@@ -0,0 +1,2241 @@
+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 serviceLane function below.%0A    static int%5B%5D serviceLane(int%5B%5D width, int%5B%5D%5B%5D cases) %7B%0A        int n = cases.length;%0A        int%5B%5D point = new int%5Bn%5D;%0A        %0A        for(int i=0;i%3Cn;i++)%7B%0A            int start = cases%5Bi%5D%5B0%5D;%0A            int exit = cases %5Bi%5D%5B1%5D;%0A            int%5B%5D useful_cases = new int%5Bexit-start+1%5D;%0A            for(int j=0;j%3Cuseful_cases.length;j++)%7B%0A                useful_cases%5Bj%5D = width%5Bstart+j%5D;%0A            %7D%0A            //point%5Bi%5D=cases%5Bi%5D%5B1%5D-cases%5Bi%5D%5B0%5D;%0A            Arrays.sort(useful_cases);%0A            point%5Bi%5D=useful_cases%5B0%5D;%0A        %7D%0A        return point;%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 nt = scanner.nextLine().split(%22 %22);%0A%0A        int n = Integer.parseInt(nt%5B0%5D);%0A%0A        int t = Integer.parseInt(nt%5B1%5D);%0A%0A        int%5B%5D width = new int%5Bn%5D;%0A%0A        String%5B%5D widthItems = 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 widthItem = Integer.parseInt(widthItems%5Bi%5D);%0A            width%5Bi%5D = widthItem;%0A        %7D%0A%0A        int%5B%5D%5B%5D cases = new int%5Bt%5D%5B2%5D;%0A%0A        for (int i = 0; i %3C t; i++) %7B%0A            String%5B%5D casesRowItems = scanner.nextLine().split(%22 %22);%0A            scanner.skip(%22(%5Cr%5Cn%7C%5B%5Cn%5Cr%5Cu2028%5Cu2029%5Cu0085%5D)?%22);%0A%0A            for (int j = 0; j %3C 2; j++) %7B%0A                int casesItem = Integer.parseInt(casesRowItems%5Bj%5D);%0A                cases%5Bi%5D%5Bj%5D = casesItem;%0A            %7D%0A        %7D%0A%0A        int%5B%5D result = serviceLane(width, cases);%0A%0A        for (int i = 0; i %3C result.length; i++) %7B%0A            bufferedWriter.write(String.valueOf(result%5Bi%5D));%0A%0A            if (i != result.length - 1) %7B%0A                bufferedWriter.write(%22%5Cn%22);%0A            %7D%0A        %7D%0A%0A        bufferedWriter.newLine();%0A%0A        bufferedWriter.close();%0A%0A        scanner.close();%0A    %7D%0A%7D%0A

add ServiceLane.java