Question:
from collections import deque
def main():
    n, k = map(int, raw_input().split())
    s = raw_input().strip()
    ans = deque(list(s))
    if n == 1:
        if k % 2:
            print 'A' if s[0] == 'B' else 'B'
        else:
            print s[0]
        return
    f = True
    for i in xrange(400020):
        if i >= k:
            if f:
                print ''.join(list(ans))
            else:
                print ''.join('A' if x == 'B' else 'B' for x in ans)
            break
        if (ans[0] == 'A') == f:
            ans[0] = 'B' if f else 'A'
        else:
            f = not f
            ans.popleft()
            ans.append('A' if f else 'B')
    else:
        k -= 400020
        k %= 2
        if not f:
            ans = ['B' if x == 'A' else 'A' for x in ans]
            ans = deque(ans)
        if n % 2 and k:
            if ans[0] == 'A':
                ans[0] = 'B'
            else:
                ans[0] = 'A'
        print ''.join(ans)
main()

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


Question:
from collections import deque
def main():
    n, k = map(int, raw_input().split())
    s = raw_input().strip()
    ans = deque(list(s))
    if n == 1:
        if k % 2:
            print 'A' if s[0] == 'B' else 'B'
        else:
            print s[0]
        return
    f = True
    for i in xrange(400020):
        if i >= k:
            if f:
                print ''.join(list(ans))
            else:
                print ''.join('A' if x == 'B' else 'B' for x in ans)
            break
        if (ans[0] == 'A') == f:
            ans[0] = 'B' if f else 'A'
        else:
            f = not f
            ans.popleft()
            ans.append('A' if f else 'B')
    else:
        k -= 400020
        k %= 2
        if not f:
            ans = ['B' if x == 'A' else 'A' for x in ans]
            ans = deque(ans)
        if n % 2 and k:
            if ans[0] == 'A':
                ans[0] = 'B'
            else:
                ans[0] = 'A'
        print ''.join(ans)
main()

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


Question:
import sys
from itertools import accumulate
from collections import deque

def solve():
    N, K = map(int, input().split())
    S = input()

    '''
    if N == 1:
        if K % 2 == 0:
            print(S)
        else:
            print('A' if S == 'B' else 'B')

        return
    '''

    q = deque([1 if c == 'A' else 0 for c in S])
    cb = 0

    for i in range(min(K, 2 * N + K % 2)):
        if q[0] == (cb ^ 1):
            q[0] ^= 1
        else:
            q.popleft()
            q.append(cb)
            cb ^= 1

    # print(q)

    ans = ['A' if (c ^ cb) else 'B' for c in q]
    print(''.join(ans))

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()

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


Question:
def run(K):
    n_max = 500
    '''
    K <= 500の場合は、n = Kとして1行につき1色を塗ればよい
        111
        222
        333
    Kが4の倍数の場合は、n = K/2以下の塗り方ができる
        1234
        5678
        3412
        7856
    上記でn+i+1色をi色に塗り替えても条件を満たす
        1234
        5178
        3412
        7851
    K = 1000の時は、n = 500で満たし、塗り替え操作で501～999まで表現できる
    '''
    n = 0
    trouts = []
    if K <= n_max:
        n = K
        for i in range(K):
            trouts.append([i+1]*K)
    else:
        n = n_max
        change = n_max*2 - K
        c1 = [i for i in range(1, n_max+1)]
        # c - 1 + n_max - c + 1 (c>0)
        # 0 + n_max (c==0)
        c2 = [i for i in range(2, change+1)] + [i for i in range(n_max+1, n_max*2+1-change)]
        if change > 0:
            c2 += [1]
        for i in range(n_max):
            shift = (i//2) * 2
            if i % 2 == 0:
                trouts.append(c1[shift:] + c1[:shift])
            else:
                trouts.append(c2[shift:] + c2[:shift])
    return (n, trouts)

def main():
    K = int(input())
    n, trouts = run(K)
    print(n)
    for i in range(len(trouts)):
        print(' '.join(map(str, trouts[i])))

if __name__ == '__main__':
    main()

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


Question:
K  = int(input())
n = 0
n1 = 0
n2 = 0
n3 = 0
n4 = 0
n5 = 0

#Kが500以下の場合、斜め作戦にする
if K <= 499:
   n = K
   mat = [[0 for n1 in range(K)] for n2 in range(K)]
   for n1 in range(K):
      for n2 in range(K-n1):
         mat[n1][n1+n2] = n2+1
   for n1 in range(K):
      for n2 in range(n1):
         mat[n1][n2] = K+n2-n1+1

#Kが500以上の場合、斜めに1マスずつしのびこませる
else:
   n = 500
   mat = [[0 for n1 in range(500)] for n2 in range(500)]
   for n1 in range(500):
      for n2 in range(500-n1):
         mat[n1][n1+n2] = n2+1
   for n1 in range(500):
      for n2 in range(n1):
         mat[n1][n2] = 500+n2-n1+1

   #Kが500以上の場合のギザギザ部分
   for n2 in range(K-500):
      for n1 in range(250):
          kari = n1*2+n2
          if kari >= 500:
             kari = kari-500
          mat[n1*2][kari] = n2+501

#行列の出力かんがえとく
print(n)

if K <= 500:
   out = ""
   for n1 in range(K):
      out = ""
      for n2 in range(K):
         out = out + " " + str(mat[n1][n2])
      print(out)

#Kが500以上の場合、斜めに1マスずつしのびこませる
else:
   out = ""
   for n1 in range(500):
       out = ""
       for n2 in range(500):
          out = out + " " + str(mat[n1][n2])
       print(out)

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


Question:
N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

from collections import deque
def bfs(v):
    que = deque([v])
    dist = {v: 0}
    prev = {v: v}
    while que:
        u = que.popleft()
        d = dist[u]
        for w in G[u]:
            if w in dist:
                continue
            dist[w] = d + 1
            prev[w] = u
            que.append(w)
    w = u
    D = []
    while w != v:
        D.append(w)
        w = prev[w]
    D.append(v)
    return u, D

from collections import deque
def solve(u, v = -1):
    que = deque([u])
    if v != -1:
        que.append(v)
    used = set([u, v])
    D = {v: 0, u: 0}
    E = {}
    if v != -1:
        E[0] = max(len(G[v]), len(G[u]))-1
    else:
        E[0] = len(G[u])
    x = v
    while que:
        v = que.popleft()
        d = D[v]
        for w in G[v]:
            if w in used:
                continue
            D[w] = d + 1
            que.append(w)
            used.add(w)
            E[d+1] = max(E.get(d+1, 0), len(G[w])-1)
    res = 2 if x != -1 else 1
    for v in E.values():
        if v: res *= v
    return res

D = bfs(bfs(0)[0])[1]
L = len(D)

col = (L + 1) // 2

if L % 2 == 1:
    ans = 10**18
    v = D[L//2]
    for w in G[v]:
        ans = min(ans, solve(v, w))
    ans = min(ans, solve(v))
else:
    v = D[L//2-1]; w = D[L//2]
    ans = solve(v, w)
print(col, ans)

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


Question:
n,a,b=int(input()),list(map(int,input().split()))+[0],list(map(int,input().split()))+[0]
for i in range(n):
	a[n]^=a[i]
	b[n]^=b[i]
na,nb=sorted(a),sorted(b)
if na!=nb:
	print("-1")
	exit()
f=dict()
def find(x):
	if f[x]==x:
		return x
	else:
		f[x]=find(f[x])
		return f[x]
ans=0
for i in range(n):
	if a[i]!=b[i]:
		f[a[i]]=a[i]
f[a[n]]=a[n]
for i in range(n):
	if a[i]!=b[i]:
		ans+=1
		f[find(b[i])]=find(a[i])
for i in f:
	if i==f[i]:
		ans+=1
print(ans-1)

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


Question:
n,a,b=int(input()),list(map(int,input().split()))+[0],list(map(int,input().split()))+[0]
for i in range(n):
	a[n]^=a[i]
	b[n]^=b[i]
na,nb=sorted(a),sorted(b)
if na!=nb:
	print("-1")
	exit()
f=dict()
def find(x):
	if f[x]==x:
		return x
	else:
		f[x]=find(f[x])
		return f[x]
ans=0
for i in range(n):
	if a[i]!=b[i]:
		f[a[i]]=a[i]
f[a[n]]=a[n]
for i in range(n):
	if a[i]!=b[i]:
		ans+=1
		f[find(b[i])]=find(a[i])
for i in f:
	if i==f[i]:
		ans+=1
print(ans-1)

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


Question:
import java.util.Scanner;

public class duplexprinting {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int n;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();

		System.out.println(n%2==0 ? n/2:(n/2)+1);

	}

}

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


Question:
import java.util.Scanner;

public class abc157c {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int n,m;
		String num = new String();
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();m=sc.nextInt();
		int[] s = new int[m];
		int[] c = new int[m];

		for(int i = 0; i < m; i++) {
			s[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}

		for(int i = 0 ; i < 1000; i++) {//1to1000までの数
			String temp = String.valueOf(i);
			if(temp.length() !=n) {//桁数と要求されたのが違うとき
				continue;
			}
			for(int j = 0; j < m; j++) {
				if(temp.charAt(s[j]-1)-'0'!=c[j]) {
					break;
				}else {
					if(j == m -1) {
						System.out.println(i);
						return;
					}
				}
			}
		}

		if(m == 0&&n==1) {
			System.out.println(0);
			return;
		}
		System.out.println(-1);
		return;

	}

}

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


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

		double a=sc.nextDouble();
		double b=sc.nextDouble();
		double n=sc.nextDouble();

		double x=0.0;

		double index=0.0;
		int count=1;

		while(x<=n){
			double tmp=Math.floor((a*x)/b)-a*Math.floor(x/b);
			//System.out.println(tmp);

			if(index==0.0)index=tmp;
			else if(index>tmp){
				break;
			}
			else if(index<tmp)index=tmp;
			x++;
		}
		System.out.println((long)index);

	}

}

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


Question:
import java.util.*;

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

		int n=sc.nextInt();
		int m=sc.nextInt();
		String str=sc.next();
		char[] tmparray=str.toCharArray();
		char[] c=new char[n+1];

		for(int i=0;i<tmparray.length;i++){
			c[i]=tmparray[n-i];
		}

		LinkedList<Character> clist=new LinkedList();

		int c1=0;

		String ans="-1";

		//Case unsolvable
		for(char ch:c){
			if(ch=='1'){
				c1++;
				if(c1>=m){
					System.out.println(ans);
					System.exit(0);
				}
			}else{
				c1=0;
				clist.add(ch);
			}
		}

		//case solvable

		ans="";
		int index=0;
		for(int i=m;i>0;i--){
			if((index+i)==c.length-1){
				ans=i+" "+ans;
				break;
			}else if((index+i)>=c.length){
				continue;
			}
			if(c[index+i]=='1'){
				continue;
			}else{
				if(ans=="")ans=i+ans;
				else ans=i+" "+ans;
				index=index+i;
				i=m+1;
			}
		}

		System.out.println(ans);
		}

}

Choices:
- Compile Error
- Runtime Error
- Memory Limit Exceeded
- 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 m=sc.nextInt();
		int[] y= new int[m];

		int ans=0;

		if(n>=m){
			System.out.println(ans);
			System.exit(0);
		}

		/*if(m==2){
			if(n==1)ans=Math.abs(y[1]-y[0]);
			System.out.println(ans);
			System.exit(0);
		}*/

		for(int i=0;i<m;i++){
			y[i]=sc.nextInt();
		}
		Arrays.sort(y);

		int[] x= new int [m-1];

		for(int i=0;i<m-1;i++){
			x[i]=y[i+1]-y[i];
			ans=ans+x[i];
		}

		Arrays.sort(x);

		for(int i=0; i<n-1;i++){
			ans=ans-x[m-i-2];
		}

		System.out.println(ans);
	}

}

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


Question:
import java.util.*;

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

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

     int sqrtM = (int)Math.sqrt((double)M);
     int k = (int)M/N;

     int base = Math.min(k,sqrtM);
     int ans=1;

     for(int i=2;i<=base;i++){
    	 if(M%i==0){
    		 ans=i;
    	 }
     }
     System.out.println(ans);
}
}

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


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

		 if(N==1){
			 System.out.println("Hello World");
		 }

		 if(N==2){
			 int A = scan.nextInt();
			 int B = scan.nextInt();

			 System.out.println(A+B);
		 }
	 }
}

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


Question:
import java.util.*;

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

		 if(N==1){
			 System.out.println("Hello World!");
		 }

		 if(N==2){
           Scanner scan2 = new Scanner(System.in);
			 int A = scan2.nextInt();
			 int B = scan2.nextInt();

			 System.out.println(A+B);
		 }
	 }
}

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


Question:
package Biginner112C;

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

	 Scanner scan = new Scanner(System.in);

	 int n = scan.nextInt();

	 int x[] = new int[n];
	 int y[] = new int[n];
	 int h[] = new int[n];

	 for(int i=0; i<n; i++){
		 x[i]=scan.nextInt();
		 y[i]=scan.nextInt();
		 h[i]=scan.nextInt();

	 }

	 boolean flag = false;

	 int cx=0;
	 int cy=0;
	 int ch=0;

	 for(int X=0; X<101; X++){
		 if(flag == true)break;
		 for(int Y=0; Y<101; Y++){
			 if(flag == true)break;
			 int H=0;

			 for(int i=0;i<n;i++){
			  if(h[i]>0){
				  H=h[i]+Math.abs(x[i]-X)+Math.abs(y[i]-Y);
				  break;
			  }

			 }
			 for(int i=0; i<n; i++){

				 if(h[i]!=Math.max(H-Math.abs(x[i]-X)-Math.abs(y[i]-Y),0)){
					 flag=false;
					 break;
				 }else{
					 cx = X;
					 cy = Y;
					 ch = H;
					 flag = true;
				 }
		     }
	     }
	 }

	 System.out.println(cx + " " + cy + " "+ ch);

  }
}

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


Question:
import java.util.Scanner;
class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextInt();
		long[] arr=new long[(int)n];
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
		}
		long num=(int)(Math.pow(10, 9))+7;
		long sum=0;
		for(long i=0;i<n;i++)
		{
			for(long j=i+1;j<n;j++)
			{
				sum=sum+(arr[(int)i]*arr[(int)j])%num;
				/*if(i!=j)
				{
					sum=sum+(arr[i]*arr[j])%num;
				}
				else
				{
					j++;
				}*/
			}
		}
		System.out.println(sum%num);
	}

}

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


Question:
import java.util.Scanner;
public class Main1 {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextInt();
		long[] arr=new long[(int)n];
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
		}
		long num=(int)(Math.pow(10, 9))+7;
		long sum=0;
		for(long i=0;i<n;i++)
		{
			for(long j=i+1;j<n;j++)
			{
				sum=sum+(arr[(int)i]*arr[(int)j])%num;

			}
		}
		System.out.println(sum%num);
	}

}

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


Question:
import java.util.Scanner;

public class A {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		System.out.println((int)Math.ceil((double)n/2));
	}

}

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 k = sc.nextInt();
        int x = sc.nextInt();
        int n = 1+x-k;
        for(int i = 0;i < (2k-1); i++){
          System.out.println(n+i);
        }
      }
    }

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


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

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


Question:
import java.util.*;
2.	class Main{
3.      public static void main(String[] args){
4.        Scanner sc = new Scanner(System.in);
5.        int k = sc.nextInt();
6.        int x = sc.nextInt();
7.        int n = 1+x-k;
8.        for(int i = 0;i < 2k-1; i++){
9.          System.out.println(n+i);
10.        }
11.      }
12.    }

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


Question:
mport java.util.Scanner;

public class B {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n <= 111)System.out.println("111");
		else if(n > 111 && n <= 222)System.out.println("222");
		else if(n > 222 && n <= 333)System.out.println("333");
		else if(n > 333 && n <= 444)System.out.println("444");
		else if(n > 444 && n <= 555)System.out.println("555");
		else if(n > 555 && n <= 666)System.out.println("666");
		else if(n > 666 && n <= 777)System.out.println("777");
		else if(n > 777 && n <= 888)System.out.println("888");
		else if(n > 888 && n <= 999)System.out.println("999");
	}
}

Choices:
- No abnormally found
- Runtime Error
- Memory 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();
		int k = sc.nextInt();
		char[] c = s.toCharArray();
		boolean flag = false;
		for(int i = 0; i < c.length; i++) {
			if(c[i]==1) {
				if(i==k)System.out.println("1");
			}
			else {
				System.out.println(c[i]);
			}
		}
	}
}

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);
		String s = sc.next();
		long k = sc.nextLong();
		char ans = 0;

		if(k == 1) {
			ans = s.charAt(0);
		}else {
			ans = s.charAt(1);
		}

		String answer = String.valueOf(ans);
		System.out.println(Integer.parseInt(answer));
	}

}

Choices:
- Runtime Error
- Compile Error
- Internal error
- Memory 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[] odd=new int[100000];
        int[] even=new int[100000];
        for(int i=0;i<odd.length;i++){
            odd[i]=0; even[i]=0;
        }
        for(int i=0;i<n;i++){
            if(i%2==0){
                even[sc.nextInt()]++;
            }
            else{
                odd[sc.nextInt()]++;
            }
        }
        int odd1=0; int odd1_idx=0; int odd2=0; int odd2_idx=0;
        int even1=0; int even1_idx=0; int even2=0; int even2_idx=0;
        for(int i=0;i<100000;i++){
            if(odd[i]>odd1){
                odd2_idx=odd1_idx; odd2=odd1;
                odd1_idx=i; odd1=odd[i];
            }
            else if(odd[i]>odd2){
                odd2_idx=i; odd2=odd[i];
            }
            if(even[i]>even1){
                even2_idx=even1_idx; even2=even1;
                even1_idx=i; even1=even[i];
            }
            else if(even[i]>even2){
                even2_idx=i; even2=even[i];
            }
        }
        if(odd1==n/2 && even1==n/2 && odd1_idx!=even1_idx){
            System.out.println(0);
        }
        else if(odd1==n/2 && even1==n/2 && odd1_idx==even1_idx){
            System.out.println(n/2);
        }
        else if(odd1==n/2 || even1==n/2){
            int out=odd1==n/2 ? n/2-even1 : n/2-odd1;
            System.out.println(out);
        }
        else if(odd1_idx!=even1_idx){
            System.out.println(n-odd1-even1);
        }
        else{
            if(odd1-odd2>even1-even2)
                System.out.println(n-even2-odd1);
            else
                System.out.println(n-odd2-even1);
        }
    }
}

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


Question:
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        String S = sc.nextLine();
        long K = sc.nextLong();
        int notone=-1;
        int notoneindex=-1;
        int[] arr=new int[20];
        for(int i=0;i<S.length();i++){
            arr[i]=S.charAt(i)-'0';
        }
        for(int i=0;i<S.length();i++){
            if(arr[i]!=1){
                notone=arr[i];
                notoneindex=i;
                break;
            }
        }
        if(notone==-1){
            System.out.println("1");
        }else if(K<=notoneindex){
            System.out.println("1");
        }else{
            System.out.println(notone);
        }
    }
}

Choices:
- No abnormally found
- Memory Limit Exceeded
- 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 count = 0;
		//文字列の入力
		String s = sc.next();
		String t = sc.next();

      	//SとTが一致しないとき、文字を変換して一致させる処理を行う
		if(!s.equals(t)){
    		//文字列の文字数と等しい配列を宣言
    		String[] sList = new String[s.length()];
    		String[] tList = new String[t.length()];
    		//配列に一文字ずつ格納
    		for(int i = 0; i < s.length(); ++i){
                sList[i] = String.valueOf(s.charAt(i));
    		}
    		for(int i = 0; i < t.length(); ++i){
    		    tList[i] = String.valueOf(t.charAt(i));
    		}

        	//SをTと比較し、Sの一致していない部分をTと同じものに変換する
        	int i = 0;
        	while(!s.equals(t)){
        	   sList[i] = tList[i];
        	}
        	count = i;
        }
    	//出力
		System.out.println(count);
    }
}

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


Question:
import java.util.Scanner;

public class Main2 {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }

	//フィールド
    Scanner sc;
    String N;

    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.next();
    }

    //解答処理
    private String solve() {
        String answer = "No";
        String[] list = N.split("");

        for (int i=0; i<N.length(); i++) {
        	if (list[i].equals("7")) {
        		answer = "Yes";
        		break;
        	}
        }

        return answer;
    }

    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}

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


Question:
public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }

	//フィールド
    Scanner sc;
    int N;
    int K;

    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.K = sc.nextInt();
    }

    //解答処理
    private int solve() {
        int answer = 0;
        //NをK進数に変換する
        String num = Integer.toString(N, K);
        answer = num.length();
        return answer;
    }

    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

}

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


Question:
import java.util.*;

public class Main {
    public static void main(String args[]) {
       //値の取得
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
       double root = Math.sqrt(N); //Nの平方根
       int a = 1;    //N(a,b)
       int b;
       int count = 0;    //到達に必要な移動回数

       //到達するまで移動を繰り返す
       while(a <= root) {
           if(N % a == 0) {
               b = N / a;    //N = a * b
               if(a + b - 2 < count || count == 0) {
                  count = a + b - 2;
               }
           }
           ++a;
       }

       //出力
       System.out.println(count);
    }
}

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


Question:
public class Main {
    public static void main(String[] args) throws Exception {
        //値を取得
        Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int[] p = new int[n];
       for (int i = 0; i < n; ++i){
           p[i] = sc.nextInt();
       }

       int count = 0;   //カウント用の変数
       //条件を満たすものをカウント
       for (int i = 0; i < (n-2); ++i){ //要素数がn個の配列に対し、n-2回調べる
           if (p[i] < p[i+1] && p[i+1] < p[i+2] || p[i] > p[i+1] && p[i+1] > p[i+2]){
               ++count;
           }
       }

        //出力
        System.out.println(count);
    }
}

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


Question:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        //値を取得
        Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int[] p = new int[n];
       for (int i = 0; i < n; ++i){
           p[i] = sc.nextInt();
       }

       int count = 0;   //カウント用の変数
       //条件を満たすものをカウント
       for (int i = 0; i < (n-1); ++i){
           if (p[i] < p[i+1] && p[i+1] < p[i+2]){
               ++count;
           }
       }

        //出力
        System.out.println(count);
    }
}

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


Question:
import java.util.Scanner;

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

	//フィールド
    Scanner sc;
    int N;

    //入力
    Main8(Scanner sc) {
        this.sc = sc;
        N = sc.nextInt();
    }

    //解答処理
    private int solve() {
    	int answer = 0;
        int count = 0;

        for (int i=1; i<=N; i+=2) {
        	count = divisorCount(i);
        	if (count == 8) {
        		answer++;
        	}
        }

        return answer;
    }

    //約数の個数を返すメソッド
    private int divisorCount(int num) {
    	int count = 0;

    	for (int i=1; i<=num; i++) {
    		if (num % i == 0) {
    			count++;
    		}
    	}

    	return count;

    }

    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

}

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


Question:
public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }

	//フィールド
    Scanner sc;
    int R;

    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.R = sc.nextInt();
    }

    //解答処理
    private String solve() {
        String answer = "ABC";

        if (1200 <= R && R < 2800) {
        	answer = "ARC";
        } else if (2800 <= R) {
        	answer = "AGC";
        }

        return answer;
    }

    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}

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


Question:
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int D = sc.nextInt();
        int x = sc.nextInt();
        sc.close();
        for (int i = 0; i < 10; i++) {
            x = r * x - D;
            System.out.println(x);
        }
    }
}

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


Question:
import java.util.*;

public class Main2 {

    private static final int INF = Integer.MAX_VALUE;

    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 lcm = lcm(c, d);

        long result = (b-a+1)-b/c+(a-1)/c-b/d+(a-1)/d+b/lcm-(a-1)/lcm;

        System.out.println(result);

    }

    //最大公約数
    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

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


Question:
import java.util.*;

public class Main1 {

    private static final int INF = Integer.MAX_VALUE;

    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 num = lcm(c, d);

        long result = 0;
        long warenai = num - (num/c) - (num/d) + 1;

        long bsyou = b / num;
        long asyou = (a - 1) / num;
        long bamari = b % num;
        long aamari = a % num - 1;

        result = (bsyou - asyou) * warenai;

        long aamariwarenaicount = aamari - (aamari/c) - (aamari/d);
        long bamariwarenaicount = bamari - bamari/c - bamari/d;
        result += bamariwarenaicount;
        result -= aamariwarenaicount;

        System.out.println(result);

    }

    //最大公約数
    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

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


Question:
import java.util.*;

public class Main2 {

    private static final int INF = Integer.MAX_VALUE;

    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 num = lcm(c, d);

        long result = 0;
        long warenai = num - (num/c) - (num/d) + 1;

        long bsyou = b / num;
        long asyou = (a - 1) / num;
        long bamari = b % num;
        long aamari = a % num - 1;

        result = (bsyou - asyou) * warenai;

        long aamariwarenaicount = aamari - (aamari/c) - (aamari/d);
        long bamariwarenaicount = bamari - bamari/c - bamari/d;
        result += bamariwarenaicount;
        result -= aamariwarenaicount;

        System.out.println(result);

    }

    //最大公約数
    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

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


Question:
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long result = 0;
        for (long tmp = a; tmp <= b ; tmp++) {
            if(tmp % c != 0 && tmp % d !=0){
                result++;
            }
        }

        System.out.println(result);
    }
}

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


Question:
import java.util.*;

public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Work> list = new ArrayList<>();
        for(int tmp = 0; tmp < n;tmp++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            Work work = new Work(a,b);
            list.add(work);
        }

        Collections.sort(list, new Comparator<Work>() {
            @Override
            public int compare(Work obj0, Work obj1) {
                 return obj0.time < obj1.time ? -1 : 1;
            }
        });
        boolean result = true;
        long time = 0;
        for(int tmp = 0;tmp < n; tmp++){
            Work work = list.get(tmp);
            time += work.cost;
            if(time > work.time){
                result = false;
                break;
            }
        }

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

    }

    //最大公約数
    static class Work {
        public int cost;
        public int time;

        public Work(int a,int b){
            this.cost = a;
            this.time = b;
        }

    }
}

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


Question:
import java.util.*;

public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] ls = new int[m];
        int[] rs = new int[n];
        for(int tmp = 0; tmp<m; tmp++){
            ls[tmp] = sc.nextInt();
            rs[tmp] = sc.nextInt();
        }
        int l = 0;
        int r = INF;
        for(int tmp = 0; tmp< m; tmp++){
            int x = ls[tmp];
            l = Math.max(x,l);
            int y = rs[tmp];
            r = Math.min(y,r);
        }

        System.out.println(l <= r ? r - l + 1 : 0);
    }
}

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


Question:
import java.util.*;

public class Main {

    private static final int INF = Integer.MAX_VALUE / 4;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] ls = new int[m];
        int[] rs = new int[n];
        for(int tmp = 0; tmp<m; tmp++){
            ls[tmp] = sc.nextInt();
            rs[tmp] = sc.nextInt();
        }
        int l = 0;
        int r = INF;
        for(int tmp = 0; tmp< m; tmp++){
            int x = ls[tmp];
            l = Math.max(x,l);
            int y = rs[tmp];
            r = Math.min(y,r);
        }

        System.out.println(l <= r ? r - l + 1 : 0);
    }
}

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


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

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();

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

		list.add(a);
		list.add(b);
		list.add(c);
		list.add(d);
		list.add(e);

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

		nlist.add(a);
		nlist.add(b);
		nlist.add(c);
		nlist.add(d);
		nlist.add(e);

		list = list.stream().map(s -> s % 10).collect(Collectors.toList());
		int min = list.stream().filter(s -> s != 0).min(Comparator.naturalOrder()).get();
		int minval = nlist.get(list.indexOf(min));
		nlist.remove(list.indexOf(min));
		List<Double> n2list = nlist.stream().map(s -> (double)s/10).map(s -> Math.ceil(s)).map(s -> s * 10).collect(Collectors.toList());

		double result = 0;
		for(double s :n2list) {
			result += s;
		}
		result += minval;
		int result1 = (int)result;
		System.out.println(result1);

	}
}

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


Question:
int x = A + B;
if(x%2!=0){
  System.out.println("IMPOSSIBLE");
}else{
  System.out.println(x%2);
}

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


Question:
import java.util.Scanner;

class Main {
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int max = 0;
    int sum = 0;
    while(sc.hasNext()){
      int newone = sc.nextInt();
      if(newone > max){
        max = newone
      }
      sum = sum + newone;
    }
    sum = sum - max;
    System.out.println(max < sum ? "Yes" : "No");
  }
}

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


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

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

		Scanner keyboard = new Scanner(System.in);

		BigInteger W  = keyboard.nextInt();
		BigInteger H  = keyboard.nextInt();
		BigInteger x  = keyboard.nextInt();
		BigInteger y  = keyboard.nextInt();

		double men = (W*H)/2.0;
		double a = x*H;
		double b = (W*H)-a;
		double c = y*W;
		double d = (W*H)-c;

		double xx = Math.min(a, b);
		double yy = Math.min(c, d);

		int hou = 0;

		if(xx == men) {
			hou ++;
		}
		if(yy == men) {
			hou ++;
		}

		if(hou <= 1) {
			hou = 0;
		}else {
			hou = 1;
		}

		System.out.print(men + " " + hou);
		keyboard.close();
	}
}

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


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

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

		Scanner keyboard = new Scanner(System.in);

		int W  = keyboard.nextInt();
		int H  = keyboard.nextInt();
		int x  = keyboard.nextInt();
		int y  = keyboard.nextInt();

		long double men = (W*H)/2.0;
		double a = x*H;
		double b = (W*H)-a;
		double c = y*W;
		double d = (W*H)-c;

		double xx = Math.min(a, b);
		double yy = Math.min(c, d);

		int hou = 0;

		if(xx == men) {
			hou ++;
		}
		if(yy == men) {
			hou ++;
		}

		if(hou <= 1) {
			hou = 0;
		}else {
			hou = 1;
		}

		System.out.print(men + " " + hou);
		keyboard.close();
	}
}

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


Question:
a, b, c, d = list(map(int, input().split()))

print(min(a*c,a*d,b*c,b*d))

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


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

public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int k = stdin.nextInt();
        for (int i = 1; i <= k; i++) {
            int x = c(k - 1, i - 1);
            int y = c(n - k + 1, i);
            int z = (x % 1000000007) * (y % 1000000007) % 1000000007;
            System.out.println(z);
        }
    }

    private static List<BigInteger> fct = new ArrayList<>();
    private static List<BigInteger> inv = new ArrayList<>();
    private static BigInteger mod = BigInteger.valueOf(1000000007);
    private static int c(int n, int r) {
        if (fct.isEmpty()) {
            fct.add(BigInteger.ONE);
            inv.add(fct.get(0).modInverse(mod));
        }

        for (int i = fct.size(); i <= n; i++) {
            fct.add(fct.get(i - 1).multiply(BigInteger.valueOf(i)).mod(mod));
            inv.add(fct.get(i).modInverse(mod));
        }

        return fct.get(n).multiply(inv.get(n - r).multiply(inv.get(r)).mod(mod)).mod(mod).intValue();
    }
}

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


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

public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int k = stdin.nextInt();
        for (int i = 1; i <= k; i++) {
            int x = c(k - 1, i - 1);
            int y = c(n - k + 1, i);
            int z = (x % 1000000007) * (y % 1000000007);
            System.out.println(z);
        }
    }

    private static List<BigInteger> fct = new ArrayList<>();
    private static List<BigInteger> inv = new ArrayList<>();
    private static BigInteger mod = BigInteger.valueOf(1000000007);
    private static int c(int n, int r) {
        if (fct.isEmpty()) {
            fct.add(BigInteger.ONE);
            inv.add(fct.get(0).modInverse(mod));
        }

        for (int i = fct.size(); i <= n; i++) {
            fct.add(fct.get(i - 1).multiply(BigInteger.valueOf(i)).mod(mod));
            inv.add(fct.get(i).modInverse(mod));
        }

        return fct.get(n).multiply(inv.get(n - r).multiply(inv.get(r)).mod(mod)).mod(mod).intValue();
    }
}

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


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    private List<Set<Integer>> children;
    private Map<Tuple, Set<Integer>> cache = new HashMap<>();

    private Set<Integer> f(int current, int count) {
        if (count == 3) {
            Set<Integer> set = new HashSet<>();
            set.add(current);
            return set;
        }

        Tuple key = new Tuple(current, count);
        if (cache.containsKey(key)) {
            return cache.get(key);
        }

        Set<Integer> set = new HashSet<>();
        for (Integer child : children.get(current)) {
            set.addAll(f(child, count + 1));
        }

        cache.put(key, set);
        return set;
    }

    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        Pattern space = Pattern.compile(" ");
        int[] first = space.splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
        int n = first[0];
        int m = first[1];

        children = IntStream.range(0, n).mapToObj(unused -> new HashSet<Integer>()).collect(Collectors.toList());
        for (int i = 0; i < m; i++) {
            int[] line = space.splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
            int u = line[0] - 1;
            int v = line[1] - 1;
            children.get(u).add(v);
        }

        int[] last = space.splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
        int s = last[0] - 1;
        int t = last[1] - 1;

        List<Set<Integer>> nexts = IntStream.range(0, n).mapToObj(current -> f(current, 0)).collect(Collectors.toList());

        Deque<Integer> q = new ArrayDeque<>();
        int[] cost = new int[n];
        Arrays.fill(cost, Integer.MAX_VALUE);
        q.add(s);
        cost[s] = 0;
        while (!q.isEmpty()) {
            int current = q.pollFirst();
            for (int next : nexts.get(current)) {
                if (cost[current] + 1 < cost[next]) {
                    cost[next] = cost[current] + 1;
                    q.add(next);
                }
            }
        }

        if (cost[t] == Integer.MAX_VALUE) {
            stdout.println(-1);
        } else {
            stdout.println(cost[t]);
        }
    }

    private static class Tuple {
        private int current;
        private int count;

        public Tuple(int current, int count) {
            this.current = current;
            this.count = count;
        }

        @Override
        public int hashCode() {
            return Objects.hash(current, count);
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null || !(obj instanceof Tuple)) {
                return false;
            }

            Tuple other = (Tuple) obj;
            return this.current == other.current && this.count == other.count;
        }
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}

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


Question:
package d;

import java.util.Comparator;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = stdin.nextInt();
            b[i] = stdin.nextInt();
        }

        // 締め切りの若い順番に仕事を進める。
        int[] idxs = IntStream.range(0, n)
                              .boxed()
                              .sorted(Comparator.comparing(i -> b[i]))
                              .mapToInt(Integer::intValue)
                              .toArray();
        int t = 0;
        boolean ok = true;
        for (int idx : idxs) {
            t += a[idx];
            if (b[idx] < t) {
                ok = false;
                break;
            }
        }
        System.out.println(ok ? "Yes" : "No");
    }
}

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


Question:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        String a = stdin.readLine();

        long[] c = new long[26];
        for (char ch : a.toCharArray()) {
            c[ch - 'a']++;
        }

        long len = (long)a.length();
        long ans = len * (len - 1L) / 2L + 1L;
        for (long v : c) {
            ans -= v * (v - 1L) / 2L;
        }
        stdout.println(ans);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}

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


Question:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int x = stdin.nextInt();
        int ans = 3 * (n - gcd(x, n));
        System.out.println(ans);
    }

    public static int gcd(int a, int b) {
        int mod;
        while ((mod = b % a) > 0) {
            a = mod;
            b = a;
        }
        return a;
    }
}

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


Question:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int x = stdin.nextInt();
        int ans = 3 * (n - gcd(x, n));
        System.out.println(ans);
    }

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

Choices:
- No abnormally found
- Internal error
- Runtime 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 n = sc.nextInt();
    int x[] = new int [n];
    int y[] = new int [n];
    double dis=0;
    for(int i=0; i<n; i++){
      x[i] = sc.nextInt();
      y[i] = sc.nextInt();
    }
    for(int i=0; i<n; i++){
      for(int j=0; j<n; j++){
        if(i!=j){
          int sx = x[i] - x[j];
          int sy = y[i] - y[j];
          dis+=Math.sqrt(sx*sx+sy*sy);
        }
      }
    }
    System.out.println(dis/n);
  }
}

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


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

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

		int count = 0;

		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n + 1; j++) {
				if (new BigInteger(s.substring(i, j)).remainder(p).equals(BigInteger.ZERO))
					count++;
			}
		}
		System.out.println(count);

	}

}

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


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

public class Sub {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		BigInteger p = new BigInteger(scanner.next());
		String s = scanner.next();

		int count = 0;

		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n + 1; j++) {
				if (new BigInteger(s.substring(i, j)).remainder(p).equals(BigInteger.ZERO))
					count++;
			}
		}
		System.out.println(count);

	}

}

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


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

public class Sub {
	public static void main(String[] args) {
		Random random = new Random();

		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		BigInteger p = new BigInteger(scanner.next());
		String s = scanner.next();

		int count = 0;

		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n + 1; j++) {
				if (new BigInteger(s.substring(i, j)).remainder(p).equals(BigInteger.ZERO))
					count++;
			}
		}
		System.out.println(count);

	}

}

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


Question:
package abc.abc158.e;

import java.math.BigInteger;
import java.util.Random;
import java.util.Scanner;

public class Sub {
	public static void main(String[] args) {
		Random random = new Random();

		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		BigInteger p = new BigInteger(scanner.next());
		String s = scanner.next();

		int count = 0;

		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n + 1; j++) {
				if (new BigInteger(s.substring(i, j)).remainder(p).equals(BigInteger.ZERO))
					count++;
			}
		}
		System.out.println(count);

	}

}

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


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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int p = scanner.nextInt();
		String s = scanner.next();
		int count;

		if (p == 2 || p == 5) {
			count = 0;
			for (int i = 0; i < n; i++) {
				if (Integer.parseInt(s, i, i + 1, 10) % p == 0) {
					count += i + 1;
				}
			}
		} else {
			r = new int[p];
			place = new int[p - 1];
			place[0] = 1;
			for (int i = 1; i < p - 1; i++) {
				place[i] = place[i - 1] * 10 % p;
			}
			int remain = 0;
			for (int i = 0; i < n; i++) {
				remain += (s.charAt(n - 1 - i) - 48) * place[i % (p - 1)];
				remain %= p;
				r[remain]++;
			}

			count = Arrays.stream(r).parallel().map(i -> i * (i - 1) / 2).sum() + r[0];

		}

		System.out.println(count);

	}

	static int[] r;
	static int[] place;//10^a mod p=10^(a%(p-1)) mod p

}

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


Question:
import java.util.Scanner;

public class Sub {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A, B;

		final int N = scanner.nextInt();
		prepare(N);
		int[] except = new int[N];

		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			union(A, B);
			except[A]++;
			except[B]++;
		}

		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			if (find(A) == find(B)) {
				except[A]++;
				except[B]++;
			}
		}

		scanner.close();

		for (int i = 0; i < N; i++) {
			System.out.print(desc[find(i)] - except[i]);
			System.out.print(i == N - 1 ? "\n" : " ");
		}
	}

	static int[] parent;
	static int[] desc;

	static void prepare(int n) {
		parent = new int[n];
		for (int i = 0; i < n; i++) {
			parent[i] = i;
		}
		desc = new int[n];
	}

	static int find(int x) {
		if (parent[x] == x)
			return x;
		else
			return find(parent[x]);
	}

	static void union(int x, int y) {
		int xRoot = find(x);
		int yRoot = find(y);
		if (xRoot == yRoot)
			return;
		if (desc[xRoot] >= desc[yRoot]) {
			parent[yRoot] = xRoot;
			desc[xRoot] += desc[yRoot] + 1;
		} else {
			parent[xRoot] = yRoot;
			desc[yRoot] += desc[xRoot] + 1;
		}
	}
}

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


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A, B;

		final int N = scanner.nextInt();
		prepare(N);

		int[] except = new int[N];

		final int M = scanner.nextInt();

		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			union(A, B);
			except[A]++;
			except[B]++;
		}

		final int K = scanner.nextInt();
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			if (find(A) == find(B)) {
				except[A]++;
				except[B]++;
			}
		}

		scanner.close();
		for (int i = 0; i < N; i++) {
			System.out.print(desc[find(i)] - except[i]);
			System.out.print(i == N - 1 ? "\n" : " ");
		}
	}

	static int[] parent;
	static int[] desc;

	static void prepare(int n) {
		parent = new int[n];
		for (int i = 0; i < n; i++) {
			parent[i] = n;
		}
		desc = new int[n];
	}

	static int find(int x) {
		if (parent[x] == x)
			return x;
		else
			return find(parent[x]);
	}

	static void union(int x, int y) {
		int xRoot = find(x);
		int yRoot = find(y);
		if (desc[xRoot] >= desc[yRoot]) {
			parent[yRoot] = xRoot;
			desc[xRoot] += desc[yRoot] + 1;
		} else {
			parent[xRoot] = yRoot;
			desc[yRoot] += desc[xRoot] + 1;
		}
	}
}

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


Question:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A, B;

		final int N = scanner.nextInt();

		int[] except = new int[N];

		final int M = scanner.nextInt();

		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			union(A, B);
			except[A]++;
			except[B]++;
		}

		final int K = scanner.nextInt();
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			if (find(A) == find(B)) {
				except[A]++;
				except[B]++;
			}
		}

		scanner.close();
		for (int i = 0; i < N; i++) {
			System.out.print(desc[find(i)] - except[i]);
			System.out.print(i == N - 1 ? "\n" : " ");
		}
	}

	static int[] parent;
	static int[] desc;

	static void prepare(int n) {
		parent = new int[n];
		for (int i = 0; i < n; i++) {
			parent[i] = n;
		}
		desc = new int[n];
	}

	static int find(int x) {
		if (parent[x] == x)
			return x;
		else
			return find(parent[x]);
	}

	static void union(int x, int y) {
		int xRoot = find(x);
		int yRoot = find(y);
		if (desc[xRoot] >= desc[yRoot]) {
			parent[yRoot] = xRoot;
			desc[xRoot] += desc[yRoot] + 1;
		} else {
			parent[xRoot] = yRoot;
			desc[yRoot] += desc[xRoot] + 1;
		}
	}
}

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


Question:
import java.util.Scanner;

public class Sub {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A, B;

		final int N = scanner.nextInt();

		int[] except = new int[N];

		final int M = scanner.nextInt();

		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			union(A, B);
			except[A]++;
			except[B]++;
		}

		final int K = scanner.nextInt();
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			if (find(A) == find(B)) {
				except[A]++;
				except[B]++;
			}
		}

		scanner.close();
		for (int i = 0; i < N; i++) {
			System.out.print(desc[find(i)] - except[i]);
			System.out.print(i == N - 1 ? "\n" : " ");
		}
	}

	static int[] parent;
	static int[] desc;

	static void prepare(int n) {
		parent = new int[n];
		for (int i = 0; i < n; i++) {
			parent[i] = n;
		}
		desc = new int[n];
	}

	static int find(int x) {
		if (parent[x] == x)
			return x;
		else
			return find(parent[x]);
	}

	static void union(int x, int y) {
		int xRoot = find(x);
		int yRoot = find(y);
		if (desc[xRoot] >= desc[yRoot]) {
			parent[yRoot] = xRoot;
			desc[xRoot] += desc[yRoot] + 1;
		} else {
			parent[xRoot] = yRoot;
			desc[yRoot] += desc[xRoot] + 1;
		}
	}
}

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


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

public class Main {

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

		final int N = scanner.nextInt();
		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		List<Integer>[] friendLists = new ArrayList[N];
		List<Integer>[] blockLists = new ArrayList[N];
		for (int i = 0; i < N; i++) {
			friendLists[i] = new ArrayList<Integer>();
			blockLists[i] = new ArrayList<Integer>();
		}
		int[] result = new int[N];

		int A, B;
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			friendLists[A].add(B);
			friendLists[B].add(A);
			result[A]--;
			result[B]--;
		}
		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			blockLists[A].add(B);
			blockLists[B].add(A);
		}

		boolean[] visited = new boolean[N];

		Set<Integer> group = new HashSet<Integer>();

		int groupCount = -1;
		int[] root = new int[N];

		for (int i = 0; i < N; i++) {
			if (!visited[i]) {
				groupCount++;
				group.clear();
				DFS(friendLists, i, visited, group);
				for (int j : group) {
					root[j] = groupCount;
					result[j] += group.size() - 1;
					//result[j] = group.size() - friendLists[j].size() - 1;
				}
			}
		}

		for (int i = 0; i < N; i++) {
			for (int j : blockLists[i]) {
				if (i < j && root[i] == root[j]) {
					result[i]--;
					result[j]--;
				}
			}
		}

		for (int i : result) {
			System.out.print(i + " ");
		}
	}

	static void DFS(List<Integer>[] graph, int vertex, boolean[] visited, Set<Integer> reachable) {
		visited[vertex] = true;
		reachable.add(vertex);
		graph[vertex].forEach(neighbor -> {
			if (!visited[neighbor]) {
				DFS(graph, neighbor, visited, reachable);
			}
		});
	}

}

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


Question:
package abc.n157.d;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

		final int N = scanner.nextInt();
		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		List<Integer>[] friendLists = new ArrayList[N];
		List<Integer>[] blockLists = new ArrayList[N];
		for (int i = 0; i < N; i++) {
			friendLists[i] = new ArrayList<Integer>();
			blockLists[i] = new ArrayList<Integer>();
		}
		int[] result = new int[N];

		int A, B;
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			friendLists[A].add(B);
			friendLists[B].add(A);
			result[A]--;
			result[B]--;
		}
		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			blockLists[A].add(B);
			blockLists[B].add(A);
		}

		boolean[] visited = new boolean[N];

		Set<Integer> group = new HashSet<Integer>();

		int groupCount = -1;
		int[] root = new int[N];

		for (int i = 0; i < N; i++) {
			if (!visited[i]) {
				groupCount++;
				group.clear();
				DFS(friendLists, i, visited, group);
				for (int j : group) {
					root[j] = groupCount;
					result[j] += group.size() - 1;
					//result[j] = group.size() - friendLists[j].size() - 1;
				}
			}
		}

		for (int i = 0; i < N; i++) {
			for (int j : blockLists[i]) {
				if (i < j && root[i] == root[j]) {
					result[i]--;
					result[j]--;
				}
			}
		}

		for (int i : result) {
			System.out.print(i + " ");
		}
	}

	static void DFS(List<Integer>[] graph, int vertex, boolean[] visited, Set<Integer> reachable) {
		visited[vertex] = true;
		reachable.add(vertex);
		graph[vertex].forEach(neighbor -> {
			if (!visited[neighbor]) {
				DFS(graph, neighbor, visited, reachable);
			}
		});
	}

}

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


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

public class Main {

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

		final int N = scanner.nextInt();
		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		List<Integer>[] friendLists = new ArrayList[N];

		List<int[]> blockLists = new ArrayList<>();

		for (int i = 0; i < N; i++) {
			friendLists[i] = new ArrayList<Integer>();
		}
		int[] result = new int[N];

		int A, B;
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			friendLists[A].add(B);
			friendLists[B].add(A);
			result[A]--;
			result[B]--;
		}
		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			blockLists.add(new int[] { A, B });
		}

		boolean[] visited = new boolean[N];

		Set<Integer> group = new HashSet<Integer>();

		int groupCount = -1;
		int[] root = new int[N];

		for (int i = 0; i < N; i++) {
			if (!visited[i]) {
				groupCount++;
				group.clear();
				DFS(friendLists, i, visited, group);
				for (int j : group) {
					root[j] = groupCount;
					result[j] += group.size() - 1;
				}
			}
		}

		for (int[] block : blockLists) {
			if (root[block[0]] == root[block[1]]) {
				result[block[0]]--;
				result[block[1]]--;
			}
		}

		String outString = "";

		for (int i : result) {
			outString += i + " ";
		}
		System.out.println(outString);

	}

	static void DFS(List<Integer>[] graph, int vertex, boolean[] visited, Set<Integer> reachable) {
		visited[vertex] = true;
		reachable.add(vertex);
		graph[vertex].forEach(neighbor -> {
			if (!visited[neighbor]) {
				DFS(graph, neighbor, visited, reachable);
			}
		});
	}

}

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


Question:
package abc.n157.d;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

		final int N = scanner.nextInt();
		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		List<Integer>[] friendLists = new ArrayList[N];

		List<int[]> blockLists = new ArrayList<>();

		for (int i = 0; i < N; i++) {
			friendLists[i] = new ArrayList<Integer>();
		}
		int[] result = new int[N];

		int A, B;
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			friendLists[A].add(B);
			friendLists[B].add(A);
			result[A]--;
			result[B]--;
		}
		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			blockLists.add(new int[] { A, B });
		}

		boolean[] visited = new boolean[N];

		Set<Integer> group = new HashSet<Integer>();

		int groupCount = -1;
		int[] root = new int[N];

		for (int i = 0; i < N; i++) {
			if (!visited[i]) {
				groupCount++;
				group.clear();
				DFS(friendLists, i, visited, group);
				for (int j : group) {
					root[j] = groupCount;
					result[j] += group.size() - 1;
				}
			}
		}

		for (int[] block : blockLists) {
			if (root[block[0]] == root[block[1]]) {
				result[block[0]]--;
				result[block[1]]--;
			}
		}

		String outString = "";

		for (int i : result) {
			outString += i + " ";
		}
		System.out.println(outString);

	}

	static void DFS(List<Integer>[] graph, int vertex, boolean[] visited, Set<Integer> reachable) {
		visited[vertex] = true;
		reachable.add(vertex);
		graph[vertex].forEach(neighbor -> {
			if (!visited[neighbor]) {
				DFS(graph, neighbor, visited, reachable);
			}
		});
	}

}

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


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

public class Main {

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

		final int N = scanner.nextInt();
		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		List<Integer>[] friendLists = new ArrayList[N];

		List<int[]> blockLists = new ArrayList<>();

		for (int i = 0; i < N; i++) {
			friendLists[i] = new ArrayList<Integer>();
		}
		int[] result = new int[N];

		int A, B;
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			friendLists[A].add(B);
			friendLists[B].add(A);
		}
		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			blockLists.add(new int[] { A, B });
		}

		boolean[] visited = new boolean[N];

		Set<Integer> group = new HashSet<Integer>();

		int groupCount = -1;
		int[] root = new int[N];

		for (int i = 0; i < N; i++) {
			if (!visited[i]) {
				groupCount++;
				group.clear();
				DFS(friendLists, i, visited, group);
				for (int j : group) {
					root[j] = groupCount;
					result[j] = group.size() - friendLists[j].size() - 1;
				}
			}
		}

		for (int[] block : blockLists) {
			if (root[block[0]] == root[block[1]]) {
				result[block[0]]--;
				result[block[1]]--;
			}
		}

		String outString = "";

		for (int i : result) {
			outString += i + " ";
		}
		System.out.println(outString);

	}

	static void DFS(List<Integer>[] graph, int vertex, boolean[] visited, Set<Integer> reachable) {
		visited[vertex] = true;
		reachable.add(vertex);
		graph[vertex].forEach(neighbor -> {
			if (!visited[neighbor]) {
				DFS(graph, neighbor, visited, reachable);
			}
		});
	}

}

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


Question:
package abc.n157.d;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

		final int N = scanner.nextInt();
		final int M = scanner.nextInt();
		final int K = scanner.nextInt();

		List<Integer>[] friendLists = new ArrayList[N];

		List<int[]> blockLists = new ArrayList<>();

		for (int i = 0; i < N; i++) {
			friendLists[i] = new ArrayList<Integer>();
		}
		int[] result = new int[N];

		int A, B;
		for (int i = 0; i < M; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			friendLists[A].add(B);
			friendLists[B].add(A);
		}
		for (int i = 0; i < K; i++) {
			A = scanner.nextInt() - 1;
			B = scanner.nextInt() - 1;
			blockLists.add(new int[] { A, B });
		}

		boolean[] visited = new boolean[N];

		Set<Integer> group = new HashSet<Integer>();

		int groupCount = -1;
		int[] root = new int[N];

		for (int i = 0; i < N; i++) {
			if (!visited[i]) {
				groupCount++;
				group.clear();
				DFS(friendLists, i, visited, group);
				for (int j : group) {
					root[j] = groupCount;
					result[j] = group.size() - friendLists[j].size() - 1;
				}
			}
		}

		for (int[] block : blockLists) {
			if (root[block[0]] == root[block[1]]) {
				result[block[0]]--;
				result[block[1]]--;
			}
		}

		String outString = "";

		for (int i : result) {
			outString += i + " ";
		}
		System.out.println(outString);

	}

	static void DFS(List<Integer>[] graph, int vertex, boolean[] visited, Set<Integer> reachable) {
		visited[vertex] = true;
		reachable.add(vertex);
		graph[vertex].forEach(neighbor -> {
			if (!visited[neighbor]) {
				DFS(graph, neighbor, visited, reachable);
			}
		});
	}

}

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


Question:
import java.util.Scanner;

public class Main {

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

		int N = scanner.nextInt();
		int K = scanner.nextInt();

		int[] sum = new int[N];

		int a;

		for (int i = 0; i < N; i++) {
			a = scanner.nextInt();
			for (int j = 0; j < K && i + j < N; j++) {
				sum[i + j] += a + 1;
			}

		}

		scanner.close();

		a = 0;

		for (int i = K - 1; i < N; i++) {
			if (sum[i] > a)
				a = sum[i];
		}

		System.out.println((double) a / 2);
	}

}

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


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

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


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

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


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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int v = scanner.nextInt();
		int p = scanner.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		scanner.close();
		Arrays.parallelSort(a);

		int result = p;

		for (int i = p + 1; i <= n; i++) {
			if (canBeChosen(i, n, m, v, p, a)) {
				result = i;
			} else {
				break;
			}
		}

		System.out.println(result);
	}

	static boolean naive(int k, int n, int m, int v, int p, int[] a) {
		int threshold = a[n - k] + m;
		if (threshold < a[n - p]) {
			return false;
		}
		long canVote = (long) (p - 1) * m;
		for (int i = 0; i <= n - p; i++) {
			canVote += Math.min(m, threshold - a[i]);
		}
		return canVote >= (long) m * v;
	}

	static boolean canBeChosen(int k, int n, int m, int v, int p, int[] a) {
		int threshold = a[n - k] + m;
		if (threshold < a[n - p]) {
			return false;
		}
		int remain = v - (n - k + p);
		if (remain <= 0) {
			return true;
		}
		long canVote = 0;
		for (int i = p; i < k; i++) {
			canVote += threshold - a[n - i];
		}
		return canVote >= (long) remain * m;

	}
}

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


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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int v = scanner.nextInt();
		int p = scanner.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		scanner.close();
		Arrays.parallelSort(a);

		int result = p;

		for (int i = p + 1; i <= n; i++) {
			if (naive(i, n, m, v, p, a)) {
				result = i;
			} else {
				break;
			}
		}

		System.out.println(result);
	}

	static boolean naive(int k, int n, int m, int v, int p, int[] a) {
		int threshold = a[n - k] + m;
		if (threshold < a[n - p]) {
			return false;
		}
		long canVote = (long) (p - 1) * m;
		for (int i = 0; i <= n - p; i++) {
			canVote += Math.min(m, threshold - a[i]);
		}
		return canVote >= (long) m * v;
	}

	static boolean canBeChosen(int k, int n, int m, int v, int p, int[] a) {
		if (a[n - k] == a[n - p]) {
			return true;
		}
		int threshold = a[n - k] + m;
		if (threshold < a[n - p]) {
			return false;
		}
		int remain = v - (n - k + p);
		if (remain <= 0) {
			return true;
		}
		int canVote = 0;
		for (int i = p; i < k; i++) {
			canVote += threshold - a[n - i];
		}
		return canVote >= remain * m;

	}
}

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


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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int v = scanner.nextInt();
		int p = scanner.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		scanner.close();
		Arrays.parallelSort(a);

		int result = p;

		for (int i = p + 1; i <= n; i++) {
			if (canBeChosen(i, n, m, v, p, a)) {
				result = i;
			} else {
				break;
			}
		}

		System.out.println(result);
	}

	static boolean canBeChosen(int k, int n, int m, int v, int p, int[] a) {
		if(a[n-k]==a[n-p]){{
			return true;
		}
		int threshold = a[n - k] + m;
		if (threshold < a[n - p]) {
			return false;
		}
		int remain = v - (n - k + p);
		if (remain <= 0) {
			return true;
		}
		int canVote = 0;
		for (int i = p; i < k; i++) {
			canVote += threshold - a[n - i];
		}
		if (canVote < remain * m) {
			return false;
		} else {
			return true;
		}
	}
}

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


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

public class Main {

	static List<Integer>[] adj;
	static List<Integer>[] used;
	static int[] root;
	static int[] color;
	static int cMax = 1;

	static void dfs(int v, int prev) {
		int c = 1;
		for (int next : adj[v]) {
			if (next == prev)
				continue;
			root[next] = v;
			while (used[v].contains(c))
				c++;
			color[next] = c;
			used[v].add(c);
			used[next].add(c);
			if (c > cMax)
				cMax = c;
			dfs(next, v);
		}
	}

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		adj = new List[n];
		used = new List[n];
		root = new int[n];
		color = new int[n];
		for (int i = 0; i < n; i++) {
			adj[i] = new ArrayList<Integer>();
			used[i] = new ArrayList<Integer>();
		}

		int[][] edges = new int[n - 1][2];
		for (int i = 0, a, b; i < n - 1; i++) {
			a = scanner.nextInt() - 1;
			b = scanner.nextInt() - 1;
			edges[i][0] = a;
			edges[i][0] = b;
			adj[a].add(b);
			adj[b].add(a);
		}

		dfs(0, -1);
		System.out.println(cMax);
		for (int i = 0, a, b; i < n - 1; i++) {
			a = edges[i][0];
			b = edges[i][1];
			System.out.println(root[b] == a ? color[b] : color[a]);
		}

	}

}

Choices:
- Time Limit Exceeded
- Compile 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 scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		for (int i = 0; i < m; i++) {
			Arrays.parallelSort(a);
			a[n - 1] >>= 1;
		}
		long sum = 0;
		for (int i = 0; i < n; i++) {
			sum += a[i];
		}
		System.out.println(sum);
	}

}

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


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

public class A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if(1 == N)
            System.out.println("Hello World");
        else {
            int A, B;
            A = sc.nextInt();
            B = sc.nextInt();
            System.out.println(A+B);
        }
    }
}

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


Question:
//No sorceries shall prevail.
import java.util.*;
import java.io.*;
public class Main {

	static Scanner inp= new Scanner(System.in);
	static PrintWriter out= new PrintWriter(System.out);
	public static void main(String args[]) {
	   	Main g=new Main();
	   	g.main();
	   	out.close();
	}

	//Main
	void main() {

		int n=inp.nextInt();
		int m=inp.nextInt();
		int q=inp.nextInt();
		int r[]=new int[n];
		int c[]=new int[m];
		HashSet<Long> set = new HashSet<>();
		while(q-->0) {
			int x=inp.nextInt()-1;
			int y=inp.nextInt()-1;
			set.add(hash(x,y));
			r[x]++;
			c[y]++;
		}
		int maxXIndex=0,maxYIndex=0;
		for(int i=1;i<n;i++) {
			if(r[i]>r[maxXIndex]) {
				maxXIndex=i;
			}
		}
		for(int i=1;i<m;i++) {
			if(c[i]>r[maxYIndex]) {
				maxYIndex=i;
			}
		}
		int maxX=r[maxXIndex],maxY=c[maxYIndex];
		int gg=maxX+maxY-1;
		ArrayList<Integer> xs=new ArrayList<Integer>();
		ArrayList<Integer> ys=new ArrayList<Integer>();
		for(int i=0;i<n;i++) {
			if(r[i]==maxX) xs.add(i);
		}
		for(int i=0;i<m;i++) {
			if(c[i]==maxY) ys.add(i);
		}
		loop:
		for(int x: xs) {
			for(int y: ys) {
				if(!set.contains(hash(x,y))) {
					gg++;
					break loop;
				}
			}
		}
		System.out.println(gg);
	}

    static long hash(int x, int y) {
    	return x*100000000l+y;
    }

}

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


Question:
//No sorceries shall prevail.
import java.util.*;
import java.io.*;
public class Main {

	static Scanner inp= new Scanner(System.in);
	static PrintWriter out= new PrintWriter(System.out);
	public static void main(String args[]) {
	   	Main g=new Main();
	   	g.main();
	   	out.close();
	}

	//Main
	void main() {

		int n=inp.nextInt();
		int m=inp.nextInt();
		int q=inp.nextInt();
		int a[][]=new int[n][m];
		while(q-->0) {
			int x=inp.nextInt()-1;
			int y=inp.nextInt()-1;
			a[x][y]=1;
		}
		int rowSum[]=new int[n];
		int colSum[]=new int[m];
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				rowSum[i]+=a[i][j];
			}
		}
		for(int i=0;i<m;i++) {
			for(int j=0;j<n;j++) {
				colSum[i]+=a[j][i];
			}
		}
		int gg=0;
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				gg=Math.max(gg, a[i][j]==1?rowSum[i]+colSum[j]-1:rowSum[i]+colSum[j]);
			}
		}
		System.out.println(gg);
	}

}

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


Question:
// No sorceries shall prevail. //
import java.util.*;
import javafx.util.*;
import java.io.*;
public class Main {
	//Variables
	static long mod = 1000000007;
	static long mod2 = 998244353;
	static FastReader inp= new FastReader();
	static PrintWriter out= new PrintWriter(System.out);
	public static void main(String args[]) {
	   	Main g=new Main();
	   	g.main();
	   	out.close();
	}

	//Main
	void main() {

		int n=inp.nextInt();
		String s[]=new String[n];
		input(s,n);
		StringBuilder sb= new StringBuilder("");
		Pair<Integer,Integer> pos[]=new Pair[n];
		Pair<Integer,Integer> neg[]=new Pair[n];
		int posIndex=0,negIndex=0;
		for(int i=0;i<n;i++) {
			int count=0,min=s[i].length();
			for(int j=0;j<s[i].length();j++){
				if(s[i].charAt(j)=='(') {
					count++;
				}else {
					count--;
				}
				min=Math.min(count, min);
			}
			if(min<0) {
				if(count>0) {
					pos[posIndex++]=new Pair(min,i);
				}else {
					neg[negIndex++]=new Pair(min-count,i);
				}
			}else {
				sb.append(s[i]);
			}
		}
		Arrays.sort(pos,0,posIndex);
		Arrays.sort(neg,0,posIndex);
		for(int i=0;i<posIndex;i++) {
			sb.append(s[pos[i].getValue()]);
		}
		for(int i=negIndex-1;i>=0;i--) {
			sb.append(s[neg[i].getValue()]);
		}
		int count=0;
		//out.println(sb);
		for(int i=0;i<sb.length();i++) {
			if(sb.charAt(i)=='(') {
				count++;
			}else {
				count--;
			}
			if(count<0) {
				out.println("No");
				return;
			}
		}
		out.println(count==0?"Yes":"No");
	}

	// Classes
	static class Edge implements Comparable<Edge>{
		int l,r;
		Edge(){}
		Edge(int l,int r){
			this.l=l;
			this.r=r;
		}
		@Override
		public int compareTo(Edge e) {
			return (l-e.l)!=0?l-e.l:r-e.r;
		}
	}

    static class Segment implements Comparable<Segment> {
		long l, r, initialIndex;
		Segment () {}
		Segment (long l_, long r_, long d_) {
		    this.l = l_;
		    this.r = r_;
		    this.initialIndex = d_;
		}
		@Override
		public int compareTo(Segment o) {
		    return (int)((l - o.l) !=0 ? l-o.l : initialIndex - o.initialIndex);
		}
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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());
        }
        String nextLine() {
            String s="";
            try {
                s=br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }
    }

    // Functions
	static long gcd(long a, long b) {
		return b==0?a:gcd(b,a%b);
	}
	static int gcd(int a, int b) {
		return b==0?a:gcd(b,a%b);
	}

	void reverse(long[] A,int l,int r) {
        int i=l,j=r-1;
        while(i<j) {
            long t=A[i];
            A[i]=A[j];
            A[j]=t;
            i++;j--;
        }
    }
    void reverse(int[] A,int l,int r) {
        int i=l,j=r-1;
        while(i<j) {
            int t=A[i];
            A[i]=A[j];
            A[j]=t;
            i++;j--;
        }
    }

    //Input Arrays
    static void input(long a[], int n) {
		for(int i=0;i<n;i++) {
			a[i]=inp.nextLong();
		}
	}
	static void input(int a[], int n) {
		for(int i=0;i<n;i++) {
			a[i]=inp.nextInt();
		}
	}
	static void input(String s[],int n) {
		for(int i=0;i<n;i++) {
			s[i]=inp.next();
		}
	}
	static void input(int a[][], int n, int m) {
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				a[i][j]=inp.nextInt();
			}
		}
	}
	static void input(long a[][], int n, int m) {
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				a[i][j]=inp.nextLong();
			}
		}
	}

}

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


Question:
// No sorceries shall previal. //
import java.io.*;
import java.util.*;

public class _InVoker_ {
	static long mod = 1000000007;
	static long mod2 = 998244353;
    public static void sort(long arr[], int start, int end) {
		if(start>=end)
			return;
		int mid=(start+end)/2;
		sort(arr,start,mid);
		sort(arr,mid+1,end);
		merge(arr,start,mid,end);
	}
	private static void merge(long arr[], int start, int mid, int end) {
		int i, j=mid+1,c=0;
		long temp[]= new long[end-start+1];
		for(i=start;i<=mid && j<=end;c++) {
			if(arr[i]<=arr[j]) {
				temp[c]=arr[i];
				i++;
			}
			else {
				temp[c]=arr[j];
				j++;
			}
		}
		while(i<=mid) {
			temp[c]=arr[i];
			i++;c++;
		}
		while(j<=end) {
			temp[c]=arr[j];
			j++;c++;
		}
		c=0;
		for(i=start;i<=end;i++,c++)
			arr[i]=temp[c];
	}
	static long gcd(long a, long b) {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }
	static int gcd(int a, int b) {
	      if (b == 0)
	        return a;
	      return gcd(b, a % b);
	    }

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

    	String s=inp.next();
    	int n=s.length();
    	out.println(s.charAt(2)==s.charAt(3) && s.charAt(4)==s.charAt(5)?"Yes":"No");

    	inp.close();
    	out.close();
    }
}

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


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

public class Main {

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

	public Main() {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt(), M = sc.nextInt(), A[] = new int[M], B[] = new int[M];
		for (int i = 0;i < M;++ i) {
			A[i] = sc.nextInt() - 1;
			B[i] = sc.nextInt() - 1;
		}
		UnionFindTree unionFind = new UnionFindTree(N);
		long ans[] = new long[M];
		ans[M] = (long)N * (N - 1) / 2;
		for (int i = M - 1;i > 0;-- i) {
			ans[i] = ans[i + 1];
			if (!unionFind.isUnion(A[i], B[i])) {
				ans[i] -= (long)unionFind.getSize(A[i]) * unionFind.getSize(B[i]);
				unionFind.unite(A[i], B[i]);
			}
		}
		for (int i = 1;i <= M;++ i) out.println(ans[i]);
		out.flush();
	}

	/**
	 * 素集合データ構造です。

	 * 連結成分の個数や大きさを取得することができます。
	 * @author 31536000
	 */
	public class UnionFindTree {
		private int[] parent; // 負ならばデータ数、正ならば親のindex

		/**
		 * size個の頂点を持つ森を作ります。
		 * @param size 頂点数
		 */
		public UnionFindTree(int size) {
			this.parent = new int[size];
			Arrays.fill(this.parent, -1);
		}

		/**
		 * その頂点がどの頂点を根とする連結成分に属しているかを求めます。

		 * 計算量はO(α(N))です。
		 * @param n 根を求めたい頂点
		 * @return 根となっている頂点
		 */
		public int find(int n) {
			while(parent[n] >= 0 && parent[parent[n]] >= 0) n = parent[n] = parent[parent[n]]; // 経路圧縮
			return parent[n] >= 0 ? parent[n] : n;
		}

		/**
		 * 指定した頂点同士を連結します。

		 * 計算量はO(α(N))です。
		 * @param l 連結したい頂点
		 * @param r 連結したい頂点
		 * @return この関数によって連結されたならtrue、既に連結だったならfalse
		 */
		public boolean unite(int l, int r) {
			l = find(l);
			r = find(r);
			if (l == r) return false; // 最初から連結
			if (parent[l] >= parent[r]) { // rの方が大きい
				parent[r] += parent[l]; // 大きい方へ小さい方をマージする
				parent[l] = r;
			} else {
				parent[l] += parent[r]; // 大きい方へ小さい方をマージする
				parent[r] = l;
			}
			return true;
		}

		/**
		 * 指定した2個の頂点が連結か判定します。

		 * 計算量はO(α(N))です。
		 * @param l 判定したい頂点
		 * @param r 判定したい頂点
		 * @return lとrが連結ならばtrue
		 */
		public boolean isUnion(int l, int r) {
			return find(l) == find(r);
		}

		/**
		 * 指定した頂点を含む連結成分の要素数を求めます。

		 * 計算量はO(α(N))です。
		 * @param n 要素数を求めたい連結成分の要素
		 * @return 頂点nを含む連結成分の要素数
		 */
		public int getSize(int n) {
			return -parent[find(n)];
		}

		/**
		 * 連結成分の個数を求めます。

		 * 計算量はO(N)です。
		 * @return 連結成分の個数
		 */
		public int getUnion() {
			int ret = 0;
			for (int i : parent) if (i < 0) ++ ret;
			return ret;
		}
	}
	public class FastScanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int read = 0;
		private int length = 0;

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

		private int readByte() {
			return hasNextByte() ? buffer[read++] : -1;
		}

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

		private boolean isNumber(int c) {
			return '0' <= c && c <= '9';
		}

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

		public char nextChar() {
			if (!hasNextByte())  throw new NoSuchElementException();
			return (char)readByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b;
			while (isPrintableChar(b = readByte())) sb.appendCodePoint(b);
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (!isNumber(b)) throw new NumberFormatException();
			while (true) {
				if (isNumber(b)) {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) return minus ? -n : n;
				else throw new NumberFormatException();
				b = readByte();
			}
		}

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

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

		public int[] nextInt(int width) {
			int[] ret = new int[width];
			for (int i = 0;i < width;++ i) ret[i] = nextInt();
			return ret;
		}

		public long[] nextLong(int width) {
			long[] ret = new long[width];
			for (int i = 0;i < width;++ i) ret[i] = nextLong();
			return ret;
		}

		public int[][] nextInt(int width, int height) {
			int[][] ret = new int[height][width];
			for (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[j][i] = nextInt();
			return ret;
		}

		public long[][] nextLong(int width, int height) {
			long[][] ret = new long[height][width];
			for (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[j][i] = nextLong();
			return ret;
		}
	}
}

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


Question:
#include<iostream>
using namespace std; // 575

const int MAX = 10;
int main() {
	int N, L;
	cin >> N >> L;
	int big = L, sum = L;
	for (int i = 1;i < N;++ i) {
		cin >> L;
		big = max(big, L);
		sum += L;
	}
	cout << (big * 2 < sum ? "Yes" : "No");
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

なんで問題文中に解き方書いてんのこれ
*/

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


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

public class Main {

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

	public Main() {
		FastIO io = new FastIO();
		int[] v = io.nextInt(io.nextInt());
		int[] count = new int[100000];
		Arrays.fill(count, 0);
		for (int i = 0;i < v.length;i += 2) ++ count[v[i]];
		int max1_1 = 0, num1_1 = 0, max1_2 = 0, num1_2 = 0, max2_1 = 0, num2_1 = 0, max2_2 = 0, num2_2 = 0;
		for (int i = 0;i < count.length;++ i) {
			if (count[i] > max1_1) {
				max1_2 = max1_1;
				num1_2 = num1_1;
				max1_1 = count[i];
				num1_1 = i;
			} else if (count[i] > max1_2) {
				max1_2 = count[i];
				num1_2 = i;
			}
		}
		Arrays.fill(count, 0);
		for (int i = 1;i < v.length;i += 2) ++ count[v[i]];
		for (int i = 0;i < count.length;++ i) {
			if (count[i] > max2_1) {
				max2_2 = max2_1;
				num2_2 = num2_1;
				max2_1 = count[i];
				num2_1 = i;
			} else if (count[i] > max2_2) {
				max2_2 = count[i];
				num2_2 = i;
			}
		}
		if (num1_1 != num2_1) io.print(v.length - max1_1 - max2_1);
		else io.print(v.length - Math.max(max1_1 + max2_2, max1_2 + max2_1));
		io.flush();
	}

	public class FastIO {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int read = 0;
		private int length = 0;
		public final PrintWriter out = new PrintWriter(System.out, false);
		public final PrintWriter err = new PrintWriter(System.err, false);

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

		private int readByte() {
			return hasNextByte() ? buffer[read++] : -1;
		}

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

		private boolean isNumber(int c) {
			return '0' <= c && c <= '9';
		}

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

		public char nextChar() {
			if (!hasNextByte())  throw new NoSuchElementException();
			return (char)readByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b;
			while (isPrintableChar(b = readByte())) sb.appendCodePoint(b);
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (!isNumber(b)) throw new NumberFormatException();
			while (true) {
				if (isNumber(b)) {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) return minus ? -n : n;
				else throw new NumberFormatException();
				b = readByte();
			}
		}

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

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

		public int[] nextInt(int width) {
			int[] ret = new int[width];
			for (int i = 0;i < width;++ i) ret[i] = nextInt();
			return ret;
		}

		public long[] nextLong(int width) {
			long[] ret = new long[width];
			for (int i = 0;i < width;++ i) ret[i] = nextLong();
			return ret;
		}

		public int[][] nextInt(int width, int height) {
			int[][] ret = new int[height][width];
			for (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[i][j] = nextInt();
			return ret;
		}

		public long[][] nextLong(int width, int height) {
			long[][] ret = new long[height][width];
			for (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[j][i] = nextLong();
			return ret;
		}

		public boolean[] nextBoolean(char T) {
			char[] s = next().toCharArray();
			boolean[] ret = new boolean[s.length];
			for (int i = 0;i < ret.length;++ i) ret[i] = s[i] == T;
			return ret;
		}

		@Override
		protected void finalize() throws Throwable {
			try {
				super.finalize();
			} finally {
				in.close();
				out.close();
				err.close();
			}
		}

		public void print(boolean b) {
			out.print(b);
		}

		public void print(char c) {
			out.print(c);
		}

		public void print(char[] s) {
			out.print(s);
		}

		public void print(double d) {
			out.print(d);
		}

		public void print(float f) {
			out.print(f);
		}

		public void print(int i) {
			out.print(i);
		}

		public void print(long l) {
			out.print(l);
		}

		public void print(Object obj) {
			out.print(obj);
		}

		public void print(String s) {
			out.print(s);
		}

		public void printf(String format, Object... args) {
			out.printf(format, args);
		}

		public void printf(Locale l, String format, Object... args) {
			out.printf(l, format, args);
		}

		public void println() {
			out.println();
		}

		public void println(boolean b) {
			out.println(b);
		}

		public void println(char c) {
			out.println(c);
		}

		public void println(char[] s) {
			out.println(s);
		}

		public void println(double d) {
			out.println(d);
		}

		public void println(float f) {
			out.println(f);
		}

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

		public void println(long l) {
			out.println(l);
		}

		public void println(Object obj) {
			out.println(obj);
		}

		public void println(String s) {
			out.println(s);
		}

		public void flush() {
			out.flush();
			err.flush();
		}
	}
}

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


Question:
public class Main{
  public static void main(String[] args){
    int m = new java.util.Scanner(System.in).nextInt();
    int n = new java.util.Scanner(System.in).nextInt();
    int mn = m * n;
    System.out.println(mn);
  }
}

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


Question:
public class Main{
  public static void main(String[] args){
    int m = new java.util.Scanner(System.in).nextInt() * new java.util.Scanner(System.in).nextInt();
    System.out.println(m);
  }
}

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


Question:
public class Main{
  public static void main(String[] args){
    int m = new java.util.Scanner(System.in)nextInt() * new java.util.Scanner(System.in)nextInt();
    System.out.println(m);
  }
}

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


Question:
N = int(input())
ans = ''
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
            break
    else:
       N -= 26 ** i
       print(ans[::-1])

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