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

Fixed submission:
S1=input()
T1=input()
S=""
T=""
A=""
for i in range(1,len(S1)+1):
    S+=S1[-i]
for i in range(1,len(T1)+1):
    T+=T1[-i]
j=0
i=0
flag = False
while i<=len(S)+1-len(T):
    while j<=len(T)+1:
        if i==len(S)-len(T)+1:
            A="UNRESTORABLE"
            flag=True
            break
        elif j==len(T):
            P=S.replace(S[i:i+len(T)],T,1)
            Q=P.replace("?","a")
            for i in range(1,len(Q)+1):
                A+=Q[-i]
            flag=True
            break
        elif S[i+j]==T[j] or S[i+j]=="?":
            j+=1
        else:
            j=0
            i+=1
    if flag:
        break
print(A)

Buggy submission (verdict: Runtime Error):
S1=input()
T1=input()
S=""
T=""
A=""
for i in range(1,len(S1)+1):
    S+=S1[-i]
for i in range(1,len(T1)+1):
    T+=T1[-i]
j=0
i=0
flag = False
while i<=len(S)+1-len(T):
    while j<=len(T)+1:
        if i==len(S)-len(T):
            A="UNRESTORABLE"
            flag=True
            break
        elif j==len(T):
            P=S.replace(S[i:i+len(T)],T,1)
            Q=P.replace("?","a")
            for i in range(1,len(Q)+1):
                A+=Q[-i]
            flag=True
            break
        elif S[i+j]==T[j] or S[i+j]=="?":
            j+=1
        else:
            j=0
            i+=1
    if flag:
        break
print(A)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
j=0
i=-1
flag = False
while i>=-1*len(S)-1+len(T):
    while j>=-1*len(T)-1:
        if i==-1*len(S)-1+len(T):
            A="UNRESTORABLE"
            flag=True
            break
        elif j==-1*len(T):
            if i!=-1:
                P=S.replace(S[i-len(T)+1:i+1],T,1)
                A=P.replace("?","a")
                i=-1*len(S)-1+len(T)
                flag=True
                break
            else:
                P=S.replace(S[i-len(T)+1:],T,1)
                A=P.replace("?","a")
                flag=True
                break
        elif S[i+j]==T[j-1] or S[i+j]=="?":
            j=j-1
        else:
            j=0
            i=i-1
    if flag:
        break
print(A)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
j=0
i=-1
flag = False
while i>=-1*len(S)-1+len(T):
    while j>=-1*len(T)-1:
        if i<=-1*len(S)-1+len(T):
            A="UNRESTORABLE"
            flag=True
            break
        elif j==-1*len(T):
            if i!=-1:
                P=S.replace(S[i-len(T):i+1],T,1)
                A=P.replace("?","a")
                i=-1*len(S)-1+len(T)
                flag=True
                break
            else:
                P=S.replace(S[i-len(T):],T,1)
                A=P.replace("?","a")
                flag=True
                break
        elif S[i+j]==T[j-1] or S[i+j]=="?":
            j=j-1
        else:
            j=0
            i=i-1
    if flag:
        break
print(A)
Problem p03583 (python)

Fixed submission:
N=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        bw=4*i*j-N*i-N*j
        if bw<=0:
            continue
        if (N*i*j)%bw==0:
            print(i,j,(N*i*j)//bw)
            exit()

Buggy submission (verdict: Runtime Error):
N=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        aw=(N*n*h)
        bw=4*n*h-N*h-N*n
        if bw!=0 and bw/aw==bw//aw:
            h=i
            n=j
            break
print(h,n,bw//aw)

Buggy submission (verdict: Runtime Error):
N=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        aw=(N*n*h)
        bw=4*n*h-N*h-N*n
        if bw!=0 and bw/aw=bw//aw:
            h=i
            n=j
            break
print(h,n,bw//aw)
Problem p03633 (python)

Fixed submission:
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Buggy submission (verdict: Runtime Error):
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fraction
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Buggy submission (verdict: Runtime Error):
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fraction
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Buggy submission (verdict: Runtime Error):
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))
Problem p03647 (python)

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")
Problem p03695 (python)

Fixed submission:
N=int(input())
S=input().split()
for i in range(0,N):
    s=int(S[i])
    if 1<=s<=399:
        S[i]="a"
    if 400<=s<=799:
        S[i]="b"
    if 800<=s<=1199:
        S[i]="c"
    if 1200<=s<=1599:
        S[i]="d"
    if 1600<=s<=1999:
        S[i]="e"
    if 2000<=s<=2399:
        S[i]="f"
    if 2400<=s<=2799:
        S[i]="g"
    if 2800<=s<=3199:
        S[i]="h"
    if 3200<=s:
        S[i]="i"

if "i" in S:
    i=S.count("i")
    B=len(set(S))
    if B==1:
        C=1
        D=N
    else:
        C=B-1
        D=C+i
    
else:
    C=len(set(S))
    D=C

print(C,D)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input().split()
for i in range(0,N):
    s=int(S[i])
    if 1<=s<=399:
        S[i]="a"
    if 400<=s<=799:
        S[i]="b"
    if 800<=s<=1199:
        S[i]="c"
    if 1200<=s<=1599:
        S[i]="d"
    if 1600<=s<=1999:
        S[i]="e"
    if 2000<=s<=2399:
        S[i]="f"
    if 2400<=s<=2799:
        S[i]="g"
    if 2800<=s<=3199:
        S[i]="h"
    if 3200<=s:
        S[i]="i"

if "i" in S:
    i=S.count("i")
    B=len(set(S))
    if B=1:
        C=N
        D=N
    else:
        C=B-1
        D=C+i
    
else:
    C=len(set(S))
    D=C

print(C,D)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input().split()
for i in range(0,N):
    s=int(S[i])
    if 1<=s<=399:
        S[i]="a"
    if 400<=s<=799:
        S[i]="b"
    if 800<=s<=1199:
        S[i]="c"
    if 1200<=s<=1599:
        S[i]="d"
    if 1600<=s<=1999:
        S[i]="e"
    if 2000<=s<=2399:
        S[i]="f"
    if 2400<=s<=2799:
        S[i]="g"
    if 2800<=s<=3199:
        S[i]="h"
    if 3200<=s:
        S[i]="i"
if "i" in S:
    B=S.remove("i")
    C=len(set(B)) 
    D=C+S.count("i")
    print(C,D)
else:
    E=len(set(S))
    print(E,E)
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())
g = []
for i in range(N):
    a, b = map(int, input().split())
    h=b*(b+1)/2
    if h>=K:
        g.append(a)
print(g[0])

Buggy submission (verdict: Runtime Error):
N, K= map(int, input().split())
h=0
for i in range(N):
    a, b = map(int, input().split())
    h+=b
    if h>=K:
        print(a)
        break
Problem p03729 (python)

Fixed submission:
A,B,C=input().split()
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
A,B,C=input().split()
if A[-1]=B[0] and B[-1]=C[0]:
    print("Yes")
else:
    print("No")
Problem p03813 (python)

Fixed submission:
x=int(input())
if x<1200:
    print("ABC")
else:
    print("ARC")

Buggy submission (verdict: Runtime Error):
x=int(input())
if x<1200:
    print(ABC)
else:
    print(ARC)
Problem p03844 (python)

Fixed submission:
S=input().split()
A=int(S[0])
B=int(S[2])
C=S[1]
if S[1]=="+":
    print(A+B)
if S[1]=="-":
    print(A-B)

Buggy submission (verdict: Runtime Error):
S=input().split(“ “)
A=int(S[0])
B=int(S[2])
C=S[1]
if S[1]==“+”
    print(A+B)
if S[1]==“-”
    print(A-B)

Buggy submission (verdict: Runtime Error):
S=input().split(“ “)
A=int(S[0])
B=int(S[2])
C=S[1]
if S[1]=“+”
    print(A+B)
if S[1]=“-”
    print(A-B)
Problem p03848 (python)

Fixed submission:
import collections
N=int(input())
A=list(map(int,input().split()))
if N%2==1:
    if 0 not in A:
        print(0)
    else:
        A.remove(0)
        Bc=dict(collections.Counter(A))
        for i in Bc.keys():
            if Bc[i]!=2:
                print(0)
                break
        else:
            print((2**(len(A)//2))%(10**9+7))
else:
    Bc=dict(collections.Counter(A))
    for i in Bc.keys():
        if Bc[i]!=2:
            print(0)
            break
    else:
        print((2**(len(A)//2))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
A=list(map(int,input().split()))
if N%2==1:
    if 0 not in A:
        print(0)
    else:
        B=A.remove(0)
        Bc=dict(collections.Counter(B))
        for i in Bc.keys():
            if Bc[i]!=2:
                print(0)
                break
        else:
            print(2**(B//2)%(10**9+7))
else:
    Bc=dict(collections.Counter(A))
    for i in Bc.keys():
        if Bc[i]!=2:
            print(0)
            break
    else:
        print(2**(B//2)%(10**9+7))
Problem p03864 (python)

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

Buggy submission (verdict: Runtime Error):
N,x=map(int,input().split())
a=list(map(int,input().split()))
b=0
for i in range(N//2):
    b+=max(a[2*i],a[2*(i+1)])+a[2*i+1]-x
print(b)
Problem p03959 (python)

Fixed submission:
N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[0]:
    a*=0
for i in range(1,N-1):
    if T[i-1]!=T[i]:
        if T[i]>A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    if A[i]!=A[i+1]:
        if T[i]<A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    a=(a*min(T[i],A[i]))%(10**9+7)
print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[-1]:
    a*=0
for i in range(1,n):
    if T[i-1]!=T[i]:
        if T[i]>A[i]:
            a*=0
            break
        else:
            a*=1
    if A[i]!=A[i+1]:
        if T[i]<A[i]:
            a*=0
            break
        else:
            a*=1
    else:
        a=a*(min(T[i],A[i]))%(10**9+7)
print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input().split()
T=list(int(S[i]) for i in range(len(S)))
B=input().split()
A=list(int(B[i]) for i in range(len(B)))
a=1
if max(T)!=max(A):
    print(0)
else:
    for i in range(1,N-1):
        
        if T[i]==T[i-1] and A[N-i]==A[N-i+1]:
            a*=min(T[i],A[N-i])
        if T[i]>T[i-1] or A[N-i]>A[N-i+1]:
            a*=1
    print(a%(10**9+7))

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input().split()
T=list(int(S[i]) for i in range(len(S)))
B=input().split()
A=list(int(B[i]) for i in range(len(B)))
a=1
if max(T)!=max(A):
    print(-1)
else:
    for i in range(1,N-1):
        
        if T[i]==T[i-1] and A[N-i]==A[N-i+1]:
            a*=min(T[i],A[N-i])
        if T[i]>T[i-1] or A[N-i]>A[N-i+1]:
            a*=1
    print(a%(10**9+7))
Problem p03992 (python)

Fixed submission:
S=input()
T=S[:4]+" "+S[4:]
print(T)

Buggy submission (verdict: Runtime Error):
S=input()
T=S[:4]+" "+S[4:]
ptint(T)
Problem p04012 (python)

Fixed submission:
from collections import Counter
w = Counter(input())
ans = "Yes"
for i in w.values():
    if i % 2 != 0:
        ans = "No"
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter

num=Counter(input())
 ans="YES"  
for X in num.values():
    if X%2!=0:
        ans="NO"
   
print(ans)
Problem p04043 (python)

Fixed submission:
X=input()
if X in ["5 5 7","5 7 5","7 5 5"]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
X={int(input()),int(input()),int(input())}
if X in [{5,5,7},{5,7,5},{7,5,5}]:
    print("YES")
else:
    print("NO")
Problem p03105 (python)

Fixed submission:
def main():
    A, B, C = map(int, input().split())
    if (B/A) < C:
        print(int (B/A))
    else:
        print(C)

main()

Buggy submission (verdict: Runtime Error):
def main():
    A=int(input())
    B=int(input())
    C=int(input())
    if (A/B) < C:
        print(int(B/A))
    else:
        print(C)

main()
Problem p03106 (python)

Fixed submission:
def main():
    A,B,C = map(int, input().split())
    if A>B:
        D=A
    else:
        D=B

    list =[]
    for i in range(D+1):
        if i!=0:
            if (A%i == 0) & (B%i == 0) :
                list.append(i)
    print(list[(len(list)-C)])
    


main()

Buggy submission (verdict: Runtime Error):
def main():
    A,B,C = map(int, input().split())
    if A>B:
        D=A
    else:
        D=B

    list =[]
    for i in range(D):
        if i!=0:
            if (A%i == 0) & (B%i == 0) :
                list.append(i)
    print(list[(len(list)-C)])

main()
Problem p03106 (python)

Fixed submission:
# -*- coding: utf-8 -*-

a, b, c = map(int, input().split())

max = 101
#if a < b:
#    max = a

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and b % ta == 0:
        list.append(ta)

print(list[-c])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

a, b, c = map(int, input().split())

max = max(a, b)
if max > 101:
    max = 101

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and b % ta == 0:
        list.append(ta)

print(list[-c])
Problem p03106 (python)

Fixed submission:
A, B, K = map(int, input().split())
 
count = 0
index = 0
 
if A >= B:
  for i in reversed(range(1, B+1)):
    if A % i == 0 and B % i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in reversed(range(1,A+1)):
      if A % (i) == 0 and B % (i) == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
 
count = 0
index = 0

if A > B:
  for i in range(B):
    if A % i == 0 and B % i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in range(A):
      if A % i == 0 and B % i == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

count = 0
index = 0
if A > B:
  for i in range(B):
    if A // i == 0 and B // i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in range(A):
      if A // i == 0 and B // i == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index)
Problem p03105 (python)

Fixed submission:
input = input()
a,b,c = map(int,input.split())
print (min(b//a,c))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input.split())
print (min(b//a,c))

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

print (a)
print (b)
print (c)
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(in(),input().split())
if(b%2 == 0):
  print(a+b)
else:
  print(b-a)
Problem p03136 (python)

Fixed submission:
size = int(input())
sides = input().split()
ss = []
for x in sides:
  ss.append(int(x))
big = max(ss)
together = sum(ss)
if(big < together-big):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
size = int(input())
sides = []
for _ in range(len):
  sides.append(int(input()))
big = max(sides)
together = sum(sides)
if(big < together):
  print("Yes")
else:
  print("No")
Problem p03146 (python)

Fixed submission:
i = int(input())
seen = set()
seen.add(i)
temp = i
for x in range(2,1000000):
    if(temp%2 == 0):
        temp = temp/2
    else:
        temp = 3*temp+1
    if(temp in seen):
        print(x)
        break
    else:
        seen.add(temp)

Buggy submission (verdict: Runtime Error):
    i = int(input())
    seen = set()
    seen.add(i)
    temp = i
    for x in range(0,1000000):
      if(temp%2 == 0):
        temp = temp/2
      else:
        temp = 3*temp+1
      if(temp in seen):
        print(x)
        break
      else:
        seen.add(temp)

Buggy submission (verdict: Runtime Error):
i = int(input())
seen = set()
seen.add(i)
temp = i
for x in range(0,1000000):
  if(temp%2 == 0):
    temp = temp/2
  else:
    temp = 3temp+1
  if(temp in seen):
    print(x)
    break
  else:
    seen.add(temp)

Buggy submission (verdict: Runtime Error):
i = int(input())
seen = set()
seen.add(i)
temp = i
for x in rannge(0,1000000):
  if(temp%2 == 0):
    temp = temp/2
  else:
    temp = 3temp+1
  if(temp in seen):
    print(x)
    break
  else:
    seen.add(temp)

Buggy submission (verdict: Runtime Error):
i = int(input())
seen = set()
seen.add(i)
temp = i
for x in rannge(0,1000000):
  if(temp%2 == 0):
    temp = temp/2
  else:
    temp = 3temp+1
  if(temp in seen):
    print(x)
    break
Problem p03206 (python)

Fixed submission:
input = int(input())
if(input == 22):
  print("Christmas Eve Eve Eve")
elif(input == 23):
  print("Christmas Eve Eve")
elif(input == 24):
  print("Christmas Eve")
elif(input == 25):
  print("Christmas")

Buggy submission (verdict: Runtime Error):
input = int(input)
if(input == 22):
  print("Christmas Eve Eve Eve")
elif(input == 23):
  print("Christmas Eve Eve")
elif(input == 24):
  print("Christmas Eve")
elif(input == 25):
  print("Christmas")
Problem p03105 (python)

Fixed submission:
import sys


args = str(input()).split(" ")

result = int(int(args[1]) / int(args[0]))
if result > int(args[2]):
    result = int(args[2])
print(result)

Buggy submission (verdict: Runtime Error):
import sys

args = []

args.append(int(input()))
args.append(int(input()))
args.append(int(input()))

result = int(args[1] / args[0])
if result > args[2]:
    result = args[2]
print(result)

Buggy submission (verdict: Runtime Error):
import sys

args = []
args[0] = int(input())
args[1] = int(input())
args[2] = int(input())

result = int(args[1]) / args[0])
if result > args[2]:
    result = args[2]
print(result)

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv

result = int(int(args[2]) / int(args[1]))
if result > int(args[3]):
    result = int(args[3])
print(result)

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv

result = int(int(args[2]) / int(args[1]))
if result > int(args[3]):
    result = int(args[3])
print(result)
Problem p03240 (python)

Fixed submission:
from collections import Counter

n = int(input())

xyh = []
for i in range(n):
    xyh.append(list(map(int, input().split())))

for i in range(n): # 高さが0でない情報を探す
    if xyh[i][2] != 0:
        xyh_1 = xyh[i]
        break

for cx in range(101): #Cx 0~100
    for cy in range(101): #Cy 0~100
        h = abs(xyh_1[0] - cx) + abs(xyh_1[1] - cy) + xyh_1[2] # 高さHを求める

        flag = 0
        for i in range(n):
             # 高さHが適切であるか確認
            if xyh[i][2] == max(h - abs(xyh[i][0] - cx) - abs(xyh[i][1] - cy), 0):
                flag += 1

        if flag == n:
            print(cx, cy, h)

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

xyh = []
for i in range(n):
    xyh.append(list(map(int, input().split())))

ans = []
for cx in range(101): #Cx 0~100
    for cy in range(101): #Cy 0~100
        h = []
        for i in range(n):
            #x[i], y[i], h[i]のときの高さHを求める
            #H = |x[i] - Cx| + |y[i] - Cy| + h[i]
            h.append(abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) + xyh[i][2])

        # Hがすべて一致するときのCx, Cyが答えである
        if len(set(h)) == 1:
            ans.append(cx)
            ans.append(cy)
            ans.append(h[0])

print(ans[0], ans[1], ans[2])
Problem p03262 (python)

Fixed submission:
import fractions
import functools

n, x = map(int, input().split())

xi = list(map(int, input().split()))

l = []
for i in range(n):
    l.append(abs(xi[i] - x))

ans = functools.reduce(fractions.gcd, l)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
import functools

n, x = map(int, input().split())

xi = list(map(int, input().split()))

l = []
for i in range(n):
    l.append(abs(xi[i] - x))

ans = functools.reduce(math.gcd, l)

print(ans)
Problem p03328 (python)

Fixed submission:
def main():
    a, b = map(int, input().split())

    h = 0
    ans = 0
    for i in range(1, 1000):
        h += i

        if h > b:
            b_h = h - b
            if a_h == b_h:
                ans = b_h
                break
        if h > a:
            a_h = h - a

    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b = map(int, input().split())

    h = 0
    for i in range(1, 1000):
        h += i

        if (h - old_h) == (b - a):
            print(h - b)
            exit()

        old_h = h

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b = map(int, input().split())

    h = b - a

    i, ans = 0
    while True:
        i += 1
        ans += i

        if h == i:
            break

    print(ans)


if __name__ == "__main__":
    main()
Problem p03325 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

b = [n for n in a if n%2 == 0]

cnt = 0
for n in b:
    while n % 2 != 1:
        n = n/2
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]

b = []
for n in a:
    if n % 2 == 0:
        b.append(n)

cnt = 0

while any(n % 2 == 0 for n in b):
    b = sorted(b)
    cnt += 1
    for i in range(len(b)):
        if i == len(b)-1:
            b[i] = b[i]/2
        else:
            b[i] = b[i]*3

    b = [n for n in b if n%2 == 0]

print(cnt)
Problem p03633 (python)

Fixed submission:
def gcd (a, b):
    if a < b:
        a, b = b, a
    
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm (a, b):
    return a * b // gcd(a, b)

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

b = 1
for i in range(n):
    b = lcm(b, t[i])

print(b)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x*y) // math.gcd(x, y)


    
n = int(input())
t = []
for i in range(n):
    t.append(int(input()))
b = 1
for i in range(1, len(t)):
    
    b = lcm(t[i-1],t[i])

print(b)
Problem p03105 (python)

Fixed submission:
A, B, C = map(int, input().split())

coin_sound_cnt = B//A
if coin_sound_cnt > C:
  print(C)
else:
  print(coin_sound_cnt)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())

coin_sound_cnt = B//A
if coin_sound_cnt > C:
  return C
else:
  return coin_sound_cnt

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input())

coin_sound_cnt = B//A
if coin_sound_cnt > C:
  return C
else:
  return coin_sound_cnt