Question:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        EGolf solver = new EGolf();
        solver.solve(1, in, out);
        out.close();
    }

    static class EGolf {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            long k = in.readLong();
            long x = in.readLong();
            long y = in.readLong();

            if (k % 2 == 0 && (x + y) % 2 == 1) {
                out.printLine(-1);
                return;
            }

            int cnt = 0;
            while (x < 0 || y < 0) {
                cnt++;
                long t = x;
                x = -y;
                y = t;
            }

            boolean flag = false;
            if (x < y) {
                flag = true;
                long t = x;
                x = y;
                y = t;
            }

            int n = (int) ((x + y + k - 1) / k);
            if (x + y < k) n++;
            if ((n * k) % 2 != (x + y) % 2) n++;
            out.printLine(n);

            long[][] ans = new long[n][];
            if (x + y < k && (x + y) % 2 == 1) {
                long ty = y + k - x;
                long tx = -(2 * k - ty) / 2;
                ans[0] = new long[]{tx, ty / 2};
                ans[1] = new long[]{0, ty};
                ans[2] = new long[]{x, y};
            } else {
                long ty = y + (n * k - x - y) / 2;
                int idx = 0;
                long v = k;
                for (; v <= ty; v += k) {
                    ans[idx++] = new long[]{0, v};
                }
                v = (ty / k + 1) * k - ty;
                for (; v <= x; v += k) {
                    ans[idx++] = new long[]{v, ty};
                }
                v = ty - (((ty + x) / k + 1) * k - (ty + x));
                for (; v >= y; v -= k) {
                    ans[idx++] = new long[]{x, v};
                }
            }

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 4 - cnt; j++) {
                    long t = ans[i][0];
                    ans[i][0] = -ans[i][1];
                    ans[i][1] = t;
                }
                if (flag) {
                    long t = ans[i][0];
                    ans[i][0] = ans[i][1];
                    ans[i][1] = t;
                }
                out.printLine(ans[i]);
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(long[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void printLine(long[] array) {
            print(array);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void printLine(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

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

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

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

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        }

    }
}

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


Question:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.stream.IntStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.OptionalInt;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        BFiveDishes solver = new BFiveDishes();
        solver.solve(1, in, out);
        out.close();
    }

    static class BFiveDishes {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int[] a = in.readIntArray(5);
            int sum = IntStream.of(a).map(x -> (x + 9) / 10 * 10).sum();
            int max = IntStream.of(a).map(x -> 10 - x % 10).filter(x -> x != 10).max().getAsInt();
            out.printLine(sum - max);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

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

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = readInt();
            }
            return array;
        }

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

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

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(int i) {
            writer.println(i);
        }

    }
}

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


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] prime = new int[101000];
		boolean[] isp = new boolean[101000];
		int x = sc.nextInt();
		for (int i = 0; i < isp.length; i++) {
			isp[i] = true;
		}
		int p = 0;
		isp[0] = false; isp[1] = false;
		for (int i = 2; i < 101000; i++) {
			if(isp[i]) {
				prime[p] = i;
				p++;
				for(int j = 2*i;j < 101000; j += i) {
					isp[j] = false;
				}
			}
		}
		int i = 0;
		while(true) {
			if(prime[i] > x) {
				System.out.println(prime[i]);
				break;
			}
			i++;
		}
		sc.close();

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


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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int k = in.ni();
        dfs(10000000);
        out.println((k/2)*((k+1)/2));
    }
    public static void dfs(long i){
        if(i!=0)dfs(i-1);
        return;
    }
    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

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


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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int k = in.ni();
        dfs(100000000);
        out.println((k/2)*((k+1)/2));
    }
    public static void dfs(long i){
        if(i!=0)dfs(i-1);
        return;
    }
    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

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


Question:
import java.util.Scanner;

public class　Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		if(k%2==0) {
			System.out.println((k/2)*(k/2));
		}else {
			System.out.println((k/2+1)*(k/2));
		}
		sc.close();
	}
}

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


Question:
package app;

import java.util.Scanner;

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

        int n = sc.nextInt();
        int d = sc.nextInt();
        int[][] x = new int[n][d];

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

        int ans = 0;

        for (int i = 0; i < n; i++ ) {
            for (int j = i; j < n; j++ ) {
                double temp = 0;
                for (int k = 0; k < d; k++ ) {
                    temp += Math.pow(x[i][k] - x[j][k], 2);
                }
                if (Math.sqrt(temp) == (int)Math.sqrt(temp) && temp != 0) {
                    ans++;
                }
            }
        }
        System.out.println(ans);

        sc.close();
    }
}

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


Question:
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int [] ary = new int[5];
    int min = 130;
    int mini = 16;
    for(int i=0; i<5; ++i) {
      ary[i] = sc.nextInt();
      if(ary[i]%10<min & ary[i]%10 !=0) {
        min=ary[i]%10;
        mini = i;
      }
    }
    int w = ary[4];
    ary[4] = ary[mini];
    ary[mini] = w;

    int ans =0;
    for(int i=0; i<5; ++i) {
      ans += ary[i];
      if(i<4 & ans % 10 != 0) {
        ans = (ans+10)/10 * 10;
      }
    }
      System.out.println(ans);
  }
}

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


Question:
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int c = sc.nextInt();
		int b[] = new int[m];
		for(int i = 0; i < m; i++){
			b[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < n; i++){
			int tmp = c;
			int s = sc.nextInt();
			for(int j = 0; j < m; j++){
				tmp += s*b[i];
			}
			if(tmp > 0)ans++;
		}
		System.out.print(ans);
	}
}

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


Question:
import java.util.*;

class ABC111B{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    n/=112;
    System.out.print((n+1)*111);
  }
}

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


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

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

        int x1=sc.nextInt();
        int y1=sc.nextInt();
        int x2=sc.nextInt();
        int y2=sc.nextInt();

        int xlen=Math.abs(x1-x2);
        int ylen=Math.abs(y1-y2);
        if(x1<=x2&&y1<y2){
            System.out.println(""+(x2-ylen)+" "+(y2+xlen)+" "+((int)x1-ylen)+" "+((int)y1+xlen));
        }else if(x1<x2&&y2<=y1){
            System.out.println(""+((int)x2+ylen)+" "+((int)y2+xlen)+" "+(int)(x1+ylen)+" "+((int)y1+xlen));
        }else if(x2<=x1&&y1<y2){
            System.out.println(""+((int)x2-ylen)+" "+((int)y2-xlen)+" "+((int)x1-ylen)+" "+((int)y1-xlen));
        }else if(x2<x1&&y2<=y1){
            System.out.println(""+(x2-ylen)+" "+(y2-xlen)+" "+(x1-ylen)+" "+(y1-xlen));
        }
    }
}

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


Question:
import java.util.Scanner;
 class GoodDistance {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int D = sc.nextInt();
		int count = 0;
		double[][] a = new double[N][D];
		for(int i=0;i<N;i++) {
			for(int j=0;j<D;j++) {
				 a[i][j]  = sc.nextInt();
			}
		}
		for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				double sum = 0;
				for(int k=0;k<D;k++) {
				sum +=  Math.pow(a[i][k]-a[j][k],2);
			}
				sum=Math.sqrt(sum);
				if(sum%1==0) {
					count++;
				}
		}
	}
		System.out.println(count);
}
}

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


Question:
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

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

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

    	Long mult=a;
    	for(Long i=a+1;i<=b;i++) {
    		mult*=i;
    	}

    	if(mult>0) {
    		System.out.println("Positive");
    	}else if(mult<0) {
    		System.out.println("Negative");
    	}else {
    		System.out.println("Zero");
    	}

    }

}

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


Question:
package atcorder;

import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		sc.close();
		if(X==7 || X==5 || X==3) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}

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


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.TreeSet;
import java.util.stream.Stream;

public class Main {

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

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		int m = 200010;
		@SuppressWarnings("unchecked")
		public void solve(int testNumber, MyInput in, PrintWriter out) {

			int h = in.nextInt(), w = in.nextInt(), n = in.nextInt();

			if (n == 0) {
				out.println(h);
				return;
			}

			TreeSet<Integer>[] set = new TreeSet[h+1];
			set = Stream.generate(TreeSet::new).limit(h+1).toArray(TreeSet[]::new);

			for (int i = 0; i < n; i++) {
				int x = in.nextInt(), y = in.nextInt();
				set[x].add(y);
			}

			int nowH = 1, maxW = 1;
			while (nowH <= h) {
				if (set[nowH].floor(maxW) != null) {
					out.println(nowH-1);
					return;
				}
				nowH++;
				if (!set[nowH].contains(maxW+1) && maxW < w) {
					maxW++;
				}
			}
		}
	}

	static class MyInput {
		private final BufferedReader in;
		private static int pos;
		private static int readLen;
		private static final char[] buffer = new char[1024 * 8];
		private static char[] str = new char[500 * 8 * 2];
		private static boolean[] isDigit = new boolean[256];
		private static boolean[] isSpace = new boolean[256];
		private static boolean[] isLineSep = new boolean[256];

		static {
			for (int i = 0; i < 10; i++) {
				isDigit['0' + i] = true;
			}
			isDigit['-'] = true;
			isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
			isLineSep['\r'] = isLineSep['\n'] = true;
		}

		public MyInput(InputStream is) {
			in = new BufferedReader(new InputStreamReader(is));
		}

		public int read() {
			if (pos >= readLen) {
				pos = 0;
				try {
					readLen = in.read(buffer);
				} catch (IOException e) {
					throw new RuntimeException();
				}
				if (readLen <= 0) {
					throw new MyInput.EndOfFileRuntimeException();
				}
			}
			return buffer[pos++];
		}

		public int nextInt() {
			int len = 0;
			str[len++] = nextChar();
			len = reads(len, isSpace);
			int i = 0;
			int ret = 0;
			if (str[0] == '-') {
				i = 1;
			}
			for (; i < len; i++)
				ret = ret * 10 + str[i] - '0';
			if (str[0] == '-') {
				ret = -ret;
			}
			return ret;
		}

		public long nextLong() {
			int len = 0;
			str[len++] = nextChar();
			len = reads(len, isSpace);
			int i = 0;
			long ret = 0;
			if (str[0] == '-') {
				i = 1;
			}
			for (; i < len; i++)
				ret = ret * 10 + str[i] - '0';
			if (str[0] == '-') {
				ret = -ret;
			}
			return ret;
		}

		public char nextChar() {
			while (true) {
				final int c = read();
				if (!isSpace[c]) {
					return (char) c;
				}
			}
		}

		public String nextString() {
			return new String(nextChars());
		}

		public char[] nextChars() {
			int len = 0;
			str[len++] = nextChar();
			len = reads(len, isSpace);
			return Arrays.copyOf(str, len);
		}

		int reads(int len, boolean[] accept) {
			try {
				while (true) {
					final int c = read();
					if (accept[c]) {
						break;
					}
					if (str.length == len) {
						char[] rep = new char[str.length * 3 / 2];
						System.arraycopy(str, 0, rep, 0, str.length);
						str = rep;
					}
					str[len++] = (char) c;
				}
			} catch (MyInput.EndOfFileRuntimeException e) {
			}
			return len;
		}

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

		public int[] nextIntArray1Index(final int n) {
			final int[] res = new int[n + 1];
			for (int i = 1; i < n + 1; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public int[] nextIntArrayDec(final int n) {
			final int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

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

		public long[] nextLongArray1Index(final int n) {
			final long[] res = new long[n + 1];
			for (int i = 1; i < n + 1; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public long[] nextLongArrayDec(final int n) {
			final long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

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

		public double[] nextDoubleArray(int n) {
			double[] res = new double[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextDouble();
			}
			return res;
		}

		static class EndOfFileRuntimeException extends RuntimeException {
		}

	}

}

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


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

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

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt(), k = in.nextInt();
			int[] cnt = new int[n+1];
			for (int i = 1; i <= n; i++) cnt[i%k]++;

			long ans = 0;
			for (int a = 0; a < k; a++) {
				int b = (k - a) % k;
				int c = (k - a) % k;
				if ((b + c) % k != 0) continue;
				ans += cnt[a] * cnt[b] * cnt[c];
			}
			out.println(ans);
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

		public int[] nextIntArray1Index(int n) {
			int[] res = new int[n + 1];
			for (int i = 0; i < n; i++) {
				res[i + 1] = nextInt();
			}
			return res;
		}

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

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

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

		public double[] nextDoubleArray(int n) {
			double[] res = new double[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextDouble();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}

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


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

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

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long k = in.nextLong();
			long base = 1;

			List<Long> list = new ArrayList<>();
			for (int i = 0; i < 15; i++) {
				for (int j = 1; j < 150; j++) {
					list.add((j+1) * base - 1);
				}
				base *= 10;
			}

			for (int i = 0; i < list.size(); i++) {
				for (int j = i+1; j < list.size(); j++) {
					if (g(list.get(i)) > g(list.get(j))) {
						list.remove(i--);
						break;
					}
				}
			}

			for (int i = 0; i < k; i++) {
				out.println(list.get(i));
			}
		}

		long f(long n) {
			long ret = 0;
			while (n > 0) {
				ret += n % 10;
				n /= 10;
			}
			return ret;
		}

		double g(long n) {
			return (double)n / f(n);
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}

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


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

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

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long k = in.nextLong();
			long base = 1;

			List<Long> list = new ArrayList<>();
			for (int i = 0; i < 15; i++) {
				for (int j = 1; j < 150; j++) {
					list.add(j * base - 1);
				}
				base *= 10;
			}

			for (int i = 0; i < list.size(); i++) {
				for (int j = i+1; j < list.size(); j++) {
					if (g(list.get(i)) > g(list.get(j))) {
						list.remove(i--);
						break;
					}
				}
			}

			for (int i = 0; i < k; i++) {
				out.println(list.get(i));
			}
		}

		long f(long n) {
			long ret = 0;
			while (n > 0) {
				ret += n % 10;
				n /= 10;
			}
			return ret;
		}

		double g(long n) {
			return (double)n / f(n);
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}

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


Question:
import static java.lang.Math.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

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

	static long INF = Long.MAX_VALUE/3;
	static long MK = (long)pow(10, 15);

	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long k = in.nextLong();

			long count = 0;
			for (long n = 1; n <= MK; n++) {

				if (n*S(n+1) <= (n+1)*S(n)
						&& n*S(n+1) <= (n+1)*S(n)
						&& n*S(n+10) <= (n+10)*S(n)
						&& n*S(n+100) <= (n+100)*S(n)
						&& n*S(n+1000) <= (n+1000)*S(n)
						&& n*S(n+10000) <= (n+10000)*S(n)
						&& n*S(n+100000) <= (n+100000)*S(n)
						&& n*S(n+1000000) <= (n+1000000)*S(n)
						) {
					if (++count <= k) {
						out.println(n);
					} else {
						break;
					}
				}
			}

		}

		long S(long num) {
			long ret = 0;
			while (num > 0) {
				ret += num % 10;
				num /= 10;
			}
			return ret;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}

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


Question:
import static java.lang.Math.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

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

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n =in.nextInt();
			long x = in.nextLong();
			long[] a = in.nextLongArray(n);

			long ans = INF;
			for (int k = 0; k < n; k++) {
				long tmp = 0;
				for (int i = 0; i < n; i++) {
					long min = INF;
					for (int j = 0; j <= k; j++) {
						min = min(a[(i+n-j)%n], min);
					}
					tmp += min;
				}
				if ((tmp+k*x) < ans) {
					ans = tmp+k*x;
				}
			}
			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}

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


Question:
import java.util.*;
public class Main{
	public static final Scanner sc = new Scanner(System.in);
  	public static void main(String[] arg){
		 int a=sc.nextInt(), b=sc.nextInt(), c=sc.nextInt(), d=sc.nextInt();
         int n=sc.nextInt();
         a *= 4;
         b *= 2;
         int small = Math.min(Math.min(a, b), c);
         int ans;
      	 ans = Math.min(small*n, d*(n/2) + small*(n%2))
         System.out.println(ans);
    }
}

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


Question:
import java.util.*;
public class Main{
	public static final Scanner sc = new Scanner(System.in);
  	public static void main(String[] arg){
		 int a=sc.nextInt(), b=sc.nextInt(), c=sc.nextInt(), d=sc.nextInt();
         int n=sc.nextInt();
         a *= 4;
         b *= 2;
         int small = Math.min(Math.min(a, b) c);
         int ans;
         if (small*2 <= d){
         	ans = small*n;
         }else{
         	ans = d*(n/2) + small*(n%2);
         }
         System.out.println(ans);
    }
}

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


Question:
import java.util.*;
public class Main{
	public static final Scanner sc = new Scanner(System.in);
  	public static void main(String[] arg){
		 int a=sc.nextInt(), b=sc.nextInt(), c=sc.nextInt(), d=sc.nextInt();
         int n=sc.nextInt();
         a *= 4;
         b *= 2;
         int small = Math.min(a, b, c);
         int ans;
         if (small*2 <= d){
         	ans = small*n;
         }else{
         	ans = d*(n/2) + small*(n%2);
         }
         System.out.println(ans);
    }
}

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


Question:
import java.util.*
public class Main{
	public static final Scanner sc = new Scanner(System.in);
  	public static void main(String[] arg){
		 int a=sc.nextInt(), b=sc.nextInt(), c=sc.nextInt(), d=sc.nextInt();
         int n=sc.nextInt();
         a *= 4;
         b *= 2;
         int small = Math.min(a, b, c);
         int ans;
         if (small*2 <= d){
         	ans = small*n;
         }else{
         	ans = d*(n/2) + small*(n%2);
         }
         System.out.println(ans);
    }
}

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


Question:
import java.util.*;
class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  int n=sc.nextInt();
  int m=sc.nextInt();
  int ans=0;
  for(ans=0;ans<10000;ans++){
  	if(((int)Math.floor(ans*0.08)==n)&&((int)Math.floor(ans*0.1==m)))break;
  }
  System.out.println(ans==10000?-1:ans);
}
}

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


Question:
import java.util.*;
class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  int n=sc.nextInt();
  int m=sc.nextInt();
  int ans=0;
  for(ans=0;ans<10000;ans++){
  	if((int)Math.floor(ans*0.08)==n&&(int)Math.floor(ans*0.1==m))break;
  }
  System.out.println(ans==10000?-1:ans);
}
}

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


Question:
import java.util.*;

public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
      int n=sc.nextInt();
      int m=sc.nextInt();
      int []num=new int[n];
      for(int i=0;i<n;i++){
      	num[i]=sc.nextInt();
      }
      Arrays.sort(num);
      int ans=0;
      for(int i=0;i<n;i++){
      	if(num[i]<=m){
        ans++;
          m-=num[i];
        }
        else{break}
      }
        System.out.println(ans);
    }
}

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


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

    Scanner sc = new Scanner(System.in);
    int[]a = new int[5];
    ArrayList<Integer>b = new ArrayList<>();

    for(int i=0; i<5; i++) {
    	a[i] = sc.nextInt();
    	if(a[i]%10 != 0) {
    		b.add(a[i]%10);
    	}
    }
    Collections.sort(b);
    int last = 0;
    for(int i=0; i<5; i++) {
    	if(a[i]%10 == b.get(0)) {
    		last = a[i];
    		break;
    	}
    }
    int al = 0;
    int cou = 0;
    for(int i=0; i<5; i++) {
    	if(a[i] != last) {
    		if(a[i]%10==0) {
    			al += a[i];
    		}else {
    			al += ((a[i]/10)+1)*10;
    		}
    		cou++;
    	}
     }
    if(cou != 4) {
    	al += ((last/10)+1)*10*(4-cou);
    }
    System.out.println(al + last);
    }
}

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


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

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = in.nextInt();
        Map<Long, Map<Long, Long>> map0 = new HashMap<>();
        Map<Long, Map<Long, Long>> map1 = new HashMap<>();
        for (int i = 0; i < N; i++) {
            long A = in.nextLong();
            long B = in.nextLong();
            if (A < 0) {
                A = -A;
                B = -B;
            }
            long gcd = gcd(A, Math.abs(B));
            A /= gcd;
            B /= gcd;
            if (B > 0) {
                Map<Long, Long> map = map0.computeIfAbsent(A, k -> new HashMap<>());
                map.put(B, map.getOrDefault(B, 0L) + 1);
            } else {
                Map<Long, Long> map = map1.computeIfAbsent(-B, k -> new HashMap<>());
                map.put(A, map.getOrDefault(A, 0L) + 1);
            }
        }
        Set<Long> keys0 = new HashSet<>();
        keys0.addAll(map0.keySet());
        keys0.addAll(map1.keySet());
        long ans = 1;
        for (Long key0 : keys0) {
            Map<Long, Long> map00 = map0.getOrDefault(key0, new HashMap<>());
            Map<Long, Long> map11 = map1.getOrDefault(key0, new HashMap<>());
            Set<Long> keys1 = new HashSet<>();
            keys1.addAll(map00.keySet());
            keys1.addAll(map11.keySet());
            for (Long key1 : keys1) {
                long l = -1;
                l += mPow(2, map00.getOrDefault(key1, 0L));
                l += mPow(2, map11.getOrDefault(key1, 0L));
                ans *= l;
                ans %= MOD;
            }
        }
        out.println(ans - 1);

        out.flush();
    }

    static long gcd(long p, long q) {
        if (p < q) {
            long tmp = p;
            p = q;
            q = tmp;
        }
        while(q != 0) {
            long tmp = p % q;
            p = q;
            q = tmp;
        }
        return p;
    }

    static final int MOD = 1_000_000_007;

    static long mPow(long a, long b) {
        long ret = 1;
        while (b > 0) {
            if (b % 2 == 1)
                ret = (ret * a) % MOD;
            a = (a * a) % MOD;
            b /= 2;
        }
        return ret;
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}

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


Question:
import javafx.util.Pair;

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = in.nextInt();
        Map<Long, Map<Long, Long>> map0 = new HashMap<>();
        Map<Long, Map<Long, Long>> map1 = new HashMap<>();
        for (int i = 0; i < N; i++) {
            long A = in.nextLong();
            long B = in.nextLong();
            if (A < 0) {
                A = -A;
                B = -B;
            }
            long gcd = gcd(A, Math.abs(B));
            A /= gcd;
            B /= gcd;
            if (B > 0) {
                Map<Long, Long> map = map0.computeIfAbsent(A, k -> new HashMap<>());
                map.put(B, map.getOrDefault(B, 0L) + 1);
            } else {
                Map<Long, Long> map = map1.computeIfAbsent(-B, k -> new HashMap<>());
                map.put(A, map.getOrDefault(A, 0L) + 1);
            }
        }
        Set<Long> keys0 = new HashSet<>();
        keys0.addAll(map0.keySet());
        keys0.addAll(map1.keySet());
        long ans = 1;
        for (Long key0 : keys0) {
            Map<Long, Long> map00 = map0.getOrDefault(key0, new HashMap<>());
            Map<Long, Long> map11 = map1.getOrDefault(key0, new HashMap<>());
            Set<Long> keys1 = new HashSet<>();
            keys1.addAll(map00.keySet());
            keys1.addAll(map11.keySet());
            for (Long key1 : keys1) {
                long l = -1;
                l += mPow(2, map00.getOrDefault(key1, 0L));
                l += mPow(2, map11.getOrDefault(key1, 0L));
                ans *= l;
                ans %= MOD;
            }
        }
        out.println(ans - 1);

        out.flush();
    }

    static long gcd(long p, long q) {
        if (p < q) {
            long tmp = p;
            p = q;
            q = tmp;
        }
        while(q != 0) {
            long tmp = p % q;
            p = q;
            q = tmp;
        }
        return p;
    }

    static final int MOD = 1_000_000_007;

    static long mPow(long a, long b) {
        long ret = 1;
        while (b > 0) {
            if (b % 2 == 1)
                ret = (ret * a) % MOD;
            a = (a * a) % MOD;
            b /= 2;
        }
        return ret;
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}

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


Question:
import javafx.util.Pair;

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = in.nextInt();
        Map<Pair<Long, Long>, Long> map0 = new HashMap<>();
        Map<Pair<Long, Long>, Long> map1 = new HashMap<>();
        for (int i = 0; i < N; i++) {
            long A = in.nextLong();
            long B = in.nextLong();
            if (A < 0) {
                A = -A;
                B = -B;
            }
            long gcd = gcd(A, Math.abs(B));
            if (B > 0) {
                Pair<Long, Long> pair = new Pair<>(A / gcd, B / gcd);
                map0.put(pair, map0.computeIfAbsent(pair, k -> 0L) + 1);
            } else {
                Pair<Long, Long> pair = new Pair<>(- B / gcd , A / gcd);
                map1.put(pair, map1.getOrDefault(pair, 0L) + 1);
            }
        }
        Set<Pair<Long, Long>> keys = new HashSet<>();
        keys.addAll(map0.keySet());
        keys.addAll(map1.keySet());
        long ans = 1;
        for (Pair<Long, Long> pair : keys) {
            long l = -1;
            l += mPow(2, map0.getOrDefault(pair, 0L));
            l += mPow(2, map1.getOrDefault(pair, 0L));
            ans *= l;
            ans %= MOD;
        }
        out.println(ans - 1);

        out.flush();
    }

    static long gcd(long p, long q) {
        if (p < q) {
            long tmp = p;
            p = q;
            q = tmp;
        }
        while(q != 0) {
            long tmp = p % q;
            p = q;
            q = tmp;
        }
        return p;
    }

    static final int MOD = 1_000_000_007;

    static long mPow(long a, long b) {
        long ret = 1;
        while (b > 0) {
            if (b % 2 == 1)
                ret = (ret * a) % MOD;
            a = (a * a) % MOD;
            b /= 2;
        }
        return ret;
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}

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


Question:
import java.util.*;

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

    int n = sc.nextInt();//スイッチ
    int m = sc.nextInt();//電球
    int[] ak = new int[m];//電球に繋がっているスイッチの個数
    int[][] sw = new int[m][n];//電球mに接続しているスイッチの情報
    int[] ju = new int[m]; //電球に繋がっているスイッチ%2が配列内の値の時点灯
    int ans = 0;//条件合致数

    for(int i=0; i<m; i++){
      ak[i] = sc.nextInt();//電球i+1に繋がっているスイッチ個数
      for(int j=0; j<ak[i]; j++){
        sw[i][j] = sc.nextInt(); //繋がるスイッチ番号入力
      }
    }

    for(int k=0; k<m;k++){
      ju[k] = sc.nextInt();//1or0を入力
    }

    for(int i=0; i< (1<<n); i++){//スイッチの全ビット探索
      int[] swon = new int[m];//電球に繋がっているonの数
      for(int j=0; j<n;j++){//jビット左論理シフト

        if((1&i>>j)==1){//スイッチj+1がonかoffか
          for(int k=0; k<m;k++){//k+1=電球番号
            for(int l=0; l<ak[k];l++){
              if(sw[k][l]==j+1){
                swon[k] = swon[k] + 1;
              }
            }
          }

        }

      }
      // for(int p=0; p<m;p++){
      //   System.out.println("*"+swon[p]);
      // }
      //全ての電球が点灯したかの判定
      boolean judge = false;
      int count=0;
      for(int p=0;p<m;p++){
        if(swon[p]%2 == ju[p]){
          count +=1;
        }
      }
      if(count==m){
        ans += 1;
      }

    }

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


Question:
package B;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	int N,M;

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		N = nextInt();
		long [][]LR = new long [N][3];
		long [][]l=new long[N][2],r=new long[N][2];
		for(int i=0;i<N;i++) {
			LR[i][0]=nextLong();
			LR[i][1]=nextLong();
			LR[i][2]=LR[i][1]-LR[i][0]+1;
			l[i][0] = LR[i][0];
			r[i][0] = LR[i][1];
			l[i][1] = i;
			r[i][1] = i;
		}
		Arrays.sort(l,(a1,a2)->Long.compare(a2[0],a1[0]));
		Arrays.sort(r,(a1,a2)->Long.compare(a1[0],a2[0]));

		long []onesum = new long[N];
		for(int i=0;i<N;i++) {
			out.println(l[i][0]+" "+r[i][0]);
			long L = l[0][0];
			long R = r[0][0];
			if(l[0][1]==i)L = l[1][0];
			if(r[0][1]==i)R = r[1][0];
			long abs = R-L+1;
			if(abs <= 0)abs = 0;
			onesum[i]=LR[i][2]+abs;
		}
		Arrays.sort(onesum);

		Arrays.sort(LR,(a1,a2)->MyComparator(a1[0],a2[0],a1[1],a2[1]));
		Arrays.sort(LR,(a1,a2)->absComp(a1[0],a2[0],a1[1],a2[1]));
		long L = LR[0][0];
		long R = LR[0][1];
		long Abs = R - L + 1;
		long []lrA = new long[N];
		lrA[0] = Abs;
		for(int i=1;i<N-1;i++) {
			L=Math.max(L,LR[i][0]);
			R=Math.min(R,LR[i][1]);
			long abs = R-L+1;
			if(abs <= 0)break;
			lrA[i] = abs;
		}
		long [] lrB = new long [N];
		L = LR[N-1][0];
		R = LR[N-1][1];
		for(int i=N-1;i>0;i--) {
			L=Math.max(L,LR[i][0]);
			R=Math.min(R,LR[i][1]);
			long abs = R-L+1;
			if(abs <= 0)break;
			lrB[i] = abs;
		}

		long max = onesum[N-1];
		for(int i=0;i<N-1;i++) {
			max = Math.max(max, lrA[i]+lrB[i+1]);
		}
		out.println(max);

	}

	private int absComp(long a1, long a2, long b1, long b2) {
		if(b1 - a1 < b2 - a2)return 1;
		if(b1 - a1 > b2 - a2)return -1;
		return 0;
	}

	private int MyComparator(long a1, long a2, long b1, long b2) {
		if(a1 > a2) return 1;
		else if(a1 < a2) return -1;
		if(b1 > b2) return 1;
		else if(b1 < b2) return -1;
		return 0;
	}

	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;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

	long gcd(long m,long n) {
		if (m<n) return gcd(n,m);
		if (n==0)return m;
		return gcd(n,m%n);
	}
}

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


Question:
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		Set<Integer>[] s = new Set<Integer>[M];
		int[] p = new int[M];
		int ans = 0;
		int i,j,k;
		for(i = 0;i < M;i++){
			int k = sc.nextInt();
			s[i] = new HashSet<Integer>();
			for(j = 0;j < k;j++){
				s[i].add(sc.nextInt() - 1);
			}
		}
		for(i = 0;i < M;i++){
			p[i] = sc.nextInt();
		}
		for(i = 0;i < (1 << N);i++){
			boolean flg = true;
			for(j = 0;j < M;j++){
				int count = 0;
				for(k = 0;k < N;k++){
					if((1 & i >> k) == 1 && s[j].contains(k)){
						count++;
					}
				}
				if(count % 2 != p[j]){
					flg = false;
					break;
				}
			}
			if(flg){
				ans++;
			}
		}
		System.out.println(ans);
	}
}

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


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

      // 値の取得
	  int n = sc.nextInt();
      int[] p = new int[n];
      for(int i=0;i<n;i++){
        p[i] = sc.nextInt();
      }
      int count = 0;

      for(int i=1;i<n-1;i++){
        if(p[i-1]<p[i] && p[i]<p[i+1]){
        count++;
        }
      }
      System.out.println(count);
    }
}

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


Question:
import java.util.*;
public class Main {
	public static void main(String[] args){
       Scanner sc = new Scanner(System.in);
      //時間の取得
	  int[] T = new int[5];
      int[] D = new int[5];
      for(int i=0;i<5;i++){
        T[i] = sc.nextInt();
      }
      //総時間
      int sum = 0;
         for(int i=0;i<5;i++){
             //あまり時間がないものの注文
             if(T[i]%10==0){
               D[i]=T[i];
             //あまり時間があるものの注文
             }else{
               D[i]=(T[i]/10)+10
             }
          }

          //最後の注文のあまり時間はかからない
          int max =0;
          for(int i=0;i<5;i++){
            if((D[i]-T[i])>max) {
               max=D[i]-T[i];
            }
             sum=sum+D[i];
          }

        System.out.println(sum);
    }
}

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


Question:
import java.util.*;

/*
問題文
東西に N 個の山が連なっており、西の果てには広大な海が広がっています。
各山頂には旅館があり、あなたは海を眺められる旅館を選ぶことにしました。

西から i 番目の山の高さは Hi です。
西から 1 番目の山頂にある旅館からは必ず海を眺めることができます。

西から i (i=2,3,...,N) 番目の山頂にある旅館については、
H1≤Hi,H2≤Hi,..., かつ Hi−1≤Hi のとき、その旅館から海を眺めることができます。

これら N 個の旅館のうち、海を眺められる旅館はいくつあるでしょうか。

制約
入力は全て整数である。
1≤N≤20
1≤Hi≤100
*/

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

        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int mounts[] = new int[a];

        int max = 0;
        int count;
        for (int i = 0; i < a; i++) {
          mounts[i] = s.nextInt();
          if (mounts[i] >= max) {
            max = mounts[i];
            count++;
          }
        }

        System.out.println(count);
    }
}

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


Question:
import java.util.Scanner;
2.public class Main {
3.
4.	public static void main(String[] args) {
5.		// TODO 自動生成されたメソッド・スタブ
6.		Scanner stdIn = new Scanner(System.in);
7.		int x = stdIn.nextInt();
8.		int y = stdIn.nextInt();
9.		if (x == y)
10.			System.out.println(0);
11.		if (x < y) {
12.			if (x >= 0 || y <= 0)
13.				System.out.println(y - x);
14.			if (x < 0 && y > 0) {
15.				if ((-x) >= y)
16.					System.out.println(y - x);
17.				else
18.					System.out.println(1 + y +x);
19.			}
20.		}
21.		if (y<x) {
22.			if (y >= 0 || x <= 0)
23.				System.out.println(2+x-y);
24.			if (y < 0 && x > 0) {
25.				if ((-y) >= x)
26.					System.out.println(1-x - y);
27.				else
28.					System.out.println(1 + x +y);
29.			}
30.		}
31.
32.	}
33.}

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


Question:
import java.util.*;

public class Main8 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int Q = sc.nextInt();
        int H = sc.nextInt();
        int S = sc.nextInt();
        int D = sc.nextInt();
        int N = sc.nextInt();

        int Hmin = Q*2 < H ? Q*2 : H;
        int Smin = Hmin*2 < S ? Hmin*2 : S;
        int Dmin = Smin*2 < D ? Smin*2 : D;

        long price = (long) N/2 * Dmin + N%2 * Smin;
        System.out.println(price);
    }
}

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


Question:
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String previousWord = "~";
        String nextword = "";
        boolean isYes = true;

        Map resultMap = new HashMap();

        for(int i = 0; i<N; i++){

            nextword = sc.next();
            if(previousWord.charAt(-1) != nextword.charAt(-1)){
                break;
            }
            if(resultMap.containsKey(previousWord)){
                break;
            }
            resultMap.put(previousWord,"");
            previousWord = nextword;
        }

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

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


Question:
package sample;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int D = sc.nextInt();
		int[][] x = new int[N][D];

		for(int i = 0; i < N; i++) {
			for(int j = 0; j < D; j++) {
				x[i][j] = sc.nextInt();
			}
		}
		int count = 0;
		for(int i=0; i<N; i++) {
			for(int j=i+1; j<N; j++) {
				double sum = 0;
				for(int d=0;d<D; d++) {
				int	xd=x[i][d]-x[j][d];
					sum += xd*xd;
					//System.out.println(x[i][d]);
					//System.out.println(x[j][d]);
				}

			double dist = Math.sqrt(sum);  //Math.sqrt() 関数は、数値の平方根を返す
			//System.out.println(dist);
			if (dist == Math.floor(dist)) { //distが整数だったら countに+1する
				count++;
			}
			}
		}
		System.out.println(count);

	}
}

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


Question:
import java.util.Scanner;

public class q2 {

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

		int n=Integer.parseInt(sc.next());
		int h[]=new int[100];
		int sum=1;

		for(int i=0;i<n;i++){
			h[i]=Integer.parseInt(sc.next());
			if(i!=0&&h[i-1]<=h[i]){
				sum+=1;
			}
		}
		System.out.println(sum);
	}

}

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


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n= scan.nextInt();
		int m= scan.nextInt();
		int a[][]= new int[n][m];
		int b[]= new int[m];
		int c= scan.nextInt();
		for(int i=0;i<m;i++) {
			b[i]=scan.nextInt();
		}
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				a[i][j]=scan.nextInt();
			}
		}
		scan.close();
		int cnt=0;
		for(int i=0;i<n;i++) {
			int sum=0;
			for(int j=0;j<n;j++) {
				sum+=a[i][j]*b[j];
			}
			if(sum+c>0)cnt++;
		}
		System.out.println(cnt);
	}
}

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


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n= scan.nextInt();
		int m= scan.nextInt();
		int a[][]= new int[n][m];
		int b[]= new int[m];
		int c= scan.nextInt();
		for(int i=0;i<m;i++) {
			b[i]=scan.nextInt();
		}
		for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++) {
				a[i][j]=scan.nextInt();
			}
		}
		scan.close();
		int cnt=0;
		for(int i=0;i<n;i++) {
			int sum=0;
			for(int j=0;j<n;j++) {
				sum+=a[i][j]*b[j];
			}
			if(sum+c>0)cnt++;
		}
		System.out.println(cnt);
	}
}

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


Question:
import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n= scan.nextInt();
		int m= scan.nextInt();
		int a[][]= new int[n][m];
		int b[]= new int[m];
		int c= scan.nextInt();
		for(int i=0;i<m;i++) {
			b[i]=scan.nextInt();
		}
		for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++) {
				a[i][j]=scan.nextInt();
			}
		}
		scan.close();
		int cnt=0;
		for(int i=0;i<n;i++) {
			int sum=0;
			for(int j=0;j<n;j++) {
				sum+=a[i][j]*b[j];
			}
			if(sum+c>0)cnt++;
		}
		System.out.println(cnt);
	}
}

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


Question:
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.NoSuchElementException;

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 class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    static int calcNumOfCombination(int n, int r) {
        int num = 1;
        for (int i = 1; i <= r; i++) {
            num = num * (n - i + 1) / i;
        }
        return num;
    }

    static long lcm(long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return (long) (c / b);
    }

    static long f(long n, Map<Long, Long> map) {
        if (n < 2)
            return 1;
        else if (map.containsKey(n)) {
            return map.get(n);
        } else {
            map.put(n, n * f(n - 2, map));
            return map.get(n);
        }

    }

    public long factorialUsingRecursion(int n) {
        if (n <= 2) {
            return n;
        }
        return n * factorialUsingRecursion(n - 1);
    }

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                char[] a = String.valueOf(i).toCharArray();
                char[] b = String.valueOf(j).toCharArray();
                if (a[0] == b[b.length - 1] && a[a.length - 1] == b[0])
                    ans++;
            }
        }

        System.out.println(ans);
    }

}

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


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

public class Main {
    static int gcd(int a, int b) {
        if (a % b != 0) {
            return gcd(b, a % b);
        } else {
            return b;
        }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        INT n = sc.nextInt();
        int i = n / 111;
        if (n % 111 != 0) {
            i += 1;
        }

        System.out.println(i * 111);
    }
}

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


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

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 class Main {
    // static int MOD = 1000000007;

    // public static class Mas {
    // int x;
    // int y;
    // int step;

    // Mas(int x, int y, int step) {
    // this.x = x;
    // this.y = y;
    // this.step = step;
    // }
    // }

    static long pow(long l, long i) {
        if (i == 0)
            return 1;
        else {
            if (i % 2 == 0) {
                long val = pow(l, i / 2);
                return val * val % 2019;
            } else {
                return pow(l, i - 1) * l % 2019;
            }
        }
    }

    private static final int[] vX = { 1, 0, 0, -1 };
    private static final int[] vY = { 0, 1, -1, 0 };

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int N = fs.nextInt();
        int M = fs.nextInt();
        int[] x = new int[M];
        int[] y = new int[M];
        for (int i = 0; i < M; i++) {
            x[i] = fs.nextInt() - 1;
            y[i] = fs.nextInt() - 1;
        }
        int[] nums = new int[N];
        boolean[] red = new boolean[N];
        Arrays.fill(nums, 1);
        red[0] = true;
        for (int i = 0; i < N; i++) {
            if (red[x[i]]) {
                red[y[i]] = true;
            }
            nums[x[i]]--;
            nums[y[i]]++;
            if (nums[x[i]] == 0) {
                red[x[i]] = false;
            }
        }
        int count = 0;
        for (boolean flag : red) {
            if (flag)
                count++;
        }
        System.out.println(count);
    }
}

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


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

public class Main {

	static ArrayList<Integer>[] adj;
	static int timer, par[], tin[], tout[];

	static int lca(int u, int v) {
		while (true) {
			if (tin[v] >= tin[u] && tin[v] <= tout[u])
				break;
			u = par[u];
		}
		return u;
	}

	static int[] prefix;

	static void update(int u, int lca) {
		prefix[u]++;
		prefix[lca]--;
	}

	static int dfs(int u, int p) {
		par[u] = p;
		tin[u] = timer++;
		int ans = 0;
		for (int v : adj[u])
			if (v != p) {
				ans += dfs(v, u);
				prefix[u] += prefix[v];
			}
		if (prefix[u] > 0)
			ans++;
		tout[u] = timer - 1;
		return ans;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		adj = new ArrayList[n];
		par = new int[n];
		tin = new int[n];
		prefix = new int[n];

		tout = new int[n];
		for (int i = 0; i < n; i++) {
			adj[i] = new ArrayList();
		}
		for (int i = 1; i < n; i++) {
			int u = sc.nextInt() - 1, v = sc.nextInt() - 1;
			adj[u].add(v);
			adj[v].add(u);
		}
		dfs(0, 0);
		int[][] lca = new int[n][n];
		int[] a = new int[n], b = new int[n];
		int m = sc.nextInt();
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt() - 1;
			b[i] = sc.nextInt() - 1;
			lca[a[i]][b[i]] = lca(a[i], b[i]);
		}
		long ans = 0;
		for (int msk = 0; msk < 1 << m; msk++) {
			Arrays.fill(prefix, 0);
			for (int i = 0; i < m; i++) {
				if ((msk & 1 << i) == 0)
					continue;
				update(a[i], lca[a[i]][b[i]]);
				update(b[i], lca[a[i]][b[i]]);

			}
			int c = dfs(0, 0);

			ans += (1L << (n - 1 - c)) * (Integer.bitCount(msk) % 2 == 0 ? 1 : -1);
		}
		out.println(ans);
		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

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

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}

}

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


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

public class Main {

	static long INF = Long.MAX_VALUE;
	static long[][] cost;

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt(), X = sc.nextInt();
		int[] a = new int[n + 1];
		for (int i = 1; i <= n; i++)
			a[i] = sc.nextInt();
		long[] dp = new long[n + 1];
		cost = new long[n + 1][n + 1];
		for (int r = n; r > 0; r--) {
			long curr = 0;
			for (int l = r - 1; l > 0; l--) {
				long len = r - l + 1;
				curr += len * len * (a[l + 1] - a[l]);
				cost[l][r] = curr;
			}
		}
		for (int r = 1; r <= n; r++) {
			long ans = INF;
			for (int l = r; l > 0; l--) {
				long carry = r - l + 1;
				long curr = dp[l - 1] + cost[l][r] + a[l] * 1l * (carry + 1) * (carry + 1);
				ans = Math.min(ans, curr);
			}
			dp[r] = ans + X + a[r];
		}

		out.println(dp[n] + n * 1L * X);

		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

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

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}

}

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


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

public class Main {

	static long INF = (long) 1e18;
	static long[][] cost;

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt(), X = sc.nextInt();
		int[] a = new int[n + 1];
		for (int i = 1; i <= n; i++)
			a[i] = sc.nextInt();
		long[] dp = new long[n + 1];
		cost = new long[n + 1][n + 1];
		for (int r = n; r > 0; r--) {
			long curr = 0;
			for (int l = r - 1; l > 0; l--) {
				long len = r - l + 1;
				curr += len * len * (a[l + 1] - a[l]);
				cost[l][r] = curr;
			}
		}
		for (int r = 1; r <= n; r++) {
			long ans = INF;
			for (int l = r; l > 0; l--) {
				long carry = r - l + 1;
				long curr = dp[l - 1] + cost[l][r] + a[l] * (carry + 1) * (carry + 1);
				ans = Math.min(ans, curr);
			}
			dp[r] = ans + X + a[r];
		}

		out.println(dp[n] + n * 1L * X);

		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

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

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}

}

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


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

class BBQ_Easy {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int k=sc.nextInt(), res=0;
		int[] s=new int[k*2];
		for(int i=0; i<k*2; ++i) s[i]=sc.nextInt();
		Arrays.sort(s);
		for(int i=k*2-1; i>=0; --i)
			if(i%2==0)  res+=s[i];
		System.out.println(res);
		sc.close();
	}

}

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


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

public class BBQ_Easy {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int k=sc.nextInt(), res=0;
		int[] s=new int[k*2];
		for(int i=0; i<k*2; ++i) s[i]=sc.nextInt();
		Arrays.sort(s);
		for(int i=k*2-1; i>=0; --i)
			if(i%2==0)  res+=s[i];
		System.out.println(res);
		sc.close();
	}

}

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


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

class atcoder_ptot implements Runnable{

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		new Thread(null,new atcoder_ptot(),"somethreadname",1<<26).start();
	}

	public void run() {

		atc.init(System.in);
		try {
			int N=atc.nextInt();
			int u=atc.nextInt();
			int v=atc.nextInt();
			u--;
			v--;

			atc_graph g=new atc_graph(N);

			for(int i=0;i<N-1;i++) {
				int a=atc.nextInt();
				int b=atc.nextInt();
				a--;
				b--;
				g.add_edge(g, a, b);
			}

			int[] visited=new int[N];
			int[] dist=new int[N];
			int[] parent=new int[N];
			int[] max_depth=new int[N];

			g.BFS(g, v, visited, dist, parent);
			g.DFS(g, max_depth);

//			for(int f=0;f<N;f++) {
//				System.out.print(max_depth[f]+" ");
//			}

			if(dist[u]==1) {
				System.out.println(0);
			}
			else if(N==2) {
				System.out.println(0);
			}
			else {
				int x=0;
				if(dist[u]%2==1) {
					x=(dist[u]-3)/2;
				}
				else {
					x=(dist[u]-2)/2;
				}
				int vertex=u;
				for(int e=0;e<x;e++) {
					vertex=parent[vertex];
				}

				if(dist[u]%2==1) {
					System.out.println(x+max_depth[vertex]+1);
				}
				else {
					System.out.println(x+max_depth[vertex]);
				}
			}

		}
		catch(IOException ioe) {
			System.out.println("IOException occurred");
		}

	}

}

class atc_graph{

	int n;
	ArrayList<ArrayList<Integer>> adj;

	atc_graph(int V){
		n=V;
		adj=new ArrayList<ArrayList<Integer>>();

		for(int p=0;p<n;p++) {
			adj.add(new ArrayList<Integer>());
		}
	}

	void add_edge(atc_graph g,int a,int b) {
		g.adj.get(a).add(b);
		g.adj.get(b).add(a);
	}

	void BFS(atc_graph g,int s,int[] visited,int[] dist,int[] parent) {

		LinkedList<Integer> q=new LinkedList<Integer>();

		q.add(s);

		visited[s]=1;
		dist[s]=1;

		while(!q.isEmpty()) {

			int v=q.poll();

			for(int w:g.adj.get(v)) {

				if(visited[w]==0) {

					visited[w]=1;
					dist[w]=dist[v]+1;
					parent[w]=v;

					q.add(w);

				}
			}
		}
	}

	void DFS(atc_graph g,int[] max_depth) {

		/* Depth First Search*/

		int inf=-1;
		int[] colour=new int[g.n];
		for(int i=0;i<g.n;i++) {
			colour[i]=inf;
		}

		for(int j=0;j<g.n;j++) {
			if(colour[j]==inf) {
				DFS_Visit(g,j,colour,max_depth,0);
			}
		}
	}

	int DFS_Visit(atc_graph g,int u,int[] colour,int[] max_depth,int depth) {

		int inf=-1;
		colour[u]=1;
		int maxi=depth;

		for(int v:g.adj.get(u)) {
			if(colour[v]==inf) {
				maxi=Math.max(maxi, DFS_Visit(g,v,colour,max_depth,depth+1));
			}
		}

		colour[u]=2;
		max_depth[u]=maxi-depth;
		return maxi;
	}

}

/** Class for buffered reading int and double values */
class atc {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	/** call this method to initialize reader for InputStream */
	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	/** get next word */
	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens()) {
			// TODO add check for eof if necessary
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

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

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

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

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


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

public class atcoder_ptot implements Runnable{

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		new Thread(null,new atcoder_ptot(),"somethreadname",1<<26).start();
	}

	public void run() {

		atc.init(System.in);
		try {
			int N=atc.nextInt();
			int u=atc.nextInt();
			int v=atc.nextInt();
			u--;
			v--;

			atc_graph g=new atc_graph(N);

			for(int i=0;i<N-1;i++) {
				int a=atc.nextInt();
				int b=atc.nextInt();
				a--;
				b--;
				g.add_edge(g, a, b);
			}

			int[] visited=new int[N];
			int[] dist=new int[N];
			int[] parent=new int[N];
			int[] max_depth=new int[N];

			g.BFS(g, v, visited, dist, parent);
			g.DFS(g, max_depth);

//			for(int f=0;f<N;f++) {
//				System.out.print(max_depth[f]+" ");
//			}

			if(dist[u]==1) {
				System.out.println(0);
			}
			else if(N==2) {
				System.out.println(0);
			}
			else {
				int x=0;
				if(dist[u]%2==1) {
					x=(dist[u]-3)/2;
				}
				else {
					x=(dist[u]-2)/2;
				}
				int vertex=u;
				for(int e=0;e<x;e++) {
					vertex=parent[vertex];
				}

				if(dist[u]%2==1) {
					System.out.println(x+max_depth[vertex]+1);
				}
				else {
					System.out.println(x+max_depth[vertex]);
				}
			}

		}
		catch(IOException ioe) {
			System.out.println("IOException occurred");
		}

	}

}

class atc_graph{

	int n;
	ArrayList<ArrayList<Integer>> adj;

	atc_graph(int V){
		n=V;
		adj=new ArrayList<ArrayList<Integer>>();

		for(int p=0;p<n;p++) {
			adj.add(new ArrayList<Integer>());
		}
	}

	void add_edge(atc_graph g,int a,int b) {
		g.adj.get(a).add(b);
		g.adj.get(b).add(a);
	}

	void BFS(atc_graph g,int s,int[] visited,int[] dist,int[] parent) {

		LinkedList<Integer> q=new LinkedList<Integer>();

		q.add(s);

		visited[s]=1;
		dist[s]=1;

		while(!q.isEmpty()) {

			int v=q.poll();

			for(int w:g.adj.get(v)) {

				if(visited[w]==0) {

					visited[w]=1;
					dist[w]=dist[v]+1;
					parent[w]=v;

					q.add(w);

				}
			}
		}
	}

	void DFS(atc_graph g,int[] max_depth) {

		/* Depth First Search*/

		int inf=-1;
		int[] colour=new int[g.n];
		for(int i=0;i<g.n;i++) {
			colour[i]=inf;
		}

		for(int j=0;j<g.n;j++) {
			if(colour[j]==inf) {
				DFS_Visit(g,j,colour,max_depth,0);
			}
		}
	}

	int DFS_Visit(atc_graph g,int u,int[] colour,int[] max_depth,int depth) {

		int inf=-1;
		colour[u]=1;
		int maxi=depth;

		for(int v:g.adj.get(u)) {
			if(colour[v]==inf) {
				maxi=Math.max(maxi, DFS_Visit(g,v,colour,max_depth,depth+1));
			}
		}

		colour[u]=2;
		max_depth[u]=maxi-depth;
		return maxi;
	}

}

/** Class for buffered reading int and double values */
class atc {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	/** call this method to initialize reader for InputStream */
	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	/** get next word */
	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens()) {
			// TODO add check for eof if necessary
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

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

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

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

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


Question:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ECommonSubsequence solver = new ECommonSubsequence();
        solver.solve(1, in, out);
        out.close();
    }

    static class ECommonSubsequence {
        private NumberTheory.Mod107 mod = new NumberTheory.Mod107();

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            int[] s = new int[n];
            for (int i = 0; i < n; i++)
                s[i] = in.nextInt();
            int[] t = new int[m];
            for (int i = 0; i < m; i++)
                t[i] = in.nextInt();

            NumberTheory.ModularNumber[][] answer = new NumberTheory.ModularNumber[n + 1][m + 1]; // answer[i][j] is the # nonempty using the first i chars and j chars

            for (int i = 0; i <= n; i++)
                for (int j = 0; j <= m; j++)
                    answer[i][j] = mod.create(0);

            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= m; j++) {
                    if (s[i - 1] == t[j - 1]) {
                        answer[i][j] = answer[i][j].add(answer[i - 1][j - 1]).add(1);
                    }
                    answer[i][j] = answer[i][j].add(answer[i - 1][j]);
                    answer[i][j] = answer[i][j].add(answer[i][j - 1]);
                    answer[i][j] = answer[i][j].subtract(answer[i - 1][j - 1]);
                }
            }

            out.println(answer[n][m].add(1));
        }

    }

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

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

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

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

    }

    static class NumberTheory {
        private static void ASSERT(boolean assertion) {
            if (!assertion)
                throw new AssertionError();
        }

        public abstract static class Modulus<M extends NumberTheory.Modulus<M>> {
            ArrayList<NumberTheory.ModularNumber<M>> factorial = new ArrayList<>();

            public abstract long modulus();

            public Modulus() {
                super();
                factorial.add(create(1));
            }

            public NumberTheory.ModularNumber<M> create(long value) {
                return new NumberTheory.ModularNumber(value, this);
            }

        }

        public static class Mod107 extends NumberTheory.Modulus<NumberTheory.Mod107> {
            public long modulus() {
                return 1_000_000_007L;
            }

        }

        public static class ModularNumber<M extends NumberTheory.Modulus<M>> {
            public final long value;
            public final M m;
            public final long MOD;

            public ModularNumber(long value, M m) {
                this.m = m;
                this.MOD = m.modulus();
                this.value = (value % MOD + MOD) % MOD;
            }

            public NumberTheory.ModularNumber<M> add(NumberTheory.ModularNumber<M> other) {
                ASSERT(m.modulus() == other.m.modulus());
                return this.add(other.value);
            }

            public NumberTheory.ModularNumber<M> add(long other) {
                return m.create(value + other);
            }

            public NumberTheory.ModularNumber<M> subtract(NumberTheory.ModularNumber<M> other) {
                ASSERT(m.modulus() == other.m.modulus());
                return this.subtract(other.value);
            }

            public NumberTheory.ModularNumber<M> subtract(long other) {
                return m.create(value - other);
            }

            public String toString() {
                return String.valueOf(value);
            }

        }

    }
}

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