Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# C - Slimes

N = int(input())
S = str(input())

def f(s):
    n = len(s)
    for i in range(n - 1):
        if s[i] == s[i + 1]:
            s = f(s[:i] + s[i + 1:])
            break
    return s

print(len(f(S)))


Fixed submission:
# C - Slimes

N = int(input())
S = str(input())

ans = ''
for i in range(N - 1):
    if S[i] != S[i + 1]:
        ans += S[i]
else:
    ans += S[N - 1]

print(len(ans))
Buggy python submission (verdict: Runtime Error):
# D - Disjoint Set of Common Divisors

import math

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

primes = []
i = 2
while i * i <= C:
    while C % i == 0:
        C //= i
        primes.append(i)
    i += 1
if C > 1:
    primes.append(C)

print(len(set(primes)) + 1)


Fixed submission:
# D - Disjoint Set of Common Divisors

import fractions

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

primes = []
i = 2
while i * i <= C:
    while C % i == 0:
        C //= i
        primes.append(i)
    i += 1
if C > 1:
    primes.append(C)

print(len(set(primes)) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
# C - Attack Survival

N, K, Q = map(int, input().split())
P = [K] * N
for _ in range(Q):
    P = [p - 1 for p in P]
    i = int(input()) - 1
    P[i] += 1

for p in P:
    if 0 < p:
        print('Yes')
    else:
        print('No')


Fixed submission:
# C - Attack Survival

N, K, Q = map(int, input().split())
P = [0] * N
for _ in range(Q):
    P[int(input()) - 1] += 1

for p in P:
    if 0 < K - Q + p:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
# D - Powerful Discount Tickets

N, M = map(int, input().split())
A = [int(a) for a in input().split()]

def quick_sort(ls):
    left = []
    right = []
    if len(ls) <= 1:
        return ls

    ref = ls[0]
    ref_count = 0

    for el in ls:
        if el < ref:
            left.append(el)
        elif el > ref:
            right.append(el)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right

for i in range(M):
    price = A.pop()
    A.append(price // 2)
    A = quick_sort(A)

print(sum(A))


Fixed submission:
# D - Powerful Discount Tickets

import heapq

N, M = map(int, input().split())
A = [int(a) * -1 for a in input().split()]
heapq.heapify(A)

for i in range(M):
    price = heapq.heappop(A)
    price = -1 * ((-1 * price) // 2)
    heapq.heappush(A, price)

print(sum(A) * -1)

Buggy python submission (verdict: Time Limit Exceeded):
# D - Powerful Discount Tickets

N, M = map(int, input().split())
A = [int(a) for a in input().split()]

for i in range(M):
    mx = A.index(max(A))
    A[mx] = A[mx] // 2

print(sum(A))


Fixed submission:
# D - Powerful Discount Tickets

import heapq

N, M = map(int, input().split())
A = [int(a) * -1 for a in input().split()]
heapq.heapify(A)

for i in range(M):
    price = heapq.heappop(A)
    price = -1 * ((-1 * price) // 2)
    heapq.heappush(A, price)

print(sum(A) * -1)
Buggy python submission (verdict: Time Limit Exceeded):
# D - Gathering Children

S = [s for s in str(input())]
N = len(S)
cnt = 0
tmp = 0
for i in range(N - 1):
    if S[i] == S[i + 1]:
        tmp += 1
    else:
        tmp = 0
    cnt = max(cnt, tmp)

if cnt % 2 != 0:
    cnt += 1

ans = [1] * N
for _ in range(cnt):
    tmp = [0] * N
    for i in range(N):
        if S[i] == 'R':
            tmp[i + 1] += ans[i]
        if S[i] == 'L':
            tmp[i - 1] += ans[i]
    ans = tmp

print(*ans)


Fixed submission:
# D - Gathering Children

S = [s for s in str(input())]

N = len(S)
cnt = 0
ans = [0] * N

for i in range(N - 1):
    if S[i] == 'R':
        cnt += 1
    if S[i] == 'R' and S[i + 1] == 'L':
        ans[i] += cnt // 2
        ans[i + 1] += cnt // 2
        if cnt % 2 != 0:
            ans[i] += 1
        cnt = 0

for i in reversed(range(1, N)):
    if S[i] == 'L':
        cnt += 1
    if S[i] == 'L' and S[i - 1] == 'R':
        ans[i] += cnt // 2
        ans[i - 1] += cnt // 2
        if cnt % 2 != 0:
            ans[i] += 1
        cnt = 0

print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
# C - Exception Handling

N = int(input())
A = [int(input()) for _ in range(N)]
for i in range(N):
    print(max(A[:i] + A[i + 1:]))

Fixed submission:
# C - Exception Handling

N = int(input())
A = [int(input()) for _ in range(N)]
mx1 = sorted(A)[-1]
mx2 = sorted(A)[-2]
for i in range(N):
    if A[i] != mx1:
        print(mx1)
    else:
        print(mx2)
Buggy python submission (verdict: Runtime Error):
# C - Anti-Division

from math import gcd

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

CxD = C * D // gcd(C, D)

total_C = B // C
total_D = B // D
total_CxD = B // CxD

sub_C = (A - 1) // C
sub_D = (A - 1) // D
sub_CxD = (A - 1) // CxD

print((B - (A - 1)) -
        (total_C + total_D - total_CxD) + (sub_C + sub_D - sub_CxD))


Fixed submission:
# C - Anti-Division

from fractions import gcd

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

CxD = C * D // gcd(C, D)

total_C = B // C
total_D = B // D
total_CxD = B // CxD

sub_C = (A - 1) // C
sub_D = (A - 1) // D
sub_CxD = (A - 1) // CxD

print((B - (A - 1)) -
        (total_C + total_D - total_CxD) + (sub_C + sub_D - sub_CxD))
Buggy python submission (verdict: Runtime Error):
# B - Bounding

N, X = map(int, input().split())
L = [int(l) for l in input().split()]
D = 0
cnt = 0
for i in range(N + 1):
    if D <= X:
        cnt += 1
    D = D + L[i]

print(cnt)


Fixed submission:
# B - Bounding

N, X = map(int, input().split())
L = [int(l) for l in input().split()]
D = 0
cnt = 1
for i in range(N):
    D = D + L[i]
    if D <= X:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
# C - Prison

N, M = map(int, input().split())
ls = [i for i in range(1, N + 1)]
for _ in range(M):
    l, r = map(int, input().split())
    ls = set(ls) & set([i for i in range(l, r + 1)])

print(len(ls))


Fixed submission:
# C - Prison

N, M = map(int, input().split())
left = 0
right = 10 ** 5
for _ in range(M):
    l, r = map(int, input().split())
    left, right = max(left, l), min(right, r)

print(len([i for i in range(left, right + 1)]) if left <= right else 0)
Buggy python submission (verdict: Time Limit Exceeded):
# D - Integer Cards

from operator import itemgetter
from collections import deque

N, M = map(int, input().split())
A = sorted([int(a) for a in input().split()])

BC = []
for i in range(M):
    b, c = map(int, input().split())
    BC.append((b, c))

BC = sorted(BC, key=itemgetter(1), reverse=True)

D = deque()
for _ in range(M):
    bc = BC.pop()
    for _ in range(bc[0]):
        D.append(bc[1])

for i in range(N):
    if len(D) != 0 and A[i] <= D[-1]:
        A[i] = D.pop()

print(sum(A))


Fixed submission:
# D - Integer Cards

from operator import itemgetter

N, M = map(int, input().split())
A = sorted([int(a) for a in input().split()])

BC = []
for i in range(M):
    b, c = map(int, input().split())
    BC.append([b, c])

BC = sorted(BC, key=itemgetter(1), reverse=True)

ans = 0
for i in range(N):
    if len(BC) != 0 and A[i] <= BC[0][1]:
        ans += BC[0][1]
        BC[0][0] -= 1
        if BC[0][0] == 0:
            BC.pop(0)
    else:
        ans += A[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# D - Integer Cards

from operator import itemgetter

N, M = map(int, input().split())
A = sorted([int(a) for a in input().split()])

BC = []
for i in range(M):
    b, c = map(int, input().split())
    BC.append((b, c))

BC = sorted(BC, key=itemgetter(1), reverse=True)

D = []
for _ in range(M):
    bc = BC.pop()
    D += [bc[1]] * bc[0]

for i in range(N):
    if len(D) != 0 and A[i] <= D[-1]:
        A[i] = D.pop()

print(sum(A))


Fixed submission:
# D - Integer Cards

from operator import itemgetter

N, M = map(int, input().split())
A = sorted([int(a) for a in input().split()])

BC = []
for i in range(M):
    b, c = map(int, input().split())
    BC.append([b, c])

BC = sorted(BC, key=itemgetter(1), reverse=True)

ans = 0
for i in range(N):
    if len(BC) != 0 and A[i] <= BC[0][1]:
        ans += BC[0][1]
        BC[0][0] -= 1
        if BC[0][0] == 0:
            BC.pop(0)
    else:
        ans += A[i]

print(ans)

Buggy python submission (verdict: Runtime Error):
# D - Integer Cards

from operator import itemgetter

N, M = map(int, input().split())
A = sorted([int(a) for a in input().split()])

B = [0] * M
C = [0] * M
for i in range(M):
    B[i], C[i] = map(int, input().split())

D = []
for _ in range(M):
    i = C.index(min(C))
    c = C.pop(i)
    b = B.pop(i)
    for j in range(b):
        D.append(c)

for i in range(N):
    if A[i] <= D[-1]:
        A[i] = D.pop()

print(sum(A))


Fixed submission:
# D - Integer Cards

from operator import itemgetter

N, M = map(int, input().split())
A = sorted([int(a) for a in input().split()])

BC = []
for i in range(M):
    b, c = map(int, input().split())
    BC.append([b, c])

BC = sorted(BC, key=itemgetter(1), reverse=True)

ans = 0
for i in range(N):
    if len(BC) != 0 and A[i] <= BC[0][1]:
        ans += BC[0][1]
        BC[0][0] -= 1
        if BC[0][0] == 0:
            BC.pop(0)
    else:
        ans += A[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
A = [*map(int, input().split())]

l = [a for a in A if a < X]
r = [a for a in A if a > X]

print(len(l) if len(l) < len(r) else len(r))


Fixed submission:
N, M, X = map(int, input().split())
A = [int(i) for i in input().split()]

l = [a for a in A if a < X]
r = [a for a in A if a > X]

print(len(l) if len(l) < len(r) else len(r))

Buggy python submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
A = [*map(int, input().split())]

l = [a for a in A if a < X]

print(min(len(l), M - len(l)))


Fixed submission:
N, M, X = map(int, input().split())
A = [int(i) for i in input().split()]

l = [a for a in A if a < X]
r = [a for a in A if a > X]

print(len(l) if len(l) < len(r) else len(r))

Buggy python submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
A = [*map(int, input().split())]

l = [a for a in A if a < X]

print(min(len(l), M - len(l)))


Fixed submission:
N, M, X = map(int, input().split())
A = [int(i) for i in input().split()]

l = [a for a in A if a < X]
r = [a for a in A if a > X]

print(len(l) if len(l) < len(r) else len(r))

Buggy python submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
A = [*map(int, input().split())]

l = [a for a in A if a < X]
r = [a for a in A if a > X]

print(min(len(l), len(r)))


Fixed submission:
N, M, X = map(int, input().split())
A = [int(i) for i in input().split()]

l = [a for a in A if a < X]
r = [a for a in A if a > X]

print(len(l) if len(l) < len(r) else len(r))
Buggy python submission (verdict: Runtime Error):
X, Y, A, B, C = [int(x) for x in input().split()]
p = sorted([int(x) for x in input().split()], reverse=True)[:X]
q = sorted([int(x) for x in input().split()], reverse=True)[:Y]
pq = deque(sorted(p + q, reverse=True))
r = deque(sorted([int(x) for x in input().split()]))

ans = sum(pq)

for i in range(len(r)):
    if r[-1] > pq[-1]:
        ans += r.pop() - pq.pop()

print(ans)

Fixed submission:
from collections import deque

X, Y, A, B, C = [int(x) for x in input().split()]
p = sorted([int(x) for x in input().split()], reverse=True)[:X]
q = sorted([int(x) for x in input().split()], reverse=True)[:Y]
pq = deque(sorted(p + q, reverse=True))
r = deque(sorted([int(x) for x in input().split()]))

ans = sum(pq)

for i in range(len(r)):
    if r[-1] > pq[-1]:
        ans += r.pop() - pq.pop()

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

for s in S[0::2]:
    if s != 'R' and s != 'U' and s != 'D':
        print('No')
        quit()

for s in S[1::2]:
    if S[i] != 'L' and S[i] != 'U' and S[i] != 'D':
        print('No')
        quit()

print('Yes')


Fixed submission:
S = input()

for s in S[0::2]:
    if s != 'R' and s != 'U' and s != 'D':
        print('No')
        quit()

for s in S[1::2]:
    if s != 'L' and s != 'U' and s != 'D':
        print('No')
        quit()

print('Yes')

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

for s in S[0::2]:
    if s != 'R' and s != 'U' and s != 'D':
        print('No')
        quit()

for i in S[1::2]:
    if S[i] != 'L' and S[i] != 'U' and S[i] != 'D':
        print('No')
        quit()

print('Yes')


Fixed submission:
S = input()

for s in S[0::2]:
    if s != 'R' and s != 'U' and s != 'D':
        print('No')
        quit()

for s in S[1::2]:
    if s != 'L' and s != 'U' and s != 'D':
        print('No')
        quit()

print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, M = map(int, input().split())
A = np.array([int(n) for n in input().split()])

for _ in range(M):
    A[np.argmax(A)] //= 2

print(int(np.sum(A)))


Fixed submission:
import heapq

N, M = map(int, input().split())
A = [-int(n) for n in input().split()]
heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    a = a // 2 if a % 2 == 0 else a // 2 + 1
    heapq.heappush(A, a)

print(-sum(A))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, Q = [int(x) for x in input().split()]
STX = np.zeros((N, 3))
for i in range(N):
    STX[i, 0], STX[i, 1], STX[i, 2] = [int(x) for x in input().split()]
D = [int(input()) for _ in range(Q)]
STX = STX[np.argsort(STX[:, 2])]

for d in D:
    STX_copy = np.copy(STX)
    STX_copy[:, :2] = STX_copy[:, :2] - d
    try:
        print(int(STX_copy[np.where((STX_copy[:, 0] - 0.5 <= STX_copy[:, 2]) & (STX_copy[:, 1] - 0.5 >= STX_copy[:, 2]))][0, 2]))
    except:
        print(-1)


Fixed submission:
A, P = map(int, input().split())
print((3 * A + P) // 2)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from collections import deque
N, M = map(int, stdin.readline().rstrip().split())
A = [int(x) for x in stdin.readline().rstrip().split()]
A.sort()
A = deque(A)
X = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]
Y = []
for b, c in X:
    Y.extend([c] * b)
Y.sort()
Y = deque(Y)

for i in range(len(X) if len(X) < len(A) else len(A)):
    a = A.popleft()
    c = Y.pop()
    if a < c:
        A.append(c)
    else:
        A.append(a)
        print(sum(A))
        quit()
print(sum(A))

Fixed submission:
A, B = map(int, input().split())
if A >= 13:
    print(B)
elif 6 <= A <= 12:
    print(int(B / 2))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
cnt = 0

for r in range(N // R + 1):
    for g in range(N // G + 1):
        if (N - r * R - g * G) % B == 0 and (N - r * R - g * G) >= 0:
            cnt += 1

print(cnt)

Fixed submission:
R, G, B, N = map(int, input().split())
cnt = 0

for r in range(N // R + 1):
    for g in range(N // G + 1):
        if (N - r * R - g * G) % B == 0 and (N - r * R - g * G) >= 0:
            cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
D = input()
print("Christmas" + "Eve" * (25 - D))

Fixed submission:
D = int(input())
print("Christmas"+" Eve"*(25 - D))
Buggy python submission (verdict: Runtime Error):
N = int(input())

for i in range(N // 4 + 1):
  for j in range(N // 7 + 1):
	if 4 * i + 7 * j == N:
      print("Yes")
      quit()
    else:
      pass
print("No")

Fixed submission:
N = int(input())

for i in range(N // 4 + 1):
      for j in range(N // 7 + 1):
            if 4 * i + 7 * j == N:
                print("Yes")
                quit()
            else:
                pass
print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())


def fsod(n):
    sum = 0
    while n >= 1:
        sum += n % 10
        n //= 10
    return sum


print(min([fsod(A) + fsod(N-A) for A in range(1, N // 2)]))

Fixed submission:
N = int(input())


def fsod(n):
    sum = 0
    while n >= 1:
        sum += n % 10
        n //= 10
    return sum


print(min([fsod(A) + fsod(N-A) for A in range(1, N // 2 + 1)]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())

if N - (N // 500) * 500 <= A:
  print("Yes")
else:
  pritn("No")

Fixed submission:
N = int(input())
A = int(input())

if N - (N // 500) * 500 <= A:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

mean = (a + b) / 2

if mean % 1 == 0:
  print((mean)
else:
  print((a + b) // 2 + 1)

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

if (a + b) % 2 == 0:
  print(int((a + b) / 2))
else:
  print(int((a + b + 1) / 2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(map(int, input().split())))
print(sum(A[N:2*N])


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

ans = 0
for i in range(2 * N):
    if i % 2 == 1:
        ans += A[3 * N - i - 1]

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = sorted(map(int, input().split()))
print(sum(A[N:2*N])

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

ans = 0
for i in range(2 * N):
    if i % 2 == 1:
        ans += A[3 * N - i - 1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
while len(S) > 0:
    if ''.join(S[-5:]) == 'dream' or ''.join(S[-5:]) == 'erase':
        S = S[:-5]
    elif ''.join(S[-6:]) == 'eraser':
        S = S[:-6]
    elif ''.join(S[-7:]) == 'dreamer':
        S = S[:-7]
    else:
        print('NO')
        quit()
print('YES')

Fixed submission:
S = list(input())
while len(S) > 0:
    if ''.join(S[-5:]) == 'dream' or ''.join(S[-5:]) == 'erase':
        S = S[:-5]
    elif ''.join(S[-6:]) == 'eraser':
        S = S[:-6]
    elif ''.join(S[-7:]) == 'dreamer':
        S = S[:-7]
    else:
        print('NO')
        quit()
print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
while len(S) > 0:
    if ''.join(S[-5:]) == 'dream' or ''.join(S[-5:]) == 'erase':
        S = S[:-5]
    elif ''.join(S[-6:]) == 'eraser':
        S = S[:-6]
    elif ''.join(S[-7:]) == 'dreamer':
        S = S[-7:]
    else:
        print('NO')
        quit()
print('YES')

Fixed submission:
S = list(input())
while len(S) > 0:
    if ''.join(S[-5:]) == 'dream' or ''.join(S[-5:]) == 'erase':
        S = S[:-5]
    elif ''.join(S[-6:]) == 'eraser':
        S = S[:-6]
    elif ''.join(S[-7:]) == 'dreamer':
        S = S[:-7]
    else:
        print('NO')
        quit()
print('YES')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
# C = [[0, 0, 0] for i in range(M)] # Cities
C = []
for i in range(M):
    P, Y = map(int, input().split())
    # C[i] = [i, P, Y]
    C.append([i, P, Y])

C.sort(key=lambda x: x[2])

# I = [[0, 0] for i in range(M)]
I = []
Num = [0]*M

for i in range(M):
    P = C[i][1]
    # I[i] = [C[i][0], "%06d%06d" % (P, Num[P-1] + 1)]
    I.append([C[i][0], "%06d%06d" % (P, Num[P-1] + 1)])
    Num[P-1] += 1

I.sort(key=lambda x: x[0])
for i in range(M):
    print(I[i][1])

Fixed submission:
N, M = map(int, input().split())
C = [[0, 0, 0] for i in range(M)] # Cities
for i in range(M):
    P, Y = map(int, input().split())
    C[i] = [i, P, Y]

C.sort(key=lambda x: x[2])

I = [[0, 0] for i in range(M)]
Num = [0]*N

for i in range(M):
    P = C[i][1]
    Num[P-1] += 1
    I[i] = [C[i][0], "%06d%06d" % (P, Num[P-1])]

I.sort(key=lambda x: x[0])
for i in range(M):
    print(I[i][1])

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
C = [[0, 0, 0] for i in range(M)] # Cities
for i in range(M):
    P, Y = map(int, input().split())
    C[i] = [i, P, Y]

C.sort(key=lambda x: x[2])

I = [[0, 0] for i in range(M)]
Num = [0]*M

for i in range(M):
    P = C[i][1]
    I[i] = [C[i][0], "%06d%06d" % (P, Num[P-1] + 1)]
    Num[P-1] += 1

I.sort(key=lambda x: x[0])
for i in range(M):
    print(I[i][1])

Fixed submission:
N, M = map(int, input().split())
C = [[0, 0, 0] for i in range(M)] # Cities
for i in range(M):
    P, Y = map(int, input().split())
    C[i] = [i, P, Y]

C.sort(key=lambda x: x[2])

I = [[0, 0] for i in range(M)]
Num = [0]*N

for i in range(M):
    P = C[i][1]
    Num[P-1] += 1
    I[i] = [C[i][0], "%06d%06d" % (P, Num[P-1])]

I.sort(key=lambda x: x[0])
for i in range(M):
    print(I[i][1])

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
C = [[0, 0, 0] for i in range(M)] # Cities
for i in range(M):
    P, Y = map(int, input().split())
    C[i][:] = [i, P, Y]

C.sort(key=lambda x: x[2])

I = [[0, 0] for i in range(M)]
Num = [0]*M

for i in range(M):
    P = C[i][1]
    I[i][:] = [C[i][0], "%06d%06d" % (P, Num[P-1] + 1)]
    Num[P-1] += 1

I.sort(key=lambda x: x[0])
for i in range(M):
    print(I[i][1])

Fixed submission:
N, M = map(int, input().split())
C = [[0, 0, 0] for i in range(M)] # Cities
for i in range(M):
    P, Y = map(int, input().split())
    C[i] = [i, P, Y]

C.sort(key=lambda x: x[2])

I = [[0, 0] for i in range(M)]
Num = [0]*N

for i in range(M):
    P = C[i][1]
    Num[P-1] += 1
    I[i] = [C[i][0], "%06d%06d" % (P, Num[P-1])]

I.sort(key=lambda x: x[0])
for i in range(M):
    print(I[i][1])
Buggy python submission (verdict: Runtime Error):
ans = []
for p in range(2, 10):
    for b in range(1, 32):
        if b**p <= X:
            ans.append(b**p)
        else:
            break
print(max(ans))

Fixed submission:
X = int(input())
ans = []
for p in range(2, 10):
    for b in range(1, 32):
        if b**p <= X:
            ans.append(b**p)
        else:
            break
print(max(ans))
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split())).sort()
K = int(input())

A[-1] = A[-1]*2**K
print(sum(A))

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

A[-1] = A[-1]*2**K
print(sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

Asum = [0]*(N+1)
for i in range(N):
    Asum[i+1] = Asum[i] + A[i]

ans = 0
for i in range(N):
    ans += Asum[i+1:].count(Asum[i])
print(ans)

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

Asum = [0]*(N+1)
for i in range(N):
    Asum[i+1] = Asum[i] + A[i]

Asum.sort()
ans = 0
same = 1
tmp = Asum[0] - 1
for i in range(N+1):
    if tmp != Asum[i]:
        ans += same*(same - 1)//2
        tmp = Asum[i]
        same = 1
    else:
        same += 1
ans += same*(same - 1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

def solve(n,x,y):
  matrix = np.full((n,n), -1)
  x = x-1
  y = y-1
  for i in range(n):
    for j in range(i+1, n):
      if j >= x:
        matrix[i][j] = min(j-i, np.abs(j-y)+np.abs(x-i)+1)
      else:
        matrix[i][j] = j-i

  for i in range(1,n):
    print(np.count_nonzero(matrix==i))

if __name__ == "__main__":
  _n, _x, _y = map(int, input().split())
  solve(_n,_x,_y)


Fixed submission:
def is_same(str):
  assert len(str) == 6
  if str[2] != str[3]:
    return False
  if str[4] != str[5]:
    return False
  return True

if __name__ == "__main__":
  s = list(input())

  if is_same(s):
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

v_min = math.inf

def solve(arr):
  global v_min
  count = 0
  for v in arr:
    if v <= v_min:
      count += 1
      v_min = v
  return count

if __name__ == "__main__":
  _n = int(input())
  arr = [int(i) for i in input().split()]
  ans = solve(arr)
  print(int(ans))


Fixed submission:
import numpy as np
import math

v_min = np.inf

def solve(arr):
  global v_min
  count = 0
  for v in arr:
    if v <= v_min:
      count += 1
      v_min = v
  return count

if __name__ == "__main__":
  _n = int(input())
  arr = [int(i) for i in input().split()]
  ans = solve(arr)
  print(int(ans))