Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    void solve() throws IOException {
        int n = ni(), k = ni();
        int[] a = new int[n - 1];
        int[] b = new int[n - 1];
        for (int i = 0; i < n - 1; i++) {
            a[i] = ni() - 1;
            b[i] = ni() - 1;
        }

        Dijkstra dij = new Dijkstra(n, a, b);

        int ans = Integer.MAX_VALUE;

        if (k % 2 == 0) {
            for (int i = 0; i < n; i++) {
                int[] dist = dij.getDist(i);
                int cnt = 0;
                for (int j = 0; j < n; j++) {
                    if (dist[j] > k / 2) cnt++;
                }
                ans = Math.min(ans, cnt);
            }
        } else {
            for (int i = 0; i < n - 1; i++) {
                int[] dist1 = dij.getDist(a[i]);
                int[] dist2 = dij.getDist(b[i]);
                int cnt = 0;
                for (int j = 0; j < n; j++) {
                    if (Math.min(dist1[j], dist2[j]) > k / 2) cnt++;
                }
                ans = Math.min(ans, cnt);
            }
        }

        out.println(ans);
    }

    class Dijkstra {
        int n;
        ArrayList<ArrayList<Edge>> G;

        int INF = Integer.MAX_VALUE / 3;

        Dijkstra(ArrayList<ArrayList<Edge>> G) {
            n = G.size();
            this.G = G;
        }

        Dijkstra(int n, int[] a, int[] b) {
            this.n = n;
            G = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                G.add(new ArrayList<>());
            }

            int k = a.length;
            for (int i = 0; i < k; i++) {
                G.get(a[i]).add(new Edge(b[i], 1));
                G.get(b[i]).add(new Edge(a[i], 1));
            }
        }

        int[] getDist(int s) {
            PriorityQueue<Pair> Q = new PriorityQueue<>();
            Q.add(new Pair(s, 0));
            int[] dist = new int[n];
            Arrays.fill(dist, INF);
            boolean[] used = new boolean[n];
            while (!Q.isEmpty()) {
                Pair p = Q.poll();
                if (used[p.x]) continue;
                used[p.x] = true;
                dist[p.x] = p.y;

                for (Edge e : G.get(p.x)) {
                    Q.add(new Pair(e.to, p.y + e.cost));
                }
            }
            return dist;
        }

        class Pair implements Comparable<Pair> {
            int x, y;

            Pair(int x, int y) {
                this.x = x;
                this.y = y;
            }

            public int compareTo(Pair p) {
                return y - p.y;
            }
        }
    }

    class Edge implements Comparable<Edge> {
        int to;
        int cost;

        Edge(int to, int cost) {
            this.to = to;
            this.cost = cost;
        }

        public int compareTo(Edge edge) {
            return cost - edge.cost;
        }
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    class INA {
        int[][] a;

        INA(int n, int m) throws IOException {
            this(n, m, -1);
        }

        INA(int n, int m, int t) throws IOException {
            a = new int[m][n];

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    a[j][i] = ni() + t;
                }
            }
        }

        int[] get(int i) {
            return a[i];
        }
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Choices:
- Compile Error
- Runtime Error
- Memory Limit Exceeded
- Internal error


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni(), k = ni();
        int[] a = new int[n - 1];
        int[] b = new int[n - 1];
        for (int i = 0; i < n - 1; i++) {
            a[i] = ni() - 1;
            b[i] = ni() - 1;
        }

        int[][] d = new int[n][n];
        for (int i = 0; i < n; i++) {
            Arrays.fill(d[i], INF);
        }
        for (int i = 0; i < n; i++) {
            d[i][i] = 0;
        }
        for (int i = 0; i < n - 1; i++) {
            d[a[i]][b[i]] = d[b[i]][a[i]] = 1;
        }

        warshallFloyd(d);

        int ans = INF;

        if (k % 2 == 0) {
            for (int i = 0; i < n; i++) {
                int cnt = 0;
                for (int j = 0; j < n; j++) {
                    if (d[i][j] > k / 2) cnt++;
                }
                ans = Math.min(ans, cnt);
            }
        } else {
            for (int i = 0; i < n - 1; i++) {
                int cnt = 0;
                for (int j = 0; j < n; j++) {
                    if (Math.min(d[a[i]][j], d[b[i]][j]) > k / 2) cnt++;
                }
                ans = Math.min(ans, cnt);
            }
        }

        out.println(ans);
    }

    int INF = Integer.MAX_VALUE / 3;

    void warshallFloyd(int[][] d) {
        int n = d.length;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                for (int k = 0; k < n; k++) {
                    d[j][k] = Math.min(d[j][k], d[j][i] + d[i][k]);
                }
            }
        }
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Choices:
- Memory Limit Exceeded
- No abnormally found
- Runtime Error
- Time Limit Exceeded


Question:
import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N=in.nextInt();
        int sum=0;
        for (int i = 0; i < N; i++) {
            if (in.nextInt()%2==1) {
                sum++;
            }
        }
        if(sum%2==0) System.out.println("YES");
        else System.out.println("NO");
        }

        }

Choices:
- Compile Error
- No abnormally found
- Internal error
- Runtime Error


Question:
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] x = new int[M];
        int[] y = new int[M];
        for (int i = 0; i < M; ++i) {
            x[i] = sc.nextInt() - 1;
            y[i] = sc.nextInt() - 1;
        }
        boolean[] memo = new boolean[N];
        memo[0] = true;
        int[] count = new int[N];
        Arrays.fill(count, 1);

        for (int i = 0; i < M; ++i) {
            --count[x[i]];
            ++count[y[i]];
            if (memo[x[i]]) {
                memo[y[i]] = true;
                if (count[i] == 0) {
                    memo[x[i]] = false;
                }
            }
        }
        int ans = 0;
        for (int i = 0; i < N; ++i) {
            if (memo[i] && count[i] > 0) {
                ++ans;
            }
        }
        _out.println(ans);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Choices:
- Compile Error
- No abnormally found
- Runtime Error
- Memory Limit Exceeded


Question:
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            final int n = in.nextInt();
            final int N = n * n;
            final int[] res = new int[N + 1];
            boolean[] check = new boolean[N + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                res[a] = i + 1;
                check[a] = true;
            }
            int sum = 0;
            for (int i = 1; i <= N; ++i) {
                if (res[i] > 0)
                    sum += res[i];
                if (i < sum) {
                    out.println("No");
                    return;
                }
            }

            sum = 0;
            for (int i = N; i > 0; --i) {
                if (res[i] > 0)
                    sum += n - res[i];
                if ((N - i + 1) < sum) {
                    out.println("No");
                    return;
                }
            }

            List<Integer> order = new ArrayList<>();
            for (int i = 1; i<=N; ++i) {
                if (res[i] > 0) order.add(res[i]);
            }
            int pos = 0;
            int cnt = order.get(0) - 1;
            outerloop:
            for (int i =1 ; i <=N; ++i) {
                if (res[i] > 0) continue;
                while (cnt == 0) {
                    pos++;
                    if (pos >= order.size()) break outerloop;
                    cnt = order.get(pos) - 1;
                }
                res[i] = order.get(pos);
                cnt--;
            }

            pos = order.size() - 1;
            cnt = n - order.get(order.size() - 1);
            outerloop1:
            for (int i = N; i > 0; --i) {
                if (res[i] > 0) continue;
                while (cnt == 0) {
                    pos--;
                    if (pos < 0) break outerloop1;
                    cnt = n - order.get(pos);
                }
                res[i] = order.get(pos);
                cnt--;
            }
            int[] freq = new int[n + 1];
            for (int i = 1; i <= N; ++i) {
//                if (res[i] == 0) call();
                freq[res[i]]++;
                if (!check[i]) continue;
                if (freq[res[i]] != res[i])
                    call();
            }

            out.println("Yes");
            for (int i = 1; i <= N; ++i) {
                if (i > 1) out.print(" ");
                out.print(res[i]);
            }
            out.println();

        }

        private void call() {
            throw new RuntimeException();
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

Choices:
- Runtime Error
- No abnormally found
- Compile Error
- Internal error


Question:
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            final int n = in.nextInt();
            final int N = n * n;
            final int[] res = new int[N + 1];
            boolean[] check = new boolean[N + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                res[a] = i + 1;
                check[a] = true;
            }
            int sum = 0;
            for (int i = 1; i <= N; ++i) {
                if (res[i] > 0)
                    sum += res[i];
                if (i < sum) {
                    out.println("No");
                    return;
                }
            }

            sum = 0;
            for (int i = N; i > 0; --i) {
                if (res[i] > 0)
                    sum += n - res[i];
                if ((N - i + 1) < sum) {
                    out.println("No");
                    return;
                }
            }

            List<Integer> order = new ArrayList<>();
            for (int i = 1; i<=N; ++i) {
                if (res[i] > 0) order.add(res[i]);
            }
            int pos = 0;
            int cnt = order.get(0) - 1;
            outerloop:
            for (int i =1 ; i <=N; ++i) {
                if (res[i] > 0) continue;
                while (cnt == 0) {
                    pos++;
                    if (pos >= order.size()) break outerloop;
                    cnt = order.get(pos) - 1;
                }
                res[i] = order.get(pos);
                cnt--;
            }

            pos = order.size() - 1;
            cnt = n - order.get(order.size() - 1);
            outerloop1:
            for (int i = N; i > 0; --i) {
                if (res[i] > 0) continue;
                while (cnt == 0) {
                    pos--;
                    if (pos < 0) break outerloop1;
                    cnt = n - order.get(pos);
                }
                res[i] = order.get(pos);
                cnt--;
            }
            int[] freq = new int[n + 1];
            for (int i = 1; i <= N; ++i) {
                if (res[i] == 0) call();
                freq[res[i]]++;
                if (!check[i]) continue;
                if (freq[res[i]] != res[i])
                    call();
            }

            out.println("Yes");
            for (int i = 1; i <= N; ++i) {
                if (i > 1) out.print(" ");
                out.print(res[i]);
            }
            out.println();

        }

        private void call() {
            throw new RuntimeException();
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

Choices:
- Time Limit Exceeded
- No abnormally found
- Memory Limit Exceeded
- Runtime Error


Question:
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            final int n = in.nextInt();
            final int N = n * n;
            final int[] res = new int[N + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                res[a] = i + 1;
            }
            int sum = 0;
            for (int i = 1; i <= N; ++i) {
                if (res[i] > 0)
                    sum += res[i];
                if (i < sum) {
                    out.println("No");
                    return;
                }
            }

            sum = 0;
            for (int i = N; i > 0; --i) {
                if (res[i] > 0)
                    sum += n - res[i];
                if ((N - i + 1) < sum) {
                    out.println("No");
                    return;
                }
            }
            call();

            List<Integer> order = new ArrayList<>();
            for (int i = 1; i<=N; ++i) {
                if (res[i] > 0) order.add(res[i]);
            }
            int pos = 0;
            int cnt = order.get(0) - 1;
            outerloop:
            for (int i =1 ; i <=N; ++i) {
                if (res[i] > 0) continue;
                while (cnt == 0) {
                    pos++;
                    if (pos >= order.size()) break outerloop;
                    cnt = order.get(pos) - 1;
                }
                res[i] = order.get(pos);
                cnt--;
            }
            pos = order.size() - 1;
            cnt = n - order.get(order.size() - 1);
            outerloop1:
            for (int i = N; i > 0; --i) {
                if (res[i] > 0) continue;
                while (cnt == 0) {
                    pos--;
                    if (pos < 0) break outerloop1;
                    cnt = n - order.get(pos);
                }
                res[i] = order.get(pos);
                cnt--;
            }

            out.println("Yes");
            for (int i = 1; i <= N; ++i) {
                if (i > 1) out.print(" ");
                out.print(res[i]);
            }
            out.println();

        }

        private void call() {
            throw new RuntimeException();
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

Choices:
- Compile Error
- No abnormally found
- Runtime Error
- Time Limit Exceeded


Question:
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            final int n = in.nextInt();
            final int N = n * n;
            final int[] res = new int[N + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                res[a] = i + 1;
            }
            throw new RuntimeException();
//            int sum = 0;
//            for (int i = 1; i <= N; ++i) {
//                if (res[i] > 0)
//                    sum += res[i];
//                if (i < sum) {
//                    out.println("No");
//                    return;
//                }
//            }
//
//            sum = 0;
//            for (int i = N; i > 0; --i) {
//                if (res[i] > 0)
//                    sum += n - res[i];
//                if ((N - i + 1) < sum) {
//                    out.println("No");
//                    return;
//                }
//            }
//
//            List<Integer> order = new ArrayList<>();
//            for (int i = 1; i<=N; ++i) {
//                if (res[i] > 0) order.add(res[i]);
//            }
//            int pos = 0;
//            int cnt = order.get(0) - 1;
//            outerloop:
//            for (int i =1 ; i <=N; ++i) {
//                if (res[i] > 0) continue;
//                while (cnt == 0) {
//                    pos++;
//                    if (pos >= order.size()) break outerloop;
//                    cnt = order.get(pos) - 1;
//                }
//                res[i] = order.get(pos);
//                cnt--;
//            }
//            pos = order.size() - 1;
//            cnt = n - order.get(order.size() - 1);
//            outerloop1:
//            for (int i = N; i > 0; --i) {
//                if (res[i] > 0) continue;
//                while (cnt == 0) {
//                    pos--;
//                    if (pos < 0) break outerloop1;
//                    cnt = n - order.get(pos);
//                }
//                res[i] = order.get(pos);
//                cnt--;
//            }
//
//            out.println("Yes");
//            for (int i = 1; i <= N; ++i) {
//                if (i > 1) out.print(" ");
//                out.print(res[i]);
//            }
//            out.println();

        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

Choices:
- Memory Limit Exceeded
- No abnormally found
- Internal error
- Runtime Error


Question:
import java.io.BufferedReader;
    import java.io.InputStreamReader;

    public class Main {
    	public static void main(String[] args) throws Exception {
    		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    		String[] sa = br.readLine().split(" ");
    		int i = Integer.parseInt(sa[0]);
    		int o = Integer.parseInt(sa[1]);
    		int j = Integer.parseInt(sa[3]);
    		int l = Integer.parseInt(sa[4]);
    		br.close();

    		long ans = o;
    		while ((j>=0) && (l>=0) && (i>=0)) {
    			ans += 3;
    			i--;
    			j--;
    			l--;
    		}

          if(j==0 && l%2==1 && i%2==1){
            ans +=1;
          }
          if(l==0 && j%2==1 && i%2==1){
            ans +=1;
          }
          if(i=0 && l%2==1 && i%2==1){
            ans +=1;
          }

    		ans += i / 2 * 2;
    		ans += j / 2 * 2;
    		ans += l / 2 * 2;
    		System.out.println(ans);
    	}
    }

Choices:
- Time Limit Exceeded
- Memory Limit Exceeded
- Internal error
- Compile Error


Question:
    import java.io.BufferedReader;
    import java.io.InputStreamReader;

    public class Main {
    	public static void main(String[] args) throws Exception {
    		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    		String[] sa = br.readLine().split(" ");
    		int i = Integer.parseInt(sa[0]);
    		int o = Integer.parseInt(sa[1]);
    		int j = Integer.parseInt(sa[3]);
    		int l = Integer.parseInt(sa[4]);
    		br.close();

    		long ans = o;
    		while (j>=0 && l>=0 && i>=0) {
    			ans += 3;
    			i--;
    			j--;
    			l--;
    		}

          if((j==0 && l%2==1 && i%2==1)||(l==0 && j%2==1 && i%2==1)||(i=0 && l%2==1 && i%2==1)){
            ans +=1;
          }

    		ans += i / 2 * 2;
    		ans += j / 2 * 2;
    		ans += l / 2 * 2;
    		System.out.println(ans);
    	}
    }

Choices:
- Memory Limit Exceeded
- Internal error
- No abnormally found
- Compile Error


Question:
public class Main {

	public static void main(String[] args) {
		Scanner console = new Scanner(System.in);
		int n = console.nextInt();		//number of boxes
		int m = console.nextInt();		//number of operations
		console.nextLine();
int[] numBalls = new int[n];
		boolean[] couldHaveRed = new boolean[n];
		//intialize boxes
		for(int i = 0; i < n; i++) {
			numBalls[i] = 1;
			couldHaveRed[i] = false;
		}
		couldHaveRed[0] = true;

		for(int i = 0; i < m; i++) {
			int box1 = console.nextInt() - 1;	//to adjust for zero indexing
			int box2 = console.nextInt() - 1;
			console.nextLine();

			//if could have red ball
			if(couldHaveRed[box1]) {
				couldHaveRed[box2] = true;
				numBalls[box2]++;		//box 2 gains a ball
				numBalls[box1]--;		//box 1 loses a ball
				if(numBalls[box1] == 0)
					couldHaveRed[box1] = false;
			}
		}

		int numPossible = 0;
		for(int i = 0; i < n; i++)
			if(couldHaveRed[i])
				numPossible++;
		System.out.println(numPossible);

	}
}

Choices:
- No abnormally found
- Compile Error
- Memory Limit Exceeded
- Time Limit Exceeded


Question:
import java.util.Scanner;
public class BoxAndBall {

	public static void main(String[] args) {
		Scanner console = new Scanner(System.in);
		int n = console.nextInt();		//number of boxes
		int m = console.nextInt();		//number of operations
		console.nextLine();

		int[][] boxInfo = new int[n][2];	//of 2, first is total count, second is 0 if no red, 1 if possible
		//boxInfo[n][0] gives total balls
		//boxInfo[n][1] gives possibility of red

		//intialize boxes
		for(int i = 0; i < n; i++) {
			if(i == 0)
				boxInfo[0][1] = 1;
			else
				boxInfo[i][1] = 0;
			boxInfo[i][0] = 1;
		}

		for(int i = 0; i < m; i++) {
			int box1 = console.nextInt() - 1;	//to adjust for zero indexing
			int box2 = console.nextInt() - 1;
			console.nextLine();

			//if could have red ball
			if(boxInfo[box1][1] == 1) {
				//if only one ball in box, and ball is taken out, no longer possible
				if(boxInfo[box1][0] == 1) {
					boxInfo[box1][1] = 0;
				}
				boxInfo[box2][1] = 1;	//possible for box 2 to have red ball
				boxInfo[box2][0]++;		//box 2 gains a ball
				boxInfo[box1][0]--;		//box 1 loses a ball
			}
		}

		//loop thru and count how many 1's in pos 1 of the array in each box
		int numPossible = 0;
		for(int i = 0; i < n; i++)
			if(boxInfo[i][1] == 1) //if possible
				numPossible++;

		System.out.println(numPossible);

	}
}

Choices:
- Compile Error
- Runtime Error
- Internal error
- Memory Limit Exceeded


Question:
Scanner console = new Scanner(System.in);
		int n = console.nextInt();		//number of boxes
		int m = console.nextInt();		//number of operations
		console.nextLine();

		int[][] boxInfo = new int[n][2];	//of 2, first is total count, second is 0 if no red, 1 if possible
		//boxInfo[n][0] gives total balls
		//boxInfo[n][1] gives possibility of red

		//intialize boxes
		for(int i = 0; i < n; i++) {
			if(i == 0)
				boxInfo[0][1] = 1;
			else
				boxInfo[i][1] = 0;
			boxInfo[i][0] = 1;
		}

		for(int i = 0; i < m; i++) {
			int box1 = console.nextInt() - 1;	//to adjust for zero indexing
			int box2 = console.nextInt() - 1;
			console.nextLine();

			//if could have red ball
			if(boxInfo[box1][1] == 1) {
				//if only one ball in box, and ball is taken out, no longer possible
				if(boxInfo[box1][0] == 1) {
					boxInfo[box1][1] = 0;
				}
				boxInfo[box2][1] = 1;	//possible for box 2 to have red ball
				boxInfo[box2][0]++;		//box 2 gains a ball
				boxInfo[box1][0]--;		//box 1 loses a ball
			}
		}

		//loop thru and count how many 1's in pos 1 of the array in each box
		int numPossible = 0;
		for(int i = 0; i < n; i++)
			if(boxInfo[i][1] == 1) //if possible
				numPossible++;

		System.out.println(numPossible);

Choices:
- No abnormally found
- Compile Error
- Time Limit Exceeded
- Internal error


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int n;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();

		System.out.println(n%2==0 ? n/2:(n/2)+1);

	}

}

Choices:
- No abnormally found
- Compile Error
- Memory Limit Exceeded
- Runtime Error


Question:
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int n,m;
		String num = new String();
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();m=sc.nextInt();
		int[] s = new int[m];
		int[] c = new int[m];

		for(int i = 0; i < m; i++) {
			s[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}

		for(int i = 0 ; i < 1000; i++) {//1to1000までの数
			String temp = String.valueOf(i);
			if(temp.length() !=n) {//桁数と要求されたのが違うとき
				continue;
			}
			for(int j = 0; j < m; j++) {
				if(temp.charAt(s[j]-1)-'0'!=c[j]) {
					break;
				}else {
					if(j == m -1) {
						System.out.println(i);
						return;
					}
				}
			}
		}

		if(m == 0&&n==1) {
			System.out.println(0);
			return;
		}
		if(m == 0&&n==2) {
			System.out.println(10);
			return;
		}
		if(m == 0&&n==3) {
			System.out.println(100);
			return;
		}
		System.out.println(-1);
		return;

	}

}

Choices:
- Compile Error
- Time Limit Exceeded
- No abnormally found
- Runtime Error


Question:
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);

		double a=sc.nextDouble();
		double b=sc.nextDouble();
		double n=sc.nextDouble();

		double x=Math.min(b-1,n);

		System.out.println((long)(Math.floor((a*x)/b)-a*Math.floor(x/b)));

	}

}

Choices:
- Time Limit Exceeded
- No abnormally found
- Memory Limit Exceeded
- Compile Error


Question:
import java.util.*;

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

		//long startTime = System.currentTimeMillis();

		Scanner sc=new Scanner(System.in);

		int n=sc.nextInt();
		int m=sc.nextInt();
		String str=sc.next();
		char[] c=str.toCharArray();
		//char[] c=new char[n+1];

		/*for(int i=0;i<tmparray.length;i++){
			c[i]=tmparray[n-i];
		}*/

		int c1=0;

		StringBuilder ans=new StringBuilder();

		//Case unsolvable
		for(char ch:c){
			if(ch=='1'){
				c1++;
				if(c1>=m){
					System.out.println("-1");
					System.exit(0);

				}
			}else{
				c1=0;
			}
		}

		//case solvable

		int index=0;
		for(int i=m;i>0;i--){
			if((index+i)==c.length-1){
				ans.insert(0," ");
				ans.insert(0,i);
				break;
			}else if((index+i)>=c.length){
				continue;
			}
			if(c[n-index-i]=='1'){
				continue;
			}else{
				if(ans==null)ans.append(i);
				else{
					ans.insert(0," ");
					ans.insert(0,i);
				}
				index=index+i;
				i=m+1;
			}
		}

		System.out.println(ans);
		//long endTime = System.currentTimeMillis();
		//System.out.println("処理時間：" + (endTime - startTime) + " ms");
		}

}

Choices:
- Compile Error
- Time Limit Exceeded
- No abnormally found
- Runtime Error


Question:
import java.util.*;

public class Main {
	public static void main (String[] args){
		Scanner sc= new Scanner(System.in);
		double T=sc.nextDouble();
		double X=sc.nextDouble();

		double ans=T/X;

		System.out.println(String.format("%.10f", ans));
	}

}

Choices:
- Time Limit Exceeded
- Internal error
- No abnormally found
- Memory Limit Exceeded


Question:
import java.util.*;

class Main {
	public static void main (String args[]){
		 Scanner scan = new Scanner(System.in);
		 int N = scan.nextInt();

		 if(N==1){
			 System.out.println("Hello World");
		 }

		 if(N==2){
			 int A = scan.nextInt();
			 int B = scan.nextInt();

			 System.out.println(A+B);
		 }
	 }
}

Choices:
- Internal error
- No abnormally found
- Memory Limit Exceeded
- Compile Error


Question:
import java.util.*;

class Main {
	public static void main (String args[]){
		 Scanner scan = new Scanner(System.in);
		 int N = scan.nextInt();

		 if(N==1){
			 System.out.println("Hello World");
		 }

		 if(N==2){
			 int A = scan.nextInt();
			 int B = scan.nextInt();

			 System.out.println(A+B);
		 }
	 }
}

Choices:
- Compile Error
- Time Limit Exceeded
- Runtime Error
- No abnormally found


Question:
import java.util.*;

class Main {
	public static void main (String args[]){
		 Scanner scan = new Scanner(System.in);
		 int N = scan.nextInt();

		 if(N==1){
			 System.out.println("Hello World");
		 }

		 if(N==2){
			 int A = scan.nextInt();
			 int B = scan.nextInt();

			 System.out.println(A+B);
		 }
	 }
}

Choices:
- Memory Limit Exceeded
- Runtime Error
- No abnormally found
- Compile Error


Question:
import java.util.*;
public class Main {
 public static void main(String[] args){

	 Scanner scan = new Scanner(System.in);

	 int n = scan.nextInt();

	 int x[] = new int[n];
	 int y[] = new int[n];
	 int h[] = new int[n];

	 for(int i=0; i<n; i++){
		 x[i]=scan.nextInt();
		 y[i]=scan.nextInt();
		 h[i]=scan.nextInt();

	 }

	 boolean flag = false;

	 int cx=0;
	 int cy=0;
	 int ch=0;

	 for(int X=0; X<101; X++){
		 if(flag == true)break;
		 for(int Y=0; Y<101; Y++){
			 if(flag == true)break;
			 int H=0;

			 for(int i=0;i<n;i++){
			  if(h[i]>0){
				  H=h[i]+Math.abs(x[i]-X)+Math.abs(y[i]-Y);
				  break;
			  }

			 }
			 for(int i=0; i<n; i++){

				 if(h[i]!=Math.max(H-Math.abs(x[i]-X)-Math.abs(y[i]-Y),0)){
					 flag=false;
					 break;
				 }else{
					 cx = X;
					 cy = Y;
					 ch = H;
					 flag = true;
				 }
		     }
	     }
	 }

	 System.out.println(cx + " " + cy + " "+ ch);

  }
}

Choices:
- Time Limit Exceeded
- Runtime Error
- No abnormally found
- Memory Limit Exceeded


Question:
import java.util.Arrays;
import java.util.Scanner;
class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextInt();
		long[] arr=new long[(int)n];
		long[] arr1=new long[(int)n];
		Arrays.fill(arr, 0);
		Arrays.fill(arr1, 0);
		arr[0]=sc.nextInt();
		arr[0]=arr[0];
		long sum=0;
		for(int i=1;i<n;i++)
		{
			arr[i]=sc.nextInt();
			arr1[i]=arr1[i-1]+arr[i];
		}

		long num=(int)(Math.pow(10, 9))+7;
		for(int i=0;i<n;i++)
		{
			sum+=(((arr1[(int)n-1]-arr1[(int)i])%num)*arr[(int)i])%num;
		}
		System.out.println(sum%num);
	}

}

Choices:
- Time Limit Exceeded
- Runtime Error
- No abnormally found
- Compile Error


Question:
import java.util.Arrays;
import java.util.Scanner;
class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextInt();
		long[] arr=new long[(int)n];
		long[] arr1=new long[(int)n];
		Arrays.fill(arr, 0);
		Arrays.fill(arr1, 0);
		arr[0]=sc.nextInt();
		arr[0]=arr[0];
		long sum=0;
		for(int i=1;i<n;i++)
		{
			arr[i]=sc.nextInt();
			arr1[i]=arr1[i-1]+arr[i];
		}

		long num=(int)(Math.pow(10, 9))+7;
		for(int i=0;i<n;i++)
		{
			sum+=(((arr1[(int)n-1]-arr1[(int)i])%num)*arr[(int)i])%num;
		}
		System.out.println(sum%num);
	}

}

Choices:
- No abnormally found
- Internal error
- Memory Limit Exceeded
- Compile Error


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		System.out.println((int)Math.ceil((double)n/2));
	}

}

Choices:
- Memory Limit Exceeded
- No abnormally found
- Runtime Error
- Internal error


Question:
import java.util.*;
	class Main{
      public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        int n = 1+x-k;
        for(int i = 0;i < 2*k-1; i++){
          System.out.println(n+i);
        }
      }
    }

Choices:
- No abnormally found
- Internal error
- Time Limit Exceeded
- Compile Error


Question:
import java.util.*;
	class Main{
      public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        int n = 1+x-k;
        for(int i = 0;i < 2*k-1; i++){
          System.out.println(n+i);
        }
      }
    }

Choices:
- Time Limit Exceeded
- Memory Limit Exceeded
- Internal error
- No abnormally found


Question:
import java.util.*;
	class Main{
      public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        int n = 1+x-k;
        for(int i = 0;i < 2*k-1; i++){
          System.out.println(n+i);
        }
      }
    }

Choices:
- No abnormally found
- Compile Error
- Time Limit Exceeded
- Memory Limit Exceeded


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	}
}

Choices:
- Time Limit Exceeded
- No abnormally found
- Runtime Error
- Compile Error


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		char[] c = s.toCharArray();
		for(int i = 0; i < k; i++) {
			if(c[i]!='1') {
				System.out.println(c[i]);
				System.exit(0);
			}
		}System.out.println('1');
	}
}

Choices:
- No abnormally found
- Compile Error
- Runtime Error
- Internal error


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		char[] c = s.toCharArray();
		for(int i = 0; i < k; i++) {
			if(c[i]!='1') {
				System.out.println(c[i]);
				System.exit(0);
			}
		}System.out.println('1');
	}
}

Choices:
- Internal error
- Runtime Error
- No abnormally found
- Compile Error


Question:
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int[] odd=new int[1000001];
        int[] even=new int[1000001];
        for(int i=0;i<odd.length;i++){
            odd[i]=0; even[i]=0;
        }
        for(int i=0;i<n;i++){
            if(i%2==0){
                even[sc.nextInt()]++;
            }
            else{
                odd[sc.nextInt()]++;
            }
        }
        int odd1=0; int odd1_idx=0; int odd2=0; int odd2_idx=0;
        int even1=0; int even1_idx=0; int even2=0; int even2_idx=0;
        for(int i=1;i<1000001;i++){
            if(odd[i]>odd1){
                odd2_idx=odd1_idx; odd2=odd1;
                odd1_idx=i; odd1=odd[i];
            }
            else if(odd[i]>odd2){
                odd2_idx=i; odd2=odd[i];
            }
            if(even[i]>even1){
                even2_idx=even1_idx; even2=even1;
                even1_idx=i; even1=even[i];
            }
            else if(even[i]>even2){
                even2_idx=i; even2=even[i];
            }
        }
        if(odd1==n/2 && even1==n/2 && odd1_idx!=even1_idx){
            System.out.println(0);
        }
        else if(odd1==n/2 && even1==n/2 && odd1_idx==even1_idx){
            System.out.println(n/2);
        }
        else if(odd1==n/2 || even1==n/2){
            int out=odd1==n/2 ? n/2-even1 : n/2-odd1;
            System.out.println(out);
        }
        else if(odd1_idx!=even1_idx){
            System.out.println(n-odd1-even1);
        }
        else{
            if(odd1-odd2>even1-even2)
                System.out.println(n-even2-odd1);
            else
                System.out.println(n-odd2-even1);
        }
    }
}

Choices:
- Internal error
- No abnormally found
- Time Limit Exceeded
- Memory Limit Exceeded


Question:
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        String S = sc.nextLine();
        long K = sc.nextLong();
        int notone=-1;
        int notoneindex=-1;
        int[] arr=new int[100];
        for(int i=0;i<S.length();i++){
            arr[i]=S.charAt(i)-'0';
        }
        for(int i=0;i<S.length();i++){
            if(arr[i]!=1){
                notone=arr[i];
                notoneindex=i;
                break;
            }
        }
        if(notone==-1){
            System.out.println("1");
        }else if(K<=notoneindex){
            System.out.println("1");
        }else{
            System.out.println(notone);
        }
    }
}

Choices:
- Memory Limit Exceeded
- Compile Error
- Internal error
- No abnormally found


Question:
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //置き換え回数カウント用変数の宣言
        int count = 0;
        //文字列の取得
        String strS= sc.next();
        String strT = sc.next();

        for(int i=0; i<strS.length(); ++i){
            //SとTの各文字が一致しないとき、置き換えに必要な回数をカウントする
            if(strS.charAt(i) != strT.charAt(i)){
                ++count;
            }
        }
        System.out.println(count);
    }
}

Choices:
- No abnormally found
- Memory Limit Exceeded
- Internal error
- Runtime Error


Question:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }

	//フィールド
    Scanner sc;
    String N;

    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.next();
    }

    //解答処理
    private String solve() {
        String answer = "No";
        String[] list = N.split("");

        for (int i=0; i<N.length(); i++) {
        	if (list[i].equals("7")) {
        		answer = "Yes";
        		break;
        	}
        }

        return answer;
    }

    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}

Choices:
- Runtime Error
- Compile Error
- No abnormally found
- Time Limit Exceeded


Question:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }

	//フィールド
    Scanner sc;
    int N;
    int K;

    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.K = sc.nextInt();
    }

    //解答処理
    private int solve() {
        int answer = 0;
        //NをK進数に変換する
        String num = Integer.toString(N, K);
        answer = num.length();
        return answer;
    }

    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

}

Choices:
- Time Limit Exceeded
- Memory Limit Exceeded
- Internal error
- No abnormally found


Question:
import java.util.*;

public class Main {
    public static void main(String args[]) {
       //値の取得
       Scanner sc = new Scanner(System.in);
       long N = sc.nextLong();
       double root = Math.sqrt(N); //Nの平方根
       long a = 1;    //N(a,b)
       long b;
       long count = 0;    //到達に必要な移動回数

       //到達するまで移動を繰り返す
       while(a <= root) {
           if(N % a == 0) {
               b = N / a;    //N = a * b
               if(a + b - 2 < count || count == 0) {
                  count = a + b - 2;
               }
           }
           ++a;
       }

       //出力
       System.out.println(count);
    }
}

Choices:
- Runtime Error
- No abnormally found
- Memory Limit Exceeded
- Compile Error


Question:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        //値を取得
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for (int i = 0; i < n; ++i){
            p[i] = sc.nextInt();
        }

        int count = 0;   //カウント用の変数
        //条件を満たすものをカウント
        for (int i = 0; i < (n-2); ++i){ //要素数がn個の配列に対し、n-2回調べる
            if (p[i] < p[i+1] && p[i+1] < p[i+2] || p[i] > p[i+1] && p[i+1] > p[i+2]){
                ++count;
            }
        }

        //出力
        System.out.println(count);

    }
}

Choices:
- Time Limit Exceeded
- Compile Error
- No abnormally found
- Internal error


Question:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        //値を取得
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for (int i = 0; i < n; ++i){
            p[i] = sc.nextInt();
        }

        int count = 0;   //カウント用の変数
        //条件を満たすものをカウント
        for (int i = 0; i < (n-2); ++i){ //要素数がn個の配列に対し、n-2回調べる
            if (p[i] < p[i+1] && p[i+1] < p[i+2] || p[i] > p[i+1] && p[i+1] > p[i+2]){
                ++count;
            }
        }

        //出力
        System.out.println(count);

    }
}

Choices:
- Time Limit Exceeded
- Compile Error
- No abnormally found
- Memory Limit Exceeded


Question:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }

	//フィールド
    Scanner sc;
    int N;

    //入力
    Main(Scanner sc) {
        this.sc = sc;
        N = sc.nextInt();
    }

    //解答処理
    private int solve() {
    	int answer = 0;
        int count = 0;

        for (int i=1; i<=N; i+=2) {
        	count = divisorCount(i);
        	if (count == 8) {
        		answer++;
        	}
        }

        return answer;
    }

    //約数の個数を返すメソッド
    private int divisorCount(int num) {
    	int count = 0;

    	for (int i=1; i<=num; i++) {
    		if (num % i == 0) {
    			count++;
    		}
    	}

    	return count;

    }

    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

}

Choices:
- No abnormally found
- Runtime Error
- Time Limit Exceeded
- Compile Error


Question:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }

	//フィールド
    Scanner sc;
    int R;

    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.R = sc.nextInt();
    }

    //解答処理
    private String solve() {
        String answer = "ABC";

        if (1200 <= R && R < 2800) {
        	answer = "ARC";
        } else if (2800 <= R) {
        	answer = "AGC";
        }

        return answer;
    }

    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}

Choices:
- Time Limit Exceeded
- No abnormally found
- Runtime Error
- Compile Error


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        if (A >= 13)
            System.out.println(B);
        else if (A >= 6)
            System.out.println(B/2);
        else
            System.out.println(0);
    }
}

Choices:
- Runtime Error
- No abnormally found
- Internal error
- Compile Error


Question:
import java.util.*;

public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long lcm = lcm(c, d);

        long result = (b-a+1)-b/c+(a-1)/c-b/d+(a-1)/d+b/lcm-(a-1)/lcm;

        System.out.println(result);

    }

    //最大公約数
    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

Choices:
- Memory Limit Exceeded
- No abnormally found
- Runtime Error
- Time Limit Exceeded


Question:
import java.util.*;

public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long lcm = lcm(c, d);

        long result = (b-a+1)-b/c+(a-1)/c-b/d+(a-1)/d+b/lcm-(a-1)/lcm;

        System.out.println(result);

    }

    //最大公約数
    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

Choices:
- Internal error
- Memory Limit Exceeded
- Time Limit Exceeded
- No abnormally found


Question:
import java.util.*;

public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long lcm = lcm(c, d);

        long result = (b-a+1)-b/c+(a-1)/c-b/d+(a-1)/d+b/lcm-(a-1)/lcm;

        System.out.println(result);

    }

    //最大公約数
    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

Choices:
- Time Limit Exceeded
- No abnormally found
- Internal error
- Runtime Error


Question:
import java.util.*;

public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Work> list = new ArrayList<>();
        for(int tmp = 0; tmp < n;tmp++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            Work work = new Work(a,b);
            list.add(work);
        }

        Collections.sort(list, new Comparator<Work>() {
            @Override
            public int compare(Work obj0, Work obj1) {
                if(obj0.time < obj1.time){
                    return -1;
                }else if(obj0.time > obj1.time){
                    return 1;
                }else{
                    return 0;
                }
            }
        });
        boolean result = true;
        long time = 0;
        for(int tmp = 0;tmp < n; tmp++){
            Work work = list.get(tmp);
            time += work.cost;
            if(time > work.time){
                result = false;
                break;
            }
        }

        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

    }

    //最大公約数
    static class Work {
        public int cost;
        public int time;

        public Work(int a,int b){
            this.cost = a;
            this.time = b;
        }

    }
}

Choices:
- Memory Limit Exceeded
- Runtime Error
- Time Limit Exceeded
- No abnormally found


Question:
import java.util.*;

public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        int l = 0;
        int r = INF;
        for(int tmp = 0; tmp< m; tmp++){
            int x = sc.nextInt();
            l = Math.max(x,l);
            int y = sc.nextInt();
            r = Math.min(y,r);
        }

        System.out.println(l <= r ? r - l + 1 : 0);
    }
}

Choices:
- Compile Error
- No abnormally found
- Memory Limit Exceeded
- Runtime Error


Question:
import java.util.*;

public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        int l = 0;
        int r = INF;
        for(int tmp = 0; tmp< m; tmp++){
            int x = sc.nextInt();
            l = Math.max(x,l);
            int y = sc.nextInt();
            r = Math.min(y,r);
        }

        System.out.println(l <= r ? r - l + 1 : 0);
    }
}

Choices:
- Memory Limit Exceeded
- Compile Error
- No abnormally found
- Time Limit Exceeded


Question:
import java.util.*;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		list.add(a);
		list.add(b);
		list.add(c);
		list.add(d);
		list.add(e);

		List<Integer> nlist = new ArrayList<Integer>();

		nlist.add(a);
		nlist.add(b);
		nlist.add(c);
		nlist.add(d);
		nlist.add(e);

		list = list.stream().map(s -> s % 10).collect(Collectors.toList());
		int min = list.stream().filter(s -> s != 0).min(Comparator.naturalOrder()).orElse(0);
		int minval = nlist.get(list.indexOf(min));
		nlist.remove(list.indexOf(min));
		List<Double> n2list = nlist.stream().map(s -> (double)s/10).map(s -> Math.ceil(s)).map(s -> s * 10).collect(Collectors.toList());

		double result = 0;
		for(double s :n2list) {
			result += s;
		}
		result += minval;
		int result1 = (int)result;
		System.out.println(result1);

	}
}

Choices:
- Memory Limit Exceeded
- Time Limit Exceeded
- No abnormally found
- Internal error


Question:
import java.util.Scanner;
class Main {
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
     System.out.println((A + B)%2 == 0 ? (A + B)/2 : "IMPOSSIBLE");
  }
}

Choices:
- Time Limit Exceeded
- Internal error
- No abnormally found
- Runtime Error


Question:
import java.util.Scanner;

class Main {
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int max = 0;
    int sum = 0;
    while(sc.hasNext()){
      int newone = sc.nextInt();
      if(newone > max){
        max = newone;
      }
      sum = sum + newone;
    }
    sum = sum - max;
    System.out.println(max < sum ? "Yes" : "No");
  }
}

Choices:
- Internal error
- No abnormally found
- Runtime Error
- Compile Error


Question:
import java.util.Arrays;
import java.util.Scanner;

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

		Scanner keyboard = new Scanner(System.in);

		long W  = keyboard.nextInt();
		long H  = keyboard.nextInt();
		long x  = keyboard.nextInt();
		long y  = keyboard.nextInt();

		double men = (W*H)/2.0;
		double a = x*H;
		double b = (W*H)-a;
		double c = y*W;
		double d = (W*H)-c;

		double xx = Math.min(a, b);
		double yy = Math.min(c, d);

		int hou = 0;

		if(xx == men) {
			hou ++;
		}
		if(yy == men) {
			hou ++;
		}

		if(hou <= 1) {
			hou = 0;
		}else {
			hou = 1;
		}

		System.out.print(men + " " + hou);
		keyboard.close();
	}
}

Choices:
- No abnormally found
- Compile Error
- Memory Limit Exceeded
- Internal error


Question:
import java.util.Arrays;
import java.util.Scanner;

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

		Scanner keyboard = new Scanner(System.in);

		long W  = keyboard.nextInt();
		long H  = keyboard.nextInt();
		long x  = keyboard.nextInt();
		long y  = keyboard.nextInt();

		double men = (W*H)/2.0;
		double a = x*H;
		double b = (W*H)-a;
		double c = y*W;
		double d = (W*H)-c;

		double xx = Math.min(a, b);
		double yy = Math.min(c, d);

		int hou = 0;

		if(xx == men) {
			hou ++;
		}
		if(yy == men) {
			hou ++;
		}

		if(hou <= 1) {
			hou = 0;
		}else {
			hou = 1;
		}

		System.out.print(men + " " + hou);
		keyboard.close();
	}
}

Choices:
- Time Limit Exceeded
- No abnormally found
- Memory Limit Exceeded
- Compile Error


Question:
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        System.out.println( Math.max( (Math.max(a*c,a*d)),(Math.max(b*c,b*d)) ) );
    }
}

Choices:
- Time Limit Exceeded
- No abnormally found
- Memory Limit Exceeded
- Compile Error


Question:
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int k = stdin.nextInt();
        for (int i = 1; i <= k; i++) {
            System.out.println(c(k - 1, i - 1).multiply(c(n - k + 1, i)).mod(mod).intValue());
        }
    }

    private static List<BigInteger> fct = new ArrayList<>();
    private static List<BigInteger> inv = new ArrayList<>();
    private static BigInteger mod = BigInteger.valueOf(1000000007);
    private static BigInteger c(int n, int r) {
        if (n < r) {
            return BigInteger.ZERO;
        }

        if (fct.isEmpty()) {
            fct.add(BigInteger.ONE);
            inv.add(fct.get(0).modInverse(mod));
        }

        for (int i = fct.size(); i <= n; i++) {
            fct.add(fct.get(i - 1).multiply(BigInteger.valueOf(i)).mod(mod));
            inv.add(fct.get(i).modInverse(mod));
        }

        return fct.get(n).multiply(inv.get(n - r).multiply(inv.get(r)).mod(mod)).mod(mod);
    }
}

Choices:
- Time Limit Exceeded
- Runtime Error
- No abnormally found
- Compile Error


Question:
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int k = stdin.nextInt();
        for (int i = 1; i <= k; i++) {
            System.out.println(c(k - 1, i - 1).multiply(c(n - k + 1, i)).mod(mod).intValue());
        }
    }

    private static List<BigInteger> fct = new ArrayList<>();
    private static List<BigInteger> inv = new ArrayList<>();
    private static BigInteger mod = BigInteger.valueOf(1000000007);
    private static BigInteger c(int n, int r) {
        if (n < r) {
            return BigInteger.ZERO;
        }

        if (fct.isEmpty()) {
            fct.add(BigInteger.ONE);
            inv.add(fct.get(0).modInverse(mod));
        }

        for (int i = fct.size(); i <= n; i++) {
            fct.add(fct.get(i - 1).multiply(BigInteger.valueOf(i)).mod(mod));
            inv.add(fct.get(i).modInverse(mod));
        }

        return fct.get(n).multiply(inv.get(n - r).multiply(inv.get(r)).mod(mod)).mod(mod);
    }
}

Choices:
- No abnormally found
- Runtime Error
- Time Limit Exceeded
- Memory Limit Exceeded


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        Pattern space = Pattern.compile(" ");
        int[] first = space.splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
        int n = first[0];
        int m = first[1];

        Map<Tuple, List<Tuple>> nexts = new HashMap<>();
        for (int i = 0; i < m; i++) {
            int[] line = space.splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
            int u = line[0];
            int v = line[1];
            nexts.computeIfAbsent(new Tuple(u, 0), unused -> new ArrayList<>()).add(new Tuple(v, 1));
            nexts.computeIfAbsent(new Tuple(u, 1), unused -> new ArrayList<>()).add(new Tuple(v, 2));
            nexts.computeIfAbsent(new Tuple(u, 2), unused -> new ArrayList<>()).add(new Tuple(v, 0));
        }

        int[] line = space.splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
        int s = line[0];
        int t = line[1];

        Deque<Tuple> q = new ArrayDeque<>();
        Map<Tuple, Integer> score = new HashMap<>();
        Tuple start = new Tuple(s, 0);
        q.addLast(start);
        score.put(start, 0);
        while (!q.isEmpty()) {
            Tuple current = q.pollFirst();
            if (!nexts.containsKey(current)) {
                continue;
            }

            for (Tuple next : nexts.get(current)) {
                if (score.get(current) + 1 < score.getOrDefault(next, Integer.MAX_VALUE)) {
                    score.put(next, score.get(current) + 1);
                    q.addLast(next);
                }
            }
        }

        Tuple goal = new Tuple(t, 0);
        if (score.containsKey(goal)) {
            stdout.println(score.get(goal) / 3);
        } else {
            stdout.println(-1);
        }
    }

    private static class Tuple {
        private int node;
        private int mod;

        public Tuple(int node, int mod) {
            this.node = node;
            this.mod = mod;
        }

        @Override
        public int hashCode() {
            return Objects.hash(node, mod);
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null || !(obj instanceof Tuple)) {
                return false;
            }

            Tuple other = (Tuple) obj;
            return this.node == other.node && this.mod == other.mod;
        }
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}

Choices:
- No abnormally found
- Runtime Error
- Internal error
- Memory Limit Exceeded


Question:
import java.util.Comparator;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = stdin.nextInt();
            b[i] = stdin.nextInt();
        }

        // 締め切りの若い順番に仕事を進める。
        int[] idxs = IntStream.range(0, n)
                              .boxed()
                              .sorted(Comparator.comparing(i -> b[i]))
                              .mapToInt(Integer::intValue)
                              .toArray();
        int t = 0;
        boolean ok = true;
        for (int idx : idxs) {
            t += a[idx];
            if (b[idx] < t) {
                ok = false;
                break;
            }
        }
        System.out.println(ok ? "Yes" : "No");
    }
}

Choices:
- No abnormally found
- Memory Limit Exceeded
- Compile Error
- Time Limit Exceeded


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.regex.Pattern;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        long[] line = Pattern.compile(" ").splitAsStream(stdin.readLine()).mapToLong(Long::parseLong).toArray();
        long q = line[0] * 4; // 1L
        long h = line[1] * 2; // 1L
        long s = line[2];     // 1L
        long d = line[3];     // 2L
        long n = Long.parseLong(stdin.readLine());

        long min = Math.min(q, Math.min(h, s));
        long p1 = n * min;
        long p2 = (n / 2) * d + (n % 2) * min;
        long p = Math.min(p1, p2);
        stdout.println(p);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}

Choices:
- Runtime Error
- Time Limit Exceeded
- Memory Limit Exceeded
- No abnormally found


Question:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        long n = stdin.nextLong();
        long x = stdin.nextLong();
        long ans = 3 * (n - gcd(x, n));
        System.out.println(ans);
    }

    public static long gcd(long a, long b) {
        if (a == 0) {
            return b;
        } else {
            return gcd(b % a, a);
        }
    }
}

Choices:
- Compile Error
- Memory Limit Exceeded
- Time Limit Exceeded
- No abnormally found


Question:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        long n = stdin.nextLong();
        long x = stdin.nextLong();
        long ans = 3 * (n - gcd(x, n));
        System.out.println(ans);
    }

    public static long gcd(long a, long b) {
        if (a == 0) {
            return b;
        } else {
            return gcd(b % a, a);
        }
    }
}

Choices:
- No abnormally found
- Runtime Error
- Internal error
- Time Limit Exceeded


Question:
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
    System.out.println(n*n);
  }
}

Choices:
- No abnormally found
- Internal error
- Runtime Error
- Compile Error


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int p = scanner.nextInt();
		String s = scanner.next();
		long count = 0;

		if (p == 2 || p == 5) {
			for (int i = 0; i < n; i++) {
				if ((s.charAt(i) - 48) % p == 0) {
					count += i + 1;
				}
			}
		} else {
			int[] place = new int[p - 1];//10^a mod p=10^(a%(p-1)) mod p
			place[0] = 1;
			for (int i = 1; i < p - 1; i++) {
				place[i] = place[i - 1] * 10 % p;
			}

			int[] r = new int[p];
			r[0] = 1;
			int remain = 0;
			for (int i = 0; i < n; i++) {
				remain += (s.charAt(n - 1 - i) - 48) * place[i % (p - 1)];
				remain %= p;
				r[remain]++;
			}

			for (int i = 0; i < p; i++)
				count += (long) r[i] * (r[i] - 1) / 2;

		}
		System.out.println(count);
	}

}

Choices:
- Internal error
- Runtime Error
- No abnormally found
- Memory Limit Exceeded


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int p = scanner.nextInt();
		String s = scanner.next();
		long count = 0;

		if (p == 2 || p == 5) {
			for (int i = 0; i < n; i++) {
				if ((s.charAt(i) - 48) % p == 0) {
					count += i + 1;
				}
			}
		} else {
			int[] place = new int[p - 1];//10^a mod p=10^(a%(p-1)) mod p
			place[0] = 1;
			for (int i = 1; i < p - 1; i++) {
				place[i] = place[i - 1] * 10 % p;
			}

			int[] r = new int[p];
			r[0] = 1;
			int remain = 0;
			for (int i = 0; i < n; i++) {
				remain += (s.charAt(n - 1 - i) - 48) * place[i % (p - 1)];
				remain %= p;
				r[remain]++;
			}

			for (int i = 0; i < p; i++)
				count += (long) r[i] * (r[i] - 1) / 2;

		}
		System.out.println(count);
	}

}

Choices:
- Runtime Error
- Memory Limit Exceeded
- Time Limit Exceeded
- No abnormally found


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int p = scanner.nextInt();
		String s = scanner.next();
		long count = 0;

		if (p == 2 || p == 5) {
			for (int i = 0; i < n; i++) {
				if ((s.charAt(i) - 48) % p == 0) {
					count += i + 1;
				}
			}
		} else {
			int[] place = new int[p - 1];//10^a mod p=10^(a%(p-1)) mod p
			place[0] = 1;
			for (int i = 1; i < p - 1; i++) {
				place[i] = place[i - 1] * 10 % p;
			}

			int[] r = new int[p];
			r[0] = 1;
			int remain = 0;
			for (int i = 0; i < n; i++) {
				remain += (s.charAt(n - 1 - i) - 48) * place[i % (p - 1)];
				remain %= p;
				r[remain]++;
			}

			for (int i = 0; i < p; i++)
				count += (long) r[i] * (r[i] - 1) / 2;

		}
		System.out.println(count);
	}

}

Choices:
- No abnormally found
- Time Limit Exceeded
- Internal error
- Memory Limit Exceeded


Question:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		final int N = scanner.nextInt();
		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		List<Integer>[] friendLists = new ArrayList[N];
		List<Integer>[] blockLists = new ArrayList[N];
		for (int i = 0; i < N; i++) {
			friendLists[i] = new ArrayList<Integer>();
			blockLists[i] = new ArrayList<Integer>();
		}
		int[] result = new int[N];

		int A, B;
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			friendLists[A].add(B);
			friendLists[B].add(A);
			result[A]--;
			result[B]--;
		}
		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			blockLists[A].add(B);
			blockLists[B].add(A);
		}

		boolean[] visited = new boolean[N];

		int[] root = new int[N];
		int[] size = new int[N];

		for (int i = 0; i < N; i++) {
			if (!visited[i]) {
				DFS(friendLists, i, i, visited, root, size);
			}
		}

		for (int i = 0; i < N; i++) {
			result[i] += size[root[i]] - 1;
			for (int j : blockLists[i]) {
				if (i < j && root[i] == root[j]) {
					result[i]--;
					result[j]--;
				}
			}
		}

		for (int i = 0; i < N; i++) {
			System.out.print(result[i] + (i == N - 1 ? "\n" : " "));
		}

	}

	static int groupSize;

	static void DFS(List<Integer>[] graph, int rep, int vertex, boolean[] visited, int[] root, int[] size) {
		visited[vertex] = true;
		root[vertex] = rep;
		size[rep]++;
		graph[vertex].forEach(neighbor -> {
			if (!visited[neighbor]) {
				DFS(graph, rep, neighbor, visited, root, size);
			}
		});
	}

}

Choices:
- Compile Error
- Runtime Error
- No abnormally found
- Time Limit Exceeded


Question:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		final int N = scanner.nextInt();
		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		List<Integer>[] friendLists = new ArrayList[N];
		List<Integer>[] blockLists = new ArrayList[N];
		for (int i = 0; i < N; i++) {
			friendLists[i] = new ArrayList<Integer>();
			blockLists[i] = new ArrayList<Integer>();
		}
		int[] result = new int[N];

		int A, B;
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			friendLists[A].add(B);
			friendLists[B].add(A);
			result[A]--;
			result[B]--;
		}
		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			blockLists[A].add(B);
			blockLists[B].add(A);
		}

		boolean[] visited = new boolean[N];

		int[] root = new int[N];
		int[] size = new int[N];

		for (int i = 0; i < N; i++) {
			if (!visited[i]) {
				DFS(friendLists, i, i, visited, root, size);
			}
		}

		for (int i = 0; i < N; i++) {
			result[i] += size[root[i]] - 1;
			for (int j : blockLists[i]) {
				if (i < j && root[i] == root[j]) {
					result[i]--;
					result[j]--;
				}
			}
		}

		for (int i = 0; i < N; i++) {
			System.out.print(result[i] + (i == N - 1 ? "\n" : " "));
		}

	}

	static int groupSize;

	static void DFS(List<Integer>[] graph, int rep, int vertex, boolean[] visited, int[] root, int[] size) {
		visited[vertex] = true;
		root[vertex] = rep;
		size[rep]++;
		graph[vertex].forEach(neighbor -> {
			if (!visited[neighbor]) {
				DFS(graph, rep, neighbor, visited, root, size);
			}
		});
	}

}

Choices:
- Compile Error
- Time Limit Exceeded
- Internal error
- No abnormally found


Question:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		final int N = scanner.nextInt();
		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		List<Integer>[] friendLists = new ArrayList[N];
		List<Integer>[] blockLists = new ArrayList[N];
		for (int i = 0; i < N; i++) {
			friendLists[i] = new ArrayList<Integer>();
			blockLists[i] = new ArrayList<Integer>();
		}
		int[] result = new int[N];

		int A, B;
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			friendLists[A].add(B);
			friendLists[B].add(A);
			result[A]--;
			result[B]--;
		}
		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			blockLists[A].add(B);
			blockLists[B].add(A);
		}

		boolean[] visited = new boolean[N];

		int[] root = new int[N];
		int[] size = new int[N];

		for (int i = 0; i < N; i++) {
			if (!visited[i]) {
				DFS(friendLists, i, i, visited, root, size);
			}
		}

		for (int i = 0; i < N; i++) {
			result[i] += size[root[i]] - 1;
			for (int j : blockLists[i]) {
				if (i < j && root[i] == root[j]) {
					result[i]--;
					result[j]--;
				}
			}
		}

		for (int i = 0; i < N; i++) {
			System.out.print(result[i] + (i == N - 1 ? "\n" : " "));
		}

	}

	static int groupSize;

	static void DFS(List<Integer>[] graph, int rep, int vertex, boolean[] visited, int[] root, int[] size) {
		visited[vertex] = true;
		root[vertex] = rep;
		size[rep]++;
		graph[vertex].forEach(neighbor -> {
			if (!visited[neighbor]) {
				DFS(graph, rep, neighbor, visited, root, size);
			}
		});
	}

}

Choices:
- Runtime Error
- No abnormally found
- Internal error
- Compile Error


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int N = scanner.nextInt();
		int K = scanner.nextInt();

		int[] cumulant = new int[N+1];

		for (int i = 0; i < N; i++) {
			cumulant[i+1] = cumulant[i] + scanner.nextInt();
		}

		scanner.close();

		int max = 0;

		for (int i = 0; i + K <= N; i++) {
			if (cumulant[i + K] - cumulant[i] > max)
				max = cumulant[i + K] - cumulant[i];
		}

		System.out.println((double) (max + K) / 2);
	}

}

Choices:
- Compile Error
- No abnormally found
- Time Limit Exceeded
- Memory Limit Exceeded


Question:
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    final int n = sc.nextInt();
    int count = 0;
    for(int i = 0,min = n,p;i<n;i++){
      p = sc.nextInt();
      if(p<=min){
        count++;
        min = p;
      }
    }
    System.out.println(count);
  }
}

Choices:
- Memory Limit Exceeded
- Compile Error
- No abnormally found
- Runtime Error


Question:
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    final int n = sc.nextInt();
    int count = 0;
    for(int i = 0,min = n,p;i<n;i++){
      p = sc.nextInt();
      if(p<=min){
        count++;
        min = p;
      }
    }
    System.out.println(count);
  }
}

Choices:
- Runtime Error
- Internal error
- Time Limit Exceeded
- No abnormally found


Question:
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int v = scanner.nextInt();
		int p = scanner.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		scanner.close();
		Arrays.parallelSort(a);

		int min = p;
		int sup = n + 1;
		int mid;
		while (sup - min > 1) {
			mid = (min + sup) / 2;
			if (canBeChosen(mid, n, m, v, p, a)) {
				min = mid;
			} else {
				sup = mid;
			}
		}

		System.out.println(min);
	}

	static boolean canBeChosen(int k, int n, int m, int v, int p, int[] a) {
		int threshold = a[n - k] + m;
		if (threshold < a[n - p]) {
			return false;
		}
		int remain = v - (n - k + p);
		if (remain <= 0) {
			return true;
		}
		long canVote = 0;
		for (int i = p; i < k; i++) {
			canVote += threshold - a[n - i];
		}
		return canVote >= (long) remain * m;

	}
}

Choices:
- Time Limit Exceeded
- Memory Limit Exceeded
- No abnormally found
- Compile Error


Question:
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int v = scanner.nextInt();
		int p = scanner.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		scanner.close();
		Arrays.parallelSort(a);

		int min = p;
		int sup = n + 1;
		int mid;
		while (sup - min > 1) {
			mid = (min + sup) / 2;
			if (canBeChosen(mid, n, m, v, p, a)) {
				min = mid;
			} else {
				sup = mid;
			}
		}

		System.out.println(min);
	}

	static boolean canBeChosen(int k, int n, int m, int v, int p, int[] a) {
		int threshold = a[n - k] + m;
		if (threshold < a[n - p]) {
			return false;
		}
		int remain = v - (n - k + p);
		if (remain <= 0) {
			return true;
		}
		long canVote = 0;
		for (int i = p; i < k; i++) {
			canVote += threshold - a[n - i];
		}
		return canVote >= (long) remain * m;

	}
}

Choices:
- Compile Error
- Memory Limit Exceeded
- Time Limit Exceeded
- No abnormally found


Question:
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int v = scanner.nextInt();
		int p = scanner.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		scanner.close();
		Arrays.parallelSort(a);

		int min = p;
		int sup = n + 1;
		int mid;
		while (sup - min > 1) {
			mid = (min + sup) / 2;
			if (canBeChosen(mid, n, m, v, p, a)) {
				min = mid;
			} else {
				sup = mid;
			}
		}

		System.out.println(min);
	}

	static boolean canBeChosen(int k, int n, int m, int v, int p, int[] a) {
		int threshold = a[n - k] + m;
		if (threshold < a[n - p]) {
			return false;
		}
		int remain = v - (n - k + p);
		if (remain <= 0) {
			return true;
		}
		long canVote = 0;
		for (int i = p; i < k; i++) {
			canVote += threshold - a[n - i];
		}
		return canVote >= (long) remain * m;

	}
}

Choices:
- Time Limit Exceeded
- Runtime Error
- No abnormally found
- Memory Limit Exceeded


Question:
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String[] day = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
		List<String> dayList = Arrays.asList(day);
		int index = dayList.indexOf(scanner.next());
		System.out.println(7 - index);
	}

}

Choices:
- Memory Limit Exceeded
- Compile Error
- Runtime Error
- No abnormally found


Question:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int[] a = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		Arrays.parallelSort(a);

		int sup = a[n - 1];
		int inf = -1;
		int mid;
		while (sup - inf > 1) {
			mid = (sup + inf) / 2;
			if (count(mid, n, a) <= m) {
				sup = mid;
			} else {
				inf = mid;
			}
			;
		}

		long sum = 0;
		for (int i = 0; i < n; i++) {
			while (a[i] > sup) {
				a[i] >>= 1;
				m--;
			}
			sum += a[i];
		}

		sum -= (long) (sup - sup / 2) * m;

		System.out.println(sum);
	}

	static int count(int threshold, int n, int[] a) {
		int count = 0;
		for (int i = 0, x; i < n; i++) {
			x = a[i];
			while (x > threshold) {
				x >>= 1;
				count++;
			}
		}
		return count;
	}

}

Choices:
- Runtime Error
- Internal error
- Time Limit Exceeded
- No abnormally found


Question:
//No sorceries shall prevail.
import java.util.*;
import java.io.*;
public class Main {

	static Scanner inp= new Scanner(System.in);
	static PrintWriter out= new PrintWriter(System.out);
	public static void main(String args[]) {
	   	Main g=new Main();
	   	g.main();
	   	out.close();
	}

	//Main
	void main() {

		int n=inp.nextInt();
		int m=inp.nextInt();
		int q=inp.nextInt();
		int r[]=new int[n+1];
		int c[]=new int[m+1];
		HashSet<Long> set = new HashSet<>();
		while(q-->0) {
			int x=inp.nextInt();
			int y=inp.nextInt();
			set.add(hash(x,y));
			r[x]++;
			c[y]++;
		}
		int maxX=0,maxY=0;
		for(int i=0;i<=n;i++) {
			maxX=Math.max(maxX, r[i]);
		}
		for(int i=0;i<=m;i++) {
			maxY=Math.max(maxY, c[i]);
		}
		int gg=maxX+maxY-1;
		ArrayList<Integer> xs=new ArrayList<>();
		ArrayList<Integer> ys=new ArrayList<>();
		for(int i=0;i<=n;i++) {
			if(r[i]==maxX) xs.add(i);
		}
		for(int i=0;i<=m;i++) {
			if(c[i]==maxY) ys.add(i);
		}
		loop:
		for(int x: xs) {
			for(int y: ys) {
				if(!set.contains(hash(x,y))) {
					gg++;
					break loop;
				}
			}
		}
		System.out.println(gg);
	}

    static long hash(int x, int y) {
    	return x*1000000000l+y;
    }

}

Choices:
- Memory Limit Exceeded
- No abnormally found
- Internal error
- Runtime Error


Question:
//No sorceries shall prevail.
import java.util.*;
import java.io.*;
public class Main {

	static Scanner inp= new Scanner(System.in);
	static PrintWriter out= new PrintWriter(System.out);
	public static void main(String args[]) {
	   	Main g=new Main();
	   	g.main();
	   	out.close();
	}

	//Main
	void main() {

		int n=inp.nextInt();
		int m=inp.nextInt();
		int q=inp.nextInt();
		int r[]=new int[n+1];
		int c[]=new int[m+1];
		HashSet<Long> set = new HashSet<>();
		while(q-->0) {
			int x=inp.nextInt();
			int y=inp.nextInt();
			set.add(hash(x,y));
			r[x]++;
			c[y]++;
		}
		int maxX=0,maxY=0;
		for(int i=0;i<=n;i++) {
			maxX=Math.max(maxX, r[i]);
		}
		for(int i=0;i<=m;i++) {
			maxY=Math.max(maxY, c[i]);
		}
		int gg=maxX+maxY-1;
		ArrayList<Integer> xs=new ArrayList<>();
		ArrayList<Integer> ys=new ArrayList<>();
		for(int i=0;i<=n;i++) {
			if(r[i]==maxX) xs.add(i);
		}
		for(int i=0;i<=m;i++) {
			if(c[i]==maxY) ys.add(i);
		}
		loop:
		for(int x: xs) {
			for(int y: ys) {
				if(!set.contains(hash(x,y))) {
					gg++;
					break loop;
				}
			}
		}
		System.out.println(gg);
	}

    static long hash(int x, int y) {
    	return x*1000000000l+y;
    }

}

Choices:
- Memory Limit Exceeded
- No abnormally found
- Compile Error
- Internal error


Question:
// No sorceries shall prevail. //
import java.util.*;
import java.io.*;
public class Main {
	//Variables
	static long mod = 1000000007;
	static long mod2 = 998244353;
	static FastReader inp= new FastReader();
	static PrintWriter out= new PrintWriter(System.out);
	public static void main(String args[]) {
	   	Main g=new Main();
	   	g.main();
	   	out.close();
	}

	//Main
	void main() {

		String s=inp.next();
		String t=inp.next();
		boolean can=true;
		if(s.length()!=t.length()-1) {
			can=false;
		}
		if(can) {
			for(int i=0;i<s.length();i++) {
				if(s.charAt(i)!=t.charAt(i))
					can=false;
			}
		}
		out.println(can?"Yes":"No");

	}

	// Classes
	static class Edge implements Comparable<Edge>{
		int l,r;
		Edge(){}
		Edge(int l,int r){
			this.l=l;
			this.r=r;
		}
		@Override
		public int compareTo(Edge e) {
			return (l-e.l)!=0?l-e.l:r-e.r;
		}
	}

    static class Segment implements Comparable<Segment> {
		long l, r, initialIndex;
		Segment () {}
		Segment (long l_, long r_, long d_) {
		    this.l = l_;
		    this.r = r_;
		    this.initialIndex = d_;
		}
		@Override
		public int compareTo(Segment o) {
		    return (int)((l - o.l) !=0 ? l-o.l : initialIndex - o.initialIndex);
		}
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine() {
            String s="";
            try {
                s=br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }
    }

    // Functions
	static long gcd(long a, long b) {
		return b==0?a:gcd(b,a%b);
	}
	static int gcd(int a, int b) {
		return b==0?a:gcd(b,a%b);
	}

	void reverse(long[] A,int l,int r) {
        int i=l,j=r-1;
        while(i<j) {
            long t=A[i];
            A[i]=A[j];
            A[j]=t;
            i++;j--;
        }
    }
    void reverse(int[] A,int l,int r) {
        int i=l,j=r-1;
        while(i<j) {
            int t=A[i];
            A[i]=A[j];
            A[j]=t;
            i++;j--;
        }
    }

    //Input Arrays
    static void input(long a[], int n) {
		for(int i=0;i<n;i++) {
			a[i]=inp.nextLong();
		}
	}
	static void input(int a[], int n) {
		for(int i=0;i<n;i++) {
			a[i]=inp.nextInt();
		}
	}
	static void input(String s[],int n) {
		for(int i=0;i<n;i++) {
			s[i]=inp.next();
		}
	}
	static void input(int a[][], int n, int m) {
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				a[i][j]=inp.nextInt();
			}
		}
	}
	static void input(long a[][], int n, int m) {
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				a[i][j]=inp.nextLong();
			}
		}
	}

}

Choices:
- Compile Error
- No abnormally found
- Time Limit Exceeded
- Runtime Error


Question:
// No sorceries shall prevail. //
import java.util.*;
import java.io.*;
public class Main {

	static long gcd(long a, long b) {
	      if (b == 0)
	        return a;
	      return gcd(b, a % b);
	    }
	static int gcd(int a, int b) {
	      if (b == 0)
	        return a;
	      return gcd(b, a % b);
	    }

	static long mod = 1000000007;
	public static void main(String args[]) {
		Scanner inp=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);

		String s=inp.next();
    	int n=s.length();
    	out.println(s.charAt(2)==s.charAt(3) && s.charAt(4)==s.charAt(5)?"Yes":"No");

		out.close();
		inp.close();
	}
}

Choices:
- Runtime Error
- Memory Limit Exceeded
- No abnormally found
- Internal error


Question:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt(), M = sc.nextInt(), A[] = new int[M], B[] = new int[M];
		for (int i = 0;i < M;++ i) {
			A[i] = sc.nextInt() - 1;
			B[i] = sc.nextInt() - 1;
		}
		UnionFindTree unionFind = new UnionFindTree(N);
		long ans[] = new long[M + 1];
		ans[M] = (long)N * (N - 1) / 2;
		for (int i = M - 1;i > 0;-- i) {
			ans[i] = ans[i + 1];
			if (!unionFind.isUnion(A[i], B[i])) {
				ans[i] -= (long)unionFind.getSize(A[i]) * unionFind.getSize(B[i]);
				unionFind.unite(A[i], B[i]);
			}
		}
		for (int i = 1;i <= M;++ i) out.println(ans[i]);
		out.flush();
	}

	/**
	 * 素集合データ構造です。

	 * 連結成分の個数や大きさを取得することができます。
	 * @author 31536000
	 */
	public class UnionFindTree {
		private int[] parent; // 負ならばデータ数、正ならば親のindex

		/**
		 * size個の頂点を持つ森を作ります。
		 * @param size 頂点数
		 */
		public UnionFindTree(int size) {
			this.parent = new int[size];
			Arrays.fill(this.parent, -1);
		}

		/**
		 * その頂点がどの頂点を根とする連結成分に属しているかを求めます。

		 * 計算量はO(α(N))です。
		 * @param n 根を求めたい頂点
		 * @return 根となっている頂点
		 */
		public int find(int n) {
			while(parent[n] >= 0 && parent[parent[n]] >= 0) n = parent[n] = parent[parent[n]]; // 経路圧縮
			return parent[n] >= 0 ? parent[n] : n;
		}

		/**
		 * 指定した頂点同士を連結します。

		 * 計算量はO(α(N))です。
		 * @param l 連結したい頂点
		 * @param r 連結したい頂点
		 * @return この関数によって連結されたならtrue、既に連結だったならfalse
		 */
		public boolean unite(int l, int r) {
			l = find(l);
			r = find(r);
			if (l == r) return false; // 最初から連結
			if (parent[l] >= parent[r]) { // rの方が大きい
				parent[r] += parent[l]; // 大きい方へ小さい方をマージする
				parent[l] = r;
			} else {
				parent[l] += parent[r]; // 大きい方へ小さい方をマージする
				parent[r] = l;
			}
			return true;
		}

		/**
		 * 指定した2個の頂点が連結か判定します。

		 * 計算量はO(α(N))です。
		 * @param l 判定したい頂点
		 * @param r 判定したい頂点
		 * @return lとrが連結ならばtrue
		 */
		public boolean isUnion(int l, int r) {
			return find(l) == find(r);
		}

		/**
		 * 指定した頂点を含む連結成分の要素数を求めます。

		 * 計算量はO(α(N))です。
		 * @param n 要素数を求めたい連結成分の要素
		 * @return 頂点nを含む連結成分の要素数
		 */
		public int getSize(int n) {
			return -parent[find(n)];
		}

		/**
		 * 連結成分の個数を求めます。

		 * 計算量はO(N)です。
		 * @return 連結成分の個数
		 */
		public int getUnion() {
			int ret = 0;
			for (int i : parent) if (i < 0) ++ ret;
			return ret;
		}
	}
	public class FastScanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int read = 0;
		private int length = 0;

		private boolean hasNextByte() {
			if (read < length) return true;
			else {
				try {
					read = 0;
					length = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return length > 0;
		}

		private int readByte() {
			return hasNextByte() ? buffer[read++] : -1;
		}

		private boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		private boolean isNumber(int c) {
			return '0' <= c && c <= '9';
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[read])) read++;
			return hasNextByte();
		}

		public char nextChar() {
			if (!hasNextByte())  throw new NoSuchElementException();
			return (char)readByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b;
			while (isPrintableChar(b = readByte())) sb.appendCodePoint(b);
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (!isNumber(b)) throw new NumberFormatException();
			while (true) {
				if (isNumber(b)) {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) return minus ? -n : n;
				else throw new NumberFormatException();
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextInt(int width) {
			int[] ret = new int[width];
			for (int i = 0;i < width;++ i) ret[i] = nextInt();
			return ret;
		}

		public long[] nextLong(int width) {
			long[] ret = new long[width];
			for (int i = 0;i < width;++ i) ret[i] = nextLong();
			return ret;
		}

		public int[][] nextInt(int width, int height) {
			int[][] ret = new int[height][width];
			for (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[j][i] = nextInt();
			return ret;
		}

		public long[][] nextLong(int width, int height) {
			long[][] ret = new long[height][width];
			for (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[j][i] = nextLong();
			return ret;
		}
	}
}

Choices:
- Compile Error
- No abnormally found
- Internal error
- Memory Limit Exceeded