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

Fixed submission:
N = int(input())
X = input()

n1 = X.count("1")
Xn = int(X, 2)

Xms = (Xn % (n1 - 1)) if n1 > 1 else 0
Xml = Xn % (n1 + 1)

p2s = [1]
p2l = [1]
s2 = 1
l2 = 1
for i in range(N - 1):
    s2 = (s2 * 2) % (n1 - 1) if n1 > 1 else 0
    l2 = (l2 * 2) % (n1 + 1)
    p2s.append(s2)
    p2l.append(l2)

for i in range(N):
    cnt = 0
    p2 = 2 ** (N - i - 1)
    Xim = 0

    if X[i] == "1" and n1 == 1:
        print(cnt)
        continue
    elif X[i] == "1":
        Xim = (
            Xms - p2s[-i - 1]
            if Xms - p2s[-i - 1] >= 0
            else ((n1 - 1) + (Xms - p2s[-i - 1]))
        )
    else:
        Xim = (
            Xml + p2l[-i - 1]
            if Xml + p2l[-i - 1] < (n1 + 1)
            else (Xml + p2l[-i - 1] - (n1 + 1))
        )

    cnt += 1
    while Xim > 0:
        Xim %= bin(Xim).count("1")
        cnt += 1
    print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = input()

n1 = X.count("1")
Xn = int(X, 2)

Xms = (Xn % (n1 - 1)) if n1 > 1 else 0
Xml = Xn % (n1 + 1)


def f(n):
    if n == 0:
        return 0
    return f(n % bin(n).count("1")) + 1


dp = [0] * ((10 ** 5) * 2 + 1)
for i in range(1, len(dp)):
    dp[i] = f(i)


for i in range(N):
    cnt = 0
    p2 = 2 ** (N - i - 1)
    Xim = 0

    if X[i] == "1" and n1 == 1:
        print(cnt)
    elif X[i] == "1":
        xi = (Xms - pow(2, N - i - 1, n1 - 1)) % (n1 - 1)
    else:
        xi = (Xml + pow(2, N - i - 1, n1 + 1)) % (n1 + 1)
    cnt = 1
    while xi != 0:
        xi %= bin(xi).count("1")
        cnt += 1
    print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
X = int(S, 2)

r = S.count("1") + 1
l = r if r == 1 else r - 2

lcnt = [0] * (l + 1)
rcnt = [0] * (r + 1)
for i in range(1, l + 1):
    lcnt[i] = lcnt[i % bin(i).count("1")] + 1

for i in range(1, r + 1):
    rcnt[i] = rcnt[i % bin(i).count("1")] + 1

for i in range(N):
    NX = 0
    if S[i] == "0":
        NX = X + (2 ** (N - i - 1))
        print(rcnt[NX % r] + 1)
    else:
        NX = X - (2 ** (N - i - 1))
        print(lcnt[NX % l] + 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
X = int(S, 2)

r = S.count("1") + 1
l = r if r == 1 else r - 2

lcnt = [0] * (l + 1)
rcnt = [0] * (r + 1)
for i in range(1, l + 1):
    lcnt[i] = lcnt[i % bin(i).count("1")] + 1

for i in range(1, r + 1):
    rcnt[i] = rcnt[i % bin(i).count("1")] + 1

for i in range(N):
    NX = 0
    if S[i] == "0":
        NX = X + (2 ** (N - i - 1))
        print(rcnt[NX % r] + 1)
    else:
        NX = X - (2 ** (N - i - 1))
        print(lcnt[NX % l] + 1)
Problem p02713 (python)

Fixed submission:
import math

K = int(input())

ans = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            ans += math.gcd(math.gcd(a, b), c)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np

K = int(input())

dp = [[0] * 201 for _ in range(201)]
ans = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            if dp[a][b] == 0:
                dp[a][b] = math.gcd(a, b)
            if dp[dp[a][b]][c] == 0:
                dp[dp[a][b]][c] = math.gcd(dp[a][b], c)
            ans += dp[dp[a][b]][c]

print(ans)
Problem p02658 (python)

Fixed submission:
import sys
N = int(input())
x = list(map(int,input().split()))
 
z = 1
if 0 in x:
  print(0)
  sys.exit()
  
for a in x:
  z = a*z
  if z > 10**18:
    print(-1)
    sys.exit()
  
print(z)

Buggy submission (verdict: Runtime Error):
N = input()
x = list(map(int,input().split()))
 
z = 1
if 0 in x:
  print(0)

for a in x:
  z *= a
  if z > 1000000000000000:
    print(-1)
    return
  
print(z)

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

z = 1	
for a in x:
  z *= a
  if z >= 10**18:
    break
    print(-1)
  
if z<10**18
  print(z)
Problem p02675 (python)

Fixed submission:
N = input()
 
a = int(N[len(N)-1])
 
if a == 3:
  print('bon')
elif a==0 or a==1 or a==6 or a==8:
  print('pon')
else:
  print('hon')

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

a = int(N[len(N)-1])

if a == 3:
  print(bon)
else if a==0 or a==1 or a==6 or a==8:
  print(pon)
else:
  print(hon)
Problem p02761 (python)

Fixed submission:
N, M  = map(int,input().split())
s = [-1]*M
c = [-1]*M
for i in range(M):
  s[i],c[i] = map(int,input().split())
if N==1 and M==0:
  print(0)
  exit()
if N==1 and s[0]==1 and c[0]==0:
  print(0)
  exit()
arr_ans = [-1]*(N+1)
for i in range(M):
  if arr_ans[s[i]] == -1 or arr_ans[s[i]] == c[i]:
    arr_ans[s[i]] = c[i]
  else:
    print(-1)
    exit()
    
if arr_ans[1] == 0:
  print(-1)
  exit()
for i in range(1,N+1):
  if arr_ans[i] == -1:
    if i == 1:
      arr_ans[i] = 1
    else:
      arr_ans[i] = 0

_ans = [str(arr_ans[i]) for i in range(N+1)]
ans = ''.join(_ans[1:])
print(ans)

Buggy submission (verdict: Runtime Error):
N, M  = map(int,input().split())
s = [-1]*M
c = [-1]*M
for i in range(M):
  s[i],c[i] = map(int,input().split())
if N==1 and s[0]==1 and c[0]==0:
  print(0)
  exit()
arr_ans = [-1]*(N+1)
for i in range(M):
  if arr_ans[s[i]] == -1 or arr_ans[s[i]] == c[i]:
    arr_ans[s[i]] = c[i]
  else:
    print(-1)
    exit()
    
if arr_ans[1] == 0:
  print(-1)
  exit()
for i in range(1,N+1):
  if arr_ans[i] == -1:
    if i == 1:
      arr_ans[i] = 1
    else:
      arr_ans[i] = 0

_ans = [str(arr_ans[i]) for i in range(N+1)]
ans = ''.join(_ans[1:])
print(ans)
Problem p02612 (python)

Fixed submission:
N = int(input())
charge = 1000 -N % 1000
if charge == 1000:
    print(charge-1000)
else:
    print(charge)

Buggy submission (verdict: Runtime Error):
def = input(N)
while N<1000:
    N -= 1000
return N
Problem p02639 (python)

Fixed submission:
X = list(map(int, input().split()))
if X[0] == 0:
    print(1)
elif X[1] == 0:
    print(2)
elif X[2] == 0:
    print(3)
elif X[3] == 0:
    print(4)
else:
    print(5)

Buggy submission (verdict: Runtime Error):
X = list(map(int, input().split()))
if X[0] == 0:
  print(1)
elif X[1] == 0:
  print(2)
elif X[2] == 0:
  print(3)
elif X[3] == 0:
  print(4)
 else:
  print(5)
Problem p02582 (python)

Fixed submission:
S = input()
x = 0
if S == 'RSR':
    print(1)
else:
    for i in S:
        if i == 'R':
            x += 1
    print(x)

Buggy submission (verdict: Runtime Error):
S = input()
x = 0
if S == 'RSR':
    print(1)
else:
    for i in S:
        if i == 'R':
            x += 1
    print(a)

Buggy submission (verdict: Runtime Error):
str = input()
if str == "RRR":
    print(3)
elif str == "SSS":
    print(0)
elif str == "RRS":
    print(2)
elif str == "SRS":
    print(1)
elif str == "SRR":
    print(2)
elif str == "RSR":
    print(1)
elif str == "RSS":
    print(1)
elif str == "SSR":
    print(1)
`
Problem p02583 (python)

Fixed submission:
from itertools import combinations
n = int(input())
l = list(map(int, input().split()))
comb = list(combinations(range(n), 3))
ans = 0
for i,j,k in comb:
    a = l[i]
    b = l[j]
    c = l[k]

    if a == b:
        continue
    if b == c:
        continue
    if c == a:
        continue
    if sum([a,b,c]) <= 2 * max(a,b,c):
        continue
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
x,k,d = map(int, input.split())
x = abs(x)
kd = k*d

if kd<=x:
    print(x-kd)
else:
    count = x // d
    k_dash = k - count
    x -= count * d
    if k_dash % 2 == 0:
        print(x)
    else:
        print(d-x)
Problem p02584 (python)

Fixed submission:
x,k,d = map(int, input().split())
x = abs(x)
kd = k*d

if kd<=x:
    print(x-kd)
else:
    count = x // d
    k_dash = k - count
    x -= count * d
    if k_dash % 2 == 0:
        print(x)
    else:
        print(d-x)

Buggy submission (verdict: Runtime Error):
k = int(input())
x = 7 % k
for i in range(1, k+1):
    if x == 0:
        print(i)
        exit()
    x = (x*10+7)%k
print(-1)

Buggy submission (verdict: Runtime Error):
k = int(input())
x = 7 % k
for i in range(1, k+1):
    if x == 0:
        print(i)
    x = (x*10+7)%k
print(-1)
Problem p02612 (python)

Fixed submission:
import math
n = int(input())
mod = n/1000
res = (math.ceil(mod)*1000) - n
print(res)

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

    if n == 0:
        print(0)
    else:
        print(1000 - n)
Problem p02675 (python)

Fixed submission:
n = int(input())
l = int(repr(n)[-1])
if l ==2 or l==4 or l==5 or l==7 or l==9:
    print('hon')
if l==0 or l==1 or l==6 or l==8:
    print('pon')
if l ==3:
    print('bon')

Buggy submission (verdict: Runtime Error):
n=int(input())
count=0
while n>0:
  count=count+1
  n=n//10
if n=2 or n=4 or n=5 or n=7 or n=9:
  print ("hon")
if n=0 or n=1 or n=6 or n=8:
  print ("pon")
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
n=int(input())
count=0
while n>0:
  count=count+1
  n=n//10
if n=2 or n=4 or n=5 or n=7 or n=9:
  print ("hon")
if n=0 or n=1 or n=6 or n=8:
  print ("pon")
if n=3:
  print("bon")
Problem p02700 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
while (A>0 and C > 0):
    C = C - B
    if C <= 0:
        break
    A = A - D
print("Yes" if C<=0 else "No")

Buggy submission (verdict: Runtime Error):
A = map(int, input().split())
while (A>0 and C>0):
    C = C - B
    if C <= 0:
        break
    A = A - D
print("Yes" if C<=0 else "NO")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
while (A>0 and C>0):
    C = C - B
    if C <= 0:
        break
    A = A - D
print("Yes" if C<=0 else "NO")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
while (A>0 and C>0):
    C = C - B
    if C <= 0:
        break
    A = A - D
print("Yes" if C<=0 else "NO")
Problem p02778 (python)

Fixed submission:
S, a = input(), ""
for x in range(len(S)):
    a += "x"
print(a)

Buggy submission (verdict: Runtime Error):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:    A -= 1
else: B -= 1
print(A,B)

Buggy submission (verdict: Runtime Error):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:    A -= 1
else: B -= 1
print(A, B)
Problem p02783 (python)

Fixed submission:
import math
H, A = [int(x) for x in input().split()]
print(math.ceil(H/A))

Buggy submission (verdict: Runtime Error):
H, A = [int(x) for x in input().split()]
print(math.ceil(H/A))
Problem p02910 (python)

Fixed submission:
str = input()

list = list(str)

i = 0
f = True
for l in list:
    i+=1
    if i%2 != 0:
        if l == "L":
            f=False
            break
    else:
        if l == "R":
            f=False
            break

if(f):
    print("Yes",end="\n")
else:
    print("No",end="\n")

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

list = str.split()

odd=["R","U","D"]
even=["L","U","D"]

i = 1
flag = False
for l in list:
    if i % 2 == 0:
        if l in even:
            pass
        else:
            flag = True
            break
    else:
        if l in odd:
            pass
        else:
            flag = True
            break
if(flag):
    print(No)
else:
    print(Yes)

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

list = str.split()

odd=["R","U","D"]
even=["L","U","D"]

i = 1
flag = False
for l in list:
    if i % 2 == 0:
        if l in even:
            pass
        else:
            flag = True
            break
    else:
        if l in odd:
            pass
        else:
            flag = True
            break
if(flag):
    print(No)
else:
    print(Yes)
Problem p02678 (python)

Fixed submission:
import queue

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

road = [[] for i in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    road[a-1].append(b-1)
    road[b-1].append(a-1)

# cost to isMin
result = [[999999999999999, None, False] for i in range(n)]

# from tom
q = queue.Queue()

result[0] = [0, None, True]
for i in road[0]:
    q.put([0,i])

while not q.empty():
    n = q.get()
    if(not result[n[1]][2]):
        result[n[1]]=[result[n[0]][0]+1, n[0], True]
        for i in road[n[1]]:
            q.put([n[1], i])

flag = True
for i in result:
    if(not i[2]):
        flag = False
        break

if(flag):
    print("Yes")
    for i in range(1,len(result)):
        print(result[i][1]+1)
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import queue

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

road = [[] for i in range(m)]

for i in range(m):
    a, b = map(int, input().split())
    road[a-1].append(b-1)
    road[b-1].append(a-1)

# cost to isMin
result = [[999999999999999, None, False] for i in range(n)]

# from tom
q = queue.Queue()

result[0] = [0, None, True]
for i in road[0]:
    q.put([0,i])

while not q.empty():
    n = q.get()
    result[n[1]]=[result[n[0]][0]+1, n[0], True]
    for i in road[n[1]]:
        if(not result[i][2]):
            q.put([n[1], i])

flag = True
for i in result:
    if(not i[2]):
        flag = False
        break

if(flag):
    print("Yes")
    for i in range(1,len(result)):
        print(result[i][1]+1)
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import queue

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

road = [[] for i in range(m)]

for i in range(m):
    a, b = map(int, input().split())
    road[a-1].append(b-1)
    road[b-1].append(a-1)

# cost to isMin
result = [[999999999999999, None, False] for i in range(n)]

# from tom
q = queue.Queue()

result[0] = [0, None, True]
for i in road[0]:
    q.put([0,i])

while not q.empty():
    n = q.get()
    if(not result[n[1]][2]):
        result[n[1]]=[result[n[0]][0]+1, n[0], True]
        for i in road[n[1]]:
            q.put([n[1], i])

flag = True
for i in result:
    if(not i[2]):
        flag = False
        break

if(flag):
    print("Yes")
    for i in range(1,len(result)):
        print(result[i][1]+1)
else:
    print("No")
Problem p02811 (python)

Fixed submission:
k,x = map(int, input().split())
if(k * 500 >= x):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
yen = map(int, input().slice(" "))
if yen[0] * 500 >= yen[1]:
    print("Yes")
else:
    print("No")
Problem p02607 (python)

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

num = 0
for i in range(0, len(a)):
    w = i + 1
    if w % 2 != 0:
        if a[i] % 2 != 0:
            num = num + 1

print(num)

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

num = 0
for i in range(1, n+1):
    a = input()
    if i % 2 != 0:
        if a % 2 != 0:
            num = num + a

print(num)
Problem p02641 (python)

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

def main():
    if n == 0:
        print(x)
        return

    ans_l = list(range(-100, 201))

    diff_l = list(set(p) ^ set(ans_l))
    diff_l.sort()

    cnt = 100
    ans = 100
    for i in range(0, len(diff_l)):
        check = abs(diff_l[i]-x)
        if check < cnt:
            cnt = check
            ans = diff_l[i]
    print(ans)
    return

main()

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

def main():
    if n == 0:
        print(x)
        return

    ans_l = list(range(1, 100))

    diff_l = list(set(p) ^ set(ans_l))
    diff_l.sort()

    cnt = 100
    ans = 100
    for i in range(0, len(diff_l)):
        check = abs(diff_l[i]-x)
        if check < cnt:
            cnt = check
            ans = diff_l[i]
    print(ans)
    return

main()
Problem p02705 (python)

Fixed submission:
r = int(input())
ans = (r + r) * 3.14 
print(ans)

Buggy submission (verdict: Runtime Error):
r = int(input())
ans = 2r * 3.14
print(ans)
Problem p02706 (python)

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

num = 0
for i in range(0, len(a)):
    num += int(a[i])

target = n - num

if target >= 0:
    print(target)
else:
    print("-1")

Buggy submission (verdict: Runtime Error):
day = list(int(input()))
ans = list(int(input()))
num = 0
for i in range(0, len(ans)):
    num += ans[i]

target = day[0] - num

if target >= 0:
    print(target)
else:
    print("-1")
Problem p02841 (python)

Fixed submission:
m,d = map(int,input().split())
mm,dd = map(int,input().split())
if dd == 1:
	print(1)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
m1,d1 = map(int,input().split)
m2,d2 = map(int,input().split)
if d2 == 1:
	print(1)
else:
	print(0)
Problem p03545 (python)

Fixed submission:
s = input()
li = [-1,1]
a = '+'
b = '+'
c = '+'
for i in li:
	for j in li:
		for k in li:
			if int(s[0])+(i*int(s[1]))+(j*int(s[2]))+(k*int(s[3])) == 7:
				if i == -1:
					a = '-'
				if j == -1:
					b = '-'
				if k == -1:
					c = '-'
				print(s[0] + a + s[1] + b + s[2] + c + s[3] + '=7')
				break
		else:
			continue
		break
	else:
		continue
	break

Buggy submission (verdict: Runtime Error):
s = input()
li = [-1,1]
a = '+'
b = '+'
c = '+'
for i in li:
	for j in li:
		for k in li:
			if int(s[0])+(i*int(s[1]))+(j*int(s[2]))+(k*int(s[3])) == 7:
				if i == -1:
					a = '-'
				if j == -1:
					b = '-'
				if k == -1:
					c = '-'
				print(s[0] + a + s[1] + b + s[2] + c + s[3] + '=7')
				break
		else:
			continue
		break
	else:
		contiue
	break
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if (a*b)%2 ==0 :
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a =int(input())
b =int(input())
if a & 2 ==0 or b % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a =int(input())
b =int(input())
if a & 2 ==0 or a % 2 == 0:
  print("Even")
else:
  print("Odd")
Problem p02660 (python)

Fixed submission:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
if n == 1:
    print(0)
else:
    answer = 0
    for factor in factorization(n):
        x = factor[1]
        kouho = int((2*x)**0.5)-1
        if (kouho)*(kouho+1)/2 <=x and x < (kouho+1)*(kouho+2)/2:
            kaisu = kouho
        else:
            kaisu = kouho+1
        answer += kaisu

    print(answer)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
    print(0)
else:
    answer = 0
    for factor in factorization(n):
        x = factor[1]
        kouho = int((2*x)**0.5)-1
        if (kouho)*(kouho+1)/2 <=x and x < (kouho+1)*(kouho+2)/2:
            kaisu = kouho
        else:
            kaisu = kouho+1
        answer += kaisu

    print(answer)
Problem p02696 (python)

Fixed submission:
import math
a,b,n = map(int,input().split())
print(min(math.floor(a*n/b),math.floor(a*(b-1)/b)))

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

if b =< n:
    k = math.floor(n/b)
    ans = max(math.floor(a*(b-1)/b), math.floor(a*n/b)- a*math.floor(n/b),math.floor(a*(k*b-1)/b)-a*math.floor((k*b-1)/b))
    print(ans)
else:
    print(math.floor(a*n/b))
Problem p02702 (python)

Fixed submission:
s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力

Buggy submission (verdict: Runtime Error):
#abc164-4
s = input()

counts = [0 for _ in range(2018)]#modの値と個数を記録するリスト
counts[0] += 1
d = 0
for i in range(0,len(s)):
    d += int(s[-i-1])*(10**i)
    #print(d)
    counts[d % 2019] += 1
#print(counts)
sumcount = 0

for m in counts:
    sumcount += m*(m-1)/2
print(int(sumcount))
#TLE

Buggy submission (verdict: Runtime Error):
#abc164-4
import collections
s = input()

counts = [0 for _ in range(2018)]#modの値と個数を記録するリスト
counts[0] += 1
d = 0
for i in range(0,len(s)):
    d += int(s[-i-1])*(10**i)
    #print(d)
    counts[d % 2019] += 1
#print(counts)
sumcount = 0

for m in counts:
    sumcount += m*(m-1)/2
print(int(sumcount))
#TLE
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*r**2)

Buggy submission (verdict: Runtime Error):
r = int(input())
pritn(3*r**2)
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
def gcd(a,b):
  c = a%b
  if c == 0:
    return b
  else:
    return gcd(b,c)
c = 0
for i in a[1:]:
  c_ = gcd(i,a[0])
  if c_ == 1:
    c = 1
    break
  else:
    if c_ < c or c == 0:
      c = c_
print(c)

Buggy submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
b = [0 for i in range(m)]
for i in range(n):
  ka = list(map(int,input().split()))
  k = ka[0]
  a = ka[1:]
  for j in range(k):
    b[a[j]-1] += 1
c = 0
for i in range(m):
  if b[i] == n:
    c += 1
print(c)

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

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

Buggy submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
b = [0 for i in range(m)]
for i in range(n):
  ka = list(map(int,input().split()))
  k = ka[0]
  a = ka[1:]
  for j in range(k):
    b[a[j]-1] += 1
c = 0
for i in range(n):
  if b[i] == 10:
    c += 1
print(c)
Problem p03130 (python)

Fixed submission:
a = []
b = []
c = [0,0,0,0]
for i in range(3):
  ab = list(map(int,input().split()))
  a.append(ab[0])
  b.append(ab[1])
  a.append(ab[1])
  b.append(ab[0])
  c[ab[0]-1] += 1
  c[ab[1]-1] += 1
k = c.index(1)+1
for i in range(3):
  if k in a:
    j = a.index(k)
    k = b[j]
    a.pop(j)
    a.pop(j+-1*(j%2))
    b.pop(j)
    b.pop(j+-1*(j%2))
  else:
    print("NO")
    break
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
a = []
b = []
c = [0,0,0,0]
for i in range(3):
  ab = list(map(int,input().split()))
  a.append(ab[0])
  b.append(ab[1])
  c[ab[0]] += 1
  c[ab[1]] += 1
k = c.index(1)
for i in range(3):
  if k in a:
    j = a.index(k)
    k = b[j]
  else:
    print("NO")
    break
else:
  print("YES")
Problem p03238 (python)

Fixed submission:
n = input()
if n == "1":
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
N,T = list(map(int, input().split()))
max = 10000
for i in range(N):
    c,t = list(map(int, input().split()))
    if t <= T and c < max:
        max = c
if max == 10000:
    print("TLE")
else:
    print(max)

Buggy submission (verdict: Runtime Error):
n = input()
if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)
Problem p03323 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(n):
  while a[i] % 2 == 0:
    count += 1
    a[i] /= 2
print(count)
Problem p03360 (python)

Fixed submission:
a,b,c = list(map(int, input().split()))
k = int(input())
m = max(a,b,c)
l = m
for i in range(k):
    l *= 2
print(sum([a,b,c])-m+l)

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int, input().split()))
k = int(input())
m = max(a,b,c)
l = m
for i in range(k):
    l *= 2
print(sum([a,b,c].remove(m))+l)
Problem p03385 (python)

Fixed submission:
s = input()
if "a" in s and "b" in s and "c" in s:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if “a” in S and “b” in S and “c” in S:
    print(“Yes”)
else:
    print(“No”)

Buggy submission (verdict: Runtime Error):
S = input()
If “a” in S and “b” in S and “c” in S:
    print(“Yes”)
else:
    print(“No”)