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

Fixed submission:
import collections
n = int(input())
arr = list(map(int,input().split()))
cnt = collections.defaultdict(int)
for val in arr:
    cnt[val] += 1
sums = sum(arr)
q = int(input())
for _ in range(q):
    b, c = map(int,input().split())
    diff = (c-b)*(cnt[b])
    sums += diff
    print(sums)
    cnt[c] += cnt[b]
    cnt[b] = 0

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
arr = list(map(int,input().split()))
cnt = collections.defaultdict(int)
for val in arr:
    cnt[val] += 1
sums = sum(arr)
q = int(input())
for _ in range(q):
    b, c = map(int,input().split())
    diff = (c-b)*(cnt[b])
    sums += diff
    print(sums)
    cnt[c] += nt[b]
    cnt[b] = 0
Problem p02641 (python)

Fixed submission:
X, N = map(int,input().split())
if N == 0:
    print(X)
    exit()
LP = list(map(int, input().split()))


for i in range(100):
    ans = X - i
    if ans not in LP:
        print(ans)
        exit()
    else:
        dans = X + i
        if dans not in LP:
            print(dans)
            exit()

Buggy submission (verdict: Runtime Error):
X, N = map(int,input().split())
LP = []
for i in range(N):
    LP.append(list(map(int, input().split())))

if N == 0:
    print(X)

else:
    for i in range(100):
        ans = X - i
        if ans not in LP:
            print(ans)
            break
        else:
            dans = X + i
            if dans not in LP:
                print(dans)
                break

Buggy submission (verdict: Runtime Error):
X, N = map(int,input().split())
LP = [list(map(int, input().split())) for i in range(N)]

if N == 0:
    print(X)

else:
    for i in range(100):
        ans = X - i
        if ans not in LP:
            print(ans)
            break
        else:
            dans = X + i
            if dans not in LP:
                print(dans)
                break

Buggy submission (verdict: Runtime Error):
X, N = map(int,input().split())
LP = [list(map(int, input().split())) for i in range(N)]

if N == 0:
    print(X)

else:
    for i in range(1,100):
        ans = X - i
        if ans not in LP:
            print(ans)
            break
        else:
            dans = X + i
            if dans not in LP:
                print(dans)
                break
Problem p02658 (python)

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

now=1
if 0 in A:
    print(0)
    exit()
for a in A:
    now = now * a
    if now>10**18:
        print(-1)
        exit()
print(now)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

N = int(input())
x = [int(input()) for i in range(N)]
y = reduce(mul, x)

if y > 10**18:
    print(-1)
else:
    print(y)
Problem p02675 (python)

Fixed submission:
N = input()
n = N[-1]
if n == "2" or n == "4" or n == "5" or n == "7" or n == "9":
    print("hon")
elif n == "0" or n == "1" or n == "6" or n == "8":
    print("pon")
else:
    print("bon")

Buggy submission (verdict: Runtime Error):
N = int(input())
n = N[-1]
if n == "2" or n == "4" or n == "5" or n == "7" or n == "9":
    print("hon")
elif n == "0" or n == "1" or n == "6" or n == "8":
    print("pon")
else:
    print("bon")

Buggy submission (verdict: Runtime Error):
N = int(input())
n = N[-1]
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print("hon")
elif n == 0 or n == 1 or n == 6 or n == 8:
    print("pon")
else:
    print("bon")

Buggy submission (verdict: Runtime Error):
N = int(input())
if N[-1] == 2 or N[-1] == 4 or N[-1] == 5 or N[-1] == 7 or N[-1] == 9:
    print("hon")
elif N[-1] == 0 or N[-1] == 1 or N[-1] == 6 or N[-1] == 8:
    print("pon")
else:
    print("bon")

Buggy submission (verdict: Runtime Error):
N = int(input())
if N[-1] == 2 or 4 or 5 or 7 or 9:
    print("hon")
elif N[-1] == 0 or 1 or 6 or 8:
    print("pon")
else:
    print("bon")
Problem p02705 (python)

Fixed submission:
R = int(input())
C = 2*R*3.14
print(C)

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

L = N - sum(HW)
if L < 0:
    print(-1)
else:
    print(L)
Problem p02706 (python)

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

L = N - sum(HW)
if L < 0:
    print(-1)
else:
    print(L)

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

for i in range(M):
    N = N - i
    if N < 0:
        print(-1)
        break
print(N)
Problem p02718 (python)

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

total = 0
for i in A:
    if i >= (sum(A) / (4 * M)):
        total = total + 1

if total >= M:
    print("Yes")
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
list = [int(i) for i input().split()]

total = 0
for i in range(N):
    if i >= (sum(list) / (4 * M)):
        total = total + 1

if total >= M:
    print("Yes")
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
list = [int(i) for i input().split()]

total = 0
for i in range(N):
    if i >= (sum(list) / (4 * M)):
        total = total + 1

if total >= M:
    print("Yes")
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
list = [int(i) for i input().split()]

total = 0
for i in range(N):
    if i >= sum(list) / (4 * M):
        total = total + 1

if total >= M:
    print("Yes")
else:
    print('No')
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
s, t = map(input())
print(t+s)

Buggy submission (verdict: Runtime Error):
s, t = input()
print(t+s)
Problem p02843 (python)

Fixed submission:
x=int(input())
y=x//100
z=x%100
if z<=y*5:
    print(1)
else:
    print(0)

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

def buy(cost):
    if cost == N:
        print(1)
        exit()
    if cost < N:
        for i in range(100, 106):
            buy(cost+i)
buy(0)

if buy(0) is None:
    print(0)
Problem p02924 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    print((1+N)*(N//2)-N)
else:
    print((1+N-1)*(N//2))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
tmp = np.array(range(1, N, 1))
print(sum(tmp))
Problem p02999 (python)

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

if X < A:
    print(0)
else:
    print(10)

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

if X < A:
    print(0)
else:
    pritnt(10)
Problem p03371 (python)

Fixed submission:
a, b, c, x, y = map(int, input().split())
print(min(a*x+b*y, c*2*x+b*max(0,y-x), c*2*y+a*max(0,x-y)))

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

def piz(a, b, cost):
    if a >= X and b >= Y:
        print(cost)
    
    if a < X and b >= Y:
        piz(a+1, b, cost+A)
    if a >= X and b < Y:
        piz(a, b+1, cost+B)
    if a < X and b < Y and A + B < C * 2:
        piz(a+1, b+1, cost+A+B)
    if a < X and b < Y and A + B >= C * 2:
        piz(a+1, b+1, cost+C*2)

piz(0, 0, 0)
Problem p03493 (python)

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

Buggy submission (verdict: Runtime Error):
print(input(),count("1"))
Problem p03695 (python)

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

cnt = [0] * 9
for i in a:
    x = min(i // 400, 8)
    if x >= 8:
        cnt[8] += 1
    else:
        cnt[x] = 1

if sum(cnt[:8]) == 0:
    l = 1
    r = cnt[8]
else:
    l = sum(cnt[:8])
    r = l+cnt[8]
print(l, r)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
rate = {"a":0, "b":0, "c":0, "d":0, "e":0, "f":0, "g":0, "h":0}
ratez = {"z":0}
for i in range(N):
    if A[i] >=1 and A[i] <= 399:
        rate["a"] += 1
    if A[i] >=400 and A[i] <= 799:
        rate["b"] += 1
    if A[i] >=800 and A[i] <= 1199:
        rate["c"] += 1
    if A[i] >=1200 and A[i] <= 1599:
        rate["d"] += 1
    if A[i] >=1600 and A[i] <= 1999:
        rate["e"] += 1
    if A[i] >=2000 and A[i] <= 2399:
        rate["f"] += 1
    if A[i] >=2400 and A[i] <= 2799:
        rate["g"] += 1
    if A[i] >=2800 and A[i] <= 3199:
        rate["h"] += 1
    if A[i] >=3200:
        ratez["z"] += 1
keys = [k for k, v in rate.items() if v != 0]

if ratez["z"] == 0:
    print(len(keys), len(keys))
elif len(keys) == 8:
    print(8, 8)
elif ratez["z"] <= len(keys) and len(keys) != 8:
    print(len(keys), len(keys)+ratez["z"])
elif ratez["z"] > len(keys) and len(keys) != 8 and ratez["z"] + len(keys) <= 8:
    print(rate["z"], len(keys)+ratez["z"])
elif ratez["z"] > len(keys) and len(keys) != 8 and ratez["z"] + len(keys) > 8 and ratez["z"] <= 8:
    print(rate["z"], 8)
elif ratez["z"] > len(keys) and len(keys) != 8 and ratez["z"] + len(keys) > 8 and ratez["z"] > 8:
    print(8, 8)
Problem p02647 (python)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = [0] * (N+1)

for j in range(K):
    ans = [0] * (N+1)
    for i in range(N):
        L = max(0, i-A[i])
        R = min(N, i+A[i]+1)
        ans[L] += 1
        ans[R] -= 1
    for i in range(1, N+1):
        ans[i] += ans[i-1]
    issame = True
    for i in range(N):
        if i != 0:
            if ans[i-1] != N or ans[i-1] != ans[i]:
                issame = False
        A[i] = ans[i]
    if issame:
        break

for i in range(N):
    print(ans[i], end=' ')

Buggy submission (verdict: Runtime Error):
from numba import njit

@njit(parallel=True)
def solve(A):
    ans = [0] * (N + 1)
    for j in range(K):
        ans = [0] * (N + 1)
        for i in range(N):
            L = max(0, i - A[i])
            R = min(N, i + A[i] + 1)
            ans[L] += 1
            ans[R] -= 1
        for i in range(1, N + 1):
            ans[i] += ans[i - 1]
        issame = True
        for i in range(N):
            if i != 0:
                if ans[i - 1] != N or ans[i - 1] != ans[i]:
                    issame = False
            A[i] = ans[i]
        if issame:
            break
    for i in range(N):
        print(ans[i], end=' ')

N, K = map(int, input().split())
A = list(map(int, input().split()))

solve(A)
Problem p03128 (python)

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

def nax(a, b):
    if a == '-':
        return b
    if len(a) != len(b):
        return a if len(a)>len(b) else b
    return a if a>b else b


match = [2,5,5,4,5,6,3,7,6]
# dp[i]  : iほんのマッチを使ってできる数値の最大値
dp = ['-'] * 11000
dp[0] = ''

for i in range(N+1):
    if dp[i] == '-':
        continue
    for a in A:
        dp[i+match[a-1]] = nax(dp[i+match[a-1]], dp[i] + chr(ord('0') + a))

print(dp[N])

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

def nax(a, b):
    if a == '-':
        return b
    if len(a) != len(b):
        return a if len(a)>len(b) else b
    return a if a>b else b


match = [2,5,5,4,5,6,3,7,6]
# dp[i]  : iほんのマッチを使ってできる数値の最大値
dp = ['-'] * 10001
dp[0] = ''

for i in range(N+1):
    if dp[i] == '-':
        continue
    for a in A:
        dp[i+match[a-1]] = nax(dp[i+match[a-1]], dp[i] + chr(ord('0') + a))

print(dp[N])
Problem p03227 (python)

Fixed submission:
s = input()
print(s if len(s)==2 else s[::-1])

Buggy submission (verdict: Runtime Error):
s = input()
print(s if len(s)==2 else s[::-1]
Problem p03239 (python)

Fixed submission:
N, T = map(int, input().split())
ans = 1000000
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
print("TLE" if ans == 1000000 else ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
ans = 1000000
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
    ans = min(ans, c)
print(ans if ans < T else "TLE")
Problem p03408 (python)

Fixed submission:
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

print(max([s.count(S) - t.count(S) for S in s] + [0]))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

print(max(s.count(S) - t.count(S) for S in s) + [0])
Problem p03427 (python)

Fixed submission:
N = int(input())
n = len(str(N))
NS = str(N)
ans0 = 0
for i in NS:
    ans0 += int(i)
ans1 = int(NS[0])-1 + 9 * (n-1)
ans2 = 9 * (n-1)

print(max(ans0, ans1, ans2))

Buggy submission (verdict: Runtime Error):
N = int(input())
n = len(str(N))
NS = str(N)
ans0 = 0
for i in range(NS):
    ans0 += int(i)
ans1 = int(NS[0])-1 + 9 * (n-1)
ans2 = 9 * (n-1)

print(max(ans0, ans1, ans2))
Problem p03486 (python)

Fixed submission:
S = input()
T = input()
S = sorted(S)
T = sorted(T, reverse=True)

print('Yes' if S<T else 'No')

Buggy submission (verdict: Runtime Error):
S = sorted(input())
T = sorted(input(), reversed=True)
print('Yes' if S<T else 'No')
Problem p03587 (python)

Fixed submission:
s=input()
ans = 0
for c in s:
  if c=="1":
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans = 0
for c in s:
  if c=="1"
    ans+=1
print(ans)
Problem p03607 (python)

Fixed submission:
n = int(input())
l = [0] * 100010

mp = {}
for i in range(n):
    a = int(input())
    if a in mp:
        del mp[a]
    else:
        mp[a] = 1
print(len(mp))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [0] * 100010
for i in range(n):
    a = int(input())
    if l[a] == 0:
        l[a] = 1
    else:
        l[a] = 0
print(sum(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [0] * 100000
for i in range(n):
    a = int(input())
    if l[a] == 0:
        l[a] = 1
    else:
        l[a] = 0
print(sum(l))
Problem p03625 (python)

Fixed submission:
from collections import Counter

n = int(input())
A = list(map(int, input().split()))

c = Counter(A)
pair = []
# print(c)
for x, cnt in c.items():
    pair += [x] * (cnt//2)

# print(pair)
pair.sort()

ans = 0
if len(pair) >= 2:
    ans = pair[-1] * pair[-2]
print(ans)

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

n = int(input())
A = list(map(int, input().split()))

c = Counter(A)
pair = []
print(c)
for x, cnt in c.items():
    pair += [x] * (cnt//2)

# print(pair)
pair.sort()

ans = 0
if len(pair) >= 2:
    ans = pair[-1] * pair[-2]
print ans
Problem p03633 (python)

Fixed submission:
from fractions import gcd

def nlcm(t):
    res = 1
    for a in t:
        res *= a // gcd(a,res)
    return res

n = int(input())
T = [int(input()) for i in range(n)]

print(nlcm(T))

Buggy submission (verdict: Runtime Error):
import math

def nlcm(t):
    res = 1
    for a in t:
        res *= a // math.gcd(a,res)
    return res

n = int(input())
T = [int(input()) for i in range(n)]

print(nlcm(T))
Problem p03719 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print('Yes' ifa<=c<=b else 'No')
Problem p03818 (python)

Fixed submission:
import collections as col

N = int(input())
A = list(map(int, input().split()))

m = col.Counter(A)
ans = len(m) if len(m)%2==1 else len(m)-1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections as col

N = int(input())
A = list(map(int, input().split()))

m = col.Counter(A)
ans = len(m) if m%2==1 else len(m)-1
print(ans)
Problem p02910 (python)

Fixed submission:
S = input()

flag = 'Yes'
for i in range(len(S)):
    if i%2 == 0:
        if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
            pass
        else:
            flag = 'No'
            break
    if i%2 == 1:
        if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
            pass
        else:
            flag = 'No'
            break

print(flag)

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

flag = 'Yes'
for i in range(len(S)):
    if i%2 == 0:
        if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
            pass
        else:
            flag = 'No'
            break
    if i%2 == 1:
        if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
            pass
        else:
            flag = 'No'
            brake

print(flag)

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

flag = 'Yes'
for i in range(len(S)):
    if i%2 == 0:
        if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
            pass
        else:
            flag = 'No'
            break
    if i%2 == 1:
        if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
            pass
        else:
            flag = 'No'
            brake

print(flag)
Problem p02972 (python)

Fixed submission:
N = int(input())
a = [0] + list(map(int, input().split()))
b = [0] * (N + 1)
c = []
for i in range(N, 0, -1):
    sum_i = 0
    for j in range(i+i, N+1, i):
        sum_i += b[j]
    b[i] = (a[i] + sum_i)%2
print(sum(b))
for k in range(N+1):
    if b[k] == 1:
        c.append(k)
if c != []:
    print(' '.join(map(str, c)))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = [0] + list(map(int, input().split()))
b = [0] * (N + 1)
for i in range(N, N//2, -1):
    b[i] = a[i]
for i in range(N//2, 0, -1):
    sum = 0
    for j in range(i+i, N, i):
        sum += b[j]
    b[i] = (a[i] + sum)%2
b = np.array(b)
if len(np.where(b==1)) != 0:
    print(len(np.where(b==1)[0]))
    ans = ' '.join(map(str, np.where(b == 1)[0]))
    print(ans)
else:
    print(0)
Problem p03240 (python)

Fixed submission:
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]

for i in range(N):
    if xyh[i][2] != 0:
        x = xyh[i][0]
        y = xyh[i][1]
        h = xyh[i][2]

for i in range(101):  # x座標
    for j in range(101):  # y座標
        tmp_h = abs(x-i)+abs(y-j)+h
        cnt = 0
        for k in range(N):
            if xyh[k][2] == max(0,tmp_h-abs(xyh[k][0]-i)-abs(xyh[k][1]-j)):
                cnt += 1
        if cnt == N:
            ans_x = i
            ans_y = j
            ans_h = tmp_h
            break
print(ans_x, ans_y, ans_h)

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

for i in range(101):  # x座標
    for j in range(101):  # y座標
        tmp_h = abs(xyh[0][0]-i)+abs(xyh[0][1]-j)+xyh[0][2]
        cnt = 0
        for k in range(N):
            if xyh[k][2] == max(0,tmp_h-abs(xyh[k][0]-i)-abs(xyh[k][1]-j)):
                cnt += 1
        if cnt == N:
            ans_x = i
            ans_y = j
            ans_h = tmp_h
            break
print(ans_x, ans_y, ans_h)

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

for i in range(101):  # x座標
    for j in range(101):  # y座標
        tmp_h = abs(xyh[0][0]-i)+abs(xyh[0][1]-j)+xyh[0][2]
        cnt = 0
        for k in range(N):
            if tmp_h == abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]:
                cnt += 1
        if cnt == N:
            ans_x = i
            ans_y = j
            ans_h = tmp_h
            break
print(ans_x, ans_y, ans_h)
Problem p03459 (python)

Fixed submission:
N = int(input())
t0, x0, y0 = map(int, input().split())
flag = True
if (x0+y0)%2 != t0%2 or x0+y0 > t0:
    flag = False
for _ in range(N-1):
    t1, x1, y1 = map(int, input().split())
    if (x1+y1-x0-y0)%2 != (t1-t0)%2 or (x1+y1-x0-y0) > t1-t0:
        flag = False
    t0, x0, y0 = t1, x1, y1
if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
t0, x0, y0 = map(int, input().split())
flag = True
if (x0+y0)%2 != t0%2 or x0+y0 > t0:
    flag = False
else:
    for _ in range(N-1):
        t1, x1, y1 = map(int, input().split())
        if (x1+y1-x0-y0)%2 != (t1-t0)%2 or (x1+y1-x0-y0) > t1-t0:
            flag = False
            brake
        else:
            t0, x0, y0 = t1, x1, y1
if flag:
    print('Yes')
else:
    print('No')
Problem p03633 (python)

Fixed submission:
N = int(input())
if N == 1:
    T = [int(input())]
else:
    T = [int(input()) for _ in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


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

ans = T[0]
for i in range(N):
    ans = lcm(ans, T[i])
print(ans)

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

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


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

ans = T[1]
for i in range(N):
    ans = lcm(ans, T[i])
print(ans)
Problem p03966 (python)

Fixed submission:
N = int(input())
T, A = map(int, input().split())
for i in range(N-1):
    t, a = map(int, input().split())
    n = max(-(-T//t), -(-A//a))
    T, A = n * t, n * a
print(T+A)

Buggy submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
for i in range(N-1):
    t, a = map(int, input().split())
    n = max(-(-T//t), -(-A//a))
    T, A = n * t, n, * a
print(T+A)
Problem p04045 (python)

Fixed submission:
N, K = map(int, input().split())
d = list(map(int, input().split()))
a = []
for i in range(10):
    if d.count(i) == 0:
        a.append(i)
ans = []
def dfs(s):
    if int(s) >= N or len(s) > 6:
        return s
    for i in a:
        S = dfs(s + str(i))
        if int(S) >= N:
            ans.append(int(S))
    return s
    
dfs('0')
print(min(ans))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
d = list(map(int, input().split()))
a = []
for i in range(10):
    if d.count(i) == 0:
        a.append(i)
ans = []
def dfs(s):
    if int(s) >= N or len(s) > len(str(N)):
        return s
    for i in a:
        S = dfs(s + str(i))
        if int(S) >= N:
            ans.append(int(S))
    return s
    
dfs('0')
print(min(ans))
Problem p02548 (python)

Fixed submission:
n = int(input())
ans=0
for i in range(1,n):
    ans+=int((n-1)/i)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans=0
for i in range(1,n):
    ans+=int(cnt-1)
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy

Buggy submission (verdict: Runtime Error):
import sympy
n = int(input())
ans=0
for i in range(1,n):
    ans+=len(sympy.divisors(n-i))
print(ans)
Problem p02612 (python)

Fixed submission:
n = int(input())
if n%1000==0:
    print(0)
else:
    print((n//1000+1)*1000-n)

Buggy submission (verdict: Runtime Error):
n = int(input())
print((n//1000+1)*1000-n))
Problem p02641 (python)

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

for i in range(0,102):
    if (i in p):
        continue
    else:
        tmp=(x-i)**2
        if tmp<ans:
            ans=tmp
            c=i
print(c)

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

for i in range(1,101):
    if (i in p):
        continue
    else:
        tmp=(x-i)**2
        if tmp<ans:
            ans=tmp
            c=i
print(c)
Problem p02658 (python)

Fixed submission:
n= int(input())
a=list(map(int,input().split()))
a.sort()
ans=1
for i in a:
    ans=ans*i
    if ans>(10**18):
        print(-1)
        break
    elif ans==0:
        print(ans)
        break
if ans<=(10**18)and ans!=0:
    print(ans)

Buggy submission (verdict: Runtime Error):
n= int(input())
a=list(map(int,input().split()))
a=np.array(a)
ans=1
for i in range(n):
    ans=ans*a[i]
if ans<=(10**18):
    print(ans)
else:
    print(-1)
Problem p02687 (python)

Fixed submission:
s=input()
if s=="ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
s=input()
if s==ABC:
  print("ARC")
else:
  print("ABC")
Problem p02732 (python)

Fixed submission:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
s = np.zeros(n+1)
for i in a:
    s[i]+=1
al = sum((s*(s-1))/2)
for i in range(n):
    ans=al-(s[a[i]]-1)
    print(int(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
s = n*[0]
for i in a:
    s[i]+=1
for i in range(0,n):
    s[a[i]]-=1
    ans=max(s)*(max(s)-1)/2
    s[a[i]]+=1
    print(int(ans))