For this Question: There are N pizza delivery people, they need to deliver pizzas to M customers in the town. The town is a straight line, and all the above N + M people are at distinct positions in it. The initial position of i-th pizza delivery person is P<sub>i</sub> and the initial position i-th person to whom pizza should be delivered is Q<sub>i</sub>. 
Every second, every pizza delivery person can move one unit to either the left or right, or remain stationary. Multiple pizza delivery people are permitted to occupy the same position. When a pizza delivery person occupies the same position as a customer, they can spend 0 seconds to deliver the pizza to the person.

Find the minimum time (in seconds) required to deliver pizzas to all the customers.The first line of the input contains two integers N and M.
The second line of the input contains N integers, the initial positions of the pizza delivery people.
The third and the final line of input contains M integers, the initial positions of the customers.

Constraints
1 <= N <= 200000
1 <= M <= 200000
1 <= P<sub>i</sub>, Q<sub>i</sub> <= 500,000,000Output a single integer, the minimum time required to deliver all pizzas.Sample Input
2 2 
10 20
13 16

Sample Output
4

Explanation: The 1st pizza delivery person delivers to 1st customer in 3 sec while the 2nd delivery person delivers the pizza to 2nd customer in 4 sec.

Sample Input
2 2
10 20
17 18

Sample Output
3

Explanation: The 2nd delivery person delivers to both customers. 

Sample Input
3 3
20 60 30
25 10 35

Sample Output
15

Sample Input
2 3
20 80
10 21 81

Sample Output
12, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	static int dboys,cusM;
	static long[]posOfDevBoy,posOfCust;
	public static void main (String[] args) {

		FasterIo sc = new FasterIo();

		dboys= sc.nextInt();

		cusM= sc.nextInt();

		posOfDevBoy = new long[dboys];

		posOfCust = new long[cusM];

		for(int i=0;i<dboys;i++){
			posOfDevBoy[i] = sc.nextLong();
		}

		for(int i=0;i<cusM;i++){
			posOfCust[i] = sc.nextLong();
		}

		sc.close();

		Arrays.sort(posOfDevBoy);
		Arrays.sort(posOfCust);

		System.out.println(minTimeToDeliverPizzas());

	}

	public static long minTimeToDeliverPizzas(){
		long low = 0,high = Long.MAX_VALUE,mid = 0;

		long minTime = Long.MAX_VALUE;

		while(low<=high){
			mid = low+(high-low )/2;
			if(canAllCustomerReachable(mid)){
				minTime = mid;
				high = mid-1;
			}else{
				low = mid+1;
			}
		}
		return minTime;
	}

	public static boolean canAllCustomerReachable(long totalTime){
		int k =0;
		int remainingCus = cusM;
		long dist=0;





		for(int i=0;i<dboys;i++){

			long timeForCustK = Math.abs(posOfDevBoy[i]-posOfCust[k]);
			if(posOfCust[k]<posOfDevBoy[i])
			{
				if(totalTime<timeForCustK) return false;

				dist = Math.max((totalTime-2 * timeForCustK),(totalTime-timeForCustK)/2);
			}
			else dist = totalTime;

			while(posOfDevBoy[i]+dist >= posOfCust[k]){
				if(k>=cusM-1){
					return true;
				}
				k++;

			}


		}
		return k>=cusM-1;






	}











}

class FasterIo{
	BufferedReader br;
        StringTokenizer st;

        public FasterIo()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
	int nextInt(){
		return Integer.parseInt(next());
	}
	long nextLong(){
		return Long.parseLong(next());
	}

	public void close(){
		try{
			br.close();
		}
		catch(IOException e){
			e.printStackTrace();
		}
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?