For this Question: Given two arrays X and Y of size N each. These represent the coordinates of the points where the i<sup>th</sup> point is given by (X[i], Y[i]). You need to find K points that are closest to origin. The distance between two points is given by the Manhattan distance formula i. e. D = |x1- x2|+|y1- y2|

If there are more than two points with same distance and you need to choose among them, choose the one which appears earlier in the array. 
Print all the K points.
Note: All the coordinates are integers.First line contains two integers N and K.
Next line contains N space separated integers denoting elements of array X.
Next line contains N space separated integers denoting elements of array Y.

Constraints
1 <= K <= N <= 10^5
1 <= Xi<= 10^5
1 <= Yi<= 10^5Print K lines where each line contains two space separated integers denoting the x and y coordinate of points arranged in the order of their distance in decreasing order. If two points have same distance, print the point which has higher index before printing point with same distance of lower index.Sample Input 1:
3 1
1 2 3
5 6 7

Output 
1 5

Explanation:
Distance of Point 1 : (1+5) = 6
Distance of Point 2 : (2+6) = 8
Distance of Point 3 : (3+7) = 10
Print the first point as it is closest to origin.
 
Sample Input 2:
5 3
3 6 6 9 1
1 1 1 1 1

Output 
6 1
3 1 
1 1

Explanation
Distance of Point 1 : (3+1) = 4
Distance of Point 2 : (6+1) = 7
Distance of Point 3 : (6+1) = 7
Distance of Point 4 : (9+1) = 10
Distance of Point 5 : (1+1) = 2
Print the points 2, 1 and 5 as they are closest to origin. 
Point 2 and 3 have same distance but we choose the point which occur earlier., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] line1 = br.readLine().split(" ");
        String[] line2 =  br.readLine().split(" ");
        String[] line3 =  br.readLine().split(" ");

        int n = Integer.parseInt(line1[0]);
        int k = Integer.parseInt(line1[1]);
        int[] X = new int[line2.length];
        int[] Y = new int[line3.length];

        PriorityQueue<D> pq = new PriorityQueue<>(Collections.reverseOrder());

        for(int a=0;a<line2.length;a++){
            X[a] = Integer.parseInt(line2[a]);
            Y[a] = Integer.parseInt(line3[a]);
        }

        for(int b=0;b<line2.length;b++){
            D temp = new D(X[b]+Y[b],b);
            pq.add(temp);
            if(pq.size()>k){
                pq.remove();
            }
        }



        for(int b=0;b<k;b++){
        D temp2 = pq.remove();
        System.out.println(X[temp2.idx]+" "+Y[temp2.idx]);
        }










    }

}
class D implements Comparable<D>{
        int dis;
        int idx;

        public D(int dist, int indx){
            dis = dist;
            idx = indx;
        }

        public int compareTo(D d){
            if(this.dis > d.dis){
                return 1;
            }else if(this.dis < d.dis){
                return -1;
            }else{
                if(this.idx > d.idx){
                    return 1;
                }else{
                    return -1;
                }
            }
        }

        public String toString(){
            return this.dis+" "+this.idx+" | ";
        }
    }, In this Programming Language: Java, Now tell me if this Code is compilable or not?