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

Fixed submission:
A,B=map(int,input().split())
A1=2*A-1
B1=2*B-1
if A==B:
    print(2*A)
else:
    print(max(A,B)*2-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))
if N==1:
    print(1)
else:
    maxh=H[0]
    c=1
    for i in range(1,N):
        if maxh<=H[i]:
            c+=1
            maxh=H[i]
    print(c)
Problem p03076 (python)

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
l=[A,B,C,D,E]
l0=[i%10 for i in l]
x=[]
for i in range(5):
    if l0[i]!=0:
        l[i]=(1+l[i]//10)*10 
        x.append(l0[i])
if x==[]:
    ans=sum(l)
else:
    ans=sum(l)-10+min(x)
print(ans)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
l=[A,B,C,D,E]
l0=[i%10 for i in l]
x=[]
for i in range(5):
    if l0[i]!=0:
        l[i]=(1+l[i]//10)*10 
        x.append(l0[i])
ans=sum(l)-10+min(x)
print(ans)
Problem p03085 (python)

Fixed submission:
b=input()
if b=='A':
    print('T')
elif b=='T':
    print('A')
elif b=='C':
    print('G')
else:
    print('C')

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
t=[0]*N
for i in range(N-1):
    t[i+1]=t[i]+(1 if S[i:i+2]=='AC' else 0)
for i in range(Q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
l,r=[],[]
for i in range(Q):
    l0,r0=map(int,input().split())
    l.append(l0)
    r.append(r0)
c={}
for i in range(Q):
    for i in range(l[i]-1,r[i]-1):
        if (S[i]=='A') and (S[i+1]=='C'):
            c[i]=1
    print(int(c.count(1)))
Problem p03087 (python)

Fixed submission:
N,Q=map(int,input().split())
S=input()
t=[0]*N
for i in range(N-1):
    t[i+1]=t[i]+(1 if S[i:i+2]=='AC' else 0)
for i in range(Q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
l,r=[],[]
for i in range(Q):
    l0,r0=map(int,input().split())
    l.append(l0)
    r.append(r0)
c={}
for i in range(Q):
    for i in range(l[i]-1,r[i]-1):
        if (S[i]=='A') and (S[i+1]=='C'):
            c[i]=1
    d=int(c.count(1))
    print(d)
Problem p03103 (python)

Fixed submission:
N,M=map(int,input().split())
A=[]
for i in range(N):
    A.append(list(map(int,input().split())))
A.sort(key=lambda x:(x[0],x[1]))
C=[A[0][0]*A[0][1]]
D=[A[0][1]]
for i in range(N-1):
    C.append(C[i]+A[i+1][0]*A[i+1][1])
    D.append(D[i]+A[i+1][1])
for i in range(N):
    if M<D[i]:
        print(C[i]-(D[i]-M)*A[i][0])
        break
if M==D[N-1]:
    print(C[N-1])

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[[]]
for i in range(N):
    A.append(list(map(int,input().split())))
A.sort(key=lambda x:(x[0],x[1]))
C=[A[0][0]*A[0][1]]
D=A[0][1]
for i in range(N-1):
    C.append(C[i]+A[i+1][0]*A[i+1][1])
    D.append(D[i]+A[i+1][1])
for i in range(N):
    if M<D[i]:
        print(C[i]-(D[i]-M)*A[i][0])
Problem p03105 (python)

Fixed submission:
A,B,C=map(int,input().split())
if B>A*C:
    print(C)
else:
    print(B//A)

Buggy submission (verdict: Runtime Error):
import math
A,B,K=map(int,input().split())
d=[]
for i in range(1,max(A,B)+1):
    if A%i==0 and B%i==0:
        d.append(i)
print(d[len(d)-K])

Buggy submission (verdict: Runtime Error):
import math
A,B,K=map(int,input().split())
d=[]
if math.gcd(A,B)==1:
    d.append(1)
else:
    for i in range(2,math.gcd(A,B)+1):
        if A%i==0 and B%i==0:
            d.append(i)
print(d[len(d)-K])
Problem p03106 (python)

Fixed submission:
import math
A,B,K=map(int,input().split())
d=[]
for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        d.append(i)
print(d[len(d)-K])

Buggy submission (verdict: Runtime Error):
import math
A,B,K=map(int,input().split())
d=[]
if math.gcd(A,B)==1:
    d.append(1)
else:
    for i in range(2,math.gcd(A,B)+1):
        if A%i==0 and B%i==0:
            d.append(i)
print(d[len(d)-K])

Buggy submission (verdict: Runtime Error):
import math
A,B,K=map(int,input().split())
d=[]
if math.gcd(A,B)==1:
    d.append(1)
else:
    for i in range(2,math.gcd(A,B)+1):
        if A%i==0 and B%i==0:
            d.append(i)
print(d[len(d)-K])

Buggy submission (verdict: Runtime Error):
import math
A,B,K=map(int,input().split())
d=[]
if A==1 or B==1:
    d.append(1)
else:
    for i in range(2,math.gcd(A,B)+1):
        if A%i==0 and B%i==0:
            d.append(i)
print(d[len(d)-K])
Problem p03126 (python)

Fixed submission:
import numpy as np
N,M=map(int,input().split())
A=np.zeros((N+1,M+1))
A[0]=np.ones(M+1)
for i in range(1,N+1):
    B=list(map(int,input().split()))
    for m in range(1,B[0]+1):
        A[i][B[m]]=A[i-1][B[m]]
a=sum(A[N])
print(int(a))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
a = [[1 for _ in range(M)]+[0 for _ in range(M)] for _ in range(N)]
for i in range(1,N+1):
    B=list(map(int,input().split()))
    for m in range(1,B[0]+1):
        A[i][B[m]]=A[i-1][B[m]]
a=sum(A[N])
print(int(a))
Problem p03210 (python)

Fixed submission:
X=int(input())
if X==3 or X==5 or X==7:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
S=input()
print(min(abs(int(S[i:i+3])-753) for i in range(len(S)-2)))

Buggy submission (verdict: Runtime Error):
S=input()
print(min([abs(int(S[i:i+3])-753) for i in range(len(S)-2)]))
Problem p03219 (python)

Fixed submission:
X,Y=map(int,input().split())
print(X+int(Y/2))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
PY=[list(map(int,input().split()))+[0] for _ in range(M)]
sort_PY=sorted(PY,key=lambda x:x[1])
c={}
for i in range(M):
    p=sort_PY[i][0]
    if(p in c):
        c[p]+=1
    else:
        c[p]=1
    sort_PY[i][2]=c[p]
for p,y,z in PY:
    print(str(p).zfill(6)+str(z).zfill(6))
Problem p03260 (python)

Fixed submission:
A,B=map(int,input().split())
if A%2==1 and B%2==1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
x=list(map(int,input().split()))
x=[abs(X-c) for c in x]
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
D=gcd(*x)
print(D)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
cnt = 0

for i in range(3):
    if S[i] == T[i]:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(intput())
print(N * (N-1) // 2)
Problem p02924 (python)

Fixed submission:
N = int(input())
print(N * (N-1) // 2)

Buggy submission (verdict: Runtime Error):
N = int(intput())
print(N * (N-1) // 2)

Buggy submission (verdict: Runtime Error):
N = int(intput())
print(N*(N-1)//2)
Problem p02934 (python)

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

sum_reverse = 0
for i in range(n):
	sum_reverse += 1/float(a[i])

print(1/sum_reverse)

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

sum_reverse = 0
for i in range(1,n):
	sum_reverse += 1/float(a[i])

print(1/sum_reverse)

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

sum_reverse = 0
for i in range(1,n):
	sum_reverse += 1/a[i]

print(1/sum_reverse)
Problem p02939 (python)

Fixed submission:
cnt=0
mat=test=''
for c in input():
  mat+=c
  if mat!=test:
    cnt+=1
    mat,test='',mat
print(cnt)

Buggy submission (verdict: Runtime Error):
s=input()
random.sample(s, k)
max(k)
print(k)
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
k, x = map(int,input().split())
print(sorted(x, reverse=True))
Problem p02952 (python)

Fixed submission:
n = int(input())
count = 0
for i in range(1,n+1):
  if len(str(i)) % 2 == 1:
    count += 1
    
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n):
  if len(i) % 2 == 1:
    count += 1
    
print(count)
Problem p02953 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
lis[0]-=1

for i in range(n-1):
  if lis[i] < lis[i+1]:
    lis[i+1] -= 1
  elif lis[i] > lis[i+1]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))	
bool 
for i in range (1, N):
  if H[i-1] == H[i] or H[i] == H[i-1] + 1:
    True
  elif H[i+1] == H[i] - 1:
    H[i] -= 1
    if H[i-1] > H[i]:
      False
if (True):
  print('Yes' )
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))	
bool 
for i in range (1, N+1):
  if H[i-1] == H[i] or H[i] == H[i-1] + 1:
    True
  elif H[i+1] == H[i] - 1:
    H[i] -= 1
    if H[i-1] > H[i]:
      False
if (True):
  print('Yes' )
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))	
bool 
for i in range (1, N+1):
  if H[i-1] == H[i] or H[i] == H[i-1] + 1:
    True
  elif H[i+1] == H[i] - 1:
    H[i] -= 1
    if H[i-1] > H[i]:
      False
if (True):
  print('Yes' )
if (False):
  print('No')
Problem p03292 (python)

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

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

Fixed submission:
a,b,c,d=[int(input()) for _ in range(4)]
print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
a, b, c, d = [int(input()), for _ in range(4)]
print(min(a,b)+min(c,d))
Problem p03408 (python)

Fixed submission:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
n = [ input() for _ in range( int( input() ) )]
m = [ input() for = in range( int( input() ) )]
l = list( set(n) )
print( max( 0, max( n.count(l[i]) - m.count(l[i]) for i in range( len(l) ) ) ) )

Buggy submission (verdict: Runtime Error):
n = [ input() for _ in range ( int ( input () ) )]
m = [ input() for _ in range ( int ( input () ) )]
l = list( set (n) )
print( max(0, max(n.count( l[i] ) - (m.count( l[i] ) for i in range(len(l))))))
Problem p03645 (python)

Fixed submission:
N, M = map(int, input().split())
seta = set()
setb = set()
for i in range(M):
    a, b, =map(int, input().split())
    if a == 1: setb.add(b)
    if b == N: seta.add(a)
if len(seta&setb) == 0: print("IMPOSSIBLE")
else:   print("POSSIBLE")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split)
seta = set()
setb = set()
for i in range(M):
    a, b, =map(int, input().split)
    if a == 1: setb.add(b)
    if b == N: seta.add(a)
if len(seta&setb) == 0: print("IMPOSSIBLE")
else:   print("POSSIBLE")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split)
seta = set()
setb = set()
for i in range(M):
    a, b, =map(int, input().split)
    if a == 1: setb = set.add(b)
    if b == N: seta = set.add(a)
if len(seta&setb) == 0: print("IMPOSSIBLE")
else:   print("POSSIBLE")
Problem p03777 (python)

Fixed submission:
a,_,b = input()
print("DH" [a==b])

Buggy submission (verdict: Runtime Error):
w, a, b = map(int, input().split())
dis = abs(a - b) - w
print(max(dis, 0))
Problem p03778 (python)

Fixed submission:
w, a, b = map(int, input().split())
dis = abs(a - b) - w
print(max(dis, 0))

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

Fixed submission:
input()
s = input()

x,m = 0, 0

for i in range(len(s)):
  if s[i]=="I":
    x += 1
    m = max(x, m)
    
  if s[i]=="D":
    x -= 1
    m = max(x, m)

print(m)

Buggy submission (verdict: Runtime Error):
input()
s = input()

x,m = 0, 0

for i in range(n):
  if s[i]=="I":
    x += 1
    m = max(x, m)
    
  if s[i]=="D":
    x -= 1
    m = max(x, m)

print(m)
Problem p03860 (python)

Fixed submission:
print("A"+input()[8]+"C")

Buggy submission (verdict: Runtime Error):
a, s ,c = map(input().split())
print('A'+s[0]+'C')
Problem p03943 (python)

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

Buggy submission (verdict: Runtime Error):
print("A"+input()[8]+"C")
Problem p03997 (python)

Fixed submission:
x = lambda:int(input())
print((x()+x())*x()//2)

Buggy submission (verdict: Runtime Error):
print((input()+input())*input()//2)
Problem p04011 (python)

Fixed submission:
n,k,x,y=[int(input()) for i in range(4)]
print(n*x-(x-y)*max(n-k,0))

Buggy submission (verdict: Runtime Error):
n, k, x, y = [(int(input()) for i in range(4))]
print(x*n - (x - y)*max(0, n-k))

Buggy submission (verdict: Runtime Error):
n, k, x, y = [(int(input()), for i in range(4))]
print(x*n - (x - y)*max(0, n-k))

Buggy submission (verdict: Runtime Error):
n, k, x, y = [map(int(input()), for i in range(4))]
print(x*n - (x - y)*max(0, n-k))

Buggy submission (verdict: Runtime Error):
n, k, x, y = [map(int(input()), for i in range(4))]
print(x*n - (x - y)*max(0, n - k))

Buggy submission (verdict: Runtime Error):
n, k, x, y = [map(int(input()), for i in range(4))]
print(x*n - (x - y)*max(0, n - k)

Buggy submission (verdict: Runtime Error):
n, k, x, y = [map(int(input()), for i in range(4))]
print(x * n - (x - y)*max(0, n - k)
Problem p04043 (python)

Fixed submission:
li = list(map(int, input().split()))
if li == [5,5,7] or li == [5,7,5] or li == [7,5,5]:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
li = list(map(int, input().split()))
if li  = [5,5,7] or [5,7,5] or [7,5,5]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
  if ((a == b == 5 and c == 7) or (a == c == 5 and b == 7) or (b == c == 5 and a == 7)):
    print("Yes")
  else: print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(input().split())
if a + b + c == 17:
  if (a == b == 5 and c == 7) or (a == c == 5 and b == 7) or (b == c == 5 and a == 7):
    print("Yes")
  else: print("No")
Problem p02700 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if c%b==0:
    c=c-1
if a%d==0:
    a=a-1
if  c//b==a//d:
    print("Yes")
elif c/b<a/d:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if c/b=>a/d or  c//b=a//d:
    print("Yes")
else:
    print("No")
Problem p02761 (python)

Fixed submission:
n,m=(int(x) for x in input().split())
k=m+1
s=[0]*k
c=[0]*k
answer=0
for i in range(m):
    s[i+1],c[i+1]=(int(x) for x in input().split())


a=[-1]*10

for i in range(m):
    if a[s[i+1]]==-1:
        a[s[i+1]]=c[i+1]
    elif not a[s[i+1]]==c[i+1]:
        answer=-1
if a[1]==0 and not n==1:
    answer=-1
if a[1]==-1 and not n==1:
    a[1]=1
if a[1]==-1 and n==1:
    a[1]=0
for i in range(10):
    if a[i]==-1:
        a[i]=0

if answer==0:
    for i in range(n):
        d=n-i-1
        answer+=10**d*a[i+1]
print(answer)

Buggy submission (verdict: Runtime Error):
n,m=(int(x) for x in input().split())
k=m+1
s=[0]*k
c=[0]*k
answer=0
for i in range(m):
    s[i+1],c[i+1]=(int(x) for x in input().split())


a=[-1]*10

for i in range(m):
    if a[s[i+1]]==-1:
        a[s[i+1]]=c[i+1]
    elif not a[s[i+1]]==c[i+1]:
        answer=-1
if a[1]==0 and not n=1:
    answer=-1
if a[1]==-1 and not n=1:
    a[1]=1
if a[1]==-1 and n=1:
    a[1]=0
for i in range(10):
    if a[i]==-1:
        a[i]=0

if answer==0:
    for i in range(n):
        d=n-i-1
        answer+=10**d*a[i+1]
print(answer)
Problem p02706 (python)

Fixed submission:
n,m = map(int, input().split())
an = list(map(int, input().split()))
sum_a = sum(an)
if n - sum_a < 0:
    print(-1)
else:
    print(n-sum_a)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
an = list(map(int, input().split()))
sum_a = sum(an)
if an - sum_a < 0:
    print(-1)
else:
    print(an-sum_a)
Problem p02718 (python)

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

s = sum(a)
min_num = float(s)/(4*m)

res = "No"
count = 0
for x in a:
    if x >= min_num:
        count += 1
    if count >= m:
        res = "Yes"
        break
print(res)

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

s = a.sum()
min_num = s//(4*m)

res = "No"
count = 0
for x in a:
    if x >= min_num:
        count += 1
    if count >= m:
        res = "Yes"
        break
print(res)
Problem p02886 (python)

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

sum = 0
for i in range(n):
    for j in range(i+1,n):
        sum += d[i]*d[j]

print(sum)

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
dn = list(map(int, input().split())
print(sum(d*cumulate for d, cumulate in zip(dn[1:], itertools.accumulate(dn)))
Problem p02887 (python)

Fixed submission:
n = int(input())
s = input()
after_fusion = []

current = ''
for i in range(n):
    if s[i] != current:
        after_fusion.append(s[i])
        current = s[i]

print(len(after_fusion))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
after_fusion = []

current = ''
for i in range(n):
    if s[i] != current:
        after_fusion.append(s[i])
        current = s[i]

print(len(after_fusion)
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
import heapq
n,m = map(int, input().split())
job_list = []
for i in range(n):
    a,b = map(int, input().split())
    job_list.append((a,b))

hq = []
max_income = 0
j = 0
for i in range(1,m+1):
    while j < n and job_list[j][0] <= i:
        heapq.heappush(hq, (-job_list[j][1],job_list[j][0]))
    if len(hq) < 1:
        continue
    b_i, a_i = heapq.heappop(hq)
    max_income += -b_i

print(max_income)
Problem p03061 (python)

Fixed submission:
def gcd(a,b):
    l = max(a,b)
    s = min(a,b)
    if s == 0:
        return l
    else:
        return gcd(s, l%s)

n = int(input())
a = [0] + list(map(int, input().split())) + [0]
max_gcd = 1
L = [0] * (n+2)
R = [0] * (n+2)

for i in range(1,n+2):
    L[i] = gcd(a[i],L[i-1])
    R[n+1-i] = gcd(a[n+1-i], R[n+2-i])
for i in range(1,n+1):
    max_gcd = max(max_gcd,gcd(L[i-1], R[i+1]))

print(max_gcd)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int, input().split()))
max_gcd = 1

def left_gcd(i):
    # i >= 1
    index = 0
    current_gcd = a[0]
    while index < i:
        current_gcd = math.gcd(current_gcd, a[index])
        index += 1

    return current_gcd

def right_gcd(i):
    # i < n-1
    index = n-1
    current_gcd = a[index]
    while index > i:
        current_gcd = math.gcd(current_gcd, a[index])
        index -= 1
    return current_gcd

for i in range(n):
    temp_gcd = 1
    if i == 0:
        temp_gcd = right_gcd(i)
    elif i == n-1:
        temp_gcd = left_gcd(i)
    else: 
        temp_gcd = math.gcd(left_gcd(i), right_gcd(i))
    max_gcd = max(temp_gcd, max_gcd)

print(max_gcd)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
max_gcd = 1

def gcd_3(n1,n2,n3):
    return math.gcd(math.gcd(n1,n2),math.gcd(n1,n3))

if len(a) == 2:
    max_gcd = max(a)
elif len(a) == 3:
    gcd1 = math.gcd(a[0],a[1])
    gcd2 = math.gcd(a[1],a[2])
    gcd3 = math.gcd(a[0],a[2])
    max_gcd = max(gcd1,gcd2,gcd3)
else:
    gcd1 = gcd_3(a[0], a[1],a[2])
    gcd2 = gcd_3(a[1], a[2],a[3])
    gcd3 = gcd_3(a[2], a[0],a[3])
    gcd4 = gcd_3(a[0],a[1],a[3])
    max_gcd = max(gcd1,gcd2, gcd3, gcd4)

print(max_gcd)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
max_gcd = 1
if len(a) == 2:
    max_gcd = max(a)
else:
    gcd1 = math.gcd(a[0], a[1],a[2])
    gcd2 = math.gcd(a[1], a[2],a[3])
    gcd3 = math.gcd(a[2], a[0],a[3])
    gcd4 = math.gcd(a[0],a[1],a[3])
    max_gcd = max(gcd1,gcd2, gcd3, gcd4)

print(max_gcd)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
max_gcd = 1
if len(a) == 2:
    max_gcd = max(a)
else:
    gcd1 = math.gcd(a[0], a[1])
    gcd2 = math.gcd(a[1], a[2])
    gcd3 = math.gcd(a[2], a[0])
    max_gcd = max(gcd1,gcd2, gcd3)

print(max_gcd)
Problem p03471 (python)

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

sum = y
wasFound = False
for i in range(n+1):
    if wasFound:
        break
    for j in range(n+1):
        if i+j > n:
            break
        rest = sum - i*10000 - j*5000
        if rest < 0:
            break
        k = int(rest/1000)
        if rest % 1000 == 0 and (i+j+k==n):
            print(i, j, k)
            wasFound = True
            break
if not wasFound:
    print(-1, -1, -1)

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

def check(n,y):
    if n == 0 and y == 0:
        return {"truth":True, "a":0, "b":0, "c":0}
    elif n == 0 or y == 0:
        return {"truth":False, "a":-1, "b":-1, "c":-1}
    checkA = check(n-1, y-10000)
    checkB = check(n-1, y-5000)
    checkC = check(n-1, y-1000)
    if  checkA["truth"]:
        checkA["a"] += 1
        return checkA
    elif checkB["truth"]:
        checkB["b"] += 1
        return checkB
    elif checkC["truth"]:
        checkC["c"] += 1
        return checkC
    else:
        return {"truth":False, "a":-1, "b":-1, "c":-1}

print(check(n,y))
Problem p02885 (python)

Fixed submission:
a,b = map(int,input().split())
ans = a-2*b
if ans <= 0:
  print(0)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
ans = a-2*b
if ans <= 0:
  print(0)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,inpout())
ans = a-2*b
if ans <= 0:
  print(0)
else:
  print(ans)
Problem p02939 (python)

Fixed submission:
s = input()
key = s[0]
temp = ''
ans = 1
for i in range(1,len(s)):
    temp += s[i]
    if key != temp:
        ans += 1
        key = temp
        temp = ''


print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
s_len = len(s)
count = 0
s = [s[i:i+3] for i in range(0,len(s),3)]
s_new = []
for i in s:
    s_new.append(i[0])
    s_new.append(i[1:3])
if s_new[len(s_new)-1]=='':
    s_new.remove('')
ans = len(s_new)
#print(s_new)
if s_len==2:
    if s_new[0]==s_new[1]:
        print(1)
    else:
        print(ans)
    exit()
for i in range(1,len(s_new),2):
    if i!=len(s_new)-1:
        if s_new[i][0]!=s_new[i][1] and s_new[i][0]!=s_new[i-1] and s_new[i][1]!= s_new[i+1]:
            ans += 1
    else:
        if s_new[i][0]!=s_new[i][1] and s_new[i][0]!=s_new[i-1]:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
s_len = len(s)
count = 0
s = [s[i:i+3] for i in range(0,len(s),3)]
s_new = []
for i in s:
    s_new.append(i[0])
    s_new.append(i[1:3])
if s_new[len(s_new)-1]=='':
    s_new.remove('')
ans = len(s_new)
#print(s_new)
for i in range(1,len(s_new),2):
    if i!=len(s_new)-1:
        if s_new[i][0]!=s_new[i][1] and s_new[i][0]!=s_new[i-1] and s_new[i][1]!= s_new[i+1]:
            ans += 1
    else:
        if s_new[i][0]!=s_new[i][1] and s_new[i][0]!=s_new[i-1]:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
s_len = len(s)
count = 0
s = [s[i:i+3] for i in range(0,len(s),3)]
s_new = []
for i in s:
    s_new.append(i[0])
    s_new.append(i[1:3])
ans = len(s_new)
for i in range(1,len(s_new),2):
    if i!=len(s_new)-1:
        if s_new[i][0]!=s_new[i][1] and s_new[i][0]!=s_new[i-1] and s_new[i][1]!= s_new[i+1]:
            ans += 1
    else:
        if s_new[i][0]!=s_new[i][1] and s_new[i][0]!=s_new[i-1]:
            ans += 1
print(ans)