package no472.uso; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.util.PriorityQueue; public class Main { public static int INF = (int) 1e9; public static void main(String[] args) { IO io = new IO(); int n = io.nextInt(); int p = io.nextInt(); Problem[] a = new Problem[n]; for(int i=0;i pq = new PriorityQueue<>((p1,p2)->{ return -Integer.compare(p1.gain(), p2.gain()); }); for(int i=0;i Integer.MAX_VALUE) { throw new NumberFormatException(); } return (int) nl; } public char nextChar() { if (!hasNext()) { throw new NoSuchElementException(); } return (char) readByte(); } public double nextDouble() { return Double.parseDouble(next());} public int[] nextIntArray(int n) { int[] a = new int[n]; for(int i=0;i