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

Fixed submission:
"""
a = 'a'*2000
b = 'b'*2000
c = 'c'*2000
"""
a = input()
b = input()
c = input()


len_a = len(a)
len_b = len(b)
len_c = len(c)

def match(a, b):
    return a=='?' or b=='?' or a==b

dp_len=50000
ab = [True] * dp_len
ac = [True] * dp_len
bc = [True] * dp_len

def check(a, b, ab):
    for i in range(len(a)):
        for j in range(len(b)):
            if not match(a[i], b[j]):
                ab[i-j+dp_len//2] = False

check(a, b, ab)
check(a, c, ac)
check(b, c, bc)

len_max = 2000

ans = len_a+len_b+len_c
for i in range(-2*len_max, 2*len_max+1):
    for j in range(-2*len_max, 2*len_max+1):
        if ab[i+dp_len//2] and ac[j+dp_len//2] and bc[j-i+dp_len//2]:
            ans = min(ans, max(len_a, len_b+i, len_c+j) - min(0, i, j))
print(ans)

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

len_a = len(a)
len_b = len(b)
len_c = len(c)

def match(a, b):
    return a=='?' or b=='?' or a==b


ab = [True] * 20000
ac = [True] * 20000
bc = [True] * 20000

def check(a, b, ab):
    for i in range(len(a)):
        for j in range(len(b)):
            if not match(a[i], b[j]):
                ab[i-j+10000] = False

check(a, b, ab)
check(a, c, ac)
check(b, c, bc)

len_max = len(a)+len(b)+len(c)

ans = len_max
for i in range(-2*len_max, 2*len_max+1):
    for j in range(-2*len_max, 2*len_max+1):
        if ab[i+10000] and ac[j+10000] and bc[j-i+10000]:
            ans = min(ans, max(len_a, len_b+i, len_c+j) - min(0, i, j))
print(ans)

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

len_a = len(a)
len_b = len(b)
len_c = len(c)

def match(a, b):
    return a=='?' or b=='?' or a==b


ab = [True] * 9000
ac = [True] * 9000
bc = [True] * 9000

def check(a, b, ab):
    for i in range(len(a)):
        for j in range(len(b)):
            if not match(a[i], b[j]):
                ab[i-j+4500] = False

check(a, b, ab)
check(a, c, ac)
check(b, c, bc)

len_max = len(a)+len(b)+len(c)

ans = len_max
for i in range(-2*len_max, 2*len_max+1):
    for j in range(-2*len_max, 2*len_max+1):
        if ab[i+4500] and ac[j+4500] and bc[j-i+4500]:
            ans = min(ans, max(len_a, len_b+i, len_c+j) - min(0, i, j))
print(ans)
Problem p02789 (python)

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

if N==M:
  print('Yes')
else:
  print('No')

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

if N==M:
  print('Yes')
else:
  print('No')
Problem p02791 (python)

Fixed submission:
import bisect
N = int(input())
P = list(map(int, input().split()))

count = 0
last_min = P[0]
for i in range(N):
    last_min = min(last_min, P[i])
    if i == 0:
        count += 1
    elif last_min == P[i]:
        count += 1
print(count)

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

count = 0
last_min = P[i]
for i in range(N):
    last_min = min(last_min, P[i])
    if i == 0:
        count += 1
    elif last_min == P[i]:
        count += 1
print(count)
Problem p02801 (python)

Fixed submission:
c = input()
a  = ord(c)
print(chr(a+1))

Buggy submission (verdict: Runtime Error):
s = input()
print(chr(ord(s)+1)))
Problem p02936 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n, q = map(int, input().split())
node = [0] * n
to = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    to[b-1].append(a-1)
    to[a-1].append(b-1)
for _ in range(q):
    p, x = map(int, input().split())
    node[p-1]+=x

def dfs(i, source, count=0):
    node[i]+=count
    for next_node in to[i]:
        if next_node == source: continue 
        dfs(next_node, i, node[i])
dfs(0, -1, 0)

print(' '.join(list(map(str, node))))

Buggy submission (verdict: Runtime Error):
    import sys
    sys.setrecursionlimit(10**6)
    n, q = map(int, input().split())
    node = [0] * n
    par = [-1] * n
    for _ in range(n-1):
        a, b = map(int, input().split())
        par[b-1] = a-1
    for _ in range(q):
        p, x = map(int, input().split())
        node[p-1]+=x
    def dfs(i, count=0):
        count+=node[i]
        if par[i] == -1:
            return count
        else:
            return dfs(par[i], count)
    print(' '.join([str(dfs(i)) for i in range(n)]))

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n-1)]
px = [list(map(int, input().split())) for _ in range(q)]

node = [0] * n
par = [-1] * n
for a, b in ab:
    par[b-1] = a-1
for p, x in px:
    node[p-1]+=x
def dfs(i, count=0):
    count+=node[i]
    if par[i] == -1:
        return count
    else:
        return dfs(par[i], count)
print(' '.join([str(dfs(i)) for i in range(n)]))
Problem p02995 (python)

Fixed submission:
from fractions import gcd
a, b, c, d = map(int, input().split())
"""
ans: B以下の整数から条件を満たす個数　 - A-1以下の整数から条件を満たす個数
X以下の整数から条件： X - X//c -X//d + X//lcm(c,d)
"""
def count(X, t):
    return X//t
cd = c * d // gcd(c, d)
b_under = b - count(b, c) - count(b, d) + count(b, cd)
a_under = a-1 - count(a-1, c) - count(a-1, d) + count(a-1, cd)

print( b_under - a_under )

Buggy submission (verdict: Runtime Error):
from math import gcd
a, b, c, d = map(int, input().split())
"""
ans: (B-A) - {Cの倍数の個数＋Dの倍数の個数 - CDの倍数の個数}
"""
def count(t):
    amari = a % t
    return (b - a - amari ) // t
print( b-a - (count(c) + count(d) - count(c*d)))
Problem p03000 (python)

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

cum = [0] * (n+1)
for i in range(1, n+1):
    cum[i] = cum[i-1] + l[i-1]

f = True
for i in range(n+1):
    if cum[i] > x:
        f = False
        print(i)
        break
if f:
    print(n+1)

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

xnow = 0
ans = 0
while xnow <= x:
    ans+=1
    xnow += l[ans-1]
print(ans)
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
n = int(input())
uvw = [list(map(int, input().split())) for _ in range(n-1)]

edges = [[] for _ in range(n)]
for u, v, w in uvw:
    u-=1
    v-=1
    edges[u].append([v, w%2])
    edges[v].append([u, w%2])

res = [[] for _ in range(n)]
def dfs(v, p, c):
    res[v] = c
    for e in edges[v]:
        if e[0] == p: continue
        if e[1]%2==1: dfs(e[0], v, 1-c%2)
        else: dfs(e[0], v, c)

dfs(0, -1, 1)
print('\n'.join(list(map(str, res))))

Buggy submission (verdict: Runtime Error):
n = int(input())
uvw = [list(map(int, input().split())) for _ in range(n-1)]

edges = [[] for _ in range(n)]
for u, v, w in uvw:
    u-=1
    v-=1
    edges[u].append([v, w%2])
    edges[v].append([u, w%2])

res = [[] for _ in range(n)]
def dfs(v, p, c):
    res[v] = c
    for e in edges[v]:
        if e[0] == p: continue
        if e[1]%2==1: dfs(e[0], v, 1-c%2)
        else: dfs(e[0], v, c)

dfs(0, -1, 1)
print('\n'.join(list(map(str, res))))
Problem p03061 (python)

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

mx = 0
gd_pos = [] # 0からiまでのgcd
gd_pos.append(a[0])
for i in range(1, n):
    gd_pos.append(fractions.gcd(gd_pos[i-1], a[i]))
gd_neg = [] # 末尾からiまでのgcd
gd_neg.append(a[-1])
a_rev = a[::-1]
for i in range(1, n):
    gd_neg.append(fractions.gcd(gd_neg[i-1], a_rev[i]))

def popped_g(i):
    if i == 0: return gd_neg[n-2]
    elif i == n-1: return gd_pos[n-2]
    else:
        return fractions.gcd(gd_pos[i-1], gd_neg[n-i-2])

ans = [popped_g(i) for i in range(n)]
print(max(ans))

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

mx = 0
for i in range(n):
    popped = a.pop(i)
    g = a[0]
    for aa in a[1:]:
        g = math.gcd(g, aa)
    a.insert(i, popped)
    mx = max(mx, g)
print(mx)
Problem p03148 (python)

Fixed submission:
import heapq
from collections import Counter
inf = 10**10
n, k = map(int, input().split())

dset = [[] for i in range(n)]
for i in range(n):
    t, d = map(int, input().split())
    dset[t-1].append(d)

for dd in dset:
    if dd: dd.sort(reverse=True)
    else: dd.append(-inf)

dset.sort(key= lambda x: -x[0])

cur = 0
hq = []
# k種類の先頭を除いて格納
for i in range(k):
    cur+=dset[i][0]
    for d in dset[i][1:]: heapq.heappush(hq, -d)

# 残りの種類のすべてを格納
for dd in dset[k:]:
    for d in dd:
        heapq.heappush(hq, -d)

ans = cur + k*k
for i in range(k-1, -1, -1):
    v = dset[i][0] # 削除候補
    if hq:
        w = -heapq.heappop(hq)
    else:
        break
    if v < w:
        cur += w - v
        # heapq.heappush(hq, -v)
    else:
        heapq.heappush(hq, -w)
    ans = max(ans, cur + i*i)
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
from collections import Counter
n, k = map(int, input().split())

dset = [[] for i in range(n)]
for i in range(n):
    t, d = map(int, input().split())
    dset[t-1].append(d)

for dd in dset:
    if dd: dd.sort(reverse=True)
    else: dd.append(-float('inf'))

dset.sort(key= lambda x: -x[0])

cur = 0
hq = []
# k種類の先頭を除いて格納
for i in range(k):
    cur+=dset[i][0]
    for d in dset[i][1:]: heapq.heappush(hq, -d)

# 残りの種類のすべてを格納
for dd in dset[k:]:
    for d in dd:
        heapq.heappush(hq, -d)

ans = cur + k*k
for i in range(k-1, -1, -1):
    v = dset[i][0] # 削除候補
    w = -heapq.heappop(hq)
    if v < w:
        cur += w - v
    else:
        heapq.heappush(hq, -w)
    ans = max(ans, cur + i*i)
print(ans)
Problem p03164 (python)

Fixed submission:
import numpy as np
N, W = map(int, input().split())
dp = np.full(N*10**3+1, W+1)
dp[0] = 0

for i in range(N):
    w, v = map(int, input().split())
    dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(np.where(dp<=W)[0][-1])

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
Wl, Vl = [], []
for i in range(N):
    w, v = map(int, input().split())
    Wl.append(w); Vl.append(v)

dp = [[10**9+1]*(10**7) for _ in range(N+2)]
dp[0][0] = 0

ans = 0
for i in range(N):
    w, v = Wl[i], Vl[i]
    for j in range(10**5+100):
        if j+v < 10**7+1:
            dp[i+1][j+v] = min(dp[i+1][j+v],
                                dp[i][j]+w)
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if dp[i+1][j+v] <= W: ans=max(ans, j+v)
        if dp[i+1][j] <= W: ans=max(ans, j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
Wl, Vl = [], []
for i in range(N):
    w, v = map(int, input().split())
    Wl.append(w); Vl.append(v)

dp = [[10**9+1]*(10**7) for _ in range(N+2)]
dp[0][0] = 0

ans = 0
for i in range(N):
    w, v = Wl[i], Vl[i]
    for j in range(10**5):
        if j+v < 10**9+1:
            dp[i+1][j+v] = min(dp[i+1][j+v],
                                dp[i][j]+w)
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if dp[i+1][j+v] <= W: ans=max(ans, j+v)
        if dp[i+1][j] <= W: ans=max(ans, j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
Wl, Vl = [], []
for i in range(N):
    w, v = map(int, input().split())
    Wl.append(w); Vl.append(v)

dp = [[10**9+1]*(10**5+100) for _ in range(N+2)]
dp[0][0] = 0

ans = 0
for i in range(N):
    w, v = Wl[i], Vl[i]
    for j in range(10**5):
        if j+v < 10**9+1:
            dp[i+1][j+v] = min(dp[i+1][j+v],
                                dp[i][j]+w)
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if dp[i+1][j+v] <= W: ans=max(ans, j+v)
        if dp[i+1][j] <= W: ans=max(ans, j)
print(ans)
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
dp = [-1]*(n+1)
path = [[] for i in range(n)]
X = []; Y = []
for i in range(m):
    x, y = map(int, input().split())
    X.append(x-1); Y.append(y-1)
    path[x-1].append(y-1)

def dfs(i):
    if dp[i]>0: return dp[i]
    res = 0
    for k in path[i]:
        res = max(res, dfs(k)+1)
    dp[i] = res
    return res

ans = 0
for i in range(n):
    ans = max(ans, dfs(i))
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
dp = [-1]*(n+1)
path = [[] for i in range(n)]
X = []; Y = []
for i in range(m):
    x, y = map(int, input().split())
    X.append(x-1); Y.append(y-1)
    path[x-1].append(y-1)

def dfs(i):
    if dp[i]>0: return dp[i]
    res = 0
    if path[i]:
        for k in path[i]:
            res = max(res, dfs(k)+1)
    dp[i] = res
    return res

ans = 0
for i in range(n):
    ans = max(ans, dfs(i))
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
dp = [-1]*n
path = [[] for i in range(n)]
X = []; Y = []
for i in range(m):
    x, y = map(int, input().split())
    X.append(x-1); Y.append(y-1)
    path[x-1].append(y-1)

def dfs(i):
    if dp[i]>0: return dp[i]
    res = 0
    for k in path[i]:
        res = max(res, dfs(k)+1)
    dp[i] = res
    return res

ans = 0
for i in range(n):
    ans = max(ans, dfs(i))
print(ans)
Problem p03231 (python)

Fixed submission:
from math  import gcd
n, m = map(int, input().split())
s = input()
t = input()

g = gcd(n, m)
ans = n*m//g

"""
最小公倍数の長さで収まらない場合は、何をやってもダメ
"""
for i in range(g):
    if not s[i*n//g] == t[i*m//g]:
        print(-1)
        exit(0)
print(ans)

Buggy submission (verdict: Runtime Error):
from math  import gcd
n, m = map(int, input().split())
s = input()
t = input()

ans = n*m//gcd(n, m)

if n==1:
    if t == s*m:
        print(m)
    else:
        print(-1)
    exit(0)
elif m == 1:
    if s == t**n:
        print(n)
    else:
        print(-1)
    exit(0)

"""
最小公倍数の長さで収まらない場合は、何をやってもダメ
"""
dp = [0] * ans
for i in range(n):
    dp[i*ans//n] = s[i]

for i in range(m):
    if dp[i*ans//m] == 0: 
        dp[i*ans//m] = t[i]
    else:
        if dp[i*ans//m] != t[i]:
            print(-1)
            exit(0)
print(ans)

Buggy submission (verdict: Runtime Error):
from math  import gcd
n, m = map(int, input().split())
s = input()
t = input()

ans = n*m//gcd(n, m)

"""
最小公倍数の長さで収まらない場合は、何をやってもダメ
"""
dp = [0] * ans
for i in range(n):
    dp[i*ans//n] = s[i]

for i in range(m):
    if dp[i*ans//m] == 0: 
        dp[i*ans//m] = t[i]
    else:
        if dp[i*ans//m] != t[i]:
            print(-1)
            exit(0)
print(ans)
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, input().split())
pritn((a-1)*(b-1))
Problem p03282 (python)

Fixed submission:
s = list(map(int, list(input())))
k = int(input())

f = True
for i in range(k):
    if s[i] == 1:
        continue
    else:
        print(s[i])
        f = False
        break
if f:
    print(1)

Buggy submission (verdict: Runtime Error):
s = list(map(int, list(input())))
k = int(input())

for i in range(len(s)):
    if s[i] == 1:
        continue
    else:
        print(s[i])
        f = False
        break
if f:
    print(1)

Buggy submission (verdict: Runtime Error):
s = list(map(int, list(input())))
k = int(input())

for i in range(k):
    if s[i] == 1:
        continue
    else:
        print(s[i])
        f = False
        break
if f:
    print(1)
Problem p03337 (python)

Fixed submission:
a,b = map(int, input().split())
ans = [a+b, a-b, a*b]
print(max(ans))

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

ans = [a+b, a-b, a*b]
print(max[ans])
Problem p03480 (python)

Fixed submission:
s = list(map(int, list(input())))
ans = len(s)
for i in range(len(s)-1):
    if s[i]!=s[i+1]:
        ans = min(ans, max(i+1, len(s)-i-1))
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(map(int, list(input())))
ans = n
for i in range(len(s)-1):
    if s[i]!=s[i+1]:
        ans = min(ans, max(i+1, len(s)-i-1))
print(ans)
Problem p03543 (python)

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

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = list(input())
c = Counter(n)
if max(list(c.values))>=3:
  print('Yes')
else:
  print('No')
Problem p03587 (python)

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

Buggy submission (verdict: Runtime Error):
print(list(input()).count('1'))	]
Problem p03658 (python)

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

l.sort(reverse=True)
print(sum(l[:k]))

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

l.sort(reversed=True)
print(sum(l[:k]))
Problem p03854 (python)

Fixed submission:
import sys 
sys.setrecursionlimit(10**6)
s = input()
def dfs(s):
    while True:
        f = True
        for i in ['erase', 'eraser', 'dream', 'dreamer']:
            if s[-len(i):]==i:
                s = s[:-len(i)]
                if s=='':
                    return True
                f = False
        if f: return False
    
if dfs(s):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
s = input()
def dfs(t):
    if t==s:
        return True
    if len(t)>=len(s):
        return False
    for i in ['dream', 'dreamer', 'erase', 'eraser']:
        if dfs(t+i):
            return True
    return False
if dfs(''):
    print('YES')
else:
    print('NO')
Problem p02548 (python)

Fixed submission:
n = int(input()) - 1
lst = [n // k for k in range(1, int(n**0.5+1))]
print(2 * sum(lst) - int(n**0.5)**2)

Buggy submission (verdict: Runtime Error):
from sympy import divisor_count
n = int(input)
count = 0
for c in range(1, n):
    count += divisor_count(c)
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
for c in range(1, n):
    count += divisor_count(c)
print(count)
Problem p02556 (python)

Fixed submission:
def manhattan(n, x, y):
    x2 = [0] * n
    y2 = [0] * n
    for i in range(n):
        x2[i] = x[i] - y[i]
        y2[i] = x[i] + y[i]
    print(max(max(x2) - min(x2), max(y2) - min(y2)))

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i] , y[i] = map(int, input().split())
manhattan(n, x, y)

Buggy submission (verdict: Runtime Error):
def manhattan(n, x, y):
    x2 = [0] * n
    y2 = [0] * n
    for i in range(n):
        x0, y0 = xy[i]
        x2[i] = x0 - y0
        y2[i] = x0 + y0
    print(max(max(x2) - min(x2), max(y2) - min(y2)))

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i] , y[i] = map(int, input().split())
manhattan(n, x, y)
Problem p02576 (python)

Fixed submission:
# ABC176A

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

print(-(-n // x) * t)

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

print(-(-n // x) * t)
Problem p02588 (python)

Fixed submission:
def conv(s):
    if s.find('.') == -1:
        s += '.'
    s = s.rstrip('0')
    t = len(s) - s.find('.') - 1
    a = int(s.replace('.', ''))
    if a == 0:
        return (0, 0)
    x, y = -t, -t
    while a % 5 == 0:
        x += 1
        a //= 5
    while a % 2 == 0:
        y += 1
        a //= 2
    return (x, y)


N, *A = open(0).read().split()
N = int(N)

d = {}
for a in A:
    t = conv(a)
    d.setdefault(t, 0)
    d[t] += 1

result = 0
xs = list(d.keys())
for i in range(len(xs)):
    x, y = xs[i]
    t = d[xs[i]]
    if x >= 0 and y >= 0:
        result += t * (t - 1) // 2
    for j in range(i + 1, len(xs)):
        m, n = xs[j]
        if x + m >= 0 and y + n >= 0:
            result += t * d[xs[j]]
print(result)

Buggy submission (verdict: Runtime Error):
def prog(x):
    n = len(x)
    y = [int(i * 10**9) for i in x]
    #y

    def count25(s): # count25(0)
        if s.find('.') == -1:
            s += '.'
        s = s.rstrip('0')
        decimal_point = s.find('.')
        int_part = s[:decimal_point]
        float_part = s[decimal_point+1:]
        float_part += '0' * (9 - len(float_part))
        n = int(int_part + float_part)
        if n == 0:
            return (0, 0)
        two = five = 0
        while n % 2 == 0:
            two += 1
            n //= 2
        while n % 5 == 0:
            five += 1
            n //= 5
        return (two, five)

    two = [0] * n
    five = [0] * n
    for i in range(n):
        two[i], five[i] = count25(y[i])
    count = 0
    for i in range(n - 1):
        two_i = 18 - two[i]
        five_i = 18 - five[i]
        for j in range(i + 1, n):
            #if min(two[i] + two[j], five[i] + five[j]) >= 18:
            if two[j] >= two_i and five[j] >= five_i:
                #print(min(two1,two2) + min(five1, five2), two1, two2, five1, five2)
                #print(y[i] * y[j], (y[i] * y[j]) / 10**18)
                #print(y[i] / 10**9, y[j] / 10**9)
                #print('=================')
                count += 1
    print(count)

n = int(input())
x = [0] * n
x = [input() for i in range(n)]
prog(x)

Buggy submission (verdict: Runtime Error):
def prog(x):
    n = len(x)
    y = [int(i * 10**9) for i in x]
    #y

    def count25(n):
        two = five = 0
        while n % 2 == 0:
            two += 1
            n //= 2
        while n % 5 == 0:
            five += 1
            n //= 5
        return two, five

    two = [0] * n
    five = [0] * n
    for i in range(n):
        two[i], five[i] = count25(y[i])
    count = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            #if min(two[i] + two[j], five[i] + five[j]) >= 18:
            if two[i] + two[j] >= 18 and five[i] + five[j] >= 18:
                #print(min(two1,two2) + min(five1, five2), two1, two2, five1, five2)
                #print(y[i] * y[j], (y[i] * y[j]) / 10**18)
                #print(y[i] / 10**9, y[j] / 10**9)
                #print('=================')
                count += 1
    print(count)

n = int(input())
x = list(map(int, input().split()))
prog(x)
Problem p02630 (python)

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

mx = 10**5
table = [0] * (mx + 1)
for i in a:
    table[i] += 1

q = int(input())
total = sum(a)
for i in range(q):
    b, c, = map(int, input().split())
    total -= table[c] * c + table[b] * b
    table[c] += table[b]
    table[b] = 0
    total += table[c] * c
    print(total)

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

mx = max(a)
table = [0] * (mx + 1)
for i in a:
    table[i] += 1

q = int(input())
total = sum(a)
for i in range(q):
    b, c, = map(int, input().split())
    total -= table[c] * c + table[b] * b
    table[c] += table[b]
    table[b] = 0
    total += table[c] * c
    print(total)
Problem p02639 (python)

Fixed submission:
# ABC169A

x = list(map(int, input().split()))
print(x.index(0)+1)

Buggy submission (verdict: Runtime Error):
# ABC169A

x = map(int, input().split())
print(x.index(0)+1)
Problem p02641 (python)

Fixed submission:
# ABC170C

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

if n == 0:
    p = set([])
else:
    p = list(map(int, input().split()))
a = list(set(range(201)) - set(p))
abs_diff = [abs(i - x) for i in a]
min_abs_diff = min(abs_diff)
for i, j in zip(a, abs_diff):
    if j == min_abs_diff:
        print(i)
        break

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

if n == 0:
    p = set([])
else:
    p = list(map(int, input().split()))
p = list(map(int, str.split()))
a = list(set(range(201)) - set(p))
abs_diff = [abs(i - x) for i in a]
min_abs_diff = min(abs_diff)
for i, j in zip(a, abs_diff):
    if j == min_abs_diff:
        print(i)
        break

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

if n == 0:
    print(100)
else:
    p = list(map(int, input().split()))
    a = list(set(range(1, 101)) - set(p))
    abs_diff = [abs(i - x) for i in a]
    min_abs_diff = min(abs_diff)
    for i, j in zip(a, abs_diff):
        if j == min_abs_diff:
            print(i)
            break

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    print(x)
else:
    p = list(map(int, input().split()))
    a = set(range(1, 200))
    b = list(a - set(p))
    c = [abs(i - x) for i in b]
    import numpy as np
    pos = np.argmin(c)
    print(min([b[y] for y in c if y == pos]))