Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
K = int(input())

listup = []
listup.append(list(range(1, 10)))
list_length = 9
finish = False
for i in range(10000000):
    new_list_floor = []
    for value in listup[i]:
        newlist = []
        mod_value = value % 10
        if mod_value == 0:
            newlist.append(value * 10 + mod_value)
            newlist.append(value * 10 + mod_value + 1)
        elif mod_value == 9:
            newlist.append(value * 10 + mod_value - 1)
            newlist.append(value * 10 + mod_value)
        else:
            newlist.append(value * 10 + mod_value - 1)
            newlist.append(value * 10 + mod_value)
            newlist.append(value * 10 + mod_value + 1)
        list_length_before = list_length
        list_length += len(newlist)
        new_list_floor.extend(newlist)
        if list_length >= K:
            diff = K - list_length_before
            print(newlist[diff - 1])
            sys.exit(0)
    listup.append(new_list_floor)
print(listup)

Fixed submission:
import sys
K = int(input())

listup = []
listup.append(list(range(1, 10)))
list_length = 9
if K <= 9:
    print(listup[0][K - 1])
    sys.exit(0)
for i in range(10000000):
    new_list_floor = []
    for value in listup[i]:
        newlist = []
        mod_value = value % 10
        if mod_value == 0:
            newlist.append(value * 10 + mod_value)
            newlist.append(value * 10 + mod_value + 1)
        elif mod_value == 9:
            newlist.append(value * 10 + mod_value - 1)
            newlist.append(value * 10 + mod_value)
        else:
            newlist.append(value * 10 + mod_value - 1)
            newlist.append(value * 10 + mod_value)
            newlist.append(value * 10 + mod_value + 1)
        list_length_before = list_length
        list_length += len(newlist)
        new_list_floor.extend(newlist)
        if list_length >= K:
            diff = K - list_length_before
            print(newlist[diff - 1])
            sys.exit(0)
    listup.append(new_list_floor)
print(listup)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n, k = map(int, input().split())
H = list(map(int, input().split()))

deqh = deque(H)

for i in range(k):
    if len(deqh) == 0:
        break
    max_hp = max(deqh)
    deqh.remove(max_hp)

print(sum(deqh))


Fixed submission:
from collections import deque
import sys

n, k = map(int, input().split())
H = list(map(int, input().split()))

if k >= n:
    print("0")
    sys.exit(0)

H.sort()
print(sum(H[0:len(H) - k]))
Buggy python submission (verdict: Runtime Error):
import itertools

n = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

p_index = -1
q_index = -1
combs = itertools.permutations(range(1, n + 1), n)
for index, each in enumerate(combs, start=1):
#    print(index, each)
    if P[0] == each[0] and P[1] == each[1] and P[2] == each[2]:
        p_index = index

    if Q[0] == each[0] and Q[1] == each[1] and Q[2] == each[2]:
        q_index = index
print(abs(p_index - q_index))


Fixed submission:
import itertools

n = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

p_index = -1
q_index = -1
combs = itertools.permutations(range(1, n + 1), n)
for index, each in enumerate(combs):
    if all(P[i] == each[i] for i in range(n)):
        p_index = index

    if all(Q[i] == each[i] for i in range(n)):
        q_index = index
print(abs(p_index - q_index))
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))
result = a[0]
for i in range(1, n):
    result = result * a[i] / gcd(result, a[i])
print result / g

Fixed submission:
from fractions import gcd
n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))
result = a[0]
for i in range(1, n):
    result = result * a[i] / gcd(result, a[i])
print result
Buggy python submission (verdict: Runtime Error):
x = int(input())
k = 0
A = 0
B = 0
for i in range(0, 100):
    I = i**5
    j = I - x
    J = abs(j)
    k = 0
    while k <= J**(0.2):
        if k**5 == J:
            A = i
            B = int(J**(0.2))*(int(j/J))
            break
        k += 1
print(str(A) + ' ' + str(B))

Fixed submission:
import numpy as np

x = int(input())
k = 0
A = 0
B = 0
for i in range(0, 1000):
    I = i**5
    j = I - x
    J = abs(j)
    k = 0
    while k <= J**(0.2):
        if k**5 == J:
            A = i
            B = k*(np.sign(j))
            break
        k += 1
print(str(A) + ' ' + str(B))

Buggy python submission (verdict: Runtime Error):
x = int(input())
for i in range(0, 100):
    I = i**5
    j = I - x
    J = abs(j)
    if J**(0.2) == J**(0.2)//1:
        A = i
        B = int(J**(0.2))*(int(j/J))
        break
print(str(A) + ' ' + str(B))

Fixed submission:
import numpy as np

x = int(input())
k = 0
A = 0
B = 0
for i in range(0, 1000):
    I = i**5
    j = I - x
    J = abs(j)
    k = 0
    while k <= J**(0.2):
        if k**5 == J:
            A = i
            B = k*(np.sign(j))
            break
        k += 1
print(str(A) + ' ' + str(B))

Buggy python submission (verdict: Runtime Error):
x = int(input())
for i in range(0, 100):
    I = i**5
    j = I - x
    J = abs(j)
    if J**(0.2) == J**(0.2)//1:
        A = i
        B = int(J**(0.2))*(int(j/J))
        break
print(str(A) + ' ' + str(B))

Fixed submission:
import numpy as np

x = int(input())
k = 0
A = 0
B = 0
for i in range(0, 1000):
    I = i**5
    j = I - x
    J = abs(j)
    k = 0
    while k <= J**(0.2):
        if k**5 == J:
            A = i
            B = k*(np.sign(j))
            break
        k += 1
print(str(A) + ' ' + str(B))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i+1, n):
        if abs(j-i) == a[i] + a[j]:
            ans += 1
print(ans)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int,input().split()))
b = []
c = []
ans = 0
for i in range(n):
    b.append(i+1-a[i])
    c.append(i+1+a[i])
B = Counter(b)
for i in c:
    ans += B.get(i,0)
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())
ans = 0
for i in range(1, min(n+1, b+1)):
    s = int(((a*i)/b) // 1 - a * ((i/b)//1))
    if s > ans:
        ans = s
print(ans)

Fixed submission:
a, b, n = map(int, input().split())
s = min(b-1, n)
ans = int(((a*s)/b) // 1 - a * ((s/b)//1))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
s = [0]*n
for i in a:
    s[a[i]] += 1
for S in s[1::]:
    print(S)
print('0')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [0]*n
for i in a:
    s[i-1] += 1
for S in s[::]:
    print(str(S))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
S = list(s)
a = 0
for k in range(n):
        for j in range(k):
            if S[j] != S[k]:
                for i in range(j):
                    if   S[i] != S[j] and S[k] != S[i] and 2*j != i + k:
                        # print(i, j, k)
                        a += 1
print(a)

Fixed submission:
n = int(input())
s = input()
S = list(s)
r = S.count('R')
g = S.count('G')
b = S.count('B')
ans = r * g * b
for k in range(n):
        for j in range(k):
            i = 2*j - k
            if i >= 0 and i < j and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
S = list(s)
a = 0
for k in range(n):
        for j in range(k):
            for i in range(j):
                if  S[i] != S[j] and S[j] != S[k] and S[k] != S[i] and 2*j != i + k:
                    # print(i, j, k)
                    a += 1
print(a)

Fixed submission:
n = int(input())
s = input()
S = list(s)
r = S.count('R')
g = S.count('G')
b = S.count('B')
ans = r * g * b
for k in range(n):
        for j in range(k):
            i = 2*j - k
            if i >= 0 and i < j and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
b = 10
c = 9
while c <= k-1:
    B = str(b)
    for i in range(len(B)-1):
        if abs(int(B[i])-int(B[i+1])) > 1:
            b += 1
            break
    else:
        a.append(b)
        b += 1
        c += 1
print(a[k])

Fixed submission:
k = int(input())
a = [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
A = [1, 2, 3, 4, 5, 6, 7, 8, 9]

for j in range(9):
    b = []
    for i in a[-1]:
        I = str(i)
        if I[-1] != '9':
            b.append(i*10 + int(I[-1])+1)
        b.append(i*10 + int(I[-1]))
        if I[-1] != '0':
            b.append(i*10 + int(I[-1])-1)
    a.append(b)
    A += b
ans = sorted(A)
print(ans[k-1])
Buggy python submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

eat = []

# 食べる
p.sort(reverse=True)
if X > A:
    eat.extend(p)
else:
    eat.extend(p[:X])

q.sort(reverse=True)
if Y > B:
    eat.extend(q)
else:
    eat.extend(q[:Y])
loss = X+Y - len(eat)

# 足りない分を補充する
while loss > 0:
    r.sort(reverse=True)
    eat.append(r.pop(0))    
    loss -= 1

# rの方が大きいものがあれば入れ替える
eat.sort()
r.sort()
for i in range(len(eat)):
    if len(r) != 0 and eat[i] < r[-1]:
        eat[i] = r.pop(-1)
    else:
        break

print(sum(eat))


Fixed submission:
s = list(input())

ret = (s[2] == s[3]) and (s[4] == s[5])
if ret:
    print('Yes')
else:
    print('No')

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

eat = []

# 食べる
p.sort(reverse=True)
if X > A:
    eat.extend(p)
else:
    eat.extend(p[:X])

q.sort(reverse=True)
if Y > B:
    eat.extend(q)
else:
    eat.extend(q[:Y])
loss = X+Y - len(eat)

# 足りない分を補充する
while loss > 0:
    r.sort(reverse=True)
    eat.append(r.pop(0))    
    loss -= 1

# rの方が大きいものがあれば入れ替える
eat.sort()
for i in range(len(eat)):
    if len(r) != 0 and eat[i] < r[0]:
        eat[i] = r.pop(0)
    else:
        break

print(sum(eat))


Fixed submission:
s = list(input())

ret = (s[2] == s[3]) and (s[4] == s[5])
if ret:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

eat = []

# 食べる
p.sort(reverse=True)
if X > A:
    eat.extend(p)
else:
    eat.extend(p[:X])

q.sort(reverse=True)
if Y > B:
    eat.extend(q)
else:
    eat.extend(q[:Y])
loss = X+Y - len(eat)

# 足りない分を補充する
while loss > 0:
    r.sort(reverse=True)
    eat.append(r.pop(0))    
    loss -= 1

# rの方が大きいものがあれば入れ替える
eat.sort()
for i in range(len(eat)):
    r.sort(reverse=True)
    if len(r) != 0 and eat[i] < r[0]:
        eat[i] = r.pop(0)
    else:
        break

print(sum(eat))

Fixed submission:
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

eat = []

# 食べる
p.sort(reverse=True)
if X > A:
    eat.extend(p)
else:
    eat.extend(p[:X])

q.sort(reverse=True)
if Y > B:
    eat.extend(q)
else:
    eat.extend(q[:Y])
loss = X+Y - len(eat)

# 足りない分を補充する
while loss > 0:
    r.sort(reverse=True)
    eat.append(r.pop(0))    
    loss -= 1

# rの方が大きいものがあれば入れ替える
eat.sort()
r.sort()
for i in range(len(eat)):
    if len(r) != 0 and eat[i] < r[-1]:
        eat[i] = r.pop(-1)
    else:
        break

print(sum(eat))
Buggy python submission (verdict: Runtime Error):
import sys

def input():
    return sys.stdin.readline()[:-1]


n = int(input())

max_x = int(((2*n-3)**0.5-1)//1)
list_count = [0]*n
for x in range(1,max_x+1):
    for y in range(x, max_x+2-x):
        for z in range(y, max_x+2-x-y):
            s = x**2+y**2+z**2+x*y+y*z+z*x
            if s>=n:
                continue
            if len(set([x,y,z]))==3:
                list_count[s-1] += 6
            elif len(set([x,y,z]))==2:
                list_count[s-1] += 3
            else:
                list_count[s-1] += 1
for i in range(n):
    print(list_count[i])




Fixed submission:
import sys

def input():
    return sys.stdin.readline()[:-1]


n = int(input())
if n==1:
    print(0)
else:
    max_x = int(((2*n-3)**0.5-1)//1)
    list_count = [0]*n
    for x in range(1,max_x+1):
        for y in range(1, max_x+2-x):
            for z in range(1, max_x+2-x-y):
                s = x**2+y**2+z**2+x*y+y*z+z*x
                if s>n:
                    continue
                else:
                    list_count[s-1] += 1
    for i in range(n):
        print(list_count[i])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a_li = list(map(int, input().split()))

loop_li = []
a = 1 

while a not in loop_li:
    loop_li.append(a)
    a = a_li[a-1]

length = len(loop_li)
if k<length:
    print(loop_li[k])
else:
    bp = a_li[loop_li[-1]-1] # back point
    bp_idx = loop_li.index(bp)
    t = length - bp_idx
    amari = (k-bp_idx)%t
    print(loop_li[bp_idx+amari])

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

loop_li = []
loop_set = set([])
a = 1 

while a not in loop_set:
    loop_li.append(a)
    loop_set.add(a)
    a = a_li[a-1]

length = len(loop_li)
if k<length:
    print(loop_li[k])
else:
    bp = a_li[loop_li[-1]-1] # back point
    bp_idx = loop_li.index(bp)
    t = length - bp_idx
    amari = (k-bp_idx)%t
    print(loop_li[bp_idx+amari])
Buggy python submission (verdict: Runtime Error):
N=input()
N=int(N)
S=[100]*N
P=[100]*N
for num in range(N):
    S[num]=input().split()
    S[num].append(num+1)
    S[num][1]=int(S[num][1])

S.sort()
flag=0
flag2=0
while(flag==0):
    flag2=0
    for num in range(0,N-1):
        if(S[num][0]==S[num+1][0]):
            if(S[num][1]<S[num+1][1]):
                S[num],S[num+1]=S[num+1],S[num]
                flag2=1
    if(flag2==0):
        flag=1
    
            

for num in range(N):
    print(S[num][2])


Fixed submission:
A,P=input().split()
A=int(A)
P=int(P)
print((A*3+P)//2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
m = (10 ** 6 + 1)
cnt = [0] * m
for x in a:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    for i in range(x, m, x):
        cnt += 1
ans = 0
for x in a:
    if cnt[x] == 1:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = 10 ** 6 + 1
cnt = [0] * m
for x in a:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    for i in range(x, m, x):
        cnt[i] += 1
ans = 0
for x in a:
    if cnt[x] == 1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
cnt = 0
for i in a:
    flag = True
    for j in divisor(i):
        if j in a[a.index(i) + 1:]:
            flag = False
    if flag:
        cnt += 1
print(cnt)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = 10 ** 6 + 1
cnt = [0] * m
for x in a:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    for i in range(x, m, x):
        cnt[i] += 1
ans = 0
for x in a:
    if cnt[x] == 1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
cnt = 0
for i in a:
    flag = True
    for j in a[a.index(i) + 1:]:
        if i % j == 0:
            flag = False
    if flag:
        cnt += 1
print(cnt)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = 10 ** 6 + 1
cnt = [0] * m
for x in a:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    for i in range(x, m, x):
        cnt[i] += 1
ans = 0
for x in a:
    if cnt[x] == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for i in range(n):
    ans *= a[i]
if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

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

if 0 in a:
    print(0)
    exit()
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
cnt = 0
ans = 0
while cnt < k:
    if a > 0:
        a -= 1
        cnt += 1
        ans += 1
    elif b > 0:
        b -= 1
        cnt += 1
    elif c > 0:
        c -= 1
        cnt += 1
        ans -= 1
print(ans)

Fixed submission:
a, b, c, k = map(int, input().split())
ans = 0
ans += min(a, k)
ans -= max(0, k - a - b)
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
for a in range(-200, 200):
    for b in range(-200, 200):
        if a ** 5 - b ** 5 == x:
            print(a+" "+b)
            break

Fixed submission:
x = int(input())
for a in range(-200, 200):
    for b in range(-200, 200):
        if a ** 5 - b ** 5 == x:
            print(a, b)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())
ans = 0
for x in range(1, n+1):
    front = (a*x - (a*x)%b)//b
    back = ((x - x%b))//b
    ans = max(ans, front - back * a)
print(ans)


Fixed submission:
a, b, n = map(int, input().split())
if n < b - 1:
    print(a*(n%b)//b)
else:
    print(a*((b-1)%b)//b)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())
ans = 0
for i in range(n, 1, -1):
    ans = max(ans, ((a*i//b) - a*(i//b)))
print(ans)


Fixed submission:
a, b, n = map(int, input().split())
if n < b - 1:
    print(a*(n%b)//b)
else:
    print(a*((b-1)%b)//b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
ans = 0
for i in range(n):
    for j in range(i+1, n):
        if s[i] != s[j]:
            sa = j - i
            for k in range(j+1, n):
                if s[k] != s[j] and s[k] != s[i] and sa != k - j:
                    ans += 1
print(ans)


Fixed submission:
n = int(input())
s = input()

r = s.count("R")
g = s.count("G")
b = s.count("B")

ans = r * g * b

for i in range(n):
    for j in range(i+1, n):
        k = 2 * j - i
        if k < n:
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
print(c, a, b)


Fixed submission:
a, b, c = map(int, input().split())
print(c, a, b)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))
kitai = [0] * n
ans = 0
for i in range(n):
    kitai[i] += (p[i] + 1) / 2
for i in range(n):
    ans = max(sum(kitai[i:i+k]), ans)
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
kitai = [0] * n
ans = 0
for i in range(n):
    kitai[i] += (p[i] + 1) / 2
ruiseki = [0] * (n + 1)
for i in range(1, n + 1):
    ruiseki[i] += ruiseki[i - 1] + kitai[i - 1]
for i in range(n - k + 1):
    ans = max(ans, ruiseki[k + i] - ruiseki[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
while m > 0:
    M = max(a)
    tmp = a.index(M)
    a[tmp] = a[tmp] // 2
    m -= 1
print(sum(a))


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

pq = []
for a in A:
    heapq.heappush(pq, -a)#'-'にすることで最大値を考えることができる！
#print(pq)
for _ in range(m):
    a = (-heapq.heappop(pq)) // 2
    heapq.heappush(pq, -a)
print(-sum(pq))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
while m > 0:
    tmp = a.index(max(a))
    #print(tmp)
    a[tmp] = a[tmp] // 2
    m -= 1
print(sum(a))


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

pq = []
for a in A:
    heapq.heappush(pq, -a)#'-'にすることで最大値を考えることができる！
#print(pq)
for _ in range(m):
    a = (-heapq.heappop(pq)) // 2
    heapq.heappush(pq, -a)
print(-sum(pq))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    while m > 0:
        tmp = a.index(max(a))
        #print(tmp)
        a[tmp] = a[tmp] // 2
        m -= 1
print(sum(a))

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

pq = []
for a in A:
    heapq.heappush(pq, -a)#'-'にすることで最大値を考えることができる！
#print(pq)
for _ in range(m):
    a = (-heapq.heappop(pq)) // 2
    heapq.heappush(pq, -a)
print(-sum(pq))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
for i in range(n):
    while m > 0:
        a[i] = a[i] // 2
        a.sort(reverse = True)
        m -= 1
print(sum(a))

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

pq = []
for a in A:
    heapq.heappush(pq, -a)#'-'にすることで最大値を考えることができる！
#print(pq)
for _ in range(m):
    a = (-heapq.heappop(pq)) // 2
    heapq.heappush(pq, -a)
print(-sum(pq))
Buggy python submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

m, d = map(int, input().split())
ans = 0
for i in range(4, m + 1):
    for j in range(20, d + 1):
        if i == int(str(j)[0]) * int(str(j)[1]):
            ans += 1
print(ans)


Fixed submission:
m, d = map(int, input().split())
ans = 0
for i in range(4, m + 1):
    for j in range(22, d + 1):
        if str(j)[0] != "1" and str(j)[1] != "1":
            if i == int(str(j)[0]) * int(str(j)[1]):
                ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f
N = int(input())
v = list(map(int, input().split()))
v.sort()
tmp = v[0]
ave = 0
for i in range(1, N):
    tmp += v[i]
    ave = tmp / 2
    tmp = ave
print(ave)


Fixed submission:
N = int(input())
v = list(map(int, input().split()))
v.sort()
tmp = v[0]
ave = 0
for i in range(1, N):
    tmp += v[i]
    ave = tmp / 2
    tmp = ave
print(ave)