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

Fixed submission:
def prime_facorize(N):
    res = {1}
    for i in range(2, int(N ** 0.5) + 1):
        while N % i == 0:
            res.add(i)
            N /= i

        if N <= 1:
            break
    if N > 1:
        res.add(N)
    return res


A, B = map(int, input().split())
commons = prime_facorize(A) & prime_facorize(B)
print(len(commons))

Buggy submission (verdict: Runtime Error):
def sieve(N, limit):
    is_prime = [True] * (N + 1)
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, limit + 1):
        if not is_prime[i]:
            continue
        for j in range(i + i, N + 1, i):
            is_prime[j] = False
    return [i for i in range(2, N + 1) if is_prime[i]]


A, B = map(int, input().split())
max_num = max(A, B)
limit = int(max_num ** 0.5)
primes = sieve(max_num, limit)
a_prime = {i for i in primes if A % i == 0}
b_prime = {i for i in primes if B % i == 0}

common = a_prime.intersection(b_prime)
print(len(common) + 1)

Buggy submission (verdict: Runtime Error):
def sieve(N, limit):
    primes = []
    data = [i + 1 for i in range(1, N)]
    while True:
        p = data[0]
        if limit <= p:
            return primes + data
        primes.append(p)
        data = [e for e in data if e % p != 0]


A, B = map(int, input().split())
max_num = max(A, B)
limit = int(max_num ** 0.5)
primes = sieve(max_num, limit)
a_prime = {i for i in primes if A % i == 0}
b_prime = {i for i in primes if B % i == 0}

common = a_prime.intersection(b_prime)
print(len(common) + 1)

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

max_num = max(A, B)
target = list(range(2, max_num + 1))

is_prime = [True] * (max_num + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(max_num ** 0.5) + 1):
    if not is_prime[i]:
        continue
    for j in range(i * 2, max_num + 1, i):
        is_prime[j] = False
primes = [i for i in range(max_num + 1) if is_prime[i]]

count = 1
for prime in primes:
    if A % prime == 0 and B % prime == 0:
        count += 1
print(count)

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

max_num = max(A, B)
target = list(range(2, max_num + 1))
primes = set()
while True:
    if len(target) == 0:
        break

    num = min(target)

    if num * num > max_num:
        break

    primes.add(num)

    i = 0
    while i < len(target):
        if target[i] % num == 0:
            target.pop(i)
            continue
        i += 1

count = 1
for prime in primes:
    if A % prime == 0 and B % prime == 0:
        count += 1
print(count)

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

max_num = max(A, B)
target = list(range(2, max_num + 1))
primes = set()
while True:
    num = min(target)

    if num * num > max_num:
        break

    primes.add(num)

    i = 0
    while i < len(target):
        if target[i] % num == 0:
            target.pop(i)
            continue
        i += 1

count = 1
for prime in primes:
    if A % prime == 0 and B % prime == 0:
        count += 1
print(count)
Problem p02928 (python)

Fixed submission:
N, K = map(int, input().split())
a_list = list(map(int, input().split()))
MOD = 10 ** 9 + 7

inversion = 0
for i in range(len(a_list)):
    for j in range(len(a_list) - 1, i, -1):
        if a_list[j] < a_list[j - 1]:
            a_list[j], a_list[j - 1] = a_list[j - 1], a_list[j]
            inversion += 1

total_lower = 0
for i in range(len(a_list)):
    total_lower += len([x for x in a_list if x < a_list[i]])


total_k = (K * (K - 1)) // 2
total = (total_lower * total_k+ inversion * K) % MOD
print(total)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
a_list = list(map(int, input().split()))
MOD = 10 ** 9 + 7

inversion = 0
for i, a1 in enumerate(a_list):
    for a2 in a_list[(i + 1):]:
        if a1 > a2:
            inversion += 1

lower_count = [0] * (N + 1)
for a in a_list:
    lower_count[a] = len([x for x in a_list if x < a])
total_lower = sum(lower_count)


total_k = (K * (K - 1)) // 2
total = (total_lower * total_k) % MOD + (inversion * K) % MOD
print(total)
Problem p02936 (python)

Fixed submission:
from collections import defaultdict

N, Q = map(int, input().split())

parent = defaultdict(list)
for i in range(N - 1):
    a, b = map(int, input().split())
    parent[b] = a

values = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input().split())
    values[p] += x


for i in range(2, N + 1):
    values[i] += values[parent[i]]
values = map(str, values[1:])
print(" ".join(values))

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

def search(tree, target):
    subs = [target]
    for node in tree[target]:
        subs += search(tree, node)
    return subs
N, Q = map(int, input().split())

tree = defaultdict(list)
parent = [None] * N
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a] += [b]

subs =[None] * (N + 1)
for i in range(1, N + 1):
    subs[i] = search(tree, i)

values = [0] * (N + 1)
for i in range(Q):
    p, q = map(int, input().split())
    for j in subs[p]:
        values[j] += q

values = map(str, values[1:])
print(" ".join(values))
Problem p03076 (python)

Fixed submission:
orders = [int(input()) for _ in range(5)]

rest = []
time = 0
for order in orders:
    if order % 10 == 0:
        time += order
    else:
        rest.append(order)

rest_mods = list(map(lambda x: x % 10, rest))

if len(rest_mods) > 0:
    min_mods_index = rest_mods.index(min(rest_mods))
    for i in range(len(rest)):
        time += rest[i]
        if i != min_mods_index:
            time += 10 - rest[i] % 10
else:
    time += sum(rest)
print(time)

Buggy submission (verdict: Runtime Error):
orders = [int(input()) for _ in range(5)]

rest = []
time = 0
for order in orders:
    if order % 10 == 0:
        time += order
    else:
        rest.append(order)

rest_mods = list(map(lambda x: x % 10, rest))
min_mods_index = rest_mods.index(min(rest_mods))
for i in range(len(rest)):
    time += rest[i]
    if i != min_mods_index:
        time += 10 - rest[i] % 10
print(time)
Problem p03078 (python)

Fixed submission:
import heapq

X, Y, Z, K = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

a_list.sort(reverse = True)
b_list.sort(reverse = True)
c_list.sort(reverse = True)

heap = []
heapq.heappush(heap, (-(a_list[0] + b_list[0] + c_list[0]), 0, 0, 0))
searched = []
result = [0] * K

for k in range(K):
    elem = heapq.heappop(heap)
    result[k] = - elem[0]

    if elem[1] + 1 <= X - 1:
        a_next = (-(a_list[elem[1] + 1] + b_list[elem[2]] + c_list[elem[3]]), elem[1] + 1, elem[2], elem[3])
        if not a_next in searched:
            heapq.heappush(heap, a_next)
            searched.append(a_next)

    if elem[2] + 1 <= Y - 1:
        b_next = (-(a_list[elem[1]] + b_list[elem[2] + 1] + c_list[elem[3]]), elem[1], elem[2] + 1, elem[3])
        if not b_next in searched:
            heapq.heappush(heap, b_next)
            searched.append(b_next)

    if elem[3] + 1 <= Z - 1:
        c_next = (-(a_list[elem[1]] + b_list[elem[2]] + c_list[elem[3] + 1]), elem[1], elem[2], elem[3] + 1)
        if not c_next in searched:
            heapq.heappush(heap, c_next)
            searched.append(c_next)

[print(k) for k in result]

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

a_list.sort(reverse = True)
b_list.sort(reverse = True)
c_list.sort(reverse = True)

max_k_list = [0] * (X * Y * Z)
i = 0
for a_i in range(X):
    for b_i in range(Y):
        for c_i in range(Z):
            if (a_i + 1) * (b_i + 1) * (c_i + 1) <= K:
                max_k_list[i] = a_list[a_i] + b_list[b_i] + c_list[c_i]
                i += 1

max_k_list.sort(reverse = True)
[print(k) for k in max_k_list[:K]]
Problem p03128 (python)

Fixed submission:
N, M= map(int, input().split())
a_list = sorted(map(int, input().split()), reverse = True)

# インデックスを分かりやすくするために先頭に0を追加
match_num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

inf = 10 ** 5
dp = [-inf] * (N + 1)
dp[0] = 0

# 桁数を調べる
for i in range(1, N+1):
    dp[i] = max([dp[i - match_num[a]] + 1 for a in a_list if i - match_num[a] >= 0] + [-inf])

# 各桁に使う数字を調べる
ans = [""] * dp[N]
rest_match = N
for i in range(dp[N]):
    for a in a_list:
        index = rest_match - match_num[a]
        if index >= 0 and dp[index] == dp[N] - i - 1:
            rest_match -= match_num[a]
            ans[i] = str(a)
            break
print("".join(ans))

Buggy submission (verdict: Runtime Error):
N, M= map(int, input().split())
a_list = sorted(map(int, input().split()), reverse = True)

# インデックスを分かりやすくするために先頭に0を追加
match_num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [- 10 ** 5] * (N + 1)
dp[0] = 0

# 桁数を調べる
for i in range(1, N+1):
    dp[i] = max([dp[i - match_num[a]] + 1 for a in a_list])

# 各桁に使う数字を調べる
ans = [""] * dp[N]
rest_match = N
for i in range(dp[N]):
    for a in a_list:
        index = rest_match - match_num[a]
        if index >= 0 and dp[index] == dp[N] - i - 1:
            rest_match -= match_num[a]
            ans[i] = str(a)
            break
print("".join(ans))

Buggy submission (verdict: Runtime Error):
N, M= map(int, input().split())
a_list = sorted(map(int, input().split()), reverse = True)

# インデックスを分かりやすくするために先頭に0を追加
match_num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [- 10 ** 5] * (N + 1)
dp[0] = 0

# 桁数を調べる
for i in range(1, N+1):
    dp[i] = max([dp[i - match_num[a]] + 1 for a in a_list])

# 各桁に使う数字を調べる
ans = [""] * dp[N]
rest_match = N
for i in range(dp[N]):
    for a in a_list:
        if dp[rest_match - match_num[a]] == dp[N] - i - 1:
            rest_match -= match_num[a]
            ans[i] = str(a)
            break
print("".join(ans))
Problem p03148 (python)

Fixed submission:
from collections import defaultdict

N, K = map(int, input().split())
sushi = [list(map(int, input().split())) for _ in range(N)]

sushi = sorted(sushi, key = lambda x: x[1], reverse = True)
types = set()
max_vals = [0]
other_vals = [0]

for typ, val in sushi:
    if typ not in types:
        max_vals.append(max_vals[-1] + val)
        types.add(typ)
    else:
        other_vals.append(other_vals[-1] + val)

max_score = 0
for k in range(1, K + 1):
    if K - k < len(other_vals) and k < len(max_vals):
        score = max_vals[k] + other_vals[K - k] + k ** 2
        max_score = max(max_score, score)

print(max_score)

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

N, K = map(int, input().split())
sushi = [list(map(int, input().split())) for _ in range(N)]

sushi = sorted(sushi, key = lambda x: x[1], reverse = True)
types = set()
max_vals = [0]
other_vals = [0]

for typ, val in sushi:
    if typ not in types:
        max_vals.append(max_vals[-1] + val)
        types.add(typ)
    else:
        other_vals.append(other_vals[-1] + val)

max_score = 0
for k in range(1, K + 1):
    if K - k < len(other_vals):
        score = max_vals[k] + other_vals[K - k] + k ** 2
        max_score = max(max_score, score)

print(max_score)
Problem p03150 (python)

Fixed submission:
S = input()

keyence = "keyence"

isKey = False
for i in range(len(S) + 1):
    for j in range(i, len(S) + 1):
        rest_str = S[:i] + S[j:]
        if rest_str == keyence:
            isKey = True
            break
    if isKey:
        break

if isKey:
    print("YES")
else:
    print("NO")

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

keyence = list("keyence")

for char in S:
    if char == keyence[0]:
        del keyence[0]

if len(keyence) == 0:
    print("YES")
else:
    print("NO")
Problem p02898 (python)

Fixed submission:
N, K = map(int, input().split())
input_list = list(map(int,input().split()))
cnt = 0
for i in input_list:
    if i >= K:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
input_list = list(map(int,input().split()))
cnt = 0
for i in input_list:
    if i >= K:
        cnt += 1
print(cnt
Problem p02900 (python)

Fixed submission:
from math import sqrt
a, b = (int(i) for i in input().split())

GCD = lambda x, y: (GCD(y, x % y) if x % y else y)
ab_gcd = GCD(a, b)

def factoring(gcb,n=2):
    for i in range(n,int(gcb**0.5)+1):
        if gcb%i==0:
            ret = factoring(gcb//i,i)
            ret[i] = ret.get(i,0)+1
            return ret
    return {gcb:1}

result = set(factoring(ab_gcd).keys())
result.add(1)
print(len(result))

Buggy submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split())

common_divisor_set = []
result_set = []

GCD = lambda a, b: (GCD(b, a % b) if a % b else b)

for i in range(min(a, b), 0, -1):
    if a%i == 0 and b%i == 0:
        common_divisor_set.insert(0, i)

left = [0 for x in range(n)]
right = [0 for x in range(n)]
ans = -1

n = len(common_divisor_set)
for i in range(n):
    if (i == 0):
        gcd = a[0]
    else:
        gcd = GCD(a[i], left[i - 1])
    left[i] = gcd

for i in range(n-2, -1, -1):   
    if (i == n - 1):
        gcd = a[n - 1]
    else:
        gcd = GCD(a[i], right[i + 1])
    right[i] = gcd

for i in range(n):
    if (i == 0):
        gcd = right[1]
    elif (i == n - 1):
        gcd = left[n - 2]
    else:
        gcd = GCD(left[i - 1], right[i + 1])
    if (gcd>ans):
        ans = gcd

print(ans)
Problem p03568 (python)

Fixed submission:
N = int(input())
a = map(int, input().split())
tmp = 3 ** N
g = len([c for c in a if c % 2 == 0])
print(tmp - (2 ** g))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = map(int, input().split())
tmp = 3 ** N
g = len([c for c in a if a % 2 == 0])
print(tmp - (2 ** g))
Problem p03569 (python)

Fixed submission:
S = input()
N = len(S)
st = 0
la = N - 1
result = 0

while(st < la):
  if S[st] == 'x' and S[la] == 'x':
    st += 1
    la -= 1
    continue
  if S[st] != 'x' and S[la] == 'x':
    la -= 1
    result += 1
  elif S[st] == 'x' and S[la] != 'x':
    st += 1
    result += 1
  elif S[st] == S[la]:
    st += 1
    la -= 1
  else:
    result = -1
    break

print(result)

Buggy submission (verdict: Runtime Error):
S = input()
st = 0
la = len(S) - 1
result = 0

while(st > la):
  if S[st]== 'x' and S[la]== 'x':
    st += 1
    la += 1
    continue
  if S[st] != 'x' and S[la]== 'x':
    result += 1
    la += 1
  elif S[st] == 'x' and S[la] != 'x':
    result += 1
    st += 1
  else
    result = -1
    break

 print(result)
Problem p03587 (python)

Fixed submission:
print(input().count('1'))

Buggy submission (verdict: Runtime Error):
print(input().conut('1'))
Problem p02928 (python)

Fixed submission:
def resolve():
    N,K=map(int,input().split())
    a=list(map(int,input().split()))

    A=0
    B=0
    mina=min(a)
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(i,len(a)):
            if a[j]<a[i]:
                A+=1
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(len(a)):
            if a[j]<a[i]:
                B+=1
    ans=int(((2*A+(K-1)*B)*K//2)%(10**9+7))
    print('{}'.format(ans))

resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N,K=map(int,input().split())
    a=list(map(int,input().split()))

    A=[0]*2000
    B=[0]*2000
    mina=min(a)
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(i+1,N):
            if a[j]<a[i]:
                A[a[i]]+=1
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(N):
            if a[j]<a[i]:
                B[a[i]]+=1
    sumA=sum(A)
    sumB=sum(B)
    ans=int((0.5*(2*sumA+(K-1)*sumB)*K)%(10**9+7))
    print('{}'.format(ans))

resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N,K=map(int,input().split())
    a=list(map(int,input().split()))

    A=[0]*2000
    B=[0]*2000
    mina=min(a)
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(i+1,N):
            if a[j]<a[i]:
                A[a[i]]+=1
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(N):
            if a[j]<a[i]:
                B[a[i]]+=1
    sumA=sum(A)
    sumB=sum(B)
    ans=(0.5*(2*sumA+(K-1)*sumB)*K)%(10**9+7)
    print('{}'.format(ans))

resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N,K=map(int,input().split())
    a=list(map(int,input().split()))

    A=[0]*20
    B=[0]*20
    mina=min(a)
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(i+1,N):
            if a[j]<a[i]:
                A[a[i]]+=1
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(N):
            if a[j]<a[i]:
                B[a[i]]+=1
    sumA=sum(A)
    sumB=sum(B)
    ans=(0.5*(2*sumA+(K-1)*sumB)*K)%(10**9+7)
    print(ans)

resolve()
Problem p02983 (python)

Fixed submission:
L, R = map(int,input().split())
a = 10**10
for i in range(L,min(R,L+2019)+1):
    for j in range(i+1,min(R,L+2019)+1):
        a = min(a,(i*j)%2019)
print(a)

Buggy submission (verdict: Runtime Error):
L, R = map(int,input().split())
a = 10**10
for i in range(L,min(R,L+2019):
    for j in range(i+1,min(R,L+2019)+1):
        a = min(a,(i*j)%2019)
        if a == 1:
            print("1")
            exit()
print(a)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
a,b,c,d = map(int,input().split())
e = (c * d) // gcd(c, d)
x = b//c - (a-1)//c
y = b//d - (a-1)//d
z = b//e- (a-1)//e
print(b-a+1-(x+y-z))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
e = (c * d) // math.gcd(c, d)
x = b//c - (a-1)//c
y = b//d - (a-1)//d
z = b//e- (a-1)//e
print(b-a+1-(x+y-z))
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
l = list(map(int,input().split()))
ans = 1
L=0
for i in range(n):
    L += l[i]
    if L <= x:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
L=0
for i in range(n):
    L += l[i]
    if L > x:
        print(i+1)
        return()
Problem p03001 (python)

Fixed submission:
w,h,x,y = map(float, input().split())
print('{:.6f} {}'.format(float(w)*float(h)/2, int(x+x==w and y+y==h)))

Buggy submission (verdict: Runtime Error):
    w,h,x,y = map(float, input().split())
    if (abs(w//2-x)>abs(h//2-y)):
        print("{:.6f} {}".format(min(y*w,(h-y)*w),0))
    elif (abs(w//2-x)<abs(h//2-y)):
        print("{:.6f} {}".format(min(x*h,(w-x)*h),0))
    else:
        print("{:.6f} {}".format(min(x*h,(w-x)*h),1))
Problem p03035 (python)

Fixed submission:
a,b = map(int,input().split())
if a>=13:
    print(b)
elif a>=6:
    print(b//2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a>13:
  print(b)
  elif a>6:
    print(b//2)
    else:
      print(0)
Problem p03071 (python)

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

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

Fixed submission:
import math
def resolve():
    a = list(int(input()) for _ in range(5))
    mint = 1000
    ans = 0
    for i in range(5):
        ans += math.ceil(a[i]/10)*10
        if a[i]%10 == 0: continue
        mint = min(mint,a[i]%10)
    if mint == 1000:
        print(ans)
    else:
        print(ans+mint-10)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a = list(int(input()) for _ in range(5))
    mint = 1000
    ans = 0
    for i in range(5):
        ans += math.ceil(a[i]/10)*10
        if a[i]%10 == 0: continue
        mint = min(mint,a[i]%10)
    print(ans+mint-10)

resolve()
Problem p03262 (python)

Fixed submission:
def gcd(a, b):
    while a > 0:
        if a < b:
            a, b = b, a
        a = a % b
    return b
def resolve():
    N,x=map(int,input().split())
    X=list(map(int,input().split()))
    X.append(x)
    X=list(set(X))
    X.sort()
    D=[]
    for i in range(len(X)-1):
        D.append(X[i+1]-X[i])
    ans=D[0]
    for d in D:
        if d%ans!=0:
            ans=gcd(ans,d)
    print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
import math
import functools
def resolve():
    N,x=map(int,input().split())
    X=list(map(int,input().split()))
    X.append(x)
    X=list(set(X))
    X.sort()
    D=[]
    for i in range(len(X)-1):
        D.append(X[i+1]-X[i])
    gcd = functools.reduce(math.gcd, D)
    print(gcd)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N,x=map(int,input().split())
    X=list(map(int,input().split()))
    X.append(x)
    X=list(set(X))
    X.sort()
    D=[]
    for i in range(len(X)-1):
        D.append(X[i+1]-X[i])
    import math
    import functools
    gcd = functools.reduce(math.gcd, D)
    print(gcd)
resolve()
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,iput().split())
print((a-1)*(b-1))
Problem p03284 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
print(0 if a%b==0 else 1)
Problem p03408 (python)

Fixed submission:
s = list(input() for _ in range(int(input())))
t = list(input() for _ in range(int(input())))
print(max(0,max(s.count(S)-t.count(S) for S in set(s))))

Buggy submission (verdict: Runtime Error):
    s = list(input() for _ in range(int(input())))
    t = list(input() for _ in range(int(input())))
    print(max(0,max(s.count(S)-t.count(S) for S in set(s))))
Problem p03433 (python)

Fixed submission:
print('Yes') if int(input())%500 <= int(input()) else print('No')

Buggy submission (verdict: Runtime Error):
print('Yes') if int(input())//500 <= int(input()) else: print('No')
Problem p03447 (python)

Fixed submission:
x = int(input())
a = int(input())
b = int(input())

x -= a
while x >= b:
    x -= b
print(x)

Buggy submission (verdict: Runtime Error):
a,b,c,x = map(int,[input() for _ in range(4)])
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if (500*i + 100*j + 50*k == x):
                ans += 1
print(ans)
Problem p03470 (python)

Fixed submission:
N = int(input())
D = [int(input()) for _ in range(N)]
print(len(set(D)))

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
for i in range(N):
    for j in range(N-i):
        if 10000*i + 5000*j + 1000*(N-i-j) == Y:
            print('{} {} {}'.format(i,j,N-i-j))
            exit()
print("-1 -1 -1")
Problem p03826 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
e,f = a*b,c*d
if e<f: print(f)
else: print(e)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
e,f = a*b,c*d
if e<f: print(f)
  else: print(e)