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

Fixed submission:
s=int(input())

l=[s]*(10**6)
for i in range(10**6):
    if l[i]%2==0:
        l[i+1]=l[i]//2
    else:
        l[i+1]=3*l[i]+1
    if l[i]==4:
        print(i+4)
        exit()
    if l[i]==1:
        print(i+4)
        exit()
    if l[i]==2:
        print(i+4)
        exit()

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print((a*b)//2)
Problem p03155 (python)

Fixed submission:
n=int(input())
h=int(input())
w=int(input())
print((n-h+1)*(n-w+1))

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self,n):
        self.n=n
        self.root=[-1]*(n+1)
        self.rnk=[0]*(n+1)

    def Find_Root(self,x):
        if self.root[x]<0:
            return x
        else:
            self.root[x]=self.Find_Root(self.root[x])
            return self.root[x]

    def Unite(self,x,y):
        x=self.Find_Root(x)
        y=self.Find_Root(y)
        if x==y:
            return
        elif self.rnk[x]>self.rnk[y]:
            self.root[x]+=self.root[y]
            self.root[y]=x
        else:
            self.root[y]+=self.root[x]
            self.root[x]=y
            if self.rnk[x]==self.rnk[y]:
                self.rnk[y]+=1

    def isSameGroup(self,x,y):
        return self.Find_Root(x)==self.Find_Root(y)

    def Count(self,x):
        return -self.root[self.Find_Root(x)]

h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
uf=UnionFind(h*w)
dyx=[(1,0),(-1,0),(0,1),(0,-1)]
for i in range(h):
    for j in range(w):
        if g[i][j]==".":
            continue
        p=i*w+j
        for dy,dx in dyx:
            y=i+dy
            x=j+dx
            if 0<=y<h and 0<=x<w:
                if g[y][x]==".":
                    np=y*w+x
                    uf.Unite(p,np)

rt=[0]*(h*w)
for i in range(h*w):
    rt[i]=uf.Find_Root(i)

m=min(rt)
rt=list(map(lambda x:x-m, rt))
m=max(rt)
a=[[0,0] for _ in range(m+1)]
for i in range(h*w):
    y=i//w
    x=i%w
    if g[y][x]=="#":
        a[rt[i]][0]+=1
    else:
        a[rt[i]][1]+=1
ans=0
for i,j in a:
    ans+=i*j

print(ans)
Problem p03161 (python)

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

dp=[0]*n
def calc(n,k,h,dp):
    for i in range(1,n):
        dp[i]=min([dp[j] + abs(h[i]-h[j]) for j in range(max(i-k,0),i)])

calc(n,k,h,dp)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[0]*n
def calc(n,k,h)
    for i in range(1,n):
        dp[i]=min([dp[j] + abs(h[i]-h[j]) for j in range(max(i-k,0),i)])

calc(n,k,h)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[0]*n
def calc(n,k,h)
for i in range(1,n):
    dp[i]=min([dp[j] + abs(h[i]-h[j]) for j in range(max(i-k,0),i)])

calc(n,k,h)
print(dp[-1])
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
x=-61
c=[]
if h[0]==81234:
    print(3)
    exit()
for i in range(n):
    T=t-h[i]*0.006
    if abs(a-T)<abs(a-x):
        c.append(i)
        x=T
print(c[-1]+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
x=-61
c=[]
for i in range(n):
    T=t-h[i]*0.006
    if abs(a-T)<abs(a-x):
        c.append(i)
        x=T
print(c[-1]+1)
Problem p03240 (python)

Fixed submission:
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]

li.sort(key=lambda x: x[2])
a,b,c = li[-1]
for x in range(101):
    for y in range(101):
        h = abs(x-a) + abs(y-b) + c
        if all(k == max(h-abs(x-i)-abs(y-j),0) for i,j,k in li):
            print(x,y,h)
            exit()

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
for cx in range(101):
    for cy in range(101):
        ll=[]
        flag=True
        for i in range(n):
            H=l[i][2]+abs(l[i][0]-cx)+abs(l[i][1]-cy)
            ll.append(H)
            if i!=0 and all(ll[j]!=ll[j-1] for j in range(1,i):
                flag=False
                break
        if flag:
            print(cx,cy,H)
            break

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
for cx in range(101):
    for cy in range(101):
        ll=[]
        flag=True
        for i in range(n):
            H=l[i][2]+abs(l[i][0]-cx)+abs(l[i][1]-cy)
            ll.append(H)
            if i!=0 and all(ll[j]!=ll[j-1] for j in range(i):
                flag=False
                break
        if flag:
            print(cx,cy,H)
            break
Problem p03262 (python)

Fixed submission:
N,X=map(int,input().split())
x=list(map(int,input().split()))
l=[]
for i in range(N):
    l.append(abs(X-x[i]))
def gcd(a,b):
    if a == 0:
        return b
    if b == 0:
        return a
    r = 1
    while r > 0:
        r = a % b
        a = b
        b = r
    return a

ll=[0]*(N+1)
for i in range(N):
    ll[i+1]=gcd(ll[i],l[i])
print(ll[N])

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
x=list(map(int,input().split()))
l=[]
for i in range(N):
    l.append(abs(X-x[i]))
from hase import gcd

ll=[0]*(N+1)
for i in range(N):
    ll[i+1]=gcd(ll[i],l[i])
print(ll[N])
Problem p03273 (python)

Fixed submission:
h,w=map(int,input().split())
a=[list(input()) for i in range(h)]
#print(a)
H=[]
W=[]
for i in range(h):
    count=0
    for j in range(w):
        if a[i][j]==".":
            count+=1
    if count==w:
        H.append(i)
for i in range(w):
    count=0
    for j in range(h):
        if a[j][i]==".":
            count+=1
    if count==h:
        W.append(i)
for i in range(1,len(H)+1):
    for j in range(w):
        a[H[-1*i]][j]=""
for i in range(1,len(W)+1):
    for j in range(h):
        a[j][W[-1*i]]=""

for i in range(h):
    if not ("." in a[i] or "#" in a[i]):
        continue
    print("".join(a[i]))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
l=[]
n=0
m=0
cou=0
for i in range(h):
    x=input()
    if x==("."*w):
        cou+=1
        continue
    l.append(list(x))
for i in range(w-1):
    k=0
    for j in range(h-cou):
        if l[j][i]==".":
            k+=1
    if k==h-cou:
        for d in range(h-cou):
            del l[d][i]
for i in range(h-cou):
    l[i]="".join(l[i])
    print(l[i])
Problem p03284 (python)

Fixed submission:
n,k=map(int,input().split())
if n%k==0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
from collections import Counter
c=[0]
for i in a:
    c.append((c[-1]+i)%m)
cc=Counter(c)
ans=0
for i in cc.values():
    ans+=i*(i-1)//2
print(ans)
Problem p03287 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
from collections import Counter
c=[0]
for i in a:
    c.append((c[-1]+i)%m)
cc=Counter(c)
ans=0
for i in cc.values():
    ans+=i*(i-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
from collections import Counter
c=[0]
for i in a:
    c.append((c[-1]+a)%m)
cc=Counter(c)
ans=0
for i in cc.values():
    ans+=i*(i-1)//2
print(ans)
Problem p03288 (python)

Fixed submission:
r=int(input())
if r<1200:
    print("ABC")
elif r<2800:
    print("ARC")
else:
    print("AGC")

Buggy submission (verdict: Runtime Error):
d,g=map(int,input().split())
ans=10000
p=[]
c=[]
for i in range(d):
    a,b=map(int,input().split())
    p.append(a)
    c.append(b)
for i in range(2**d):
    x=0
    cou=0
    l=[]
    for j in range(d):
        if ((i>>j)&1):
            x+=c[j]+p[j]*(j+1)*100
            cou+=p[j]
        else:
            l.append(j)
    l.sort(reverse=True)
    k=0
    while x<g:
        for _ in range(p[l[k]]):
            if x>=g:
                break
            cou+=1
            x+=(100*(l[k]+1))
        k+=1
        if k>=len(l):
            break
    ans=min(ans,cou)
print(ans)
Problem p03316 (python)

Fixed submission:
n=int(input())
nl=str(n)
l=map(int,list(nl))
s=sum(l)

if n%s==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=list(input())
s=sum(n)
n=int(n)
if n%s==0:
    print("Yes")
else:
    print("No")
Problem p03330 (python)

Fixed submission:
n,m=map(int,input().split())
d=[list(map(int,input().split())) for _ in range(m)]
c=[list(map(int,input().split())) for _ in range(n)]
ans0=[0]
ans1=[0]
ans2=[0]
for k in range(1,m+1):
    a0=0
    a1=0
    a2=0
    for i in range(n):
        for j in range(n):
            if (i+j+2)%3==0:
                a0+=d[c[i][j]-1][k-1]
            elif (i+j+2)%3==1:
                a1+=d[c[i][j]-1][k-1]
            else:
                a2+=d[c[i][j]-1][k-1]
    ans0.append(a0)
    ans1.append(a1)
    ans2.append(a2)
ans=float("inf")
import itertools
for x,y,z in itertools.permutations(range(1,m+1),3):
    ans=min(ans,ans0[x]+ans1[y]+ans2[z])

print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
d=[list(map(int,input().split())) for _ in range(m)]
c=[list(map(int,input().split())) for _ in range(n)]
ans0=[0]
ans1=[0]
ans2=[0]
for k in range(1,m+1):
    a0=0
    a1=0
    a2=0
    for i in range(n):
        for j in range(n):
            if (i+j+2)%3==0:
                a0+=d[c[i][j]-1][k-1]
            elif (i+j+2)%3==1:
                a1+=d[c[i][j]-1][k-1]
            else:
                a2+=d[c[i][j]-1][k-1]
    ans0.append(a0)
    ans1.append(a1)
    ans2.append(a2)
ans=float("inf")
import itertools
for x,y,z in itertools.permutations(range(1,m+1)):
    ans=min(ans,ans0[x]+ans1[y]+ans2[z])

print(ans)
Problem p03380 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
mx=max(a)
d=mx
ans=0
if n==2:
  print(100,0)
  exit()
for i in a:
  if abs(i-mx/2)<d:
    d=abs(i-mx/2)
    ans=i
print(mx,ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
k=n//2

def cmb(n, r):
    nCr = {}
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

if n%2==1:
    print(a[-1],a[k])
elif n==2:
    print(a[1],a[0])
else:
    if cmb(a[-1],a[k])>cmb(a[-1],a[k+1]):
        print(a[-1],a[k])
    else:
        print(a[-1],a[k+1])
Problem p03415 (python)

Fixed submission:
c1=input()
c2=input()
c3=input()
print(c1[0]+c2[1]+c3[2])

Buggy submission (verdict: Runtime Error):
c1=input()
c2=input()
c3=input()
print(c1[0]+c2[1]+c3[2
Problem p03427 (python)

Fixed submission:
n=list(map(int,list(input())))
k=len(n)
c=n[0]
f=1
for i in range(1,k):
    if n[i]!=9:
        f=0
if f:
    print(sum(n))
else:
    print(c+9*(k-1)-1)

Buggy submission (verdict: Runtime Error):
n=list(map(int,list(input())))
k=len(n)
c=n[0]
for i in range(1,k):
    f=1
    if n[i]!=9:
        f=0
if f:
    print(sum(n))
else:
    print(c+9*(k-1)-1)
Problem p03434 (python)

Fixed submission:
n=int(input())
alice=[]
bob=[]
l=list(map(int,input().split()))
while len(l)>0:
    alice.append(max(l))
    l.remove(max(l))
    if len(l)>0:
        bob.append(max(l))
        l.remove(max(l))

print(sum(alice)-sum(bob))

Buggy submission (verdict: Runtime Error):
n=int(input())
alice=[]
bob=[]
l=list(map(int,input().split()))
while len(l)>0:
    alice.append(max(l))
    l.remove(max(l))
    bob.append(max(l))
    l.remove(max(l))

print(sum(alice)-sum(bob))
Problem p03447 (python)

Fixed submission:
x=int(input())
a=int(input())
b=int(input())
m=0
for i in range(1,10001):
    if (x-a)/(b*i)<1:
        m=i-1
        break
print((x-a-b*m))

Buggy submission (verdict: Runtime Error):
x=int(input())
a=int(input())
b=int(input())
m=0
for i in range(1,10001)
    if (x-a)/(b*i)<1:
        m=i-1
        break
print((x-a-b*m))
Problem p03469 (python)

Fixed submission:
s=input()
ss=s.replace("7","8",1)
print(ss)

Buggy submission (verdict: Runtime Error):
s=input()
ss=s.replace(7,8,1)
print(ss)
Problem p03486 (python)

Fixed submission:
s=input()
t=input()
ss="".join(sorted(s))
tt="".join(sorted(t,reverse=True))
if ss<tt:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
ss=sorted(s)
tt=sorted(t,reversed)
if ss<tt:
    print("Yes")
else:
    print("No")
Problem p03493 (python)

Fixed submission:
s=input()
m=0
for i in s:
    if i=="1":
        m+=1
print(m)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
d={}
for i in a:
    d[i]=d.get(i,0)+1
c=0
while len(d)>k:
    x=min(d, key=d.get)
    c+=d[x]
    del d[x]
print(c)
Problem p03502 (python)

Fixed submission:
n=int(input())
l=[int(c) for c in str(n)]
f=sum(l)
if n%f==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input().split())
l=list(n)
f=sum(l)
if n%f==0:
    print("Yes")
else:
    print("No")
Problem p03573 (python)

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

if a==b:
    print(c)
elif b==c:
    print(a)
elif c==a:
    print(b)
else:
    pass

Buggy submission (verdict: Runtime Error):
a,b,c=(int(x) for x in input().split())

if a=b:
    print(c)
elif b=c:
    print(a)
elif c=a:
    print(b)
else:
    pass
Problem p03589 (python)

Fixed submission:
N=int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if 4*h*n-N*n-h*N==0:
            continue
        w=(N*h*n)/(4*h*n-N*n-h*N)
        if w==int(w) and w>=1:
            print(h,n,int(w))
            exit()

Buggy submission (verdict: Runtime Error):
N=int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if 4/N-1/h-1/n==0:
            continue
        w=(N*h*n)/(4*h*n-N*n-h*N)
        if w==int(w) and w>=1:
            print(h,n,int(w))
            exit()
Problem p03597 (python)

Fixed submission:
n=int(input())
a=int(input())

print(n**2-a)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
x=set()
for i in range(f//a+1):
    for j in range(f//b+1):
        if 0<(a*i+b*j)<=f:
            x.add(a*i+b*j)
y=set()
for i in range(f//c+1):
    for j in range(f//d+1):
        if 0<(c*i+d*j)<=f:
            y.add(c*i+d*j)

ans=[]
noudoma=e/100
for n in x:
    for m in y:
        if n==0:
            continue
        if m/n<=noudoma and (n+m)<=f:
            ans.append([n+m,m,m/(n+m)])

ans.sort(key=lambda x:x[2], reverse=True)


print(ans[0][0],ans[0][1])
Problem p03605 (python)

Fixed submission:
n=int(input())
if n%10==9 or n//10==9:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=input()
if n%10==9 or n//10==9:
    print("Yes")
else:
    print("No")
Problem p03624 (python)

Fixed submission:
s=input()
l=[]
alf=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o",
"p","q","r","s","t","u","v","w","x","y","z"]
for x in alf:
    if str(x) in s:
        pass
    else:
        l.append(x)
if l==[]:
    print("None")
else:
    print(min(l))

Buggy submission (verdict: Runtime Error):
s=input()
l=[]
alf=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o",
"p","q","r","s","t","u","v","w","x","y","z"]
for x in alf:
    if str(x) in s:
        pass
    else:
        l.append(x)
print(min(l))
Problem p03651 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
def gcd(x,y):
    if x==y:
        return x
    elif x>y:
        r=-1
        while r!=0:
            r=x%y
            x=y
            y=r
        return x
    else:
        r=-1
        while r!=0:
            r=y%x
            y=x
            x=r
        return y

if n==1:
    if k==a[0]:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
    exit()
g=gcd(a[0],a[1])
for i in range(2,n):
    g=gcd(g,a[i])
if k%g==0 and k<=max(a):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
def gcd(x,y):
    if x==y:
        return x
    elif x>y:
        r=-1
        while r!=0:
            r=x%y
            x=y
            y=r
        return x
    else:
        r=-1
        while r!=0:
            r=y%x
            y=x
            x=r
        return y

g=gcd(a[0],[1])
for i in range(2,n):
    g=gcd(g,a[i])
if k%g==0 and k<=max(a):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k>max(a):
    print("IMPOSSIBLE")
    exit()
    
sa=float("inf")
a.sort()
b=[abs(a[0]-k)]
for i in range(1,n):
    sa=min(sa,abs(a[i]-a[i-1]))
    b.append(abs(a[i]-k))
f=0
for i in range(n):
    if b[i]%sa==0:
        f=1
print("POSSIBLE" if f else "IMPOSSIBLE")
Problem p03657 (python)

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

if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=(iny(x) for x in input().split())

if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=(iny(x) for x in input().split())

if a%3==0 or b%3==0 or a+b%3==0:
    print("Possible")
else:
    print("Impossible")
Problem p03665 (python)

Fixed submission:
n,p=map(int,input().split())
a=list(map(int,input().split()))
gu=0
ki=0
for i in a:
    if i%2==0:
        gu+=1
    else:
        ki+=1
if ki:
    print(2**(n-1))
else:
    if p:
        print(0)
    else:
        print(2**n)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())
a=list(map(int,input().split()))
gu=0
ki=0
for i in a:
    if a%2==0:
        gu+=1
    else:
        ki+=1
if ki:
    print(2**(n-1))
else:
    if p:
        print(0)
    else:
        print(2**n)
Problem p03698 (python)

Fixed submission:
s=input()
for i in range(len(s)):
    x=-1
    for j in range(len(s)):
        if s[i]==s[j]:
            x+=1
    if x!=0:
        print("no")
        exit()
print("yes")

Buggy submission (verdict: Runtime Error):
n=input()
l=list(map(int,input().split()))
print(max(l)-min(l))
Problem p03760 (python)

Fixed submission:
o=list(input())
e=list(input())
l=[]
if len(o)==len(e):
    for i in range(len(o)):
        l.append(o[i])
        l.append(e[i])
    print("".join(l))
else:
    for i in range(len(e)):
        l.append(o[i])
        l.append(e[i])
    l.append(o[len(o)-1])
    print("".join(l))

Buggy submission (verdict: Runtime Error):
o=list(input())
e=list(input())
l=[]
if len(o)==len(e):
    for i in range(len(o)):
        l.append(o[i])
        l.append(e[i])
    print("".join(l))
else:
    for i in range(len(e)):
        l.append(o[i])
        l.append(e[i])
    l.append(o[len(o)])
    print("".join(l))
Problem p03777 (python)

Fixed submission:
a,b = (str(x) for x in input().split())
if a == "H":
    pass
elif b == "H":
    b = "D"
else:
    b = "H"

print(b)

Buggy submission (verdict: Runtime Error):
a,b = (str(x) for x in input().split())
if a = "H":
    pass
elif b = "H":
    b = "D"
else:
    b = "H"

print(b)

Buggy submission (verdict: Runtime Error):
a,b = (str(x) for x in input().split())
if a = "H":
    continue
elif b = "H":
    b = "D"
else:
    b = "H"

print(b)
Problem p03826 (python)

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

s1 = a*b
s2 = c*d

if s1>=s2:
    print(s1)
else:
    print(s2)

Buggy submission (verdict: Runtime Error):
a,b,c,d = int(input().split())

s1 = a*b
s2 = c*d

if s1>=s2:
    print(s1)
else:
    print(s2)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

s1 = a*b
s2 = c*d

if s1>=s2:
    print(s1)
else:
    print(s2)
Problem p03845 (python)

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
ans=[]
for i in range(m):
    p,x=map(int,input().split())
    ans.append(sum(t)-(t[p-1]-x))
for i in range(m):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
    p,x=map(int,input().split())
    t[p+1]=x
print(sum(t))
Problem p03846 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
mod=10**9+7
f=True
if n==1:
    if a[0]==0:
        print(1)
    else:
        print(0)
    exit()
if n%2==1:
    if a[0]!=0 or a[1]==0:
        f=False
    for i in range(1,n-1,2):
        if not (a[i]==i+1 and a[i+1]==i+1):
            f=False
else:
    for i in range(0,n,2):
        if not (a[i]==i+1 and a[i+1]==i+1):
            f=False
if f:
    print((2**(n//2))%mod)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
mod=10**9+7
f=True
if n%2==1:
    if a[0]!=0 or a[1]==0:
        f=False
    for i in range(1,n-1,2):
        if not (a[i]==i+1 and a[i+1]==i+1):
            f=False
else:
    for i in range(0,n,2):
        if not (a[i]==i+1 and a[i+1]==i+1):
            f=False
if f:
    print((2**(n//2))%mod)
else:
    print(0)
Problem p03943 (python)

Fixed submission:
l=list(map(int,input().split()))
if max(l)*2==sum(l):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if max(a,b,c)*2==sum(a,b,c):
    print("Yes")
else:
    print("No")
Problem p03992 (python)

Fixed submission:
s=list(input())
s.insert(4," ")
print("".join(s))

Buggy submission (verdict: Runtime Error):
s=list(input())
k=int(input())
for i in range(len(s)):
    if k>=ord("z")-ord(s[i])+1:
        k-=(ord("z")-ord(s[i])+1)
        s[i]="a"

if k>0:
    if ord("z")-(ord(s[-1])+k)<=0:
        k-=ord("z")-ord(s[-1])+1
        k%=26
        s[-1]=chr(ord("a")+k)
    else:
        s[-1]=chr(ord(s[-1])+k)

print("".join(s))
Problem p03994 (python)

Fixed submission:
s=list(input())
k=int(input())
for i in range(len(s)):
    if s[i]=="a":
        continue
    if k>=ord("z")-ord(s[i])+1:
        k-=(ord("z")-ord(s[i])+1)
        s[i]="a"

if k>0:
    k%=26
    s[-1]=chr(ord(s[-1])+k)

print("".join(s))

Buggy submission (verdict: Runtime Error):
s=list(input())
k=int(input())
for i in range(len(s)):
    if k>=ord("z")-ord(s[i])+1:
        k-=(ord("z")-ord(s[i])+1)
        s[i]="a"

if k:
    s[-1]=chr(ord(s[-1])+k)

print("".join(s))
Problem p04031 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l=[]
for x in range(-100,101):
    c=0
    for i in range(n):
        c+=(a[i]-x)**2
    l.append(c)

print(min(l))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
l=[]
for x in range(-100,101):
    c=0
    for i in range(n):
        c+=(a[i]-x)**2
    l.append(c)

print(min(c))
Problem p04043 (python)

Fixed submission:
a,b,c=map(int,input().split())
l=[]
l.append(a)
l.append(b)
l.append(c)
if l==[5,5,7] or l==[5,7,5] or l==[7,5,5]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
l=[]
l.append(len(a))
l.append(len(b))
l.append(len(c))
if l==[5,5,7] or l=[5,7,5] or l=[7,5,5]:
    print("YES")
else:
    print("NO")