Question:
import java.util.*;
public class atcodervc1 {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        String name1 = sc.next();
        String name2 = sc.next();
        int ball1 = sc.nextInt();
        int ball2 = sc.nextInt();
        String unstocked_ball = sc.next();

        if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        }

        System.out.println(ball1 + " " + ball2);

	}
}

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


Question:
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long k = sc.nextLong();

        int count = 0;

        boolean check = true;

        for(long i = 0; i < k ; i++){
            if(a != 0){
                a = a - 1;
            }else if(b != 0){
                b = b - 1;
            }else if(a == 0){
                check = false;
                //count = a + b;
            }else{
                check = false;
                //count = a + b;
            }
        }

        System.out.print(a + " " + b);

	}
}

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


Question:
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long k = sc.nextLong();

        int count = 0;

        boolean check = true;

        for(int i = 0; i < k ; i++){
            if(a != 0){
                a = a - 1;
            }else if(b != 0){
                b = b - 1;
            }else if(a == 0){
                check = false;
                //count = a + b;
            }else{
                check = false;
                //count = a + b;
            }
        }

        System.out.print(a + " " + b);

	}
}

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


Question:
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();

        int count = 0;

        boolean check = true;

        for(int i = 0; i < k ; i++){
            if(a != 0){
                a = a - 1;
            }else if(b != 0){
                b = b - 1;
            }else if(a == 0){
                check = false;
                //count = a + b;
            }else{
                check = false;
                //count = a + b;
            }
        }

        System.out.print(a + " " + b);

	}
}

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


Question:
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();

        int count = 0;

        boolean check = true;

        for(int i = 0; i < k ; i++){
            if(a != 0){
                a = a - 1;
            }else if(b != 0){
                b = b - 1;
            }else if(a == 0){
                check = false;
                //count = a + b;
            }else{
                check = false;
                //count = a + b;
            }
        }

        System.out.print(a);
        System.out.print(b);

	}
}

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


Question:
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

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

        String s = sc.next();
        char[] work = new char[s.length()];
        char[] work2 = new char[t.length()];
        int count = 0;

        for(int i = 0; i < s.length(); i++){
                work[i] = s.charAt(i);
            }

        for(int i = 0; i < t.length(); i++){
                work2[i] = t.charAt(i);
        }

        for(int i = 0; i < 2; i++){
            if(work[i] == work2[i]){
                count++;
            }
        }
        Sytem.out.println(count);

    }
}

Choices:
- Memory Limit Exceeded
- Compile Error
- Time Limit Exceeded
- Runtime Error


Question:
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

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

    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    int n = sc.nextInt();

    for(int i = 0; i < n ; i++){
        list.add(sc.nextInt());
    }

    Collections.sort(list);

    int num = list.get(n/2 + 1) - list.get(n/2);

    System.out.println(num);

}
}

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


Question:
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        int n = sc.nextInt();
        String[] kk = new String[n];
        for (int i = 0; i < n; i++) {
            kk[i] = sc.next();
        }

        Pair[] ps = new Pair[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            int cp = 0, cm = 0;
            int l = kk[i].length();
            for (int j = 0; j < l; j++) {
                cp += kk[i].charAt(j) == '(' ? 1 : -1;
                cm = Math.min(cm, cp);
            }
            ps[i] = new Pair(cp, cm, kk[i]);
            sum += cp;
        }
        Arrays.sort(ps);

        if (sum != 0) {
            out.println("No");
        } else {
            boolean ok = true;
            int c = 0;
            ArrayList<Pair> tmp = new ArrayList<>();
            for (Pair p : ps) {
                if (p.p < 0) {
                    tmp.add(p);
                    continue;
                }
                if (c + p.m < 0) {
                    ok = false;
                    break;
                }
                c += p.p;
            }
            int s = tmp.size();
            for (int j = 0; j < s; j++) {
                debug(p);
                int l = tmp.get(s - j - 1).s.length();
                for (int i = 0; i < l; i++) {
                    c += tmp.get(s - j - 1).s.charAt(i) == '(' ? 1 : -1;
                    ok &= c >= 0;
                }
            }
            out.println(ok ? "Yes" : "No");
        }

        out.flush();
    }

    class Pair implements Comparable<Pair> {
        int p, m;
        String s;
        Pair(int p, int m, String s) {
            this.p = p;
            this.m = m;
            this.s = s;
        }

        @Override
        public int compareTo(Pair o) {
            if (m != o.m) {
                return o.m - m;
            }
            return o.p - p;
        }

        @Override
        public String toString() {
            return "(" + p + ", " + m + ")";
        }
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

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


Question:
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }
    int N;
    int[] ar;

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        N = sc.nextInt();
        String s = sc.next();
        ar = new int[N];
        for (int i = 0; i < N; i++) {
            ar[i] = s.charAt(i) - '1';
        }

        out.println(uso());
        out.flush();
    }

    int uso() {
        ArrayList<Integer> x = new ArrayList<>();
        for (int a : ar) x.add(a);
//        debug(x);

        while (x.size() > 1) {
            ArrayList<Integer> next = new ArrayList<>();
            int s = x.get(0);
            int size = x.size();
            for (int i = 1; i < size; i++) {
                if (s != x.get(i)) {
                    next.add(Math.abs(s - x.get(i)));
                } else {
                    while (i < size && s == x.get(i)) i++;
                    next.add(0);
                    i--;
                }
                s = x.get(i);
            }
            x = next;
//            debug(x);
        }
        return x.get(0);
    }

    int solve() {
        int[] s = new int[N];
        System.arraycopy(ar, 0, s, 0, N);
        for (int i = 1; i < N; i++) {
            debug(s);
            int[] next = new int[N - i];
            for (int j = 0; j < N - i; j++) {
                next[j] = Math.abs(s[j] - s[j + 1]);
            }
            s = next;
        }
        debug(s[0]);
        return s[0];
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

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


Question:
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    long MOD = (long)1e9 + 7;

    void run() {
        Scanner sc = new Scanner(System.in);

        int L = sc.nextInt(), R = sc.nextInt();

        debug();
        debug(count(L));
        debug();
        debug(count(R));

        System.out.println((10 * MOD + count(R) - count(L - 1) - R - L) % MOD);
    }

    long count(long X) {

        String s = Long.toBinaryString(X);
        int len = s.length();
        long[][] dp = new long[len + 1][4];
        dp[0][0] = 1;

        for (int i = 1; i <= len; i++) {
            int dig = i - 1;
            if (s.charAt(dig) == '0') {
                dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % MOD;
                dp[i][1] = 0;
                dp[i][2] = (dp[i - 1][2] + dp[i - 1][3]) % MOD;
                dp[i][3] = (dp[i - 1][2] + dp[i - 1][3]) % MOD;
            } else {
                dp[i][0] = 0;
                dp[i][1] = (dp[i - 1][0] + dp[i - 1][1]) % MOD;
                dp[i][2] = 2 * (dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][2] + dp[i - 1][3]) % MOD;
                dp[i][3] = 2 * (dp[i - 1][2] + dp[i - 1][3]) % MOD;
            }
            debug(dp[i]);
        }
        return (dp[len][0] + dp[len][1] + dp[len][2] + dp[len][3]) % MOD;
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

}

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


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

public class Main {

    int H, W;

    void run() {
        Scanner sc = new Scanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();
        int[][] var = new int[H + 1][W + 1];
        int[][] hol = new int[W + 1][H + 1];
        boolean[][] ng = new boolean[H + 1][W + 1];
        for (int i = 1; i <= H; i++) {
            String s = sc.next();
            for (int j = 1; j <= W; j++) {
                var[i][j] = s.charAt(j - 1) == '#' ? 1 : 0;
                hol[j][i] = s.charAt(j - 1) == '#' ? 1 : 0;
                ng[i][j] = s.charAt(j - 1) == '#';
            }
        }
        for (int i = 1; i <= H; i++) {
            for (int j = 1; j <=W; j++) var[i][j] += var[i][j - 1];
        }
        for (int i = 1; i <= W; i++) {
            for (int j = 1; j <=H; j++) hol[i][j] += hol[i][j - 1];
        }

        int ans = 0;
        for (int i = 1; i <= H; i++) {
            for (int j = 1; j <= W; j++) if (!ng[i][j]){
                int lv = lowerBound(var[i], var[i][j]);
                int uv = upperBound(var[i], var[i][j]);
                int lh = lowerBound(hol[j], hol[j][i]);
                int uh = upperBound(hol[j], hol[j][i]);
                ans = Math.max(ans, uv - lv + 1 + uh - lh - 4);
                debug(i, j, uv - lv + 1, uh - lh + 1);
            }
        }

        debug(var);
        debug(hol);
        System.out.println(ans);
    }

    public static int lowerBound(int[] array, int value) {
        int left = -1;
        int right = array.length;
        while (right - left > 1) {
            int middle = (right + left) / 2;
            if (array[middle] >= value) {
                right = middle;
            } else {
                left = middle;
            }
        }
        return right;
    }

    public static int upperBound(int[] array, int value) {
        int left = -1;
        int right = array.length;
        while (right - left > 1) {
            int middle = (right + left) / 2;
            if (array[middle] > value) {
                right = middle;
            } else {
                left = middle;
            }
        }
        return right;
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

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

Choices:
- Time Limit Exceeded
- Compile Error
- Runtime Error
- Memory Limit Exceeded


Question:
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        String s = sc.next();

        int l = s.length();
        long[] a = new long[l + 1], ax = new long[l + 1];
        long[] c = new long[l + 1], cx = new long[l + 1];
        long[] pow = new long[l + 1];
        pow[0] = 1;

        for (int i = 0; i < l; i++) {
            a[i + 1] += a[i];
            ax[i + 1] += ax[i];
            c[l - i - 1] += c[l - i];
            cx[l - i - 1] += cx[l - i];
            pow[i + 1] = pow[i] * 3;

            switch (s.charAt(i)) {
                case 'A':
                    a[i + 1]++;
                    break;
                case '?':
                    ax[i + 1]++;
            }
            switch (s.charAt(l - i - 1)) {
                case 'C':
                    c[l - i - 1]++;
                    break;
                case '?':
                    cx[l - i - 1]++;
            }
        }

//        debug(a, ax);
//        debug(c, cx);

        long ans = 0;
        for (int i = 1; i < l - 1; i++) {
            if (s.charAt(i) == 'B' || s.charAt(i) == '?') {
                long cnt = 0;
                long x1 = a[i] * c[i + 1] * pow[ax[i]] * pow[cx[i + 1]] % MOD;
                long x2 = (cx[i + 1] > 0) ? a[i] * cx[i + 1] * pow[ax[i]] * pow[cx[i + 1] - 1] % MOD : 0;
                long x3 = (ax[i] > 0) ? ax[i] * c[i + 1] * pow[ax[i] - 1] * pow[cx[i + 1]] % MOD : 0;
                long x4 = (ax[i] > 0 && cx[i + 1] > 0) ? ax[i] * cx[i + 1] * pow[ax[i] - 1] * pow[cx[i + 1] - 1] % MOD : 0;
//                debug(x1, x2, x3, x4);
                ans = (ans + x1 + x2 + x3 + x4) % MOD;
            }
        }

        out.println(ans);

        out.flush();
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

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


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

public class Main {

    long MOD = 924844033L;

    long[] pns;
    int n, k;

    void run() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt(); k = sc.nextInt();
        int len = 2 * (n - k);
        long[][][] dp = new long[n + 1][len + 1][2];

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

        for (int i = 1; i <= k; i++) {
            int size = 0;
            for (int j = i; j <= n; j += k) size++;
            if (size == 1) continue;
            ss.add(size - 1);
            ss.add(size - 1);
        }
//        debug(ss);

        for (int i = 0; i <= len; i++) dp[0][i][0] = 1;

        for (int i = 1; i <= n; i++) {
            int l = 1;
            for (int j = 0; j < ss.size(); j++) {
                dp[i][l][0] = (dp[i][l][0] + dp[i][l - 1][0] + dp[i][l - 1][1]) % MOD;
                dp[i][l][1] = (dp[i][l][1] + dp[i - 1][l - 1][0] + dp[i - 1][l - 1][1]) % MOD;
                for (int k = 1; k < ss.get(j); k++) {
                    dp[i][l + k][0] = (dp[i][l + k][0] + dp[i][l + k - 1][0] + dp[i][l + k - 1][1]) % MOD;
                    dp[i][l + k][1] = (dp[i][l + k][1] + dp[i - 1][l + k - 1][0]) % MOD;
                }
                l += ss.get(j);
            }
        }

        calc();
//        debug(pns);

        long ans = pns[n];
        for (int i = 1; i <= n; i++) {
//            debug(dp[i]);
            long f = i % 2 == 0 ? 1 : -1;
            long sum = (dp[i][len][0] + dp[i][len][1]) % MOD;
            sum = (sum * pns[n - i]) % MOD;
            ans = (ans + MOD + f * sum) % MOD;
        }
        System.out.println(ans);
    }

    void calc() {
        pns = new long[n + 1];
        pns[0] = 1;
        for (int i = 1; i <= n; i++) {
            pns[i] = (pns[i - 1] * i) % MOD;
        }
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

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

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


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

public class Main {

    long MOD = 924844033L;

    long[] pns;
    int n, k;

    void run() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt(); k = sc.nextInt();
        int len = 2 * (n - k);
        long[][][] dp = new long[n + 1][len + 1][2];

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

        for (int i = 1; i <= k; i++) {
            int size = 0;
            for (int j = i; j <= n; j += k) size++;
            if (size == 1) continue;
            ss.add(size - 1);
            ss.add(size - 1);
        }
        debug(ss);

        for (int i = 0; i <= len; i++) dp[0][i][0] = 1;

        for (int i = 1; i <= n; i++) {
            int l = 1;
            for (int j = 0; j < ss.size(); j++) {
                dp[i][l][0] = (dp[i][l][0] + dp[i][l - 1][0] + dp[i][l - 1][1]) % MOD;
                dp[i][l][1] = (dp[i][l][1] + dp[i - 1][l - 1][0] + dp[i - 1][l - 1][1]) % MOD;
                for (int k = 1; k < ss.get(j); k++) {
                    dp[i][l + k][0] = (dp[i][l + k][0] + dp[i][l + k - 1][0] + dp[i][l + k - 1][1]) % MOD;
                    dp[i][l + k][1] = (dp[i][l + k][1] + dp[i - 1][l + k - 1][0]) % MOD;
                }
                l += ss.get(j);
            }
        }

        calc();
        debug(pns);

        long ans = pns[n];
        for (int i = 1; i <= n; i++) {
            debug(dp[i]);
            long f = i % 2 == 0 ? 1 : -1;
            long sum = (dp[i][len][0] + dp[i][len][1]) % MOD;
            sum = (sum * pns[n - i]) % MOD;
            ans = (ans + MOD + f * sum) % MOD;
        }
        System.out.println(ans);
    }

    void calc() {
        pns = new long[n + 1];
        pns[0] = 1;
        for (int i = 1; i <= n; i++) {
            pns[i] = (pns[i - 1] * i) % MOD;
        }
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

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

Choices:
- Memory Limit Exceeded
- Runtime Error
- Time Limit Exceeded
- Compile Error


Question:
package cf;

import java.io.*;
import java.util.*;

public class CF {
    static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out));
    final static int MAX = 1_000_000+10;

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String s = fs.next().toString();
        System.out.println(s.charAt(s.length() - 1) == 's'? s+"es":s+"s");

        }

    static int gcd(int a, int b) { return b==0 ? a : gcd(b, a%b);}
    static final Random random = new Random();

    static void ruffleSort(int[] a) {
        int n = a.length;//shuffle, then sort
        for (int i = 0; i < n; i++) {
            int oi = random.nextInt(n), temp = a[oi];
            a[oi] = a[i];
            a[i] = temp;
        }
        Arrays.sort(a);
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

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

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }

}

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


Question:
import java.io.*;

class Main {
    public static void main(String... args) {
        int K = IN.nextInt();
		puts((K / 2) * ((K + 1) / 2));
		flush();
	}
    static final Scanner IN = new Scanner(System.in);
	static final PrintWriter OUT = new PrintWriter(System.out);
	static <T> void puts(T arg) { OUT.println(arg); }
	static void flush() { OUT.flush(); }
}

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


Question:
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.charset.StandardCharsets;
public class Main {
    int mod = 998244353;
    public void sol(int[] arr,int n,int s) {
        System.out.println(dp(0,0,arr,s));
    }
    Integer[][] memo = new Integer[3001][3001];
    int dp(int i, int sum, int[] arr,int s){
        if(i==arr.length){
            return sum==s?1:0;
        }
        if(memo[i][sum]!=null) return memo[i][sum];
        int res = 0;
        res = dp(i+1,sum,arr,s)*2;
        res%=mod;
        res+= dp(i+1,sum+arr[i],arr,s);
        res%=mod;
        return memo[i][sum] = res;
    }

    public static void main(String[] args)  throws IOException {
        // Use the Scanner class
        Main aka = new Main();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] ss = br.readLine().split(" ");
        int N = Integer.parseInt(ss[0]);
        int S = Integer.parseInt(ss[1]);
        int[] arr = new int[N];
        ss = br.readLine().split(" ");
        for(int i=0;i<N;i++){
            arr[i] = Integer.parseInt(ss[i]);
        }
        //int tot = Integer.parseInt(br.readLine());

        aka.sol(arr,N,S);
//        int i =1;
//        System.out.println();
//        while(tot>0){
//
//            String s = br.readLine();
//            String[] sr = s.split(" ");
//            List<Long> ls = new ArrayList<>();
//            for(String ss:sr){
//                ls.add(Long.parseLong(ss));
//            }
//            Main tt = new Main();
//            tt.sol(ls);
//            // String Buffer to store answer
//            StringBuffer sb = new StringBuffer();
////            Solution obj = new Solution();
////
////            System.out.println("Case #"+i+": "+obj.sol());
//            tot--;
//            i++;
//        }
    }

}

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


Question:
h, n = map(int, input().split())
sum = 0
for i in list(map(int, input().split())):
    sum += i
if sum >= h:
    print("Yes")
else:
    print("No")

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


Question:
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        long n = scan.nextInt();
        long[] a = new long[n + 1];
        long[] b = new long[n];
        long sum = 0;
        for(int i = 0; i < n + 1; i++){
            a[i] = scan.nextLong();
            sum += a[i];
        }
        for(int i = 0; i < n; i++) b[i] = scan.nextLong();
        for(int i = 0; i < n; i++){
            if(a[i] <= b[i]){
                a[i + 1] = Math.max(0, a[i + 1] - b[i] + a[i]);
                a[i] = 0;
            }else{
                a[i] -= b[i];
            }
        }
        long out = 0;
        for(int i = 0; i < n + 1; i++) out += a[i];
        System.out.println(sum - out);
        scan.close();
    }
}

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


Question:
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        long n = scan.nextInt();
        long[] a = new int[n + 1];
        long[] b = new int[n];
        long sum = 0;
        for(int i = 0; i < n + 1; i++){
            a[i] = scan.nextInt();
            sum += a[i];
        }
        for(int i = 0; i < n; i++) b[i] = scan.nextInt();
        for(int i = 0; i < n; i++){
            if(a[i] <= b[i]){
                a[i + 1] = Math.max(0, a[i + 1] - b[i] + a[i]);
                a[i] = 0;
            }else{
                a[i] -= b[i];
            }
        }
        long out = 0;
        for(int i = 0; i < n + 1; i++) out += a[i];
        System.out.println(sum - out);
        scan.close();
    }
}

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


Question:
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        char b = scan.next();
        if(b.equals("A")) System.out.println("T");
        else if(b.equals("T")) System.out.println("A");
        else if(b.equals("C")) System.out.println("G");
        else System.out.println("C");
        scan.close();
    }
}

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


Question:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;

class demand implements Comparable{
  int from;
  int to;

  public int compareTo(Object other){
    demand otherdemand = (demand)other;
    return to - otherdemand.to;
  }
}

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

    int n = sc.nextInt();
    int m = sc.nextInt();

    demand[] demands = new demand[m];

    for(int i = 0; i < m; i++){
      demand newdemand = new demand();
      newdemand.from = sc.nextInt();
      newdemand.to = sc.nextInt();
      demands[i] = newdemand;
    }

    Arrays.sort(demands);

    int ans = 0;
    int nowclear = 0;
    for(int i = 0; i < m; i++){
      int nowfrom = demands[i].from;
      int nowto = demands[i].to;
      if(nowclear < nowfrom){
        ans++;
        nowclear = nowto - 1;
      }
    }

    System.out.println(ans);

  }
}

Choices:
- Compile Error
- Runtime Error
- Memory Limit Exceeded
- Time Limit Exceeded


Question:
import java.util.*;

class demand implements Comparable{
  int from;
  int to;

  public int compareTo(Object other){
    demand otherdemand = (demand)other;
    return to - otherdemand.to;
  }
}

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

  int n = sc.nextInt();
  int m = sc.nextInt();

  demand[] demands = new demand[m];

  for(int i = 0; i < m; i++){
    demand newdemand = new demand();
    newdemand.from = sc.nextInt();
    newdemand.to = sc.nextInt();
    demands[i] = newdemand;
  }

  Arrays.sort(demands);

  int ans = 0;
  int nowclear = 0;
  for(int i = 0; i < m; i++){
    int nowfrom = demands[i].from;
    int nowto = demands[i].to;
    if(nowclear < nowfrom){
      ans++;
      nowclear = nowto - 1;
    }
  }

  System.out.println(ans);
}

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


Question:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;

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

    int n = sc.nextInt();

    String[] strings = new String[n];
    for(int i = 0; i < n; i++){
      strings[i] = sc.nextStr();
    }

    char[][] banmen = new char[n][n];
    int count = 0;

    for(int a = 0; a < n; a++){
      for(int b = 0; b < n; b++){
        for(int i = 0; i < n; i++){
          for(int j = 0; j < n; j++){
            banmen[(i + a) % n][(j + b) % n] = strings[i].charAt(j);
          }
        }
        boolean clear = true;
        for(int i = 0; i < n; i++){
          for(int j = 0; j < n; j++){
            if(banmen[i][j] != banmen[j][i]){
              clear = false;
              break;
            }
          }
        }
        if(clear){
          count++;
        }
      }
    }

    System.out.println(count);

  }

 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;

      public InputReader(InputStream stream) {
          this.stream = stream;
      }

      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }

      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }

      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }

      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }

      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }

      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

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


Question:
import java.util.Scanner;
class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
long d=sc.nextLong();
int cnt=0;

// long x[],y[]; x=new long[n]; y=new long[n];
long[] x=new long[n];
long[] y=new long[n];
int i=0;

while((n--)>0){
x[i]=sc.nextLong();
y[i]=sc.nextLong();
if(d*d>=(x[i]*x[i]+y[i]*y[i]))
cnt++;
i++;
}
System.out.println(cnt);
}

}

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


Question:
import java.util.Scanner;
class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
long d=sc.nextLong();
int cnt=0;

// long x[],y[]; x=new long[n]; y=new long[n];
long[] x=new long[n];
long[] y=new long[n];
int i=0;

while((n--)>0){
x[i]=sc.nextLong();
y[i]=sc.nextLong();
if(d*d<=(x[i]*x[i]+y[i]*y[i]))
cnt++;
i++;
}
System.out.println(cnt);
}

}

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


Question:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package javaapplication7;
import java.util.Scanner;
public class JavaApplication7.java{{
    public static void main(String[] args) {
        String day;
        Scanner input = new Scanner(System.in);
        day = input.nextLine();
        if(day.equals("MON")){
            System.out.println("6");
            System.out.println("It is Monday today, and six days later, it will be Sunday.");
        }
        else if(day.equals("TUE")){
            System.out.println("5");
            System.out.println("It is Tuesday today, and five days later, it will be Sunday.");
        }
        else if(day.equals("WED")){
            System.out.println("4");
            System.out.println("It is Wednesday today, and four days later, it will be Sunday.");
        }
        else if(day.equals("THU")){
            System.out.println("3");
            System.out.println("It is Thursday today, and three days later, it will be Sunday.");
        }
        else if(day.equals("FRI")){
            System.out.println("3");
            System.out.println("It is Friday today, and two days later, it will be Sunday.");
        }else if(day.equals("SAT")){
            System.out.println("1");
            System.out.println("It is Saturday today, and tomorrow will be Sunday.");
        }
        else if(day.equals("SUN")){
            System.out.println("7");
            System.out.println("It is Sunday today, and seven days later, it will be Sunday again.");
        }

    }

}
}

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


Question:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication7;
import java.util.Scanner;
public class JavaApplication7{
    public static void main(String[] args) {
        String day;
        Scanner input = new Scanner(System.in);
        day = input.nextLine();
        if(day.equals("MON")){
            System.out.println("6");
            System.out.println("It is Monday today, and six days later, it will be Sunday.");
        }
        else if(day.equals("TUE")){
            System.out.println("5");
            System.out.println("It is Tuesday today, and five days later, it will be Sunday.");
        }
        else if(day.equals("WED")){
            System.out.println("4");
            System.out.println("It is Wednesday today, and four days later, it will be Sunday.");
        }
        else if(day.equals("THU")){
            System.out.println("3");
            System.out.println("It is Thursday today, and three days later, it will be Sunday.");
        }
        else if(day.equals("FRI")){
            System.out.println("3");
            System.out.println("It is Friday today, and two days later, it will be Sunday.");
        }else if(day.equals("SAT")){
            System.out.println("1");
            System.out.println("It is Saturday today, and tomorrow will be Sunday.");
        }
        else if(day.equals("SUN")){
            System.out.println("7");
            System.out.println("It is Sunday today, and seven days later, it will be Sunday again.");
        }

    }

}

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


Question:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication7;
import java.util.Scanner;
private class JavaApplication7{
    public static void main(String[] args) {
        String day;
        Scanner input = new Scanner(System.in);
        day = input.nextLine();
        if(day.equals("MON")){
            System.out.println("6");
            System.out.println("It is Monday today, and six days later, it will be Sunday.");
        }
        else if(day.equals("TUE")){
            System.out.println("5");
            System.out.println("It is Tuesday today, and five days later, it will be Sunday.");
        }
        else if(day.equals("WED")){
            System.out.println("4");
            System.out.println("It is Wednesday today, and four days later, it will be Sunday.");
        }
        else if(day.equals("THU")){
            System.out.println("3");
            System.out.println("It is Thursday today, and three days later, it will be Sunday.");
        }
        else if(day.equals("FRI")){
            System.out.println("3");
            System.out.println("It is Friday today, and two days later, it will be Sunday.");
        }else if(day.equals("SAT")){
            System.out.println("1");
            System.out.println("It is Saturday today, and tomorrow will be Sunday.");
        }
        else if(day.equals("SUN")){
            System.out.println("7");
            System.out.println("It is Sunday today, and seven days later, it will be Sunday again.");
        }

    }

}

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


Question:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication7;
import java.util.Scanner;
public class JavaApplication7.java{ {
    public static void main(String[] args) {
        String day;
        Scanner input = new Scanner(System.in);
        day = input.nextLine();
        if(day.equals("MON")){
            System.out.println("6");
            System.out.println("It is Monday today, and six days later, it will be Sunday.");
        }
        else if(day.equals("TUE")){
            System.out.println("5");
            System.out.println("It is Tuesday today, and five days later, it will be Sunday.");
        }
        else if(day.equals("WED")){
            System.out.println("4");
            System.out.println("It is Wednesday today, and four days later, it will be Sunday.");
        }
        else if(day.equals("THU")){
            System.out.println("3");
            System.out.println("It is Thursday today, and three days later, it will be Sunday.");
        }
        else if(day.equals("FRI")){
            System.out.println("3");
            System.out.println("It is Friday today, and two days later, it will be Sunday.");
        }else if(day.equals("SAT")){
            System.out.println("1");
            System.out.println("It is Saturday today, and tomorrow will be Sunday.");
        }
        else if(day.equals("SUN")){
            System.out.println("7");
            System.out.println("It is Sunday today, and seven days later, it will be Sunday again.");
        }

    }

}

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


Question:
import java.util.*;
public class Competition2E
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		double r = sc.nextDouble();
		double c = 1;

		System.out.println((int)(Math.pow(r,2)));

	}
}

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


Question:
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner in1 = new Scanner(System.in);
        int N = in1.nextInt();
        int D[][]=new int [N][2];
        Scanner d = new Scanner(System.in);
        int sum=0;
        D[0][1]=1;
        for (int x=0;x<N;x++)
        {
            D[x][0]=d.nextInt();
            if (x==1)
            {
                D[1][1]=D[0][0];
                sum+=D[1][0]*D[0][0];
            }
            else if (x>1)
            {
                D[x][1]=D[x-1][0]+D[x-1][1];
                sum+=D[x][0]*D[x][1];
            }
        }
        System.out.print(sum);
    }
}

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


Question:
public static void main(String[] args)
    {
        Scanner in1 = new Scanner(System.in);
        int N = in1.nextInt();
        int D[]=new int [N];
        Scanner d = new Scanner(System.in);
        int sum=0;
        for (int x=0;x<N;x++)
        {
            D[x]=d.nextInt();
        }
        for (int y=0;y<N-1;y++)
        {
            for (int x=y+1;x<N;x++)
            {
                sum+=D[x]*D[y];
            }
        }
        System.out.print(sum);
    }

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


Question:
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc=new Scanner(System.in);

		double sum = 0;
		for (int i=1;i<=12;i++){
			double a=sc.nextDouble();
			sum = sum+a;
		}
		System.out.println("$"+sum/12);
	}

}

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


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] Args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        char zero = "0".charAt(0);
        String s =br.readLine(), resultado="";

        if(n == 1) {
            System.out.println("0");
        }else{
            if(s.charAt(0) != "1".charAt(0)){
                k--;
            }
            resultado += "1";
            for(int i = 1; i < n; i++){
                if(k > 0) {
                    if(s.charAt(i) != zero){
                        k--;
                    }
                    resultado += "0";
                }
                else{
                    resultado += s.substring(i);
                    break;
                }
            }
        }

        System.out.println(resultado);
        br.close();
    }
}

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


Question:
public class Main {

	public static void main(String[] args) {
		int a, b, fim=0;
		Scanner scanner = new Scanner(System.in);

		a = scanner.nextInt();
		b = scanner.nextInt();

		for(int i = 0; i < 2; i++) {
			if(a > b) {
				fim += a;
				a--;
			}else if(b > a) {
				fim += b;
				b--;
			}else if(b == a) {
				fim += a;
				a--;
			}
		}
		System.out.println(fim);
	}
}

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


Question:
import java.util.*;
public class Main2{
     public static void main(String [] args){
          Scanner sc=new Scanner(System.in);
          int a=sc.nextInt();
          int b=sc.nextInt();
          int c=sc.nextInt();
          int z=Findmax(a,b,c);
          System.out.println(z);

     }
     public static int Findmax(int a, int b, int c){

          if(a>=b&&a>=c){
               return a*10+b+c;}
          else if(b>=a&&b>=c){
               return b*10+c+a;}
          else if(c>=a&&c>=b){
               return c*10+b+a;}
          return 0;
     }

}

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


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

public class MaximizeTheFormula{

    public static void main (String[] args) {
        Scanner key = new Scanner(System.in);
        int A = key.nextInt();
        int B = key.nextInt();
        int C = key.nextInt();
        int maximum = A+B*10+C;
        System.out.println(maximum);
    }
}

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


Question:
package com.leaf;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();

		int k = 0;
		if(S.equals(T)) {
			System.out.println("yes");
		}else {
			for (int i = 0; i < S.length(); i++) {
				String a = S.substring(0, i);
				if(!T.contains(a)) {
					k = i - 1;
				}
			}
			if(k==0) {
				System.out.println("no");
			}else {
				if((!S.substring(k,S.length()-1).equals(""))&&T.contains(S.substring(k,S.length()-1))) {
					System.out.println("yes");
				}else {
					System.out.println("no");
				}
			}
		}

	}

}

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


Question:
import java.util.Scanner;

class A {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		StringBuilder s=new StringBuilder(scan.nextLine());
		s.setCharAt(5,' ');		s.setCharAt(13,' ');
		System.out.println(s);
	}

}

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


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

public class Main {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();

    Map<Integer, Integer> map = new HashMap<>();

    long sum = 1;

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

    void run() {

        map = primes(n);

//        System.out.print(map);

        for (int i=2; i<=n; i++) {
            long tmp = 1;
            for (long t: primes(i).values()) {
                tmp *= (long)(t + 1);
            }
            sum += tmp * (long)i;
        }

        System.out.print(sum);

    }
    Map<Integer, Integer> primes(int n) {
        List<Integer> list = new ArrayList<>();
        Map<Integer, Integer> map = new HashMap<>();

        while (n >= 4 && n % 2 == 0) {
            list.add(2);
            n /= 2;
        }
        int d = 3;
        int q = n / d;
        while (q >= d) {
            if (n % d == 0) {
                list.add(d);
                n = q;
            } else {
                d += 2;
            }
            q = n / d;
        }
        list.add(n);

        for (int t: list) {
            if (map.containsKey(t)) {
                map.put(t, map.get(t) + 1);
            } else {
                map.put(t, 1);
            }
        }
        return map;

    }

}

Choices:
- Compile Error
- Runtime Error
- Memory Limit Exceeded
- Time Limit Exceeded


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

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        int[][] arr = new int[n][2];

        Data[] data = new Data[n];
        for (int i=0; i<n; i++) {
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
            data[i] = new Data(arr[i][0], arr[i][1]);
        }

        Arrays.sort(data);

//        System.out.println(data[0].b);

        if (n%2 == 1) {
            System.out.println(data[n%2].b-data[n%2].a+1);
            return;
        }

        int min = data[n/2-1].a + data[n/2].a;

        Data2[] data2s = new Data2[n];
        for (int i=0; i<n; i++) {
            data2s[i] = new Data2(arr[i][0], arr[i][1]);
        }

        Arrays.sort(data2s);
        int max = data2s[n/2-1].b + data2s[n/2].b;

        System.out.println((max-min+1));
    }
    public static class Data implements Comparable<Data> {
        int a, b;
        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }
        public int compareTo(Data other) {
            if (this.a == other.a) {
                return this.b - other.b;
            } else {
                return this.a - other.a;
            }
        }
    }
    public static class Data2 implements Comparable<Data> {
        int a, b;
        public Data2(int a, int b) {
            this.a = a;
            this.b = b;
        }
        public int compareTo(Data other) {
            if (this.a == other.a) {
                return this.b - other.b;
            } else {
                return other.a - this.a;
            }
        }
    }
}

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


Question:
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();

        long ans = 0;

        long[] arr = new long[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextLong();
//        Arrays.sort(arr);

        int cnt = n / 2;

        long ansS = 0;
        long ansT = 0;
        long ansTemp = 0;

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

        for (int i=0; i<n; i++) list.add(arr[i]);

        for (int i=n-1; i>=n-1-(cnt-1)*2; i-=2) {
            ansS += arr[i];
        }
        for (int i=n-2; i>=n-2-(cnt-1)*2; i-=2) {
            ansT += arr[i];
        }
        for (int i=n-3; i>=n-3-(cnt-1)*2; i-=2) {
            ansTemp += arr[i];
        }

//        System.out.print(ansS);
//        System.out.print(ansT);

        System.out.println(Math.max(Math.max(ansS, ansT), ansTemp));
//        System.out.print(list);

    }

}

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


Question:
import java.util.*;

class Main{
  Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {

    int n = sc.nextInt();

    System.out.print( (n + 1) / 2 );

  }

}

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


Question:
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int 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();
        }

//        Map<Integer, Integer> map = new HashMap();

        for (int i=0; i<m; i++){
            if (n<s[i]){
                System.out.println("-1");
                return;
            }
            if (s[i]==1 && c[i]==0){
                System.out.println("-1");
                return;
            }
        }

        Set<Integer> set1 = new HashSet<>();
        Set<Integer> set2 = new HashSet<>();
        Set<Integer> set3 = new HashSet<>();

        for (int i=0; i<m; i++){
            int tmpS = s[i];
            int tmpC = c[i];
            if (tmpS==1){
                set1.add(tmpC);
            }else if (tmpS==2){
                set2.add(tmpC);
            }else if (tmpS==3){
                set3.add(tmpC);
            }
        }

        if (2<=set1.size() || 2<=set2.size() || 2<=set3.size()){
            System.out.println("-1");
            return;
        }

        if (n==1){
            Iterator it = set1.iterator();
            System.out.println(it.next());
        }else if (n==2){
//            StringBuilder sb = new StringBuilder();
            if (set1.size()==0){
                System.out.print(1);
            }else {
                Iterator it = set1.iterator();
                System.out.print(it.next());
            }
//            String tmpIt = (String)it.next();
//            sb.append(tmpIt);
            if (set2.size()==0){
                System.out.print(0);
            }else {
                Iterator its = set2.iterator();
                System.out.print(its.next());
            }
//            Iterator its = set2.iterator();
//            String tmpIts = (String) its.next();
//            sb.append(tmpIts);
//            System.out.print(its.next());
        }else if (n==3){
            if (set1.size()==0){
                System.out.print(1);
                if (set2.size()==0){
                    System.out.print(0);
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator it = set3.iterator();
                        System.out.print(it.next());
                    }
                }else {
                    Iterator it = set2.iterator();
                    System.out.print(it.next());
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator its = set3.iterator();
                        System.out.print(its.next());
                    }
                }
            }else {
                Iterator it = set1.iterator();
                System.out.print(it.next());
                if (set2.size()==0){
                    System.out.print(0);
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator its = set3.iterator();
                        System.out.print(its.next());
                    }
                }else {
                    Iterator its = set2.iterator();
                    System.out.print(its.next());
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator itss = set3.iterator();
                        System.out.print(itss.next());
                    }
                }

            }

        }
//        for (int i=0; i<m; i++){
//            int key = s[i];
//            int value = c[i];
//            map.put(key,value);
//        }

//        for (int i=0; i<map.size(); i++){
//
//        }

    }
}

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


Question:
import java.util.*;

public class A {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int 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();
        }

//        Map<Integer, Integer> map = new HashMap();

        for (int i=0; i<m; i++){
            if (n<s[i]){
                System.out.println("-1");
                return;
            }
            if (s[i]==1 && c[i]==0){
                System.out.println("-1");
                return;
            }
        }

        Set<Integer> set1 = new HashSet<>();
        Set<Integer> set2 = new HashSet<>();
        Set<Integer> set3 = new HashSet<>();

        for (int i=0; i<m; i++){
            int tmpS = s[i];
            int tmpC = c[i];
            if (tmpS==1){
                set1.add(tmpC);
            }else if (tmpS==2){
                set2.add(tmpC);
            }else if (tmpS==3){
                set3.add(tmpC);
            }
        }

        if (2<=set1.size() || 2<=set2.size() || 2<=set3.size()){
            System.out.println("-1");
            return;
        }

        if (n==1){
            Iterator it = set1.iterator();
            System.out.println(it.next());
        }else if (n==2){
//            StringBuilder sb = new StringBuilder();
            if (set1.size()==0){
                System.out.print(1);
            }else {
                Iterator it = set1.iterator();
                System.out.print(it.next());
            }
//            String tmpIt = (String)it.next();
//            sb.append(tmpIt);
            if (set2.size()==0){
                System.out.print(0);
            }else {
                Iterator its = set2.iterator();
                System.out.print(its.next());
            }
//            Iterator its = set2.iterator();
//            String tmpIts = (String) its.next();
//            sb.append(tmpIts);
//            System.out.print(its.next());
        }else if (n==3){
            if (set1.size()==0){
                System.out.print(1);
                if (set2.size()==0){
                    System.out.print(0);
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator it = set3.iterator();
                        System.out.print(it.next());
                    }
                }else {
                    Iterator it = set2.iterator();
                    System.out.print(it.next());
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator its = set3.iterator();
                        System.out.print(its.next());
                    }
                }
            }else {
                Iterator it = set1.iterator();
                System.out.print(it.next());
                if (set2.size()==0){
                    System.out.print(0);
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator its = set3.iterator();
                        System.out.print(its.next());
                    }
                }else {
                    Iterator its = set2.iterator();
                    System.out.print(its.next());
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator itss = set3.iterator();
                        System.out.print(itss.next());
                    }
                }

            }

        }
//        for (int i=0; i<m; i++){
//            int key = s[i];
//            int value = c[i];
//            map.put(key,value);
//        }

//        for (int i=0; i<map.size(); i++){
//
//        }

    }
}

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


Question:
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int 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();
        }

//        Map<Integer, Integer> map = new HashMap();

        for (int i=0; i<m; i++){
            if (n<s[i]){
                System.out.println("-1");
                return;
            }
            if (s[i]==1 && c[i]==0){
                System.out.println("-1");
                return;
            }
        }

        Set<Integer> set1 = new HashSet<>();
        Set<Integer> set2 = new HashSet<>();
        Set<Integer> set3 = new HashSet<>();

        for (int i=0; i<m; i++){
            int tmpS = s[i];
            int tmpC = c[i];
            if (tmpS==1){
                set1.add(tmpC);
            }else if (tmpS==2){
                set2.add(tmpC);
            }else if (tmpS==3){
                set3.add(tmpC);
            }
        }

        if (2<=set1.size() || 2<=set2.size() || 2<=set3.size()){
            System.out.println("-1");
            return;
        }

        if (n==1){
            Iterator it = set1.iterator();
            System.out.println(it.next());
        }else if (n==2){
//            StringBuilder sb = new StringBuilder();
            if (set1.size()==0){
                System.out.print(1);
            }else {
                Iterator it = set1.iterator();
                System.out.print(it.next());
            }
//            String tmpIt = (String)it.next();
//            sb.append(tmpIt);
            Iterator its = set2.iterator();
//            String tmpIts = (String) its.next();
//            sb.append(tmpIts);
            System.out.print(its.next());
        }else if (n==3){
            if (set1.size()==0){
                System.out.print(1);
                if (set2.size()==0){
                    System.out.print(0);
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator it = set3.iterator();
                        System.out.print(it.next());
                    }
                }else {
                    Iterator it = set2.iterator();
                    System.out.print(it.next());
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator its = set3.iterator();
                        System.out.print(its.next());
                    }
                }
            }else {
                Iterator it = set1.iterator();
                System.out.print(it.next());
                if (set2.size()==0){
                    System.out.print(0);
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator its = set3.iterator();
                        System.out.print(its.next());
                    }
                }else {
                    Iterator its = set2.iterator();
                    System.out.print(its.next());
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator itss = set3.iterator();
                        System.out.print(itss.next());
                    }
                }

            }

        }
//        for (int i=0; i<m; i++){
//            int key = s[i];
//            int value = c[i];
//            map.put(key,value);
//        }

//        for (int i=0; i<map.size(); i++){
//
//        }

    }
}

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


Question:
import java.util.*;

public class A {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int 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();
        }

//        Map<Integer, Integer> map = new HashMap();

        for (int i=0; i<m; i++){
            if (n<s[i]){
                System.out.println("-1");
                return;
            }
            if (s[i]==1 && c[i]==0){
                System.out.println("-1");
                return;
            }
        }

        Set<Integer> set1 = new HashSet<>();
        Set<Integer> set2 = new HashSet<>();
        Set<Integer> set3 = new HashSet<>();

        for (int i=0; i<m; i++){
            int tmpS = s[i];
            int tmpC = c[i];
            if (tmpS==1){
                set1.add(tmpC);
            }else if (tmpS==2){
                set2.add(tmpC);
            }else if (tmpS==3){
                set3.add(tmpC);
            }
        }

        if (2<=set1.size() || 2<=set2.size() || 2<=set3.size()){
            System.out.println("-1");
            return;
        }

        if (n==1){
            Iterator it = set1.iterator();
            System.out.println(it.next());
        }else if (n==2){
//            StringBuilder sb = new StringBuilder();
            if (set1.size()==0){
                System.out.print(1);
            }else {
                Iterator it = set1.iterator();
                System.out.print(it.next());
            }
//            String tmpIt = (String)it.next();
//            sb.append(tmpIt);
            Iterator its = set2.iterator();
//            String tmpIts = (String) its.next();
//            sb.append(tmpIts);
            System.out.print(its.next());
        }else if (n==3){
            if (set1.size()==0){
                System.out.print(1);
                if (set2.size()==0){
                    System.out.print(0);
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator it = set3.iterator();
                        System.out.print(it.next());
                    }
                }else {
                    Iterator it = set2.iterator();
                    System.out.print(it.next());
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator its = set3.iterator();
                        System.out.print(its.next());
                    }
                }
            }else {
                Iterator it = set1.iterator();
                System.out.print(it.next());
                if (set2.size()==0){
                    System.out.print(0);
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator its = set3.iterator();
                        System.out.print(its.next());
                    }
                }else {
                    Iterator its = set2.iterator();
                    System.out.print(its.next());
                    if (set3.size()==0){
                        System.out.print(0);
                    }else {
                        Iterator itss = set3.iterator();
                        System.out.print(itss.next());
                    }
                }

            }

        }
//        for (int i=0; i<m; i++){
//            int key = s[i];
//            int value = c[i];
//            map.put(key,value);
//        }

//        for (int i=0; i<map.size(); i++){
//
//        }

    }
}

Choices:
- Compile Error
- Runtime 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 n = sc.nextInt();
        int m = sc.nextInt();
        int v = sc.nextInt();
        int p = sc.nextInt();

        int[] a = new int[n];

        for (int i=0; i<n; i++) a[i] = sc.nextInt();
        Arrays.sort(a);

        int[] copy_a = a;

        int base_cnt = 0;

        int div = a[n-p];

        int idx = 0;

        for (int i=0; i<n; i++){
            if (a[i]==div){
                base_cnt = (n-i);
                idx = i;
                break;
            }
        }

//        System.out.println(base_cnt);

        if ((a[idx]-a[idx-1])>m){
            System.out.println(base_cnt);
            return;
        }

        int[][] copy_idx = new int[n][2];

        for (int i=0; i<n; i++){
            copy_idx[i][0] = a[i];
            copy_idx[i][1] = i;
        }

        for (int i=0; i<v; i++){
            copy_idx[i][0] += m;
        }

        Arrays.sort(copy_idx, (x, y) -> Integer.compare(x[0], y[0]));

        int tmp = copy_idx[n-p][0];

//        System.out.println(tmp);

        int ans = 0;

        for (int i=0; i<n; i++){
            if (tmp==copy_idx[i][0]){
                ans = idx - copy_idx[i][1];
                break;
            }
        }
        System.out.println(base_cnt+ans);

    }
}

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


Question:
import java.util.*;

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

        String s = sc.next();
        char[] c = s.toCharArray();

        long k = sc.nextLong();

        long ans = 0;

        int cnt = 1;
        for (int i=0; i<s.length()-1; i++){
            if (c[i]==c[i+1]) {
                cnt++;
            }
        }
//        System.out.println(cnt);
        if (cnt==s.length()){
            System.out.println(((long)s.length()*k)/2);
        }else {
            if (c[0]==c[s.length()-1]){
                char[] cc = new char[s.length()*2];
                long tmp = 0;
                for (int j=0; j<s.length()*2-1; j++){
                    if (c[j]==c[j+1]){
                        tmp++;
                        j++;
                    }
                }
                for (int j=0; j<s.length()-1; j++){
                    if (c[j]==c[j+1]){
                        ans++;
                        j++;
                    }
                }
                if (tmp == ans*2){
                    System.out.println(ans*k);
                }else {
                    System.out.println(ans+(ans+1)*(k-1));
                }

            }else {
                for (int i=0; i<s.length()-1; i++){
                    if (c[i]==c[i+1]){
                        ans++;
                        i++;
                    }
                }
                System.out.println(ans*k);
            }
        }
    }
}

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


Question:
import java.util.*;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        int h = sc.nextInt();
        int w = sc.nextInt();

        String str[] = new String[h];
        for (int i=0; i<h; i++){
            str[i] = sc.next();
        }

        char point[][] = new char[h][w];

        for (int i=0; i<h; i++){
            for (int j=0; j<w; j++){
                point[i][j] = str[i].charAt(j);
            }
        }

        int count = 0;

        int max_count[] = new int[h*w];

        for (int i=0; i<h; i++){
            for (int j=0; j<w; j++){
                count = 0;
                if (point[i][j]=='#'){
                    continue;
                }
                else if (point[i][j]=='.'){
                    for (int k=i-1; 0<=k; k--){
                        if(point[i][k]=='#'){
                            break;
                        }
                        count++;
                    }

                    for (int l=i+1; l<w; l++){
                        if (point[i][l]=='#'){
                            break;
                        }
                        count++;
                    }

                    for (int m=i-1; 0<=m; m--){
                        if (point[m][j]=='#'){
                            break;
                        }
                        count++;
                    }

                    for (int n=i+1; n<h; n++){
                        if (point[n][j]=='#'){
                            break;
                        }
                        count++;
                    }
                }
                max_count[i*j]=count;
            }
        }
        for (int i=0; i<h*w; i++){
            count = Math.max(count, max_count[i]);
        }
        System.out.println(count + 1);

    }
}

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


Question:
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] arr = new char[h+1][w+1];

        StringBuilder sb = new StringBuilder();

        for (int i=0; i<h; i++) {
            arr[i] = sc.next().toCharArray();
        }

        List<char[]> list = new ArrayList<>();

        for (int i=0; i<h; i++) {
            int cnt = 0;
            for (int j=0; j<w; j++) {
                if (arr[i][j] == '.') cnt++;
            }
            if (cnt != w) {
                char[] tmp = arr[i];
                list.add(tmp);
            }
        }

//        System.out.println(list);

        char[][] s = new char[list.size()][w];

        for (int i=0; i<list.size(); i++) {
            s[i] = list.get(i);
        }

        List<char[]> list1 = new ArrayList<>();

        for (int i=0; i<w; i++) {
            int cnt = 0;
            for (int j=0; j<list.size(); j++) {
                if (arr[j][i] == '.') cnt++;
            }
            if (cnt != list.size()) {
                char[] c = new char[list.size()];
                for (int k=0; k<list.size(); k++) {
                    c[k] = s[k][i];
                }
                list1.add(c);
            }

        }

//        System.out.println(list1);

        for (int i=0; i<list1.get(0).length; i++) {
//            System.out.println(list1.get(0)[i]);
        }

        char[][] res = new char[list1.get(0).length][list1.size()];

//        System.out.println(list1.get(0).length);
//        System.out.println(list1.size());

        for (int i=0; i<list1.size(); i++) {
            for (int j=0; j<list1.get(0).length; j++) {
                res[j][i] = list1.get(i)[j];
            }
        }

        for (int i=0; i<res.length; i++) {
            for (int j=0; j<res[0].length-1; j++) {
                sb.append(res[i][j]);
            }
            sb.append(res[i][res[0].length-1] + "\n");
        }

        System.out.println(sb.toString());

    }
}

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


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

public class CF {
    FastScanner in;
    PrintWriter out;

    void solve() {
        String s = in.next();
        String[] arr = s.split(",",3);
        out.println(arr[0]+' '+arr[1]+' '+arr[2]);
    }

    void run() {
        try {
            in = new FastScanner(new File("test.in"));
            out = new PrintWriter(new File("test2.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

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

    public static void main(String[] args) {
        new CF().runIO();
    }
}

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


Question:
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 文字列の入力
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] p = new int[n];

		for ( int i=0; i<n; i++ ) {
			p[i] = sc.nextInt();
		}

		double s = 0.0 ;

		for ( int i=0; i<n-k+1; i++ ) {
			double t = 0.0 ;
			for ( int j=0; j<k; j++ ) {
				double u = ((double)p[i+j] + 1.0)/2.0 ;
				t = t + u ;
			}
			if ( t > s ) {
				s = t ;
			}
		}

		System.out.println(s);
	}
}

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


Question:
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    String S=sc.nextLine();
    String T=sc.nextLine();
    int shortest=1001;
	int data=0;
    char[] Schar=S.toCharArray();
    char[] Tchar=T.toCharArray();
    for(int i=0;i<Schar.length-Tchar.length+1;i++){
      for(int j=0;j<Tchar.length[];j++){
       	if(Schar[i+j]!=Tchar[j]){
          data++;
        }
      }
	  if(data<shortest){
        shortest=data;
      }
       data=0;
    }

  }
}

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


Question:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		String str = sc.next();
		int r=0,g=0,b=0;
		char[] rgb = str.toCharArray();
		for(int i=0;i<length;i++) {
			if(rgb[i]=='R') r++;
			if(rgb[i]=='G') g++;
			if(rgb[i]=='B') b++;
		}
		if(r==0 || g==0 || b==0) {
			System.out.println(0);
			return;
		}
		long ans = r*g*b;
		int len,count=0;
		//if(length%2==0)
		len=length/2-1;
		//else len = length/2;
		for(int i=1;i<=len;i++) {
			for(int j=0;j<length-2*i;j++) {
				if(rgb[j]!=rgb[j+i] && rgb[j]!=rgb[j+2*i] && rgb[j+i]!=rgb[j+2*i]) {
					count++;
				}
			}
		}
		System.out.println(ans-count);
	}
}

Choices:
- Runtime Error
- Compile Error
- Memory Limit Exceeded
- Time Limit Exceeded


Question:
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h =sc.nextInt(), n = sc.nextInt();
		int usm=0;
		for(int i=0;i<n;i++) usm += sc.nextInt();
		if(sum>=h) System.out.println("Yes");
		else System.out.println("No");
	}
}

Choices:
- No abnormally found
- Time Limit Exceeded
- Runtime Error
- 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(n*n-1/2);
  }
}

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


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[] array = new int[5];
		for(int i=0;i<n;i++) {
			char[] temp = sc.next().toCharArray();
			char top = temp[0];
			if(top=='M') array[0]++;
			if(top=='A') array[1]++;
			if(top=='R') array[2]++;
			if(top=='C') array[3]++;
			if(top=='H') array[4]++;
		}
		sc.close();
		long ans=0;
		for(int i=0;i<n-2;i++) {
			for(int j=i+1;j<n-1;j++) {
				for(int k=j+1;k<n;k++) ans += (long)array[i]*array[j]*array[k];
			}
		}
		System.out.println(ans);
	}
}

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


Question:
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int A = sc.nextInt();
		// スペース区切りの整数の入力
		int B = sc.nextInt();
		int T = sc.nextInt();
		int s = T/A
		System.out.println( s*b);
	}
}

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


Question:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {

	static long[] dp;
	public static void main(String[] args) throws Exception {

		//int N = scan.nextInt();
		//long L = scan.nextLong();
		//double D = scan.nextDouble();
		//char[] A = scan.next().toCharArray();
		int N = scan.nextInt();
		long ans = 0;
		dp = new long[N+1];
		for(int i=1; i<=N; i++){

			ans += i*f(i);
		}

		out.println(ans);
		out.flush();
	}

	static long f(int n){
		if(n == 1)return dp[n] = 1;
		if(n == 2)return dp[n] = 2;
		if(n == 3)return dp[n] = 2;
		if(dp[n] != 0) return dp[n];
		int p = 2;

		while(p*p <= n){
			if(n % p == 0){
				int new_n = n;
				int tmp = 0;
				while(new_n % p == 0){
					new_n /= p;
					tmp++;
				}
				return dp[n] = (tmp+1) * f(new_n);
			}
			if(p % 2 == 1){
				p+=2;
			}else{
				p++;
			}
		}
		return dp[n] = 2;
	}
/*
	static long f(int M){
		if(dp[M] != 0){
			return M*dp[M];
		}
		List<long[]> p = factorization(M);
		long tmp = 1;
		int m = 1;
		for(long[] p_ : p){
			m *= Math.pow(p_[0],p_[1]);
			tmp *= (p_[1]+1);
			dp[m] = tmp;
		}
		dp[M] = tmp;
		return tmp;
	}
	static List<long[]> factorization(long M){
		List<long[]> primes = new ArrayList<>();

		long now_prime = 2;
		long now_M = M;
		while(now_prime*now_prime<=M){
			if(now_M%now_prime == 0){
				now_M /= now_prime;
				long[] prime = new long[2];
				prime[0] = now_prime;
				prime[1] = 1;
				while(now_M%now_prime == 0){
					now_M /= now_prime;
					prime[1]++;
				}
				primes.add(prime);

			}
			if(now_prime%2 == 0){
				now_prime++;
			}else{
				now_prime += 2;
			}
		}
		if (now_M>1){
			long[] prime = new long[2];
			prime[0] = now_M;
			prime[1] = 1;
			primes.add(prime);
		}

		return primes;
	}
	*/
	static FastScanner scan = new FastScanner();
	static PrintWriter out = new PrintWriter(System.out);
	static long MOD = 1_000_000_007;

	static int[] dx = {1,-1,0,0};
	static int[] dy = {0,0,1,-1};
	static int[] dx8 = {1,-1,0,0,1,1,-1,-1};
	static int[] dy8 = {0,0,1,-1,1,-1,1,-1};

	//GCD最大公約数を返す
	static long gcd(long a, long b){
		if(b == 0) return a;
		return gcd(b, a%b);
	}

	//aとbの最小公倍数を返す
	static long lcm (long a, long b) {
		return ((a/gcd(a,b))*b);
	}

	//入力
	//https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        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 (b < '0' || '9' < b) {
	            throw new NumberFormatException();
	        }
	        while(true){
	            if ('0' <= b && b <= '9') {
	                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());}
	}
}

Choices:
- Compile Error
- Memory Limit Exceeded
- Runtime Error
- Time Limit Exceeded


Question:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {

	static long[] dp;
	public static void main(String[] args) throws Exception {

		//int N = scan.nextInt();
		//long L = scan.nextLong();
		//double D = scan.nextDouble();
		//char[] A = scan.next().toCharArray();
		int N = scan.nextInt();
		long ans = 0;
		dp = new long[N+1];
		for(int i=N; i>=1; i--){

			ans += i*f(i);
		}

		out.println(ans);
		out.flush();
	}

	static long f(int n){
		if(n == 1)return dp[n] = 1;
		if(n == 2)return dp[n] = 2;
		if(n == 3)return dp[n] = 2;
		if(dp[n] != 0) return dp[n];
		int p = 2;

		while(p*p <= n){
			if(n % p == 0){
				int new_n = n;
				int tmp = 0;
				while(new_n % p == 0){
					new_n /= p;
					tmp++;
				}
				return dp[n] = (tmp+1) * f(new_n);
			}
			if(p % 2 == 1){
				p+=2;
			}else{
				p++;
			}
		}
		return dp[n] = 2;
	}
/*
	static long f(int M){
		if(dp[M] != 0){
			return M*dp[M];
		}
		List<long[]> p = factorization(M);
		long tmp = 1;
		int m = 1;
		for(long[] p_ : p){
			m *= Math.pow(p_[0],p_[1]);
			tmp *= (p_[1]+1);
			dp[m] = tmp;
		}
		dp[M] = tmp;
		return tmp;
	}
	static List<long[]> factorization(long M){
		List<long[]> primes = new ArrayList<>();

		long now_prime = 2;
		long now_M = M;
		while(now_prime*now_prime<=M){
			if(now_M%now_prime == 0){
				now_M /= now_prime;
				long[] prime = new long[2];
				prime[0] = now_prime;
				prime[1] = 1;
				while(now_M%now_prime == 0){
					now_M /= now_prime;
					prime[1]++;
				}
				primes.add(prime);

			}
			if(now_prime%2 == 0){
				now_prime++;
			}else{
				now_prime += 2;
			}
		}
		if (now_M>1){
			long[] prime = new long[2];
			prime[0] = now_M;
			prime[1] = 1;
			primes.add(prime);
		}

		return primes;
	}
	*/
	static FastScanner scan = new FastScanner();
	static PrintWriter out = new PrintWriter(System.out);
	static long MOD = 1_000_000_007;

	static int[] dx = {1,-1,0,0};
	static int[] dy = {0,0,1,-1};
	static int[] dx8 = {1,-1,0,0,1,1,-1,-1};
	static int[] dy8 = {0,0,1,-1,1,-1,1,-1};

	//GCD最大公約数を返す
	static long gcd(long a, long b){
		if(b == 0) return a;
		return gcd(b, a%b);
	}

	//aとbの最小公倍数を返す
	static long lcm (long a, long b) {
		return ((a/gcd(a,b))*b);
	}

	//入力
	//https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        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 (b < '0' || '9' < b) {
	            throw new NumberFormatException();
	        }
	        while(true){
	            if ('0' <= b && b <= '9') {
	                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());}
	}
}

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


Question:
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int K = Integer.parseInt(sc.next());
		Deque<Integer> pre_ = new ArrayDeque<>();
		for(int i=0;i<N;i++){
			pre_.addFirst(Integer.parseInt(sc.next()));
		}

		int ans =0;
		for(int i=0;i<=K;i++){
			//i個(0<=i<=K)取り出す。（K-i個押し戻すことができる）
			for(int j=0;j<=i;j++){
				//左からｊ個取り出す(右からi-j個取り出す)
				Deque<Integer> pre = new ArrayDeque<>();
				Queue<Integer> hand = new PriorityQueue<>();
				for(int p : pre_){
					pre.addFirst(p);
				}
				for(int left=0;left<j;left++){
					int get = pre.pollFirst();
					hand.add(get);
				}
				for(int right=0;right<i-j;right++){
					int get = pre.pollLast();
					hand.add(get);
				}
				//最大K-i個分消す。マイナスだったら消す
				int count =1;
				while(count <= K-i){
					if (hand.size() == 0)break;
					int min = hand.peek();
					if(min < 0){
						count++;
						hand.poll();
					}else{
						break;
					}
				}
				int tmp_ans = 0;
				for(int p : hand){
					tmp_ans += p;
				}
				ans = Math.max(ans, tmp_ans);
			}

		}

		System.out.println(ans);

	}

}

Choices:
- Memory Limit Exceeded
- Time Limit Exceeded
- Runtime Error
- Compile Error


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

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long A = Long.parseLong(sc.next());
		long B = Long.parseLong(sc.next());
		long ans = A;
		long diff = B-A;

		StringBuffer str ;
		for(long i=A+1; i<B+1; i++){
			ans = ans ^ i;
			//System.out.println(ans);
		}
		System.out.println(ans);
		sc.close();
	}

}

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


Question:
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//int Q = Integer.parseInt(sc.next());
		//long L = Long.parseLong(sc.next());
		//char[] c = sc.next().toCharArray();
		int INF = Integer.MAX_VALUE;
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		long MOD = 1_000_000_007;

		//素因数分解
		List<int[]> primes = new ArrayList<>();

		int now_prime = 2;
		int now_M = M;
		while(now_prime*now_prime<=M){
			if(now_M%now_prime == 0){
				now_M /= now_prime;
				int[] prime = new int[2];
				prime[0] = now_prime;
				prime[1] = 1;
				while(now_M%now_prime == 0){
					now_M /= now_prime;
					prime[1]++;
				}
				primes.add(prime);

			}
			now_prime++;
		}
		if (now_M>1){
			int[] prime = new int[2];
			prime[0] = now_M;
			prime[1] = 1;
			primes.add(prime);
		}

		long ans = 1;

		//二項係数演算用前処理
		long[] fac = new long[2*N];
		fac[0] = 1;
		fac[1] = 1;
		long[] inv = new long[2*N];
		inv[1] = 1;
		long[] finv = new long[2*N];
		finv[0] = 1;
		finv[1] = 1;
		for(int i=2;i<2*N;i++){
			fac[i] = (fac[i-1]*i)%MOD;
			inv[i] = MOD - inv[(int) (MOD%i)]*(MOD/i)%MOD;
			finv[i] = (finv[i-1] * inv[i]) % MOD;
		}

		for(int[] prime : primes){
			//因数K個のN分割を求める
			int K = prime[1];
			ans *= (fac[N+K-1] * (finv[K] * finv[N-1])%MOD)%MOD;
			ans %= MOD;
		}
		ans %= MOD;
		System.out.println(ans);

	}
}

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


Question:
package main;

import java.util.*;
import java.util.stream.*;
import java.io.*;

public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] in1 = br.readLine().split(" ");
        String[] in2 = br.readLine().split(" ");
        int H = Integer.parseInt(in1[0]);
        int N = Integer.parseInt(in1[1]);

        br.close();
        int sum = Arrays.stream(in2)
                        .mapToInt(Integer::parseInt)
                        .sum();

        System.out.println(sum >= H ? "Yes" : "No");
    }
}

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


Question:
import java.util.Scanner;

public class Main {
	static long searchLow(long A[] , long B[]){
		long left = 0;
		long right = 1000000000;
		int N = A.length;
		while(right - left > 1){
			long mid = (left + right) / 2;
			int large = 0;
			int small = 0;
			for(int i = 0 ; i < A.length ; ++i){
				if(mid < A[i]){
					++large;
				}
				if(mid > B[i]){
					++small;
				}
			}
			int other = A.length - small - large;
			if(small + other > N / 2){
				right = mid;
			}else{
				left = mid;
			}
		}
		return right;
	}
	static long searchHigh(long A[] , long B[]){
		long left = 0;
		long right = 1000000000;
		int N = A.length;
		while(right - left > 1){
			long mid = (left + right) / 2;
			int large = 0;
			int small = 0;
			for(int i = 0 ; i < A.length ; ++i){
				if(mid < A[i]){
					++large;
				}
				if(mid > B[i]){
					++small;
				}
			}
			int other = A.length - small - large;
//			System.out.println(small+" "+large+" "+mid+" "+other);
			if(large + other > N / 2){
				left = mid;
			}else{
				right = mid;
			}
		}
//		System.out.println(left+" "+right);
		return left;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long A[] = new long[N];
		long B[] = new long[N];
		for(int i = 0 ; i < N ; ++i){
			A[i] = sc.nextLong();
			B[i] = sc.nextLong();
		}
		if(N % 2 == 1){
			long low = searchLow(A, B);
			long high = searchHigh(A, B);
//			System.out.println(low+" "+high);
			System.out.println((high - low + 1));
		}else{
			System.out.println(A[-1]);
		}
	}
}

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