Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02727 (python)

Fixed submission:
x,y,a,b,c = list(map(int, input().split()))

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p_rev = sorted(p, reverse=True)
q_rev = sorted(q, reverse=True)
pq_rev = sorted(p_rev[:x] + q_rev[:y] , reverse=True)

total = sum(sorted(pq_rev + r, reverse=True)[:x+y])
print(total)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c = list(map(int, input().split()))

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p_rev = sorted(p, reverse=True)
q_rev = sorted(q, reverse=True)
r_rev = sorted(r, reverse=True)
#print(p_rev[:x])
#print(q_rev[:y])
pq_rev = sorted(p_rev[:x] + q_rev[:y] , reverse=True)

num_r = len(r_rev)
start = len(pq_rev) - num_r

pq_cnt = 0
r_cnt = 0
total = 0
for i in range(len(pq_rev)):
  if pq_rev[pq_cnt] < r_rev[r_cnt] and r_cnt < num_r:
    total += r_rev[r_cnt]
    r_cnt += 1
  else:
    total += pq_rev[pq_cnt]
    pq_cnt += 1

print(total)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c = list(map(int, input().split()))

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p_rev = sorted(p, reverse=True)
q_rev = sorted(q, reverse=True)
r_rev = sorted(r, reverse=True)
#print(p_rev[:x])
#print(q_rev[:y])
pq_rev = sorted(p_rev[:x] + q_rev[:y] , reverse=True)

num_r = len(r_rev)
start = len(pq_rev) - num_r

pq_cnt = 0
r_cnt = 0
total = 0
for i in range(len(pq_rev)):
  if pq_rev[pq_cnt] > r_rev[r_cnt]:
    total += pq_rev[pq_cnt]
    pq_cnt += 1
  else:
    total += r_rev[r_cnt]
    r_cnt += 1
print(total)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c = list(map(int, input().split()))

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p_rev = sorted(p, reverse=True)
q_rev = sorted(q, reverse=True)
r_rev = sorted(r, reverse=True)
#print(p_rev[:x])
#print(q_rev[:y])
pq_rev = sorted(p_rev[:x] + q_rev[:y] , reverse=True)

num_r = len(r_rev)
start = len(pq_rev) - num_r
total = sum(pq_rev[:(-1)*num_r])
#print(total)
pq_cnt=0
r_cnt = 0
for i in range(num_r):
  if pq_rev[start + pq_cnt] > r_rev[r_cnt]:
    total += pq_rev[start + pq_cnt]
    pq_cnt += 1
  else:
    total += r_rev[r_cnt]
    r_cnt += 1
print(total)
Problem p02923 (python)

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
h=[0]*N
count=0
for i in range(1,N):
    if H[i-1]>=H[i]:
        count+=1
    else:
        count=0
    h[i]=count
print(max(h))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(i) for i in  input().split()]
length = len(H)
h = [0]*length
def z_counter(start):
  cnt = 0
  for i in range(start+1, length):
    if H[i] <= H[i-1]:
      cnt += 1
    else:
      break
  return cnt
for i in range(1, length):
  h[i] = z_counter(i)
  ans = max(h)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(i) for i in  input().split()]
length = len(H)
def z_counter(start):
  cnt = 0
  for i in range(start+1, length):
    if H[i] <= H[i-1]:
      cnt += 1
    else:
      break
  return cnt
ans = []
for i in range(1, length):
  ans.append(z_counter(i))

print(max(ans))
Problem p03486 (python)

Fixed submission:
s = input()
s_dash = sorted(s)
#print(s_dash)

t = input()
t_dash = sorted(t, reverse=True)
#print(t_dash)

if s_dash < t_dash:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S, T = [input() for _ in range(2)]

S = sorted(S)
T = sorted(T)
print(S,T)
flg = False
if len(S) < len(T):
  flg =True
      
if len(S) == len(T):
  for i in range(len(S)):
    if T[i] > s[i]:
      print("T>S")
      flg =True
    
if flg:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S, T = [input() for _ in range(2)]

S = sorted(S)
T = sorted(T)
print(S,T)
flg = False
if len(S) < len(T):
  for i, s in enumerate(S):
    print(T[i], s)
    if T[i] <= s:
      #print("T>S")      
      flg = True
      
if len(S) == len(T):
  for i, s in enumerate(S):
    if T[i] < s[i]:
      #print("T>S")
      flg =True
    
if flg:
  print('Yes')
else:
  print('No')
Problem p03796 (python)

Fixed submission:
import math
print(math.factorial(int(input())) % (10**9 +7))

Buggy submission (verdict: Runtime Error):
import math
print(math.factorial(int(input())) /(10**9 +7))
Problem p04044 (python)

Fixed submission:
N, L = map(int, input().split())
S = []
for i in range(N):
    line = input()
    S.append(line)
S.sort()
print("".join(S))

Buggy submission (verdict: Runtime Error):
L, N = list(map(int, input().split()))
S = [str(input()) for _ in range(N)]

#print(S)
S = sorted(S)
#print("sorted", S)
total = "".join(S)
print(total)

Buggy submission (verdict: Runtime Error):
L, N = list(map(int, input().split()))
S = [str(input()) for _ in range(N)]

#print(S)
S = sorted(S)
#print("sorted", S)

total = ''
for i in range(len(S)):
  total += str(S[i])

print(total)

Buggy submission (verdict: Runtime Error):
L, N = list(map(int, input().split()))
S = [input() for _ in range(N)]

#print(S)
S = sorted(S)
#print("sorted", S)

total = ''
for i in range(len(S)):
  total += S[i]

print(total)
Problem p02639 (python)

Fixed submission:
print(list(map(int,input().split())).index(0)+1)

Buggy submission (verdict: Runtime Error):
from itertools import *
X,Y = map(int,input().split())
if X*2 == Y:
    print("Yes")
elif X*4 == Y:
    print("Yes")
else:
    tmp = [2 for i in range(25)]+[4 for i in range(25)]
    li = set(combinations(tmp,X))
    for i in li:
        if sum(i) == Y:
            print("Yes")
            exit()
    print("No")

Buggy submission (verdict: Runtime Error):
from itertools import *
X,Y = map(int,input().split())
if X*2 == Y:
    print("Yes")
elif X*4 == Y:
    print("Yes")
else:
    tmp = [2 for i in range(20)]+[4 for i in range(20)]
    li = set(combinations(tmp,X))
    for i in li:
        if sum(i) == Y:
            print("Yes")
            exit()
    print("No")
Problem p02657 (python)

Fixed submission:
a,b = map(int,input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int,input().split()))
mul = eval('*'.join([str(n) for n in arr]))
print("-1" if mul > (10**18) else mul)
Problem p02658 (python)

Fixed submission:
N = int(input())
arr = list(map(int,input().split()))

if 0 in arr:
    print(0)
else:
    r = 1
    for i in arr:
        if r*i > 10**18:
            print(-1)
            exit()
        r *= i
    print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int,input().split()))
mul = eval('*'.join([str(n) for n in arr]))
print("-1" if mul > (10**18) else mul)
Problem p02687 (python)

Fixed submission:
print('ABC' if input()=='ARC' else 'ARC')

Buggy submission (verdict: Runtime Error):
1print('ABC' if input()=='ARC' else 'ARC')
Problem p03031 (python)

Fixed submission:
n, m = map(int, input().split())
s = []
k = []
for i in range(m):
    ipt = list(map(int, input().split()))
    k.append(ipt[0])
    s.append(ipt[1:])
p = list(map(int, input().split()))
cnt = 0
for sw in (list(format(i, '0{}b'.format(n))) for i in range(2 ** n)):
    for i in range(m):
        if sum([int(sw[j - 1]) for j in s[i]]) % 2 != p[i]:
            break
    else:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
s = []
k = []
for i in range(m):
    ipt = list(map(int, input().split()))
    k.append(ipt[0])
    s.append(ipt[1:])
p = list(map(int, input().split()))
cnt = 0
for sw in (list(format(i, f'0{n}b')) for i in range(2 ** n)):
    for i in range(m):
        if sum([int(sw[j - 1]) for j in s[i]]) % 2 != p[i]:
            break
    else:
        cnt += 1
print(cnt)
Problem p02616 (python)

Fixed submission:
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
MOD = 10 ** 9 + 7
s, t = [], []  # 正、負の配列
for i in a:
  if i < 0:
    t.append(i)
  else:
    s.append(i)
S, T = len(s), len(t)
is_positive = False  # 積が正である
if S > 0:
  # 正の数が0より大きい
  if n == k:
    # nとkが同じ
    is_positive = (T % 2 == 0) # 負の数が偶数個のとき、積は正
  else:
    is_positive = True
else:
  is_positive = (k % 2 == 0)

ans = 1
if not is_positive:
  a.sort(key=abs)
  for i in range(k):
    ans = ans * a[i] % MOD
else:
  s.sort()
  t.sort(reverse=True)
  if k % 2 == 1:
    ans = ans * s.pop(-1) % MOD
  p = []
  while(len(s) >= 2):
    x = s.pop(-1)
    x *= s.pop(-1)
    p.append(x)
  while(len(t) >= 2):
    x = t.pop(-1)
    x *= t.pop(-1)
    p.append(x)
  p.sort(reverse=True)
  for i in range(k // 2):
    ans = ans * p[i] % MOD
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
from functools import reduce
MOD = 10 ** 9 + 7
N, K = map(int, input().split())
A = [int(_) for _ in input().split()]
C = [list(i) for i in itertools.combinations(A, K)]
digits = [[] for i in range(len(C))]
for i, v in enumerate(C): 
  for j in v: 
    digits[i].append(len(str(abs(j))))
max_digits = max([reduce(lambda x, y: x+y, j) for j in digits])
res = [reduce(lambda x, y: x*y%MOD, j) for j in C]
res = [i for i in res if len(str(i)) <= max_digits]
ans = max(res)
if ans < 0:
  print(ans % MOD)
else:
  print(ans)
Problem p02646 (python)

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if V - W > 0:
  if abs(B - A) - T * abs(V - W) <= 0:
    result = "YES"
  else:
    result = "NO"
else:
  result = "NO"
print(result)

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if A > B:
  result = "NO"
else:
  if V - W > 0:
    if B - A - T * (V - W) <= 0:
      if 
    else:
      result = "NO"
  else:
    result = "NO"
print(result)

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if A > B:
  result = "YES"
elif A == B:
  result = "YES"
else:
  if V - W > 0:
    for i in range(1, T + 1):
      if B - A - i * (V - W) == 0:
        result = "YES"
        break
  else:
    result = "NO"
print(result)
Problem p02690 (python)

Fixed submission:
X = int(input())
M = []
for i in range(120):
    M.append(i**5)
for i in range(120):
    for j in range(120):
      if(M[i] - M[j] == X):
          A = i
          B = j
      elif(M[i] + M[j] == X):
          A = i
          B = -1*j

print(A,B)

Buggy submission (verdict: Runtime Error):
X = int(input())
M = []
for i in range(119):
    M.append(i**5)
for i in range(119):
    for j in range(119):
      if(M[i] - M[j] == X):
          A = i
          B = j
      elif(M[i] + M[j] == X):
          A = i
          B = -1*j

print(A,B)
Problem p02718 (python)

Fixed submission:
N,M = map(int,input().split())
li = list(map(int,input().split()))
x = sum(li) / (4*M)

l = [i for i in li if i >= x]
if len(l) >= M:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
li = list(map(int,input().split()))
x = sum(li) * 1/(4*M)
li.sort(reverse=True)

l = [i for i in li if i > x]
if M > len(l):
    print("No")
else:
    print("Yes")
Problem p02641 (python)

Fixed submission:
import numpy as np
x,n =map(int,input().split())

if  n==0:
 print(x)
else:
 P =list(map(int,input().split()))
 for i in range(100):
  if  (x-i) not in P:
   print(x-i)
   break
  elif (x+i) not in P:
   print(x+i)
   break

Buggy submission (verdict: Runtime Error):
import numpy as np
x,n =map(int,input().split())

if  n==0:
 print(x)
else:
 P =list(map(int,input().split()))
 l = list(range(2*x))
 result = list(set(l) - set(P))
 abs = list(np.abs(np.array(result)-x))
 abs.remove(0)
 min = min(abs)
 print(abs)
 print(result[abs.index(min)])
Problem p02801 (python)

Fixed submission:
print(chr(ord(input())+1))

Buggy submission (verdict: Runtime Error):
n,k,m = map(int,input().split())
a = list(map(int,input().split()))

t = n*m - sum(a)
if 0<=t<=k:
 print(t)
if  k<t:
 print(-1)
else:
 print(0
Problem p02817 (python)

Fixed submission:
S,T = input().split()
print(T+S)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
 
if A >= K:
  print (A - K, B)
else:
  print (0, max(0, B - (K - A)))

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
if a>=k:
 print(a-k,b)
elif a+b<=k:
 print(0,0)
else:
 print(0,b-k+a)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
print(T+S)
Problem p02885 (python)

Fixed submission:
a,b = map(int,input().split())
print(a-b*2 if a-b*2>=0 else 0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(a-b*2 if a-b*2>=0 0 else)
Problem p02678 (python)

Fixed submission:
from collections import deque
n,m=map(int,input().split())
root=[[] for _ in range(n)]
for i in range(m):
	a,b=map(int,input().split())
	root[a-1].append(b-1)
	root[b-1].append(a-1)
times=[0]*n
sign=[-1]*n
sign[0]=0
color=[False]*n
que=deque([0])
while que: #qが空でないのはこう表現できる
	i=que.popleft()
	if color[i]==False:
		for edge in root[i]:
			if color[edge]==False and sign[edge]==-1: #相方が親じゃなければ(親ならすでに探索済みのはず)
				sign[edge]=i
				que.append(edge)
		color[i]=True
print('Yes')
for i in range(n-1):
	print(sign[i+1]+1)

Buggy submission (verdict: Runtime Error):
#from collections import deque
n,m=map(int,input().split())
root=[[] for _ in range(m)]
for i in range(m):
	a,b=map(int,input().split())
	root[a-1].append(b-1)
	root[b-1].append(a-1)
times=[0]*n
sign=[-1]*n
sign[0]=0
#q=deque(root[0])
flag=0
a=root[0]
b=[]
f=False
while True:
	for i in a:
		if sign[i]==-1:
			sign[i]=flag
			b.extend(root[i])
			f=True
	flag=i
	a=b
	b=[]
	if f==False:
		break
	f=False
for i in range(n-1):
	print(sign[i+1]+1)
Problem p02683 (python)

Fixed submission:
n,m,x=map(int,input().split())
c=[]
a=[]
for i in range(n):
	C,*A=map(int,input().split())
	c.append(C)
	a.append(A)

ans=[]
for i in range(2**n):
	A=[0]*m
	C=0
	lst=list(map(int,format(i,'b').zfill(n)))
	for j in range(n):
		if lst[j]==1:
			C+=c[j]
			for k in range(m):
				A[k]+=a[j][k]
	if all(elem>=x for elem in A):
		ans.append(C)
if len(ans):
	print(min(ans))
else:
	print(-1)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
c=[]
a=[]
for i in range(m):
	C,*A=map(int,input().split())
	c.append(C)
	a.append(A)

ans=[]
for i in range(2**n):
	A=[0]*m
	C=0
	lst=list(map(int,format(i,'b').zfill(n)))
	for j in range(m):
		if lst[j]==1:
			C+=c[j]
			for k in range(m):
				A[k]+=a[j][k]
	if all(elem>=x for elem in A):
		ans.append(C)
if len(ans):
	print(min(ans))
else:
	print(-1)
Problem p02684 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0
for i in range(k):
	now=a[now]
	if town[now]==1:
		memo=now
		b=1
		break
	lst.append(now)
	town[now]=1
if b==1:
	i=lst.index(memo)
	l=len(lst)
	if memo!=0:
		lst=lst[i:]
		l-=len(lst)
		print(lst[(k-l)%len(lst)]+1)
	else:
		print(lst[k%l]+1)
else:
	print(now+1)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0
for i in range(k):
	now=a[now]
	if town[now]==1:
		memo=now
		b=1
		break
	lst.append(now)
	town[now]=1
if b==1:
	i=a.index(memo)
	l=len(lst)
	if memo!=0:
		lst=lst[i:]
		l-=len(lst)
		print(lst[(k-l)%len(lst)]+1)
	else:
		print(lst[k%l]+1)

else:
	print(now+1)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0
for i in range(k):
	now=a[now]
	if town[now]==1:
		memo=now
		b=1
		break
	lst.append(now)
	town[now]=1
if b==1:
	i=a.index(memo)
	l=len(lst)
	if memo!=0:
		lst=lst[i:]
	print(lst[(k+len(lst)-l)%len(lst)]+1)
else:
	print(now+1)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0
for i in range(k):
	now=a[now]
	if town[now]==1:
		memo=now
		b=1
		break
	lst.append(now)
	town[now]=1
if b==1:
	i=a.index(memo)
	l=len(lst)
	if memo!=0:
		lst=lst[i:]
	print(lst[(k-l)%len(lst)]+1)
else:
	print(now)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
for i in range(k):
	now=a[now]
	if town[now]==1:
		memo=now
		break
	lst.append(now)
	town[now]=1
i=a.index(memo)
l=len(lst)
if memo!=0:
	lst=lst[i:]
print(lst[(k-l)%len(lst)]+1)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
for i in range(k):
	now=a[now]
	if now in lst:
		memo=now
		break
	lst.append(now)
i=a.index(memo)
l=len(lst)
if memo!=0:
	lst=lst[i:]
print(lst[(k-l)%len(lst)]+1)
Problem p02692 (python)

Fixed submission:
n,*abc=map(int,input().split())
ip=[0]*n
for i in range(n):
	tmp=input()
	if tmp=="AB":
		ip[i]=[0,1]
	elif tmp=="BC":
		ip[i]=[1,2]
	else:
		ip[i]=[0,2]
ans="Yes"
res=[0]*n
s=sum(abc)
if s==0:
	ans="No"
elif s==1:
	for i in range(n):
		i1=ip[i][0]
		i2=ip[i][1]
		if abc[i1]+abc[i2]==0:
			ans="No"
		elif abc[i1]+abc[i2]==1:
			if abc[i1]==0:
				abc[i1]+=1
				abc[i2]-=1
				res[i]=i1
			else:
				abc[i1]-=1
				abc[i2]+=1
				res[i]=i2
else:
	i1=ip[0][0]
	i2=ip[0][1]
	if abc[i1]+abc[i2]==0:
		ans="No"
	else:
		for i in range(n):
			i1=ip[i][0]
			i2=ip[i][1]
			if abc[i1]*abc[i2]==0:
				if abc[i1]==0:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			elif i+1<n and ip[i+1]!=ip[i]:
				c=list(set(ip[i])&set(ip[i+1]))[0]
				if i1==c:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			else:
				if abc[i1]>=abc[i2]:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
print(ans)
if ans=="Yes":
	for i in range(n):
		if res[i]==0:
			print("A")
		elif res[i]==1:
			print("B")
		else:
			print("C")

Buggy submission (verdict: Runtime Error):
n,*abc=map(int,input().split())
ip=[0]*n
for i in range(n):
	tmp=input()
	if tmp=="AB":
		ip[i]=[0,1]
	elif tmp=="BC":
		ip[i]=[1,2]
	else:
		ip[i]=[0,2]
ans="Yes"
res=[0]*n
s=sum(abc)
if s==0:
	ans="No"
elif s==1:
	for i in range(n):
		i1=ip[i][0]
		i2=ip[i][1]
		ABC=(i1,i2)
		if ABC==(0,0):
			ans="No"
		'''
		if abc[i1]+abc[i2]==0:
			ans="No"
		'''
		elif abc[i1]+abc[i2]==1:
			if abc[i1]==0:
				abc[i1]+=1
				abc[i2]-=1
				res[i]=i1
			else:
				abc[i1]-=1
				abc[i2]+=1
				res[i]=i2
else:
	i1=ip[0][0]
	i2=ip[0][1]
	if abc[i1]+abc[i2]==0:
		ans="No"
	else:
		for i in range(n):
			i1=ip[i][0]
			i2=ip[i][1]
			if abc[i1]*abc[i2]==0:
				if abc[i1]==0:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			elif i+1<n and ip[i+1]!=ip[i]:
				c=list(set(ip[i])&set(ip[i+1]))[0]
				if i1==c:
					abc[i1]+=1
					abc[i2]-=1
					res[i]=i1
				else:
					abc[i1]-=1
					abc[i2]+=1
					res[i]=i2
			else:
				abc[i1]+=1
				abc[i2]-=1
				res[i]=i1
print(ans)
dic={0:"A",1:"B",2:"C"}
if ans=="Yes":
	for i in range(n):
		print(dic[res[i]])
		'''
		if res[i]==0:
			print("A")
		elif res[i]==1:
			print("B")
		else:
			print("C")
		'''
Problem p02804 (python)

Fixed submission:
def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)

    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac
    
n,k=map(int,input().split())
a=sorted(list(map(int, input().split())))
MOD=10**9+7

fac, ifac=make_tables(MOD,n)

s=0
for i in range(k-1,n):
	s+=(a[i]-a[n-i-1])*cmb(i,k-1,MOD,fac,ifac)
	s%=10**9+7
print(s)

Buggy submission (verdict: Runtime Error):
from math import factorial

n,k=map(int,input().split())
a=sorted(list(map(int, input().split())))
s=0

for i in range(n-k+1):
	for j in range(i+k-1,n):
		s+=(a[j]-a[i])*factorial(j-i-1)//factorial(k-2)//factorial(j-i-k+1)
		s%=10**9+7
print(s)
Problem p02817 (python)

Fixed submission:
s,t=input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
if a<k:
	b=max(b-(k-a),0)
	a=0
else:
	a=a-k
print(a,end=' ')
print(b)
Problem p02883 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int, input().split()))
f=list(map(int, input().split()))
a.sort()
f.sort(reverse=True)

maxaf=a[0]*f[0]
for i in range(n):
	if a[i]*f[i]>maxaf:
		maxaf=a[i]*f[i]

def solve(x):
	total=0
	for i in range(n):
		total+=max(0,a[i]-x//f[i]) #負になりうる懸念ができていなかった、とほほ
	return total<=k

#xの範囲 ngは実現が難しい方
ok=maxaf
ng=-1

while ok-ng>1:
	mid=(ok+ng)//2
	if solve(mid):
		ok=mid
	else:
		ng=mid
print(ok)

Buggy submission (verdict: Runtime Error):
import numpy as np

n,k=map(int,input().split())
a=list(map(int, input().split()))
f=list(map(int, input().split()))
a.sort()
f.sort(reverse=True)

maxaf=a[0]*f[0]
for i in range(n):
	if a[i]*f[i]>maxaf:
		maxaf=a[i]*f[i]

def solve(x):
	total=0
	for i in range(n):
		total+=max(0,a[i]-x//f[i]) #負になりうる懸念ができていなかった、とほほ
	return total<=k

#xの範囲 ngは実現が難しい方
ok=maxaf
ng=-1

while ok-ng>1:
	mid=(ok+ng)//2
	if solve(mid):
		ok=mid
	else:
		ng=mid
print(ok)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int, input().split()))
f=list(map(int, input().split()))
a.sort()
f.sort(reverse=True)

maxaf=a[0]*f[0]
for i in range(n):
	if a[i]*f[i]>maxaf:
		maxaf=a[i]*f[i]

def solve(x):
	total=0
	for i in range(n):
		total+=max(0,a[i]-x//f[i]) //負になりうる懸念ができていなかった、とほほ
	return total<=k

#xの範囲 ngは実現が難しい方
ok=maxaf
ng=-1

while ok-ng>1:
	mid=(ok+ng)//2
	if solve(mid):
		ok=mid
	else:
		ng=mid
print(ok)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int, input().split()))
f=list(map(int, input().split()))
a.sort()
f.sort(reverse=True)

maxaf=a[0]*f[0]
for i in range(n):
	if a[i]*f[i]>maxaf:
		maxaf=a[i]*f[i]

def solve(x):
	total=0
	for i in range(n):
		total+=max(a[i]-x//f[i])
	return total<=k

#xの範囲 ngは実現が難しい方
ok=maxaf
ng=-1

while ok-ng>1:
	mid=(ok+ng)//2
	if solve(mid):
		ok=mid
	else:
		ng=mid
print(ok)
Problem p02922 (python)

Fixed submission:
a,b = list(map(int, input().split()))
i=0
while b>(a-1)*i+1:
	i+=1
print(i)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
c=(b-1)//a+1
print(c)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
print((b-1)//a+1)

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
print((b+1)//a)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
print((b+1)//a)

Buggy submission (verdict: Runtime Error):
a,b=input.split
print((b+1)//a)
Problem p02945 (python)

Fixed submission:
a,b = map(int, input().split())
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
print(max(a+b,a-b,a*b)
Problem p02982 (python)

Fixed submission:
n, d = map(int, input().split())
x = [[int(i) for i in input().split()] for i in range(n)] 
dist2 = 0
count = 0
for i in range(n-1):
    for j in range(i+1,n):
        for k in range(d):
            dist2 += (x[i][k]-x[j][k])**2
        dist = dist2**0.5 
        dist2=0
        if dist.is_integer():
            count += 1 
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,d=list(map(int, input().split()))
x=[list(map(int,input().split())) for i in range(n)]
y=np.array(x)
count=0
for i in range(n):
	for j in range(i+1,d):
		dist=np.linalg.norm(y[i]-y[j])
		if dist.is_integer:
			count+=1
print(count)