Question:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] str=sc.next().toCharArray();
		sc.close();
		int first=0,l=0;
		char oc=str[0],nc;
		String ans="";
		for(int i=1;i<str.length;i++) {
			nc=str[i];
			if(oc=='R'&&nc=='L') {
				l=i;
			}else if(oc=='L'&&nc=='R'){
				int rNum=l-first,lNum=i-l;
				for(int j=1;j<rNum;j++) {
					ans+=" 0";
				}
				int rVal=lNum/2,lVal=rNum/2;
				rNum-=lVal;
				lVal+=lNum-rVal;
				rVal+=rNum;
				ans+=" "+rVal+" "+lVal;
				for(int j=1;j<lNum;j++) {
					ans+=" 0";
				}
				first=i;
			}
			oc=nc;
		}
		int rNum=l-first,lNum=str.length-l;
		for(int j=1;j<rNum;j++) {
			ans+=" 0";
		}
		int rVal=lNum/2,lVal=rNum/2;
		rNum-=lVal;
		lVal+=lNum-rVal;
		rVal+=rNum;
		ans+=" "+rVal+" "+lVal;
		for(int j=1;j<lNum;j++) {
			ans+=" 0";
		}
		System.out.println(ans.substring(1));
	}

}

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


Question:
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
		int K = sc.nextInt();
		PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());
		ArrayList<Integer> al = new ArrayList<>();
		char[] c = sc.next().toCharArray();
		int temp = 1;
		for(int i=0; i<N-1;i++){
			if (c[i] == c[i+1]){temp += 1;}
			else{
				al.add(temp);
				temp = 1;
			}
		}
		al.add(temp);
		int Ans = 0;
		if(al.size()<K*2+1){Ans = N-1;}
		else{
			for(int i = K; i<=al.size()-K-1 ;i++){
				temp = 0;
				for(int j = -K;j<=K;j++){
					temp += al.get(i+j);
				}
                for(int j=0;j<i-K;j++){
                    temp += al.get(j)-1;
                }
                for(int j=i+K+1;j<al.size();j++){
                    temp += al.get(j)-1;
                }
				pq.add(temp);
			}
			Ans = pq.poll()-1;
		}
		System.out.println(Ans);
	}
}

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


Question:
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String c = sc.next();
    String ans = "A";
    if (c.equals("A")){ans = "T";}
    if (c.equals("T")){ans = "A";}
    if (c.equals("C")){ans = "G";}
    if (c.equals("G")){ans = "C";}
    System.out.println(Ans);
  }
}

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


Question:
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String c = sc.next();
    String Ans = "A";
    if (c.equals("A")){ans = "T";}
    if (c.equals("T")){ans = "A";}
    if (c.equals("C")){ans = "G";}
    if (c.equals("G")){ans = "C";}
    System.out.println(Ans);
  }
}

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


Question:
import java.util.Scanner;
2

3
public class Main{
4
  public static void main(String[] args){
5
    Scanner sc = new Scanner(System.in);
6
    int an = sc.nextInt();
7
    System.out.println((an==3|an==5|an==7) ? "Yes":"No");
8
  }
9
}

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


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

public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] memo = new int[100000];
		for(int i = 0; i < n; i++) {
			int a = sc.nextInt();
			memo[a-1]++;
		}
		int q = sc.nextInt();
		int b[] = new int[q];
		int c[] = new int[q];
		for(int i = 0; i < q; i++) {
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}
		for(int i = 0; i < q; i++) {
			memo[c[i]-1]+=memo[b[i]-1];
			memo[b[i]-1]=0;
			long ans = 0;
			for(int j = 0; j < 100000; j++) {
				if(memo[j]!=0) {
					ans = ans + (j+1)*memo[j];
				}
			}
			System.out.println(ans);
		 }
		}
}

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


Question:
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;

public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	   	String s = sc.next();
	   	long sum = 0;
	   	for(int i = 0; i < s.length()-3; i++) {
	   		int left = i;
		   	int right = i+4;
	   		while(right<=s.length()) {
		   		BigDecimal val = new BigDecimal(s.substring(left, right));
		   		BigDecimal mod = new BigDecimal(2019);
		   		BigDecimal rem = val.remainder(mod);
		   		//System.out.println(rem);
		   		if(rem.equals(new BigDecimal(0))) {
		   			left = right;
		   			right=left+3;
		   			sum++;
		   		}
		   		else {
		   			right++;
		   		}
		   	}
	   	}
	   	System.out.println(sum);
	}
}

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


Question:
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;

public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	   	String s = sc.next();
	   	long sum = 0;
	   	for(int i = 0; i < s.length()-3; i++) {
	   		int left = i;
		   	int right = i+4;
	   		while(right<=s.length()) {
		   		long val = Long.parseLong(s.substring(left, right));
		   		//System.out.println(val);
		   		if(val%2019==0) {
		   			left = right;
		   			right=left+3;
		   			sum++;
		   		}
		   		else {
		   			right++;
		   		}
		   	}
	   	}
	   	System.out.println(sum);
	}
}

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


Question:
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String S = sc.next();
		char[] s = S.toCharArray();
		List<Integer> R = new ArrayList<Integer>();
		List<Integer> B = new ArrayList<Integer>();
		List<Integer> G = new ArrayList<Integer>();
		long ans = 0;
		for(int i = 0; i < n; i++) {
			if(s[i] =='R') {
				R.add(i);
			}
			else if(s[i] =='B') {
				B.add(i);
			}
			else if(s[i] =='G') {
				G.add(i);
			}
		}
		long sub = 0;
		ans = R.size()*B.size()*G.size();
		while(!R.isEmpty()) {
			int nowR = R.remove(0);
			for(int i = 0; i < B.size(); i++) {
				int nowB= B.get(i);
				int c = (nowR+nowB)/2;
				int l = Math.abs(nowR-nowB);
				if(G.contains(c)&&l%2==0) {
					sub++;
				}
				if(nowB>nowR) {
					if(G.contains(nowB+l)) {
						sub++;
					}
					if(G.contains(nowR-l)) {
						sub++;
					}
				}
				else {
					if(G.contains(nowB-l)) {
						sub++;
					}
					if(G.contains(nowR+l)) {
						sub++;
					}
				}
			}
		}
		System.out.println(ans-sub);
	}
}

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


Question:
import java.util.*;

public class Main {
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] P = new int[N];
		int R = N;
		for(int i = 0; i < N; i++) {
			P[i] = sc.nextInt();
			for(int j = i; j >= 0; j--) {
				if(P[i] > P[j]) {
					R--;
					break;
				}
			}
		}
		System.out.println(R);
	}
}

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


Question:
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;

public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n = s.length();
		int[] now = new int[n];
		int[] c = new int[n];
		for(int i = 0; i < n; i++) {
			c[i]=1;
			now[i]=1;
		}
		for(int i = 0; i < n/2; i++) {
			for(int j = 0; j < n; j++) {
				//System.out.println(s.charAt(j));
				if(s.charAt(j)=='R') {
					c[j+1]+=now[j];
					c[j]-=now[j];
				}
				else if(s.charAt(j)=='L') {
					c[j-1]+=now[j];
					c[j]-=now[j];
				}
			}
			for(int j = 0; j < n; j++) {
				now[j] = c[j];
			}
		}
		String ans = "";
		for(int i = 0; i < n; i++) {
			if(i==0) {
				ans+=c[i];
			}
			else {
				ans+=" ";
				ans+=c[i];
			}
		}
		System.out.println(ans);
	 }
}

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


Question:
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int A,B,T;
      A = sc.nextInt();
      B = sc.nextInt();
      T = sc.nextInt();
      int result = (T / A) * B;
      System.out.println(result);
    }
}

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


Question:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = Math.abs(sc.nextLong());
        long k = sc.nextLong();
        long d = sc.nextLong();
        long min = x % d;
        long count = x / d;
        if(count >= k) {
            System.out.println(x - k * d);
            return;
        }
        if((k - count) % 2 == 0) {
            System.out.println(min);
        } else {
            System.out.println(d - min);
        }
    }
}

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


Question:
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = Math.abs(sc.nextLong());
        long k = sc.nextLong();
        long d = sc.nextLong();
        if(x >= k * d) {
            System.out.println(x - k * d);
            return;
        }
        long min = x % d;
        long count = x / d;
        if((k - count) % 2 == 0) {
            System.out.println(min);
        } else {
            System.out.println(d - min);
        }
    }
}

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


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        BigInteger[] a = new BigInteger[n];
        BigInteger aa = new BigInteger("1000000000000000000");
        BigInteger sum = new BigInteger("1");
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextBigInteger();
        }
        for (int i = 0; i < n; i++) {
            sum = sum.multiply(a[i]);
        }
        if(sum.compareTo(aa) > 0) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        }
    }
}

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


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

public class Main71 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        BigInteger[] b = new BigInteger[a];
        BigInteger total = BigInteger.ONE;
        for(int i =0; i<a; i++) {
            b[i] = sc.nextBigInteger();
            if(b[i] == BigInteger.ZERO) {
                System.out.println("0");
                return;
            }
        }
        BigInteger c = BigInteger.TEN.pow(18);
        for(int i =0; i<a; i++) {
            if(0 > total.compareTo(c) ) {
                System.out.println("-1");
                return;
            }
            total = b[i].multiply(total);
        }
        System.out.println(total);
    }
}

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


Question:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        long c = sc.nextInt();
        long k = sc.nextInt();
        long total = 0;
        total += a;
        k -= a;
        if(k <= 0) {
            System.out.println(total);
            return;
        }
        k -= b;
        if(k <= 0) {
            System.out.println(total);
            return;
        }
        total += (k * -1);
        System.out.println(total);
    }
}

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


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Long> list = new ArrayList<>();
        for(int i=0; i<n; i++) {
            list.add(sc.nextLong());
        }
        if(n <= k) {
            System.out.println(0);
            return;
        }
        Collections.sort(list);
        Collections.reverse(list);
        for(int i=0; i<k; i++) {
            list.remove(i);
        }
        BigInteger total = BigInteger.ZERO;
        for(int i=0; i<list.size(); i++) {
            total = total.add(BigInteger.valueOf(list.get(i)));
        }
        System.out.println(total);
    }
}

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


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0; i<n; i++) {
            list.add(sc.nextInt());
        }
        if(n <= k) {
            System.out.println(0);
            return;
        }
        Collections.sort(list);
        Collections.reverse(list);
        for(int i=0; i<k; i++) {
            list.remove(i);
        }
        BigInteger total = BigInteger.ZERO;
        for(int i=0; i<list.size(); i++) {
            total = total.add(BigInteger.valueOf(list.get(i)));
        }
        System.out.println(total);
    }
}

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


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0; i<n; i++) {
            list.add(sc.nextInt());
        }
        if(n <= k) {
            System.out.println(0);
            return;
        }
        Collections.sort(list);
        Collections.reverse(list);
        for(int i=0; i<k; i++) {
            list.remove(i);
        }
        long total = 0;
        for(int i=0; i<list.size(); i++) {
            total += list.get(i);
        }
        System.out.println(total);
    }
}

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


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        BigInteger c = BigInteger.valueOf(a).multiply(BigInteger.valueOf(b));
        int d = a % b;
        while(d != 0) {
            a = b;
            b = d;
            d = a % b;
        }
        System.out.println(c.divide(BigInteger.valueOf(b)));
    }

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


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        List<Integer> list = new ArrayList<>();
        for(int i=0; i<n; i++) {
            //list.add(sc.nextInt());
            a[i] = sc.nextInt();
        }
        for(int i=1; i<=n; i++) {
            //System.out.print(list.indexOf(Integer.valueOf(i)) + 1);
            for(int j=0; j<n; j++) {
                if(i == a[j]) {
                    System.out.print(j+1);
                    break;
                }
            }
            if(i != n) System.out.print(" ");
        }
        System.out.println();
    }
}

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


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        List<Integer> list = new ArrayList<>();
        for(int i=0; i<n; i++) {
            list.add(sc.nextInt());
        }
        for(int i=1; i<=n; i++) {
            System.out.print(list.indexOf(Integer.valueOf(i)) + 1);
            if(i != n) System.out.print(" ");
        }
        System.out.println();
    }
}

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


Question:
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong() - 1;
        long b = sc.nextLong() - 1;
        long c = sc.nextLong();
        long d = sc.nextLong();
        long lcm = lcm(c, d);
        long e = b - a;
        long f = a / c;
        long g = a / d;
        long h = a / lcm;
        long ans1 = a - f - g + h;
        long i = b / c;
        long j = b / d;
        long k = b / lcm;
        long ans2 = b - i - j + k;
        long ans = ans2 - ans1;
        System.out.println(ans);
    }

    public static final long lcm(final long a, final long b) {
        return a * b / gcd(a, b);
    }

    public static final long gcd(long a, long b) {
        if (a < b) {
            long tmp = a;
            a = b;
            b = tmp;
        }
        long r = -1;
        while (r != 0) {
            r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
}

Choices:
- Runtime 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 n = sc.nextInt();
        int q = sc.nextInt();
        String s = sc.next();
        int[] l = new int[q];
        int[] r = new int[q];
        for (int i = 0; i < q ; i++) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
        }
        for(int i = 0; i < q; i++) {
            char[] ss = s.toCharArray();
            int ans = 0;
            for(int j = l[i] - 1; j < r[i] -1; j++) {
                if(ss[j] == 'A' && ss[j + 1]  == 'C') {
                    ans++;
                }
            }
            System.out.println(ans);
        }
    }
}

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


Question:
mport java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int T = sc.nextInt();
        int[] c = new int[n];
        int[] t = new int[n];
        int min = Integer.MAX_VALUE;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            c[i] = sc.nextInt();
            t[i] = sc.nextInt();
            if(T > t[i]) {
                if(min > t[i]) {
                    min = t[i];
                    ans = c[i];
                }
            }
        }
        if(ans == Integer.MAX_VALUE) System.out.println("TLE");
        else System.out.println(ans);
    }
}

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


Question:
mport java.util.Scanner;

public class Main099 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int T = sc.nextInt();
        int[] c = new int[n];
        int[] t = new int[n];
        int min = Integer.MAX_VALUE;
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            c[i] = sc.nextInt();
            t[i] = sc.nextInt();
            if(T > t[i]) {
                if(min > t[i]) {
                    min = t[i];
                    ans = c[i];
                }
            }
        }
        if(ans == Integer.MAX_VALUE) System.out.println("TLE");
        else System.out.println(ans);
    }
}

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


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        boolean flg = true;
        for (int i = 0; i < n; i++) {
            int tmp = sc.nextInt();
            if(tmp > x && flg) {
                list.add(x);
                flg = false;
            }
            list.add(tmp);
        }
        Collections.sort(list);
        ArrayList<Integer> list2 = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list2.add(Math.abs(list.get(i + 1) - list.get(i)));
        }
        if(list2.size() == 0) {
            System.out.println();
        }
        int ans = list2.get(0);
        for (int i = 1; i < list2.size() - 1; i++) {
            ans = gcd(ans, list2.get(i));
        }
        System.out.println(ans);
    }

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

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


Question:
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        String ans = "1";
        for (int i = 0; i <= 101 ; i++) {
            String ss = s.substring(i, i + 1);
            if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        System.out.println(ans);
    }
}

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


Question:
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        String ans = "1";
        for (int i = 0; i <= 100 ; i++) {
            String ss = s.substring(i, i + 1);
            if(!ss.equals("1")) {
                ans = ss;
                break;
            }
        }
        System.out.println(ans);
    }
}

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


Question:
package aizuOnlineJudge;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        if(n == k) {
            System.out.println(1);
            return;
        } else if(k == 2) {
            System.out.println(n - 1);
        } else if(k == 3) {
            System.out.println(n / 2);
        } else {
            int ans = n / (k - 1);
            if(n % (k - 1) != 0) ans++;
            System.out.println(ans);
        }
    }
}

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


Question:
import java.util.Arrays;
import java.util.Collections;
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();
		int[] A = new int[M];
		for(int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();
		//int[] a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
		int[] c = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i = 0; i < M; i++) {
			if(map.containsKey(c[A[i]])) {
				if(map.get(c[A[i]]) < A[i]) {
					map.put(c[A[i]], A[i]);
				}
			}else {
				map.put(c[A[i]], A[i]);
			}
		}
		int l = map.size();
		int[]k = new int[map.size()];
		int idx = 0;
		for(int key : map.keySet()) {
			k[idx] = key;
			idx++;
		}
		if(l == 1) {
			for(int i = 0; i < N / k[0]; i++) {
				System.out.print(map.get(k[0]));
			}
			System.out.println();
			System.exit(0);
		}
		Arrays.sort(k);
		Data[] d = new Data[N + 1];
		for(int i = 0; i <= N; i++) {
			d[i] = new Data(l);
		}
		for(int i = 1; i <= N / k[0]; i++) {
			d[i * k[0]].flag = true;
			d[i * k[0]].g[0] = i;
		}
		d[0].flag = true;
		for(int i = 0; i < N; i++) {
			if(!d[i].flag) continue;
			for(int j = 0; j < l; j++) {
				int t = i + k[j];
				if(t > N) break;
				if(d[t].flag == false) {
					d[t].flag = true;
					for(int u = 0; u < l; u++) {
						d[t].g[u] = d[i].g[u];
					}
					d[t].g[j] += 1;
				}else {
					if(d[t].sum() <= d[i].sum()) {
						for(int u = 0; u < l; u++) {
							d[t].g[u] = d[i].g[u];
						}
						d[t].g[j] += 1;
					}else if(d[t].sum() == d[i].sum() + 1) {
						//System.out.println(t + " " + i);
						int f1 = 0;
						int f2 = 0;
						for(int u = 0; u < l; u++) {
							f1 += d[t].g[u] * map.get(k[u]);
							f2 += d[i].g[u] * map.get(k[u]);
						}
						f2 += map.get(k[j]);
						if(f1 < f2) {
							for(int u = 0; u < l; u++) {
								d[t].g[u] = d[i].g[u];
							}
							d[t].g[j] += 1;

						}
						if(f1 == f2) {
							System.out.println(d[N * 2]);
						}
					}
				}
			}
		}
		Integer[] ans = new Integer[d[N].sum()];
		idx = 0;
		for(int i = 0; i < l; i++) {
			for(int j = 0; j < d[N].g[i]; j++) {
				ans[idx] = map.get(k[i]);
				idx++;
			}
		}
		Arrays.sort(ans, Collections.reverseOrder());
		for(int i : ans) {
			System.out.print(i);
		}
		System.out.println();

	}
	static class Data{
		int[]g;
		boolean flag = false;
		public Data(int n) {
			g = new int[n];
		}
		public int sum() {
			int ret = 0;
			for(int i : g) {
				ret += i;
			}
			return ret;
		}
	}
}

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


Question:
import java.util.Arrays;
import java.util.Collections;
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();
		int[] A = new int[M];
		for(int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();
		//int[] a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
		int[] c = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i = 0; i < M; i++) {
			if(map.containsKey(c[A[i]])) {
				if(map.get(c[A[i]]) < A[i]) {
					map.put(c[A[i]], A[i]);
				}
			}else {
				map.put(c[A[i]], A[i]);
			}
		}
		int l = map.size();
		int[]k = new int[map.size()];
		int idx = 0;
		for(int key : map.keySet()) {
			k[idx] = key;
			idx++;
		}
		if(l == 1) {
			for(int i = 0; i < N / k[0]; i++) {
				System.out.print(map.get(k[0]));
			}
			System.out.println();
			System.exit(0);
		}
		Arrays.sort(k);
		Data[] d = new Data[N + 1];
		for(int i = 0; i <= N; i++) {
			d[i] = new Data(l);
		}
		for(int i = 1; i <= N / k[0]; i++) {
			d[i * k[0]].flag = true;
			d[i * k[0]].g[0] = i;
		}
		d[0].flag = true;
		for(int i = 0; i < N; i++) {
			if(!d[i].flag) continue;
			for(int j = 0; j < l; j++) {
				int t = i + k[j];
				if(t > N) break;
				if(d[t].flag == false) {
					d[t].flag = true;
					for(int u = 0; u < l; u++) {
						d[t].g[u] = d[i].g[u];
					}
					d[t].g[j] += 1;
				}else {
					if(d[t].sum() <= d[i].sum()) {
						for(int u = 0; u < l; u++) {
							d[t].g[u] = d[i].g[u];
						}
						d[t].g[j] += 1;
					}else if(d[t].sum() == d[i].sum() + 1) {
						//System.out.println(t + " " + i);
						int f1 = 0;
						int f2 = 0;
						for(int u = 0; u < l; u++) {
							f1 += d[t].g[u] * map.get(k[u]);
							f2 += d[i].g[u] * map.get(k[u]);
						}
						f2 += map.get(k[j]);
						if(f1 < f2) {
							for(int u = 0; u < l; u++) {
								d[t].g[u] = d[i].g[u];
							}
							d[t].g[j] += 1;
							System.out.println(d[N * 2]);
						}
					}
				}
			}
		}
		Integer[] ans = new Integer[d[N].sum()];
		idx = 0;
		for(int i = 0; i < l; i++) {
			for(int j = 0; j < d[N].g[i]; j++) {
				ans[idx] = map.get(k[i]);
				idx++;
			}
		}
		Arrays.sort(ans, Collections.reverseOrder());
		for(int i : ans) {
			System.out.print(i);
		}
		System.out.println();

	}
	static class Data{
		int[]g;
		boolean flag = false;
		public Data(int n) {
			g = new int[n];
		}
		public int sum() {
			int ret = 0;
			for(int i : g) {
				ret += i;
			}
			return ret;
		}
	}
}

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


Question:
import java.util.Arrays;
import java.util.Collections;
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();
		int[] A = new int[M];
		for(int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();
		//int[] a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
		int[] c = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i = 0; i < M; i++) {
			if(map.containsKey(c[A[i]])) {
				if(map.get(c[A[i]]) < A[i]) {
					map.put(c[A[i]], A[i]);
				}
			}else {
				map.put(c[A[i]], A[i]);
			}
		}
		int l = map.size();
		int[]k = new int[map.size()];
		int idx = 0;
		for(int key : map.keySet()) {
			k[idx] = key;
			idx++;
		}
		if(l == 1) {
			for(int i = 0; i < N / k[0]; i++) {
				System.out.print(map.get(k[0]));
			}
			System.out.println();
			System.exit(0);
		}
		Arrays.sort(k);
		Data[] d = new Data[N + 1];
		for(int i = 0; i <= N; i++) {
			d[i] = new Data(l);
		}
//		for(int i = 1; i <= N / k[0]; i++) {
//			d[i * k[0]].flag = true;
//			d[i * k[0]].g[0] = i;
//		}
		d[0].flag = true;
		for(int i = 0; i < N; i++) {
			if(!d[i].flag) continue;
			for(int j = 0; j < l; j++) {
				int t = i + k[j];
				if(t > N) break;
				if(d[t].flag == false) {
					d[t].flag = true;
					for(int u = 0; u < l; u++) {
						d[t].g[u] = d[i].g[u];
					}
					d[t].g[j] += 1;
				}else {
					if(d[t].sum() <= d[i].sum()) {
						for(int u = 0; u < l; u++) {
							d[t].g[u] = d[i].g[u];
						}
						d[t].g[j] += 1;
					}else if(d[t].sum() == d[i].sum() + 1) {
						int f1 = 0;
						int f2 = 0;
						for(int u = 0; u < l; u++) {
							f1 += d[t].g[u] * map.get(k[u]);
							f2 += d[i].g[u] * map.get(k[u]);
						}
						f2 += map.get(k[j]);
						if(f1 <= f2) {
							for(int u = 0; u < l; u++) {
								d[t].g[u] = d[i].g[u];
							}
							d[t].g[j] += 1;
						}
					}
				}
			}
		}
		Integer[] ans = new Integer[d[N].sum()];
		idx = 0;
		for(int i = 0; i < l; i++) {
			for(int j = 0; j < d[N].g[i]; j++) {
				ans[idx] = map.get(k[i]);
				idx++;
			}
		}
		Arrays.sort(ans, Collections.reverseOrder());
		for(int i : ans) {
			System.out.print(i);
		}
		System.out.println();

	}
	static class Data{
		int[]g;
		boolean flag = false;
		public Data(int n) {
			g = new int[n];
		}
		public int sum() {
			int ret = 0;
			for(int i : g) {
				ret += i;
			}
			return ret;
		}
	}
}

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


Question:
import java.util.Arrays;
import java.util.Collections;
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();
		int[] A = new int[M];
		for(int i = 0; i < M; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();
		//int[] a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
		int[] c = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i = 0; i < M; i++) {
			if(map.containsKey(c[A[i]])) {
				if(map.get(c[A[i]]) < A[i]) {
					map.put(c[A[i]], A[i]);
				}
			}else {
				map.put(c[A[i]], A[i]);
			}
		}
		int l = map.size();
		int[]k = new int[map.size()];
		int idx = 0;
		for(int key : map.keySet()) {
			k[idx] = key;
			idx++;
		}
		if(l == 1) {
			for(int i = 0; i < N / k[0]; i++) {
				System.out.print(map.get(k[0]));
			}
			System.out.println();
			System.exit(0);
		}
		Arrays.sort(k);
		Data[] d = new Data[N + 1];
		for(int i = 0; i <= N; i++) {
			d[i] = new Data(l);
		}
//		for(int i = 1; i <= N / k[0]; i++) {
//			d[i * k[0]].flag = true;
//			d[i * k[0]].g[0] = i;
//		}
		d[0].flag = true;
		for(int i = 0; i < N; i++) {
			if(!d[i].flag) continue;
			for(int j = 0; j < l; j++) {
				int t = i + k[j];
				if(t > N) break;
				if(d[t].flag == false) {
					d[t].flag = true;
					for(int u = 0; u < l; u++) {
						d[t].g[u] = d[i].g[u];
					}
					d[t].g[j] += 1;
				}else {
					if(d[t].sum() < d[i].sum() + 1) {
						for(int u = 0; u < l; u++) {
							d[t].g[u] = d[i].g[u];
						}
						d[t].g[j] += 1;
					}else if(d[t].sum() == d[i].sum() + 1) {
						System.out.println(d[N*2]);
						int f1 = 0;
						int f2 = 0;
						for(int u = 0; u < l; u++) {
							f1 += d[t].g[u] * map.get(k[u]);
							f2 += d[i].g[u] * map.get(k[u]);
						}
						f2 += map.get(k[j]);
						if(f1 < f2) {
							for(int u = 0; u < l; u++) {
								d[t].g[u] = d[i].g[u];
							}
							d[t].g[j] += 1;
						}
					}
				}
			}
		}
		Integer[] ans = new Integer[d[N].sum()];
		idx = 0;
		for(int i = 0; i < l; i++) {
			for(int j = 0; j < d[N].g[i]; j++) {
				ans[idx] = map.get(k[i]);
				idx++;
			}
		}
		Arrays.sort(ans, Collections.reverseOrder());
		for(int i : ans) {
			System.out.print(i);
		}
		System.out.println();

	}
	static class Data{
		int[]g;
		boolean flag = false;
		public Data(int n) {
			g = new int[n];
		}
		public int sum() {
			int ret = 0;
			for(int i : g) {
				ret += i;
			}
			return ret;
		}
	}
}

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


Question:
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long[] d = new long[N];
		int[]t = new int[N];
		Data[] v = new Data[N];
		Set<Integer> set = new HashSet<Integer>();
		for(int i = 0; i < N; i++) {
			t[i] = sc.nextInt();
			d[i] = sc.nextLong();
			v[i] = new Data(t[i], d[i]);
			set.add(t[i]);
		}
		sc.close();
		Arrays.sort(v, new MyCompData());
//		for(int i = 0; i < N; i++) {
//			System.out.println(v[i].c);
//		}
		if(set.size() == N) {
			long ans = 0;
			for(int i = 0; i < K; i++) {
				ans += v[i].c;
			}
			long x = K;
			ans += x * x;
			System.out.println(ans);
			System.exit(0);
		}
		int l1 = set.size();
		int l2 = N - set.size();
		Long[]d1 = new Long[l1];
		Long[]d2 = new Long[l2];
		set.clear();
		int idx1 = 0;
		int idx2 = 0;
		for(int i = 0; i < N; i++) {
			if(!set.contains(v[i].id)) {
				set.add(v[i].id);
				d1[idx1++] = v[i].c;
			}else {
				d2[idx2++] = v[i].c;
			}
		}
		long[] s1 = new long[l1 + 1];
		long[] s2 = new long[l2 + 1];
		s1[0] = 0;
		s2[0] = 0;
		Arrays.sort(d1, Collections.reverseOrder());
		Arrays.sort(d2, Collections.reverseOrder());
		for(int i = 1; i <= l1; i++) {
			s1[i] += s1[i - 1] + d1[i - 1];
		}
		for(int i = 1; i <= l2; i++) {
			s2[i] += s2[i - 1] + d2[i - 1];
		}
		long ans = 0;
		int max = Math.min(K, l1);
		for(int i = max; i >= 1; i--) {
			if(K - i > l2) break;
			long x = i;
			long sum = s1[i] + s2[K - i] + x * x;
			ans = Math.max(ans, sum);
		}
		System.out.println(ans);
	}
	static void disp(Long[] d1) {
		for(long i : d1) {
			System.out.print(i +" ");
		}
		System.out.println();
	}
	static void disp(long[] d1) {
		for(long i : d1) {
			System.out.print(i +" ");
		}
		System.out.println();
	}
	static class Data{
		int id;
		long c;
		public Data(int id, long c) {
			this.id = id;
			this.c = c;
		}
	}
	static class MyCompData implements Comparator<Data>{
		@Override
		public int compare(Data d1, Data d2) {
			if(d1.c < d2.c) {
				return 1;
			}else if(d1.c == d2.c) {
				return 0;
			}else {
				return -1;
			}
		}
	}
}

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


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

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

		int N = scan.nextInt();
		int X = scan.nextInt();
		int[]x = new int[N];
		for(int i = 0; i < N; i++) {
			x[i] = scan.nextInt();
		}
		scan.close();
		if(N == 1) {
			int ans = Math.abs(X - x[0]);
			System.out.println(ans);
			System.exit(0);
		}else if(N == 2) {
			int l = Math.abs(x[0] - x[1]);
			int l1 = Math.abs(x[0] - X);
			int l2 = Math.abs(x[1] - X);
			if(l1 % l != 0 && l2 % l != 0) {
				System.out.println(1);
			}else {
				System.out.println(l);
			}
		}
		Arrays.sort(x);
		int[] k = new int[N - 1];
		for(int i = 0; i < N - 1; i++) {
			k[i] = x[i + 1] - x[i];
		}
		int g = gcd(k[0], k[1]);
		for(int i = 2; i < N - 1; i++) {
			g = gcd(g, k[i]);
		}

		int m = g;
		int []r = new int[N];
		for(int i = 0; i < N; i++) {
			r[i] = Math.abs(X - x[i]);
		}

		for(int i = 0; i < N; i++) {
			if(r[i] % m != 0) {
				System.out.println(1);
				System.exit(0);
			}
		}
		System.out.println(m);

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

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


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

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

		int N = scan.nextInt();
		int X = scan.nextInt();
		int[]x = new int[N];
		for(int i = 0; i < N; i++) {
			x[i] = scan.nextInt();
		}
		scan.close();
		if(N == 1) {
			int ans = Math.abs(X - x[0]);
			System.out.println(ans);
			System.exit(0);
		}
		Arrays.sort(x);
		int[] k = new int[N - 1];
		for(int i = 0; i < N - 1; i++) {
			k[i] = x[i + 1] - x[i];
		}
		int g = gcd(k[0], k[1]);
		for(int i = 2; i < N - 1; i++) {
			g = gcd(g, k[i]);
		}

		int m = g;
		int []r = new int[N];
		for(int i = 0; i < N; i++) {
			r[i] = Math.abs(X - x[i]);
		}

		for(int i = 0; i < N; i++) {
			if(r[i] % m != 0) {
				System.out.println(1);
				System.exit(0);
			}
		}
		System.out.println(m);

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

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


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

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int X = scan.nextInt();
		int[]x = new int[N];
		for(int i = 0; i < N; i++) {
			x[i] = scan.nextInt();
		}
		scan.close();
		if(N == 1) {
			int ans = Math.abs(X - x[0]);
			System.out.println(ans);
			System.exit(0);
		}
		Arrays.sort(x);
		int[] k = new int[N - 1];
		for(int i = 0; i < N - 1; i++) {
			k[i] = x[i + 1] - x[i];
		}
		Arrays.sort(k);
		int t = k[0];
		List<Integer> list = new ArrayList<Integer>();
		for(int i = 2; i <= t / 2; i++) {
			if(t % i == 0) {
				list.add(i);
			}
		}
		list.add(t);
		int l = list.size();
		int m = 1;
		//System.out.println(t);
		for(int i = l - 1; i >= 0; i --) {
			boolean flag = true;
			int g = list.get(i);
			for(int j = 0; j < N - 1; j++) {
				if(k[j] % g != 0) {
					flag = false;
					break;
				}
			}
			if(flag) {
				m = g;
				break;
			}
		}

		int []r = new int[N];
		for(int i = 0; i < N; i++) {
			r[i] = Math.abs(X - x[i]);
		}
		Arrays.sort(r);
		for(int i = 0; i < N; i++) {
			if(r[i] % m != 0) {
				System.out.println(1);
				System.exit(0);
			}
		}
		System.out.println(m);

	}
}

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


Question:
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();
		int Q = scan.nextInt();
		int [][]A = new int[N + 1][N + 1];
		for(int i = 0; i < M; i++) {
			int L = scan.nextInt();
			int R = scan.nextInt();
			A[L][R] ++;
		}

		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < Q; i++) {
			int p = scan.nextInt();
			int q = scan.nextInt();
			int cnt = 0;
			for(int j = p; j <= q; j++) {
				for(int l = p; l <= q; l++) {
					cnt += A[j][l];
				}
			}
			sb.append(cnt).append("\n");
		}
		scan.close();
		System.out.println(sb.toString());

//		for(int i = 1; i <= N; i++) {
//			for(int j = 1; j <= N; j++) {
//				System.out.print(A[i][j] + " ");
//			}
//			System.out.println();
//		}

	}
}

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


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();
		long M = sc.nextLong();
		long[] A = new long[N];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
		}
		sc.close();
		long[] b = new long[N + 1];
		b[0] = 0;
		for(int i = 0; i < N; i++) {
			b[i + 1] += b[i] + A[i];
			b[i + 1] %= M;
		}
		Map<Long, Long> map = new HashMap<Long, Long>();
		for(int i = 0; i <= N; i++) {
			map.merge(b[i], 1l, (v1, v2) -> v1 + v2);
		}
		long ans = 0;
		for(long k : map.keySet()) {
			long t = map.get(k);
			ans += t * (t - 1) / 2;
		}
		System.out.println(ans);
	}
}

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


Question:
import java.util.Scanner;

public class MAin {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		S = S.replaceAll(",", " ");
		System.out.println(S);
	}
}

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


Question:
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String str1=sc.next();
		String str2=sc.next();
		int ans=0;
		for(int i=0;i<str.length();i++){
		    if(str1.chatAt(i)!=str1.chatAt(i))
		    ans++;
		}
		System.out.println(ans);
	}
}

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


Question:
import java.util.*;

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

        for (int j = 1; j <= n; j++) {

            for (int i = 1; i <= Math.sqrt(j); i++) {
                if (j % i == 0) {

                    if (j / i == i){
                        count++;
                    }

                    else {
                        count++;
                        count++;
                    }
                }

            }
            sum+=count*j;
            count=0;
        }
        System.out.println(sum);
    }
}

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


Question:
import java.util.*;

public class NoB {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //切り出しする文字列
        String S = sc.next();
        String T = sc.next();
        if(T.startsWith(S) && T.length() == S.length() + 1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

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


Question:
import java.util.*;

public class NoA {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        if(S >= W) {
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }
}

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


Question:
import java.util.Scanner;

public class NoA {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        if(W >= S) {
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }
}

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


Question:
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        if(W >= S) {
            System.out.println('unsafe');
        }else{
            System.out.println('safe');
        }
    }

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


Question:
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        if(W >= S) {
            System.out.println("unsafe");
        }else if(W < S){
            System.out.println("safe");
        }
    }

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


Question:
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        if(W >= S) {
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }

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


Question:
package contest164;

import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        if(W >= S) {
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }
}

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


Question:
public void main(){
  double R = 3;
  double e = 3.1415;
  double Answer = 2*e*R;
  System.out.plintln(Answer);
}

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


Question:
public main(){
  double R = 3;
  double e = 3.1415;
  double Answer = 2*e*R;
  System.out.plintln(Answer);
}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        for(int i=0; i<M; i++){
          int Ai = sc.next();
          N = N - Ai;
        }
        if(N < 0){
          System.out.println("-1");
        }else{
          System.out.println(N);
        }
    }
}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        for(int i=0; i<M; i++){
          int Ai = sc.next();
          N = N - Ai;
        }
        if(N < 0){
          System.out.println('-1');
        }else{
          System.out.println(N);
        }
    }
}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        for(int i=0; i<M; i++){
          int Ai = sc.next();
          N = N - Ai;
        }
        if(N < 0){
          System.out.println(-1);
        }else{
          System.out.println(N);
        }
    }
}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        for(int i=0; i<M; i++){
          int Ai = sc.nextInt();
          N = N - Ai;
        }
        if(N < 0){
          System.out.plintln("-1");
        }else{
          System.out.plintln(N);
        }
    }
}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        for(int i=0; i<M; i++){
          int Ai = sc.next();
          N = N - Ai;
        }
        if(N < 0){
          System.out.plintln(-1);
        }else{
          System.out.plintln(N);
        }
    }
}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int Ai = sc.nextLine();
        int Answer;
        for(int i=0; i<M; i++){
            N = N - Ai[i];
        }
        if(N < 0){
          System.out.plintln(-1);
        }else{
          System.out.plintln(N);
        }
    }
}

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


Question:
    public int main(int N,int M){
        N=42;
        M=2;
        int[] Ai = {5, 6};
        int Answer;
        for(int i=0; i<M; i++){
            N = N - Ai[i];
        }
        if(N < 0){
            N = -1;
        }
        return N;
    }

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


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

    public void main(){
        ArrayList<Integer> list = new ArrayList<Integer>();
        int N=42;
        int M=2;
        int[] Ai = {5, 6};
        int Answer;
        for(int i=0; i<M; i++){
            Answer = N - Ai[i];
        }
        if(Answer < 0){
            System.out.println(-1);
        }else{
            System.out.println(Answer);
        }
    }

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


Question:
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int K=scan.nextInt();
		int A=scan.nextInt();
		int B=scan.nextInt();
		int num=0;
	for(int i=0;i<=B;i=+K) {
		if(i>=A&&i<=B) {
			num=1;
		}
	}
	if(num==0) {
		System.out.println("NG");
	}
	else {
		System.out.println("OK");
	}
	}
}

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


Question:
import java.util.Scanner;
public class Main {
	static int N;
	static int K;
	public static long calc(int n) {
		long max=0;
		long min=0;
		for(int i=0;i<n;i++) {
			min+=i;
			max+=(N-i);
		}
		return max-min+1;
	}
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		K=sc.nextInt();
		long ans=0;
		for(int i=K;i<=N+1;i++) {
			ans+=calc(i);
			ans%=1000000007;
		}
		System.out.println(ans);
	}
}

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


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

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

    static class BGreatOceanView {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            int max = Integer.MIN_VALUE;
            for (int i = 0; i < a.length; i++) {
                a[i] = in.nextInt();
                max = Math.max(max, a[i]);
            }
            int count = 0;
            if (a[0] == max) {
                for (int i = 0; i < a.length; i++) {
                    if (a[i] == max) {
                        count++;
                    }
                }
                out.println(count);
            } else {
                for (int i = 1; i < a.length; i++) {
                    if (a[i] > a[0]) {
                        ++count;
                    } else if (a[i] == a[0] && count == 0) {
                        ++count;
                    }
                }
                out.println(count + 1);
            }
        }

    }

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

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

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

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

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

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

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

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

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

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

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

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

    }
}

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


Question:
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double W = Integer.parseInt(scan.next());
        double H = Integer.parseInt(scan.next());
        double x = Integer.parseInt(scan.next());
        double y = Integer.parseInt(scan.next());
        if (W/2 == x && H/2  == y){
            System.out.println(W*H/2 + " " + 1);
        }
        else{
            System.out.println((W*H/2 + " " + 0);
        }
    }
}

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


Question:
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int W = Integer.parseInt(scan.next());
        int H = Integer.parseInt(scan.next());
        int x = Integer.parseInt(scan.next());
        int y = Integer.parseInt(scan.next());
        if (W > H) {
            if (Math.min(x,W-x)*H<Math.min(y,H-y)*W && y != H / 2 ) {
                System.out.println(Math.min(y,H-y)*W + " " + 0);
            } else if(Math.min(x,W-x)*H>Math.min(y,H-y)*W && x != W / 2 ) {
                System.out.println(Math.min(x,W-x)*H + " " + 0);
            } else if(Math.min(x,W-x)*H>Math.min(y,H-y)*W && x == W / 2 ) {
                System.out.println(Math.min(x,W-x)*H + " " + 1);
            } else if (Math.min(x,W-x)*H<Math.min(y,H-y)*W && y == H / 2 ) {
                System.out.println(Math.min(y,H-y)*W + " " + 1);
            }
    }
}

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


Question:
import java.util.Scanner;

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

      String s = sc.next();
      String t = sc.next();

      if(s.equals(t)){
        System.out.print("0");
        return;
      }

      int result = 0;
      for(int i=0; i < s.length(); i++){
      	if(!s.substring(i,i+1),equals(t.substring(i, i+1))){
          result++;
        }
      }

      System.out.print(result);
    }
}

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


Question:
import java.util.Scanner;

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

      String s = sc.next();
      String t = sc.next();

      int result = 0;
      for(int i=0; i < s.length(); i++){
      	if(s.substring(i,1) != t.substring(i, 1)){
          result++;
        }
      }

      System.out.print(result);
    }
}

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


Question:
import java.util.Scanner;

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

      String s = sc.next();
      String t = sc.next();

      int result = 0;
      for(int i=0; i < s.length(); i++){
      	if(s.subString(i,1) != t.subString(i, 1)){
          result++;
        }
      }

      System.out.print(result);
    }
}

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


Question:
import java.util.Scanner;

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

      String s = sc.next();
      String t = sc.next();

      int result = 0;
      for(int i=0; i < s.length(); i++){
      	if(s.toString(i,1) != t.toString(i, 1)){
          result++;
        }
      }

      System.out.print(result);
    }
}

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


Question:
import java.util.Scanner;

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

      String s = sc.next();
      String t = sc.next();

      int result = 0;
      for(int i=0; i < s.length(); i++){
      	if(s[i] != t[i]){
          result++;
        }
      }

      System.out.print(result);
    }
}

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


Question:
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
      	int index = new Integer(scan.nextLine());
        String[] scanLine = scan.nextLine().split(" ");
      	int[] ranges = new Integer()[count];
        int range = 0;
        for(int i=0;i<count;i++){
            range += (index - new Integer(scanLine[i]))*(index - new Integer(scanLine[i]));
        }

        System.out.println(range);
    }
}

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


Question:
import java.util.*;

public class Main {
	public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String[] str = scan.nextLine().split();
		String value = Integer.toString(str[0],str[1]);
		System.out.println(value.length()); //output = 1e
    }
}

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


Question:
import java.util.*;
import java.io.*;
public class Main extends PrintWriter {
    Main()
    {
        super(System.out);
    }
    public static void main(String args[]) {
      Main o=new Main();
      o.main();
      o.flush();
      o.close();
    }
    void main()
    {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        int c=0;
        for(i=0;i<3;i++)
        {
            ch=str.charAt(i);
            if(str.charAt(0)=='R' && str.charAt(1)=='R' && str.charAt(2)=='R')
            println(3);
            else if((str.charAt(0)=='R' && str.charAt(1)=='R') || (str.charAt(1)=='R' && str.charAt(2)=='R'))
            println(2);
            else if(str.indexOf('R')>=0)
            println(1);
            else
            println(0);
        }
        sc.close();
    }
}

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


Question:
package ABC162;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	 	Scanner scanner = new Scanner(System.in);
	 	int N = scanner.nextInt();
	 	int a = 0;
	 	int b = 0;
	 	int c = 0;
	 	int d = 0;

	 	a = N / 100;
	 	d = N % 100;
	 	b = d / 10;
	 	c = d % 10;
//	 	System.out.println(a);
//	 	System.out.println(b);
//	 	System.out.println(c);

	 	if (a == 7 || b == 7 || c == 7) {
	 		System.out.println("Yes");
	 	} else {
	 		System.out.println("No");
	 	}
 	}
}

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


Question:
import java.util.*;
import java.io.PrintWriter;
class B{

	static PrintWriter out;
	static Scanner sc;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		sc=new Scanner(System.in);
		out=new PrintWriter(System.out);

		int n=sc.nextInt();
		long x=sc.nextLong();
		int ans=0;
		for(int i=0;i<n;i++) {
			long a=sc.nextLong();
			long b=sc.nextLong();
			if(a*a+b*b<=x*x)
				ans++;
		}
		out.println(ans);

		sc.close();
		out.close();

	}
}

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


Question:
import org.omg.CORBA.INTERNAL;

import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;

public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

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

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

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

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

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

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

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

        public String next() {
            return readString();
        }

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

    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(), "Main", 1 << 26).start();
    }

    long modPow(long a, long p, long m) {
        if (a == 1) return 1;
        long ans = 1;
        while (p > 0) {
            if (p % 2 == 1) ans = (ans * a) % m;
            a = (a * a) % m;
            p >>= 1;
        }
        return ans;
    }

    long modInv(long a, long m) {
        return modPow(a, m - 2, m);
    }

    PrintWriter out;
    InputReader sc;

    public void run() {
        sc = new InputReader(System.in);
        // Scanner sc=new Scanner(System.in);
        //  Random sc=new Random();
        out = new PrintWriter(System.out);

        int k=sc.nextInt();
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=0;
        for (int i = a; i <=b ; i++) {
            if(i%k==0)c++;
        }
        if(c>0)out.println("OK");
        else out.println("NG");

        out.close();
    }

}

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


Question:
import java.util.*;
class Solution{
 	public static void main(String  args[]){
     	Scanner sc=new Scanner(System.in);
     	char a=sc.next().charAt(0);
      	if(a=='A')System.out.println('T');
      	if(a=='T')System.out.println('A');
      	if(a=='G')System.out.println('C');
      	if(a=='C')System.out.println('G');
    }
}

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


Question:
import java.util.*;
public class Solution{
 	public static void main(String  args[]){
     	Scanner sc=new Scanner(System.in);
     	char a=sc.next().charAt(0);
      	if(a=='A')System.out.println('T');
      	if(a=='T')System.out.println('A');
      	if(a=='G')System.out.println('C');
      	if(a=='C')System.out.println('G');
    }
}

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


Question:
class Solution{
 	public static void main(String  args[]){
     	Scanner sc=new Scanner(System.in);
     	char a=sc.next().charAt(0);
      	if(a=='A')System.out.println('T');
      	if(a=='T')System.out.println('A');
      	if(a=='G')System.out.println('C');
      	if(a=='C')System.out.println('G');
    }
}

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


Question:
import javafx.util.Pair;

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

public class Main {
    private static final long INF = Long.MAX_VALUE;
    private static final int MOD = 1000000007;

    private long pow(long a, long n) {
        long ret = 1;
        long base = a;
        while (n > 0) {
            if ((n & 1) > 0) {
                ret = (ret * base) % MOD;
            }
            base = (base * base) % MOD;
            n >>= 1;
        }
        return ret;
    }

    private void add(Map<Pair<Long, Long>, int[]> cnt, Pair<Long, Long> key, int i) {
        int[] v = cnt.computeIfAbsent(key, k -> new int[]{0, 0});
        ++v[i];
    }

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

    private void solve() {
        int n = sc.nextInt();
        Map<Pair<Long, Long>, int[]> cnt = new HashMap<>();
        for (int i = 0; i < n; i++) {
            long a = sc.nextLong();
            long b = sc.nextLong();
            if (a == 0 && b == 0) {
                continue;
            }

            if (a == 0L) {
                add(cnt, new Pair<>(0L, 0L), 0);
            } else if (b == 0L) {
                add(cnt, new Pair<>(0L, 0L), 1);
            } else {
                if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
                    a = Math.abs(a);
                    b = Math.abs(b);
                    long g = gcd(a, b);
                    add(cnt,new Pair<>(a / g, b / g), 0);
                } else {
                    a = Math.abs(a);
                    b = Math.abs(b);
                    long g = gcd(a, b);
                    add(cnt, new Pair<>(b / g, a / g), 1);
                }
            }
        }

        long ans = 1;
        for (int[] v : cnt.values()) {
            ans = (ans * ((pow(2, v[0]) + pow(2, v[1]) - 1 + MOD) % MOD)) % MOD;
        }

        ans = (ans - 1 + MOD) % MOD;
        out.println(ans);
    }

    private static PrintWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().solve();
        out.close();
    }
}

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


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

public class Main {
    private void solve() {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int m = n % 2 == 0 ? 2 : 3;
        long[][] dp = new long[n][m];
        for (int i = 0; i < n; i++) {
            Arrays.fill(dp[i], Long.MIN_VALUE);
        }
        dp[0][0] = a[0];
        dp[1][1] = a[1];
        dp[2][0] = a[0] + a[2];
        if (m == 3) {
            dp[2][2] = a[2];
        }

        for (int i = 3; i < n; i++) {
            for (int j = 0; j < m; j++) {
                for (int k = 0; k < m; k++) {
                    int pi = i - 2 - k;
                    int pj = j - k;
                    if (pi >= 0 && pj >= 0) {
                        dp[i][j] = Math.max(dp[pi][pj], dp[i][j]);
                    }
                }
                if (dp[i][j] != Long.MIN_VALUE) {
                    dp[i][j] += a[i];
                }
            }
        }

        long ans = Long.MIN_VALUE;
        for (int j = 0; j < m; j++) {
            int li = n - 1 - j;
            int lj = m - 1 - j;
            if (li >= 0) {
                ans = Math.max(ans, dp[li][lj]);
            }
        }

        out.println(ans);
    }

    private static PrintWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().solve();
        out.close();
    }
}

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


Question:
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long X = Math.abs(sc.nextLong());
		long K = sc.nextLong();
		long D = sc.nextLong();

		long minX;
		long maxX;
		long minK = X / D;

		if(X % D > Math.abs((X % D) - D)) {
			minX = Math.abs((X % D) - D);
			maxX = X % D;
			minK++;
		}

		if(minK >= K) {
			System.out.println(Math.abs(X- (D * K)));
			return;
		}

		if((K-minK)%2 == 0) {
			System.out.println(minX);
		}else {
			System.out.println(maxX);
		}

	}

}

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


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

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int dognum = sc.nextInt();
		BigInteger dogs = new BigInteger(String.valueOf(dognum));
		BigInteger[] results;
		StringBuilder result = new StringBuilder("");

		results = dogs.divideAndRemainder(new BigInteger("1"));
		while(results[0].compareTo(new BigInteger("0")) != 0) {
			dogs = dogs.subtract(new BigInteger("1"));
			results = dogs.divideAndRemainder(new BigInteger("26"));
			dogs = results[0];
			result.insert(0,(char)('a' + (char)results[1].intValue()));
		}

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

	}

}

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


Question:
import java.util.*;
public class Main {
  	public static int muld(int n){
      int cnt = 0;
      for(int i = 1;i <= n/i;i++){
        if(n % i == 0){
          if(i == n/i) cnt++;
          else cnt += 2;
        }
      }

      return cnt;
    }

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

		int n = sc.nextInt();
      	int cnt = 1;

      	for(int i = 1;i < n-1;i++){
          cnt += muld(n - i);
        }

		System.out.println(cnt);
	}
}

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


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

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

      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      	int d = sc.nextInt();
      	boolean twin = false;
      	boolean awin = false;
      	String str = " ";

      	for(int i = 0;!twin && !awin;i++) {
			if(i % 2 == 0){
              c -= b;
              if(c <= 0) {
                twin = true;
              	str = "Yes";
              }
            } else {
              a -= d;
              if(a <= 0) {
                awin = true;
                str = "No";
              }
            }
        }

      	System.out.println(str);

	}
}

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


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

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

      	int n = sc.nextInt();
      	int count = 0;
      	int max = 1;
      	int istack;
      	Integer igstack;
      	String sstack;
        List wList = new ArrayList<String>();
      	List pList = new ArrayList<Integer>();
      	List aList = new ArrayList<String>();
      	Map<String,Integer> wMap = new HashMap<String,Integer>();

      	for(int i = 0;i < n;i++){
          sstack = sc.next();
          if(!wList.contains(sstack)) {
            wList.add(sstack);
            pList.add(1);
            wMap.put(sstack,count);
            count++;
          } else {
            igstack = (Integer)pList.get((Integer)wMap.get(sstack).intValue());
          	istack = igstack.intValue() + 1;
            pList.set((Integer)wMap.get(sstack).intValue(),istack);
            if(istack > max) max = istack;
          }
        }
      	for(int i = 0;i < count;i++){
          	igstack = (Integer)pList.get(i);
        	if(igstack.intValue() == max) aList.add((String)wList.get(i));
        }
      	Collections.sort(aList);
      	for(int i = 0;i < aList.size();i++){
          	System.out.println(aList.get(i));
        }

	}
}

Choices:
- Time Limit Exceeded
- Internal error
- 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 n = sc.nextInt();

      	int ns[] = new int[n];
      	int nc = 0;
      	boolean edge;
      	boolean edge2 = true;

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

      	for(int i = 0; i < n && edge2;i++){
          edge = true;
          if(ns[i] == 1){
            nc += (n - i - 1);
            edge2 = false;
          } else {
            for(int j = 0; j < i && edge; j++){
            	if(ns[i] > ns[j]) {
              		nc++;
              		edge = false;
            	}
          	}
          }
        }

      	System.out.println(n - nc);

	}
}

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


Question:
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long goal = sc.nextLong();
      	long i = 1;
      	long num1 = 1;
      	long num2 = goal;

      	while(i < num2){
          if(goal % i == 0) {
            num1 = i;
            num2 = goal/i;
          }
          i++;
        }

      	System.out.println(num1 + num2 - 2);

	}
}

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


Question:
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int goal = sc.nextInt();
      	int i = 1;
      	int num1 = 1;
      	int num2 = goal;
      	int stack_num2;

      	while(i < num2){
          if(goal % i == 0) {
            num1 = i;
            num2 = goal/num1;
          }
          i++;
        }

      	System.out.println(num1 + num2 - 2);

	}
}

Choices:
- Time Limit Exceeded
- Internal error
- 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 length = sc.nextInt();
      	int a[] = new int[length];
  		int b[] = new int[length - 1];
      	int a_sum = 0;

     	for(int i = 0; i < b.length; i++) b[i] = sc.nextInt();

      	a[0] = b[0];
      	a[1] = b[0];

      	for(int i = 2;i < length; i++){
        	if(a[i - 1] > b[i - 1]) a[i] = a[i -1];
            else a[i] = b[i - 1];
        }

      	for(int num: a) a_sum += num;

        System.out.println(a_sum);

	}
}

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 sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int point;
    boolean con1 = true;
    boolean con2 = true;

    for(int i = 0; i < s.length() && con1;i++) {
      con2 = true;
      for(int j = i; j < (s.length()+i) && con2;j++) {
      	if(j > s.length()) point = j - s.length();
        else point = j;

        if(s.charAt(j - i) != t.charAt(point)) con2 = false;
      }
      if(con2) con1 = false;
    }

    if(!con1) System.out.println("Yes");
    else System.out.println("No");
  }
}

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


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

	public class Main {

		static long mod = 1000000007;
		static long pattern[] = new long[1000001];

		public static void main(String[] args) {
			// AtCoder_C
			Scanner sc = new Scanner(System.in);
			int N = sc.nextInt();
    	    // Scannerクラスのインスタンスをクローズ
    		sc.close();

    		Arrays.fill(pattern, -1);

    		long ans=0;

    		for(int C=1; C<N; C++) {
    			int AB = N-C;
    			int cnt = 0;
    			for(int A=1; A<=Math.sqrt(AB); A++) {
    				if(pattern[AB] != -1) {
    					ans += pattern[AB];
    				} else if(AB%A==0) {
    					if(AB/A == A) {
        					ans++;
        					cnt++;
    					} else {
        					ans += 2;
        					cnt += 2;
    					}
    				}
    			}
				if(pattern[AB] != -1) {
					pattern[AB] = cnt;
				}
    		}
    		System.out.println(ans);
    	}
    }

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


Question:
import java.util.Scanner;

	public class Main {

		static long mod = 1000000007;

		public static void main(String[] args) {
			// AtCoder_C
			Scanner sc = new Scanner(System.in);
			int N = sc.nextInt();
    	    // Scannerクラスのインスタンスをクローズ
    		sc.close();

    		long ans=0;

    		for(int C=1; C<N; C++) {
    			int AB = N-C;
    			for(int A=1; A<=Math.sqrt(AB); A++) {
    				if(AB%A==0) {
    					ans++;
    					if(AB/A != A) {
        					ans++;
    					}
    				}
    			}
    		}
    		System.out.println(ans);
    	}
    }

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


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

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


Question:
import java.util.*;

public class A {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = Integer.parseInt(sc.next());
        int ans = (n % 2 == 0) ? n / 2 : n / 2 + 1;
        System.out.println(ans);
    }
}

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


Question:
import java.util.*;

public class A {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)) {
            --a;
        } else {
            --b;
        }
        System.out.printf("%d %d", a, b);
    }
}

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


Question:
import java.util.*;

public class B {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long h = sc.nextLong();
        int n = sc.nextInt();
        long s = 0;
        for(int i = 0; i < n; ++i) {
            s += sc.nextLong();
        }
        String ans = (s >= h) ? "Yes" : "No";
        System.out.println(ans);
    }
}

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


Question:
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long za = xor(a - 1L);
        long zb = xor(b);
        long ans = za ^ zb;
        System.out.println(ans);
    }

    static long xor(long x) {
        if(x % 2L == 1L) {
            long q1 = (x + 1L) / 2L;
            return (q1 % 2L == 1L) ? 1L : 0L;
        }

        if(x == 0L) return 0L;

        return xor(x - 1L) ^ x;
    }
}

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){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		long x = sc.nextLong();
      	long k = sc.nextLong();
      	long d = sc.nextLong();
      	long nokorikaisuu = 0;
      	long kekka = x;

        for(int i = 0 ; i <k ; i++){
        	if((kekka-d)*(kekka-d) <= (kekka+d)*(kekka+d)){
            	kekka = kekka - d;
            }else{
            	kekka = kekka + d;
            }

          if(x>=0){
          	//プラス
			if(kekka<=0){
            	nokorikaisuu = k - (i+1);
            	if(nokorikaisuu % 2 != 0){
                	kekka = kekka + d;
                }
              break;
            }
          }else{
            //マイナス
          	if(kekka>=0){
            	nokorikaisuu = k - (i+1);
            	if(nokorikaisuu % 2 != 0){
                	kekka = kekka - d;
                }
              break;
            }
          }

        }

			System.out.println(Math.abs(kekka));

	}
}

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


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

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


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

public class ABC177 {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

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

        int ans = t.length;
        for (int i = 0; i <= s.length - t.length; i++) {
            int tmp = 0;
            for (int j = 0; j < t.length; j++) {
                if (s[i+j] != t[j])
                    tmp++;
            }
            ans = Math.min(tmp, ans);

            if (ans == 0)
                break;
        }

        System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

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

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

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

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


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

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        char[] s = sc.next().toCharArray();
        long k = sc.nextLong();
        char[] tmp = {'a', 'c', 'e', 'g'};

        int cnt = 0;
        for (int i = 1; i < s.length; i++) {
            if (s[i-1] == s[i]) {
                cnt++;
                for (char c : tmp) {
                    int nextIndex = i+1;
                    if (i+1 > s.length-1)
                        nextIndex = i;
                    if (s[i-1] != c && s[nextIndex] != c)
                        s[i] = c;
                }
            }
        }

        if (s[0] == s[s.length-1]) {
            if (s[s.length-2] != s[s.length-1])
                cnt++;
        }

        System.out.println(cnt * k);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

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

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

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

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


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

public class ABC139 {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();

        System.out.println(n * (n-1) / 2);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

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

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

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

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


Question:
import java.util.Scanner;

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

        char[] c = sc.next().toCharArray();
        int[] cnt = new int[c.length];

        for (int i = 0; i < c.length; i++) {
            int index = i;
            int tmp = 0;
            while (c[i] == c[index]) {
                if (c[index] == 'R')
                    index++;
                else
                    index--;
                tmp++;
            }

            if (tmp % 2 != 0) {
                if (c[index] == 'R')
                    index++;
                else
                    index--;
            }
            cnt[index]++;
        }

        for (int i = 0; i < c.length; i++) {
            System.out.print(cnt[i] + " ");
        }
    }
}

Choices:
- Runtime Error
- Internal error
- 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);

        String s = sc.next();
        boolean ans = true;
        int[] num = new int[10];

        for (int i = 0; i < s.length(); i++) {
            int n = (int)s.charAt(i);
            if (++num[n] > 1) {
                ans = false;
                break;
            }
        }

        System.out.println(ans ? "Good" : "Bad");
    }
}

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


Question:
import java.util.Scanner;

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

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

        long ans = b - a + 1;
        long tmp = c;
        while (tmp <= b) {
            if (tmp > b)
                break;
            if (tmp >= a)
                ans--;
            tmp += c;
        }

        tmp = d;
        while (tmp <= b) {
            if (tmp > b)
                break;
            if (tmp % c == 0) {
                tmp += d;
                continue;
            }
            if (tmp >= a)
                ans--;
            tmp += d;
        }

        System.out.println(ans);
    }

    static long counter(long n, long a, long b) {
        long count = 0;
        long tmp = n;
        while (tmp <= b) {
            if (tmp > b)
                break;
            if (tmp >= a)
                count++;
            tmp += n;
        }
        return count;
    }
}

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


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

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

        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];

        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();

            boolean isAdd = false;
            for (int j = 0; j < i; j++) {
                if (a[list.get(j)] > a[i]) {
                    list.add(j, i);
                    isAdd = true;
                }
            }
            if (!(isAdd))
                list.add(i);
        }

        long totalPrice = 0;
        int totalCnt = 0;
        for (int i = 0; i < n; i++) {
            int index = list.get(i);
            long price = a[index];
            int count = b[index];

            if (count >= m - totalCnt) {
                totalPrice += (m - totalCnt) * price;
                break;
            } else {
                totalPrice += count * price;
                totalCnt += count;
            }
        }

        System.out.println(totalPrice);
    }
}

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


Question:
import java.util.Scanner;

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

        String s = sc.nextLine();
        String t = sc.nextLine();

        boolean flag = false;
        for (int i = 0; i < s.length(); i++) {
            if (flag)
                break;
            char cs = s.charAt(i);
            char ct = t.charAt(0);

            if (cs != ct)
                continue;
            else
                flag = true;

            int cnt = i + 1;
            for (int j = 1; j < t.length(); j++) {
                cs = s.charAt(cnt++);
                ct = t.charAt(j);
                if (cs != ct) {
                    flag = false;
                    break;
                }
                if (cnt >= s.length())
                    cnt = 0;
                flag = true;
            }
        }

        System.out.println(flag ? "Yes" : "No");
    }
}

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