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

Fixed submission:
import sys
input = sys.stdin.readline

mod=1000000007
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
al=len(a)


f=0
for i in range(al-1):
    if a[i+1]==a[i]+1:
        f=1
        break
if f==1:
    print(0)
else:
    dp=[0]*(n+1)
    dp[0]=1
    if 1 in a:
        dp[1]=0
        a.pop(0)
        al-=1
    else:
        dp[1]=1
    
    for i in range(2,n+1):
        if al>0 and i==a[0]:
            dp[i]=0
            a.pop(0)
            al-=1
        else:
            dp[i]=(dp[i-1]+dp[i-2])%mod
    print(dp[n]%mod)

Buggy submission (verdict: Runtime Error):
mod=1000000007
n,m=map(int,input().split())
a=[]
af=0
for i in range(m):
    a.append(int(input()))
if len(a)>0:
    a.sort()
    af=1
f=0
for i in range(len(a)):
    if a[i]+1 in a:
        f=1
        break
if f==1:
    print(0)
else:
    dp=[0]*(n+1)
    dp[0]=1
    if 1 in a:
        dp[1]=0
        a.pop(0)
    else:
        dp[1]=1
    
    for i in range(2,n+1):
        if af==1 and i==a[0]:
            dp[i]=0
            a.pop(0)
        else:
            dp[i]=(dp[i-1]+dp[i-2])%mod
    print(dp[n]%mod)

Buggy submission (verdict: Runtime Error):
mod=1000000007
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
a.sort()
f=0
for i in range(len(a)):
    if a[i]+1 in a:
        f=1
        break
if f==1:
    print(0)
else:
    dp=[0]*(n+1)
    dp[0]=1
    if 1 in a:
        dp[1]=0
    else:
        dp[1]=1
    
    for i in range(2,n+1):
        if i==a[0]:
            dp[i]=0
            a.pop(0)
        else:
            dp[i]=(dp[i-1]+dp[i-2])%mod
    print(dp[n]%mod)

Buggy submission (verdict: Runtime Error):
mod=1000000007
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
f=0
for i in range(len(a)):
    if a[i]+1 in a:
        f=1
        break
if f==1:
    print(0)
else:
    dp=[0]*(n+1)
    dp[0]=1
    if 1 in a:
        dp[1]=0
    else:
        dp[1]=1
    
    for i in range(2,n+1):
        if i in a:
            dp[i]=0
        else:
            dp[i]=(dp[i-1]+dp[i-2])%mod
    print(dp[n]%mod)
Problem p03018 (python)

Fixed submission:
s=list(input())
n=len(s)
l=[]
i=0
while i<n:
    if i<n-1 and s[i]=='B' and s[i+1]=='C':
        l.append('D')
        i+=2
    else:
        l.append(s[i])
        i+=1
n=len(l)
ans=0
r=[0]*(n+1)
f=0
for i in range(n-1,-1,-1):
    if l[i]=='D':
        f+=1
    elif l[i]=='A':
        ans+=f
    else:
        f=0
print(ans)

Buggy submission (verdict: Runtime Error):
s=list(input())
n=len(s)
l=[]
i=0
while i<n:
    if i<n-1 and l[i]=='B' and l[i+1]=='C':
        l.append('D')
        i+=2
    else:
        l.append(s[i])
        i+=1
n=len(l)
ans=0
r=[0]*(n+1)
f=0
for i in range(n-1,-1,-1):
    if l[i]=='D':
        f+=1
    elif l[i]=='A':
        ans+=f
    else:
        f=0
print(ans)

Buggy submission (verdict: Runtime Error):
s=list(input())
n=len(s)
l=[]
i=0
while i<n:
    if i<n-1 and l[i]=='B' and l[i+1]=='C':
        l.append('D')
        i+=2
    else:
        l.append(l[i])
        i+=1
n=len(l)
ans=0
r=[0]*(n+1)
f=0
for i in range(n-1,-1,-1):
    if l[i]=='D':
        f+=1
    elif l[i]=='A':
        ans+=f
    else:
        f=0
print(ans)
Problem p03038 (python)

Fixed submission:
import numpy as np
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[0]*m
c=[0]*m
for i in range(m):
    b[i],c[i]=map(int,input().split())
xc=np.argsort(c)
a.sort()
co=0
f=0
for i in range(m-1,-1,-1):
    for j in range(b[xc[i]]):
        a[co]=max(a[co],c[xc[i]])
        if a[co]>c[xc[i]]:
            f=1
            break                
        co+=1
        if co>=n:
            f=1 
            break
    if f==1:
        break
print(sum(a))

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[0]*m
c=[0]*m
for i in range(m):
    b[i],c[i]=map(int,input().split())
xc=np.argsort(c)
a.sort()
co=0
for i in range(m-1,-1,-1):
    for j in range(b[xc[i]]):
        a[co]=max(a[j],c[xc[i]])
        if a[j]>c[xc[i]]:
            break                
        co+=1
print(sum(a))

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[0]*m
c=[0]*m
for i in range(m):
    b[i],c[i]=map(int,input().split())
xc=np.argsort(c)
a.sort()
for i in range(m-1,-1,0):
    for j in range(b[xc[i]]):
        a[j]=max(a[j],c[xc[i]])
    a.sort()
print(sum(a))
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
if s[k-1]=='A':
    s[k-1]='a'
elif s[k-1]=='B':
    s[k-1]='b'
else:
    s[k-1]='c'
ans=''
for i in range(n):
    ans+=s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(input())
if s[k-1]='A':
    s[k-1]='a'
elif s[k-1]='B':
    s[k-1]='b'
else:
    s[k-1]='c'
ans=''
for i in range(n):
    ans+=s[i]
print(ans)
Problem p03053 (python)

Fixed submission:
h,w=map(int,input().split())
g=[]
for i in range(h):
    g.append(list(input()))
q=[]
v=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if g[i][j]=='#':
            q.append([i,j])
            v[i][j]=1
ans=0
while len(q)>0:
    tmp=[]
    for i in q:
        a=i[0]
        b=i[1]
        if a==0:
            hi=[1]
        elif a==h-1:
            hi=[-1]
        else:
            hi=[1,-1]
        if h==1:
            hi=[]
        if b==0:
            wi=[1]
        elif b==w-1:
            wi=[-1]
        else:
            wi=[1,-1]
        if w==1:
            wi=[]
        for c in hi:
            if v[a+c][b]==0:
                tmp.append([a+c,b])
                v[a+c][b]=1
        for d in wi:
            if v[a][b+d]==0:
                tmp.append([a,b+d])
                v[a][b+d]=1
    q=tmp
    ans+=1
print(ans-1)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
g=[]
for i in range(h):
    g.append(list(input()))
q=[]
v=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if g[i][j]=='#':
            q.append([i,j])
            v[i][j]=1
ans=0
while len(q)>0:
    tmp=[]
    for i in q:
        a=i[0]
        b=i[1]
        if a==0:
            hi=[1]
        elif a==h-1:
            hi=[-1]
        else:
            hi=[1,-1]
        if b==0:
            wi=[1]
        elif b==w-1:
            wi=[-1]
        else:
            wi=[1,-1]
        for c in hi:
            if v[a+c][b]==0:
                tmp.append([a+c,b])
                v[a+c][b]=1
        for d in wi:
            if v[a][b+d]==0:
                tmp.append([a,b+d])
                v[a][b+d]=1
    q=tmp
    ans+=1
print(ans-1)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
g=[]
for i in range(h):
    g.append(list(input()))
q=[]
v=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if g[i][j]=='#':
            q.append([i,j])
            v[i][j]=1
ans=0
while len(q)>0:
    tmp=[]
    for i in q:
        a=i[0]
        b=i[1]
        if a==0:
            hi=[1]
        elif a==h-1:
            hi=[-1]
        else:
            hi=[1,-1]
        if b==0:
            wi=[1]
        elif b==w-1:
            wi=[-1]
        else:
            wi=[1,-1]
        for c in hi:
            for d in wi:
                if v[a+c][b+d]==0:
                    tmp.append([a+c,b+d])
                    v[a+c][b+d]=1
    q=tmp
    ans+=1
print(ans-1)
Problem p03127 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
n=int(input())
li = list(map(int,input().split()))
a=li[0]
for i in range(n):
    a=gcd(li[i],a)
print(a)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
li = list(map(int,input().split()))
a=li[0]
for i in range(n):
    a=math.gcd(li[i],a)
print(a)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
li = list(map(int,input().split()))
a=li[0]
for i in range(n):
    a=math.gcd(li[i],a)
print(a)
Problem p03201 (python)

Fixed submission:
from bisect import bisect_left
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
A.sort()
t=0
for i in range(N):
    while 2**t<=A[i]:
        if 2**t<=A[i]<2**(t+1):
            break
        t+=1
    B[i]=2**(t+1)-A[i]
i=N-1
count=0
flag=[0]*N
for i in range(N-1,0,-1):
    if flag[i]==1:
        continue
    flag[i]=1
    b=bisect_left(A,B[i])
    if A[b]==B[i] and flag[b]==0:
        flag[i]=1
        flag[b]=1
        A[b]-=1
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
import sys
input=sys.stdin.readline
k=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
i=0
n=k
while i<n:
    s=l[-1]
    b=1
    while b<=s:
        b*=2
    g=b-s
    p=bisect.bisect_left(l,g)
    if p==len(l):
        l.pop(-1)
        i+=1
        continue
    else:
        if l[p]==g:
            l.pop(-1)
            l.pop(p)
            i+=2
            ans+=1
        else:
            l.pop(-1)
            i+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
k=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
i=0
n=k
while i<n:
    s=l[-1]
    b=1
    while b<=s:
        b*=2
    g=b-s
    p=bisect.bisect_left(l,g)
    if p==len(l):
        l.pop(-1)
        i+=1
        continue
    else:
        if l[p]==g:
            l.pop(-1)
            l.pop(p)
            i+=2
            ans+=1
        else:
            l.pop(-1)
            i+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n-1):
    s=l[n-i-1]
    b=1
    while b<=s:
        b*=2
    g=b-s
    p=bisect.bisect_left(l[:n-i-1],g)
    if p==n-i-1:
        continue
    else:
        if l[p]==g:
            l.pop(n-i-1)
            l.pop(p)
            n-=2
            ans+=1
print(ans)
Problem p03208 (python)

Fixed submission:
n,k = map(int,input().split())
li=list(range(n))
for i in range(n):
    li[i]=int(input())
li.sort()
ans=100000000000
for i in range(n-k+1):
    if ans>(li[i+k-1]-li[i]):
        ans=li[i+k-1]-li[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
li=range(n)
for i in range(n):
    li[i]=int(input())
li.sort()
ans=100000000000
for i in range(n-k+1):
    if ans>(li[i+k-1]-li[i]):
        ans=li[i+k-1]-li[i]
print(ans)
Problem p03221 (python)

Fixed submission:
n,m=map(int,input().split())
l=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append([a,b])
x=sorted(l)
dic={}
x.append([0,0])
f=1
for i in range(m):
    if x[i][0]==x[i+1][0]:
        dic[str(x[i][0])+'000000'+str(x[i][1])]=f
        f+=1
    else:
        dic[str(x[i][0])+'000000'+str(x[i][1])]=f
        f=1
for i in range(m):
    b=dic[str(l[i][0])+'000000'+str(l[i][1])]
    p=len(list(str(l[i][0])))
    q=len(list(str(b)))
    ans=''
    for j in range(6-p):
        ans+='0'
    ans+=str(l[i][0])
    for j in range(6-q):
        ans+='0'
    ans+=str(b)
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
d=[[] for i in range(n)]
l=[]
for i in range(m):
    a,b=map(int,input().split())
    d[a-1].append(b)
    l.append(a)
x=[[] for i in range(n)]
for i in range(n):
    d[i]=list(np.argsort(d[i]))
    tmp=[0]*len(d[i])
    for j in range(len(d[i]):
        tmp[d[i][j]]=j+1
    x[i]=tmp
for i in range(m):
    b=x[l[i]-1].pop(0)
    b+=1
    p=len(list(str(l[i])))
    q=len(list(str(b)))
    ans=''
    for j in range(6-p):
        ans+='0'
    ans+=str(l[i])
    for j in range(6-q):
        ans+='0'
    ans+=str(b)
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
d=[[]*m for i in range(n)]
l=[]
for i in range(m):
    a,b=map(int,input().split())
    d[a-1].append(b)
    l.append(a)

for i in range(n):
    d[i]=np.argsort(d[i])
    
for i in range(m):
    b=d[l[i]-1].pop(0)
    b+=1
    p=len(list(str(l[i])))
    q=len(list(str(b)))
    ans=''
    for j in range(6-p):
        ans+='0'
    ans+=str(l[i])
    for j in range(6-q):
        ans+='0'
    ans+=str(b)
    print(ans)
Problem p03327 (python)

Fixed submission:
n=int(input())
if n<=999:
    print('ABC')
else:
    print('ABD')

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
a=y-x
b=a*(a-1)/2
print(round(b-x))
Problem p03332 (python)

Fixed submission:
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        if bi<=n:
            ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
            ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
        ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
        ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)
        ans%=mod
        ans+=p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
        ans%=mod
print(ans)
Problem p03634 (python)

Fixed submission:
from collections import deque
n=int(input())
g=[[] for i in range(n)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    g[a-1].append([b-1,c])
    g[b-1].append([a-1,c])
q,k=map(int,input().split())
qu=deque([[k-1,0]])
v=[0]*n
d=[0]*n
while len(qu)>0:
    s=qu.popleft()
    v[s[0]]=1
    for j in g[s[0]]:
        if not v[j[0]]:
            v[j[0]]=1
            d[j[0]]=s[1]+j[1]
            qu+=[[j[0],d[j[0]]]]
for i in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])

Buggy submission (verdict: Runtime Error):
fron collections import deque
n=int(input())
g=[[] for i in range(n)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    g[a-1].append([b-1,c])
    g[b-1].append([a-1,c])
q,k=map(int,input().split())
qu=deque([[k-1,0]])
v=[0]*n
d=[0]*n
while len(qu)>0:
    s=qu.popleft()
    v[s[0]]=1
    for j in g[s[0]]:
        if not v[j[0]]:
            v[j[0]]=1
            d[j[0]]=s[1]+j[1]
            qu+=[[j[0],d[j[0]]]]
for i in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
g=[[] for i in range(n)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    g[a-1].append([b-1,c])
    g[b-1].append([a-1,c])
q,k=map(int,input().split())
qu=[[k-1,0]]
v=[0]*n
d=[0]*n
while len(qu)>0:
    s0,s1=qu[0]
    qu=qu[1:]
    v[s0]=1
    for j in g[s0]:
        j0,j1=j
        if not v[j0]:
            v[j0]=1
            d[j0]=s[1]+j1
            qu+=[[j0,d[j0]]]
for i in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
g=[[] for i in range(n)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    g[a-1].append([b-1,c])
    g[b-1].append([a-1,c])
q,k=map(int,input().split())
qu=[[k-1,0]]
v=[0]*n
d=[0]*n
while len(qu)>0:
    s=qu.pop(0)
    v[s[0]]=1
    for j in g[s]:
        if not v[j[0]]:
            v[j[0]]=1
            d[j[0]]=s[1]+j[1]
            qu.append([j[0],d[j[0]]])
for i in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])
Problem p03652 (python)

Fixed submission:
n,m=map(int,input().split())
k=[[0]*m for i in range(n)]
for i in range(n):
    k[i]=list(map(int,input().split()))
ans=1000
for i in range(m-1):
    ma=[0]*m
    mi=-1
    for j in range(n):
        ma[k[j][0]-1]+=1
    if ans>max(ma):
        ans=max(ma)
    mi=ma.index(max(ma))+1
    for j in range(n):
        k[j].remove(mi)
if m==1:
    print(n)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
k=[[0]*m for i in range(n)]
for i in range(n):
    k[i]=list(map(int,input().split()))
ans=1000
for i in range(m-1):
    ma=[0]*m
    mi=-1
    for j in range(n):
        ma[k[j][0]]+=1
    if ans>max(ma):
        ans=max(ma)
    mi=ma.index(max(ma))+1
    for j in range(n):
        k[j].remove(mi)
print(ans)
Problem p03723 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a==b and b==c and a%2==0:
    print(-1)
else:
    ans=0
    while a%2==0 and b%2==0 and c%2==0:
        tmp=a
        tmp2=b
        a=(b+c)//2
        b=(c+tmp)//2
        c=(tmp+tmp2)//2
        ans+=1
    print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b and b==c and a%2=0:
    print(-1)
else:
    ans=0
    while a%2==0 ans b%2==0 and c%2==0:
        tmp=a
        tmp2=b
        a=(b+c)//2
        b=(c+tmp)//2
        c=(tmp+tmp2)//2
        ans+=1
    print(ans)
Problem p03806 (python)

Fixed submission:
n,ma,mb=map(int,input().split())
dpn=400001
dp=[10**6]*dpn
dp[0]=0
for i in range(n):
    a,b,c=map(int,input().split())
    for j in range(dpn-1,-1,-1):
        if j==0 or dp[j]!=10**6:
            dp[j+a*1000+b]=min(dp[j+a*1000+b],dp[j]+c)
ans=10**6
s=1000*ma+mb
p=1
while s*p<dpn:
    ans=min(ans,dp[s*p])
    p+=1
if ans==10**6:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,ma,mb=map(int,input().split())
dpn=10**6
dp=[10**6]*dpn
dp[0]=0
for i in range(n):
    a,b,c=map(int,input().split())
    for j in range(dpn,-1,-1):
        if j==0 or dp[j]!=10**6:
            dp[j+a*1000+b]=min(dp[j+a*1000+b],dp[j]+c)
ans=10**6
s=1000*ma+mb
p=1
while s*p<10**6:
    ans=min(ans,dp[s*p])
    p+=1
print(ans)
Problem p02712 (python)

Fixed submission:
ans=int(0)
for i in range(int(input())+1):
    if i%3!=0 and i%5!=0:
        ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
asn=int(0)
for i in range(int(input())):
    if i%3!=0 and i%5!=0:
        ans+=i
print(ans)
Problem p03986 (python)

Fixed submission:
s=str(input())
co=int(1)
n=len(s)
A=[]
for i in range(1,n):
    if s[i]!=s[i-1]:
        A.append(co)
        co=1
    else:
        co+=1
A.append(co)
m=len(A)
how=0
if s[0]=='T':
    how=1

S=int(0)
T=int(0)
for i in range(how,m-how):
    if i%2==how:##s
        S+=A[i]
    else:##t
        T+=A[i]
        if S<T:
            n-=2*S
            T=0
            S=0
        else:
            n-=2*T
            S-=T
            T=0


print(n)

Buggy submission (verdict: Runtime Error):
s=str(input())
co=int(1)
n=len(s)
A=[]
for i in range(1,n):
    if s[i]!=s[i-1]:
        A.append(co)
        co=1
    else:
        co+=1
A.append(co)
m=len(A)
how=0
if s[0]=='T':
    how=1

for i in range(how,m-how):
    if i%2!=how:
        continue

    if A[i]<A[i+1]:
        n-=2*A[i]
    else:
        n-=2*A[i+1] 
print(n)
Problem p04005 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a%2==0 or b%2==0 or c%2==0:
    print(0)
    exit()
x=[a*b,b*c,c*a]
print(min(x))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a%2==0 or b%2==0 or c%2==0:
    print(0)
    exit()

print(min[a*b,b*c,c*a])
Problem p02661 (python)

Fixed submission:
n=int(input())
a=sorted([list(map(int,input().split())) for i in range(n)])
b=sorted(a,key=lambda x:x[1])
if n%2==1:
    print(b[n//2][1]-a[n//2][0]+1)
else:
    print((b[n//2-1][1]+b[n//2][1])-(a[n//2-1][0]+a[n//2][0])+1)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
a=sorted([list(map(int,input().split())) for i in range(n)])
b=sorted(a,key=lambda x:x[1])
if n%2==1:
    print(b[n//2][1]-a[n//2][0]+1)
else:
    print((b[n//2-1][1]+b[n//2][1])-(a[n//2-1][0]-a[n//2][0]))//2)
Problem p02847 (python)

Fixed submission:
a=['SUN','MON','TUE','WED','THU','FRI','SAT']
print(7-a.index(input()))

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
a,b,c,d=[],[],[],[]
for i in range(n):
    b.append([])
for i in range(n-1):
    a.append(list(map(int,input().split())))
for i in range(n-1):
    j=0
    d.append(a[i][0])
    d.append(a[i][1])
    while True:
        if j not in b[a[i][0]-1] and j not in b[a[i][1]-1]:
            c.append(j)
            b[a[i][0]-1].append(j)
            b[a[i][1]-1].append(j)
            break
        j+=1
print(collections.Counter(d).most_common()[0][1])
for i in range(n-1):
    print(c[i]+1)
Problem p03013 (python)

Fixed submission:
z=list(map(int,input().split()))
n,m,b,c=z[0],z[1],[1],0
a=[int(input()) for i in range(m)]
if len(a)>=1:
    if a[0]==1:
        b.append(0)
        c=1
    else:
        b.append(1)
        c=0
else:
    b.append(1)
for i in range(n-1):
    if c<len(a):
        if i+2==a[c]:
            b.append(0)
            c+=1
        else:
            b.append(b[i]+b[i+1])
    else:
        b.append(b[i]+b[i+1])
print(b[-1]%1000000007)

Buggy submission (verdict: Runtime Error):
z=list(map(int,input().split()))
n,m,b=z[0],z[1],[1]
a=[int(input()) for i in range(m)]
if a[0]==1:
    b.append(0)
    c=1
else:
    b.append(1)
    c=0
for i in range(n-1):
    if c<len(a):
        if i+2==a[c]:
            b.append(0)
            c+=1
        else:
            b.append(b[i]+b[i+1])
    else:
        b.append(b[i]+b[i+1])
print(b[-1]%1000000007)
Problem p03072 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=1
for i in range(n-1):
    if a[i+1]>=max(a[0:i+1]):
        b+=1
print(b)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=0
for i in range(n):
    if a[i]>=max(a[0:i]):
        b+=1
print(b)
Problem p03075 (python)

Fixed submission:
a=[int(input()) for i in range(6)]
b=a[4]-a[0]
if a[5]>=b:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
a=[int(input()) for i in range(6)]
if a[4]-a[0]>=a[5]:
  print'Yay!'
  else:
    print ':('

Buggy submission (verdict: Runtime Error):
a=[int(input()) for i in range(6)]
if (a[4]-a[0]>=a[5]):
  print'Yay!'
  else print ':('

Buggy submission (verdict: Runtime Error):
a=[int(input()) for i in range(6)]
if a[4]-a[0]>=a[5]:
  print'Yay!'
  else print ':('
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce
def g(n):
    return reduce(fractions.gcd,n)
n=int(input())
print(g(list(map(int,input().split()))))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def g(n):
    return reduce(math.gcd,n)
n=int(input())
print(g(list(map(int,input().split()))))
Problem p03272 (python)

Fixed submission:
a=list(map(int,input().split()))
print(a[0]-a[1]+1)

Buggy submission (verdict: Runtime Error):
a=list(map(int(input().split()))
print(a[0]-a[1]+1)
Problem p03315 (python)

Fixed submission:
a=input()
b=0
for i in range(4):
    if a[i]=="+":
        b+=1
    else:
        b-=1
print(b)

Buggy submission (verdict: Runtime Error):
a=input()
b=0
for i in range(4)
    if a[i]=="+":
        b+=1
    else:
        b-=1
print(b)

Buggy submission (verdict: Runtime Error):
a=input()
b=0
for i while(4)
    if a[i]=="+":
        b+=1
    else:
        b-=1
print(b)
Problem p03327 (python)

Fixed submission:
a=int(input())
if a>=1000:
    print("ABD")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
a=int(input())
if a<=1000:
    print("ABD"+(a-999))
else:
    print("ABC"+a)
Problem p03631 (python)

Fixed submission:
a=input()
if a[0]==a[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
if input()[0]==input()[2]:
    print('Yes')
else:
    print('No')