Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
L=[0]*N
A=0
W=0
tmp=[0]*M
for i in range(M):
	x,y=input().split()
	t=int(x)
	if L[t-1]==0:
		if y=="WA":
			tmp[t-1]+=1
		else:
			A+=1
			W+=tmp[t-1]
			L[t-1]=1
print(A,W)

Fixed submission:
from collections import defaultdict

N,M=map(int,input().split())
P=[]
S=[]
for i in range (M):
	A,B=input().split()
	P.append(int(A))
	S.append(B)
Q=defaultdict(lambda:0)
R=defaultdict(lambda:0)
count=0
for i,j in zip(P,S):
  if Q[i]==0:
    if j=="AC":
      Q[i]=1
      count+=R[i]
    elif j=="WA":
      R[i]+=1
print(sum(Q.values()),count)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())

ans = A+B+C
if ans>=22:
	print(bust)
elif ans <= 21:
	print(win)

Fixed submission:
A,B,C = map(int,input().split())
ans = A + B + C

if ans >= 22:
	print("bust")
else:
	print("win")
Buggy python submission (verdict: Runtime Error):
def nibutan(A,B,X,L,H):
	M=(H+L)//2
	tmp=A*M+B*len(str(M))
	if M == 0:
		return 0
	elif tmp==X:
		return M
	elif tmp<X:
		if M==999999999:
			return M
		else:
			return nibutan(A,B,X,M,H)
	elif tmp>X:
		tmp_2=A*(M-1)+B*len(str(M-1))
		if tmp_2<X:
			return M-1
		else:
			return nibutan(A,B,X,L,M)

A,B,X=map(int,input().split())
if X>=A*1000000000+B*10:
	print(1000000000)
else:
	ans=nibutan(A,B,X,0,1000000000)
	print(ans)



Fixed submission:
S = input()

mp = {
    'SUN':7,
    'MON':6,
    'TUE':5,
    'WED':4,
    'THU':3,
    'FRI':2,
    'SAT':1
}

print(mp[S])

Buggy python submission (verdict: Runtime Error):
def nibutan(A,B,X,L,H):
	M=(H+L)//2
	tmp=A*M+B*len(str(M))
	if M == 0:
		return 0
	elif tmp==X:
		return M
	elif tmp<X:
		if M=999999999:
			return 999999999
		else:
			return nibutan(A,B,X,M,H)
	elif tmp>X:
		tmp_2=A*(M-1)+B*len(str(M-1))
		if tmp_2<X:
			return M-1
		else:
			return nibutan(A,B,X,L,M)

A,B,X=map(int,input().split())
if X>=A*1000000000+B*10:
	print(1000000000)
else:
	ans=nibutan(A,B,X,0,1000000000)
	print(ans)



Fixed submission:
S = input()

mp = {
    'SUN':7,
    'MON':6,
    'TUE':5,
    'WED':4,
    'THU':3,
    'FRI':2,
    'SAT':1
}

print(mp[S])
Buggy python submission (verdict: Runtime Error):
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
a = ''
for item in S:
  a_index = alphabet.index(item) + n
  if a_index > 25:
    a_index = a_index - 26
  a += alphabet[a_index]
print(a)


Fixed submission:
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
a = ''
for item in S:
  a_index = alphabet.index(item) + N
  if a_index > 25:
    a_index = a_index - 26
  a += alphabet[a_index]
print(a)
Buggy python submission (verdict: Runtime Error):
import math
A = int(input())
B = int(math.sqrt(A))
count = 0
for i in reversed(range(1,B+1)):
	if count == 0:
		if A % i == 0:
			print(int(i+A/i-2))
			count += 1

Fixed submission:
A,B = map(int,input().split())
if A>0 and A<10 and B>0 and B<10:
	print(A*B)
else:
	print(-1)

Buggy python submission (verdict: Runtime Error):
A,B = map(int(input().split()))
if A>0 and A<10 and B>0 and B<10:
	print(A*B)
else:
	print(-1)

Fixed submission:
A,B = map(int,input().split())
if A>0 and A<10 and B>0 and B<10:
	print(A*B)
else:
	print(-1)
Buggy python submission (verdict: Runtime Error):
import math
A = int(input())
B = int(math.sqrt(A))
count = 0
for i in reversed(range(1,B)):
	if count == 0:
    	if A % i == 0:
			print(i+A/i-2)
        	count += 1

Fixed submission:
import math
A = int(input())
B = int(math.sqrt(A))
count = 0
for i in reversed(range(1,B+1)):
	if count == 0:
		if A % i == 0:
			print(int(i+A/i-2))
			count += 1
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
M=[0]*N
count=0
while(1):
	for i in range (N-1):
		if L[i]>L[i+1]:
			if M[i]==1:
				print("No")
				exit()
			else:
				L[i]-=1
				M[i]=1
		else:
			count+=1
	if count==(N-1):
		print("Yes")
		exit()


Fixed submission:
N=int(input())
H=list(map(int,input().split()))
M=[0]*N

while(1):
	count=0
	for i in range (N-1):
		if H[i]>H[i+1]:
			if M[i]==1:
				print("No")
				exit()
			else:
				M[i]=1
				H[i]=H[i]-1
		else:
			count+=1
	if count==N-1:
		print("Yes")
		exit()
Buggy python submission (verdict: Runtime Error):
import math 

def lcm(x,y):
	return int((x*y)/math.gcd(x,y))

A,B,C,D= map(int,input().split())
lcm = lcm(C,D)
E = int((A-1)/C)
F = int((A-1)/D)
G = int((A-1)/lcm)
H = int(B/C)
I = int(B/D)
J = int(B/lcm)

count = (B-A+1)-((H-E)+(I-F)-(J-G))

print(count)

Fixed submission:
import fractions

def lcm(x,y):
	return (x*y)//fractions.gcd(x,y)
count = 0
A,B,C,D= map(int,input().split())
lcm = lcm(C,D)
E = (A-1)//C
F = (A-1)//D
G = (A-1)//lcm
H = B//C
I = B//D
J = B//lcm

count = (B-A+1)-((H-E)+(I-F)-(J-G))

print(count)

Buggy python submission (verdict: Runtime Error):
import math 

def lcm(x,y):
	return (x*y)//math.gcd(x,y)

A,B,C,D= map(int,input().split())
lcm = lcm(C,D)
E = (A-1)//C
F = (A-1)//D
G = (A-1)//lcm
H = B//C
I = B//D
J = B//lcm

count = (B-A+1)-((H-E)+(I-F)-(J-G))

print(count)

Fixed submission:
import fractions

def lcm(x,y):
	return (x*y)//fractions.gcd(x,y)
count = 0
A,B,C,D= map(int,input().split())
lcm = lcm(C,D)
E = (A-1)//C
F = (A-1)//D
G = (A-1)//lcm
H = B//C
I = B//D
J = B//lcm

count = (B-A+1)-((H-E)+(I-F)-(J-G))

print(count)

Buggy python submission (verdict: Runtime Error):
import math 

def lcm(x,y):
	return (x*y)//math.gcd(x,y)

A,B,C,D= map(int,input().split())
lcm = lcm(C,D)
E = (A-1)//C
F = (A-1)//D
G = (A-1)//lcm
H = B//C
I = B//D
J = B//lcm

count = (B-A+1)-((H-E)+(I-F)-(J-G))

print(count)

Fixed submission:
import fractions

def lcm(x,y):
	return (x*y)//fractions.gcd(x,y)
count = 0
A,B,C,D= map(int,input().split())
lcm = lcm(C,D)
E = (A-1)//C
F = (A-1)//D
G = (A-1)//lcm
H = B//C
I = B//D
J = B//lcm

count = (B-A+1)-((H-E)+(I-F)-(J-G))

print(count)
Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
tmp=0
ans=1
for i in range(N):
	tmp+=L[i]
	if tmp>X:
		print(ans)
		exit()
	else:
		ans+=1
print(ans)

Fixed submission:
X,A = map(int,input().split())

if X<A :
	print(0)
else:
	print(10)
Buggy python submission (verdict: Runtime Error):
A = int(input())
W = list(map(int,input().split()))
tmp = 0
ans = 0
wa = 0

for i in range (A):
    wa += W[i]
for i in range (A):
    tmp += W[i]
    tmp_r = wa-tmp
    if i == 0:
        ans = tmp
    if ans > abs(tmp-tmp_r):
        ans = abs(tmp-tmp_r)
print(ans)

Fixed submission:
P,Q,R = map(int,input().split())
A = [P+Q,Q+R,P+R]
A.sort()
print(A[0])
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())
count=0
for i in range(3001):
	for j in range (3001):
		if i*R+j*G<=N:
			tmp=N-(i*R+j*G)
			if tmp%B==0:
				count+=1
print(count)

Fixed submission:
R,G,B,N=map(int,input().split())
count=0
for i in range(3001):
	for j in range (3001):
		if i*R+j*G<=N:
			tmp=N-(i*R+j*G)
			if tmp%B==0:
				count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
L=[0]*Q
P=[0]*Q
for i in range(Q):
	L[i],P[i]=map(int,input().split())
for i in range(Q):
	count=0
	D=S[L[i]-1:P[i]]
	print(D.count("AC"))

Fixed submission:
N,Q=map(int,input().split())
S=input()
X=[0]*N
for i in range(N-1):
	if S[i:i+2]=="AC":
		X[i+1]=X[i]+1
	else:
		X[i+1]=X[i]
for i in range(Q):
	L,R=map(int,input().split())
	print(X[R-1]-X[L-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
L=[0]*Q
P=[0]*Q
for i in range(Q):
	L[i],P[i]=map(int,input().split())
for i in range(Q):
	count=0
	D=S[L[i]-1:P[i]]
	for j in range(len(D)-1):
		if D[j]=="A":
			if D[j+1]=="C":
				count+=1
	print(count)

Fixed submission:
N,Q=map(int,input().split())
S=input()
X=[0]*N
for i in range(N-1):
	if S[i:i+2]=="AC":
		X[i+1]=X[i]+1
	else:
		X[i+1]=X[i]
for i in range(Q):
	L,R=map(int,input().split())
	print(X[R-1]-X[L-1])
Buggy python submission (verdict: Runtime Error):
S=input()
M=S[5]*10+S[6]
if M>4:
	print("TBD")
else:
	print("Heisei")

Fixed submission:
S=input()

M=int(S[5])*10+int(S[6])
if M>4:
	print("TBD")
else:
	print("Heisei")
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
L=[]
ans=float("inf")
for i in range (N):
	L.append(int(input()))
S=sorted(L)
for i in range(N-K+1):
	M=S[i:i+K]
	ans=min(ans,S[i+K-1]-S[i])
print(ans)


Fixed submission:
N,K=map(int,input().split())
L=[]
for i in range(N):
	L.append(int(input()))
M=sorted(L)
ans=float("inf")
for i in range(N-K+1):
	ans=min(ans,M[i+K-1]-M[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
L=[]
count=0
for i in range (N):
	L.append(int(input()))
if len(set(L))!=N:
	print("No")
else:
	for i in range (N-1):
		if L[i][-1]!=L[i+1][0]:
			count+=1
	if count==0:
		print("Yes")
	else:
		print("No")

Fixed submission:
N=int(input())
L=[]
count=0
for i in range (N):
	L.append(input())
if len(set(L))!=N:
	print("No")
else:
	for i in range (N-1):
		if L[i][-1]!=L[i+1][0]:
			count+=1
	if count==0:
		print("Yes")
	else:
		print("No")
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input(.split())
print((A-1)*(B-1))

Fixed submission:
A,B=map(int,input().split())
print((A-1)*(B-1))
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()

if S.sort()==T.sort():
	print("Yes")
else:
	print("No")

Fixed submission:
S=input()
T=input()
for i in range(len(S)):
	S=S[-1]+S[0:-1]
	if S==T:
		print("Yes")
		exit()
print("No")
Buggy python submission (verdict: Runtime Error):
D,N=map(int,input().split())
if D==0:
	if N=100:
		print(101)
	else:
		print(N)
elif D==1:
	if N=100:
		print(101*100)
	else:
		print(N*100)
	
elif D==2:
	if N=100:
		print(101*100*100)
	else:
		print(N*100*100)

Fixed submission:
D,N=map(int,input().split())
if D==0:
	if N==100:
		print(101)
	else:
		print(N)
elif D==1:
	if N==100:
		print(101*100)
	else:
		print(N*100)
	
elif D==2:
	if N==100:
		print(101*100*100)
	else:
		print(N*100*100)
Buggy python submission (verdict: Runtime Error):
A,B,C,X,Y=map(int,input().split())
if X>=Y:
	Z=A*(X-Y)
else:
	Z=B*(Y-Z)
print(min(A*X+B*Y,min(X,Y)*C+Z))

Fixed submission:
A,B,C,X,Y=map(int,input().split())
if X>=Y:
	Z=A*(X-Y)
else:
	Z=B*(Y-X)
print(min(A*X+B*Y,min(X,Y)*2*C+Z,C*max(X,Y)*2))
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C=map(int,input().split())
for i in range (A,B+1):
	if i<A+C or i>B-C:
		print(i)

Fixed submission:
A,B,C=map(int,input().split())
L=[]
for i in range (C):
	if A+i>=A and A+i<=B:
		L.append(A+i)
	if B-i>=A and B-i<=B:
		L.append(B-i)
X=sorted(set(L))
for i in range (len(X)):
	print(X[i])
Buggy python submission (verdict: Runtime Error):
N=input()
M=len(str(N))
K=int(N[0])
ans=0
for i in range (M):
	ans+=N[i]

print(max(9*(M-1)+(K-1)),ans)

Fixed submission:
N=input()
M=int(N[0:2])
L=len(N[2:])*9
K=0
sum=0
for i in range(len(N)):
	sum+=int(N[i])
K=0
if L>0:
	D=M
else:
	D=M+1
for i in range(D):
	j=str(i)
	if len(j)==1:
		K=max(K,(int(j)))
	else:
		K=max(K,(int(j[0])+int(j[1])))
print(max(sum,K+L))

Buggy python submission (verdict: Runtime Error):
N=input()
M=len(str(N))
K=int(N[0])
ans=0
for i in range (M):
	ans+=N[i]
print(max(9*(M-1)+(K-1),ans))

Fixed submission:
N=input()
M=int(N[0:2])
L=len(N[2:])*9
K=0
sum=0
for i in range(len(N)):
	sum+=int(N[i])
K=0
if L>0:
	D=M
else:
	D=M+1
for i in range(D):
	j=str(i)
	if len(j)==1:
		K=max(K,(int(j)))
	else:
		K=max(K,(int(j[0])+int(j[1])))
print(max(sum,K+L))
Buggy python submission (verdict: Runtime Error):
L=list(map(int,input().split()))
A=L[0]-L[1]
B=L[0]-L[2]
if min(A,B)=A:
	print("A")
else:
	print("B")

Fixed submission:
L=list(map(int,input().split()))
A=abs(L[0]-L[1])
B=abs(L[0]-L[2])
if min(A,B)==A:
	print("A")
else:
	print("B")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
count=0
while(1):
	#print(max(L))
	tmp=0
	if max(L)<N:
		print(count)
		exit()
	else:
		M=max(L)//N
		count+=M
		for i in range(N):
			if L[i]==max(L) and tmp==0:
				tmp=1
				L[i]-=M*N
			else:
				L[i]+=M

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
count=0
while(1):
	K=max(L)
	if max(L)<N:
		print(count)
		exit()
	else:
		tmp=0
		#print(max(L))
		M=K//N
		count+=M
		for i in range(N):
			if L[i]==K and tmp==0:
				#print(i)
				tmp=1
				L[i]=K%N
			else:
				L[i]+=M
		#print(L)
Buggy python submission (verdict: Runtime Error):
import fractions
N,K=map(int,input().split())
L=list(map(int,input().split()))
tmp=0
for i in range(1,N):
	if i==1:
		tmp=fractions.gcd(L[0],L[1])
	else:
		tmp=fractions.gcd(tmp,L[i])
if max(L)>=K and K%tmp==0:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

Fixed submission:
import fractions
N,K=map(int,input().split())
L=list(map(int,input().split()))
tmp=0
if N==1:
	if L[0]==K:
		print("POSSIBLE")
		exit()
	else:
		print("IMPOSSIBLE")
		exit()
for i in range(1,N):
	if i==1:
		tmp=fractions.gcd(L[0],L[1])
	else:
		tmp=fractions.gcd(tmp,L[i])
if max(L)>=K and K%tmp==0:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
import fractions
N,K=map(int,input().split())
L=list(map(int,input().split()))
tmp=0
for i in range(1,N):
	if i==1:
		tmp=fractions.gcd(L[0],L[1])
	else:
		tmp=fractions.gcd(tmp,L[i])
if tmp<K and K%tmp==0:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

Fixed submission:
import fractions
N,K=map(int,input().split())
L=list(map(int,input().split()))
tmp=0
if N==1:
	if L[0]==K:
		print("POSSIBLE")
		exit()
	else:
		print("IMPOSSIBLE")
		exit()
for i in range(1,N):
	if i==1:
		tmp=fractions.gcd(L[0],L[1])
	else:
		tmp=fractions.gcd(tmp,L[i])
if max(L)>=K and K%tmp==0:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
import fractions
N,K=map(int,input().split())
L=list(map(int,input().split()))
tmp=0
if max(L)<K:
	print("IMPOSSIBLE")
	exit()
for i in range(1,N):
	if i==1:
		if L[0]==K or L[i]==K:
			print("POSSIBLE")
			exit()
		tmp=fractions.gcd(L[0],L[1])
		if tmp<=K and K%tmp==0:
			print("POSSIBLE")
			exit()
	else:
		ifL[i]==K:
			print("POSSIBLE")
			exit()
		tmp=fractions.gcd(tmp,L[i])
		if tmp<=K and K%tmp==0:
			print("POSSIBLE")
			exit()
print("IMPOSSIBLE")

Fixed submission:
import fractions
N,K=map(int,input().split())
L=list(map(int,input().split()))
tmp=0
if N==1:
	if L[0]==K:
		print("POSSIBLE")
		exit()
	else:
		print("IMPOSSIBLE")
		exit()
for i in range(1,N):
	if i==1:
		tmp=fractions.gcd(L[0],L[1])
	else:
		tmp=fractions.gcd(tmp,L[i])
if max(L)>=K and K%tmp==0:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
L=list(,ap(int,input().split()))
K=sorted(L)
print(L[0]+K[1])

Fixed submission:
L=list(map(int,input().split()))
K=sorted(L)
print(K[0]+K[1])
Buggy python submission (verdict: Runtime Error):
X,A,B=map(int,input().split())
if A>=B:
	print("delicious")
elif A<B and B=<A+X:
	print("safe")
else:
	print("dangerous")

Fixed submission:
X,A,B=map(int,input().split())
if A>=B:
	print("delicious")
elif B>A and X+A>=B :
	print("safe")
else:
	print("dangerous")
Buggy python submission (verdict: Runtime Error):
A,B=map(input().split())
if A=="H":
	print(B)
else:
	if B=="H":
		print("D")
	else:
		print("H")

Fixed submission:
A,B=map(str,input().split())
if A=="H":
	print(B)
else:
	if B=="H":
		print("D")
	else:
		print("H")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
ans=1
for i in range(1,N+1):
	ans*=i

print(ans%(10**9+7))

Fixed submission:
import math
N=int(input())
ans=math.factorial(N)%(10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))
count=0
for i in range N:
	if L[i]%2==1:
		count+=1
if count%2==1:
	print("NO")
else:
	print("YES")

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
count=0
for i in range (N):
	if L[i]%2==1:
		count+=1
if count%2==1:
	print("NO")
else:
	print("YES")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
if N%2==0:
	for i in range (N):
		A[i]%2!=1:
			print(0)
			exit()
	print((2**N)%(10**9+7))
else:
	for i in range (N):
		A[i]%2!=0:
			print(0)
			exit()
	if min(A)!=0:
		print(0)
		exit()
	else:
		print((2**(N-1))%(10**9+7))

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
if N%2==0:
	for i in range (N):
		if A[i]%2 != 1:
			print(0)
			exit()
	print((2**(N//2))%(10**9+7))
else:
	for i in range (N):
		if A[i]%2!=0:
			print(0)
			exit()
	if min(A)!=0 or A.count(0)!=1:
		print(0)
		exit()
	else:
		print((2**((N-1)//2))%(10**9+7))
Buggy python submission (verdict: Runtime Error):
# S = input()
# N = int(input())
# A, B = map(int, input().split(' '))
# A = list(map(int, input().split(' ')))

A, B, C, K = map(int, input().split(' '))

card = []
a = [1]*A
b = [0]*B
c = [-1]*C

card.extend(a)
card.extend(b)
card.extend(c)


card = sorted(card, reverse=True)

print(sum(card[:K]))

Fixed submission:
# S = input()
# N = int(input())
# A, B = map(int, input().split(' '))
# A = list(map(int, input().split(' ')))

A, B, C, K = map(int, input().split(' '))
result = 0

if A < K:
  result += A
  K -= A
else:
  result = K
  K -= A

if K > 0:
  if B < K:
    K -= B
  else:
    K -= B

if K > 0:
  if C < K:
    result -= C
    K -= C
  else:
    result -= K

print(result)
Buggy python submission (verdict: Runtime Error):
X = int(input())
for A in range(0, X):
  
  A5 = A**5
  B5 = X - A5
  B = B5 ** (1/5) 
  if float.is_integer(B):
    print(A, int(B*-1))
    break
  

Fixed submission:
def calcurate(x):
  for a in range(1000):
    a5 = a**5
    for b in range(-1000, 1000):
      b5 = b**5
      if a5 - b5 == X:
        return a, b
      
if __name__ == "__main__":
  X = int(input())
  A, B = calcurate(X)
  print(A, B)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

K = int(input())
result = 0

for a in range(1, K+1):
  for b in range(1, K+1):
    temp = np.gcd.reduce([a, b])
    for c in range(1, K+1):
      result += np.gcd.reduce([temp, c])

print(result)

Fixed submission:
import math

K = int(input())
result = 0

for a in range(1, K+1):
  for b in range(1, K+1):
    temp = math.gcd(a, b)
    for c in range(1, K+1):
      result += math.gcd(temp, c)

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

K = int(input())
result = 0

for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      result += np.gcd.reduce([a, b, c])

print(result)

Fixed submission:
import math

K = int(input())
result = 0

for a in range(1, K+1):
  for b in range(1, K+1):
    temp = math.gcd(a, b)
    for c in range(1, K+1):
      result += math.gcd(temp, c)

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

K, N = map(int, input().split(' '))
A = list(map(int, input().split(' ')))

A.append(K + A[0])

diff = np.diff(A).tolist()

min_ = sum(diff)
for i in range(len(diff)):
  diff_ = diff[:]
  diff_.remove(diff[i])
  if min_ > sum(diff_):
    min_ = sum(diff_)

print(min_)  

Fixed submission:
import numpy as np

K, N = map(int, input().split(' '))
A = list(map(int, input().split(' ')))

A.append(K + A[0])

diff = np.diff(A).tolist()
diff = sorted(diff)

print(sum(diff[:-1]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split(' ')

if len(set(a)) == n:
  print('YES')
else
  print('NO')

Fixed submission:
n = int(input())
a = input().split(' ')
 
if len(set(a)) == n:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
n, m = input()

if n == m:
  print('Yes')
else:
  print('No')

Fixed submission:
n, m = input().split(' ')
 
if n == m:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
#!python3.4.3
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == "__main__":
    a, b = map(int, input().split(' '))
    
    print(lcm(a, b))



Fixed submission:
#!python3.4.3
from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

if __name__ == "__main__":
    a, b = map(int, input().split(' '))
    
    print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
#!python3.4.3

x_str = input()
x = int(x_str)

a = int(x_str[:-2])
b = int(x_str[-2:])

if a > b:
    print(1)
else:
    count = 0
    d = b
    for i in range(5, 0, -1):
        if d % i == 0:
            print(1)
            break
        c = d // i
        count += c
        if a < count:
            print(0)
            break
        d = d - c*i

Fixed submission:
#!python3.4.3

x_str = input()
x = int(x_str)

if x < 100:
    print(0)
else:
    a = int(x_str[:-2])
    b = int(x_str[-2:])

    if a > b:
        print(1)
    else:
        count = 0
        d = b
        for i in range(5, 0, -1):
            c = d // i
            count += c
            if a < count:
                print(0)
                break
            if d % i == 0:
                print(1)
                break
            d = d - c*i
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
arr = []

for i in range(n):
    arr.append(list(map(int, input().split(' '))))

arr = np.array(arr)

takahashi = 0
aoki = 0


for i in range(n):
    max_i = np.argmax(np.sum(arr, axis=1))
    if i % 2 == 0:
        takahashi += arr[max_i, 0]
    else:
        aoki += arr[max_i, 1]
    arr = np.delete(arr, max_i, axis=0)
    
print(takahashi - aoki)

Fixed submission:
import numpy as np

n = int(input())
arr = []

for i in range(n):
    arr.append(list(map(int, input().split(' '))))

arr = np.array(arr)
arr = arr[np.argsort(np.sum(arr, axis=1))[::-1]]
takahashi = np.sum(arr[::2, 0], axis=0)
aoki = np.sum(arr[1::2, 1], axis=0)

print(takahashi - aoki)
Buggy python submission (verdict: Runtime Error):
n = input()
s = [int(x) for x in input().split(' ')]
count = 0

while sum(map(lambda x: x%2, s)) == 0:
  s =list(map(lambda x: x/2, s))
  count+=1
  
print(count)

Fixed submission:
s = [int(x) for x in input()]
print(sum(s))
Buggy python submission (verdict: Time Limit Exceeded):
#!python3.4.3

n = int(input())
a_list = list(map(int, input().split(' ')))
a_list.sort()
A = 2**(n//2)%(10**9+7)

for i in range(1, n):
    c = a_list.count(i)
    if c%2 != 0:
        A = 0
        break
print(A)


Fixed submission:
#!python3.4.3

n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
# a_list.sort()

b = [abs(i) for i in range(-n+1, n, 2)]
b.sort()
if a==b:
    result = 2**(n//2)%(10**9+7)
else:
    result = 0
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
max_num=0
for i in range(n+1):
    tmp=(a*i)//b-a*(i//b)
    max_num=max(tmp,max_num)
print(max_num)

Fixed submission:
a,b,n=map(int,input().split())
if b-1<=n:
    print((a*(b-1))//b-a*((b-1)//b))
else:
    print((a * n) // b - a * (n // b))