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

Fixed submission:
import fractions, math
n,x=map(int, input().split())
a=list(map(int, input().split()))
mina=min(a+[x])
a=[i-mina for i in a]+[x-mina]
f=max(a)
for i in a:
    if i!=0:
        f=fractions.gcd(f,i)
print(f)

Buggy submission (verdict: Runtime Error):
n,x=map(int, input().split())
a=list(map(int, input().split()))
mina=min(a)
a=[i-mina for i in a]+[x-mina]
f=max(a)
for i in a:
    if i!=0:
        f=fractions.gcd(f,i)
print(f)
Problem p03303 (python)

Fixed submission:
s=input()
w=int(input())
for i in range((len(s)-1)//w+1):
    print(s[i*w],end='')

Buggy submission (verdict: Runtime Error):
s=input()
w=int(input())
for i in range(len(s)//w+1):
    print(s[i*w],end='')
Problem p03308 (python)

Fixed submission:
a=int(input())
b=list(map(int, input().split()))
print(max(b)-min(b))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(int, input().split()))
print(max(a)-min(b))
Problem p03323 (python)

Fixed submission:
a,b=map(int, input().split())
if a>8 or b>8:print(':(')
else:print('Yay!')

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>8 or b>8:print(':(')
else:print('Yay!')
Problem p03328 (python)

Fixed submission:
a,b=map(int, input().split())
c=list(range(1,1000))
c2=[sum(c[:i+1]) for i in range(len(c))]
d=b-a
print(c2[d-2]-a)

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
c=list(range(1,15))
c2=[sum(c[:i+1]) for i in range(len(c))]
d=b-a
print(c2[d-2]-a)
Problem p03355 (python)

Fixed submission:
s=input()
k=int(input())
s1=list(s)
s2=[s[i:i+2] for i in range(len(s)-1)]
s3=[s[i:i+3] for i in range(len(s)-2)]
s4=[s[i:i+4] for i in range(len(s)-3)]
s5=[s[i:i+5] for i in range(len(s)-4)]
sall=sorted(list(set(s1+s2+s3+s4+s5)))
print(sall[k-1])

Buggy submission (verdict: Runtime Error):
import copy

n,m=map(int, input().split())
p=list(map(int, input().split()))
q=list()
for i in range(m):
    q.append(set(map(int, input().split())))
count=0
while count!=5000:
    a=q.pop()
    for j in q:
        if len(j&a) != 0:
            j |=a
            count=0
            break
    else:q=[a]+q
    if count>len(q): break
    count+=1

q2=copy.copy(set(p))
for i in q:
    q2 -= i
    
count2=len([i for i in q2 if i==p[i-1]])

for i in q:
    r=list()
    for j in list(i):
        r.append(p[j-1])
    #print(i,r)
    count2 += len(i&set(r))
print(count2)
Problem p03373 (python)

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

if x>=y :l=min(x,y)*2*c+(x-y)*a
else: l=l=min(x,y)*2*c+(y-x)*b

print(min(a*x+b*y, l, max(x,y)*2*c))

Buggy submission (verdict: Runtime Error):
n,c=map(int,input().split())
x=[0]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    v.append(b)
x1=[x[i+1]-x[i] for i in range(len(x)-1)]
x2=[c-x[-1]]+x1[:0:-1]
#print(x1,x2)
h=[0]
t=[0]
for i,j in zip(x2,reversed(v)):
    h.append(h[-1]+j+-i)
hm=[max(h[:-i]) for i in range(1,len(h))]+[0]
#print(h,hm)
m=0
for k,(i,j) in enumerate(zip(x1,v)):
    t.append(t[-1]+j-i)
    #print(m,t[-1],i)
    m=max(m,t[-1]+hm[k])
print(m)

Buggy submission (verdict: Runtime Error):
n,c=map(int,input().split())
x=[0]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    v.append(b)

x1=[x[i+1]-x[i] for i in range(len(x)-1)]
x2=[c-x[-1]]+x1[:0:-1]
print(x1,x2)
h=[0]
t=[0]
for i,j in zip(x2,reversed(v)):
    h.append(h[-1]+j+-i)
hm=[max(h[:-i]) for i in range(1,len(h))]+[0]
print(h,hm)
m=0
for k,(i,j) in enumerate(zip(x1,v)):
    t.append(t[-1]+j-i)
    print(m,t[-1],i)
    m=max(m,t[-1]+hm[k])
print(m)
Problem p03388 (python)

Fixed submission:
import math
n=int(input())
for _ in range(n):
    a,b=map(int,input().split())
    c=int(math.sqrt(a*b))
    if c*(c+1)<a*b: print(2*c-1)
    elif a*b==c*c and a!=b:  print(2*c-3)
    else:  print(2*c-2)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
for _ in range(n):
    a,b=map(int,input().split())
    c=int(math.sqrt(a*b))
    if c<2 :
        print('0')
    elif (math.sqrt(a*b)==c and a!=b:
        print(2*c-3)
    elif c*(c+1)<a*b:
        print(2*c-1)
    else:
        print(2*c-2)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
for _ in range(n):
    a,b=map(int,input().split())
    c=int(math.sqrt(a*b))
    if c<2 :
        print('0')
    elif a==1 or b==1:
        print(2c-3)
    elif c*(c+1)<a*b:
        print(2c-1)
    else:
        print(2c-2)
Problem p03393 (python)

Fixed submission:
s=list(input())
al=[chr(ord('a') + i) for i in range(26)]
al=[i for i in al if i not in s]
if al:
    print(''.join(s)+al[0])
    exit()
for i in range(25,0,-1):
    if s[i-1]<s[i]:
        a=[j for j in s[i-1:] if s[i-1]<j]
        s=s[:i-1]+[sorted(a)[0]]
        print(''.join(s))
        break
        exit()
else:print(-1)

Buggy submission (verdict: Runtime Error):
s=list(input())
al=[chr(ord('a') + i) for i in range(26)]
al=[i for i in al if i not in s]
if al:
    print(''.join(s)+al[0])
    exit()
for i in range(25,0,-1):
    if s[i-1]<s[i]:
        a=[j for j in s[i:] if s[i]>j]
        s=s[:i-1]+[sorted(a)[0]]
        print(''.join(s))
        exit()
else:print(-1)

Buggy submission (verdict: Runtime Error):
s=list(input())
al=[chr(ord('a') + i) for i in range(26)]
al=[i for i in al if i not in s]
if al:
    print(''.join(s)+al[0])
    #exit()
for i in range(25,0,-1):
    if s[i-1]<s[i]:
        s=s[:i-1]+[s[-1]]
        print(''.join(s))
        exit()
else:print(-1)

Buggy submission (verdict: Runtime Error):
s=list(input())
al=[chr(ord('a') + i) for i in range(26)]
al=[i for i in al if i not in s]
if al:
    print(s+al[0])
    exit()
for i in range(25,0,-1):
    if s[i-1]<s[i]:
        s=s[:i-1]+[s[-1]]
        print(''.join(s))
        exit()
else:print(-1)
Problem p03407 (python)

Fixed submission:
a,b,c=map(int, input().split())
if a+b>=c:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
b=[]
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(n):
    b.append(list(map(int,input().split())))
an=sorted(a, key=lambda x:-x[1])
bn=sorted(b)#, key=lambda x:(x[0],x[1]))
count=0
for i in range(len(bn)):
    for j in range(len(an)):
#        print(an[j],bn[i])
        if bn[i][0]>an[j][0] and bn[i][1]>an[j][1]:
            count+=1
            an.pop(j)
            break
 
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
b=[]
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(n):
    b.append(list(map(int,input().split())))
an=sorted(a, key=lambda x:(x[0],-x[1]),reverse=True)
bn=sorted(b, key=lambda x:(x[0],-x[1]),reverse=True)
count=0
for i in range(len(bn)):
    for j in range(len(an)):
#        print(an[j],bn[i])
        if bn[i][0]>an[j][0] and bn[i][1]>an[j][1]:
            count+=1
            an.pop(j)
            break
 
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
b=[]
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(n):
    b.append(list(map(int,input().split())))
an=sorted(a, key=lambda x:(x[0],-x[1]),reverse=True)
bn=sorted(b, key=lambda x:(x[0],-x[1]),reverse=True)
count=0
for i in range(len(bn)):
    for j in range(len(an)):
#        print(an[j],bn[i])
        if bn[i][0]>an[j][0] and bn[i][1]>an[j][1]:
            count+=1
            an.pop(j)
            break
 
print(count)
Problem p03436 (python)

Fixed submission:
h, w =map(int, input().split())

a=['#'*(w+2)]
for i in range(h):
    b='#'+input()+'#'
    a.append(b)
a.append('#'*(w+2))
#print(a)

from collections import Counter

n=[(1,1)]
route={(1,1):0}
p=[[1,0],[0,1],[-1,0],[0,-1]]
count=1
while route.get((h,w),0)==0 and count != 10000:
    n2=[]
    #print(n,route)
    for i in n:
        for j in p:
            np=(i[0]+j[0],i[1]+j[1])
            if a[np[0]][np[1]]=='.' and route.get(np,-1)==-1:
                n2.append(np)
                if route.get(np,1000)>count:
                    route[np]=count
    n=n2
    #print(n,route)
    count+=1

    
a2=[]
for i in a:
    for j in range(len(i)):
        a2.append(i[j])
con=Counter(a2)


if count==10000:
    print('-1')
else:
    print(con['.']-route[(h,w)]-1)

Buggy submission (verdict: Runtime Error):
a=['#'*(w+2)]
for i in range(h):
    b='#'+input()+'#'
    a.append(b)
a.append('#'*(w+2))
#print(a)

from collections import Counter

n=[(1,1)]
route={(1,1):0}
p=[[1,0],[0,1],[-1,0],[0,-1]]
count=1
while route.get((h,w),0)==0 and count != 10000:
    n2=[]
    #print(n,route)
    for i in n:
        for j in p:
            np=(i[0]+j[0],i[1]+j[1])
            if a[np[0]][np[1]]=='.' and route.get(np,-1)==-1:
                n2.append(np)
                if route.get(np,1000)>count:
                    route[np]=count
    n=n2
    #print(n,route)
    count+=1

    
a2=[]
for i in a:
    for j in range(len(i)):
        a2.append(i[j])
con=Counter(a2)


if count==10000:
    print('-1')
else:
    print(con['.']-route[(h,w)]-1)
Problem p03503 (python)

Fixed submission:
from itertools import product
al=list(product([0,1],repeat=10))
n=int(input())
a=[list(map(int, input().split())) for i in range(n)]
p=[list(map(int, input().split())) for i in range(n)]
ans=-100000000000
for i in al:
    if sum(i)==0:continue
    q=0
    for j in range(n):
        count=0
        for k in range(10):
            if a[j][k]==1 and i[k]==1:
                count+=1
        q+=p[j][count]
    ans=max(ans,q)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import product
al=list(product([0,1],repeat=10))
n=int(input())
a=[list(map(int, input().split())) for i in range(n)]
p=[list(map(int, input().split())) for i in range(n)]
ans-100000000000
for i in al:
    if sum(i)==0:continue
    q=0
    for j in range(n):
        count=0
        for k in range(10):
            if a[j][k]==1 and i[k]==1:
                count+=1
        q+=p[j][count]
    ans=max(ans,q)
print(ans)
Problem p03550 (python)

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

if len(a)==1: print(abs(a[-1]-w))
elif abs(a[-2]-a[-1])>abs(a[-1]-w):
    print(abs(a[-2]-a[-1]))
else: print(abs(a[-1]-w))

Buggy submission (verdict: Runtime Error):
if len(a)==1: print(abs(a[-1]-w))
elif abs(a[-2]-a[-1])>abs(a[-1]-w):
    print(abs(a[-2]-a[-1]))
else: print(abs(a[-1]-w))
Problem p03574 (python)

Fixed submission:
import numpy as np
h,w=map(int, input().split())
a=[list(input()) for i in range(h)]
a=np.array(a)
for i in range(h):
    for j in range(w):
        if a[i][j]=='.':
            b=a[max(i-1,0):min(i+2,h),max(j-1,0):min(j+2,w)].flatten()
            a[i][j]=sum(b=='#')
for i in a:
    print(''.join(i))

Buggy submission (verdict: Runtime Error):
import numpy as np
h,w=map(int, input().split())
a=[list(input()) for i in range(h)]
a=np.array(a)
for i in range(h):
    for j in range(w):
        if a[i][j]=='.':
            a[i][j]=sum(sum(a[max(i-1,0):min(i+2,w),max(j-1,0):min(j+2,w)]=='#'))
for i in a:
    print(''.join(i))
Problem p03576 (python)

Fixed submission:
n,t=map(int, input().split())
x=[]
y=[]
m=[]
for i in range(n):
    a,b=map(int, input().split())
    x.append(a)
    y.append(b)
    m.append([a,b])
x.sort()
y.sort()
ans=float('inf')
for i in range(n-1):
    for j in range(i,n):
        if i>=j:continue
        for k in range(n-1):
            for l in range(k,n):
                if k>=l:continue
                count=0
                for a,b in m:
                    if x[i]<=a<=x[j] and y[k]<=b<=y[l]:
                        count+=1
                if count>=t:
                    ans=min(ans,(x[j]-x[i])*(y[l]-y[k]))
print(ans)

Buggy submission (verdict: Runtime Error):
n,t=map(int, input().split())
x=[]
y=[]
m=[]
for i in range(n):
    a,b=map(int, input().split())
    x.append(a)
    y.append(b)
    m.append([a,b])
x.sort()
y.sort()
for i in range(n-1):
    for j in range(i,n):
        if i>=j:continue
        for k in range(n-1):
            for l in range(k,n):
                if k>=l:continue
                count=0
                for a,b in m:
                    if x[i]<=a<=x[j] and y[k]<=b<=y[l]:
                        count+=1
                if count>=t:
                    ans=min(ans,(x[j]-x[i])*(y[l]-y[k]))
print(ans)
Problem p03608 (python)

Fixed submission:
n,m,r=map(int, input().split())
s=[[10**9]*n for i in range(n)]
t=list(map(int, input().split()))
for i in range(m):
    a,b,c=map(int, input().split())
    s[a-1][b-1]=c
    s[b-1][a-1]=c
 
for k in range(n):
    for i in range(n):
        for j in range(n):
            s[i][j]=min(s[i][j],s[i][k]+s[k][j])
ans=float('inf')
from itertools import permutations
for i in permutations(t):
    an=0
    for j in range(r-1):
        an+=s[i[j]-1][i[j+1]-1]
    ans=min(ans,an)
print(ans)

Buggy submission (verdict: Runtime Error):
import  scipy as sp 
from itertools import permutations
n,m,r=map(int, input().split())
s=[[10**9]*n for i in range(n)]
t=list(map(int, input().split()))
for i in range(m):
    a,b,c=map(int, input().split())
    s[a-1][b-1]=c
    s[b-1][a-1]=c

s=sp.sparse.csgraph.floyd_warshall(s)   
ans=float('inf')
for i in permutations(t):
    an=0
    for j in range(r-1):
        an+=s[i[j]-1][i[j+1]-1]
    ans=min(ans,an)
print(ans)
Problem p03612 (python)

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

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

Fixed submission:
n=int(input())
t=1
for i in range(n):
    s=int(input())
    if t>s: a,b=t,s
    else: a,b=s,t
    
    while b!=0:
        a, b = b, a%b
    t=t*s//a
print(t)

Buggy submission (verdict: Runtime Error):
import fractions
t=1
for i in range(int(input())):
    s=int(input())
    t=t*s//math.gcd(s,t)
print(t)

Buggy submission (verdict: Runtime Error):
import math
t=1
for i in range(int(input())):
    s=int(input())
    t=t*s//math.gcd(s,t)
print(t)
Problem p03719 (python)

Fixed submission:
a,b,c=map(int, input().split())
if a<=c<=b:print('Yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
n,k=map(int, input().split())
a=[list(map(int, input().split())) for i in range(n)]
a.sort()
#print(a)
b=[]
for i,j in a:
    b=b+[i]*j
    if len(b)>k:break
print(b[k-1])
Problem p03722 (python)

Fixed submission:
def BF(p,n,s):
    inf=float("inf")
    d=[inf for i in range(n)]
    d[s-1]=0
    for i in range(n+1):
        for e in p:
            if e[0]!=inf and d[e[1]-1]>d[e[0]-1]+e[2]:
                d[e[1]-1] = d[e[0]-1] + e[2]
        if i==n-1:t=d[-1]
        if i==n and t!=d[-1]:
            return [0,'inf']
    return list(map(lambda x:-x, d))
n,m=map(int, input().split())
a=[list(map(int, input().split())) for i in range(m)]
a=[[x,y,-z] for x,y,z in a]
print(BF(a, n, 1)[-1])

Buggy submission (verdict: Runtime Error):
def BF(p,n,s):
    inf=float("inf")
    d=[inf for i in range(n)]
    d[s-1]=0
    for i in range(n+1):
        for e in p:
            if e[0]!=inf and d[e[1]-1]>d[e[0]-1]+e[2]:
                d[e[1]-1] = d[e[0]-1] + e[2]
                if i==n: return [0,'inf']
    return list(map(lambda x:-x, d))
n,m=map(int, input().split())
a=[list(map(int, input().split())) for i in range(m)]
a=[[x,y,-z] for x,y,z in a]
print(BellmanFord(a, n, 1)[-1])
Problem p03807 (python)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
a=[i%2 for i in a]
b=a.count(1)
if b%2==0:print('YES')
else:print('NO')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
a=[i%2 for i in a]
b=a.count(1)
anb,b=a.count(0)+b//2,b+b//2
if an%2+b%2==1:print('YES')
else:print('NO')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
a=[i%2 for i in a]
b=a.count(1)
anb,b=a.count(0)+b//2,b+b//2
if an%2+b%2==1:print('YES')
else:print('NO')
Problem p03938 (python)

Fixed submission:
n=int(input())
c=list(map(int, input().split()))
a=list(range(n,n**2+1,n))
b=list(range(n**2,0,-n))
for i in range(n):
    b[c[i]-1]+=i
    
for i in a:
    print(i,end=' ')
print()
for i in b:
    print(i,end=' ')
print()

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(map(int, input().split()))
a=list(range(1,n+1))
b=list(range(n,0,-1))
for i,j in enumerate(b):
    b[j-1]+=i
print(*a)
print(*b)

Buggy submission (verdict: Runtime Error):
n=int(input())
c=list(map(int, input().split()))
a=list(range(n,n**2+1,n))
b=a[::-1]
for i in range(n):
    b[c[i]-1]+=i
print(*a,'\n',*b)
Problem p03952 (python)

Fixed submission:
n,x=map(int, input().split())
if x==1 or x==2*n-1:print('No')
else:
    print('Yes')
    a=list(range(1,2*n))
    b=[]
    b.append(a.pop(x))
    b.append(a.pop(x-1))
    b.append(a.pop(x-2))
    for i in a[:n-2]+b+a[n-2:]:
        print(i)

Buggy submission (verdict: Runtime Error):
n,x=map(int, input().split())
if x==1 or x==2*n+1:print('No')
else:
    print('Yes')
    a=list(range(1,2*n))
    b=[]
    b.append(a.pop(x))
    b.append(a.pop(x-1))
    b.append(a.pop(x-2))
    for i in a[:n-2]+b+a[n-2:]:
        print(i)

Buggy submission (verdict: Runtime Error):
n,x=map(int, input().split())
if x==1 or x==2*n+1:print('No')
else:
    print('Yes')
    a=list(range(1,2*n))
    b=[]
    b.append(a.pop(x))
    b.append(a.pop(x-1))
    b.append(a.pop(x-2))
    for i in a[:n-1]+b+a[n-1:]:
        print(i)
Problem p03998 (python)

Fixed submission:
a=list(input())
b=list(input())
c=list(input())
oner='a'
while True:
        if oner=='a':
            if len(a)==0:break
            oner=a.pop(0)
        if oner=='b':
            if len(b)==0:break
            oner=b.pop(0)
        if oner=='c':
            if len(c)==0:break
            oner=c.pop(0)
print(oner.upper())

Buggy submission (verdict: Runtime Error):
a=list(input())
b=list(input())
c=list(input())
oner='a'
while True:
        if oner=='a':
            if len(a)==0:break
            oner=a.pop(0)
        if oner=='b':
            if len(c)==0:break
            oner=b.pop(0)
        if oner=='c':
            if len(c)==0:break
            oner=c.pop(0)
print(oner.upper)

Buggy submission (verdict: Runtime Error):
a=list(input())
b=list(input())
c=list(input())
oner='a'
while True:
        if oner=='a':
            if len(a)==0:break
            oner=a.pop(0)
        if oner=='b':
            if len(c)==0:break
            oner=b.pop(0)
        if oner=='c':
            if len(c)==0:break
            oner=c.pop(0)
        print(a,b,c)
print(oner.upper)
Problem p02765 (python)

Fixed submission:
n,r=map(int,input().split());print(r+max(0,1000-100*n))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split());k=10**9+7;c=(1<<n)%k-1;X=Y=1
for i in range(b):X=X*(n-i)%k;Y=Y*(i+1)%k;c-=X*pow(Y,k-2,k)if i+1in(a,b)else 0
print(c%k)
Problem p02923 (python)

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

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

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

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

num = input()
num = int(num) - 1

if 0 <= num <= 31:
    print(a[num])
else:
    pass

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

num = int(input())
print(a[num])

Buggy submission (verdict: Runtime Error):
num = input()
num = int(num)

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[num])
Problem p02741 (python)

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b = int(input())
print(a[b-1])

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b, = map(int, input())
print(a[b-1])

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(a[input()-1])

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(a[map(int, input())-1])

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[map(input())-1])
Problem p03005 (python)

Fixed submission:
a, b = map(int, input().split())
if b == 1:
    print(0)
else:
    print(a - b)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if b = 1:
  print(0)
else:
	print(a - b)
Problem p04045 (python)

Fixed submission:
N, K = map(int, input().split())
D = list(map(str, input().split()))
while True:
    flg = True
    num = str(N)
    for i in range(len(num)):
        if num[i] in D:
            flg = False
            break
    if flg is True:
        print(int(num))
        break
    N += 1

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
D = list(map(int, input().split()))
flg = True
while True:
  num = str(N)
  for i in range(len(num)):
    if num[i] in D:
      flg = False
      break
  if fig is True:
    print(int(num))
    break
  N += 1
Problem p02797 (python)

Fixed submission:
# 2020/01/19

n,k,s=map(int,input().split())
if s==10**9:
    rest=10**9-1
else:
    rest=10**9
ans=[s]*k+[rest]*(n-k)
print(*ans)

Buggy submission (verdict: Runtime Error):
print(*[1,2,3,3]
Problem p03006 (python)

Fixed submission:
n=int(input())
xy=[]
for _ in range(n):
	xy+=[list(map(int,input().split()))]

dic={}
for e in xy:
	for f in xy:
		if e==f:continue
		tmp=(e[0]-f[0],e[1]-f[1])
		dic[tmp]=dic.get(tmp,0)+1

mx=max(dic.values()) if dic else 0
print(n-mx)

Buggy submission (verdict: Runtime Error):
n=int(input())
xy=[]
for _ in range(n):
	xy+=[list(map(int,input().split()))]

dic={}
for e in xy:
	for f in xy:
		if e==f:continue
		tmp=(e[0]-f[0],e[1]-f[1])
		dic[tmp]=dic.get(tmp,0)+1

mx=max(dic.values())
print(n-mx)
Problem p03044 (python)

Fixed submission:
# 2019/10/10
# 解答かんにんぐ
# 前回WAの原因は、u,vのいずれかが訪問済みである必要があった。
# edge参照順序によっては、u,vのいずれも未訪問となり、このときWAとなる。

import sys
sys.setrecursionlimit(10**7)

n=int(input())
node=[None]*n
edge=[[] for _ in range(n)]


for i in range(n-1):
    u,v,w=map(int,input().split())
    u-=1;v-=1
    edge[u].append((v,w))
    edge[v].append((u,w))


def dfs(v,p,c):
    node[v]=c
    for vv,w in edge[v]:
        if vv==p:continue
        dfs(vv,v,1-c) if w%2 else dfs(vv,v,c)


dfs(0,-1,0)

for e in node:
    print(e)

Buggy submission (verdict: Runtime Error):
# 2019/10/10
# 解答かんにんぐ
# 前回WAの原因は、u,vのいずれかが訪問済みである必要があった。
# edge参照順序によっては、u,vのいずれも未訪問となり、このときWAとなる。

n=int(input())
node=[None]*n
edge=[[] for _ in range(n)]


for i in range(n-1):
    u,v,w=map(int,input().split())
    u-=1;v-=1
    edge[u].append((v,w))
    edge[v].append((u,w))


def dfs(v,p,c):
    node[v]=c
    for vv,w in edge[v]:
        if vv==p:continue
        dfs(vv,v,1-c) if w%2 else dfs(vv,v,c)


dfs(0,-1,0)

for e in node:
    print(e)
Problem p03086 (python)

Fixed submission:
import re
regex=(r'[A|C|G|T]+')
s=input()
mo=re.findall(regex,s)
print(len(max(mo,key=len)) if mo!=[] else 0)

Buggy submission (verdict: Runtime Error):
import re
regex=(r'[A|C|G|T]+')
s=input()
mo=re.search(regex,s)
print(len(mo.group()))