@@ -0,0 +1,2592 @@
+import java.io.*;%0Aimport java.math.*;%0Aimport java.security.*;%0Aimport java.text.*;%0Aimport java.util.*;%0Aimport java.util.concurrent.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A%0A    // Complete the workbook function below.%0A    static int workbook(int n, int k, int%5B%5D arr) %7B%0A        int last_page_of_chap = 0;%0A        int first_page_of_chap = 1;%0A        int count = 0;%0A        int first_ques_on_page = 0;%0A        int curr_page=0;%0A        for(int i=0 ; i%3Cn;i++)%7B%0A            int no_problem_in_chap = arr%5Bi%5D;%0A            int no_of_pages_in_chap = arr%5Bi%5D/k;%0A            if(arr%5Bi%5D%25k!=0) no_of_pages_in_chap++;%0A            last_page_of_chap+=no_of_pages_in_chap;%0A            int%5B%5D totl_ques_on_each_page = new int%5Bno_of_pages_in_chap%5D;%0A            int t = no_problem_in_chap;%0A            //System.out.println(k);%0A            for(int a=0;a%3Cno_of_pages_in_chap;a++)%7B%0A                t=t-k;%0A                if(t%3E=k) totl_ques_on_each_page%5Ba%5D = k;%0A                else totl_ques_on_each_page%5Ba%5D=t+k;%0A                //System.out.println(totl_ques_on_each_page%5Ba%5D);%0A            %7D%0A            for(int j=0;j%3Cno_of_pages_in_chap;j++)%7B%0A                curr_page = first_page_of_chap+j;%0A                %0A                for(int l=0;l%3Ctotl_ques_on_each_page%5Bj%5D;l++)%7B%0A                    if(first_ques_on_page+1+l==curr_page) count++;%0A                    //System.out.println(first_ques_on_page+1+l);%0A                %7D%0A                first_ques_on_page+=k+1;%0A                //System.out.println(curr_page);%0A            %7D%0A            %0A            first_page_of_chap+=no_of_pages_in_chap;%0A            curr_page=first_page_of_chap;%0A            first_ques_on_page=1;%0A            //System.out.println(i);%0A        %7D%0A        return count;%0A    %7D%0A%0A    private static final Scanner scanner = new Scanner(System.in);%0A%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv(%22OUTPUT_PATH%22)));%0A%0A        String%5B%5D nk = scanner.nextLine().split(%22 %22);%0A%0A        int n = Integer.parseInt(nk%5B0%5D);%0A%0A        int k = Integer.parseInt(nk%5B1%5D);%0A%0A        int%5B%5D arr = new int%5Bn%5D;%0A%0A        String%5B%5D arrItems = scanner.nextLine().split(%22 %22);%0A        scanner.skip(%22(%5Cr%5Cn%7C%5B%5Cn%5Cr%5Cu2028%5Cu2029%5Cu0085%5D)?%22);%0A%0A        for (int i = 0; i %3C n; i++) %7B%0A            int arrItem = Integer.parseInt(arrItems%5Bi%5D);%0A            arr%5Bi%5D = arrItem;%0A        %7D%0A%0A        int result = workbook(n, k, arr);%0A%0A        bufferedWriter.write(String.valueOf(result));%0A        bufferedWriter.newLine();%0A%0A        bufferedWriter.close();%0A%0A        scanner.close();%0A    %7D%0A%7D%0A

add LisaWorkbook.java -- DO AGAIN !