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

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

	public static void main(String[] args) {
		int q=in.nextInt();
		while(q-->0) {
			int a=in.nextInt(), b=in.nextInt(), c=in.nextInt()-1, d=in.nextInt()-1, e=a>=b?(a-1)/(b+1)+1:(b-1)/(a+1)+1;
			char[] s = new char[a+b];
			for(int i=0, lastSame=0; i<s.length; ++i) {
				if(lastSame>=e) {
					if(s[i-1]=='A') {
						s[i]='B';
						--b;
					} else {
						s[i]='A';
						--a;
					}
					lastSame=1;
				} else {
					if((b-1)/e<=a-1) {
						s[i]='A';
						if(i>0&&s[i-1]=='A')
							++lastSame;
						else
							lastSame=1;
						--a;
					} else {
						s[i]='B';
						if(i>0&&s[i-1]=='B')
							++lastSame;
						else
							lastSame=1;
						--b;
					}
				}
			}
			out.println(new String(s).substring(c, d+1));
		}
		out.close();
	}

	interface Input {
		public String next();
		public String nextLine();
		public int nextInt();
		public long nextLong();
		public double nextDouble();
	}
	static class StdIn implements Input {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt();
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong();
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
}

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


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

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

	public static void main(String[] args) {
		int q=in.nextInt();
		while(q-->0) {
			/*int a=in.nextInt(), b=in.nextInt(), c=in.nextInt()-1, d=in.nextInt()-1;
			int el=1, er=(int)5e8, e=er;
			while(el<=er) {
				int em=(el+er)/2;
				if(a>=b?(a-1)/em<=b:(b-1)/em<=a) {
					e=em;
					er=em-1;
				} else
					el=em+1;
			}*/
			int a=in.nextInt(), b=in.nextInt(), c=in.nextInt()-1, d=in.nextInt()-1, e=a>=b?(a-1)/(b+1)+1:(b-1)/(a+1)+1;
			char[] s = new char[a+b];
			for(int i=0, lastSame=0; i<s.length; ++i) {
				if(lastSame>=e) {
					if(s[i-1]=='A') {
						s[i]='B';
						--b;
					} else {
						s[i]='A';
						--a;
					}
					lastSame=1;
				} else {
					if(a-1>=b?(a-2)/e<=b:(b-1)/e<=a-1) {
						s[i]='A';
						if(i>0&&s[i-1]=='A')
							++lastSame;
						else
							lastSame=1;
						--a;
					} else {
						s[i]='B';
						if(i>0&&s[i-1]=='B')
							++lastSame;
						else
							lastSame=1;
						--b;
					}
				}
			}
			out.println(new String(s).substring(c, d+1));
		}
		out.close();
	}

	interface Input {
		public String next();
		public String nextLine();
		public int nextInt();
		public long nextLong();
		public double nextDouble();
	}
	static class StdIn implements Input {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt();
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong();
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
}

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


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

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

	public static void main(String[] args) {
		int q=in.nextInt();
		while(q-->0) {
			int a=in.nextInt(), b=in.nextInt(), c=in.nextInt()-1, d=in.nextInt()-1, e=1;
			while(a>=b?(a-1)/e>b:(b-1)/e>a)
				++e;
			char[] s = new char[a+b];
			for(int i=0, lastSame=0; i<s.length; ++i) {
				if(lastSame>=e) {
					if(s[i-1]=='A') {
						s[i]='B';
						--b;
					} else {
						s[i]='A';
						--a;
					}
					lastSame=1;
				} else {
					if(a-1>=b?(a-2)/e<=b:(b-1)/e<=a-1) {
						s[i]='A';
						if(i>0&&s[i-1]=='A')
							++lastSame;
						else
							lastSame=1;
						--a;
					} else {
						s[i]='B';
						if(i>0&&s[i-1]=='B')
							++lastSame;
						else
							lastSame=1;
						--b;
					}
				}
			}
			out.println(new String(s).substring(c, d+1));
		}
		out.close();
	}

	interface Input {
		public String next();
		public String nextLine();
		public int nextInt();
		public long nextLong();
		public double nextDouble();
	}
	static class StdIn implements Input {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt();
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong();
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
}

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


Question:
import java.io.*;
import java.util.*;
import java.lang.*;
class Graph
{
	public ArrayList adjacency[];
	public Graph(int nodes)
	{
		adjacency = new ArrayList[nodes];
		for(int i=0;i<nodes;i++)
		{
			adjacency[i] = new ArrayList<Integer>();
		}
	}
	@Override
	public String toString()
	{
		String ret = "";
		for (ArrayList temp : adjacency) {
			ret+=(temp.toString()+"\n");
		}
		return ret;
	}
	public void addEdge(int from, int to)
	{
		adjacency[from].add(to);
		adjacency[to].add(from);
	}
}

public class Main {
	public static Graph g;
	public static int taka,aoki;
	public static int count[];
	public static void mark(int node, int pos)
	{
		count[node] = pos;
		ArrayList list = g.adjacency[node];
		int val;
		for(int i=0;i<list.size();i++)
		{
			val = (int)list.get(i);
			if(count[val]<0)
			{
				mark(val,pos+1);
			}
		}
	}
	public static int calc(int node, int pos)
	{
		if(count[node]==pos || count[node]+1==pos)
			return count[node];
		if(count[node]<pos)
			return Integer.MIN_VALUE;
		ArrayList list = g.adjacency[node];
		int val;
		int ans = 0;
		for(int i=0;i<list.size();i++)
		{
			val = (int)list.get(i);
			ans=Math.max(ans,calc(val,pos+1));
		}
		return ans;
	}
	public static void main(String[] args)throws IOException {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

		int n = in.nextInt();
		taka = in.nextInt()-1;
		aoki = in.nextInt()-1;
		g = new Graph(n);
		int a,b;
		for(int i=0;i<n-1;i++)
		{
			a=in.nextInt()-1;
			b=in.nextInt()-1;
			g.addEdge(a,b);
			g.addEdge(b,a);
		}
		count = new int[n];
		// Arrays.fill(count,-1);
		for(int i=0;i<n;i++)
		{
			count[i]=-1;
		}
		mark(aoki,0);
		// out.println("marked");
		// for(int i=0;i<n;i++)
		// {
		// 	out.print(i+" ");
		// 	out.println(count[i]);
		// }
		out.println(calc(taka,0));
        out.close();
	}
    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());
        }

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

    }

}

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


Question:
import java.util.*;

public class agc020D {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int Tests = sc.nextInt();
		for (int test = 0; test < Tests; test ++) {
			long a = sc.nextInt();
			long b = sc.nextInt();
			long l = sc.nextInt();
			long r = sc.nextInt();
			long len = (Math.max(a, b) - 1) / (Math.min(a, b) + 1) + 1;
			long lena, lenb;
			if (a >= len * b) {
				lena = a + b; lenb = 0;
			} else if (b >= len * a) {
				lena = 0; lenb = a + b;
			} else {
				lena = (len * a - b) / (len - 1);
				lenb = (len * b - a) / (len - 1);
			}
			boolean B = a - lena + lena / (len + 1) - lenb / (len + 1) == 0;
			for (long i = l - 1; i < r; ++ i) {
				char pc;
				if (i < lena) {
					if (i % (len + 1) == len) pc = 'B';
					else pc = 'A';
				}
				else if (i >= a + b - lenb) {
					if ((a + b - i - 1) % (len + 1) != len) pc = 'B';
					else pc = 'A';
				}
				else if (B) pc = 'B';
				else pc = 'A';
				System.out.print(pc);
			}
			System.out.println();
		}
	}
}

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


Question:
import java.util.*;

public class agc020D {
	public static void main(String[] argv) {
		Scanner sc = new Scanner(System.in);
		long Tests = sc.nextLong();
		while (Tests > 0) {
			long a = sc.nextLong(), b = sc.nextLong();
			long l = sc.nextLong(), r = sc.nextLong();
			long len = (a + b) / (Math.min(a, b) + 1);
			long lena, lenb;
			if (a >= len * b) {
				lena = a + b; lenb = 0;
			} else if (b >= len * a) {
				lena = 0; lenb = a + b;
			} else {
				lena = (len * a - b) / (len - 1);
				lenb = (len * b - a) / (len - 1);
			}
			boolean B = a - lena + lena / (len + 1) - lenb / (len + 1) == 0;
			for (long i = l - 1; i < r; ++ i) {
				if (i < a && i % (len + 1) == len) System.out.print('B');
				else if (i >= a + b - lenb && (a + b - i - 1) % (len + 1) != len) System.out.print('B');
				else System.out.print('A');
			}
			System.out.println();
			Tests --;
		}
	}
}

Choices:
- Internal error
- No abnormally found
- Compile 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 H = sc.nextInt(), W = sc.nextInt(), h = sc.nextInt(), w = sc.nextInt();
        if (H%h == 0 && W%w == 0) {
            System.out.println("No");
        }
        else {
            System.out.println("Yes");
            for (int i = 0; i < H; ++i) {
                for (int j = 0; j < W; ++j) {
                    System.out.print(i%h == h-1 && j%w == w-1 ? -4000*h*w+3999 : 4000);
                    System.out.print(' ');
                }
                System.out.println();
            }
        }
	}
}

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


Question:
#include <bits/stdc++.h>
using namespace std;

int main() {

  int s;
  cin >> s;

  vector<int> array(1001000);

  bool valid = true;

  int count = 2;

  array[s]++;

  while (valid) {

    if (s % 2 == 0) {
      s = s / 2;
    } else {
      s = 3 * s + 1;
    }

    if (array[s] != 0) {
      valid = false;
    } else {
      array[s]++;
      count++;
    }

  }

  cout << count << endl;

}

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


Question:
import java.util.*;

public class Main {

    public static List<List<Integer>> switchList;

    public static void main(String[] args) {
        switchList = new ArrayList<>();

        for (List<Integer> list : switchList) {
            for (int i : list) {
                System.out.print(i + " ");
            }
            System.out.println();
        }

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();

        getAllpatterns(M, new ArrayList<>(), 0);

        Map<Integer, List<Integer>> lampMap = new HashMap<>();
        Map<Integer, Integer> conditionMap = new HashMap<>();
        for (int i = 1; i <= M; i++) {
            int k = sc.nextInt();
            List<Integer> switchList = new ArrayList<>();
            for (int j = 0; j < k; j++) {
                int s = sc.nextInt();
                switchList.add(s);
            }
            lampMap.put(i, switchList);
        }

        for (int i = 1; i <= M; i++) {
            conditionMap.put(i, sc.nextInt());
        }
        sc.close();

        int count = 0;
        for (List<Integer> conditions : switchList) {
            boolean isOk = true;
            for (int lamp : lampMap.keySet()) {
                List<Integer> sws = lampMap.get(lamp);
                int onCount = 0;
                for (int switchNo : sws) {
                    if (conditions.get(switchNo - 1) == 1) {
                        onCount++;
                    }
                }
                if (onCount % 2 != conditionMap.get(lamp)) {
                    isOk = false;
                    break;
                }
            }
            if (isOk) {
                count++;
            } else {
                continue;
            }
        }

        System.out.println(count);
    }

    public static void getAllpatterns(int N, List<Integer> switches, int cnt) {
        if (cnt >= N) {
            List<Integer> copy = new ArrayList<>(switches);
            switchList.add(copy);
            return;
        }
        switches.add(0);
        getAllpatterns(N, switches, cnt + 1);
        switches.remove(switches.size() - 1);
        switches.add(1);
        getAllpatterns(N, switches, cnt + 1);
        switches.remove(switches.size() - 1);
    }
}

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


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Set<Integer> switchNumList = new HashSet<>();
        int n = sc.nextInt();
        int m = sc.nextInt();
        List<List<Integer>> sLists = new ArrayList<>();
        int[] p = new int[m];
        for (int i = 0; i < m; i++) {
            int k = sc.nextInt();
            List<Integer> list = new ArrayList<>();
            for (int j = 0; j < k; j++) {
                int stype = sc.nextInt();
                list.add(stype);
                switchNumList.add(stype);
            }
            sLists.add(list);
        }
        for (int i = 0; i < m; i++) {
            p[i] = sc.nextInt();
        }

        List<Integer> snumList = new ArrayList<>(switchNumList);
        int ans = 0;
        for (int bit = 0; bit < (1 << n); bit++) {
            Set<Integer> onOffPatter = new HashSet<>();
            for (int i = 0; i < n; i++) {
                if ((1 & (bit >> i)) == 1) {
                    onOffPatter.add(snumList.get(i));
                }
            }

            boolean allLight = true;
            for (int i = 0; i < m; i++) {
                List<Integer> sList = sLists.get(i);
                int count = 0;
                for (int s : sList) {
                    if (onOffPatter.contains(s)) {
                        count++;
                    }
                }
                if (count % 2 != p[i]) {
                    allLight = false;
                    break;
                }
            }
            if (allLight) {
                ans++;
                //System.out.println(Arrays.toString(onOffPatter.toArray()));
            }
        }
        System.out.println(ans);
    }

}

Choices:
- Memory Limit Exceeded
- Internal error
- No abnormally found
- Runtime 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();
        int m = sc.nextInt();
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            map.put(a, map.getOrDefault(a, 0) + 1);
            map.put(b, map.getOrDefault(b, 0) + 1);
        }
        for (int i = 1; i <= n; i++) {
            if (!map.containsKey(n)) {
                continue;
            }
            if (map.get(i) % 2 != 0) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }

}

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


Question:
import java.util.*;
public class Main{
	public static void main(String [] args){
    	Scanner scan = new Scanner(System.in);
      	int x = scan.nextInt();
 		int [] arr = new int[10e5+10];
      	int size = arr.length();
      arr[1]=1;
      arr[2]=1;
      arr[3]=1;
      	for(int i=4;i<size;i++){
          boolean isPrime=true;
        	for(int j=2;j<=Math.sqrt(i);j++){
            	if(i%j==0){
                  isPrime=false;
                  break;
                }
            }
          if(isPrime){
          arr[i]=1;
          }
        }
      	for(int i = x;i<size;i++){
        	if(arr[i]==1){
            System.out.println(i);
              break;
            }
        }

    }
}

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


Question:
import java.util.*;
public class Main{
	public static void main(String [] args){
    	Scanner scan = new Scanner(System.in);
      	int x = scan.nextInt();
 		int [] arr = new int[10e5+10];
      	int size = arr.length();
      arr[1]=1;
      arr[2]=1;
      arr[3]=1;
      	for(int i=4;i<size;i++){
          boolean isPrime=true;
        	for(int j=2;j<=Math.sqrt(i);j++){
            	if(i%j==0){
                  isPrime=false;
                  break;
                }
            }
          if(isPrime){
          arr[i]=1;
          }
        }
      	for(int i = x;i<size;i++{
        	if(arr[i]==1){
            System.out.println(i);
              break;
            }
        }

    }
}

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


Question:
package grand_04_02_17;

import java.util.Scanner;

/**
 * Created by srikanth on 04-02-2017.
 */
public class Main {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int even=0,odd=0;
        int N=scan.nextInt();
        while(N-->0){
            int i=scan.nextInt();
            if(i%2==0){
                even++;

            }
            else{
                odd++;
            }
        }
        if(odd%2==1 && even>0)
            System.out.println("NO");
        else{
            System.out.println("YES");
        }
    }
}

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


Question:
import java.util.Scanner;

/**
 * Created by srikanth on 04-02-2017.
 */
public class Addition {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int even=0,odd=0;
        int N=scan.nextInt();
        while(N-->0){
            int i=scan.nextInt();
            if(i%2==0){
                even++;

            }
            else{
                odd++;
            }
        }
        if(odd%2==1 && even>0)
            System.out.println("NO");
        else{
            System.out.println("YES");
        }
    }
}

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


Question:
package grand_04_02_17;

import java.util.Scanner;

/**
 * Created by srikanth on 04-02-2017.
 */
public class Addition {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int even=0,odd=0;
        int N=scan.nextInt();
        while(N-->0){
            int i=scan.nextInt();
            if(i%2==0){
                even++;

            }
            else{
                odd++;
            }
        }
        if(odd%2==1 && even>0)
            System.out.println("NO");
        else{
            System.out.println("YES");
        }
    }
}

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


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

public class A012 {

	public static void Main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		ArrayList<Long> list = new ArrayList<>();
		for(int i = 0; i < 3 * N; i++) {
			list.add(scanner.nextLong());
		}

		//どうソートする？
		Collections.sort(list, Collections.reverseOrder());

		long sum = 0;
		for(int i = 0; i < N; i++) {
			sum += list.get(1 + (2 * i));
		}

		System.out.println(sum);
	}

}

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


Question:
package practice;

import java.util.Scanner;

public class Main {

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

		int N = sc.nextInt();
		int M = sc.nextInt();

		int[][] S = new int[M][N+1];

		for(int i = 0 ; i < M ; i ++){
			int k = sc.nextInt();
			for(int j = 0 ; j < k ; j++){
				S[i][j] = sc.nextInt();
			}
		}

		int[] P = new int[M];
		for(int i = 0 ; i < M ; i++){
			P[i] = sc.nextInt();
		}
		sc.close();

		//スイッチパターンを2進数で表現
		int aans = (int)Math.pow(2, N);

		String denkyu;
		//スイッチオフを表現するために、桁埋め
		String ar = "%0" + N + "d";

		int count = 0;
		int a = 0;
		int ans = 0;
		for(int i = 0 ; i < aans ; i++){
			denkyu = String.format(ar ,Integer.parseInt(Integer.toBinaryString(i)));
			//System.out.println(denkyu);

			//各電球ごとのスイッチパターンを全探索
			for(int j = 0 ; j < M ; j++){
				for(int k = 0 ; k < N ; k++){
					if(S[j][k] ==0){
						break;
					}
					//System.out.println("S : " + S[j][k]);

					//スイッチオンの数を合計
					a += Integer.parseInt(String.valueOf(denkyu).substring(S[j][k]-1,S[j][k]));

					}
				//System.out.println("a : " + a);

				//2で割ったときの余りは適切か
				if(a%2 == P[j]){
					count++;
				}
				a = 0;
			}
			//System.out.println(count);
			//全電球が点灯するパターン(countがMになるパターン)は何個あるか
			if(count == M){
				ans++;
			}
			count = 0;
		}

		System.out.println(ans);
	}

}

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


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

        Scanner sc = new Scanner(System.in);

        // input K
        int K = sc.nextInt();
        int odd = 0;
        int even = 0;

        if(K%2 == 1){
            odd = K/2 + 1;
            even = K/2;
        }
        else{
            odd = K/2;
            even = K/2;
        }
        System.out.println(odd * even);
    }
}

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


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

        Scanner sc = new Scanner(System.in);

        // input N,K
        int N = sc.nextInt();
        int K = sc.nextInt();

        int a = 0;
        int b = 0;
        int c = 0;

        int count = 0;

        for(a = 1 ; a <=N ; a++){
            for(b = 1 ; b <=N ; b++){
                for(c = 1 ; c <=N ; c++){
                    if((a+b)%K==0 && (b+c)%K==0 && (c+a)%K==0){
                        count = count + 1;
                    }
                }
            }
        }
        System.out.println(count);
    }
}

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


Question:
import java.util.Scanner;

public class Main {

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

        final int N = sc.nextInt();
        final int M = sc.nextInt();

        final int[] s = new int[M];
        for (int i = 0; i < M; i++) {
            final int k = sc.nextInt();
            int sw = 0;
            for (int j = 0; j < k; j++) {
                sw |= (1<<(sc.nextInt()-1));
            }
            s[i] = sw;
        }

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

        int cnt = 0;

        for (int bit = 0; bit < (1<<N); bit++) {
//            System.out.println("***" + bit + "***");
            boolean lighten = true;
            for (int i = 0; i < M; i++) {
//                System.out.println(b(8, bit & s[i]) + ", " + p[i] + " = " + Integer.bitCount(bit & s[i]) % 2);
                if (Integer.bitCount(bit & s[i]) % 2 != p[i]) {
                    lighten = false;
                    break;
                }
            }

            if (lighten) {
                cnt++;
            }
        }

        System.out.println(cnt);
    }

    private static String b(final int n, final int bit) {
        final String s = "0".repeat(n) + Integer.toBinaryString(bit);
        return s.substring(s.length() - n);
    }
}

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


Question:
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            String[] nm = sc.nextLine().split(" ");
            int n = Integer.parseInt(nm[0]);
            long k = Long.parseLong(nm[1]);

            String[] alist = sc.nextLine().split(" ");
            //Convert to binary string
            long[] aary = new long[n];
            for(int i=0;i<n;i++){
                aary[i] = Long.parseLong(alist[i]);
            }

            //Convert to binary string
            String[] bsary = new String[n];
            int maxbslen = 0;
            for(int i=0;i<n;i++){
                bsary[i] = Long.toBinaryString(aary[i]);
                maxbslen = Math.max(maxbslen,bsary[i].length());
            }

            //Count each bit in binary string
            long bitcount [] = new long[maxbslen];
            for(String bs:bsary){
                for(int j=bs.length() - 1; j >= 0;j--){
                    if(bs.charAt(j)=='1'){
                        bitcount[bs.length() - 1 - j]++;
                    }
                }
            }

            //Calculate digits of x in binary
            int xdigit = Long.toBinaryString(k).length();

            //Calculate x
            long x = 0;
            for(int i=xdigit - 1; i > 0; i--){
                long next = x + (long)Math.pow(2,i);
                if(next <= k){
                    if(i >= bitcount.length){
                        x = next;
                    }else{
                        if(bitcount[i] <= n/2){
                            x = next;
                        }
                    }
                }
            }

            //Calculate f
            long f = 0;
            for(long a:aary){
                f += x^a;
            }
            System.out.println(f);
		}
    }
}

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


Question:
public class Main {
//public class A_EntranceExamination {
    public static void main(String[] args){
//        if(args.length == 0){
//           args = new String[] {"8","3"};
//       }
        int t = Integer.parseInt(args[0]);
        int x = Integer.parseInt(args[1]);
        Double dt = (double)t;
        Double dx = (double)x;
        String answer = String.format("%.10f",dt/dx);
        System.out.println(answer);
    }
}

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


Question:
public class Main {
    public static void main(String[] args){
        if(args.length == 0){
            args = new String[] {"99","1"};
        }
        int t = Integer.parseInt(args[0]);
        int x = Integer.parseInt(args[1]);
        Double dt = (double)t;
        Double dx = (double)x;
        answer = String.format("%.5f",dt/dx);
        System.out.println(answer);
    }
}

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


Question:
import java.util.Scanner;

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

        long a[] = new long[n];
        long b[] = new long[n];

        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
            b[i] = in.nextLong();
        }

        long ans = 0;
        for (int i = n - 1; i >= 0; i--) {
            long c = ((a[i] + b[i] - 1) / b[i]) * b[i] - a[i];
            ans += c;
            for (int j = 0; j <= i; j++) {
                a[j] += c;
            }
        }

        System.out.println(ans);
    }
}

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


Question:
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int w = sc.nextInt();
    String[][] data = new String[h][w];
    int[] H = new int[h];
    int[] W = new int[w];

    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        data[i][j] = sc.next();
      }
    }

    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        if (data[i][j].equals("#")) {
          H[i]++;
        }
      }
    }

    for (int j = 0; j < w; j++) {
      for (int i = 0; i < h; i++) {
        if (data[j][i].equals("#")) {
          W[j]++;
        }
      }
    }

    for (int i = 0; i < h; i++) {
      if (H[i] == 0) continue;
      for (int j = 0; j < w; j++) {
        if (W[j] == 0) continue;
      System.out.println(data[i][j]);
      }
    }
  }

}

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


Question:
import java.util.Scanner;

 class Main {
    static int total;
    static int[] costs;
    static int[] treasures;
    static int min;

    static void dp(int key, int treasure, int cost){
        if(key >= costs.length)
            return;
        if(treasure==total){
            min=Math.min(min, cost);
            return;
        }
        if(cost==Integer.MAX_VALUE)
            cost=0;
        dp(key+1, treasure| treasures[key], cost+costs[key]);
        dp(key+1, treasure, cost);
    }

    public static void main(String[] args) {
        Scanner in =new Scanner(System.in);
        int n= in.nextInt();
        int m = in.nextInt();
        costs = new int[m];
        min=Integer.MAX_VALUE;
        treasures = new int[m];
        total=0;
        for(int i=0;i<n;i++){
            total=total | (1<<i);
        }
       //System.out.println("Total " + total);
        for(int i=0;i<m;i++){
            costs[i]=in.nextInt();
            int tres= in.nextInt();
            int t=0;
            for(int j=0;j<tres;j++){
                int k=in.nextInt();
                t|= (1 << (k-1));
            }
            treasures[i]=t;
        }
        dp(0,0, Integer.MAX_VALUE);
        if(min==Integer.MAX_VALUE) {
            int x=-1;
            System.out.println(x);
        }
        else
            System.out.println(min);

    }
}

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


Question:
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m=sc.nextInt();
		long mod=1000000007;
		int[] s=new int[n];
		int[] t=new int[n];
		long[][] dp=new long[n+1][m+1];
		for(int i=0; i<n; i++){
			s[i]=sc.nextInt();
		}
		for(int i=0; i<m; i++){
			t[i]=sc.nextInt();
		}
		for(int i=1; i<=n; i++){
			for(int j=1; j<=m; j++){
				if(s[i-1]==t[j-1]){
					dp[i][j]=dp[i-1][j-1]+1+dp[i-1][j-1];
					dp[i][j]%=mod;
				}
				dp[i][j]=Math.max(dp[i][j],Math.max(dp[i-1][j],dp[i][j-1]));
			}
		}
		System.out.println(dp[n][m]+1);
	}
}

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


Question:
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int k=sc.nextInt();
		long mod=1000000007;
		long ans=0;
		for(int i=1; i<=m; i++){
			ans+=((((m-i+1)*(m-i)/2)*((n*n)%mod))%mod)*Combination(n*m-2,k-2,mod);
			ans%=mod;
		}
		for(int i=1; i<=n; i++){
			ans+=((((n-i+1)*(n-i)/2)*((m*m)%mod))%mod)*Combination(n*m-2,k-2,mod);
			ans%=mod;
		}
		System.out.println(ans);
	}
	static long Combination(int left,int right,long mod){
		long ans=1;
		right=Math.min(right,left-right);
		for(int i=0; i<right; i++){
			ans*=(left-i);
			ans%=mod;
		}
		for(int i=2; i<=right; i++){
			long tmp=mod-2;
			long mul=i;
			while(tmp>0){
				if((tmp&1)==1){
					ans*=mul;
				}
				tmp>>=1;
				mul*=mul;
				ans%=mod;
				mul%=mod;
			}
		}
		return ans;
	}
}

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


Question:
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int k=sc.nextInt();
		long mod=1000000007;
		long ans=0;
		for(int i=1; i<=m; i++){
			for(int j=i+1; j<=m; j++){
				ans+=(((j-i)*((n*n)%mod))%mod)*Combination(n*m-2,k-2,mod);
				ans%=mod;
			}
		}
		for(int i=1; i<=n; i++){
			for(int j=i+1; j<=n; j++){
				ans+=(((j-i)*((m*m)%mod))%mod)*Combination(n*m-2,k-2,mod);
				ans%=mod;
			}
		}
		System.out.println(ans);
	}
	static long Combination(int left,int right,long mod){
		long ans=1;
		right=Math.min(right,left-right);
		for(int i=0; i<right; i++){
			ans*=(left-i);
			ans%=mod;
		}
		for(int i=2; i<=right; i++){
			long tmp=mod-2;
			long mul=i;
			while(tmp>0){
				if((tmp&1)==1){
					ans*=mul;
				}
				tmp>>=1;
				mul*=mul;
				ans%=mod;
				mul%=mod;
			}
		}
		return ans;
	}
}

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


Question:
package com.company;
import java.util.*;

public class Main {
    static ArrayList<Edge>[] gr;
    static boolean[] mark;
    static int[] cover;

    static class Edge {
        int to, num;
        Edge(int to, int num) {
            this.to = to;
            this.num = num;
        }
    }

    static boolean DFS(int x, int y, int p) {
        if (x == y) return true;
        for (Edge e : gr[x]) {
            if (e.to == p) continue;
            if (DFS(e.to, y, x)) {
                mark[e.num] = true;
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        gr = new ArrayList[n];
        for (int i = 0; i < n; i++)
            gr[i] = new ArrayList<>();
        for (int i = 0; i < n - 1; i++)
        {
            int u = sc.nextInt(), v = sc.nextInt();
            u--;
            v--;
            gr[u].add(new Edge(v, i));
            gr[v].add(new Edge(u, i));
        }
        int m = sc.nextInt();
        cover = new int[n];
        for (int i = 0; i < m; i++)
        {
            int u = sc.nextInt(), v = sc.nextInt();
            u--;
            v--;

            mark = new boolean[n];
            for (int j = 0; j < n; j++)
                mark[j] = false;

            DFS(u, v, -1);

            for (int j = 0; j < n - 1; j++)
                if (mark[j])
                    cover[j] |= (1 << i);
        }

        long d[] = new long[1 << m];
        d[0] = 1;

        for (int i = 0; i < n - 1; i++)
            for (int x = (1 << m) - 1; x >= 0; x--) {
                long q = d[x];
                //d[x] += q;
                d[x | cover[i]] += q;
            }

        System.out.println(d[(1 << m) - 1]);
    }
}

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


Question:
import java.io.IOException;
import java.util.Scanner;

public class Main {

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

		Scanner scan = new Scanner(System.in);

		int X;
		X = scan.nextInt();

		if (X == 3 || X == 5 || X == 7) {
			System.out.println("YES");

		} else {
			ystem.out.println("NO");
		}
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}

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


Question:
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Scanner;
import java.util.TreeSet;

import com.sun.tools.classfile.Opcode.Set;

public class Main {

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

		Scanner scan = new Scanner(System.in);

		int N;
		String lastChar = "";
		N = scan.nextInt();
		java.util.Set<String> set = new LinkedHashSet<>();

		for (int i = 1; i <= N; i++) {
			set.add(scan.next());
		}

		if (N != set.size()) {
			System.out.println("No");
			return;

		}

		for (String item : set) {
			if (!lastChar.equals("")) {
				String firstChar = String.valueOf(item.charAt(0));

				if (!firstChar.equals(lastChar)) {
					System.out.println("No");
					return;
				}
			}

			lastChar = String.valueOf(item.charAt(item.length() - 1));
		}

		System.out.println("Yes");

	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}

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


Question:
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        Set<Integer> set = new HashSet<>();
        int past = s;
        for (int i = 2 ; ;i++) {
            int cur;
            if (past % 2 == 0) {
                cur = past / 2;
            } else {
                cur = 3 * past +1;
            }
            if (set.contains(cur)) {
                System.out.println(i);
                return;
            }
            set.contains(cur);
            past = cur;
        }
    }
}

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


Question:
//package solver;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class Main {

    int H, W, n;
    int x, y;
    String s, t;

    boolean okByLR(){
        int lft = y, rgt = y;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'L'){
                lft--;
            } else if(s.charAt(i) == 'R'){
                rgt++;
            }
            //---
            if(lft < 1 || rgt > W){
                return false;
            }
            //---
            if(t.charAt(i) == 'L'){
                if(rgt > 1){
                    rgt--;
                }
            } else if(t.charAt(i) == 'R'){
                if(lft < W){
                    lft++;
                }
            }
        }
        return true;
    }

    boolean okByUD(){
        int up = x, down = x;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'U'){
                up--;
            } else if(s.charAt(i) == 'D'){
                down++;
            }
            //---
            if(up < 1 || down > H){
                return false;
            }
            //---
            if(t.charAt(i) == 'U'){
                if(down > 1){
                    down--;
                }
            } else if(t.charAt(i) == 'D'){
                if(up < H){
                    up++;
                }
            }
        }
        return true;
    }

    void run() throws IOException {
        Reader in = new Reader();
        H = in.nextInt();
        W = in.nextInt();
        n = in.nextInt();
        x = in.nextInt();
        y = in.nextInt();
        s = in.readLine();
        t = in.readLine();

        if(okByUD() == false || okByLR() == false){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

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

    static class Reader {
        final private int bufferSize = 1 << 16;
        final private DataInputStream din;
        final private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader(){
            din = new DataInputStream(System.in);
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String fileName) throws IOException {
            din = new DataInputStream(new FileInputStream(fileName));
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, bufferSize);
            if(bytesRead == -1){
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException {
            if(bufferPointer == bytesRead){
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        private void close() throws IOException {
            if(din == null){
                return ;
            }
            din.close();
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while((c = read()) != -1){
                if(c == '\n'){
                    break;
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do{
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (c == '.'){
                while ((c = read()) >= '0' && c <= '9'){
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg)
                return -ret;
            return ret;
        }
    }
}

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


Question:
package solver;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class Main {

    int H, W, n;
    int x, y;
    String s, t;

    boolean okByLR(){
        int lft = y, rgt = y;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'L'){
                lft--;
            } else if(s.charAt(i) == 'R'){
                rgt++;
            }
            //---
            if(lft < 1 || rgt > W){
                return false;
            }
            //---
            if(t.charAt(i) == 'L'){
                if(rgt > 1){
                    rgt--;
                }
            } else if(t.charAt(i) == 'R'){
                if(lft < W){
                    lft++;
                }
            }
        }
        return true;
    }

    boolean okByUD(){
        int up = x, down = x;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'U'){
                up--;
            } else if(s.charAt(i) == 'D'){
                down++;
            }
            //---
            if(up < 1 || down > H){
                return false;
            }
            //---
            if(t.charAt(i) == 'U'){
                if(down > 1){
                    down--;
                }
            } else if(t.charAt(i) == 'D'){
                if(up < H){
                    up++;
                }
            }
        }
        return true;
    }

    void run() throws IOException {
        Reader in = new Reader();
        H = in.nextInt();
        W = in.nextInt();
        n = in.nextInt();
        x = in.nextInt();
        y = in.nextInt();
        s = in.readLine();
        t = in.readLine();

        if(okByUD() == false || okByLR() == false){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

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

    static class Reader {
        final private int bufferSize = 1 << 16;
        final private DataInputStream din;
        final private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader(){
            din = new DataInputStream(System.in);
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String fileName) throws IOException {
            din = new DataInputStream(new FileInputStream(fileName));
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, bufferSize);
            if(bytesRead == -1){
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException {
            if(bufferPointer == bytesRead){
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        private void close() throws IOException {
            if(din == null){
                return ;
            }
            din.close();
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[200005];
            int cnt = 0, c;
            while((c = read()) != -1){
                if(c == '\n'){
                    break;
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do{
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (c == '.'){
                while ((c = read()) >= '0' && c <= '9'){
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg)
                return -ret;
            return ret;
        }
    }
}

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


Question:
package solver;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class Main {

    int H, W, n;
    int x, y;
    String s, t;

    boolean okByLR(){
        int lft = 0, rgt = 0;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'L'){
                lft--;
            } else if(s.charAt(i) == 'R'){
                rgt++;
            }
            // --
            if(t.charAt(i) == 'L'){
                rgt--;
            } else if(t.charAt(i) == 'R'){
                lft++;
            }
            //---
            if(lft < 0 && (y + lft < 1)){
                return false;
            }
            if(rgt > 0 && (y + rgt > W)){
                return false;
            }
        }
        return true;
    }

    boolean okByUD(){
        int up = 0, down = 0;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'U'){
                up--;
            } else if(s.charAt(i) == 'D'){
                down++;
            }
            //---
            if(t.charAt(i) == 'U'){
                down--;
            } else if(t.charAt(i) == 'D'){
                up++;
            }
            //--
            if(up < 0 && (x + up < 1)){
                return false;
            }
            if(down > 0 && (x + down > H)){
                return false;
            }
        }
        return true;
    }

    void run() throws IOException {
        Reader in = new Reader();
        H = in.nextInt();
        W = in.nextInt();
        n = in.nextInt();
        x = in.nextInt();
        y = in.nextInt();
        s = in.readLine();
        t = in.readLine();

        if(okByUD() == false || okByLR() == false){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

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

    static class Reader {
        final private int bufferSize = 1 << 16;
        final private DataInputStream din;
        final private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader(){
            din = new DataInputStream(System.in);
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String fileName) throws IOException {
            din = new DataInputStream(new FileInputStream(fileName));
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, bufferSize);
            if(bytesRead == -1){
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException {
            if(bufferPointer == bytesRead){
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        private void close() throws IOException {
            if(din == null){
                return ;
            }
            din.close();
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[200005];
            int cnt = 0, c;
            while((c = read()) != -1){
                if(c == '\n'){
                    break;
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do{
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (c == '.'){
                while ((c = read()) >= '0' && c <= '9'){
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg)
                return -ret;
            return ret;
        }
    }
}

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


Question:
package solver;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class Main {

    int H, W, n;
    int x, y;
    String s, t;

    boolean okByLR(){
        int lft = 0, rgt = 0;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'L'){
                rgt--;
            } else {
                lft++;
            }
            // --
            if(t.charAt(i) == 'L'){
                lft--;
            } else {
                rgt++;
            }
            //---
            if(lft < 0 && (y + lft < 1)){
                return false;
            }
            if(rgt > 0 && (y + rgt > W)){
                return false;
            }
        }
        return true;
    }

    boolean okByUD(){
        int up = 0, down = 0;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'U'){
                down--;
            } else {
                up++;
            }
            //---
            if(t.charAt(i) == 'U'){
                up--;
            } else {
                down++;
            }
            //--
            if(up < 0 && (x - up < 1)){
                return false;
            }
            if(down > 0 && (x + down > H)){
                return false;
            }
        }
        return true;
    }

    void run() throws IOException {
        Reader in = new Reader();
        H = in.nextInt();
        W = in.nextInt();
        n = in.nextInt();
        x = in.nextInt();
        y = in.nextInt();
        s = in.readLine();
        t = in.readLine();

        if(okByUD() == false || okByLR() == false){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

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

    static class Reader {
        final private int bufferSize = 1 << 16;
        final private DataInputStream din;
        final private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader(){
            din = new DataInputStream(System.in);
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String fileName) throws IOException {
            din = new DataInputStream(new FileInputStream(fileName));
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, bufferSize);
            if(bytesRead == -1){
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException {
            if(bufferPointer == bytesRead){
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        private void close() throws IOException {
            if(din == null){
                return ;
            }
            din.close();
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[200005];
            int cnt = 0, c;
            while((c = read()) != -1){
                if(c == '\n'){
                    break;
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do{
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (c == '.'){
                while ((c = read()) >= '0' && c <= '9'){
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg)
                return -ret;
            return ret;
        }
    }
}

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


Question:
package solver;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class Main {

    int H, W, n;
    int x, y;
    String s, t;

    boolean okByLR(){
        int lft = 0, rgt = 0;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'L'){
                rgt--;
            } else {
                lft++;
            }
            // --
            if(t.charAt(i) == 'L'){
                lft--;
            } else {
                rgt++;
            }
            //---
            if(lft < 0 && (y + lft < 1)){
                return false;
            }
            if(rgt > 0 && (y + rgt > W)){
                return false;
            }
        }
        return true;
    }

    boolean okByUD(){
        int up = 0, down = 0;
        for(int i = 0; i < n; i++){
            if(s.charAt(i) == 'U'){
                down--;
            } else {
                up++;
            }
            //---
            if(t.charAt(i) == 'U'){
                up--;
            } else {
                down++;
            }
            //--
            if(up < 0 && (x - up < 1)){
                return false;
            }
            if(down > 0 && (x + down > H)){
                return false;
            }
        }
        return true;
    }

    void run() throws IOException {
        Reader in = new Reader();
        H = in.nextInt();
        W = in.nextInt();
        n = in.nextInt();
        x = in.nextInt();
        y = in.nextInt();
        s = in.readLine();
        t = in.readLine();

        if(okByUD() == false || okByLR() == false){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }

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

    static class Reader {
        final private int bufferSize = 1 << 16;
        final private DataInputStream din;
        final private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader(){
            din = new DataInputStream(System.in);
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String fileName) throws IOException {
            din = new DataInputStream(new FileInputStream(fileName));
            buffer = new byte[bufferSize];
            bufferPointer = bytesRead = 0;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, bufferSize);
            if(bytesRead == -1){
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException {
            if(bufferPointer == bytesRead){
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        private void close() throws IOException {
            if(din == null){
                return ;
            }
            din.close();
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while((c = read()) != -1){
                if(c == '\n'){
                    break;
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do{
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (c == '.'){
                while ((c = read()) >= '0' && c <= '9'){
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg)
                return -ret;
            return ret;
        }
    }
}

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


Question:
import java.util.Scanner;

public class Main {

	static long bignum = 1000000000+7;

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();
		long[] sum = new long[k+1];

		for(int i = k;i>0;i-- ) {
			long s = 1;
			for(int j=0;j<n;j++) {
				s= s*(k/i);
				s = div(s);
			}
			for(int j=2;j*i<k+1;j++) {
				s -= sum[j*i];
				s = div(s);
			}
			sum[i]=s;
		}
		long ans = 0;
		for(int i =1;i<k+1;i++) {
			ans += sum[i]*i;
			ans = div(ans);
		}
		System.out.println(ans);

	}

	static long div(long a) {
		if(a<0)a+=1000000000+7;
		return a%(1000000000+7);
	}

	static int gcd(int a,int b,int c) {
		int ans = 1;
		int max = Math.max(Math.max(a, b),c);
		for(int i =max;i>0;i--) {
			if(a%i==0) {
				if(b%i==0) {
					if(c%i==0) {
						ans = i;
						break;
					}
				}
			}
		}
		return ans;
	}

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/

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


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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt(), b = in.next();
        System.out.println(a * b  - a - b + 1);
    }
}

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


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

public class Main {
    static final int DIGIT_NUM_LIMIT = 18;

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

        long L = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();
        int M = sc.nextInt();

        System.out.println(solve(L, A, B, M));

        sc.close();
    }

    static int solve(long L, long A, long B, int M) {
        long[] beginIndices = new long[DIGIT_NUM_LIMIT + 1];
        long[] endIndices = new long[DIGIT_NUM_LIMIT + 1];
        for (int digitNum = 1; digitNum <= DIGIT_NUM_LIMIT; ++digitNum) {
            beginIndices[digitNum] = findBeginIndex(L, A, B, digitNum);
            endIndices[digitNum] = findEndIndex(L, A, B, digitNum);
        }

        int result = 0;
        BigInteger tenExponent = BigInteger.ZERO;
        for (int digitNum = DIGIT_NUM_LIMIT; digitNum >= 1; --digitNum) {
            if (beginIndices[digitNum] != -1) {
                long count = endIndices[digitNum] - beginIndices[digitNum] + 1;

                result = addMod(result, multiplyMod(computePart(A, B, M, digitNum, beginIndices[digitNum], count),
                        BigInteger.TEN.modPow(tenExponent, BigInteger.valueOf(M)).intValue(), M), M);

                tenExponent = tenExponent.add(BigInteger.valueOf(digitNum).multiply(BigInteger.valueOf(count)));
            }
        }

        return result;
    }

    static int computePart(long A, long B, int M, int digitNum, long beginIndex, long count) {
        int[][] transition = {
                { BigInteger.TEN.modPow(BigInteger.valueOf(digitNum), BigInteger.valueOf(M)).intValue(), 0, 0 },
                { 1, 1, 0 }, { 0, mod(B, M), 1 } };

        int[] initial = { 0, mod(A + B * beginIndex, M), 1 };

        return multiply(initial, pow(transition, count, M), M)[0];
    }

    static int[] multiply(int[] v, int[][] m, int M) {
        int size = m.length;

        int[] result = new int[size];
        for (int i = 0; i < result.length; ++i) {
            for (int j = 0; j < size; ++j) {
                result[i] = addMod(result[i], multiplyMod(v[j], m[j][i], M), M);
            }
        }

        return result;
    }

    static int[][] multiply(int[][] m1, int[][] m2, int M) {
        int size = m1.length;

        int[][] result = new int[size][size];
        for (int i = 0; i < size; ++i) {
            for (int j = 0; j < size; ++j) {
                for (int k = 0; k < size; ++k) {
                    result[i][j] = addMod(result[i][j], multiplyMod(m1[i][k], m2[k][j], M), M);
                }
            }
        }

        return result;
    }

    static int[][] pow(int[][] m, long exponent, int M) {
        int size = m.length;

        int[][] result = new int[size][size];
        for (int i = 0; i < size; ++i) {
            result[i][i] = 1;
        }

        for (int i = 0; i < exponent; ++i) {
            result = multiply(result, m, M);
        }

        return result;
    }

    static int mod(long x, int M) {
        return (int) (x % M);
    }

    static int addMod(int x, int y, int M) {
        return (x + y) % M;
    }

    static int multiplyMod(int x, int y, int M) {
        return (int) ((long) x * y % M);
    }

    static long findBeginIndex(long L, long A, long B, int digitNum) {
        long result = -1;
        long lower = 0;
        long upper = L - 1;
        while (lower <= upper) {
            long middle = (lower + upper) / 2;
            String s = String.valueOf(A + B * middle);

            if (s.length() >= digitNum) {
                if (s.length() == digitNum) {
                    result = middle;
                }

                upper = middle - 1;
            } else {
                lower = middle + 1;
            }
        }

        return result;
    }

    static long findEndIndex(long L, long A, long B, int digitNum) {
        long result = -1;
        long lower = 0;
        long upper = L - 1;
        while (lower <= upper) {
            long middle = (lower + upper) / 2;
            String s = String.valueOf(A + B * middle);

            if (s.length() <= digitNum) {
                if (s.length() == digitNum) {
                    result = middle;
                }

                lower = middle + 1;
            } else {
                upper = middle - 1;
            }
        }

        return result;
    }
}

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


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

public class Main {
    static final int DIGIT_NUM_LIMIT = 18;

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

        long L = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();
        int M = sc.nextInt();

        System.out.println(solve(L, A, B, M));

        sc.close();
    }

    static int solve(long L, long A, long B, int M) {
        long[] beginIndices = new long[DIGIT_NUM_LIMIT + 1];
        long[] endIndices = new long[DIGIT_NUM_LIMIT + 1];
        for (int digitNum = 1; digitNum <= DIGIT_NUM_LIMIT; ++digitNum) {
            beginIndices[digitNum] = findBeginIndex(L, A, B, digitNum);
            endIndices[digitNum] = findEndIndex(L, A, B, digitNum);
        }

        int result = 0;
        BigInteger tenExponent = BigInteger.ZERO;
        for (int digitNum = DIGIT_NUM_LIMIT; digitNum >= 1; --digitNum) {
            if (beginIndices[digitNum] != -1) {
                result = addMod(result,
                        multiplyMod(computePart(A, B, M, digitNum, beginIndices[digitNum], endIndices[digitNum]),
                                BigInteger.TEN.modPow(tenExponent, BigInteger.valueOf(M)).intValue(), M),
                        M);

                tenExponent = tenExponent.add(BigInteger.valueOf(digitNum)
                        .multiply(BigInteger.valueOf(endIndices[digitNum] - beginIndices[digitNum] + 1)));
            }
        }

        return result;
    }

    static int computePart(long A, long B, int M, int digitNum, long beginIndex, long endIndex) {
        long a1 = A + B * endIndex;
        long an = A + B * beginIndex;
        long n = endIndex - beginIndex + 1;
        long d = -B % M + M;
        int q = BigInteger.TEN.modPow(BigInteger.valueOf(digitNum), BigInteger.valueOf(M)).intValue();

        if (n == 1) {
            return mod(a1, M);
        }

        if (q == 1) {
            return addMod(multiplyMod(mod(n, M), mod(a1, M), M),
                    multiplyMod(BigInteger.valueOf(n).multiply(BigInteger.valueOf(n - 1)).divide(BigInteger.valueOf(2))
                            .mod(BigInteger.valueOf(M)).intValue(), mod(d, M), M),
                    M);
        }

        return divideMod(
                subtractMod(
                        addMod(mod(a1, M),
                                divideMod(
                                        multiplyMod(mod(d, M),
                                                subtractMod(1,
                                                        BigInteger.valueOf(q)
                                                                .modPow(BigInteger.valueOf(n - 1),
                                                                        BigInteger.valueOf(M))
                                                                .intValue(),
                                                        M),
                                                M),
                                        subtractMod(1, q, M), M),
                                M),
                        multiplyMod(
                                BigInteger.valueOf(q).modPow(BigInteger.valueOf(n), BigInteger.valueOf(M)).intValue(),
                                mod(an, M), M),
                        M),
                subtractMod(1, q, M), M);
    }

    static int mod(long x, int M) {
        return (int) (x % M);
    }

    static int addMod(int x, int y, int M) {
        return (x + y) % M;
    }

    static int subtractMod(int x, int y, int M) {
        return ((x - y) % M + M) % M;
    }

    static int multiplyMod(int x, int y, int M) {
        return (int) ((long) x * y % M);
    }

    static int divideMod(int x, int y, int M) {
        return multiplyMod(x, BigInteger.valueOf(y).modInverse(BigInteger.valueOf(M)).intValue(), M);
    }

    static long findBeginIndex(long L, long A, long B, int digitNum) {
        long result = -1;
        long lower = 0;
        long upper = L - 1;
        while (lower <= upper) {
            long middle = (lower + upper) / 2;
            String s = String.valueOf(A + B * middle);

            if (s.length() >= digitNum) {
                if (s.length() == digitNum) {
                    result = middle;
                }

                upper = middle - 1;
            } else {
                lower = middle + 1;
            }
        }

        return result;
    }

    static long findEndIndex(long L, long A, long B, int digitNum) {
        long result = -1;
        long lower = 0;
        long upper = L - 1;
        while (lower <= upper) {
            long middle = (lower + upper) / 2;
            String s = String.valueOf(A + B * middle);

            if (s.length() <= digitNum) {
                if (s.length() == digitNum) {
                    result = middle;
                }

                lower = middle + 1;
            } else {
                upper = middle - 1;
            }
        }

        return result;
    }
}

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


Question:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
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;
        FasterScanner in = new FasterScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public double getScore(long n) {
            double s = 0;
            String ns = Long.toString(n);

            for (char cc : ns.toCharArray()) s += cc - 48;

            return (double) n / s;
        }

        public void solve(int testNumber, FasterScanner in, PrintWriter out) {
            int k = in.nextInt();
            List<Long> possibleNum = new ArrayList<>();

            for (long i = 1; i <= 15; i++) {
                long cn = 0;
                for (long j = 0; j < i - 1; j++) cn += 9 * Math.pow(10, j);
                for (long j = 1; j <= 9; j++) possibleNum.add(cn + j * (long) Math.pow(10, i - 1));
            }

            List<Double> scores = new ArrayList<>();
            for (long cn : possibleNum) scores.add(getScore(cn));

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

            for (int i = 0; i < possibleNum.size(); i++) {
                double cs = scores.get(i);
                boolean isSnukeNum = true;
                for (int j = i + 1; j < possibleNum.size(); j++) {
                    double ts = scores.get(j);
                    if (cs > ts) {
                        isSnukeNum = false;
                        break;
                    }
                }
                if (isSnukeNum) snukeNum.add(possibleNum.get(i));
            }

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

    }

    static class FasterScanner {
        private InputStream in;
        private byte[] buffer;
        private int bufPointer;
        private int bufLength;

        public FasterScanner(InputStream in) {
            this.in = in;
            buffer = new byte[1024];
        }

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

        private int readByte() {
            if (hasNextByte()) return buffer[bufPointer++];
            return -1;
        }

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

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

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

        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' || b > '9') throw new NumberFormatException();

            while (true) {
                if (b >= '0' && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

    }
}

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


Question:
import java.util.Scanner;

public class seven {

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

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


Question:
/**
 *
 */
package beans;

import java.util.Scanner;

/**
 * @author yoshida3203
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
//		String str="ABCDE";
//		char[]a=str.toCharArray();
//		System.out.println(a);
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int[]H=new int[N];

		for(int i=0;i<H.length;i++){

			H[i]=sc.nextInt();
	}
		sc.close();

		int ans=1;
		int max=H[0];

		for(int i=1;i<H.length;i++){
			if(max<=H[i]){
				max=H[i];
				ans++;
			}
		}System.out.println(ans);

	}
}

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


Question:
package d;

import static java.lang.System.*;
import java.util.*;

public class Main {
	public static final int MOD = 1000000007;

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

        int n = sc.nextInt();

		long[][][][] dp = new long[4][4][4][n-3+1];
		for(int i=0; i<4; i++)
			for(int j=0; j<4; j++)
				for(int k=0; k<4; k++) {
					Arrays.fill(dp[i][j][k], 0L);
					dp[i][j][k][0] = 1L;
				}
		dp[0][1][2][0] = 0L;
		dp[0][2][1][0] = 0L;
		dp[1][0][2][0] = 0L;

		for(int m=0; m<n-3; m++)
			for(int i=0; i<4; i++)
				for(int j=0; j<4; j++)
					for(int k=0; k<4; k++)
						for(int l=0; l<4; l++) {
							dp[j][k][l][m+1] += dp[i][j][k][m];
							dp[j][k][l][m+1] %= MOD;

							dp[0][1][2][m+1] = 0L;
							dp[0][2][1][m+1] = 0L;
							dp[1][0][2][m+1] = 0L;
							if(i==0) {
								for(int o=0; o<4; o++) {
									dp[o][1][2][m+1] = 0L;
									dp[1][o][2][m+1] = 0L;
								}
							}
						}

		long sum = 0L;
		for(int i=0; i<4; i++)
			for(int j=0; j<4; j++)
				for(int k=0; k<4; k++) {
					sum += dp[i][j][k][n-3];
					sum %= MOD;
				}

		out.println(sum);
	}
}

Choices:
- Memory Limit Exceeded
- Internal error
- Runtime 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 n = sc.nextInt();
		int a[]=new int[n];
		int S=0;
		for(int i=0;i<n;i++) {
		a[i]=sc.nextInt();
		S+=a[i];
		}
		int s=S/2;
		boolean dp[][]=new boolean[n+1][s+1];
		dp[0][0]=true;
		for(int i=0;i<n;i++) {
			for(int j=0;j<=s;j++) {
				if(j>=a[i]) {
					dp[i+1][j]=dp[i][j-a[i]]||dp[i][j];
				}
				else {
					dp[i+1][j]=dp[i][j];
				}
			}
		}
		int w=0;
		for(int i=s;s>=0;s--) {
			if(dp[n][i]) {
				w=i;
			break;
			}
		}
		System.out.println(S-w);

	}
}

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


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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[]=new int[n];
		int S=0;
		for(int i=0;i<n;i++) {
		a[i]=sc.nextInt();
		S+=a[i];
		}
		int s=S/2;
		Arrays.sort(a);
//		int b=0;int c=0;
//		for(int i=n;i>=1;i--) {
//			if(b<c)b+=a[i];
//			else c+=a[i];
//		}
//		if(b<c)System.out.println(c);
//		else System.out.println(b);
		int dp[][]=new int[n+1][s+1];
		for(int i=0;i<=s;i++)dp[0][i]=0;
		for(int i=0;i<n;i++) {
			for(int j=0;j<=s;j++) {
				if(j>=a[i]) {
					dp[i+1][j]=Math.max(dp[i][j-a[i]]+a[i],dp[i][j]);
//					System.out.println("dp["+(i+1)+"]["+j+"]="+Math.max(dp[i][j-a[i]]+a[i],dp[i][j]));
				}
				else {
					dp[i+1][j]=dp[i][j];
//					System.out.println("dp["+(i+1)+"]["+j+"]="+dp[i][j]);
				}
			}
		}
		System.out.println(S-dp[n][s]);

	}
}

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


Question:
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int s = scn.nextInt();
		int a = scn.nextInt();
    	int count = 0;
    	int count2 = 0;
    	if(a == 1){
        	count = count + 1;
        }
    	if(a == 2){
        	count = count - 2;
        }
    	while(count2 < 2){
      		count = count + 1;
      		if(a == 4){
            	count2 = count + 1;
            }
			if(a%2==0){
            	a = a/2;
            }else{
             	a = a*3 + 1;
            }
   		 }

    	System.out.println(count);
	}
}

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


Question:
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int s = scn.nextInt();
		int a = sc.nextInt();
    	int count = 0;
    	int count2 = 0;
    	if(a == 1){
        	count = count + 1;
        }
    	if(a == 2){
        	count = count - 2;
        }
    	while(count2 < 2){
      		count = count + 1;
      		if(a == 4){
            	count2 = count + 1;
            }
			if(a%2==0){
            	a = a/2;
            }else{
             	a = a*3 + 1;
            }
   		 }

    	System.out.println(count);
	}
}

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


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

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      	String ans = "Yes";
		String[] w = new String[n];
		for(int i=0; i<w.length; ++i){
			w[i] = scn.next();
		}
      	String[] ww = new String[n];
      	for(int i=0; i<w.length; ++i){
			ww[i] = w[i];
		}
      	Arrays.sort(ww);
      	for(int i=1; i<w.length; ++i){
			if(ww[i].equals(ww[i-1])){
              ans = "No";
            }
		}
      	for(int i=1; i<w.length; ++i){
          char[] last = list[i-1].toCharArray();
          char[] first = list[i].toCharArray();
          if(last[last.length-1] != first[0]){
            ans = "No";
          }
        }
      	System.out.println(ans);
	}
}

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


Question:
import java.util.*;
public class Main {
	public static void main(String[] args)throws Exeption{
      Scanner scn = new Scanner(System.in);
      int h = scn.nextInt();
      int w = scn.nextInt();
      char[][] a = new char[h][w];
      for(int i=0; i<h; ++i){
        String str = scn.next();
        for(int j=0; j<w; ++j){
          a[i][j] = str.charAt(j);
        }
      }
      int[] hh = new int[h];
      int c = 0;
      for(int i=0; i<h; ++i){
        int count = 0;
        for(int j=0; j<w; ++j){
          if(a[i][j]=='.'){
            count = count + 1;
          }
        }
          if(count != w){
          	hh[c] = i;
            c = c + 1;
          }
      }
      int[] ww = new int[w];
      int d=0;
      for(int j=0; j<w; ++j){
        int count = 0;
        for(int i=0; i<h; ++i){
          if(a[i][j]=='.'){
            count = count + 1;
          }
        }
          if(count != h){
          	ww[d] = j;
            d = d + 1;
          }
      }
      for(int i=0; i<c; ++i){
        for(int j=0; j<d; ++j){
        	System.out.print(a[hh[i]][ww[j]]);
        	System.out.println();
        }
      }
    }
}

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


Question:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskD {
        static long dp;
        static long mod = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            dp = new long[N + 1][5][5][5][5];

            if (N == 3) {
                out.println(61);
                return;
            }

            long ans = 0;
            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    for (int k = 0; k < 4; k++) {
                        for (int l = 0; l < 4; l++) {
                            ans += dp(N, i, j, k, l);
                        }
                    }
                }
            }
            out.println(ans % mod);
        }

        private long dp(int n, int i, int j, int k, int l) {
            if (isTarget(i, j, k, l)) {
                return 0;
            }
            if (n == 4) return 1;

            if (dp[n][i][j][k][l] != 0) {
                return dp[n][i][j][k][l];
            }

            long tmp = 0;
            for (int m = 0; m < 4; m++) {
                tmp += dp(n - 1, m, i, j, k);
            }

            tmp %= mod;

            return dp[n][i][j][k][l] = tmp;
        }

        private boolean isTarget(int i, int j, int k, int l) {
            if (i == 0 && j == 1 && k == 2) return true;
            if (i == 1 && j == 0 && k == 2) return true;
            if (i == 0 && j == 2 && k == 1) return true;
            if (i == 0 && k == 1 && l == 2) return true;
            if (i == 0 && j == 1 && l == 2) return true;
            if (j == 0 && k == 1 && l == 2) return true;
            if (j == 1 && k == 0 && l == 2) return true;
            if (j == 0 && k == 2 && l == 1) return true;
            return false;
        }

    }
}

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


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

public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	int d = scan.nextInt();
      	int[][] x = new int[n][d];
      	int counter =0;
      for(int j = 0 ; j < n; j ++){
      	for(int i = 0; i < d; i ++){
       		x[j][i] = scan.nextInt();
        }
      }
      for(int i = 0; i < n - 1 ; i ++){
        int sum = 0;
      	for(int j = i + 1; j < n ; j ++){
          for(int k = 0; k < d; k ++){
          	sum += ((x[j]*x[i] - x[i]*x[i]) * (x[j]*x[i] - x[i]*x[i]));
          }
          if(Math.sqrt(sum) == (int)(Math.sqrt(sum))){
          	counter++;
          }
        }
      }
      System.out.print(counter);
    }

}

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


Question:
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	int d = scan.nextInt();
      	int[][] x = new int[n][d];
      	int counter =0;
      for(int j = 0 ; j < n; j ++){
      	for(int i = 0; i < d; i ++){
       		x[j][i] = scan.nextInt();
        }
      }
      for(int i = 0; i < n - 1 ; i ++){
        int sum = 0;
      	for(int j = i + 1; j < n ; j ++){
          for(int k = 0; k < d; k ++){
          	sum += ((x[j]*x[i] - x[i]*x[i]) * (x[j]*x[i] - x[i]*x[i]));
          }
          if(Math.sqrt(sum) == int(Math.sqrt(sum))){
          	counter++;
          }
        }
      }
      System.out.print(counter);
    }

}

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