Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())
ans = 0
for i in range(a, b+1):
    if i % x == 0:
        ans +=1
print(ans)

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

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

Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())
ans = 0
for i in range(a, b+1):
    if i%x ==0:
        ans +=1

print(ans)

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

if a % x == 0:
    print(-(a//x)+(b//x)+1)
else:
    print(-(a//x)+(b//x))
Buggy python submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = [int(i) for i in input().split()]
ans = 0

if a[0] > x:
    ans += a[0] - x
    ans[0] = x

for i in range(1, N):
    if a[i] + a[i - 1] > x:
        ans += a[i] - (x - a[i - 1])
        a[i] = x - a[i - 1]

print(ans)

Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    if (a[i]+a[i+1]) > x and x < a[i] :
        ans += a[i+1]+a[i]-x
        
        a[i] = a[i]-(x-a[i+1])
        a[i+1] = 0
        
    elif (a[i]+a[i+1]) > x:
        ans += a[i+1]+a[i]-x
        
        a[i+1] = x-a[i]
        
print(ans)
Buggy python submission (verdict: Runtime Error):
abc = sorted(list(map(int, input().split())))
print(`Yes` if abc[0]+abc[1] == abc[2] else `No`)


Fixed submission:
abc = sorted(map(int, input().split()))
print ('Yes' if abc[0]+abc[1] == abc[2] else 'No')

Buggy python submission (verdict: Runtime Error):
abc = sorted(map(int, input().split()))
print(`Yes` if abc[0]+abc[1] == abc[2] else `No`)


Fixed submission:
abc = sorted(map(int, input().split()))
print ('Yes' if abc[0]+abc[1] == abc[2] else 'No')
Buggy python submission (verdict: Runtime Error):
S = input()
s = s[0]
ans = 0
for i in S:
    if s != i:
        ans += 1
        s = i
print(ans)

Fixed submission:
S = list(input())
flag = S[0]
flag_num = 0
ans = 0


for i in range(len(S)):
    if flag != S[flag_num]:
        ans += 1
        flag = S[flag_num]
    
    flag_num += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, T = map(int, input().split())
A = list(map(int, input().split()))

aa = A[:]
aa.sort()
num = []
for i in range(N-1):
    aa.remove(A[i])
    num.append(aa[-1]-A[i])
    
print(num.count(max(num)))

Fixed submission:
from bisect import bisect_left

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

aa = A[:]
aa.sort()

ans = 0
num = []

for i in range(N-1):
    ind = bisect_left(aa, A[i])
    del aa[ind]
    
    num.append(aa[-1]-A[i])

print(num.count(max(num)))

Buggy python submission (verdict: Time Limit Exceeded):
N, T = map(int, input().split())
A = list(map(int, input().split()))

num = []
for i in range(N-1):
    a = A[i+1:]
    num.append(max(a)-A[i])
print(num.count(max(num)))

Fixed submission:
from bisect import bisect_left

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

aa = A[:]
aa.sort()

ans = 0
num = []

for i in range(N-1):
    ind = bisect_left(aa, A[i])
    del aa[ind]
    
    num.append(aa[-1]-A[i])

print(num.count(max(num)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
TA = [[int(i) for i in input().split()] for i in range(N)]
Takahashi, Aoki = TA[0][0], TA[0][1]

for ta, ao in TA:
    if Takahashi <= ta and Aoki <= ao:
        Takahashi, Aoki = ta, ao
    else:
        num = max(math.ceil(Takahashi / ta), math.ceil(Aoki / ao))
        Takahashi, Aoki = num * ta, num * ao


print(Takahashi + Aoki)


Fixed submission:
N = int(input())
T, A = 1, 1
for i in range(N):
    t, a = map(int, input().split())
    if T % t == 0:
        n1 = T // t
    else:
        n1 = T // t + 1
    if A % a == 0:
        n2 = A // a
    else:
        n2 = A // a + 1
    #print('--',n1, n2)
    n = max(n1, n2)
    T = n*t
    A = n*a
    #print('--------',T, A)
    
print(T+A)

Buggy python submission (verdict: Runtime Error):
from math import ceil

N = int(input())
ta, ao = 1, 1
for i in range(N):
    T, A = map(int, input().split())
    if ta <= T and ao <= A:
        ta = T
        ao = A
    else:
        if ta % T == 0:
            n = ta//T
        else:
            n == ta//T + 1
        if ao % A == 0:
            m = ao//A
        else:
            m = ao//A + 1
        
        ta = max(n, m) * T
        ao = max(n, m) * A
        print(n)
print(ta+ao)

Fixed submission:
N = int(input())
T, A = 1, 1
for i in range(N):
    t, a = map(int, input().split())
    if T % t == 0:
        n1 = T // t
    else:
        n1 = T // t + 1
    if A % a == 0:
        n2 = A // a
    else:
        n2 = A // a + 1
    #print('--',n1, n2)
    n = max(n1, n2)
    T = n*t
    A = n*a
    #print('--------',T, A)
    
print(T+A)

Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = 1, 1
for i in range(N):
    t, a = map(int, input().split())
    if T % t == 0:
        n1 = T // t
    else:
        n1 = T // t + 1
    if A % a == 0:
        n2 = A // a
    else:
        n2 = T // a + 1
    n = max(n1, n2)
    #print(T,A)
    T = n*t
    A = n*a
    
print(sum(T+A))

Fixed submission:
N = int(input())
T, A = 1, 1
for i in range(N):
    t, a = map(int, input().split())
    if T % t == 0:
        n1 = T // t
    else:
        n1 = T // t + 1
    if A % a == 0:
        n2 = A // a
    else:
        n2 = A // a + 1
    #print('--',n1, n2)
    n = max(n1, n2)
    T = n*t
    A = n*a
    #print('--------',T, A)
    
print(T+A)
Buggy python submission (verdict: Runtime Error):
A = list(input())
B = list(input())
C = list(input())
ans = 1
if len(A) == 1 and A[0] == 'a':
    print('A')
else:
    card = A[0]
    del A[0]
    while ans == 1:
        
        if card == 'a':
            
            card = A[0]
            del A[0]
            
            if card == 'a' and len(A) == 0:
                print('A')
                ans = 0
                
        elif card == 'b':
            
            card = B[0]
            del B[0]
            
            if card == 'b' and len(B) == 0:
                print('B')
                ans = 0
                
        elif card == 'c':
            
            card = C[0]
            del C[0]
            
            if card == 'c' and len(C) == 0:
                print('C')
                ans = 0


Fixed submission:
SA = list(input())
SB = list(input())
SC = list(input())
turn = 'a'

for i in range(301):
    if turn == 'a':
        
        if len(SA) == 0:
            print('A')
            break
        
        else:
            turn = SA[0]
            del SA[0]
    
    if turn == 'b':
        
        if len(SB) == 0:
            print('B')
            break
        
        else:
            turn =SB[0]
            del SB[0]
        
    if turn == 'c':
        if len(SC) == 0:
            print('C')
            break
        else:
            turn = SC[0]
            del SC[0]

Buggy python submission (verdict: Runtime Error):
A = list(input())
B = list(input())
C = list(input())
ans = 1
if len(A) == 0:
    print(A)
else:
    card = A[0]
    del A[0]
    while ans == 1:
        
        if card == 'a':
            card = A[0]
            del A[0]
            if card == 'a' and len(A) == 0:
                print('A')
                ans = 0
        elif card == 'b':
            card = B[0]
            del B[0]
            if card == 'b' and len(B) == 0:
                print('B')
                ans = 0
        elif card == 'c':
            card = C[0]
            del C[0]
            if card == 'c' and len(C) == 0:
                print('C')
                ans = 0

Fixed submission:
SA = list(input())
SB = list(input())
SC = list(input())
turn = 'a'

for i in range(301):
    if turn == 'a':
        
        if len(SA) == 0:
            print('A')
            break
        
        else:
            turn = SA[0]
            del SA[0]
    
    if turn == 'b':
        
        if len(SB) == 0:
            print('B')
            break
        
        else:
            turn =SB[0]
            del SB[0]
        
    if turn == 'c':
        if len(SC) == 0:
            print('C')
            break
        else:
            turn = SC[0]
            del SC[0]
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C = map(int, input().split())
ans = float('inf')

for i in range(1, A+1):
    ans = min(ans, abs((i*B*C)-(A-i)*B*C))

for i in range(1, B+1):
    ans = min(ans, abs((A*i*C)-A*(B-i)*C))
    
for i in range(1, B+1):
    ans = min(ans, abs((A*B*i)-A*B*(C-i)))
print(ans)

Fixed submission:
A, B, C = map(int, input().split())
ans = float('inf')

if A % 2 == 0 or B % 2 == 0 or C % 2 == 0:
    print(0)
else:
    ans = min(ans, abs((A//2)*B*C - (A//2 + 1)*B*C))
    ans = min(ans, abs((B//2)*A*C - (B//2 + 1)*A*C))
    ans = min(ans, abs((C//2)*B*A - (C//2 + 1)*B*A))
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N, A = map(int, input().split())
x = sorted([int(i)-A for i in input().split()])
ans = x.count(0)

if N >= 2:
    for i in range(2, N+1):
        check = list(itertools.combinations(x,i))
        for i in check:
            if sum(i) == 0:
                ans += 1

print(ans)

Fixed submission:
N, A = [int(_) for _ in input().split()]
x = [int(_) for _ in input().split()]
 
dp = [[0] * (sum(x)+1) for j in range(N+1)]
 
dp[0][0] = 1
for i in range(1, N+1):
    for j in list(range(1, N+1))[::-1]:
        for k in list(range(x[i-1], sum(x[:i])+1))[::-1]:
            dp[j][k] += dp[j-1][k - x[i-1]]
 
print(sum([dp[i][i*A] for i in range(1, N+1) if i*A <= sum(x)]))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N, A = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
 
for i in range(1, N+1):
    check = list(itertools.combinations(x,i))
    for j in check:
        if sum(j) % len(j) == 0 and (sum(j) // len(j)) == A:
            ans +=1
print(ans)

Fixed submission:
N, A = [int(_) for _ in input().split()]
x = [int(_) for _ in input().split()]
 
dp = [[0] * (sum(x)+1) for j in range(N+1)]
 
dp[0][0] = 1
for i in range(1, N+1):
    for j in list(range(1, N+1))[::-1]:
        for k in list(range(x[i-1], sum(x[:i])+1))[::-1]:
            dp[j][k] += dp[j-1][k - x[i-1]]
 
print(sum([dp[i][i*A] for i in range(1, N+1) if i*A <= sum(x)]))
Buggy python submission (verdict: Runtime Error):
import sys
s = input()
N = len(s)


for i in range(N-2+1):
    if s[i] == s[i+1]:
        print(i+1, i+3)
        sys.exit()
        
for i in range(N-3+1):
    if s[i] == s[i+3]:
        print(i+1, i+4)
        sys.exit()
        
print(-1, -1)

Fixed submission:
import sys
s = input()
N = len(s)


for i in range(N-2+1):
    if s[i] == s[i+1]:
        print(i+1, i+2)
        sys.exit()

        
for i in range(N-3+1):
    if s[i] == s[i+2]:
        print(i+1, i+3)
        sys.exit()

        
        
print(-1, -1)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
if a+b+c=17:
    print('YES')
else:
    print('NO')


Fixed submission:
a, b, c = map(int,input().split())
if a == b == 5 and c==7:
    print('YES')
elif a== c == 5 and b==7:
    print('YES')
elif b == c == 5 and a==7:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
H, W, A, B = map(int, input().split())

ans = 0 
MOD = 10**9 + 7
N = H + W - 2
fac = [1] * N
inv = [1] * N

# 階乗
for i in range(1, N):
    fac[i] = (fac[i - 1] * i) % MOD
 
# 逆元
inv[N - 1] = pow(fac[N - 1], mod - 2, mod)
for i in range(N - 1, 0, -1):
    inv[i - 1] = (inv[i] * i) % MOD
 
 
def f(x, y):
    ans = fac[x + y] * inv[x] * inv[y] % MOD
    return ans
 

for x in range(B, W):
    ans += f(x, H - A - 1) * f(W - 1 - x, A - 1)
    ans %= MOD
    
print(ans % MOD)

Fixed submission:
H, W, A, B = map(int, input().split())

ans = 0 
MOD = 10**9 + 7
N = H + W - 2
fac = [1] * N
inv = [1] * N

# 階乗
for i in range(1, N):
    fac[i] = (fac[i - 1] * i) % MOD
 
# 逆元
inv[N - 1] = pow(fac[N - 1], MOD - 2, MOD)
for i in range(N - 1, 0, -1):
    inv[i - 1] = (inv[i] * i) % MOD
 
 
def f(x, y):
    ans = fac[x + y] * inv[x] * inv[y] % MOD
    return ans
 

for x in range(B, W):
    ans += f(x, H - A - 1) * f(W - 1 - x, A - 1)
    ans %= MOD
    
print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
# calculate N!(modP)
def fac(n):
    ans = 1
    mod = 10**9+7
    for i in range(1, n+1):
        ans *= i
        ans %= mod
    return ans
 
# calculate a**b(modP)     
def cal(a, b, mod):
    if b == 0:
        return 1
    elif b % 2 == 0:
        return cal(a, b//2, mod)**2 % mod
    else:
        return (a * cal(a, b-1, mod)) % mod 
    
H, W, A, B = map(int, input().split())

ans = 0
mod = 10**9+7


for w in range(B, W):
    now = fac((H-A-1)+w) * cal(fac(H-A-1), mod-2, mod) * cal(fac(w), mod-2, mod) % mod
    now *= fac((A-1)+(W-w-1)) * cal(fac(A-1), mod-2, mod) * cal(fac(W-w-1), mod-2, mod) % mod
    ans = (ans+now) % mod
print(ans)

Fixed submission:
H, W, A, B = map(int, input().split())

ans = 0 
MOD = 10**9 + 7
N = H + W - 2
fac = [1] * N
inv = [1] * N

# 階乗
for i in range(1, N):
    fac[i] = (fac[i - 1] * i) % MOD
 
# 逆元
inv[N - 1] = pow(fac[N - 1], MOD - 2, MOD)
for i in range(N - 1, 0, -1):
    inv[i - 1] = (inv[i] * i) % MOD
 
 
def f(x, y):
    ans = fac[x + y] * inv[x] * inv[y] % MOD
    return ans
 

for x in range(B, W):
    ans += f(x, H - A - 1) * f(W - 1 - x, A - 1)
    ans %= MOD
    
print(ans % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    import numpy as np
    import itertools
    readline = sys.stdin.readline

    n = int(readline())

    a = list(map(int, readline().split()))
    a_c = list(itertools.combinations(a, 2))

    a0 = np.array([a_c[i][0] for i in range(len(a_c))])
    a1 = np.array([a_c[i][1] for i in range(len(a_c))])

    ans_b = np.matmul(a0%(1e+9 + 7), a1)
    ans = ans_b % (1e+9 + 7)

    print(f"{ans:.0f}")


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    import sys
    readline = sys.stdin.readline

    mod = 10**9 + 7

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

    sumA = sum(A) % mod
    ans = 0

    for i in A:
        sumA -= i
        ans += i * sumA
        ans %= mod

    ans %= mod
    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
import itertools
readline = sys.stdin.readline

n = int(readline())
a = list(map(int, readline().split()))

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        ans += a[i] * a[j]

ans = np.mod(ans, 1e+9 + 7)

print(f"{ans:.0f}")

Fixed submission:
def main():
    import sys
    readline = sys.stdin.readline

    mod = 10**9 + 7

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

    sumA = sum(A) % mod
    ans = 0

    for i in A:
        sumA -= i
        ans += i * sumA
        ans %= mod

    ans %= mod
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

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


def func(a, cnt=0):
    global count
    for i in range(len(a)-1):
        if a[i] > a[i+1]:
            a[i+1] += 1
            cnt += 1
            count = max(cnt, count)
            func(a, cnt)
        else:
            continue
    return count


COUNT = func(A)
print(COUNT)

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

    tallest = A[0]
    cnt = 0

    for height in A:
        if tallest > height:
            cnt += tallest - height
        else:
            tallest = height

    print(cnt)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
x = [0] * 100001
ans = sum(a)

for ai in a:
    x[ai] += 1  # xのなかでaiが登場する個数のカウント

for _ in range(q):
    b, c = map(int, input().split())
    ans += (c-b) * x[b]
    x[c] += x[b]  # bをcに入れ替えた個数だけcが増加する
    x[b] = 0
    print(ans)

# for i in range(q):
#     count = 0
#     b, c = map(int, input().split())
#
#     for j in a:
#         if j == b:
#             a[count] = c
#         count += 1
#     a_list = [_ for _ in a]
#     ans.append(a_list)
#
# for answer in ans:
#     print(sum(answer))


Fixed submission:
aa = input()

alpha = 'a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u,v,w,x,y,z'
alpha.split(',')

print('a' if aa in alpha else 'A')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bclist = [[0] for i in range(q)]
ans = []

for i in range(q):
    count = 0
    b, c = map(int, input().split())

    for j in a:
        if j == b:
            a[count] = c
        count += 1
    a_list = [_ for _ in a]
    ans.append(a_list)

for answer in ans:
    print(sum(answer))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
q = int(input())
x = [0] * 100001
ans = sum(a)

for ai in a:
    x[ai] += 1  # xのなかでaiが登場する個数のカウント

for _ in range(q):
    b, c = map(int, input().split())
    ans += (c-b) * x[b]
    x[c] += x[b]  # bをcに入れ替えた個数だけcが増加する
    x[b] = 0
    print(ans)

# for i in range(q):
#     count = 0
#     b, c = map(int, input().split())
#
#     for j in a:
#         if j == b:
#             a[count] = c
#         count += 1
#     a_list = [_ for _ in a]
#     ans.append(a_list)
#
# for answer in ans:
#     print(sum(answer))
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = [int(_) for _ in input().split()]

not_in_p = [i for i in range(0, 102) if i not in p]
nip_temp = list(map(lambda s: abs(x - s), not_in_p))

address = nip_temp.index(min(nip_temp))
print(p[address])


Fixed submission:
x, n = map(int, input().split())
p = [int(_) for _ in input().split()]

not_in_p = [i for i in range(0, 102) if i not in p]
nip_temp = list(map(lambda s: abs(x - s), not_in_p))

address = nip_temp.index(min(nip_temp))
print(not_in_p[address])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

multi = 1
for i in range(n):
    multi = multi * a[i]

print(multi if multi <= 10 ** 18 else -1)

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

if 0 in a:
    print(0)
    sys.exit()

else:
    multi = 1
    for i in a:
        multi *= i
        if multi > 10 ** 18:
            print(-1)
            sys.exit()

    print(multi)
Buggy python submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())

ans = []

a_list = list(range(a + 1))
b_list = list(range(b + 1))

for l in a_list:
    for m in b_list:
        ans.append(l - (k - l - m))

print(max(ans))


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

if k <= a:
    print(k)
elif a < k <= a+b:
    print(a)
elif a+b < k:
    print(a - (k-a-b))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
items = deque()
item = tuple(input() for _ in range(n))

for i in range(n):
    if item[i] not in items:
        items.append(item[i])

print(len(items))

Fixed submission:
n = int(input())
items = {}

for i in range(n):
    item = input()
    items[item] = True

print(len(items))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
items = []
item = tuple(input() for _ in range(n))

for i in range(n):
    if item[i] not in items:
        items.append(item[i])

print(len(items))

Fixed submission:
n = int(input())
items = {}

for i in range(n):
    item = input()
    items[item] = True

print(len(items))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
items = []

for i in range(n):
    item = input()
    if item not in items:
        items.append(item)

print(len(items))

Fixed submission:
n = int(input())
items = {}

for i in range(n):
    item = input()
    items[item] = True

print(len(items))
Buggy python submission (verdict: Time Limit Exceeded):
import math

k = int(input())
k_range = range(1, k + 1)

#
# def gcd(a, b):
#     if a < b:
#         a, b = b, a
#     while a % b != 0:
#         a, b = b, a % b
#     return b


sum_gcd = 0
for l in k_range:
    for m in k_range:
        for n in k_range:
            sum_gcd += math.gcd(n, math.gcd(l, m))

print(sum_gcd)

Fixed submission:
import math

k = int(input())
k_range = range(1, k + 1)

sum_gcd = 0
for l in k_range:
    temp = 0
    for m in k_range:
        temp = math.gcd(l, m)
        for n in k_range:
            sum_gcd += math.gcd(n, temp)

print(sum_gcd)

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10 ** 7)
k = int(input())
k_range = range(1, k + 1)


def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


sum_gcd = 0
for l in k_range:
    for m in k_range:
        for n in k_range:
            sum_gcd += gcd(n, gcd(l, m))

print(sum_gcd)

Fixed submission:
import math

k = int(input())
k_range = range(1, k + 1)

sum_gcd = 0
for l in k_range:
    temp = 0
    for m in k_range:
        temp = math.gcd(l, m)
        for n in k_range:
            sum_gcd += math.gcd(n, temp)

print(sum_gcd)
Buggy python submission (verdict: Runtime Error):
k = int(input())
S = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(S[k+1])

Fixed submission:
k = int(input())
S = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(S[k-1])
Buggy python submission (verdict: Runtime Error):
from sys import setrecursionlimit
setrecursionlimit(10**9)


def main():
    from sys import stdin
    import pandas as pd
    readline = stdin.readline

    n = int(readline())
    S = pd.Series([readline()[:-1] for _ in [0]*n])

    S = S.value_counts().copy()
    cond = S[0]
    answers = list(S[S == cond].sort_index().index)

    for ans in answers:
        print(ans)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    from sys import stdin
    from collections import Counter
    readline = stdin.readline

    n = int(readline())
    S = [readline()[:-1] for _ in [0]*n]

    s = Counter(S)
    most = s.most_common(1)[0][1]

    answers = [i[0] for i in s.items() if i[1] == most]
    answers = sorted(answers)

    for ans in answers:
        print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    from sys import stdin
    import pandas as pd
    readline = stdin.readline

    n = int(readline())
    S = pd.Series([readline()[:-1] for _ in [0]*n])

    S = S.value_counts().copy()
    cond = S[0]
    answers = list(S[S == cond].sort_index().index)

    for ans in answers:
        print(ans)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    from sys import stdin
    from collections import Counter
    readline = stdin.readline

    n = int(readline())
    S = [readline()[:-1] for _ in [0]*n]

    s = Counter(S)
    most = s.most_common(1)[0][1]

    answers = [i[0] for i in s.items() if i[1] == most]
    answers = sorted(answers)

    for ans in answers:
        print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())

if k <= A:
    print(A - k, B)
elif k <= (A + B):
    print(0, B - (k - A))
else:
    print(0, 0)

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

if K <= A:
    print("{} {}".format(A - K, B))
elif K <= (A + B):
    print("{} {}".format(0,B - (K - A)))
else:
    print("{} {}".format(0, 0))
Buggy python submission (verdict: Runtime Error):
import heapq
N, M = map(int, input().split())
A = [-int(i) for i in input().split()]

heapq.heapify(A)
for _ in range(M):
#Hは全部マイナスをつけたからaは最大値的なのはいる
    heapq.heapreplace((A, int(A[0]/2))
print(-sum(A))


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

heapq.heapify(A)
for _ in range(M):
#Hは全部マイナスをつけたからaは最大値的なのはいる
    a = heapq.heappop(A)
    heapq.heappush(A, int(a/2))
print(-sum(A))