Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(a) for a in input().split()]

result = 0
for i in range(n):
    if all([h[j] <= h[i] for j in range(i)]):
        result += 1

print(result)


Fixed submission:
a, b = [int(x) for x in input().split()]

c = max([a, b])

if c == a:
    d = max([a - 1, b])
else:
    d = max([a, b - 1])

result = c + d
print(result)
Buggy python submission (verdict: Runtime Error):
import numpy as np

def prod(p, q, r):
    return A[p] + B[q] + C[r]

x, y, z, k = [int(a) for a in input().split()]
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
C = [int(a) for a in input().split()]

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

progress = [(0, 0, 0, prod(0,0,0))]


def expand(p, q, r):
    result = []
    if p + 1 < x:
        result.append((p+1, q, r, prod(p+1, q, r)))
    if q + 1 < y:
        result.append((p, q+1, r, prod(p, q+1, r)))
    if r + 1 < z:
        result.append((p, q, r+1, prod(p, q, r+1)))
    return result

for i in range(k):
    prods = [tup[-1] for tup in progress]

    max_val = max(prods)
    max_idx = prods.index(max_val)
    p, q, r, _ = progress[max_idx]

    print(max_val)
    progress.pop(max_idx)
    progress.extend(expand(p, q, r))
    progress = list(set(progress))


Fixed submission:
a = int(input())
b = input()
c = input()
d = input()
e = int(input())
k = int(input())

if e - a > k:
  print(':(')
else:
  print('Yay!')
Buggy python submission (verdict: Time Limit Exceeded):
r,g,y,n=map(int,input().split())
a=0
b=0
c=0
count=0


m=n
for i in range((n//r)+1):
    a=i
    m=m-r*i
    for j in range((n//g)+1):
        b=j
        c=m-j*g
        if c%y==0 and c>=0 :
            count+=1

    m=n

print(count)



Fixed submission:
r,g,y,n=map(int,input().split())
a=0
b=0
c=0
count=0


m=n
for i in range((n//r)+1):
    m=m-r*i
    for j in range((m//g)+1):
        c=m-j*g
        if c%y==0 and c>=0 :
            count+=1

    m=n

print(count)
Buggy python submission (verdict: Runtime Error):
x=int(input())
y=sorted(x)
if (y[0]+y[1])%2==0:
  print((2*y[2]-y[1]-y[0])/2)
else :
  print((2*y[2]-y[1]-y[0]+3)/2)

Fixed submission:
x=list(map(int,input().split()))
y=sorted(x)
if (y[0]+y[1])%2==0:
  print(int((2*y[2]-y[1]-y[0])/2))
else :
  print(int((2*y[2]-y[1]-y[0]+3)/2))
Buggy python submission (verdict: Runtime Error):
M, N = map(int, input().split())
if M > 2 and N > 2:
    print(M - 2) * (N - 2)
elif M==1 or N==1:
    print(N * M - 2)
else:
    print(0)


Fixed submission:
M, N = map(int, input().split())
if M==1 and N==1:
    print(1)
elif M > 2 and N > 2:
    print((M - 2) * (N - 2))
elif M==1 or N==1:
    print(N * M - 2)
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
M, N = map(int, input().split())
if M >= 2 and N >= 2:
    print(M - 2) * (N - 2)
elif M==1 or N==1:
    print(N * M - 2)
else:
    print(0)

Fixed submission:
M, N = map(int, input().split())
if M==1 and N==1:
    print(1)
elif M > 2 and N > 2:
    print((M - 2) * (N - 2))
elif M==1 or N==1:
    print(N * M - 2)
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
M,N = map(int, input().split())
if M>=2 and N>=2 : 
    print(M-2)*(N-2)
else:
    print(N*M-2)
    

Fixed submission:
M, N = map(int, input().split())
if M==1 and N==1:
    print(1)
elif M > 2 and N > 2:
    print((M - 2) * (N - 2))
elif M==1 or N==1:
    print(N * M - 2)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
# coding: UTF-8
import math
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    a=a*b//math.gcd(a, b)
print(int(a))

Fixed submission:
# coding: UTF-8
from fractions import gcd
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    a=a*b//gcd(a, b)
print(int(a))

Buggy python submission (verdict: Runtime Error):
# coding: UTF-8
import math
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    c=math.gcd(a, b)
    a=a*b/c
print(int(a))

Fixed submission:
# coding: UTF-8
from fractions import gcd
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    a=a*b//gcd(a, b)
print(int(a))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())
dic = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,'m':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,'y':0,'z':0}

ans = 1

for i in range(N):
	dic[S[i]] += 1

for key in list(dic.keys()):
	ans *= (dic[key]+1)

print(str((ans-1)%(10**9+7))

Fixed submission:
N = int(input())
S = str(input())
dic = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,'m':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,'y':0,'z':0}

ans = 1

for i in range(N):
	dic[S[i]] += 1

for key in list(dic.keys()):
	ans *= (dic[key]+1)

print(str((ans-1)%(10**9+7)))
Buggy python submission (verdict: Runtime Error):
t, x = [ s for s in int(input())]
result = t/x
print(result)

Fixed submission:
t, x = [ int(s) for s in input().split(' ')]
result = t/x
print(result)
Buggy python submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split(' ')))
dp=[]

for i in range(N):
	if i==0:
		dp.append(0)
	elif k==1:
		dp.append(abs(H[1]-H[0]))
	else:
		return min(dp[k-2]+abs(H[k]-H[k-2]), dp[k-1]+abs(H[k]-H[k-1]))
		
print(dp[N-1])

Fixed submission:
N=int(input())
H=list(map(int,input().split(' ')))
dp=[]

for k in range(N):
	if k==0:
		dp.append(0)
	elif k==1:
		dp.append(abs(H[1]-H[0]))
	else:
		dp.append(min(dp[k-2]+abs(H[k]-H[k-2]), dp[k-1]+abs(H[k]-H[k-1])))
		
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split(' ')))

def dp(k):
	if k==0:
		return 0
	elif k==1:
		return abs(H[1]-H[0])
	else:
		return min(dp(k-2)+abs(H[k]-H[k-2]), dp(k-1)+abs(H[k]-H[k-1]))
		
print(dp(N-1))

Fixed submission:
N=int(input())
H=list(map(int,input().split(' ')))
dp=[]

for k in range(N):
	if k==0:
		dp.append(0)
	elif k==1:
		dp.append(abs(H[1]-H[0]))
	else:
		dp.append(min(dp[k-2]+abs(H[k]-H[k-2]), dp[k-1]+abs(H[k]-H[k-1])))
		
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K=map(int,input().split(' '))
H=np.array(list(map(int,input().split(' '))))
dp=np.zeros(N)

for i in range(N):
	if i==0:
		continue
	elif i==1:
      	#0->1に移動するコストは1通り
		dp[i]=(np.abs(H[1]-H[0]))
	else:
      	#i>=2のときはiに移動するコストは
        #dp[i-j]+abs(H[i-j]-H[i]) (j=1,...,min(K,i)) の最小値]
        dp[i] = np.min(dp[min(0,i-K):i] + np.abs(H[min(0,i-K):i] - H[i]))
		
print(dp[N-1])

Fixed submission:
N, K=map(int,input().split(' '))
H=list(map(int,input().split(' ')))
dp=[]

for i in range(N):
	if i==0:
		dp.append(0)
	elif i==1:
		dp.append(abs(H[1]-H[0]))
	else:
		d = min([ dp[i-j]+abs(H[i]-H[i-j]) for j in range(1,K+1) if i-j>=0])
		dp.append(d)
		
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K=map(int,input().split(' '))
H=np.array(list(map(int,input().split(' '))))
dp=np.zeros(N)

for i in range(N):
	if i==0:
		continue
	elif i==1:
		dp[i]=(np.abs(H[1]-H[0]))
	else:
		d = np.min(np.array([ dp[i-j]+abs(H[i]-H[i-j]) for j in range(1,K+1) if i-j>=0]))
		dp.append(d)
		
print(dp[N-1])

Fixed submission:
N, K=map(int,input().split(' '))
H=list(map(int,input().split(' ')))
dp=[]

for i in range(N):
	if i==0:
		dp.append(0)
	elif i==1:
		dp.append(abs(H[1]-H[0]))
	else:
		d = min([ dp[i-j]+abs(H[i]-H[i-j]) for j in range(1,K+1) if i-j>=0])
		dp.append(d)
		
print(dp[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K=map(int,input().split(' '))
H=list(map(int,input().split(' ')))
dp=[]

for i in range(N):
	if i==0:
		dp.append(0)
	elif i==1:
		dp.append(abs(H[1]-H[0]))
	else:
		d = np.min(np.array([ dp[i-j]+abs(H[i]-H[i-j]) for j in range(1,K+1) if i-j>=0]))
		dp.append(d)
		
print(dp[N-1])

Fixed submission:
N, K=map(int,input().split(' '))
H=list(map(int,input().split(' ')))
dp=[]

for i in range(N):
	if i==0:
		dp.append(0)
	elif i==1:
		dp.append(abs(H[1]-H[0]))
	else:
		d = min([ dp[i-j]+abs(H[i]-H[i-j]) for j in range(1,K+1) if i-j>=0])
		dp.append(d)
		
print(dp[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K=map(int,input().split(' '))
H=list(map(int,input().split(' ')))
dp=[]

for i in range(N):
	if i==0:
		dp.append(0)
	elif i==1:
		dp.append(abs(H[1]-H[0]))
	else:
		dp.append(min([ dp[i-j]+abs(H[i]-H[i-j]) for j in range(1,K+1) if i-j>=0]))
		
print(dp[N-1])

Fixed submission:
N, K=map(int,input().split(' '))
H=list(map(int,input().split(' ')))
dp=[]

for i in range(N):
	if i==0:
		dp.append(0)
	elif i==1:
		dp.append(abs(H[1]-H[0]))
	else:
		d = min([ dp[i-j]+abs(H[i]-H[i-j]) for j in range(1,K+1) if i-j>=0])
		dp.append(d)
		
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split(' '))
height = [1]

for i in range(N):
	height.append(height[-1]*2 + 3)

def patty(N,X):
	if N==1:
		l = [0,1,2,3,3]
		return l[X-1]
	elif N>=2:
		if X<(height[N]+1)/2:
			return patty(N-1,X-1)
		elif X==(height[N]+1)/2:
			return patty(N-1,height[N-1]) + 1
		elif X>(height[N]+1)/2:
			return patty(N-1,height[N-1]) + 1 + patty(N-1,X-2-height[N-1])

print(patty(N,X))


Fixed submission:
N, X = map(int, input().split(' '))
height = [1]

for i in range(N):
	height.append(height[-1]*2 + 3)

def patty(N,X):
	if N==1:
		l = [0,1,2,3,3]
		return l[X-1]
	elif N>=2:
		if X == 1:
			return 0
		elif X <= height[N-1]+1:
			return patty(N-1,X-1)
		elif X == height[N-1]+2:
			return patty(N-1,height[N-1])+1
		elif X == height[N]:
			return patty(N-1,height[N-1])*2+1
		elif X >= height[N-1]+3:
			return patty(N-1,height[N-1])+1+ patty(N-1,X-2-height[N-1])

print(patty(N,X))
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = y-x,x
	return y

N,M=map(int,input().split())
S=input()
T=input()
g=gcd(N,M)
p,q=M//g,N//g
print((N//g)*M) if S[0::q]==T[0::p] else print('-1')

Fixed submission:
def gcd(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = min(x,y), max(x,y)
		x,y = y-x,x
	return y

N,M=map(int,input().split())
S=input()
T=input()
g=gcd(N,M)
p,q=M//g,N//g
print((N//g)*M) if S[0::q]==T[0::p] else print('-1')

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = y-x,x
	return y

N,M=map(int,input().split())
S=input()
T=input()
g=gcd(N,M)
p,q=M//g,N//g
print(N*M//g) if S[0::q]==T[0::p] else print('-1')

Fixed submission:
def gcd(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = min(x,y), max(x,y)
		x,y = y-x,x
	return y

N,M=map(int,input().split())
S=input()
T=input()
g=gcd(N,M)
p,q=M//g,N//g
print((N//g)*M) if S[0::q]==T[0::p] else print('-1')

Buggy python submission (verdict: Runtime Error):
def lcm(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = y-x,x
	return int(a*b/y)

N,M=map(int,input().split())
S=input()
T=input()
l=lcm(N,M)
p,q=l//N,l//M
print(l) if S[0::q]==T[0::p] else print('-1')


Fixed submission:
def gcd(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = min(x,y), max(x,y)
		x,y = y-x,x
	return y

N,M=map(int,input().split())
S=input()
T=input()
g=gcd(N,M)
p,q=M//g,N//g
print((N//g)*M) if S[0::q]==T[0::p] else print('-1')
Buggy python submission (verdict: Runtime Error):
N,T=map(int,input().split(' '))
costs = []
for i in range(N):
  c,t = map(int,input().split(' '))
  if t<=T:
    costs.append(c)
print(min(costs))

Fixed submission:
N,T=map(int,input().split(' '))
costs = []
for i in range(N):
  c,t = map(int,input().split(' '))
  if t<=T:
    costs.append(c)
if costs == []:
  print('TLE')
else:
  print(min(costs))
Buggy python submission (verdict: Runtime Error):
n = str(input())
for i in range(2):
  if n[i] == '1':
    n[i] = '9'
  elif n[i] == '9':
    n[i] = '1'
print(n)

Fixed submission:
n = str(input())
s = ''
for i in range(3):
  if n[i] == '1':
    s += '9'
  elif n[i] == '9':
    s += '1'
  else:
    s += n[i]
print(s)
Buggy python submission (verdict: Runtime Error):
S=input()
K=int(input())
notonehead=min([S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1])
notone=S[notonehead]
print(1) if K-1<notonehead else print(str(notone))


Fixed submission:
S=input()
K=int(input())
notoneposition=[S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1]
if notoneposition==[]:
	print(1)
else:
	notonehead=min(notoneposition)
	notone=S[notonehead]
	print(1) if K-1<notonehead else print(str(notone))

Buggy python submission (verdict: Runtime Error):
S=input()
K=int(input())
notonehead=min([S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1])
notone=S[notonehead]
print(1) if K-1<notonehead else print(str(notone))


Fixed submission:
S=input()
K=int(input())
notoneposition=[S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1]
if notoneposition==[]:
	print(1)
else:
	notonehead=min(notoneposition)
	notone=S[notonehead]
	print(1) if K-1<notonehead else print(str(notone))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print('+') if a+b==15 else print('*') else a*b==15 else print('x')

Fixed submission:
a,b=map(int,input().split(' '))
print('+') if a+b==15 else print('*') if a*b==15 else print('x')
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split(' '))
A=list(map(int,input.split(' ')))
count=0
sum=0
while sum<N:
	if count==0:
		sum+=K
	else:
		sum+=(K-1)
	count+=1
print(count)

Fixed submission:
N,K=map(int,input().split(' '))
A=list(map(int,input().split(' ')))
count=0
sum=0
while sum<N:
	if count==0:
		sum+=K
	else:
		sum+=(K-1)
	count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
print('ABD{%03d}'.format(N-1000)) if N>=1000 else print('ABC{%03d}',format(N))

Fixed submission:
print('ABD') if int(input())>=1000 else print('ABC')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
ans=N*10
for i in range(N):
  n=S[:i].count('W')+S[i+1:].count('E')
  ans=n if n<ans else ans
print(ans)

Fixed submission:
N=int(input())
S=input()
count=S[1:].count('E')
ans=S[1:].count('E')
for i in range(N-1):
  count+=(S[i].count('W')-S[i+1].count('E'))
  ans=count if count<ans else ans
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
print(a) if b>=a else print(a-1)

Fixed submission:
a,b=map(int,input().split(' '))
print(a) if b>=a else print(a-1)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print(['Even','Odd'][A*B%2])

Fixed submission:
a,b=map(int,input().split(' '))
print(['Even','Odd'][a*b%2])
Buggy python submission (verdict: Runtime Error):
100 4 16

Fixed submission:
N,A,B=map(int,input().split(' '))
ans=0
for i in range(N):
  if A<=sum([int(s) for s in list(str(i+1))])<=B:
    ans+=(i+1)
print(ans)
Buggy python submission (verdict: Runtime Error):
i,j=['ABCDEF',find(X) for x in input().split(' ')]
print('<') if i<j else print('>') if i>j else print('=')

Fixed submission:
i,j=['ABCDEF'.find(x) for x in input().split(' ')]
print('<') if i<j else print('>') if i>j else print('=')
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split(' '))
R=[list(map(int,input().split(' '))) for i in range(M)]
Mat=[[0]*N]*N
for r in R:
	Mat[r[0]-1][r[1]-1]=1
	Mat[r[1]-1][r[0]-1]=1

stack=[1]
island=[]

ans=0
Matmini=[]

def dfs():
	global stack
	global island
	global Matmini
	if stack==[]:
		return None
	if len(set(island))==N:
		#全頂点が網羅できていたらそこで終了
		return None
	else:
		#たどれるノードがあるかどうかを確認
		for i in range(1,N+1):
			#iが未訪問のときのみ処理続行
			if i not in stack:
				#実際に辺が存在するか
				if Matmini[stack[0]-1][i-1]==1:
					stack = [i] + stack
					dfs()
		#これ以上先に進めなくなったら島の構成要素を更新
		island += stack
		stack.pop(0)

for r in R:
	#Rからi番目の辺だけ除去したもの
	Matmini = Mat
	Matmini[r[0]-1][r[1]-1]=0
	Matmini[r[1]-1][r[0]-1]=0
	stack = [1]
	island = []
	dfs()
	if len(set(island))!=N:
		ans += 1
		
print(ans)


Fixed submission:
n = list(map(int,input().split(' ')))
print(str(max([i if n.count(i)==1 else -10000 for i in list(dict.fromkeys(n))])))

Buggy python submission (verdict: Runtime Error):
n = list(map(int,input().split(' ')))
ans = i if n.count(i)==1 for i in list(dict.fromkeys(n))
print(str(ans))

Fixed submission:
n = list(map(int,input().split(' ')))
print(str(max([i if n.count(i)==1 else -10000 for i in list(dict.fromkeys(n))])))

Buggy python submission (verdict: Runtime Error):
n = list(map(int,input().split(' ')))
ans = i if i.count(dict.fromkeys(n))==1 for i in n
print(str(ans))

Fixed submission:
n = list(map(int,input().split(' ')))
print(str(max([i if n.count(i)==1 else -10000 for i in list(dict.fromkeys(n))])))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
D=sorted(list(map(int,input().split(' '))))
M=int(input())
T=sorted(list(map(int,input().split(' '))))
ans='YES'
for t in set(T):
  if T.count(t)>D.count(t):
    ans='NO'
    break
print(ans)

Fixed submission:
import collections
N=int(input())
D=list(map(int,input().split(' ')))
M=int(input())
T=list(map(int,input().split(' ')))
cd = collections.Counter(D)
ct = collections.Counter(T)
ans = 'YES'
for t in list(ct.keys()):
	if ct[t]>cd[t]:
		ans = 'NO'
		break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
D=list(map(int,input().split(' ')))
M=int(input())
T=list(map(int,input().split(' ')))
ans='YES'
for t in set(T):
  if T.count(t)>D.count(t):
    ans='NO'
    break
print(ans)

Fixed submission:
import collections
N=int(input())
D=list(map(int,input().split(' ')))
M=int(input())
T=list(map(int,input().split(' ')))
cd = collections.Counter(D)
ct = collections.Counter(T)
ans = 'YES'
for t in list(ct.keys()):
	if ct[t]>cd[t]:
		ans = 'NO'
		break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
D=list(map(int,input().split(' ')))
M=int(input())
T=list(map(int,input().split(' ')))
ans='YES'
for t in T:
  if t not in D:
    ans='NO'
    break
  else:
    D.pop(D.index(t))
print(ans)

Fixed submission:
import collections
N=int(input())
D=list(map(int,input().split(' ')))
M=int(input())
T=list(map(int,input().split(' ')))
cd = collections.Counter(D)
ct = collections.Counter(T)
ans = 'YES'
for t in list(ct.keys()):
	if ct[t]>cd[t]:
		ans = 'NO'
		break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
history=[]
for i in range(N):
  history.append(int(input()))
history=sorted(history)
print(sum([history.count(n)%2 for n in list(set(history))]))

Fixed submission:
N=int(input())
history=[]
for i in range(N):
  history.append(int(input()))
history=sorted(history)
nums=[]
for i in range(N):
  if i==0:
    nums.append(1)
  else:
    if history[i]==history[i-1]:
      nums[-1]+=1
    else:
      nums.append(1)
print(sum([n%2 for n in nums]))
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input(' '))
print('A') if abs(x-a)<abs(x-b) else print('B')

Fixed submission:
x,a,b=map(int,input().split(' '))
print('A') if abs(x-a)<abs(x-b) else print('B')
Buggy python submission (verdict: Runtime Error):
print('Yes') if str(input())==str(input())[::-1] else print('No')

Fixed submission:
s = str(input())
print('Yes') if s==s[::-1] else print('No')
Buggy python submission (verdict: Runtime Error):
import fractions
def lcm(a,b):
  return int(a*b/fractions.gcd(a,b))
N=int(input())
T=[int(input()) for i in range(N)]
ans=1
for i in range(N):
  ans=lcm(ans,T[i])
print(ans)

Fixed submission:
import fractions
def lcm(a,b):
  return a*b//fractions.gcd(a,b)
N=int(input())
T=[int(input()) for i in range(N)]
ans=1
for i in range(N):
  ans=lcm(ans,T[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split(' '))
print(sum((n-1)*(m-1)))

Fixed submission:
n,m=map(int,input().split(' '))
print(str((n-1)*(m-1)))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split(' ')))
B=[]
for i in range(N):
  if i%2==0:
    B.append(A[i])
  else:
    B = [A[i]] + B
#revert B when N%2==1
print(' '.join([str(b) for b in B])) if N%2==0 else print(' '.join([str(b) for b in B[::-1]]))

Fixed submission:
N=int(input())
A=list(map(str, input().split(' ')))
even=A[0::2]
odd=A[1::2]
print(' '.join(even[::-1])+' '+' '.join(odd)) if N%2==1 else print(' '.join(odd[::-1])+' '+' '.join(even))
Buggy python submission (verdict: Runtime Error):
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
if x==y: ans='Yes'
else:
    for c in [a,b]:
        ans='Yes' if x in c and y in c
if ans=='': ans='No'
print(ans)

Fixed submission:
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
if x==y: ans='Yes'
else:
    for c in [a,b]:
        if (x in c)*(y in c):
            ans='Yes'
            break
if ans=='': ans='No'
print(ans)

Buggy python submission (verdict: Runtime Error):
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
ans='Yes' if x==y
for c in (a,b):
    ans='Yes' if x in c and y in c
if ans=='': ans='No'
print(ans)


Fixed submission:
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
if x==y: ans='Yes'
else:
    for c in [a,b]:
        if (x in c)*(y in c):
            ans='Yes'
            break
if ans=='': ans='No'
print(ans)

Buggy python submission (verdict: Runtime Error):
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
ans='Yes' if x==y
for c in (a,b):
    ans='Yes' if x in c and y in c
ans='No' if ans==''
print(ans)

Fixed submission:
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
ans=''
x,y=map(int,input().split(' '))
if x==y: ans='Yes'
else:
    for c in [a,b]:
        if (x in c)*(y in c):
            ans='Yes'
            break
if ans=='': ans='No'
print(ans)
Buggy python submission (verdict: Runtime Error):
N,T=map(int,input().split(' '))
times=[int(input()) for i in range(N)]
print(sum([min(T, times[i+1]-times[i] for i in range(N-1))])+times[-1])

Fixed submission:
N,T=map(int,input().split(' '))
times=list(map(int,input().split(' ')))
print(sum([min(T, times[i+1]-times[i]) for i in range(N-1)])+T)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split(' '))
S = [list(map(int,input().split(' '))) for i in range(N)]
C = [list(map(int,input().split(' '))) for i in range(M)]
for i in range(N):
  l = [abs(S[i][0]-C[i][0])+abs(S[i][1]-C[i][1]) for i in range(M)]
  print(l.index(min(l))+1)

Fixed submission:
N,M=map(int,input().split(' '))
S = [list(map(int,input().split(' '))) for i in range(N)]
C = [list(map(int,input().split(' '))) for i in range(M)]
for i in range(N):
  l = [abs(S[i][0]-C[j][0])+abs(S[i][1]-C[j][1]) for j in range(M)]
  print(l.index(min(l))+1)
Buggy python submission (verdict: Runtime Error):
W,a,b=map(int,input().split(' '))
print(max(0,b-(a+W)) if a<=b else print(max(0,a-(b+W)))

Fixed submission:
W,a,b=map(int,input().split(' '))
print(max(0,b-(a+W))) if a<=b else print(max(0,a-(b+W)))
Buggy python submission (verdict: Runtime Error):
import math
print(math.factorial(N)%(10**9+7))

Fixed submission:
import math
print(math.factorial(int(input()))%(10**9+7))
Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row=i+1 if 'snuke' in S[i] else continue for i in range(H)
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row))

Fixed submission:
H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row = -1
for i in range(H):
    if 'snuke' in S[i]: row=i+1
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row))

Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row=i+1 if 'snuke' in S[i] for i in range(H)
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row))

Fixed submission:
H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row = -1
for i in range(H):
    if 'snuke' in S[i]: row=i+1
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row))