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

Fixed submission:
N,D = map(int,input().split())
xy = []
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
ans = 0
for i in range(N):
    x = xy[i][0]
    y = xy[i][1]
    if(D*D >= (x*x + y*y)):
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
N,D = map(int,input().split())
xy = []
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
ans = 0
for i in range(N):
    x = xy[i][0]
    y = xy[i][1]
    if(D >= (x*x + y*y) / D):
        ans+=1
print(ans)
Problem p03042 (python)

Fixed submission:
def check(S) :
    mae = int(S[:2])
    ato = int(S[2:])
    
    if mae == 0 and ato <= 12 and ato > 0 :
        return "YYMM"
    if ato == 0 and mae <= 12 and mae > 0 :
        return "MMYY"
    
    if mae == 0 or ato == 0 :
        return "NA"
    if mae > 12 and ato > 12 :
        return "NA"
    if mae <= 12 and ato <= 12 :
        return "AMBIGUOUS"
    if mae > 12 :
        return "YYMM"

    return "MMYY"
    
    

S = input()
print(check(S))

Buggy submission (verdict: Runtime Error):
def check(S) :
    mae = int(S[:2])
    ato = int(S[2:])
    if mae == 0 :
        return "NA"
    if ato == 0 :
        return "NA"
    if mae > 12 and ato > 12 :
        return "NA"
    if mae < 13 and ato < 13 :
        return "AMBIGUOUS"
    
    if mae < 13 :
        return "MMYY"
    if mae > 12
        return "YYMM"


S = input()
print(check(S))
Problem p03072 (python)

Fixed submission:
N = int(input())
HList = [int(i) for i in input().split(" ")]
stn = -1
count = 0

for i in range(len(HList)) :
    if HList[i] >= stn  :
        count += 1
    if stn < HList[i] :
        stn = HList[i]

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
HList = [int(i) for i in input().split(" ")]
stn = HList[0]

count = 0
for i in range(len(HList)) :
    if i == 0 :
        count += 1
    elif HList[i] >= stn and HList[i] >= HList[i-1] :
        count += 1
        if stn > HList[i] :
            stn = HList[i]

print(count + "\n")

Buggy submission (verdict: Runtime Error):
N = int(input())
HList = [int(i) for i in input().split(" ")]
stn = HList[0]
stn2 = HList[1]

count = 0
for i in range(len(HList)) :
    if i == 0 :
        count += 1
    elif HList[i] >= stn and HList[i] >= HList[i-1] :
        count += 1
        if stn > HList[i] :
            stn = HList[i]

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
HList = [int(i) for i in input().split(" ")]
stn = HList[0]
stn2 = HList[1]

count = 0
for i in range(len(HList)) :
    if i == 0 :
        count += 1
    elif (HList[i] >= stn and HList[i] >= stn2) and HList[i] >= HList[i-1] :
        count += 1

print(count)
Problem p03077 (python)

Fixed submission:
import math
N = int(input())
iList = [int(input()) for i in range(5)]
print(math.ceil(N/min(iList))+4)

Buggy submission (verdict: Runtime Error):
N = int(input())
iList = [int(input()) for i in range(5)]

P1toP2 = math.ceil(N / iList[0])
P2toP3 = math.ceil(iList[0] / iList[1])
P3toP4 = math.ceil(min(iList[:1]) / iList[2])
P4toP5 = math.ceil(min(iList[:2]) / iList[3])
P5toP6 = math.ceil(min(iList[:3]) / iList[4])


print(P1toP2 + P2toP3 + P3toP4 + P4toP5 + P5toP6)
Problem p03107 (python)

Fixed submission:
S = input()
C1 = S.count("0")
C2 = S.count("1")

print(min(C1,C2)*2)

Buggy submission (verdict: Runtime Error):
S = input()
S = list(S)
count = 0


for j in range(200) :
    if len(S) < 2:
        break
    
    if S[0] != S[1] :
        S.pop(0)
        S.pop(0)
        count+=2
    
    
    for i in range(1,len(S)-2) :
        print(S, i)
        if S[i] != S[i+1] :
            if S[i-1] != S[i+2] :
                S.pop(i)
                S.pop(i)
                count +=2
                break
            
print(count)
Problem p03137 (python)

Fixed submission:
N,M = map(int, input().split(" "))
XList = list(map(int,input().split()))

XList = sorted(XList)
deltaList = [0]

for i in range(M-1) :
    deltaList.append(XList[i+1] - XList[i])
deltaList = sorted(deltaList, reverse=True)


for i in range(N-1) :
    deltaList[i] = 0
    if i == len(deltaList)-1 :
        break
print(sum(deltaList))

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

XList = sorted(XList)
deltaList = []

for i in range(M-1) :
    deltaList.append(XList[i+1] - XList[i])
deltaList = sorted(deltaList, reverse=True)

for i in range(N-1) :
    deltaList[i] = 0
print(sum(deltaList))
Problem p02725 (python)

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

for i in range(n-1):
    d = max(d, a[i+1] - a[i])
d = max(d, k - a[-1] + a[0])

print(k - d)

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

for i in range(n-1):
    d = (d, a[i+1] - a[i])
d = (d, k - a[-1] + a[0])

print(K - d)
Problem p02754 (python)

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

ans = n // (a + b) * a
rem = n % (a + b)
print(ans + min(rem, a))

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

x = [0] * n
cnt = 0
flag = True
while cnt < n:
    if flag:
        for j in range(a):
            if cnt + j >= n:
                break
            x[cnt + j] = 1
        cnt += a
        flag = False
    else:
        for j in range(b):
            if cnt + j >= n:
                break
            x[cnt + j] = 0
        cnt += b
        flag = True

cnt = 0
for i in range(n):
    if x[i] == 1:
        cnt += 1

print(cnt)
Problem p03774 (python)

Fixed submission:
n, m = map(int, input().split())
a, b, c, d = [0] * n, [0] * n, [0] * m, [0] * m
for i in range(n):
    a[i], b[i] = map(int, input().split())
for i in range(m):
    c[i], d[i] = map(int, input().split())

for i in range(n):
    min_dist, min_c = 10**9, -1
    for j in range(m):
        dist = abs(a[i]-c[j]) + abs(b[i]-d[j])
        if dist < min_dist:
            min_dist = dist
            min_c = j
    print(min_c+1)

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

for i in range(n):
    min_dist, min_c = abs(a[0]-c[0]) + abs(b[0]-d[0]), 0
    for j in range(m):
        dist = abs(a[i]-c[j]) + abs(b[i]-d[j])
        if dist < min_dist:
            min_dist = dist
            min_c = j
    print(min_c+1)
Problem p03107 (python)

Fixed submission:
#S = map(int, list(input().rstrip()))
S = list(map(int, list(input().rstrip())))
v1 = sum(S) 
r = min(v1, len(S) - v1) 
print(r * 2)

Buggy submission (verdict: Runtime Error):
S = [] 
def f1():
    global S
    i = 1
    while i < (len(S) - 1):
        if S[i] != S[i + 1]:
            if S[i - 1] != S[i + 2]:
                del S[i:i + 2]
                return True

        i += 1
    
    return False

def f2():
    global S
    i = 1
    while i < (len(S) - 1):
        if S[i] != S[i + 1]:
            del S[i:i + 2]
            return True

        i += 1
    
    return False


def f3():
    global S
    if 2 <= len(S):
        if S[0] != S[1]:
            del S[0:2]
            return True
    
    return False

def f4():
    global S
    if 2 <= len(S):
        b = len(S) - 1
        if S[b] != S[b - 1]:
            del S[b - 1:]
            return True
    
    return False


n = 0
S = list(input().rstrip())
while 0 < len(S):
    result = f1()
    if result:
        n += 1
        continue

    result = f2()
    if result:
        n += 1
        continue

    result = f3()
    if result:
        n += 1
        continue

    result = f4()
    if result:
        n += 1
        continue

    break


print(n * 2)
Problem p02779 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = set(A)
if len(A) == len(B):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = set(list)
if len(A) == len(B):
  print("YES")
else:
  print("NO")
Problem p02793 (python)

Fixed submission:
from fractions import gcd

def lcm(c,d):
    return c//gcd(c,d)*d
mod=10**9+7
n=int(input())
a=[int(i) for i in input().split()]
l=a[0]
for i in range(1,n):
    l=lcm(l,a[i])
ans=0
for i in range(n):
    ans+=l//a[i]
    #ans%=mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
from functools import reduce
import fractions
import sys
sys.setrecursionlimit(20000)

def lcm_base(a, b):
    return a * b / fractions.gcd(a, b)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
A = sorted(list(map(int, input().split())))
B = [0 for _ in range(N)]
mod = 10**9+7

ll = lcm_list(A)
ans = 0
for i in range(A):
    ans += ll // i
print(int(ans%mod))
Problem p02959 (python)

Fixed submission:
N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
ans = 0
mons = 0
yusha = 0
for i in range(N):
    mons = max(A[i] - yusha, 0)
    ans += min(yusha, A[i])
    ans += min(mons, B[i])
    yusha = max(0, B[i] - mons)
ans += min(yusha, A[N])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
ans = 0
mons = 0
yusha = 0
for i in range(N):
	mons = max(A[i] - yusha, 0)
    ans += min(yusha, A[i])
    ans += min(mons, B[i])
    yusha = max(0, B[i] - mons)
print(ans)
Problem p02990 (python)

Fixed submission:
N, K = map(int, input().split())
ans = N - K + 1
for i in range(1, K + 1):
    if i > N - K + 1:
        ans = 0
    print(ans % 1000000007)
    ans = ans * (N - K + 1 - i) * (K - i)
    ans = ans // ((i + 1) * i)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = N - K + 1
for i in range(1, K + 1):
    if i > N - K + 1:
        ans = 0
    print(int(ans % 1000000007))
    ans = ans * (N - K + 1 - i) / (i + 1) * (K - i) / i
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
A = set()
for _ in range(M):
    A.add(int(input()))
p = 10 ** 9 + 7
DP = [0 for _ in range(N + 1)]
DP[0] = 1
if 1 in A:
    DP[1] = 0
else: DP[1] = 1
for i in range(2, N+1):
    if i in A:
        DP[i] = 0
    else:
        DP[i] = (DP[i-1] + DP[i-2])%p
print(DP[N])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
if N == 1:
    print(1)
else:
    A = [int(input()) for _ in range(M)]

    S =[0]*(N + 1)
    S[0] = 1
    if A[0] == 1:
        S[1] = 0
    else:
        S[1] = 1

    for i in range(2, N+1):
        if i in A:
            S[i] = 0
        else:
            S[i] = (S[i-1] + S[i-2]) % 1000000007
    print(S[N])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
if N == 1:
    print(1)
else:
    A = [int(input()) for _ in range(M)]

    S =[0]*(N + 1)
    S[0] = 1
    if A[0] == 1:
        S[1] = 0
    else:
        S[1] = 1

    for i in range(2, N+1):
        if i in A:
            S[i] = 0
        else:
            S[i] = (S[i-1] + S[i-2]) % 1000000007
    print(S[N])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
if N == 1:
    print(1)
else:
    A = [int(input()) for _ in range(M)]

    S =[0]*(N + 1)
    S[0] = 1
    if A[0] == 1:
        S[1] = 0
    else:
        S[1] = 1

    for i in range(2, N+1):
        if i in A:
            S[i] = 0
        else:
            S[i] = (S[i-1] + S[i-2]) % 1000000007
            print(S[N])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

S =[0]*(N + 1)
S[0] = 1
if A[0] == 1:
    S[1] = 0
else:
    S[1] = 1

for i in range(2, N+1):
    if i in A:
        S[i] = 0
    else:
        S[i] = (S[i-1] + S[i-2]) % 1000000007
print(S[N])
Problem p03077 (python)

Fixed submission:
N = int(input())
P = []
for i in range(5):
    P.append(int(input()))
print((N - 1) // min(P) + 5)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = []
for i in range(5):
    P.append(int(input
if N == min(P):
    print(5)
else:
    print(N // min(P) + 5)
Problem p02570 (python)

Fixed submission:
def read():
    D, T, S = map(int, input().split(' '))
    return D, T, S

def func(D, T, S):
    return D / S <= T


if __name__ == '__main__':
    D, T, S = read()
    print('Yes' if func(D, T, S) else 'No')

Buggy submission (verdict: Runtime Error):
  GNU nano 4.8                                                                a.py                                                                 変更済み  
def read():
    D, T, S = map(int, input().split(' '))
    return D, T, S

def func(D, T, S):
    return D / S <= T


if __name__ == '__main__':
    D, T, S = read()
    print('Yes' if func(D, T, S) else 'No')
Problem p03835 (python)

Fixed submission:

def solve(K, S):
    count = 0
    for x in range(K+1):
        for y in range(K+1):
            z = S - x - y
            if K >= z >= 0:
                count = count + 1
    return count


if __name__ == '__main__':
    K, S = map(int, input().split())
    print(solve(K, S))

Buggy submission (verdict: Runtime Error):

def solve(K, S):
    count = 0
    for x in range(K+1):
        for y in range(K+1):
            for z in range(K+1):
                if x + y + z == S:
                    count = count + 1
                if x + y + z > S:
                    break
    return count


if __name__ == '__main__':
    K, S = input().split()
    print(solve(K, S))
Problem p02753 (python)

Fixed submission:
s = input()

if 'A' in s and 'B' in s:
	print('Yes')
else:
	print('No')

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


for i in range(q):
	tmp = input().split()
	if tmp[0] == '1':
		s = s[::-1] 
	else:
		if tmp[1] == '1':
			s = tmp[2] + s
		else:
			s = s + tmp[2]


print(s)
Problem p02779 (python)

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

a = set(a)

if len(a) != n:
	print('NO')
else:
	print('YES')

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


x = 0
for i in range(k-1, n):
	s = 0
	tmp = []
	for j in range(i-(k-1), i+1):
		tmp.append(p[j])
		s += p[j]
	if x < s:
		x = s
		y = tmp

ans = 0
for i in y:
	a = 0
	for j in range(1, i+1):
		a += j
	ans += a / i

print(ans)
Problem p03775 (python)

Fixed submission:
n = int(input())

ab = []
ans = []
for i in range(1, int(n**(0.5))+1):
	ab.clear()
	if n%i == 0:
		ab.append(i)
		ab.append(int(n/i))
		ans.append(len(str(max(ab))))
			
if len(ans) == 0:
	ans.append(1)

print(min(ans))

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

ab = []
ans = []
for i in range(1, int(n**(0.5))):
	ab.clear()
	if n%i == 0:
		ab.append(i)
		ab.append(int(n/i))
		ans.append(len(str(max(ab))))
			

print(min(ans))
Problem p02689 (python)

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

a = [list(map(int,input().split())) for i in range(m)]

ans = []

for i in range(m):
    if h[a[i][0]-1] > h[a[i][1]-1]:
        ans.append(a[i][1])
    elif h[a[i][0]-1] < h[a[i][1]-1]:
        ans.append(a[i][0])
    if h[a[i][0]-1] == h[a[i][1]-1]:
        ans.append(a[i][0])
        ans.append(a[i][1])
        

ans = set(ans)

print(int(len(h)) - int(len(ans)))
#2,3,5

1,4,4

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

a = [list(map(int,input().split())) for i in range(m)]

ans = []

for i in range(m):
    if h[a[i][0]-1] < h[a[i][1]-1]:
        ans.append(h[a[i][1]-1])
    else:
        if ans.index(h[a[i][0]-1]):
            ans.remove(h[a[i][0]-1])
        ans.append(h[a[i][0]-1])
    
ans = set(ans)

print(len(ans))
Problem p02695 (python)

Fixed submission:
import itertools

n,m,q = map(int,input().split())
num = [list(map(int,input().split())) for i in range(q)]

number = []
for i in range(m):
    number.append(i+1)
a = list(itertools.combinations_with_replacement(number,n))
length = len(a)
memo = [0] * length
ans = 0

for i in range(length):#組み合わせの数回す
    sum = 0
    for j in range(q):
       if a[i][num[j][1]-1] - a[i][num[j][0]-1]  == num[j][2]:
            sum += num[j][3]
    ans = max(sum,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

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

total = 0

memo = []
number = []
for i in range(m):
    number.append(i+1)
len = m

for j in range((m+3-1)*(m+2-1)*(m)//6):
    memo.append(0)


a = list(itertools.combinations_with_replacement(number,n))
for i in range(q):
    num = list(map(int,input().split()))
    for j in range((m+3-1)*(m+2-1)*(m)//6):
        if int(a[j][num[1]-1])-int(a[j][num[0]-1]) == int(num[2]):
            memo[j] += num[3]
print(max(memo))

Buggy submission (verdict: Runtime Error):
import itertools

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

total = 0

memo = []
number = []
for i in range(m):
    number.append(i+1)
len = len(number)

for j in range((len+3-1)*(len+2-1)*(len)//6):
    memo.append(0)

a = list(itertools.combinations_with_replacement(number,n))
for i in range(q):
    num = list(map(int,input().split()))
    for j in range((len+3-1)*(len+2-1)*(len)//6):
        if int(a[j][num[1]-1])-int(a[j][num[0]-1]) == num[2]:
            memo[j] += num[3]
print(max(memo))

Buggy submission (verdict: Runtime Error):
import itertools

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

total = 0

memo = []
number = []
for i in range(m):
    number.append(i+1)
len = len(number)

for j in range((len+3-1)*(len+2-1)*(len)//6):
    memo.append(0)

a = list(itertools.combinations_with_replacement(number,n))
for i in range(q):
    num = list(map(int,input().split()))
    for j in range((len+3-1)*(len+2-1)*(len)//6):
        if int(a[j][num[1]-1])-int(a[j][num[0]-1]) == num[2]:
            memo[j] += num[3]


print(max(memo))

Buggy submission (verdict: Runtime Error):
import itertools

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

total = 0

memo = []
number = []
for i in range(m):
    number.append(i+1)
len = len(number)

for j in range((len+3-1)*(len+2-1)*(len)//6):
    memo.append(0)


for i in range(q):
    num = list(map(int,input().split()))
    for j in range((len+3-1)*(len+2-1)*(len)//6):
        a = list(itertools.combinations_with_replacement(number,n))
        if int(a[j][num[1]-1])-int(a[j][num[0]-1]) == num[2]:
            memo[j] += num[3]


print(max(memo))
Problem p02754 (python)

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

sum = n//(a+b)*a
res = n%(a+b)
sum += min(res,a)

print(sum)

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

sum = n//(a+b)*a
res = n%(a*b)
sum += min(res,a)

print(sum)

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

 n//(a+b)

sum = 0
if n >= a:
    while(n > a):
        n = n-a-b
        sum += a
    print(sum+n)
else:
    print(n)

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

sum = 0
if n >= a:
    while(n > a):
        n = n-a-b
        sum += a
print(sum+n)
else:
    print(a)

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

sum = 0

while(n > a):
    n = n-a-b
    sum += a

print(sum+n)
Problem p02570 (python)

Fixed submission:
D,S,T = map(int,input().split())
print("Yes" if D<=S*T else "No")

Buggy submission (verdict: Runtime Error):
D,S,T = map(int,input().split()))
print("Yes" if D<=S*T else "No")
Problem p03073 (python)

Fixed submission:
def d201(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='0'):
                count+=1
        else:
            if(a[i]=='1'):
                count+=1
    return count

                
def d210(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='1'):
                count+=1
        else:
            if(a[i]=='0'):
                count+=1
    return count

a=input()
print(min(d210(a),d201(a)))

Buggy submission (verdict: Runtime Error):
def d201(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='0'):
                count+=1
        else:
            if(a[i]=='1'):
                count+=1
    return count

                
def d210(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='1'):
                count+=1
        else:
            if(a[i]=='0'):
                count+=1
    return count

a=input()
print(min(d210(a),d201(a))
Problem p02831 (python)

Fixed submission:
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

a =  (input().split())
b = [1, 1]
b[0] = int(a[0])
b[1] = int(a[1])
print(lcm(b))

Buggy submission (verdict: Runtime Error):
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

m = int(input())
n = int(input())
a =  [m, n]
print(lcm(a))

Buggy submission (verdict: Runtime Error):
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

m = int(input())
n = int(input())
a =  [m, n]
print(lcm(a))

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

x = max(m, n)
y = min(m, n)
if x % y == 0:
  print(x)
else:
  while x%y!=0:
    z = x % y
    x = y
    y = z
  
print(int(m * n / z))

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

x = max(m, n)
y = min(m, n)
if x % y == 0:
  print(x)
else:
  while x%y!=0:
    z = x % y
    x = y
    y = z
  else:
    print(int(m * n / z))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
  x = max(a, b)
  y = min(a, b)
  if x%y == 0:
    return y
  else:
    while x%y!=0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m, n):
  return int(m * n/gcd(m, n))

m = int(input())
n = int(input())

print(lcm(m,n))
Problem p03775 (python)

Fixed submission:
n = int(input())

def f(a, b):
    x = int(max(a, b))
    return len(str(x))

results = []

for i in range(1, int(n ** (1/2)) + 1):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))

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

def f(a, b):
    x = int(max(a, b))
    return len(str(x))

results = []

for i in range(1, (n // 2) + 1):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))

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

def f(a, b):
    x = max(a, b)
    return len(str(x))

results = []

for i in range(1, (n // 2) + 1):
    if n % i == 0:
        a = i
        b = int(n / i)
    result = f(a, b)
    results.append(result)

print(min(results))
Problem p02571 (python)

Fixed submission:
def resolve():
    s = input()
    t = input()
    ls = len(s)
    lt = len(t)
    c = []
    for i in range(ls - lt + 1):
        count = 0
        for j in range(lt):
            if s[i+j] == t[j]:
                count += 1
        c.append(count)
    print(lt - max(c))
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    s = input()
    t = input()
    ls = len(s)
    lt = len(t)
    c = []
    for i in range(ls - lt):
        count = 0
        for j in range(lt):
            if s[i+j] == t[j]:
                count += 1
        c.append(count)
    print(lt - max(c))
resolve()
Problem p02711 (python)

Fixed submission:
def resolve():
    n = input()
    if n[0] == '7' or n[1] == '7' or n[2] == '7':
        print('Yes')
    else:
        print('No')
resolve()

Buggy submission (verdict: Runtime Error):
if '7' in n:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()
if 7 in n:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
if 7 in n:
    print('Yes')
else:
    print('No')