Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,K,*P = map(int,open(0).read().split())

m = 0
maxIdx = 0
for i in range(0,N-K+1):
  sa =sum(P[i:i+K])
  if m < sa:
    m = sa
    maxIdx = i
ans = 0
for i in range(K):
  ans += (P[maxIdx+i]+1)/2
print(ans)

Fixed submission:
N,K,*P = map(int,open(0).read().split())
P = [(P[i]+1)/2 for i in range(N)]
M = m = sum(P[:K])

for i in range(N-K):
  if M < m-P[i]+P[i+K]:
    M = m-P[i]+P[i+K]
  m= m-P[i]+P[i+K]

print(M)

Buggy python submission (verdict: Time Limit Exceeded):
N,K,*P = map(int,open(0).read().split())
m = [0]*N
E = [((n+1))/2 for n in range(1,1001)]
for i in range(0,N-K+1):
  tmp_sum = 0
  for j in range(K):
    tmp_sum+=E[P[i+j]-1]
  m[i]=tmp_sum
print(max(m))

Fixed submission:
N,K,*P = map(int,open(0).read().split())
P = [(P[i]+1)/2 for i in range(N)]
M = m = sum(P[:K])

for i in range(N-K):
  if M < m-P[i]+P[i+K]:
    M = m-P[i]+P[i+K]
  m= m-P[i]+P[i+K]

print(M)
Buggy python submission (verdict: Runtime Error):
N,a,b = map(int,input().split())

if (b-a)%2 ==0:
  ams = (b-a)//2
else:
  ans = min(a-1,N-b)+1 + (b-a-1)//2
print(ans)

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

if (b-a)%2 ==0:
  ans = (b-a)//2
else:
  ans = min(a-1,N-b)+1 + (b-a-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np 

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


X,Y =map(int,input().split())
x,y = np.sum(1/3.0*(np.array([[ 2., -1.],[-1.,  2.]])*np.array([X,Y])),axis=1).astype(np.int32)
#print(x)
##x = int(X-(X+Y)//3)
#y = int(Y-(X+Y)//3)
if (X+Y)%3==0 and x>=0 and y>=0:
    print(cmb(x+y,x,mod))
else:
    print(0)
    


Fixed submission:
import math
#import numpy as np 

#参照
#https://qiita.com/derodero24/items/91b6468e66923a87f39f#%E7%95%AA%E5%A4%96%E7%B7%A8
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 5*10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


X,Y =map(int,input().split())
#x,y = np.sum(1/3*(np.array([[ 2., -1.],[-1.,  2.]])*np.array([X,Y])),axis=1).astype(np.int32)
#print(x)
x = int(X-(X+Y)//3)
y = int(Y-(X+Y)//3)
if (X+Y)%3==0 and x>=0 and y>=0:
    print(cmb(x+y,x,mod))
else:
    print(0)

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

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


X,Y =map(int,input().split())
x,y = np.sum(1/3.0*(np.array([[ 2., -1.],[-1.,  2.]])*np.array([X,Y])),axis=1).astype(np.int32)
print(x)
##x = int(X-(X+Y)//3)
#y = int(Y-(X+Y)//3)
if (X+Y)%3==0 and x>=0 and y>=0:
    print(int(cmb(x+y,x,mod)))
else:
    print(0)
    


Fixed submission:
import math
#import numpy as np 

#参照
#https://qiita.com/derodero24/items/91b6468e66923a87f39f#%E7%95%AA%E5%A4%96%E7%B7%A8
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 5*10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


X,Y =map(int,input().split())
#x,y = np.sum(1/3*(np.array([[ 2., -1.],[-1.,  2.]])*np.array([X,Y])),axis=1).astype(np.int32)
#print(x)
x = int(X-(X+Y)//3)
y = int(Y-(X+Y)//3)
if (X+Y)%3==0 and x>=0 and y>=0:
    print(cmb(x+y,x,mod))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N,*H = map(int,open(0).read().split())
maxLen = 0
tmpCnt = 0
for i in range(len(H)):
  if H[i] > H[1+1]:
    tmpCnt+=1
  else:
    maxLen = max(maxLen,tmpCnt)
    tmpCnt =0
print(maxLen)

Fixed submission:
N,*H = map(int,open(0).read().split())
maxLen = 0
tmpCnt = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    tmpCnt += 1
  else:
    tmpCnt = 0
  maxLen = max(maxLen,tmpCnt)

print(maxLen)
Buggy python submission (verdict: Time Limit Exceeded):
N,*A =map(int,open(0).read().split())

for i in range(1,N+1):
  print(max(A[:i-1]+A[i:]))

Fixed submission:
N,*A =map(int,open(0).read().split())
B =sorted(A)
biggest = B[-1]
for i in A:
  if i==biggest:
    print(B[-2])
  else:
    print(biggest)
Buggy python submission (verdict: Runtime Error):
L,R = map(int,input().split())
 
x = 2019**2
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if x > ans:
            x = ans
            if x == 0:
        	    break
    if x == 0:
      break
print(x)

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

print(min(N*A,B))

Buggy python submission (verdict: Runtime Error):
L,R = map(int,input()split())

x = 2019**2
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if x > ans:
            x = ans
            if x == 0:
        	    break
    if x == 0:
      break

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

print(min(N*A,B))

Buggy python submission (verdict: Runtime Error):
L,R = map(int,input().split())
#divisor = [2019,673,3]
x = 2019
X = []
if L-R >= 2019:
    x=0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            #x = min(x,(i%2019)*(j%2019))
            X.append((i*j)%2019)
x = min(X)
print(x)

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

print(min(N*A,B))
Buggy python submission (verdict: Runtime Error):
from scipy.misc import comb

N,K = map(int,input().split())

for i in range(1,K+1):
    B = comb(K-1, i-1, exact=True)
    R = comb(N-K+1, i, exact=True)
    print((B%m *R%m)%m)

Fixed submission:
from scipy.misc import comb

N,K = map(int,input().split())
m=1000000007

for i in range(1,K+1):
    B = comb(K-1, i-1, exact=True)
    R = comb(N-K+1, i, exact=True)
    print((B%m *R%m)%m)
Buggy python submission (verdict: Runtime Error):
import fractions
  
A,B,C,D= map(int,input().split())
 
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
 
CD=lcm(C, D)
 
dc =  B//C -  (A-1)//C
dd = B//D - (A-1)//D
dcd = B//CD - (A-1)//CD
 
print(B-A+1-dc-dd+dcd)

Fixed submission:
S = input()
dif = False
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        dif=True
if dif:
    print("Bad")
else:
    print("Good")
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())
CD=lcm(C, D)

def xc(x,C=C,D=D,CD=CD):
    return(x//C+x//D-x//(CD))

print(B-A+1-xc(B+1)+xc(A))

Fixed submission:
import fractions
  
A,B,C,D= map(int,input().split())
 
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
 
CD=lcm(C, D)
 
dc =  B//C -  (A-1)//C
dd = B//D - (A-1)//D
dcd = B//CD - (A-1)//CD
 
print(B-A+1-dc-dd+dcd)
Buggy python submission (verdict: Runtime Error):
N,K= map(int,input().split())
if k==1:
  print(1)
else:
  print(N-K)

Fixed submission:
W = list(map(int,input().split()))
print(W[0]%W[1])
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
S= input()

sa = ""
for i in range(len(S)):
  if S[i] == S[int(K)]:
    sa = sa + str(S[i].lower())
  else:
    sa = sa + str(S[i])
print(sa)

Fixed submission:
N,K= map(int,input().split())
S = input()
s=str("")
for i in range(len(S)):
    
    if i == K-1:
        #print(i,S[i].lower())
        s=s+S[i].lower()
    else:
        #print(i,S[i])
        s=s+S[i]
print(s)
Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())

AB = {}
for i in range(N):
  A, B = map(int,input().split())
  AB[A]=B
AB = sorted(AB.items(),key = lambda x:x[0])

acost = 0

for a,b in AB:
  cost += (min(max(M,0),b))*a
  M-=b
  if M<=0:
    break
print(cost)
  

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

AB = []
for i in range(N):
  A, B = map(int,input().split())
  AB.append([A,B])
AB = sorted(AB,key = lambda x:x[0])
cost = 0

for a,b in AB:
  cost += (min(max(M,0),b))*a
  M-=b
  if M<=0:
    break
print(cost)
Buggy python submission (verdict: Runtime Error):
import collections

s = int(input())
A = [s]
for i in range(1000000+1):
  A.append(i//2 if i%2==0 else 3*n+1)
  c = collections.Counter(A)
  if c.most_common()[0][1] ==2:
    print(i)
    break

Fixed submission:
import collections

s = int(input())
A = [s]
for i in range(1000000+1):
  A.append(A[i]//2 if A[i]%2==0 else 3*A[i]+1)
  c = collections.Counter(A)
  if c.most_common()[0][1] == 2:
    print(len(A))
    break
Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it

N =  int(input())
n =list(map(str,range(10)))
ans = 0
for i in it.combinations_with_replacement(n,16):
  a = int("".join(i))
  if a <= N:
    b = sum(map(int,i))
    ans = max(ans,b)
print(ans)

Fixed submission:
import itertools as it

N =  int(input())
n =list(map(str,range(10)))
ans = 0
for i in it.combinations_with_replacement(n,16):
  a = int("".join(i))
  if a <= N:
    b = sum(map(int,i))
    ans = max(ans,b)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B =map(int,input().split())
if (A*B)52==0:
  print("Even")
else:
  print("Odd")

Fixed submission:
A,B =map(int,input().split())
if (A*B)%2==0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
import collections as c
N,K,*A= map(int,open(0).read().split())
ans=0
C=c.Counter(A)
C=sorted(C.values())

colors = len(C)

for i in range(colors):
  if len(C)<=K:
    break
  _c = C.pop(0)
  ans+=_c
print(ans)


Fixed submission:
import collections as c
N,K,*A= map(int,open(0).read().split())
ans=0
C=c.Counter(A)
C=sorted(C.values())
#Aprint(C)
for i in range(len(C)-K):
  ans+=C[i]

print(ans)

Buggy python submission (verdict: Runtime Error):
import collections as c
N,K,*A= map(int,open(0).read().split())
ans=0
C=c.Counter(A)
C=sorted(C.values())

for i in range(N):
  if len(C)<=K:
    break
  ans+=C[i]
print(ans)

Fixed submission:
import collections as c
N,K,*A= map(int,open(0).read().split())
ans=0
C=c.Counter(A)
C=sorted(C.values())
#Aprint(C)
for i in range(len(C)-K):
  ans+=C[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
N,A = open(0).read().split()
print(N**2-A)

Fixed submission:
N,A = map(int,open(0).read().split())
print(N**2-A)
Buggy python submission (verdict: Runtime Error):
S=map(int,input().split())
print(max(0,S[0]-S[1]))

Fixed submission:
S=list(map(int,input().split()))
print(max(0,S[0]-S[1]))
Buggy python submission (verdict: Runtime Error):
N,*A  =map(int,open(0).read().split())

L = [0 for i in range(N+3)]

for a in A:
  L[a]+=1

ans = 0
for i in range(N+3):
  S = sum(L[i:i+3])
  if ans < S:
    ans = S
  
print(ans)

Fixed submission:
N,*A  =map(int,open(0).read().split())

L = [0 for i in range(int(1e5)+1)]

for a in A:
  L[a]+=1

ans = 0
for i in range(int(1e5)+1):
  S = sum(L[i:i+3])
  if ans < S:
    ans = S
  
print(ans)

Buggy python submission (verdict: Runtime Error):
N,*A  =map(int,open(0).read().split())

L = [0 for i in range(N+3)]

for a in A:
  L[a]+=1

ans = 0
for i in range(N+2):
  S = sum(L[i:i+3])
  if ans < S:
    ans = S
  
print(ans)

Fixed submission:
N,*A  =map(int,open(0).read().split())

L = [0 for i in range(int(1e5)+1)]

for a in A:
  L[a]+=1

ans = 0
for i in range(int(1e5)+1):
  S = sum(L[i:i+3])
  if ans < S:
    ans = S
  
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

from1 = [False]*N
toN = [False]*N
for i in range(M):
  a,b = map(int,input().split())
  if a ==1 or b ==1:
    from1[max(a,b)-1]=True
  if a == N or b == N:
    toN[a-1 if a!= N else b-1]=True
cnt =0 
for i in range(M):
  cnt+=from1[i]&toN[i]
print("POSSIBLE" if cnt else "IMPOSSIBLE")

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

from1 = [False]*max(N,M)
toN = [False]*max(N,M)
for i in range(M):
  a,b = map(int,input().split())
  if a ==1 or b ==1:
    from1[a-1 if a!= 1 else b-1]=True
  if a == N or b == N:
    toN[a-1 if a!= N else b-1]=True
cnt =0 
for i in range(M):
  cnt+=from1[i]&toN[i]
print("POSSIBLE" if cnt else "IMPOSSIBLE")

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

from1 = [False]*N
toN = [False]*N
for i in range(M):
  a,b = map(int,input().split())
  if a ==1 or b ==1:
    from1[max(a,b)]=True
  if a == N or b == N:
    toN[a if a!= N else b]=True
cnt =0 
for i in range(M):
  cnt+=from1[i]&toN[i]
print("POSSIBLE" if cnt else "IMPOSSIBLE")

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

from1 = [False]*max(N,M)
toN = [False]*max(N,M)
for i in range(M):
  a,b = map(int,input().split())
  if a ==1 or b ==1:
    from1[a-1 if a!= 1 else b-1]=True
  if a == N or b == N:
    toN[a-1 if a!= N else b-1]=True
cnt =0 
for i in range(M):
  cnt+=from1[i]&toN[i]
print("POSSIBLE" if cnt else "IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())

from1 = []
toN = []
for i in range(M):
  a,b = map(int,input().split())
  if a ==1 or b ==1:
    from1.append(a if a!=1 else b)
  if a == N or b == N:
    toN.append(a if a!=N else b)

F = False

for i in from1:
  for j in toN:
    if i == j:
      F = True
      break
  if F:
    break
print("POSSIBLE" if F else "IMPOSSIBLE")

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

from1 = [False]*max(N,M)
toN = [False]*max(N,M)
for i in range(M):
  a,b = map(int,input().split())
  if a ==1 or b ==1:
    from1[a-1 if a!= 1 else b-1]=True
  if a == N or b == N:
    toN[a-1 if a!= N else b-1]=True
cnt =0 
for i in range(M):
  cnt+=from1[i]&toN[i]
print("POSSIBLE" if cnt else "IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,*A=map(int,open(0).read().split())
A=(np.array(A)//400).astype("int32")

color_num=0

colors=np.zeros(9)

for a in A:
    colors[min(a,9)]+=1
c=np.count_nonzero(colors[:-1])

min_color_num = 1 if (c==0 and colors[-1]>0) else c
max_color_num = min(8,c+max(int(colors[-1]),0))

print(min_color_num,max_color_num)


Fixed submission:
N,*A=map(int,open(0).read().split())

colors = [0 for i in range(8)]
tyty = 0

for a in A:
  c = a//400
  if c>=8:
    tyty+=1
  else:
    colors[c]+=1

cNum = 8-colors.count(0)
    
minC = max(cNum,1)
maxC = cNum+tyty

print(minC,maxC)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N,*A=map(int,open(0).read().split())
A=(np.array(A)//400).astype("int32")

color_num=0

colors=np.zeros(9)

for a in A:
  colors[a]+=1

c=np.count_nonzero(colors[:-1])

min_color_num = 1 if (c==0 and colors[-1]>0) else c
max_color_num = min(8,c+max(int(colors[-1]),0))

print(min_color_num,max_color_num)


Fixed submission:
N,*A=map(int,open(0).read().split())

colors = [0 for i in range(8)]
tyty = 0

for a in A:
  c = a//400
  if c>=8:
    tyty+=1
  else:
    colors[c]+=1

cNum = 8-colors.count(0)
    
minC = max(cNum,1)
maxC = cNum+tyty

print(minC,maxC)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N,*A=map(int,open(0).read().split())
A=(np.array(A)//400).astype("int32")

color_num=0

colors=np.zeros(9)

for a in A:
  colors[a]+=1

c=np.count_nonzero(colors[:8])

min_color_num = 1 if (c==0 and colors[-1]>0) else c
max_color_num = min(8,c+max(int(colors[-1]),0))

print(min_color_num,max_color_num)

Fixed submission:
N,*A=map(int,open(0).read().split())

colors = [0 for i in range(8)]
tyty = 0

for a in A:
  c = a//400
  if c>=8:
    tyty+=1
  else:
    colors[c]+=1

cNum = 8-colors.count(0)
    
minC = max(cNum,1)
maxC = cNum+tyty

print(minC,maxC)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().spli())
print("YES" if b-a == c-b else "NO")

Fixed submission:
a,b,c = map(int,input().split())
print("YES" if b-a == c-b else "NO")
Buggy python submission (verdict: Runtime Error):
S=input()
max_v =0
v =0
for i in S:
  if i=="I":
    v+=1
    if v>max_v:
      max_v=v
  else:
    v-=


Fixed submission:
N=input()
S=input()
max_v =0
v =0
for i in S:
  if i=="I":
    v+=1
    if v>max_v:
      max_v=v
  else:
    v-=1
print(max_v)
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
ans=0
for x in range(K+1):
  for y in range(K+1):
    z= S-x-y
    if x+y+z ==S and 0<=z<=K:
      #print(x,y,z) 
      ans+=1
print(ans)

Fixed submission:
K,S = map(int,input().split())
ans=0
for x in range(K+1):
  for y in range(K+1):
    z= S-x-y
    if x+y+z ==S and 0<=z<=K:
      #print(x,y,z) 
      ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
v

Fixed submission:
import collections
print(len(collections.Counter(input().split())))
Buggy python submission (verdict: Runtime Error):
n=int(intput())
arr=list(input().slpit())
arr.sort();
x=int(1)
for i in arr:
  x=x*i
  if x>1e18:
    x=-1;
    break;
print(x)
  

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
arr.sort();
x=int(1)
for i in arr:
  x=x*i
  if x>1e18:
    x=-1;
    break;
print(x)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a='Xabcdefghijklmnopqrstuvwxyz'
a=list(a)
j=11
ans=''
while True:
    while n<=26**j:
        j-=1
    temp=a[n//26**j]
    ans+=temp
    n%=26**j
    j-=1
    if j==-1:
        break
print(ans)


Fixed submission:
n=int(input())
n-=1
a='abcdefghijklmnopqrstuvwxyz'
a=list(a)
ans=''
for i in range(1,20):
    if n<26**i:
        for j in range(i):
            ans+=a[n%26]
            n//=26
        break
    else:
        n-=26**i
print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
n=int(input())
a='Xabcdefghijklmnopqrstuvwxyz'
a=list(a)
j=11
ans=''
while True:
    while n<26**j:
        j-=1
    temp=a[n//26**j]
    ans+=temp
    n%=26**j
    j-=1
    if j==-1:
        break
print(ans)


Fixed submission:
n=int(input())
n-=1
a='abcdefghijklmnopqrstuvwxyz'
a=list(a)
ans=''
for i in range(1,20):
    if n<26**i:
        for j in range(i):
            ans+=a[n%26]
            n//=26
        break
    else:
        n-=26**i
print(ans[::-1])
Buggy python submission (verdict: Runtime Error):
x,n=map(int,input().split())

p=set(map(int,input().split()))

n=set(n for n in range(-100,101))

pd=list(n-p)

min1=1000

for i in range(len(pd)):
    if abs(pd[i]-x)<abs(min1-x):
        min1=pd[i]
    elif abs(pd[i]-x)==abs(min1-x):
        min1=min(pd[i],min1)
print(min1)

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

for i in range(5):
    if x[i]==0:
        print(i+1)
        break

Buggy python submission (verdict: Runtime Error):
x,n=map(int,input().split())

p=set(map(int,input().split()))

n=set(n for n in range(-100,101))

pd=list(n-p)

min1=1000

for i in range(len(pd)):
    if abs(pd[i]-x)<abs(min1-x):
        min1=pd[i]
    elif abs(pd[i]-x)==abs(min1-x):
        min1=min(pd[i],min1)
print(min1)

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

for i in range(5):
    if x[i]==0:
        print(i+1)
        break
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int x,y;
    cin>>x>>y;
    int s=0;
    
    for (int i=0;i<100;++i)
    {
        for (int j=0;j<=x-i;++j)
        {
            if(y-2*i==j*4)
            {
                cout<<"Yes"<<endl;
                s++;
                break;
            }
        }
    }
    if(s==0){
        cout<<"No"<<endl;
    }
}

Fixed submission:
x,y=map(int,input().split())

for i in range(51):
    if 2*i+4*(x-i)==y:
        print("Yes")
        break
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(len(a)):
    ans*=a[i]
if ans>10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a1=sorted(a,reverse=True)
a2=sorted(a)
ans=1
if len(a)<90:
    for i in range(len(a)):
        ans*=a[i]

else:
    if a2[0]==0:
        ans=0
    elif a1[90]>1:
        ans=-1
    else:
        del a1[90:]
        for i in range(len(a1)):
           ans*=a1[i]
if ans>10**18:
    print(-1)
else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(len(a)):
    ans*=a[i]
if ans>10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a1=sorted(a,reverse=True)
a2=sorted(a)
ans=1
if len(a)<90:
    for i in range(len(a)):
        ans*=a[i]

else:
    if a2[0]==0:
        ans=0
    elif a1[90]>1:
        ans=-1
    else:
        del a1[90:]
        for i in range(len(a1)):
           ans*=a1[i]
if ans>10**18:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
h=list(map(int, input().split()))
a=[j for j in range(1,n+1)]
road=[]*m
for i in range(m):
    c=list(map(int,input().split()))
    road.append(c)
for i in range(m):
    d,e=road[i]
    if h[d-1]==h[e-1]:
        if d in a and e in a:
            a.remove(d)
            a.remove(e)
        elif d in a and e not in a:
            a.remove(d)
        elif d not in a and e in a:
            a.remove(e)
    elif h[d-1]>h[e-1]:
        if e in a:
            a.remove(e)
        else:
            pass
    elif h[d-1]<h[e-1]:
        if d in a:
            a.remove(d)
        else:
            pass
    
print(len(a))

Fixed submission:
n,m=map(int,input().split())
h=[0]+list(map(int, input().split()))
roads=[[] for _ in range(n+1)]
cnt=0
for i in range(m):
    a,b=map(int,input().split())
    roads[a].append(b)
    roads[b].append(a)

for i in range(1,n+1):
    for j in roads[i]:
        if h[i]<=h[j]:
            break
    else:
         cnt+=1
    
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))

for i in range(1,n+1):
    num=a.count(i)
    while True:
        if i in a:
            a.remove(i)
        else:
            break
    print(num)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))

cnt=[0]*(n+1)
for i in range(n-1):
    cnt[a[i]]+=1

for i in range(1,n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))

for i in range(1,n+1):
    num=a.count(i)
    print(num)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))

cnt=[0]*(n+1)
for i in range(n-1):
    cnt[a[i]]+=1

for i in range(1,n+1):
    print(cnt[i])
Buggy python submission (verdict: Time Limit Exceeded):
import math
k=int(input())
ans=0

for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=math.gcd(math.gcd(a,b),c)
print(ans)
            

Fixed submission:
import math
k=int(input())
ans=0

for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=math.gcd(math.gcd(a,b),c)
print(ans)

Buggy python submission (verdict: Runtime Error):
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=math.gcd(math.gcd(a,b),c)
print(ans)

Fixed submission:
import math
k=int(input())
ans=0

for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=math.gcd(math.gcd(a,b),c)
print(ans)