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

Fixed submission:
a,b,c = input().split()
if str(b) == '+':
  print(int(a)+int(c))
else:
  print(int(a)-int(c))

Buggy submission (verdict: Runtime Error):
a,b,c = input().split())
if b = '+':
  print(int(a)+int(b))
else:
  print(int(a)-int(b))
Problem p03860 (python)

Fixed submission:
s = input()
b = s[8]
print('A'+b+'C')

Buggy submission (verdict: Runtime Error):
s = input()
a = s.rstrip()split()
b = a[1]
print('A'+b+'C')
Problem p03937 (python)

Fixed submission:
h,w = map(int,input().split())
a = [list(input()) for nesya in range(h)]
c = 0
for i in range(h):
  for j in range(w):
    if a[i][j] == '#':
      c += 1

if c == h+w-1:
  print('Possible')
else:
  print('Impossible')

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
a = [list(input()) for nesya in range(h)]
b = [['.']*w for motsu in range(h)]
b[0][0] = '#'
j = 0
for i in range(h):
  if j < w:
    while a[i][j+1] == '#':
      j += 1
      b[i][j] = '#'
      if j == w-1:
        break
  if i+1 < h:
    b[i+1][j] = '#'

if a == b:
  print('Possible')
else:
  print('Impossible')

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
a = [list(input()) for nesya in range(h)]
b = [['.']*w for motsu in range(h)]
b[0][0] = '#'
j = 0
for i in range(h):
  while a[i][j+1] == '#':
    j += 1
    b[i][j] = '#'
  b[i+1][j] = '#'
if a == b:
  print('Possible')
else:
  print('Impossible')
Problem p03970 (python)

Fixed submission:
s = input()
a = 'CODEFESTIVAL2016'
b = 0
for i in range(16):
  if a[i] != s[i]:
    b += 1
print(b)

Buggy submission (verdict: Runtime Error):
s = input()
a = 'CODEFESTIVAL2016'
b = 0
for i in range(16):
  if a[i] != b[i]:
    b += 1
print(b)
Problem p03993 (python)

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

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

Fixed submission:
from sys import stdin

def mpow(n, p, mod):
    if mod == 0:
        return 0
    r = 1
    while p > 0:
        if p & 1 == 1:
            r = r * n % mod
        n = n * n % mod
        p >>= 1
    return r
def popcount(u):
    if u == 0:
        return 0
    a = u % bin(u).count('1')
    return 1 + popcount(a)
def main():
    input = stdin.readline
    n = int(input())
    x = '0b' + input()
    xs = int(x, 0)
    xc = x.count('1')
    xsp = mpow(xs, 1, xc + 1)
    xsm = mpow(xs, 1, xc - 1)
    for i in range(2, n + 2):
        if x[i] == '0':
            y = xsp + mpow(2, n - i + 1, xc + 1)
            y = mpow(y, 1, xc + 1)
            print(popcount(y) + 1)
        elif xc == 1:
            print(0)
        else:
            y = xsm - mpow(2, n - i + 1, xc - 1)
            y = mpow(y, 1, xc - 1)
            print(popcount(y) + 1)
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def mpow(n, p, mod):
    if mod == 0:
        return 0
    r = 1
    while p > 0:
        if p & 1 == 1:
            r = r * n % mod
        n = n * n % mod
        p >>= 1
    return r
def popcount(u):
    if u == 0:
        return 0
    a = u % bin(u).count('1')
    return 1 + popcount(a)
def main():
    input = stdin.readline
    n = int(input())
    x = '0b' + input()
    xs = int(x, 0)
    xc = x.count('1')
    xsp = mpow(xs, 1, xc + 1)
    xsm = mpow(xs, 1, xc - 1)
    for i in range(2, n + 2):
        if x[i] == '0':
            y = xsp + mpow(2, n - i + 1, xc + 1)
            y = mpow(y, 1, xc + 1)
        elif xc == 1:
            print(0)
            next
        else:
            y = xsm - mpow(2, n - i + 1, xc - 1)
            y = mpow(y, 1, xc - 1)
        print(popcount(y) + 1)            
main()
Problem p03848 (python)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
h = Counter()
for x in a:
    h[x] += 1
f = True
for k, v in h.items():
    if n % 2 == 1 and k == 0:
        if v != 1:
            f = False
            break
    elif v != 2:
        f = False
        break
MOD = 1000000007
def mpow(n, p, mod):
    r = 1
    while p > 0:
        if p & 1 == 1:
            r = r * n % mod
        n = n * n % mod
        p >>= 1
    return r
print(mpow(2, int(n / 2), MOD) if f else 0)

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

n = int(input())
a = list(map(int, input().split()))
h = Counter()
for x in a:
    h[x] += 1
f = True
for k, v in h..most_common():
    if n % 2 == 1 and k == 0:
        if v != 1:
            f = False
            break
    elif v != 2:
        f = False
        break
MOD = 1000000007
def mpow(n, p, mod):
    r = 1
    while p > 0:
        if p & 1 == 1:
            r = r * n % mod
        n = n * n % mod
        p >>= 1
    return r
print(mpow(2, int(n / 2), MOD) if f else 0)

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

n = int(input())
a = list(map(int, input().split()))
h = Counter()
for x in a:
    h[x] += 1
f = True
for k, v in h.items():
    if n % 2 == 1 and k == 0:
        if v != 1:
            f = False
            break
    elif v != 2:
        f = False
        break
MOD = 1_000_000_007
def mpow(n, p, mod):
    r = 1
    while p > 0:
        if p & 1 == 1:
            r = r * n % mod
        n = n * n % mod
        p >>= 1
    return r
print(mpow(2, int(n / 2), MOD) if f else 0)

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

n = int(input())
a = list(map(int, input().split()))
h = Counter()
for x in a:
    h[x] += 1
f = True
for k, v in h.most_common():
    if n % 2 == 1 and k == 0:
        if v != 1:
            f = False
            break
    elif v != 2:
        f = False
        break
MOD = 1_000_000_007
def mpow(n, p, mod):
    r = 1
    while p > 0:
        if p & 1 == 1:
            r = r * n % mod
        n = n * n % mod
        p >>= 1
    return r
print(mpow(2, int(n / 2), MOD) if f else 0)

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

n = int(input())
a = map(int, input().split())
h = Counter()
for x in a:
    h[x] += 1
f = True
for k, v in h.most_common():
    if n % 2 == 1 and k == 0:
        if v != 1:
            f = False
            break
    elif v != 2:
        f = False
        break
MOD = 1_000_000_007
def mpow(n, p, mod):
    r = 1
    while p > 0:
        if p & 1 == 1:
            r = r * n % mod
        n = n * n % mod
        p >>= 1
    return r
print(mpow(2, int(n / 2), MOD) if f else 0)
Problem p03958 (python)

Fixed submission:
from sys import stdin

def main():
    input = stdin.readline
    k, _ = map(int, input().split())
    a = max(map(int, input().split()))
    print(max(0, 2 * a - k - 1))
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    import heapq
    input = stdin.readline
    input()
    a = [-1 * int(i) for i in input().split()]
    heapq.heapify(a)
    while len(a) > 1:
        u = heapq.heappop(a)
        v = heapq.heappop(a)
        if u + 1 < 0:
            heapq.heappush(a, u + 1)
        if v + 1 < 0:
            heapq.heappush(a, v + 1)
    print(abs(a[0] + 1))
main()
Problem p02718 (python)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
A.sort(reverse=True)
 
total = 0
for a in A:
    total += a

word = "Yes"
for m in range(M):
    if (A[m] * 4 * M < total):
        word = "No"
 
print(word)

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

A.sort(reverse=True)

total = 0
for a in A:
    total += a

for m in range(M):
    if (A[m] * 4 * M < total):
        print("No")
        exit(1)

print("Yes")
Problem p02719 (python)

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

N = N % K

if (N == 0):
    print(N)
elif (N == K):
    print(0)
elif (K == 1):
    print(0)
else:
    while (N >= 0):
        if (N > abs(N - K)):
            N = abs(N - K)
        else:
            print(N)
            break

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

N = N % K

if (N > abs(N - K)):
    N = abs(N - K)
else:
    print(N)
    break
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
s = []
c = []
for m in range(M):
    si, ci = map(int, input().split())
    s.append(si)
    c.append(ci)

ss = 10 ** (N - 1)
if N == 1:
    ss -= 1

for i in range(ss, 10 ** N):
    for m in range(M):
        if str(i)[s[m] - 1] != str(c[m]):
            break
    else:
        print(i)
        exit()

print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = []
c = []
for m in range(M):
    si, ci = map(int, input().split())
    s.append(si)
    c.append(ci)

s = 10 ** (N - 1)
if N == 1:
    s -= 1

for i in range(s, 10 ** N):
    for m in range(M):
        if str(i)[s[m] - 1] != str(c[m]):
            break
    else:
        print(i)
        exit()

print(-1)
Problem p02843 (python)

Fixed submission:
X = int(input())

x = X % 100
tmp = (x // 5) * 105
if x % 5 != 0:
    tmp += 100 + (x % 5)
if tmp > X:
    print(0)
else:
    print(1)

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

dp = [0] * (100000)
dp[0] = 1

for i in range(X + 1):
    if dp[i] == 1:
        for j in range(6):
            dp[i + 100 + j] = 1
            if i + 100 + j == X:
                print(1)
                exit()
print(0)
Problem p02900 (python)

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

    if temp != 1:
        s.add(temp)

    if len(s) == 0:
        s.add(n)

    return s


A, B = map(int, input().split())
mini = min(A, B)
maxi = max(A, B)

ss = factorization(mini)

res = 1
for i in ss:
    if maxi % i == 0:
        res += 1

if mini == 1:
    res = 1

print(res)

Buggy submission (verdict: Runtime Error):
def factorization(n):
    s = set()
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            s.add(i)

    if temp != 1:
        s.add(temp)

    if s == {}:
        s.add(n)

    return s


A, B = map(int, input().split())
mini = min(A, B)
maxi = max(A, B)

s = factorization(mini)

res = 0
for i in s:
    if maxi % i == 0:
        res += 1

print(res + 1)
def factorization(n):
    s = set()
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            s.add(i)

    if temp != 1:
        s.add(temp)

    if s == {}:
        s.add(n)

    return s


A, B = map(int, input().split())
mini = min(A, B)
maxi = max(A, B)

s = factorization(mini)

res = 0
for i in s:
    if maxi % i == 0:
        res += 1

print(res + 1)
Problem p02995 (python)

Fixed submission:
import fractions

A, B, C, D = map(int, input().split())

cntC = B // C - A // C + int(A % C == 0)
cntD = B // D - A // D + int(A % D == 0)

lcm = C * D // fractions.gcd(C, D)
cntCD = B // lcm - A // lcm + int(A % lcm == 0)

print((B - A + 1) - (cntC + cntD - cntCD))

Buggy submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())

cntC = B // C - A // C + int(A % C == 0)
cntD = B // D - A // D + int(A % D == 0)

lcm = C * D // math.gcd(C, D)
cntCD = B // lcm - A // lcm + int(A % lcm == 0)

print((B - A + 1) - (cntC + cntD - cntCD))
Problem p03109 (python)

Fixed submission:
s = list(input().split('/'))
s = [int(ss) for ss in s]

if s[0] < 2019:
  print("Heisei")
elif s[0] == 2019:
  if s[1] < 4 or (s[1] == 4 and s[2] <= 30):
    print("Heisei")
  else:
    print("TBD")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
s = list(input().split('/'))

if s[0] < 2019:
  print("Heisei")
elif s[0] == 2019:
  if s[1] < 4:
    print("Heisei)
  elif (s[1] == 4 and s[2] <= 30) or s[1] > 4:
    print("TBD")
else:
  print("TBD")
Problem p03229 (python)

Fixed submission:
N = int(input())
a = [int(input()) for _ in range(N)]
a.sort()

if N % 2 == 0:
    res = 2 * (sum(a[N // 2:]) - sum(a[:N // 2]))
    res += a[N // 2 - 1] - a[N // 2]
    print(res)
else:
    res = 2 * (sum(a[N // 2 + 1:]) - sum(a[:N // 2]))
    print(res - min(a[N // 2 + 1] - a[N // 2], a[N // 2] - a[N // 2 - 1]))

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

if N % 2 == 0:
    res = 2 * (sum(a[N // 2:]) - sum(a[:N // 2]))
    res += a[N // 2 - 1] - a[N // 2]
    print(res)
else:
    res = 2 * (sum(a[N // 2 + 1:]) - sum(a[N // 2]))
    print(res - min(a[N // 2 + 1] - a[N // 2] - a[N // 2 - 1]))
Problem p03231 (python)

Fixed submission:
import fractions

N, M = map(int, input().split())
S = input()
T = input()

if N == M:
    print(N if S == T else -1)
else:
    G = fractions.gcd(N, M)
    L = N * M // G
    n = N // G
    m = M // G
    ans = True
    for k in range(G):
        if S[k * n] != T[k * m]:
            ans = False
            break
    print(L if ans else -1)

Buggy submission (verdict: Runtime Error):
import math

N, M = map(int, input().split())
S = input()
T = input()

if N == M:
    print(N if S == T else -1)
else:
    G = math.gcd(N, M)
    L = N * M // G
    n = N // G
    m = M // G
    ans = True
    for k in range(G):
        if S[k * n] != T[k * m]:
            ans = False
            break
    print(L if ans else -1)
Problem p03263 (python)

Fixed submission:
import sys, heapq, bisect, math, fractions
from collections import deque
from collections import Counter
from collections import OrderedDict

H, W = map(int, input().split())
A = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(H)]

res = []
for i in range(H):
    for j in range(W):
        if j == W - 1 and i != H - 1 and A[i][j] % 2 != 0:
            A[i][j] -= 1
            A[i + 1][j] += 1
            res.append([i + 1, j + 1, i + 2, j + 1])
        elif j < W - 1 and A[i][j] % 2 != 0:
            A[i][j] -= 1
            A[i][j + 1] += 1
            res.append([i + 1, j + 1, i + 1, j + 2])

print(len(res))
for i in range(len(res)):
    print(*res[i])

Buggy submission (verdict: Runtime Error):
import sys

H, W = map(int, input().split())
A = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(H)]

res = []
for i in range(H):
    for j in range(W):
        if A[i][j] % 2 != 0 and i < W - 1:
            A[i][j] -= 1
            A[i][j + 1] += 1
            res.append([i + 1, j + 1, i + 2, j + 1])
        elif A[i][j] % 2 != 0 and i != H - 1 and j == W - 1:
            A[i][j] -= 1
            A[i + 1][j] += 1
            res.append([i + 1, j + 1, i + 1, j + 2])
print(len(res))
for i in range(len(res)):
    print(*res[i])
Problem p03284 (python)

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

print(int(N % K != 0))

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

res = "No"
for cake in range(0, int(n/4) + 1):
    for dornut in range(0, int(n/7) + 1):
        if 4 * cake + 7 * dornut == n:
            res = "Yes"
            break
    else:
        continue
    break

print(res)
Problem p03427 (python)

Fixed submission:
N = input()

f = int(N[0])
res = (len(N) - 1) * 9 + f - 1
s = 0
for i in N:
    s += int(i)

print(max(res, s))

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

n = N - int((len(str(N)) - 1) * '9')
tmp = (len(str(N)) - 1) * '9'
if len(str(n)) > (len(str(N)) - 1):
    tmp = str(n)[0] + tmp

res = 0
for t in tmp:
    res += int(t)

print(res)

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

n = N - int((len(str(N)) - 1) * '9')
tmp = (len(str(N)) - 1) * '9'
if len(tmp) > (len(str(N)) - 1):
    tmp = str(n)[0] + tmp

res = 0
for t in tmp:
    res += int(t)

print(res)
Problem p03435 (python)

Fixed submission:
data = [list(map(int, input().split())) for i in range(3)]

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            b1 = data[0][0] - a1
            b2 = data[0][1] - a1
            b3 = data[0][2] - a1

            if (
                b1 + a2 == data[1][0]
                and b2 + a2 == data[1][1]
                and b3 + a2 == data[1][2]
                and b1 + a3 == data[2][0]
                and b2 + a3 == data[2][1]
                and b3 + a3 == data[2][2]
            ):
                print("Yes")
                exit(0)

print("No")

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

for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            b1 = data[0][0] - a1
            b2 = data[0][1] - a1
            b3 = data[0][2] - a1

            if (
                b1 + a2 == data[1][0]
                and b2 + a2 == data[1][1]
                and b3 + a2 == data[1][2]
                and b1 + a3 == data[2][0]
                and b2 + a3 == data[2][1]
                and b3 + a3 == data[2][2]
            ):
                print("Yes")
                exit(1)

print("No")
Problem p03578 (python)

Fixed submission:
import sys
from collections import defaultdict

N = int(input())
D = list(map(int, sys.stdin.readline().rsplit()))
M = int(input())
T = list(map(int, sys.stdin.readline().rsplit()))
q = defaultdict(int)

for d in D:
    q[d] += 1

for t in T:
    if q[t] > 0:
        q[t] -= 1
    else:
        print("NO")
        exit()

print("YES")

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
D = list(map(int, sys.stdin.readline().rsplit()))
M = int(input())
T = list(map(int, sys.stdin.readline().rsplit()))

q = [0] * (10 ** 9 + 1)
for d in D:
    q[d] += 1

for t in T:
    if q[t] > 0:
        q[t] -= 1
    else:
        print("NO")
        exit()

print("YES")

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
D = list(map(int, sys.stdin.readline().rsplit()))
M = int(input())
T = list(map(int, sys.stdin.readline().rsplit()))

q = [0] * (max(D) + 1)
for d in D:
    q[d] += 1

for t in T:
    if q[t] > 0:
        q[t] -= 1
    else:
        print("NO")
        exit()

print("YES")
Problem p03733 (python)

Fixed submission:
N, T = map(int, input().split())
t = list(map(int, input().split()))

res = 0
for i in range(N - 1):
    res += min(T, t[i + 1] - t[i])

res += T

print(res)

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

res = 0
for i in range(N - 1):
    res += min(T, t[i + 1] - t[i])

if t[-2] + T <= t[-1]:
    res += T 

print(res)
Problem p03752 (python)

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

res = 10 ** 15

for bit in range(2 ** N):
    cnt = 0
    for i in range(N):
        if (bit >> i) & 1:
            cnt += 1

    if cnt < K:
        continue

    cost = 0
    height = 0
    for i in range(0, N):
        if (bit >> i) & 1 and height >= A[i]:
            cost += height - A[i] + 1
            height += 1
        elif height < A[i]:
            height = A[i]

    res = min(res, cost)

print(res)

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

res = 1000000000
for bit in range(2 ** N):
    b = [int(bin(bit)[i + 2]) for i in range(len(bin(bit)) - 2)]
    if b.count(1) >= K:
    	b.reverse()
        b_index = -1
        height = 0
        cnt = 0
        while True:
            sub = 0
            if 1 in b[b_index + 1:]:
                b_index = b[b_index + 1:].index(1) + b_index + 1
            else:
                break

            if A[b_index] - height <= 0:
                sub += height - A[b_index] + 1
                cnt += sub
                height = A[b_index] + sub
            else:
                height = A[b_index]

        res = min(res, cnt)

print(res)
Problem p03861 (python)

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

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

if x % a == 0:
    print((b - a + 1) // x + 1)
else:
    print((b - a + 1) // x)
Problem p03994 (python)

Fixed submission:
S = list(input())
K = int(input())

for i, s in enumerate(S):
    if s == "a":
        pass
    elif ord('z') - ord(s) + 1 <= K:
        S[i] = 'a'
        K -= ord('z') - ord(s) + 1

K %= 26
S[-1] = chr((ord(S[-1]) - ord('a') + K) % 26 + ord('a'))

print("".join(S))

Buggy submission (verdict: Runtime Error):
S = list(input())
K = int(input())

l = 0
for i, s in enumerate(S):
    if ord('z') - ord(s) + 1 <= K:
        S[i] = 'a'
        K -= ord('z') - ord(s) + 1
    else:
        l = i
else:
    if K > 0:
        S[l] = chr(ord(S[l]) + K)

print("".join(S))

Buggy submission (verdict: Runtime Error):
S = list(input())
K = int(input())

for i, s in enumerate(S):
    if ord('z') - ord(s) + 1 <= K:
        S[i] = 'a'
        K -= ord('z') - ord(s) + 1
else:
    if K > 0:
        S[-1] = chr(ord(S[-1]) + K)

print("".join(S))
Problem p02885 (python)

Fixed submission:
a = list(map(int, input().split()))
A = a[0]
B = a[1]
if A <= B * 2:
    print(0)
else:
    print(A - B * 2)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
B *= 2
if A < B:
    print('0')
else:
    print(A - B)
Problem p02630 (python)

Fixed submission:
n = int(input())
count = {}
s = 0
a = [int(c) for c in input().split()]
for val in a:
	s += val
	if (val not in count): count[val] = 1
	else: count[val] += 1

q = int(input())
for _ in range(q):
	b, c = [int(c) for c in input().split()]
	if (b in count):
		temp = count[b]
		count.pop(b)
		s = s + c*temp - b*temp 
		if (c not in count): count[c] = temp 
		else: count[c] += temp
	print(s)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

void printArray(vector<int> arr) {
	for (int a: arr) cout << a << " ";
	cout << '\n';
}

int a[100001];

int main() {
	std::ios_base::sync_with_stdio(false);
	int n, q;
	cin >> n;
	map<int, int> count;
	ll sum = 0;
	for (int i = 0; i<n; i++) {
		cin >> a[i];
		sum += a[i];
		if (count.find(a[i]) == count.end()) count[a[i]] = 1;
		else count[a[i]]++;
	} 
	cin >> q;
	for (int _=0; _<q; _++) {
		int b,c,temp;
		cin >> b >> c;
		if (count.find(b) != count.end()) {
			temp = count[b];
			count.erase(b);
			sum = sum - b*temp + c*temp;
			if (count.find(c) == count.end()) count[c] = temp;
			else count[c] += temp;
		}
		cout << sum << '\n';
	}
	
}
Problem p02548 (python)

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

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

Buggy submission (verdict: Runtime Error):
from sympy import divisors
n = int(input())

cnt = 0
for i in range(1, n):
    k = n-i
    cnt += len(divisors(k))
print(cnt)
Problem p02602 (python)

Fixed submission:
n, k = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
for i in range(k, n):
    score = 1
    if score < score*a[i]/a[i-k]:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
score = 1
for i in range(k-1, n-1):
    if int(score) < int(score*a[i+1]/a[i-k+1]):
        print('Yes')
    else:
        print('No')
    score = score*a[i+1]/a[i-k+1]