@@ -0,0 +1,1555 @@
+/* paiza POH! Lite%0A* result:%0A*%0A* author: Leonardone @ NEETSDKASU%0A*/%0Aimport java.io.*;%0Aimport java.lang.*;%0Aimport java.util.*;%0A%0Aclass Main%0A%7B%0A    static byte%5B%5D buf = new byte%5B2000%5D;%0A    static int bufindex = 0;%0A   %0A    static int nextInt() %7B%0A        int n = 0;%0A        int b = (int)buf%5Bbufindex%5D;%0A        while (b %3C '0' %7C%7C b %3E '9') %7B%0A            b = (int)buf%5B++bufindex%5D;%0A        %7D%0A        while (b %3E= '0' && b %3C= '9') %7B%0A            n = n * 10 + (int)(b) - '0';%0A            b = (int)buf%5B++bufindex%5D;%0A        %7D%0A        return n;%0A    %7D%0A   %0A    static int%5B%5D%5B%5D a = new int%5B51%5D%5B500001%5D;%0A    static int%5B%5D q = new int%5B51%5D;%0A    static int%5B%5D r = new int%5B51%5D;%0A%0A    public static void main (String%5B%5D args) throws java.lang.Exception%0A    %7B%0A       %0A        int m;%0A        int n;%0A       %0A        int w = 0, p = 0;%0A       %0A        int i, j, x, y;%0A        int%5B%5D t0, t1;%0A       %0A        System.in.read(buf);%0A       %0A        m = nextInt();%0A        n = nextInt();%0A%0A        for (i = 0; i %3C n; i++) %7B%0A            q%5Bi%5D = nextInt();%0A            r%5Bi%5D = nextInt();%0A            w += q%5Bi%5D;%0A            p += r%5Bi%5D;%0A        %7D%0A        w -= m;%0A       %0A        for (i = 0; i %3C n; i++) %7B%0A            t0 = a%5Bi%5D;%0A            t1 = a%5Bi + 1%5D;%0A            for (j = 0; j %3C= w; j++) %7B%0A                if (q%5Bi%5D %3C= j) %7B%0A                    x = t0%5Bj%5D;%0A                    y = t0%5Bj - q%5Bi%5D%5D + r%5Bi%5D;%0A                    t1%5Bj%5D = (x %3E y) ? x : y;%0A                %7D else %7B%0A                    t1%5Bj%5D = t0%5Bj%5D;%0A                %7D%0A            %7D%0A        %7D%0A       %0A        System.out.println(p - a%5Bn%5D%5Bw%5D);%0A%0A    %7D%0A%7D%0A

Create no-good-answer.java