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 a[] = new int[N];
		int place = 0;
		for(int i=0; i<N; i++){
			a[i] = sc.nextInt();
			if(a[i]==1)place = i;
		}
		int num = 0;
		num1 += (place+K-2)/(K-1);
		num2 += (N-place+K-3)/(K-1);
		System.out.println(num1+num2);
	}
}

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


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

public class Main {
    static int[] mx = {1,0,0,-1};
    static int[] my = {0,1,-1,0};
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[][] step = new int[n][n];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                step[i][j] = Math.min(i,Math.min(j,Math.min(n-1-i,n-1-j)));
            }
        }
        long ans = 0;
        boolean[][] removed = new boolean[n][n];
        Deque<Point> q = new ArrayDeque<Point>();
        for(int i = 0; i < n*n; i++){
            int now = sc.nextInt()-1;
            int h = now/n;
            int w = now%n;
            ans += step[h][w];
            removed[h][w] = true;
            q.add(new Point(h,w,step[h][w]));
            while(q.size() > 0){
                Point p = q.poll();
                step[p.h][p.w] = Math.min(step[p.h][p.w],p.cnt);
                int cnt = removed[p.h][p.w] ? p.cnt : p.cnt+1;
                for(int j = 0; j < 4; j++){
                    int nx = p.w+mx[j];
                    int ny = p.h+my[j];
                    if(check(ny,nx,n) && step[ny][nx] > p.cnt){
                        q.add(new Point(ny,nx,cnt));
                    }
                }
            }
        }
        System.out.println(ans);
    }

    public static boolean check(int y, int x, int n){
        return (0 <= y && y < n && 0 <= x && x < n);
    }
}

class Point{
    int h,w,cnt;
    public Point(int h, int w, int c){
        this.h = h;
        this.w = w;
        this.cnt = c;
    }
}
class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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


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

public class Main {
    static int[] mx = {1,0,0,-1};
    static int[] my = {0,1,-1,0};
    static boolean[][] checked;
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[][] step = new int[n][n];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                step[i][j] = Math.min(i,Math.min(j,Math.min(n-1-i,n-1-j)));
            }
        }
        long ans = 0;
        boolean[][] removed = new boolean[n][n];
        Deque<Point> q = new ArrayDeque<Point>();
        for(int i = 0; i < n*n; i++){
            checked = new boolean[n][n];
            int now = sc.nextInt()-1;
            int h = now/n;
            int w = now%n;
            ans += step[h][w];
            checked[h][w] = true;
            removed[h][w] = true;
            q.add(new Point(h,w,step[h][w]));
            while(q.size() > 0){
                Point p = q.poll();
                /*
                if(step[p.h][p.w] > p.cnt){
                    step[p.h][p.w] = Math.min(step[p.h][p.w],p.cnt);

                    for(int j = 0; j < 4; j++){
                        int nx = p.w+mx[j];
                        int ny = p.h+my[j];
                        if(check(ny,nx,n) && !checked[ny][nx]){
                            checked[ny][nx] = true;
                            int nextCnt = removed[p.h][p.w] ? p.cnt : p.cnt++;
                            q.add(new Point(ny,nx,nextCnt));
                        }
                    }

                }
                */
                step[p.h][p.w] = Math.min(step[p.h][p.w],p.cnt);
                int cnt = removed[p.h][p.w] ? p.cnt : p.cnt+1;
                for(int j = 0; j < 4; j++){
                    int nx = p.w+mx[j];
                    int ny = p.h+my[j];
                    if(check(ny,nx,n) && step[ny][nx] > p.cnt){
                        //checked[ny][nx] = true;
                        q.add(new Point(ny,nx,cnt));
                    }
                }
            }
            /*
            System.out.println(h + " "+ w);
            for(int k = 0; k < n; k++){
                for(int j = 0; j < n; j++){
                   System.out.print(step[k][j] + " ");
                }
                System.out.println();
            }
            System.out.println(ans);
            */
        }
        System.out.println(ans);
    }

    public static boolean check(int y, int x, int n){
        return (0 <= y && y < n && 0 <= x && x < n);
    }
}

class Point{
    int h,w,cnt;
    public Point(int h, int w, int c){
        this.h = h;
        this.w = w;
        this.cnt = c;
    }
}
class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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


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

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        char[] s = sc.next().toCharArray();
        ArrayList<HashSet<Integer>> map = new ArrayList<>();
        Integer[][] arr = new Integer[26][];
        for(int i = 0; i < 26; i++){
            map.add(new HashSet<Integer>());
        }
        for(int i = 0; i < n; i++){
            map.get(s[i]-'a').add(i);
        }
        for(int i = 0; i < 26; i++){
            Integer[] tmp = map.get(i).toArray(new Integer[map.get(i).size()]);
            Arrays.sort(tmp);
            arr[i] = tmp;
        }
        int q = sc.nextInt();
        for(int i = 0; i < q; i++){
            int type = sc.nextInt();
            if(type == 1){
                int iq = sc.nextInt()-1;
                char cq = sc.next().charAt(0);
                if(s[iq] == cq){
                    continue;
                }else{
                    map.get(s[iq]-'a').remove(iq);
                    map.get(cq-'a').add(iq);
                    Integer[] tmps = map.get(s[iq]-'a').toArray(new Integer[map.get(s[iq]-'a').size()]);
                    Arrays.sort(tmps);
                    arr[s[iq]-'a'] = tmps;
                    Integer[] tmpc = map.get(cq-'a').toArray(new Integer[map.get(cq-'a').size()]);
                    Arrays.sort(tmpc);
                    arr[cq-'a'] = tmpc;
                    s[iq] = cq;
                }
            }else{
                int ans = 0;
                int l = sc.nextInt()-1;
                int r = sc.nextInt();
                for(int j = 0; j < 26; j++){
                    int size = map.get(j).size();
                    if(size == 0){
                        continue;
                    }
                    int left = ~Arrays.binarySearch(arr[j], l, (x,y)->x.compareTo(y)>=0?1:-1);
                    int right = ~Arrays.binarySearch(arr[j], r, (x,y)->x.compareTo(y)>=0?1:-1);
                    if(right > left){
                        ans++;
                    }
                }
                System.out.println(ans);
            }
        }
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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


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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean chk = true;
        HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
        for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            if(map.containsKey(a)){
                chk = false;
                break;
            }else{
                map.put(a,1);
            }
        }
    if(chk){
        System.out.println("YES");
    }else{
        System.out.println("NO");
    }
}

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


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

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        ArrayList<Key> keys = new ArrayList<>();
        for(int i = 0; i < m; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            int t = 0;
            for(int j = 0; j < b; j++){
                t += 1 << (sc.nextInt()-1);
            }
            keys.add(new Key(a,b,t));
        }
        int[][] dp = new int[m+1][n*n+1];
        for(int i = 0; i <= m; i++){
            Arrays.fill(dp[i],Integer.MAX_VALUE/2);
        }
        dp[0][0] = 0;
        for(int i = 0; i < m; i++){
            Key k = keys.get(i);
            for(int j = 0; j < n*n; j++){
                dp[i+1][j] = Math.min(dp[i+1][j],dp[i][j]);
                dp[i+1][j | k.t] = Math.min(dp[i+1][j | k.t], dp[i][j] + k.c);
            }
        }
        System.out.println(dp[m][n*n-1] == Integer.MAX_VALUE/2 ? -1 : dp[m][n*n-1]);
    }
}

class Key{
    int c, o, t;
    public Key(int c, int o, int t){
        this.c = c;
        this.o = o;
        this.t = t;
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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


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

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        ArrayList<Key> keys = new ArrayList<>();
        for(int i = 0; i < m; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            int t = 0;
            for(int j = 0; j < b; j++){
                t += 1 << (sc.nextInt()-1);
            }
            keys.add(new Key(a,b,t));
        }
        int[][] dp = new int[m+1][n*n];
        for(int i = 0; i <= m; i++){
            Arrays.fill(dp[i],Integer.MAX_VALUE/2);
        }
        dp[0][0] = 0;
        for(int i = 0; i < m; i++){
            Key k = keys.get(i);
            for(int j = 0; j < n*n; j++){
                dp[i+1][j] = Math.min(dp[i+1][j],dp[i][j]);
                dp[i+1][j | k.t] = Math.min(dp[i+1][j | k.t], dp[i][j] + k.c);
            }
        }
        System.out.println(dp[m][n*n-1] == Integer.MAX_VALUE/2 ? -1 : dp[m][n*n-1]);
    }
}

class Key{
    int c, o, t;
    public Key(int c, int o, int t){
        this.c = c;
        this.o = o;
        this.t = t;
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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


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

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] a = sc.nextIntArray();
        Arrays.sort(a);
        System.out.println(a[n/2]-a[n/2-1]);

    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
            return tokenizer.nextToken("\n");
    }

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

    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble() {
         return Double.parseDouble(next());
    }

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }
}

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


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

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        long mod = (long)1e9+7;
        int[] left = new int[n+1];
        Arrays.fill(left, -1);
        long[] dp = new long[n+1];
        dp[0] = 1;
        int prev = -1;
        for(int i = 1; i <= n; i++){
            int now = sc.nextInt();
            dp[i] += dp[i-1];
            dp[i] %= mod;
            //pw.println(dp[i]);
            if(prev == now) continue;
            if(left[now] != -1){
                dp[i] += dp[left[now]];
                dp[i] %= mod;
            }
            left[now] = i;
            prev = now;
        }
        pw.println(dp[n]%mod);
        pw.flush();
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }

        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }

    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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


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

public class Main {
	public static void main(String[] args) {
	    FastScanner sc = new FastScanner(System.in);
	    PrintWriter pw = new PrintWriter(System.out);
	    long mod = (long)1e9 + 7;
		char[] s = sc.next().toCharArray();
		int n = s.length;
		long[][] dp = new long[n + 1][4];
		dp[0][3] = 1;
		for(int i = n; i >= 0; --i){
            for(int j = 3; j >= 0; --j){
                if(i == n){
                    dp[i][j] = (j == 3 ? 1 : 0);
                }else{
                    dp[i][j] = dp[i+1][j] * (s[i] == '?' ? 3L : 1L);
                    if(j < 3 && (s[i] == '?' || s[i] == "ABC".CharAt(j))){
                        dp[i][j] += dp[i+1][j+1];
                    }
                    dp[i][j] %= mod;
                }
            }
        }
        pw.println(dp[0][0]);
        pw.flush();
	}
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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


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

public class Main {
	public static void main(String[] args) {
	    FastScanner sc = new FastScanner(System.in);
	    PrintWriter pw = new PrintWriter(System.out);
	    long mod = (long)1e9 + 7;
	    int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		long[][] dp = new long[n + 1][4];
		dp[0][3] = 1;
		for(int i = n; i >= 0; --i){
            for(int j = 3; j >= 0; --j){
                if(i == n){
                    dp[i][j] = (j == 3 ? 1 : 0);
                }else{
                    dp[i][j] = dp[i+1][j] * (s[i] == '?' ? 3L : 1L);
                    if(j < 3 && (s[i] == '?' || s[i] == "ABC".charAt(j))){
                        dp[i][j] += dp[i+1][j+1];
                    }
                    dp[i][j] %= mod;
                }
            }
        }
        pw.println(dp[0][0]);
        pw.flush();
	}
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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


Question:
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		HashMap hs = new HashMap();
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next()) - 1;
		int m = Integer.parseInt(sc.next());
		int[][] s = new int[2][m];
		for(int i = 0 ; i < m ; i++){
			for(int j = 0 ; j < 2 ; j++){
				s[j][i] = Integer.parseInt(sc.next());
			}
			s[0][i]--;
			s[1][i] += 48;
		}
		sc.close();
		boolean ebishu = true;
		int k = 0;
		if(n == 0 && s[1][0] == 48){
			ou.print(0);
			ebishu = false;
		}
		for(k = (int)Math.pow(10 , n) ; k <= (int)Math.pow(10 , n + 1) && ebishu ; k++){
			String ss = String.valueOf(k);
			boolean ebi = true;
			for(int i = 0 ; i < m && ebi ; i++){
				if((int)ss.charAt(s[0][i]) != s[1][i]) ebi = false;
			}
			if(ebi){
				ou.print(k);
				ebishu = false;
				break;
			}
		}
		if(ebishu) ou.print(-1);
		ou.print("\n");
		ou.flush();
	}
}

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


Question:
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next()) - 1;
		int m = Integer.parseInt(sc.next());
		int[][] s = new int[2][m];
		for(int i = 0 ; i < m ; i++){
			for(int j = 0 ; j < 2 ; j++){
				s[j][i] = Integer.parseInt(sc.next());
			}
			s[0][i]--;
		}
		sc.close();
		boolean ebishu = true;
		int k = (int)Math.pow(10 , n);
		while(ebishu){
			String ss = String.valueOf(k);
			boolean ebi = true;
			for(int i = 0 ; i < n && ebi ; i++){
				if((int)ss.charAt(s[0][i]) - 48 != s[1][i]) ebi = false;
			}
			if(ebi){
				ebishu = false;
				ou.print(k);
			}
			k++;
			if(k >= Math.pow(10 , n + 1)){
				ebishu = false;
				ou.print(-1);
			}
		}
		ou.print("\n");
		ou.flush();
	}
}

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


Question:
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                int n = sc.nextInt();
                String[] q = new String[n];
                for(int i = 0 ; i < n ; i++){
                        q[i] = sc.next();
                }
                for(String s : q){
                        int c = 0;
                        if(hs.containsKey(s)) c = (int)hs.get(s);
                        hs.put(s , c + 1);
                }
                int[] qq = {0};
                hs.forEach((s , c) -> {
                        qq[0] = Math.max(qq[0] , (int)c);
                });
                String[] u = new String[n];
                int[] yono = {0};
                hs.forEach((s , cc) -> {
                        if((int)cc == qq[0]){
                                u[yono[0]] = (String)s;
                                yono[0]++;
                        }
                });
                sc.close();
                String[] it = new String[yono[0]];
                for(int i = 0 ; i < yono[0] ; i++){
                        it[i] = u[i];
                }
                Arrays.sort(it);
                for(int i = 0 ; i < yono[0] ; i++){
                        System.out.println(it[i]);
                }
        }
}

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


Question:
import java.util.*;
public class Main1 {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                int n = sc.nextInt();
                String[] q = new String[n];
                for(int i = 0 ; i < n ; i++){
                        q[i] = sc.next();
                }
                for(String s : q){
                        int c = 0;
                        if(hs.containsKey(s)) c = (int)hs.get(s);
                        hs.put(s , c + 1);
                }
                int[] qq = {0};
                hs.forEach((s , c) -> {
                        qq[0] = Math.max(qq[0] , (int)c);
                });
                hs.forEach((s , cc) -> {
                        if((int)cc == qq[0]) System.out.println(s);
                });
                sc.close();
        }
}

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


Question:
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        long s = 0;
        for(int i = 1 ; i < a ; i++ ){
            if(a % i == 0 && b % i == 0){
                s = i;
            }
        }
        long q = a * b / s;
        System.out.println(q);
        sc.close();
    }
}

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


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

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


Question:
import java.util.*;
import java.io.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                PrintWriter ou = new PrintWriter(System.out);
                long a = Long.parseLong(sc.next());
                long b = Long.parseLong(sc.next());
                int c = Integer.parseInt(sc.next());
                int d = Integer.parseInt(sc.next());
                sc.close();
                int cc = c;
                int dd = d;
                long s = 1;
                for(int i = 2 ; i <= c ; i++){
                        if(c % i == 0 && d % i == 0){
                                s *= i;
                                c /= i;
                                d /= i;
                                i--;
                        }
                }
                a--;
                s *= c * (long)d;
                long yono = b - a - b / cc + a / cc - b / dd + a / dd + b / s - a / s;
                ou.print(yono + "\n");
                ou.flush();
        }
}

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


Question:
import java.util.*;
import java.io.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                long a = Long.parseLong(sc.next());
                long b = Long.parseLong(sc.next());
                int c = Integer.parseInt(sc.next());
                int d = Integer.parseInt(sc.next());
                sc.close();
                int cc = c;
                int dd = d;
                long s = 1;
                for(int i = 2 ; i <= c ; i++){
                        if(c % i == 0 && d % i == 0){
                                s *= i;
                                c /= i;
                                d /= i;
                                i--;
                        }
                }
                s *= c * (long)d;
                long yono = 1;
                yono += b - a;
                a--;
                yono -= b / cc - a / cc;
                yono -= b / dd - a / dd;
                yono += b / s - a / s;
                ou.print(yono + "\n");
                ou.flush();
        }
}

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


Question:
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        if(c > d){
            int cha = c;
            c = d;
            d = cha;
        }
        int re = 1;
        for(int i = 1;i <= c; i++){
            if(c % i == 0 && d % i == 0){
                re = i;
            }
        }
        int g = c * d / re;
        int syu = g + 1 - g / c - g / d;
        int s = 0;
        int aa = a % g;
        int bb = b % g;
        if(aa - bb < 0){
            s = s + syu * (b - a + aa - bb) / g;
            for(int i = aa + 1;i <= bb ; i++){
                if(i % c != 0 && i % d != 0){
                    s++;
                }
            }
            s++;
        }else{
            s = s + syu * (aa - a - bb + b) / g;
            for(int i = bb + 1;i <= aa ; i++){
                if(i % c != 0 && i % d != 0){
                    s--;
                }
            }
        }
        System.out.println(s);
        sc.close();
    }
}

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


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

public class Main {

	class Node implements Comparable<Node>{
		int left, right;

		public Node(int left, int right) {
			this.left  = left;
			this.right = right;
		}

		@Override
		public int compareTo(Node o) {
			return right - o.right;
		}
	}

	public Main() {
		FastScanner scanner = new FastScanner();
		int H = scanner.nextInt();
		int W = scanner.nextInt();

		TreeSet<Node>             nodeSet  = new TreeSet<>();
		TreeMap<Integer, Integer> costMap  = new TreeMap<>();

		for (int i = 1; i <= W; i++) {
			nodeSet.add(new Node(i, i));
		}
		costMap.put(0, W);

		Node A = new Node(0,0);
		Node B = new Node(0,0);
		for (int h = 1; h <= H; h++) {
			A.right = scanner.nextInt();
			B.right = scanner.nextInt() + 1;

			SortedSet<Node> sub = nodeSet.subSet(A, B);

			if (!sub.isEmpty()) {

				for (Node node : sub){
					int cost = node.right - node.left;
					int num  = costMap.get(cost);
					if (num != 1) {
						costMap.put(cost, num - 1);
					} else {
						costMap.remove(cost);
					}
				}

				if (B.right != W+1) {
					Node node = sub.last();
					node.right = B.right;
					int cost = node.right - node.left;
					costMap.put(cost, costMap.getOrDefault(node,0)+1);
					nodeSet.add(node);
				}

				sub.clear();
			}
			if (costMap.isEmpty()) {
				System.out.println(-1);
			} else {
				System.out.println(costMap.firstKey() + h);
			}
		}
	}

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

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:
- Runtime Error
- Compile Error
- No abnormally found
- Internal error


Question:
public class Main {
    public static void main(String args[]) {
        java.util.scanner sc = new java.util.scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        if ((B - A) % 2 == 0) {
            System.out.println("Alice");
        } else {
            System.out.println("Borys");
        }
    }
}

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


Question:
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int K = in.i();
        int[] V = in.ii(N);

        int lmax = Math.min(K, N);

        int[] minus = new int[K];
        int mi = 0;
        int ans = 0;
        for (int l = 0; l <= lmax; l++) {
            int rmax = K - l;
            for (int r = 0; r <= rmax; r++) {
                mi = 0;
                int t = 0;
                for (int i = 0; i < l; i++) {
                    int v = V[i];
                    if (v < 0) {
                        minus[mi++] = v;
                    }
                    t += v;
                }
                for (int i = 0; i < r; i++) {
                    int v = V[N - 1 - i];
                    if (v < 0) {
                        minus[mi++] = v;
                    }
                    t += v;
                }
                Arrays.parallelSort(minus, 0, mi);
                int returnNum = Math.min(mi, K - l - r);
                for (int i = 0; i < returnNum; i++) {
                    t -= minus[i];
                }
                if (ans < t) {
                    ans = t;
                }
            }
        }
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = read(cbuf, 0, cbuf.length);
            } catch (IOException e) {}
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (c != ' ' && c != '\n' && c != '\r') {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (true) {
            char c = next();
            if (c != ' ' && c != '\n' && c != '\r') {
                back();
                break;
            }
        }
    }

    char[] s(final int N) {
        skip();
        char[] s = new char[N];
        for (int i = 0; i < s.length; i++) {
            s[i] = next();
        }
        return s;
    }

    String s() {
        try {
            return readLine();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}

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


Question:
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] abc = br.readLine().split(“ ”);
        int a = Integer.parseInt(abc[0]);
        int b = Integer.parseInt(abc[1]);
        System.out.println(a*b/2);
    }
}

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


Question:
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in);
        String[] abc = br.readLine().split(“ ”);
        int a = Integer.parseInt(abc[0]);
        int b = Integer.parseInt(abc[1]);
        System.out.println(a*b/2);
    }
}

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


Question:
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in);
        String[] abc = br.read().split(“ ”);
        int a = Integer.parseInt(abc[0]);
        int b = Integer.parseInt(abc[1]);
        System.out.println(a*b/2);
    }
}

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


Question:
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
       long total = 0;
       int N = stdIn.nextInt();
       int[] A = new int[N];
       for(int i=0;i<A.length;i++)
    	   A[i] = stdIn.nextInt();
       for(int k=0;k<(A.length-1);k++) {
       for(int i=0;i<(A.length-1);i++) {
    	   if(A[i]-A[i+1]<0) {
    		   A[i] = -A[i];
    		   A[i+1] = -A[i+1];
    	   }
    	   else
    		   ;
       }
       }
       for(int i=0;i<A.length;i++)
    	   total +=A[i];
       System.out.println(total);
}
}

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


Question:
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
       long total = 0;
       int N = stdIn.nextInt();
       int[] A = new int[N];
       for(int i=0;i<A.length;i++)
    	   A[i] = stdIn.nextInt();
       for(int i=0;i<(A.length-1);i++) {
    	   if(A[i]-A[i+1]<0 && A[i]<0) {
    		   A[i] = -A[i];
    		   A[i+1] = -A[i+1];
    	   }
    	   else
    		   ;
       }
       for(int i=0;i<A.length;i++)
    	   total +=A[i];
       System.out.println(total);
}
}

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


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

public class Main {
  static Scanner sc = new Scanner(System.in);
  static long MOD = 998244353;

  public static void main(String[] args) {
    char[] s = sc.next().toCharArray();
    int N = s.length;
    boolean[] S = new boolean[N];
    for (int i = 0; i < N; i++) {
      S[i] = s[i] == '1';
    }
    System.out.println(solve(S));
  }

  static long solve(boolean[] s) {
    int N = s.length;
    long[][] count = new long[N][N];
    for (int i = 0; i < N; i++) {
      for (int j = i + 1; j < N; j++) {
        boolean[] cs = new boolean[j - i + 1];
        for (int k = i; k <= j; k++) {
          cs[k - i] = s[k];
        }
        count[i][j] = count(cs);
      }
    }
//    for (int i = 0; i < N; i++) {
//      for (int j = i + 1; j < N; j++) {
//        System.err.println("i:" + i + " j:" + j + " " + count[i][j]);
//      }
//    }
//    System.err.println("");
    long[] dp = new long[N + 1];
    dp[0] = 1;
    for (int i = 0; i < N; i++) {
      dp[i] %= MOD;
      if (s[i]) {
        dp[i + 1] += dp[i] * 2;
      } else {
        dp[i + 1] += dp[i];
      }
      for (int j = i; j < N; j++) {
        dp[j + 1] += dp[i] * count[i][j] % MOD;
      }
//      System.err.println(Arrays.toString(dp));
    }
    return dp[N] % MOD;
  }

  static long count(boolean[] s) {
    long ret = 0;
    for (int i = 2; i <= s.length; i++) {
      if (s.length % i != 0) continue;
      boolean[] sub = new boolean[s.length / i];
      Arrays.fill(sub, true);
      for (int j = 0; j < s.length; j++) {
        sub[j % sub.length] &= s[j];
      }
      ret += solve(sub);
      if (ret >= MOD) ret -= MOD;
    }
    return ret;
  }
}

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


Question:
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		long N = sc.nextLong();
		long X = sc.nextLong();
		System.out.println(solve(N, X));
	}

	static long solve(long n, long x) {
		if (x * 2 == n) {
			return x * 3;
		}
		if (x * 2 > n) {
			return solve(n, n - x);
		}
		return solve(n - x, x) - (n - x * 2) + n + x;
	}
}

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


Question:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main{
  public static void main(String[] args) throw IOException{
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int n=Integer.parseInt(br.readLine());
    System.out.println(n*n*n);
  }
}

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


Question:
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
  public static void main(String[] args){
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int n=Integer.parseInt(br.readLine());
    System.out.println(n*n*n);
  }
}

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


Question:
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
  public static void main(String[] args){
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int n=Integer.parseInt(br.readline());
    System.out.println(n*n*n);
  }
}

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


Question:
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main{
  public static void main(String[] args){
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int n=Integer.parseInt(br.readLine());
    System.out.println(n*n*n);
  }
}

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


Question:
import java.util.*;
public class Main {
	public static int sLen;
	public static int tLen;
	public static long ans[];
	public static boolean ok[];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		sLen = s.length();
		tLen = t.length();

		s = repeat(new StringBuilder(s), (int)Math.max(2, Math.ceil(tLen * 2.0 / sLen))).toString();

		ans = new long[sLen];
		Arrays.fill(ans, -1);
		ok = new boolean[sLen];
		Arrays.fill(ok, false);
		ArrayList<Integer> matchIndex = kmp(s, t);
		for(int i = 0; i < matchIndex.size(); i ++) {
			ok[matchIndex.get(i) % sLen] = true;
		}

		long max = 0;
		for(int i = 0; i < sLen; i ++) {
			max = Math.max(max, solve(i));
		}
		System.out.println(max);
	}

	static StringBuilder repeat(StringBuilder s, long y) {
		if (y == 0) {
			return new StringBuilder();
		} else if (y == 1) {
			return new StringBuilder(s);
		} else if (y % 2 == 0) {
			StringBuilder tmp = repeat(s, y / 2);
			tmp.append(tmp);
			return tmp;
		} else {
			StringBuilder tmp = repeat(s, y / 2);
			tmp.append(tmp);
			tmp.append(s);
			return tmp;
		}
	}

	static long solve(int i) {
		i %= sLen;
		if(ans[i] == -2) {
			System.out.println(-1);
			System.exit(0);
		}else if(ans[i] == -1) {
			ans[i] = -2;
			ans[i] = (ok[i] ? (solve(i + tLen) + 1) : 0);
		}
		return ans[i];
	}

	static ArrayList<Integer> kmp(String s, String p) {

		int sLen = s.length();
		int sInt[] = new int[sLen];
		for(int i = 0; i < sLen; i ++) {
			sInt[i] = s.charAt(i) - 'a';
		}
		int pLen = p.length();
		int pInt[] = new int[pLen];
		for(int i = 0; i < pLen; i ++) {
			pInt[i] = p.charAt(i) - 'a';
		}

		int sIndex = 1;
		int pIndex = 0;

		int skip[] = new int[pLen + 1];
		Arrays.fill(skip, 0);
		while(sIndex < pLen) {
			if(pInt[sIndex] == pInt[pIndex]) {
				sIndex ++;
				pIndex ++;
				skip[sIndex] = pIndex;
			}else if(pIndex == 0) {
				sIndex ++;
				skip[sIndex] = 0;
			}else {
				pIndex = skip[pIndex];
			}
		}

		ArrayList<Integer> matchIndex = new ArrayList<Integer>();
		sIndex = 0;
		pIndex = 0;
		end: while(true) {
			while(pIndex < pLen && sInt[sIndex] == pInt[pIndex]) {
				sIndex ++;
				pIndex ++;
				if(sIndex >= sLen) { break end; }
			}
			if(pIndex >= pLen) {
				matchIndex.add(sIndex - pLen);
				pIndex = skip[pIndex];
			}else if(pIndex == 0){
				sIndex ++;
			}else {
				pIndex = skip[pIndex];
			}
		}
		return matchIndex;
	}
}

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


Question:
import java.util.*;
public class Main {
	public static int sLen;
	public static int tLen;
	public static long ans[];
	public static boolean ok[];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		sLen = s.length();
		tLen = t.length();

		s = repeat(new StringBuilder(s), (int)Math.max(2, Math.ceil(tLen * 2.0 / sLen))).toString();

		ans = new long[sLen];
		Arrays.fill(ans, -1);
		ok = new boolean[sLen];
		Arrays.fill(ok, false);
		ArrayList<Integer> matchIndex = bm(s, t);
		for(int i = 0; i < matchIndex.size(); i ++) {
			ok[matchIndex.get(i) % sLen] = true;
		}

		long max = 0;
		for(int i = 0; i < sLen; i ++) {
			max = Math.max(max, solve(i));
		}
		System.out.println(max);
	}

	static StringBuilder repeat(StringBuilder s, long y) {
		if (y == 0) {
			return new StringBuilder();
		} else if (y == 1) {
			return new StringBuilder(s);
		} else if (y % 2 == 0) {
			StringBuilder tmp = repeat(s, y / 2);
			tmp.append(tmp);
			return tmp;
		} else {
			StringBuilder tmp = repeat(s, y / 2);
			tmp.append(tmp);
			tmp.append(s);
			return tmp;
		}
	}

	static long solve(int i) {
		i %= sLen;
		if(ans[i] == -2) {
			System.out.println(-1);
			System.exit(0);
		}else if(ans[i] == -1) {
			ans[i] = -2;
			ans[i] = (ok[i] ? (solve(i + tLen) + 1) : 0);
		}
		return ans[i];
	}

	static ArrayList<Integer> bm(String s, String p) {
		int size = 26;

		int sLen = s.length();
		int sInt[] = new int[sLen];
		for(int i = 0; i < sLen; i ++) {
			sInt[i] = s.charAt(i) - 'a';
		}
		int pLen = p.length();
		int pInt[] = new int[pLen];
		for(int i = 0; i < pLen; i ++) {
			pInt[i] = p.charAt(i) - 'a';
		}

		int skip[] = new int[size];
		Arrays.fill(skip, pLen);
		for(int i = 0; i < pLen; i ++) {
			skip[pInt[i]] = pLen - 1 - i;
		}

		ArrayList<Integer> matchIndex = new ArrayList<Integer>();
		int sIndex = pLen - 1;
		while(sIndex < Math.max(pLen, sLen)) {
			int pIndex = pLen - 1;
			while(sIndex >= 0 && pIndex >= 0 && sInt[sIndex] == pInt[pIndex]) {
				sIndex --;
				pIndex --;
			}
			if(pIndex < 0) {
				matchIndex.add(sIndex + 1);
				sIndex += pLen + 1;
			}else {
				sIndex += Math.max(skip[sInt[sIndex]], pLen - pIndex);
			}
		}
		return matchIndex;
	}
}

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


Question:
import java.util.*;
public class Main {
	public static int sLen;
	public static int tLen;
	public static long ans[];
	public static boolean ok[];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		sLen = s.length();
		tLen = t.length();

		s = repeat(new StringBuilder(s), (int)Math.max(2, Math.ceil(tLen * 2.0 / sLen))).toString();

		ans = new long[sLen];
		Arrays.fill(ans, -1);
		ok = new boolean[sLen];
		Arrays.fill(ok, false);
		ArrayList<Integer> matchIndex = bm(s, t);
		for(int i = 0; i < matchIndex.size(); i ++) {
			ok[matchIndex.get(i) % sLen] = true;
		}

		long max = 0;
		for(int i = 0; i < sLen; i ++) {
			max = Math.max(max, solve(i));
		}
		System.out.println(max);
	}

	static StringBuilder repeat(StringBuilder s, long y) {
		if (y == 0) {
			return new StringBuilder();
		} else if (y == 1) {
			return new StringBuilder(s);
		} else if (y % 2 == 0) {
			StringBuilder tmp = repeat(s, y / 2);
			tmp.append(tmp);
			return tmp;
		} else {
			StringBuilder tmp = repeat(s, y / 2);
			tmp.append(tmp);
			tmp.append(s);
			return tmp;
		}
	}

	static long solve(int i) {
		i %= sLen;
		if(ans[i] == -2) {
			System.out.println(-1);
			System.exit(0);
		}else if(ans[i] == -1) {
			ans[i] = -2;
			ans[i] = (ok[i] ? (solve(i + tLen) + 1) : 0);
		}
		return ans[i];
	}

	static ArrayList<Integer> bm(String s, String p) {
		int size = 26;

		int sLen = s.length();
		int sInt[] = new int[sLen];
		for(int i = 0; i < sLen; i ++) {
			sInt[i] = s.charAt(i) - 'a';
		}
		int pLen = p.length();
		int pInt[] = new int[pLen];
		for(int i = 0; i < pLen; i ++) {
			pInt[i] = p.charAt(i) - 'a';
		}

		int skip[] = new int[size];
		Arrays.fill(skip, pLen);
		for(int i = 0; i < pLen; i ++) {
			skip[pInt[i]] = pLen - 1 - i;
		}

		ArrayList<Integer> matchIndex = new ArrayList<Integer>();
		int sIndex = pLen - 1;
		while(sIndex < sLen) {
			int pIndex = pLen - 1;
			while(sIndex >= 0 && pIndex >= 0 && sInt[sIndex] == pInt[pIndex]) {
				sIndex --;
				pIndex --;
			}
			if(pIndex < 0) {
				matchIndex.add(sIndex + 1);
				sIndex += pLen + 1;
			}else {
				sIndex += Math.max(skip[sInt[sIndex]], pLen - pIndex);
			}
		}
		return matchIndex;
	}
}

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


Question:
import java.util.*;
public class Main {
	public static int sLen;
	public static int tLen;
	public static long ans[];
	public static boolean ok[];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		sLen = s.length();
		tLen = t.length();
		StringBuilder s2 = new StringBuilder(s);
		s2.append(s);
		while(s2.length() < tLen * 2) {
			s2.append(s);
		}
		s = s2.toString();
		ans = new long[sLen];
		for(int i = 0; i < sLen; i ++) {
			ans[i] = -1;
		}
		ok = new boolean[sLen];
		ArrayList<Integer> matchIndex = bm(s, t);
		for(int i = 0; i < matchIndex.size(); i ++) {
			ok[matchIndex.get(i) % sLen] = true;
		}

		long max = 0;
		for(int i = 0; i < sLen; i ++) {
			max = Math.max(max, solve(i));
		}
		System.out.println(max);
	}

	static long solve(int i) {
		i %= sLen;
		if(ans[i] == -2) {
			System.out.println(-1);
			System.exit(0);
		}else if(ans[i] == -1) {
			ans[i] = -2;
			ans[i] = (ok[i] ? (solve(i + tLen) + 1) : 0);
		}
		return ans[i];
	}

	static ArrayList<Integer> bm(String str, String ptr) {
		int size = 26;
		int strLen = str.length();
		int ptrLen = ptr.length();
		int skip[] = new int[size];
		for(int i = 0; i < size; i ++) {
			skip[i] = ptrLen;
		}
		for(int i = 0; i < ptrLen; i ++) {
			skip[ptr.charAt(i) - 'a'] = ptrLen - 1 - i;
		}

		ArrayList<Integer> matchIndex = new ArrayList<Integer>();
		int strIndex = ptrLen - 1;
		while(strIndex < strLen) {
			int ptrIndex = ptrLen - 1;
			while(strIndex >= 0 && ptrIndex >= 0 && str.charAt(strIndex) == ptr.charAt(ptrIndex)) {
				strIndex --;
				ptrIndex --;
			}
			if(ptrIndex < 0) {
				matchIndex.add(strIndex + 1);
				strIndex += ptrLen + 1;
			}else {
				strIndex += Math.max(skip[str.charAt(strIndex) - 'a'], ptrLen - ptrIndex);
			}
		}
		return matchIndex;
	}
}

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


Question:
import java.util.*;
public class Main {
	public static int len;
	public static int lenT;
	public static long ans[];
	public static boolean ok[];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		len = s.length();
		lenT = t.length();
		StringBuilder s2 = new StringBuilder(s);
		s2.append(s);
		while(s2.length() < lenT * 2) {
			s2.append(s);
		}
		s = s2.toString();
		ans = new long[len];
		for(int i = 0; i < len; i ++) {
			ans[i] = -1;
		}
		ok = new boolean[len];
		for(int i = 0; i < len; i ++) {
			ok[i] = t.equals(s.substring(i, i + lenT));
		}

		long max = 0;
		for(int i = 0; i < len; i ++) {
			max = Math.max(max, solve(i));
		}
		System.out.println(max >= 10000000 ? -1 : max);
	}

	static long solve(int i) {
		i %= len;
		if(ans[i] == -2) {
			return 10000000;
		}else if(ans[i] == -1) {
			ans[i] = -2;
			ans[i] = (ok[i] ? (solve(i + lenT) + 1) : 0);
		}
		return ans[i];
	}
}

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


Question:
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		prepareFact();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int sum = m * 3;
		long ans = combiMod(n - 1 + sum, n - 1);
		for(int i = m * 2 + 1; i <= sum; i ++) {
			long tmp = combiMod(n - 2 + (sum - i), n - 2);
			tmp = mod(tmp * (long)n);
			ans = mod(ans - tmp);
		}

		for(int i = m + 1; i <= n; i ++) {
			int rest = sum - i;
			if(rest % 2 != 0) { continue; }
			long tmp = combiMod(n - 1 + rest / 2, n - 1);
			tmp = mod(tmp * combiMod(n, i));
			ans = mod(ans - tmp);
		}
		System.out.println(ans);
	}

	static long MOD = 998244353;
	public static long mod(long i) {
		return i % MOD + ((i % MOD) < 0 ? MOD : 0);
	}

	static long powerMod(long x, long y) {
		if (y == 0) {
			return 1;
		} else if (y == 1) {
			return x;
		} else if (y % 2 == 0) {
			long tmp = powerMod(x, y / 2);
			return mod(tmp * tmp);
		} else {
			long tmp = powerMod(x, y / 2);
			return mod(mod(tmp * tmp) * x);
		}
	}

	static long invMod(long x) {
		return powerMod(x, MOD - 2);
	}

	static int MAX_FACT = 3_000_100;
	static long factMod[] = new long[MAX_FACT];
	static void prepareFact() {
		factMod[0] = 1;
		for(int i = 1; i < MAX_FACT; i ++) {
			factMod[i] = mod(factMod[i - 1] * i);
		}
	}

	static long combiMod(int n, int r) {
		if(n < 0 || n < r) { return 0; }
		if(r == 0 || r == n) { return 1; }
		return mod(mod(factMod[n] * invMod(factMod[r])) * invMod(factMod[n - r]));
	}
}

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


Question:
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		prepareFact();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int sum = m * 3;
		long ans = combiMod(n - 1 + sum, n - 1);
		for(int i = m * 2 + 1; i <= sum; i ++) {
			long tmp = combiMod(n - 2 + (sum - i), n - 2);
			tmp = mod(tmp * (long)n);
			ans = mod(ans - tmp);
		}

		for(int i = m + 1; i <= n; i ++) {
			int rest = sum - i;
			if(rest % 2 != 0) { continue; }
			long tmp = combiMod(n - 1 + rest / 2, n - 1);
			tmp = mod(tmp * combiMod(n, i));
			ans = mod(ans - tmp);
		}
		System.out.println(ans);
	}

	static long MOD = 998244353;
	public static long mod(long i) {
		return i % MOD + ((i % MOD) < 0 ? MOD : 0);
	}

	static long powerMod(long x, long y) {
		if (y == 0) {
			return 1;
		} else if (y == 1) {
			return x;
		} else if (y % 2 == 0) {
			long tmp = powerMod(x, y / 2);
			return mod(tmp * tmp);
		} else {
			long tmp = powerMod(x, y / 2);
			return mod(mod(tmp * tmp) * x);
		}
	}

	static long invMod(long x) {
		return powerMod(x, MOD - 2);
	}

	static int MAX_FACT = 2_000_100;
	static long factMod[] = new long[MAX_FACT];
	static void prepareFact() {
		factMod[0] = 1;
		for(int i = 1; i < MAX_FACT; i ++) {
			factMod[i] = mod(factMod[i - 1] * i);
		}
	}

	static long combiMod(int n, int r) {
		if(n < 0 || n < r) { return 0; }
		if(r == 0 || r == n) { return 1; }
		return mod(mod(factMod[n] * invMod(factMod[r])) * invMod(factMod[n - r]));
	}
}

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


Question:
import java.util.*;
public class Main {
	static int modAns = (int)Math.pow(10, 9) + 7;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		int multi = sc.nextInt();
		long ans = 1;
		ArrayList<Integer> counts = new ArrayList<Integer>();
		for(int i = 2; i <= multi; i ++) {
			if(multi % i == 0) {
				int count = 0;
				while(multi % i == 0) {
					multi /= i;
					count ++;
				}
				counts.add(count);
			}
			if(multi == 1) { break; }
		}
		for(int i = 0; i < counts.size(); i ++) {
			ans *= combi(counts.get(i) + length - 1, Math.min(counts.get(i), length - 1));
			ans %= modAns;
		}
		System.out.println(ans);
	}

	public static long combi(int n, int r) {
		if (n == r || r == 0) {
			return 1;
		}else {
			return ( combi(n - 1, r - 1) + combi(n - 1, r)) % modAns;
		}
	}
}

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


Question:
import java.util.*;
public class Main {
	static int modAns = (int)Math.pow(10, 9) + 7;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		int multi = sc.nextInt();
		long ans = 1;
		ArrayList<Integer> counts = new ArrayList<Integer>();
		for(int i = 2; i <= multi; i ++) {
			if(multi % i == 0) {
				int count = 0;
				while(multi % i == 0) {
					multi /= i;
					count ++;
				}
				counts.add(count);
			}
			if(multi == 1) { break; }
		}
		for(int i = 0; i < counts.size(); i ++) {
			ans *= combi(counts.get(i) + length - 1, Math.min(counts.get(i), length - 1));
			ans %= modAns;
		}
		System.out.println(ans);
	}

	public static long combi(int n, int r) {
		if (n == r || r == 0) {
			combis[n][r] = 1;
			return 1;
		}else {
			return ( combi(n - 1, r - 1) + combi(n - 1, r)) % modAns;
		}
	}
}

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


Question:
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
	static long lcm (long a, long b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (long n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	public static void printArray(int[] a) {
		for(int i=0;i<a.length-1;i++) {
		System.out.print(a[i]+" ");
		}
		System.out.println(a[a.length-1]);
	}
	public static void main(String[] args) {
		String str=scan.next();
		long b=scan.nextLong();
		if(str.length()==1) {
			System.out.println(b/2);
			return;
		}
		if(str.length()==2) {
			if(str.charAt(0)==str.charAt(1)) {
				System.out.println(b);
			}
			else {
				System.out.println(0);
			}
			return;
		}
		long cnt=1;
		long ans=0;
		long sum=0;
		String fir="";
		fir+=str.charAt(0);
		str=str.substring(1,str.length());
		for(int i=0;i<str.length();) {
			if(str.charAt(0)==fir.charAt(fir.length()-1)) {
				fir+=str.charAt(0);
				str=str.substring(1,str.length());
			}
			else {
				break;
			}
		}
		String las="";
		las+=str.charAt(str.length()-1);
		str=str.substring(0,str.length()-1);
		for(int i=str.length()-1;i>=0;) {
			if(str.charAt(i)==las.charAt(0)) {
				las+=str.charAt(i);
				str=str.substring(0,str.length()-1);
				i--;
			}
			else {
				break;
			}
		}
		for(int i=1;i<str.length();i++) {
			char ch=str.charAt(i-1);
			char ch2=str.charAt(i);
			if(ch==ch2) {
				cnt++;
			}
			else {
				sum+=cnt/2;
				cnt=1;
			}
		}
		sum+=cnt/2;
		ans+=sum*b;
		if(fir.charAt(0)==las.charAt(0)) {
			long uouo=0;
			uouo+=fir.length()/2;
			uouo+=las.length()/2;
			uouo+=(fir.length()+las.length())/2*(b-1);
			ans+=uouo;
		}
		else {
			long uouo=0;
			uouo+=fir.length()/2*b;
			uouo+=las.length()/2*b;
			ans+=uouo;
		}
		System.out.println(ans);
	}
}

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


Question:
import java.util.Scanner;
public static void main(String[]args){
Scanner scan=new Scanner(System.in);
  String str=scan.next();
  boolean bool=true;
  for(int i=0;i<str.length();i++){
  	char ch=str.charAr(i);
    if(i%2==0){if(ch=='L')bool=false;}
    else{if(ch=='R')bool=false;}
  }
  System.out.println(bool?"Yes":"No");
}

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


Question:
#include<iostream>
#include<string.h>
#include<math.h>
#include<algorithm>

using namespace std;

int main() {
	string s;
	cin >> s;
	if (s[0] == s[1] &&s[2]==s[3]||s[0]==s[2]&&s[1]==s[3]||s[0]==s[3]&&s[2]==s[1]){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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


Question:
#include<iostream>
#include<string.h>
#include<math.h>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 5) {
		cout << 0 << endl;
	}
	else if (a <= 12) {
		cout << b / 2 << endl;
	}
	else {
		cout << b << endl;
	}
	return 0;
}

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


Question:
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		//int d=scan.nextInt();
		//int e=scan.nextInt();
		String s=scan.next();
		boolean bool=false;
		int ans=0;
		System.out.println(c/a*b);
	}
}

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


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

class UnionFind{
	int Parent[];
	UnionFind(int n){//Initialize by -1
		Parent=new int[n];
		Arrays.fill(Parent, -1);
	}
	int root(int A) {//In which tree is A?
		if(Parent[A]<0)return A;
		return Parent[A]=root(Parent[A]);
	}
	int size(int A) {//size of tree which is include A
		return -Parent[root(A)];
	}
	boolean connect(int A,int B) {//Connect A and B
		A=root(A);
		B=root(B);
		if(A==B) return false;
		if(size(A)<size(B)) {int C=0;C=B;B=A;A=C;}//SWAP
		Parent[A]+=Parent[B];
		Parent[B]=A;
		return true;
	}
}

public class Main {
	static FastScanner scan=new FastScanner();
	static Scanner scanner=new Scanner(System.in);
	static Random rand=new Random();
	static long mod=1000000007;
	static double eps=0.0000000001;
	static int big=Integer.MAX_VALUE;
	static long modlcm(long a,long b) {return a*b*modint(gcd(a,b),mod);}
	static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
	static long lcm (long a, long b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	public static void main(String[] args) throws IOException {
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		System.out.println(a*b/2);
		}
	}
	static int lower_bound(int a[],int key) {
		int right=a.length;
		int left=0;
		while(right-left>1) {
			int mid=(right+left)/2;
			if(a[mid]<key) {
				left=mid;
			}
			else {
				right=mid;
			}
		}
		return left;
	}
	static int upper_bound(int a[],int key) {
		int right=a.length;
		int left=0;
		while(right-left>1) {
			int mid=(right+left)/2;
			if(a[mid]<=key) {
				left=mid;
			}
			else {
				right=mid;
			}
		}
		return left;
	}
	static boolean isPrime (long n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static long[] lsetArray(int a) {
		long b[]=new long[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextLong();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	public static void printArray(int[] que) {
		for(int i=0;i<que.length-1;i++) {
			System.out.print(que[i]+" ");
		}
		System.out.println(que[que.length-1]);
	}
	public static int[][] doublesort(int[][]a) {
		Arrays.sort(a,(x,y)->Integer.compare(x[0],y[0]));
		return a;
	}
	public static long[][] ldoublesort(long[][]a) {
		Arrays.sort(a,(x,y)->Long.compare(x[0],y[0]));
		return a;
	}
	static long modpow(long x,long n,long mo) {
		long sum=1;
		while(n>0) {
			if((n&1)==1) {
				sum=sum*x%mo;
			}
			x=x*x%mo;
			n>>=1;
		}
		return sum;
	}
	public static char[] revch(char ch[]) {
		char ret[]=new char[ch.length];
		for(int i=ch.length-1,j=0;i>=0;i--,j++) {
			ret[j]=ch[i];
		}
		return ret;
	}
	public static int[] revint(int ch[]) {
		int ret[]=new int[ch.length];
		for(int i=ch.length-1,j=0;i>=0;i--,j++) {
			ret[j]=ch[i];
		}
		return ret;
	}
	public static void warshall_floyd(int v[][],int n) {
		for(int k=0;k<n;k++)
			for(int i=0;i<n;i++)
				for(int j=0;j<n;j++)
					v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
	}
	public static long modint(long a,long m) {
		long b=m,u=1,v=0;
		while(b!=0) {
			long t=a/b;
			a-=t*b;
			long x=a;
			a=b;
			b=x;

			u-=t*v;
			x=u;
			u=v;
			v=x;
		}
		u%=m;
		if(u<0)u+=m;
		return u;
	}
}
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());}
	public char nextchar() {
		try { return (char)System.in.read(); } catch(Exception e) {
			throw new RuntimeException(e);
		}
	}
}

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


Question:
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int ans=0;
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		System.out.println(a*b/2);
	}
}

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


Question:
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int ans=0;
		int a=scan.nextInt();
		int b[]=new int[a];
		for(int i=0;i!=a;i++) {
			b[i]=scan.nextInt();
		}
		if(a==1) {
			System.out.println(b[0]);
		}
		else {
		int i=0;
		int k=0;
		for(;;) {
			if(k==1) {
				break;
			}
			if(b[i]!=0) {
				for(int j=i;;j++) {
					if(j==a) {
						break;
					}
					if(b[j]==0) {
						break;
					}
					b[j]--;
				}
				ans++;
				i=0;
				for(int j=0;j!=a+1;j++) {
						if(j==a) {
							k=1;
							break;
					}
					if(b[j]!=0) {
						break;
					}

				}
				continue;
			}

			i++;
		}
		System.out.println(ans);
	}
		}
}

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


Question:
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int ans=0;
		int a=scan.nextInt();
		int b[]=new int[a];
		for(int i=0;i!=a;i++) {
			b[i]=scan.nextInt();
		}
		int i=0;
		int k=0;
		for(;;) {
			if(k==1) {
				break;
			}
			if(b[i]!=0) {
				for(int j=i;;j++) {
					if(j==a) {
						break;
					}
					if(b[j]==0) {
						break;
					}
					b[j]--;
				}
				ans++;
				i=0;
				for(int j=0;j!=a+1;j++) {
						if(j==a) {
							k=1;
							break;
					}
					if(b[j]!=0) {
						break;
					}

				}
				continue;
			}

			i++;
		}
		System.out.println(ans);
	}
}

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


Question:
import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b[];
		switch(a) {
		case 25:
			b=new int[a];
			System.out.println(b[a]);
			break;
		case 22:
			System.out.println(1);
			break;
		case 23:
			b=new int[a];
			System.out.println(b[a]);
			break;
		case 24:
			System.out.println(1);
			break;
		}
	}
}

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


Question:
import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b[];
		switch(a) {
		case 24:
			b=new int[a];
			System.out.println(b[a]);
			break;
		case 23:
			System.out.println(1);
			break;
		case 22:
			b=new int[a];
			System.out.println(b[a]);
			break;
		case 25:
			System.out.println(1);
			break;
		}
	}
}

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


Question:
import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b[];
		switch(a) {
		case 24:
			b=new int[a];
			System.out.println(b[a]);
			break;
		case 22:
			System.out.println(1);
			break;
		case 23:
			b=new int[a];
			System.out.println(b[a]);
			break;
		case 25:
			System.out.println(1);
			break;
		}
	}
}

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


Question:
import java.util Scanner;
public class Main {
	public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int b=scan.nextInt();
int c=scan.nextInt();
int max=a;
if(max<b){
max=b;
}
if(max<c){
max=c;
}
if(max==a){
a=0;
}
else if(max==b){
b=0;
}
else if(max==c){
c=0;
}
System.out.println(max*10+a+b+c);
}
}

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


Question:
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;
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());}
	public char nextchar() {
		try { return (char)System.in.read(); } catch(Exception e) {
			throw new RuntimeException(e);
		}
	}
}
public class Main {
	static FastScanner scan=new FastScanner();
	static Scanner scanner=new Scanner(System.in);
	static long mod=1000000007;
	static double eps=0.0000000001;
	static int big=Integer.MAX_VALUE;
	static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
	static long lcm (long a, long b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int right=a.length;
		int left=0;
		while(right-left>0) {
			int mid=(right+left)/2;
			if(a[mid]<key) {
				left=mid;
			}
			else {
				right=mid;
			}
		}
		return left;
	}
	static int upper_bound(int a[],int key) {
		int right=a.length;
		int left=0;
		while(right-left>0) {
			int mid=(right+left)/2;
			if(a[mid]<=key) {
				left=mid;
			}
			else {
				right=mid;
			}
		}
		return left;
	}
	static boolean isPrime (long n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static long[] lsetArray(int a) {
		long b[]=new long[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextLong();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	public static void printArray(int[] y) {
		for(int i=0;i<y.length-1;i++) {
			System.out.print(y[i]+" ");
		}
		System.out.println(y[y.length-1]);
	}
	public static int[][] doublesort(int[][]a) {
		Arrays.sort(a,(x,y)->Integer.compare(x[0],y[0]));
		return a;
	}
	static long modpow(long x,long n,long mo) {
		long sum=1;
		while(n>0) {
			if((n&1)==1) {
				sum=sum*x%mo;
			}
			x=x*x%mo;
			n>>=1;
		}
		return sum;
	}
	public static char[] revch(char ch[]) {
		char ret[]=new char[ch.length];
		for(int i=ch.length-1,j=0;i>=0;i--,j++) {
			ret[j]=ch[i];
		}
		return ret;
	}
	public static int[] revint(int ch[]) {
		int ret[]=new int[ch.length];
		for(int i=ch.length-1,j=0;i>=0;i--,j++) {
			ret[j]=ch[i];
		}
		return ret;
	}
	public static void warshall_floyd(int v[][],int n) {
		for(int k=0;k<n;k++)
			for(int i=0;i<n;i++)
				for(int j=0;j<n;j++)
					v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
	}
	public static void main(String[] args) {
		String str=scan.next();
		if(str.equals("zyxwvutsrqponmlkjihgfedcba")) {
			System.out.println(-1);
			return;
		}
		int ch[]=new int[26];
		for(int i=0;i<str.length();i++) {
			int a=str.charAt(i)-'a';
			ch[a]++;
		}
		if(str.length()<=25) {
			System.out.print(str);
			for(int i=0;i<26;i++) {
				if(ch[i]==0) {
					System.out.println((char)(i+'a'));
					return;
				}
			}
		}
		else {
			int cnt=0;
			for(int i=0;i<26;i++) {
				char ch1=str.charAt(i);
				char ch2=str.charAt(i+1);
				if(ch1>ch2) {
					cnt=i;
					break;
				}
			}
			ch=new int[26];
			String sstr=str.substring(cnt,str.length());
			for(int i=0;i<sstr.length();i++)ch[sstr.charAt(i)-'a']++;
			System.out.print(str.substring(0,str.length()-sstr.length()-1));
			char chch[]=sstr.toCharArray();
			Arrays.sort(chch);
			System.out.println(chch[0]);
		}
	}
}

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


Question:
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;
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());}
	public char nextchar() {
		try { return (char)System.in.read(); } catch(Exception e) {
			throw new RuntimeException(e);
		}
	}
}
public class Main {
	static FastScanner scan=new FastScanner();
	static Scanner scanner=new Scanner(System.in);
	static long mod=1000000007;
	static double eps=0.0000000001;
	static int big=Integer.MAX_VALUE;
	static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
	static long lcm (long a, long b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int right=a.length;
		int left=0;
		while(right-left>0) {
			int mid=(right+left)/2;
			if(a[mid]<key) {
				left=mid;
			}
			else {
				right=mid;
			}
		}
		return left;
	}
	static int upper_bound(int a[],int key) {
		int right=a.length;
		int left=0;
		while(right-left>0) {
			int mid=(right+left)/2;
			if(a[mid]<=key) {
				left=mid;
			}
			else {
				right=mid;
			}
		}
		return left;
	}
	static boolean isPrime (long n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static long[] lsetArray(int a) {
		long b[]=new long[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextLong();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	public static void printArray(int[] y) {
		for(int i=0;i<y.length-1;i++) {
			System.out.print(y[i]+" ");
		}
		System.out.println(y[y.length-1]);
	}
	public static int[][] doublesort(int[][]a) {
		Arrays.sort(a,(x,y)->Integer.compare(x[0],y[0]));
		return a;
	}
	static long modpow(long x,long n,long mo) {
		long sum=1;
		while(n>0) {
			if((n&1)==1) {
				sum=sum*x%mo;
			}
			x=x*x%mo;
			n>>=1;
		}
		return sum;
	}
	public static char[] revch(char ch[]) {
		char ret[]=new char[ch.length];
		for(int i=ch.length-1,j=0;i>=0;i--,j++) {
			ret[j]=ch[i];
		}
		return ret;
	}
	public static int[] revint(int ch[]) {
		int ret[]=new int[ch.length];
		for(int i=ch.length-1,j=0;i>=0;i--,j++) {
			ret[j]=ch[i];
		}
		return ret;
	}
	public static void warshall_floyd(int v[][],int n) {
		for(int k=0;k<n;k++)
			for(int i=0;i<n;i++)
				for(int j=0;j<n;j++)
					v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
	}
	public static void main(String[] args) {
		String str=scan.next();
		if(str.equals("zyxwvutsrqponmlkjihgfedcba")) {
			System.out.println(-1);
			return;
		}
		int ch[]=new int[26];
		for(int i=0;i<str.length();i++) {
			int a=str.charAt(i)-'a';
			ch[a]++;
		}
		if(str.length()<=25) {
			System.out.print(str);
			for(int i=0;i<26;i++) {
				if(ch[i]==0) {
					System.out.println((char)(i+'a'));
					return;
				}
			}
		}
		else {
			int cnt=0;
			for(int i=0;i<26;i++) {
				char ch1=str.charAt(i);
				char ch2=str.charAt(i+1);
				if(ch1>ch2) {
					cnt=i;
					break;
				}
			}
			ch=new int[26];
			str=str.substring(0,cnt);
			for(int i=0;i<str.length();i++)ch[str.charAt(i)-'a']++;
			System.out.print(str.substring(0,str.length()-1));
			for(int i=0;i<26;i++) {
				if(ch[i]==0) {
					System.out.println((char)(i+'a'));
					return;
				}
			}
		}
	}
}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int N = Integer.parseInt(sc.next());
        final int A = Integer.parseInt(sc.next());
        final int B = Integer.parseInt(sc.next());
        sc.close();

        int ans = 0;
        if (A%2==B%2) {
            ans = (B-A)/2;
        } else if (B<N/2) {
            ans = B-1;
        } else if (A>N/2) {
            ans = N-A;
        } else {
            ans = Math.min(N-A, B-1);
        }

        System.out.println(ans);
    }
}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final long A = Long.parseLong(sc.next());
        final long B = Long.parseLong(sc.next());
        final long X = Long.parseLong(sc.next());
        sc.close();

        long N;
        long m;
        long L = X/A;
        if (L>1000000000)
            L=1000000000;
        for (N=L; N>0; N--) {
            m = A*N+B*(Long.toString(N).length());
            if (m<=X) {
                break;
            }
        }
        System.out.println(N);
    }
}

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


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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int A[] = new int[N];
        for (int i=0; i<N; i++)
            A[i] = Integer.parseInt(sc.next());
        int B[] = new int[N];
        for (int i=0; i<N; i++)
            B[i] = Integer.parseInt(sc.next());
        int C[] = new int[N-1];
        for (int i=0; i<N-1; i++)
            C[i] = Integer.parseInt(sc.next());
        sc.close();

        int sum = Arrays.stream(B).sum();

        for (int i=0; i<N-1; i++) {
            if (A[i]+1==A[i+1])
                sum += C[A[i]-1];
        }

        PrintWriter out = new PrintWriter(System.out);
        out.println(sum);
        out.flush();
    }
}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int H = Integer.parseInt(sc.next());
        final int W = Integer.parseInt(sc.next());
        final char S[][] = new char[H+2][W+2];
        for (int i=1; i<H+1; i++) {
            S[i] =  ("#" + sc.next() + "#").toCharArray();
        }
        sc.close();
        for (int i=0; i<W+2; i++) {
            S[0][i] = '#';
            S[H+1][i] = '#';
        }

        int ans = 0;
        for (int i=1; i<H+1; i++) {
            for (int j=1; j<W+1; j++) {
                int cnt = 0;
                for (int k=0;; k++) {
                    if (S[i-k][j]=='#') {
                        break;
                    } else {
                        cnt++;
                    }
                }
                for (int k=0;; k++) {
                    if (S[i+k][j]=='#') {
                        break;
                    } else {
                        cnt++;
                    }
                }
                for (int k=0;; k++) {
                    if (S[i][j-k]=='#') {
                        break;
                    } else {
                        cnt++;
                    }
                }
                for (int k=0;; k++) {
                    if (S[i][j+k]=='#') {
                        break;
                    } else {
                        cnt++;
                    }
                }
                if (ans<cnt) ans = cnt;
            }
        }
        ans -= 3;
        System.out.println(ans);
    }
}

Choices:
- No abnormally found
- Runtime Error
- Time Limit Exceeded
- Internal 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 bansai19 {
	public static void main(final String[] args){

    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    String s = sc.next();

    if(s.charAt(s.length() - 1) == 's'){
        System.out.println(s + "es");
    }else{
        System.out.println(s + "s");
    }

}
}

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


Question:
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(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        List<Integer> list = new ArrayList<>(200000);

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

        Collections.sort(list);
        int count = 0;
        for(int i = 0; i < number - 1 ; i++){
            if(list.get(i).equals(list.get(i+1))){
                count++;
            }else{}
        }
        //System.out.println(list);

        if(count == 0){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }

	}
}

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


Question:
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(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        List<Integer> list = new ArrayList<>(200000);

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

        Collections.sort(list);
        int count = 0;
        for(int i = 0; i < number - 1 ; i++){
            if(list.get(i).equals(list.get(i+1))){
                count++;
            }else{}
        }
        System.out.println(list);

        if(count == 0){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }

	}
}

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