Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
ans=1000000000000000000000
for i in range(n):
    before=s[0:i]
    after=s[i+1:]
    if before.count("W")+after.count("E")<ans:
        ans=before.count("W")+after.count("E")
print(ans)

Fixed submission:
n=int(input())
s=input()
left=[0]*(n+1)
right=[0]*(n+1)
for i in range(n):
    if s[i]=="W":
        left[i+1]=left[i]+1
    else:
        left[i+1]=left[i]

for i in range(n-1,0,-1):
    if s[i]=="E":
        right[i-1]=right[i]+1
    else:
        right[i-1]=right[i]
print(min([left[i]+right[i] for i in range(n)]))

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
half=n//2
if s[half]=="E":
    for i in range(n//2):
        if s[half+1]!=s[half]:
            break
        else:
            half+=1
else:
    for i in range(n//2):
        if s[half-1]!=s[half]:
            break
        else:
            half-=1
before=dict(Counter(s[0:half])).get("W",0)
after=dict(Counter(s[half+1:])).get("E",0)
print(before+after)

Fixed submission:
n=int(input())
s=input()
left=[0]*(n+1)
right=[0]*(n+1)
for i in range(n):
    if s[i]=="W":
        left[i+1]=left[i]+1
    else:
        left[i+1]=left[i]

for i in range(n-1,0,-1):
    if s[i]=="E":
        right[i-1]=right[i]+1
    else:
        right[i-1]=right[i]
print(min([left[i]+right[i] for i in range(n)]))

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
half=n//2
if s[half]=="E":
    for i in range(n//2+1):
        if s[half+1]!=s[half]:
            break
        else:
            half+=1
else:
    for i in range(n//2+1):
        if s[half-1]!=s[half]:
            break
        else:
            half-=1
before=dict(Counter(s[:half])).get("W",0)
after=dict(Counter(s[half+1:])).get("E",0)
print(before+after)

Fixed submission:
n=int(input())
s=input()
left=[0]*(n+1)
right=[0]*(n+1)
for i in range(n):
    if s[i]=="W":
        left[i+1]=left[i]+1
    else:
        left[i+1]=left[i]

for i in range(n-1,0,-1):
    if s[i]=="E":
        right[i-1]=right[i]+1
    else:
        right[i-1]=right[i]
print(min([left[i]+right[i] for i in range(n)]))
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
n=len(s)
ans=[]
for i in range(n):
    for j in range(n-i):
        ans.append(s[i:i+j+1])
print(sorted(list(set(ans)))[k-1])

Fixed submission:
s=input()
k=int(input())
n=len(s)
koho=[]
for i in range(n):
    for j in range(k):
        if len(s[i:i+j+1])<=k:
            koho.append(s[i:i+j+1])

print(sorted(list(set(koho)))[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=[int(i) for i in input().split()]
for i in range(n):
    A=x[0:i]+x[i+1:]
    A.sort()
    half=n//2
    print(A[n-half-1])

Fixed submission:
n=int(input())
x=[int(i) for i in input().split()]
A=sorted(x)
b=A[n//2-1]
c=A[n//2]
for i in x:
    if i<=b:
        print(c)
    else:
        print(b)
Buggy python submission (verdict: Time Limit Exceeded):
q=int(input())
LR=[[int(i) for i in input().split()] for _ in range(q)]
sosu=[False]*(10**5+1)
question=[0]*(10**5+1)
for i in range(2,10**5+1):
    for j in range(2,int(i**0.5)+1):
        if i%j==0:
            break
    else:
        sosu[i]=True
for i in range(3,10**5+1):
    if sosu[i] and sosu[(i+1)//2]:
        question[i]=1
for l,r in LR:
    print(sum(question[l:r+1]))

Fixed submission:
q=int(input())
LR=[[int(i) for i in input().split()] for _ in range(q)]
sosu=[False]*(10**5+1)
question=[0]*(10**5+1)
for i in range(2,10**5+1):
    for j in range(2,int(i**0.5)+1):
        if i%j==0:
            break
    else:
        sosu[i]=True
for i in range(3,10**5+1):
    if sosu[i] and sosu[(i+1)//2]:
        question[i]=1
for i in range(1,10**5+1):
    question[i]+=question[i-1]
for l,r in LR:
    print(question[r]-question[l-1])
Buggy python submission (verdict: Runtime Error):
n,C=[int(i) for i in input().split()]
stc=[[int(i) for i in input().split()] for _ in range(n)]
stc.sort(key=lambda x:x[1])
stc.sort(key=lambda x:x[2])
time=[0]*(2*(10**5+1))
end=[[0]*(10**5) for _ in range(C)]

for s,t,c in stc:
    end[c-1][t]+=1

for s,t,c in stc:
    if end[c-1][s]==0:
        time[2*s-1]+=1
    time[2*t]-=1
for i in range(1,2*10**5+2):
    time[i]=time[i-1]+time[i]
print(max(time))

Fixed submission:
n,C=[int(i) for i in input().split()]
stc=[[int(i) for i in input().split()] for _ in range(n)]
time=[0]*(2*(10**5+1))
end=[[0]*(10**5+1) for _ in range(C)]   #チャンネル別の終わりの記録

for s,t,c in stc:
    end[c-1][t]+=1

for s,t,c in stc:
    if end[c-1][s]==0:
        time[2*s-1]+=1
    else:
        time[2*s]+=1
    time[2*t]-=1

for i in range(1,2*10**5+2):
    time[i]+=time[i-1]
print(max(time))

Buggy python submission (verdict: Runtime Error):
n,c=[int(i) for i in input().split()]
stc=sorted([[int(i) for i in input().split()] for _ in range(n)],key=lambda x:x[0])
time=[0]*(10**5)
for s,t,c in stc:
    time[s-1]+=1
    time[t]-=1
for i in range(10**5):
    time[i]=time[i-1]+time[i]
print(max(time))

Fixed submission:
n,C=[int(i) for i in input().split()]
stc=[[int(i) for i in input().split()] for _ in range(n)]
time=[0]*(2*(10**5+1))
end=[[0]*(10**5+1) for _ in range(C)]   #チャンネル別の終わりの記録

for s,t,c in stc:
    end[c-1][t]+=1

for s,t,c in stc:
    if end[c-1][s]==0:
        time[2*s-1]+=1
    else:
        time[2*s]+=1
    time[2*t]-=1

for i in range(1,2*10**5+2):
    time[i]+=time[i-1]
print(max(time))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n=int(input())
numList=deque([])
for i in range(n):
    a=input()
    if a in numList:
        numList.remove(a)
    else:
        numList.append(a)
print(len(numList))

Fixed submission:
from collections import Counter
n=int(input())
a=[int(input()) for i in range(n)]
cnt=Counter(a)
print(len(tuple(i for i in cnt.values() if i%2==1)))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m=[int(i) for i in input().split()]
a_to=deque([])
to_b=deque([])
for i in range(m):
    a,b=[int(i) for i in input().split()]
    if a==1:
        a_to.append(b)
    if b==n:
        to_b.append(a)
for i in a_to:
    if i in to_b:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
n,m=[int(i) for i in input().split()]
a_to_b=[0]*n
for i in range(m):
    a,b=[int(j) for j in input().split()]
    if a==1:
        a_to_b[b]+=1
    if b==n:
        a_to_b[a]+=1
if 2 in a_to_b:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n,m=[int(i) for i in input().split()]
voyage=[tuple(int(i) for i in input().split()) for _ in range(m)]
for i in range(m):
    if voyage[i][0]==1:
        if (voyage[i][1],n) in voyage:
            print("POSSIBLE")
            break
else:
    print("IMPOSSIBLE")

Fixed submission:
n,m=[int(i) for i in input().split()]
a_to_b=[0]*n
for i in range(m):
    a,b=[int(j) for j in input().split()]
    if a==1:
        a_to_b[b]+=1
    if b==n:
        a_to_b[a]+=1
if 2 in a_to_b:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n=int(input())
a=[int(i) for i in input().split()]
ans=deque([])
for i in a:
    ans.append(i)
    ans=list(reversed(ans))
print(*ans,sep=' ')

Fixed submission:
from collections import deque
n=int(input())
a=[int(i) for i in input().split()]
ans=deque([])
for i,j in enumerate(a):
    if n%2==i%2:
        ans.append(j)
    else:
        ans.appendleft(j)
print(*ans,sep=' ')
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=sorted([int(input()) for _ in range(n)])
ans=sum(s)
if ans%10==0:
    tmp=ans
    for i in range(n):
        tmp-=s[i]
        if tmp%10!=0:
            break
    num=ans
    for i in s:
        if i%10!=0:
            num=i
            break
print(max(tmp,ans-num))

Fixed submission:
n=int(input())
s=sorted([int(input()) for _ in range(n)])
ans=sum(s)
tmp=ans
num=ans
if ans%10==0:
    for i in range(n):
        tmp-=s[i]
        if tmp%10!=0:
            break
    for i in s:
        if i%10!=0:
            num=i
            break
print(max(tmp,ans-num))
Buggy python submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
ab=[]
cd=[]
for i in range(n):
    a,b=[int(j) for j in input().split()]
    ab.append((a,b))

for i in range(m):
    c,d=[int(j) for j in input().split()]
    cd.append((c,d))

for i in range(n):
    mini=10000000
    for j in range(m):
        dis=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if mini>dis:
            mini=dis
            point=j+1
    print(point)

Fixed submission:
n,m=[int(i) for i in input().split()]
ab=[]
cd=[]
for i in range(n):
    a,b=[int(j) for j in input().split()]
    ab.append((a,b))

for i in range(m):
    c,d=[int(j) for j in input().split()]
    cd.append((c,d))

for i in range(n):
    mini=10000000000000000
    for j in range(m):
        dis=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if mini>dis:
            mini=dis
            point=j+1
    print(point)
Buggy python submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
a=[input() for i in range(n)]
b=[input() for i in range(m)]
for i in range(m):
    for j in range(len(b[i])):
        if b[i][j]!=a[i][j]:
            result=True
            break
print("No" if result else "Yes")

Fixed submission:
n,m=[int(i) for i in input().split()]
a=[input() for i in range(n)]
b=[input() for i in range(m)]
result=True
for i in range(m):
    if (b[i] in a[i])==False:
        result=False
        break
print("Yes" if result else "No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A_lis=list(map(int,input().split())
x=0           
for i in A_lis:
   x += 1/i
ans = 1/x
print(ans)           
           
  

Fixed submission:
N=int(input())
A_lis=list(map(int,input().split()))
a=0        
for i in A_lis:
   a += 1/i
ans = 1/a
print(ans)
Buggy python submission (verdict: Runtime Error):
*A = map(int,input().split())
A.sort()
print(A[0]+A[1])

Fixed submission:
*A, = map(int,input().split())
A.sort()
print(A[0]+A[1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
c,f=0,0
while(n>0):
  a,b=map(int,input().split())
  if(a==b):
    c+=1
  else:
    c=0
  if(c>=3):
    f=1
    break
  n-=1
if(f==1 or c>=3):
  print("Yes")
else:
  print("No")

Fixed submission:
s=input()
if(s[-1]=='s'):
  s+='es'
else:
  s+='s'
print(s)
Buggy python submission (verdict: Runtime Error):
d,t,s=map(int,input())
if(d/s<=t):
  print("YES")
else:
  print("NO")


Fixed submission:
d,t,s=map(int,input().split())
if(d/s<=t):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
d,t,s=map(int,input())
if(d//t>=s):
  print("YES")
else:
  print("NO")


Fixed submission:
d,t,s=map(int,input().split())
if(d/s<=t):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
d,t,s=map(int,input())
if(d/t>=s):
  print("YES")
else:
  print("NO")

Fixed submission:
d,t,s=map(int,input().split())
if(d/s<=t):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().strip().split()))[:n]
s=0
for i in range(n):
  for j in range(i+1,n):
    s+=a[i]*a[j]
print(s%(10**9+7))

Fixed submission:
n=int(input())
a=list(map(int,input().strip().split()))[:n]
E=sum(a)**2
s=0
s=sum(i*i for i in a)
print(((E-s)//2)%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
n,k,q=map(int,input().split())
list=[]
for i in range(q):
    list.append(int(input()))

point = np.zeros(n+1)
for i in range(len(point)):
    point[i] = k

for i in range(len(list)):
    for j in range(len(point)):
        if j != list[i]:
            point[j] -= 1

for i in range(1,len(point),1):
    if point[i] > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
import sys
import numpy as np
n,k,q=map(int,input().split())
list=[]
for i in range(q):
    list.append(int(input()))

point = [k] * n
for i in range(len(list)):
    point[list[i]-1] += 1

for i in range(len(point)):
    if point[i] > q:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
ans = 0
N = len(S)
for i in range(N):
    if S[i] != S[N-1-i]:
        ans += 1
print(cnt//2)


Fixed submission:
S = input()
ans = 0
N = len(S)
for i in range(N):
    if S[i] != S[N-1-i]:
        ans += 1
print(ans//2)
Buggy python submission (verdict: Runtime Error):
=int(input())
even=N//2
odd=N-even
print(str(odd/N)+'000000000')


Fixed submission:
n = int(input())
a = n // 2
if n % 2 == 1:
    a += 1
print(a / n)
Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    tmp=0
    for k in range(d):
      tmp+=abs(x[i][d]-x[j][d])**2
    tmp=tmp**0.5
    if tmp==int(tmp):1
      ans+=1
print(ans)

Fixed submission:
N, D = map(int, input().split())
X = [list(map(int,input().split())) for i in range(N)]
ans = 0
for i in range(N):
  for j in range(i+1,N):
    tmp = 0
    for k in range(D):
      tmp += abs(X[i][k]-X[j][k])**2
    tmp = tmp**0.5
    if tmp == int(tmp):
      ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())
x=[list(map(int,input().split()))]
ans=0
for i in range(n):
  for j in range(i+1,n):
    tmp=0
    for k in range(d):
      tmp+=abs(x[i][d]-x[j][d])**2
    tmp=tmp**0.5
    if tmp==int(tmp):1
      ans+=1
print(ans)

Fixed submission:
N, D = map(int, input().split())
X = [list(map(int,input().split())) for i in range(N)]
ans = 0
for i in range(N):
  for j in range(i+1,N):
    tmp = 0
    for k in range(D):
      tmp += abs(X[i][k]-X[j][k])**2
    tmp = tmp**0.5
    if tmp == int(tmp):
      ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
d.sort()
print(d[n//2]-d[n//
   

Fixed submission:
n=int(input())
d=list(map(int,input().split()))
d.sort()
print(d[n//2]-d[n//2-1])
Buggy python submission (verdict: Runtime Error):
,x=map(int,input().split())
ans=0
oh=0
l=[int(i) for i in input().split()]
for j in l:
  if sum(l)<=x:
      if x>=oh:
          ans+=1
  elif x>=oh:
      ans+=1
  oh+=j   
if sum(l)<=x:
  print(ans+1)
else:
  print(ans)
  

Fixed submission:
n,x=map(int,input().split())
ans=0
oh=0
l=[int(i) for i in input().split()] 
for j in l:
  if x>=oh:
    ans+=1
  oh+=j
if sum(l)<=x:
    print(ans+1)
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
a,p = map(int,input().split())
 print(int((a*3+p)//2))

Fixed submission:
a,p = map(int,input().split())
print((a*3+p)//2)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
for i in n:
	if i==k:
        if i=='A':
            i='a'
        elif i=='B':
            i='b'
        elif i=='C':
            i='c'        
print(i)
    

Fixed submission:
n,k=map(int,input().split())
S=list(input())
s=S[k-1].lower()
S[k-1]=s
lst=''.join(S)
print(lst)
Buggy python submission (verdict: Runtime Error):
n = int( input() )

for i in range( 0, n ):
	m =  input() 
	print(m)
nm=0
nm1=0
cnt=m
for i in cnt:
      if i=='A' or i=='B':
              nm+=1
              nm1=max(nm1,nm)
      else:
              nm=0
print(nm1)

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

for i in range(k):
      nm=[i,1+i ]
for j in range (n):
      nm1=[i,1+i]
print(n-k+1)

Buggy python submission (verdict: Runtime Error):
n = int( input() )

for i in range( 0, n ):
	m =  input() 
	print(m)
nm=0
nm1=0
cnt=m
for i in cnt:
      if i=='A' or i=='B':
              nm+=1
              nm1=max(nm1,nm)
      else:
              nm=0
print(nm1)

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

for i in range(k):
      nm=[i,1+i ]
for j in range (n):
      nm1=[i,1+i]
print(n-k+1)
Buggy python submission (verdict: Runtime Error):
n=input()
s1,s2=input()      
nm=0
nm1=0
cnt=s1+s2
for i in cnt:
      if i=='A' or i=='B':
              nm+=1
              nm1=max(nm1,nm)
      else:
              nm=0
print(nm1)

Fixed submission:
N = int(input())
c1 = 0
c2 = 0
c3 = 0
count = 0
for i in range(N):
  s = input()
  count += s.count('AB')
  if s[0] == 'B' and s[-1] == 'A':
    c1 += 1
  elif s[0] == 'B' and s[-1] != 'A':
    c2 += 1
  elif s[0] != 'B' and s[-1] == 'A':
    c3 += 1
  else:
    pass

if c1 == 0:
  print(count + min(c2,c3))
else:
  if c2 > 0 or c3 > 0:
    print(count + c1 + min(c2,c3))
  else:
    print(count + c1-1)

Buggy python submission (verdict: Runtime Error):
n=input()
while True:
       for j in range(n):
              j=input()
       
nm=0
nm1=0
cnt=j
for i in cnt:
      if i=='A' or i=='B':
              nm+=1
              nm1=max(nm1,nm)
      else:
              nm=0
print(nm1)

Fixed submission:
N = int(input())
c1 = 0
c2 = 0
c3 = 0
count = 0
for i in range(N):
  s = input()
  count += s.count('AB')
  if s[0] == 'B' and s[-1] == 'A':
    c1 += 1
  elif s[0] == 'B' and s[-1] != 'A':
    c2 += 1
  elif s[0] != 'B' and s[-1] == 'A':
    c3 += 1
  else:
    pass

if c1 == 0:
  print(count + min(c2,c3))
else:
  if c2 > 0 or c3 > 0:
    print(count + c1 + min(c2,c3))
  else:
    print(count + c1-1)
Buggy python submission (verdict: Runtime Error):
=int(input())
s=input()
bl=s.count('#')
wh=s.count('.')
if bl>wh:
    print(wh)
elif wh>bl:
    print(bl)

Fixed submission:
N=int(input())
S = input()
white = S.count(".")
black = 0
ans = white + black
for i in range (N):
    if S[i] == "." :
        white -= 1
    else:
        black += 1
    ans = min(ans,white+black)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
x=0
if a=b:
    print(a+b)
elif a>b:
    print(a+a-1)
else:
    print(b+b-1)

Fixed submission:
a,b=map(int, input().split())
x=0
if a==b:
    x=a+b
elif a>b:
    x=a+a-1
else:
    x=b+b-1
print(x)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a=b=c:
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c=map(int,input().split())
if a==b==c:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x==7 or x==5 or x==3:
    print('YES)
else:
    print('NO')

Fixed submission:
x=int(input())

if x==7 or x==5 or x==3:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
x=int(input())
if x==7 or x==5 or x==3:
    print(YES)
else:
    print(NO)

Fixed submission:
x=int(input())

if x==7 or x==5 or x==3:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
x=int(input())
if x==7 or x==5 or x==3:
    print(Yes)
else:
    print(No)

Fixed submission:
x=int(input())

if x==7 or x==5 or x==3:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
N,I=map(int,input().split())
print(N-I+


Fixed submission:
n,i=map(int,input().split())
print(n-i+1)
Buggy python submission (verdict: Runtime Error):
a, b = input().split(' ')
print (a * b)

Fixed submission:
arr = input().split(' ')
a = int(arr[0])
b = int(arr[1])
print (a * b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = [ int(x) for x in input().strip().split(' ') ]
isZ = False
for x in arr:
    if x == 0:
        isZ = True

if isZ:
    print ("0")
    exit(0)

res = 1
for x in arr:
    res *= x
    if res > 1000000000000000000:
        print ("-1")
        exit(0)
p

Fixed submission:
n = int(input())
arr = [ int(x) for x in input().strip().split(' ') ]
isZ = False
for x in arr:
    if x == 0:
        isZ = True

if isZ:
    print ("0")
    exit(0)

res = 1
for x in arr:
    res *= x
    if res > 1000000000000000000:
        print ("-1")
        exit(0)
print (res)
Buggy python submission (verdict: Runtime Error):
from  math import log10
n = int(input())
dig = int(log10(n)+1)
cnt = 0
for _ in range(dig):
  cnt += n%10 
  n //= 10
print('Yes' if cnt%9 == 0 else 'No')

Fixed submission:
print('Yes' if sum(list(map(int, list(input()))))%9 == 0 else 'No')
Buggy python submission (verdict: Runtime Error):
, r, d = map(int, input().split())
cnt = 0
for i in range(l, r+1):
  if i%d == 0:
    cnt += 1
print(cnt)

Fixed submission:
l, r, d = map(int, input().split())
cnt = 0
for i in range(l, r+1):
  if i%d == 0:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input()
a = list(map(int, input().split()))
cnt = 0
for i in range(len(a)):
  if (i+1)%2 != 0 and a[i]%2 != 0:
    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(len(a)):
  if (i+1)%2 != 0 and a[i]%2 != 0:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(print(0 if n%1000 == 0 else 1000*((n//1000)+1) - n)

Fixed submission:
n = int(input())
print(0 if n%1000 == 0 else 1000*((n//1000)+1) - n)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, k = map(int, input().split())
a =  list(map(int, input().split()))
b = list(map(int, input().split()))
a_sum, b_sum = [0], [0]
for i in range(n):
  a_sum.append(a_sum[i]+a[i])
for i in range(m):
  b_sum.append(b_sum[i]+b[i])
ans, j = 0, m
for i in range(n+1):
  if a_sum[i] > k:
    break
  while b_sum[j] > k - a_sum[i]:
    j =- 1
  ans = max(ans, i+j)
print(ans)

Fixed submission:
n, m, k = map(int, input().split())
a =  list(map(int, input().split()))
b = list(map(int, input().split()))
a_sum, b_sum = [0], [0]
for i in range(n):
  a_sum.append(a_sum[i]+a[i])
for i in range(m):
  b_sum.append(b_sum[i]+b[i])
ans, j = 0, m
for i in range(n+1):
  if a_sum[i] > k:
    break
  while b_sum[j] > k - a_sum[i]:
    j -= 1
  ans = max(ans, i+j)
print(ans)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = list(map(int, input().split()))
unique = set(range(1, max(p)+1)) - set(p)
ans = {}
ans2 = []
for i in unique:
  calc = abs(x-i)
  ans[calc] = i
  ans2.append(calc)
print(ans[min(ans2)])

Fixed submission:
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = list(map(int, input().split()))
unique = set(range(0, 102)) - set(p)
ans = {}
ans2 = []
for i in unique:
  calc = abs(x-i)
  if calc in ans.keys():
    ans[calc] = min(ans[calc], i)
  else:
    ans[calc] = i
  ans2.append(calc)
print(ans[min(ans2)])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(input().split()))
ans = 1
if 0 in a:
  ans = 0
else:
  for i in range(n):
    ans *= a[i]
    if ans >= 10**18:
      ans = -1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
  ans = 0
else:
  for i in range(n):
    ans *= a[i]
    if ans > 10**18:
      ans = -1
      break
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(input().split()))
ans = 1
if 0 in a:
  ans = 0
for i in range(n):
  ans *= a[i]
  print(i)
if ans >= 10**18:
  ans = -1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
  ans = 0
else:
  for i in range(n):
    ans *= a[i]
    if ans > 10**18:
      ans = -1
      break
print(ans)
Buggy python submission (verdict: Runtime Error):
a ,b = map(int, input().split()) 
print(int(a*b))

Fixed submission:
from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print(floor(a * b))