import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class city implements Comparable < city> { int l1,l2,h,p; city(){ } void set(int a,int b,int c,int d){ l1 = a; l2 = b; h = c ; p = d; } public int compareTo(city a){ return this.h - a.h; } public String toString(){ return new String(" "+l1 +" "+ l2+" "+h + " "+ p+ "\n"); } } public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int x = in.nextInt(); int y = in.nextInt(); city r []= new city[n]; for(int a0 = 0; a0 < n; a0++){ int latitude = in.nextInt(); int longitude = in.nextInt(); int height = in.nextInt(); int points = in.nextInt(); r[a0]= new city(); r[a0].set(latitude,longitude,height,points); // your code goes here } Arrays.sort(r); int max = 0,sum = 0; for(int i=1;i=x && Math.abs(r[i].l2-r[i-1].l2)) } //System.out.println(Arrays.toString(r)); } }