Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import collections

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


def main(n: int, a: list):
    counter = collections.Counter(a)
    pairs = {k: v * (v - 1) / 2 for k, v in counter.items()}

    counted = {}

    for i in range(N):

        target = a[i]

        if target not in counted.keys():
            temp = pairs.copy()

            v = counter[target] - 1
            temp[target] = v * (v - 1) / 2

            pair_cnt = sum(temp.values())
            counted.update({target: pair_cnt})
        else:
            pair_cnt = counted[target]

        print(int(pair_cnt))


main(N, A)


Fixed submission:
import collections

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


def main(n: int, a: list):
    counter = collections.Counter(a)
    pairs = {k: v * (v - 1) / 2 for k, v in counter.items()}
    pairs_all = sum(pairs.values())

    for i in range(N):
        k = a[i]
        v = counter[k] - 1
        pair_cnt = pairs_all - pairs[k] + (v * (v - 1) / 2)

        print(int(pair_cnt))


main(N, A)

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

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


def main(n: int, a: list):
    counter = collections.Counter(a)
    pairs = {k: v * (v - 1) / 2 for k, v in counter.items()}

    for i in range(N):

        temp = pairs.copy()

        target = a[i]
        v = counter[target] - 1
        temp[target] = v * (v - 1) / 2

        pair_cnt = sum(temp.values())
        print(int(pair_cnt))


main(N, A)


Fixed submission:
import collections

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


def main(n: int, a: list):
    counter = collections.Counter(a)
    pairs = {k: v * (v - 1) / 2 for k, v in counter.items()}
    pairs_all = sum(pairs.values())

    for i in range(N):
        k = a[i]
        v = counter[k] - 1
        pair_cnt = pairs_all - pairs[k] + (v * (v - 1) / 2)

        print(int(pair_cnt))


main(N, A)

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

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


def main(n: int, a: list):
    for i in range(N):
        b = a.copy()
        b.pop(i)

        counter = collections.Counter(b)

        # print(counter)

        pair_cnt = 0
        for k, v in counter.items():
            pair_cnt += v * (v - 1) / 2

        print(int(pair_cnt))


main(N, A)


Fixed submission:
import collections

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


def main(n: int, a: list):
    counter = collections.Counter(a)
    pairs = {k: v * (v - 1) / 2 for k, v in counter.items()}
    pairs_all = sum(pairs.values())

    for i in range(N):
        k = a[i]
        v = counter[k] - 1
        pair_cnt = pairs_all - pairs[k] + (v * (v - 1) / 2)

        print(int(pair_cnt))


main(N, A)
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = map(int, input().split(' '))


def main():
    blue = red = 0

    for i in range(10 ** 100):
        blue += A

        if blue + red > N:
            blue -= blue + red - N
            break

        red += B

        if blue + red > N:
            red -= blue + red - N
            break

    return blue


print(main())


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


def main():
    blue = (N // (A+B)) * A

    blue += min(A, N % (A+B))

    return blue


print(main())
Buggy python submission (verdict: Runtime Error):
import math

a, b = map(int, input().split(' '))


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


print(lcm(a, b))

Fixed submission:
from fractions import gcd


def lcm(x, y):
    return (x * y) // gcd(x, y)


a, b = map(int, input().split(' '))

print(lcm(a, b))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = [int(li) for li in input().split(' ')]
cnt = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        # print('check', L[i], L[j])
        kcnt = sum([1 for li in L[j + 1:N] if li < L[i] + L[j] and L[i] < li + L[j] and L[j] < li + L[i]])
        # print('ok', [li for li in L[j + 1:N] if li < L[i] + L[j]])
        cnt += kcnt

print(cnt)


Fixed submission:
import bisect

N = int(input())
L = [int(li) for li in input().split(' ')]
LMAX = 10 ** 3

L.sort()
# print(L)
ans = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        # 1,2番目の棒を長い順に決める
        # 3番目の棒として満たす
        lin = L[i] + L[j]

        ind = bisect.bisect_left(L, lin)
        ans += ind-j-1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = [int(li) for li in input().split(' ')]
cnt = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            if L[i] < L[j] + L[k] and L[j] < L[i] + L[k] and L[k] < L[i] + L[j]:
                cnt += 1

print(cnt)

Fixed submission:
import bisect

N = int(input())
L = [int(li) for li in input().split(' ')]
LMAX = 10 ** 3

L.sort()
# print(L)
ans = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        # 1,2番目の棒を長い順に決める
        # 3番目の棒として満たす
        lin = L[i] + L[j]

        ind = bisect.bisect_left(L, lin)
        ans += ind-j-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split(' ')))

students = []

for i in range(1, N + 1):
    students.append(str(A.index(i) + 1))

print(' '.join(iter(students)))


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

students = [None] * N

for i, a in enumerate(A):
    students[a - 1] = str(i + 1)

print(' '.join(iter(students)))
Buggy python submission (verdict: Time Limit Exceeded):
# from pprint import pprint
# import math
# import collections

# n = int(input())
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))

for _m in range(m):
    a = sorted(a, reverse=True)

    a[0] = a[0] // 2

ans = sum(a)
print(ans)


Fixed submission:
# from pprint import pprint
import math

# import collections

# n = int(input())
n, m = map(int, input().split(' '))
a = list(map(lambda x: int(x) * (-1), input().split(' ')))
# a = sorted(a, reverse=True)
# b = [math.log2(_a) for _a in a]


import heapq

q_a = heapq.heapify(a)

for m in range(m):
    x = heapq.heappop(a) * (-1)
    heapq.heappush(a, (x // 2) * (-1))

print(sum(a) * (-1))
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = input().split(' ')

for i in reversed(range(n)):
    if i < n - 1:
        if int(h[i]) > int(h[i + 1]):
            h[i] -= 1
            if int(h[i]) > int(h[i + 1]):
                print('No')
                exit()

print('Yes')

Fixed submission:
n = int(input())
h = input().split(' ')

for i in reversed(range(n)):
    if i < n - 1:

        h[i] = int(h[i])
        h[i + 1] = int(h[i + 1])

        if h[i] > h[i + 1]:
            h[i] -= 1
            if h[i] > h[i + 1]:
                print('No')
                exit()

print('Yes')

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = map(lambda x: int(x), input().split(' '))
flg = 0

for i in range(n):
    if i > 0:
        if h[i + 1] >= h[i]:
            pass
        else:
            if flg == 1:
                print('No')
                continue
            h[i] -= 1
            flg = 1

            if h[i + 1] >= h[i]:
                pass
            else:
                print('No')


Fixed submission:
n = int(input())
h = input().split(' ')

for i in reversed(range(n)):
    if i < n - 1:

        h[i] = int(h[i])
        h[i + 1] = int(h[i + 1])

        if h[i] > h[i + 1]:
            h[i] -= 1
            if h[i] > h[i + 1]:
                print('No')
                exit()

print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
# from pprint import pprint
# import math
import collections

# n = int(input())
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = [None] * m
c = [None] * m
for i in range(m):
    _b, _c = map(int, input().split(' '))
    b[i] = _b
    c[i] = _c

for j in range(m):
    l = [c[j]] * b[j]
    a.extend(l)

a2 = list(sorted(a, reverse=True))[:n]

# print(a2)
print(sum(a2))


Fixed submission:
# from pprint import pprint
# import math
import collections

# n = int(input())
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = [None] * m
c = [None] * m
for i in range(m):
    _b, _c = map(int, input().split(' '))
    b[i] = _b
    c[i] = _c

# # リストに連結していって最後に大きい順に出力
# for j in range(m):
#     l = [c[j]] * b[j]
#     a.extend(l)


cnt = collections.Counter(a)

# カウンターのdictのみ更新
for j in range(m):
    cnt.update({c[j]: b[j]})

a_tup = cnt.items()

# print(a_tup)

# カウンターの結果を逆順にして合計n個になるまで取り出して加算
res = 0
num_cnt = 0
for _ in sorted(a_tup, reverse=True):
    res += _[0] * _[1]
    num_cnt += _[1]

    if num_cnt >= n:
        res -= _[0] * (num_cnt - n)
        break

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
# from pprint import pprint
# import math
import collections

# n = int(input())
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = [None] * m
c = [None] * m
for i in range(m):
    _b, _c = map(int, input().split(' '))
    b[i] = _b
    c[i] = _c


def update_list(c):
    a.pop(a.index(min(a)))
    a.append(c)


for j in range(m):
    # 数字の登場個数を数える
    cnt = collections.Counter(a)

    for _ in range(b[j]):
        # cjより小さい数字がaにあれば更新する
        if min(cnt.keys()) < c[j]:
            update_list(c[j])

print(sum(a))

Fixed submission:
# from pprint import pprint
# import math
import collections

# n = int(input())
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = [None] * m
c = [None] * m
for i in range(m):
    _b, _c = map(int, input().split(' '))
    b[i] = _b
    c[i] = _c

# # リストに連結していって最後に大きい順に出力
# for j in range(m):
#     l = [c[j]] * b[j]
#     a.extend(l)


cnt = collections.Counter(a)

# カウンターのdictのみ更新
for j in range(m):
    cnt.update({c[j]: b[j]})

a_tup = cnt.items()

# print(a_tup)

# カウンターの結果を逆順にして合計n個になるまで取り出して加算
res = 0
num_cnt = 0
for _ in sorted(a_tup, reverse=True):
    res += _[0] * _[1]
    num_cnt += _[1]

    if num_cnt >= n:
        res -= _[0] * (num_cnt - n)
        break

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
# from pprint import pprint
# import math
# import collections

n = int(input())
# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))
a = []
for i in range(n):
    a.append(int(input()))

l = []
for _a in a:
    if _a in l:
        l.remove(_a)
    else:
        l.append(_a)

print(len(l))

Fixed submission:
# from pprint import pprint
# import math
# import collections

n = int(input())
# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))
a = []
for i in range(n):
    a.append(int(input()))

l = {}
for _a in a:
    if _a in l:
        l.pop(_a)
    else:
        l.update(
            {_a: True}
        )

print(len(l))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

pushed = [False] * N
pushed[0] = True
now = 0
cnt = 0
while True:
    next = A[now] - 1
    if pushed[next]:
        cnt = -1
        break

    if next != 1:
        now = next
        cnt += 1

    if next == 1:
        cnt += 1
        break

print(cnt)


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

pushed = [False] * N
pushed[0] = True
now = 0
cnt = 0

while True:
    next = A[now] - 1

    if pushed[next]:
        cnt = -1
        break

    if next == 1:
        cnt += 1
        break

    if next != 1:
        now = next
        pushed[next] = True
        cnt += 1


print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n >= 30:
  print('Yes')
  else:
    print('No')

Fixed submission:
n = int(input())
if n >= 30:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
checker = False
for i in range(10 ** 6):
    n = int('7' * (i + 1))
    if n % K == 0:
        checker = True
        break
    
if checker:
    print(len(str(n)))
else:
    print(-1)

Fixed submission:
K = int(input())

cur = 7
flg = False
for i in range(10 ** 6):
    mod = cur % K
    if mod == 0:
        ans = i + 1
        flg = True
        break
    else:
        cur = mod * 10 + 7

if flg:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
def print_ans(num):
#     num = int(input())
    base = 26

    checker = True
    ind = 1
    while checker:
        if num > base ** ind:
            ind += 1
        else:
            checker = False
            ind -= 1

    pre_ans_num = []
    for i in range(ind):
        ind_2 = ind - i
        quot = num // base ** ind_2
        pre_ans_num.append(quot)
        num = num % base ** ind_2
    pre_ans_num.append(num)

    ans = ""
    
#     print(pre_ans_num)
    pre_ans_num2 = pre_ans_num.copy()
    for i , ans_num in enumerate(pre_ans_num):
#         print(i, ans_num)
        pre_ans_num2[i - 1] += -1
        
    for n in pre_ans_num2:
        if n==0:
            ans += "z"
        else:
            order = ord("a") + n - 1
            ans += chr(order)

    print(ans)

a = str(input())
print_ans(a)

Fixed submission:
N = int(input())
ans = ''
for i in range(1, 10000):
#     print(N)
#     print("-> ",26 ** i)
    if N <= 26 ** i: 
#         print("ok")
        N += -1
        for j in range(i):
#             print("N:", N)
#             print("N % 26:", N % 26)
            ans += chr(ord('a') + N % 26)
            N = N // 26  # 26で割った商
        break
    else:
        N -= 26 ** i

print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
num = int(input())
base = 26

checker = True
ind = 1
while checker:
  if num > base ** ind:
    ind += 1
  else:
    checker = False
    ind += -1

pre_ans_num = []
for i in range(ind):
  ind_2 = ind - i
  quot = num // base ** ind_2
  pre_ans_list.append(quot)
  num = a % base ** ind_2

ans = ""
for n in pre_ans_num:
  if n==0:
    ans += "0"
  else:
    order = ord("a") + n - 1
    ans += chr(order)

print(ans)
    

Fixed submission:
N = int(input())
ans = ''
for i in range(1, 10000):
#     print(N)
#     print("-> ",26 ** i)
    if N <= 26 ** i: 
#         print("ok")
        N += -1
        for j in range(i):
#             print("N:", N)
#             print("N % 26:", N % 26)
            ans += chr(ord('a') + N % 26)
            N = N // 26  # 26で割った商
        break
    else:
        N -= 26 ** i

print(ans[::-1])
Buggy python submission (verdict: Runtime Error):
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = (hour + minute/60) * 360/12
arg_m = minute * 360/60

diff_arg_abs = abs(arg_h - arg_m)
if diff_arg_abs > 180:
    diff_arg = diff_arg_abs - 180
elif diff_arg_abs < 180:
    diff_arg = diff_arg_abs
else:
    print(0)
    exit
    
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(math.radians(diff_arg)) 
ans = math.sqrt(ans_square)
print(ans)

Fixed submission:
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = (hour + minute/60) * 360/12
arg_m = minute * 360/60

diff_arg = abs(arg_h - arg_m)
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(math.radians(diff_arg)) 
ans = math.sqrt(ans_square)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = hour * 30 + minute * 0.5
arg_m = minute * 6

diff_arg_abs = abs(arg_h - arg_m)
if diff_arg_abs > 180:
    diff_arg = diff_arg_abs -180
    print(diff_arg)
elif diff_arg_abs < 180:
    diff_arg = diff_arg_abs
    print(diff_arg)
else:
    print(0)
    exit
    
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(math.radians(diff_arg)) 
ans = math.sqrt(ans_square)
print(ans)

Fixed submission:
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = (hour + minute/60) * 360/12
arg_m = minute * 360/60

diff_arg = abs(arg_h - arg_m)
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(math.radians(diff_arg)) 
ans = math.sqrt(ans_square)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = hour * 30 + minute * 0.5
arg_m = minute * 6

diff_arg_abs = abs(arg_h - arg_m)
if diff_arg_abs > 180:
    diff_arg = diff_arg_abs -180
elif diff_arg_abs < 180:
    diff_arg = diff_arg_abs
else:
    print(0)
    exit
    
diff_arg_rad = diff_arg / 180 * pi
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(diff_arg_rad) 
ans = math.sqrt(ans_square)
print(ans)

Fixed submission:
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = (hour + minute/60) * 360/12
arg_m = minute * 360/60

diff_arg = abs(arg_h - arg_m)
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(math.radians(diff_arg)) 
ans = math.sqrt(ans_square)
print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np

N_book, M_algo, X_skill = map(int, input().split())  

A = []
for _ in range(N_book):
    a = list(map(int, input().split()))
    A.append(a)

flg = False
ans = float('inf')
for selector in list(itertools.product([1, 0], repeat=N_book))[:-1]:
    C = []
    for i in range(N_book):
        if selector[i] == 1:
            C.append(A[i])
    
    D = list(np.array(C).sum(axis=0))
    if (False in [i >= X_skill for i in D[1:]]):
        continue
    else:
        flg = True
        ans = min(ans, D[0])

if flg:
    print(ans)
else:
    print(-1)

Fixed submission:
import itertools
import numpy as np

N_book, M_algo, X_skill = map(int, input().split())  

A = []
for _ in range(N_book):
    a = list(map(int, input().split()))
    A.append(a)

flg = False
ans = float('inf')
for selector in list(itertools.product([1, 0], repeat=N_book))[:-1]:
    C = []
    for i in range(N_book):
        if selector[i] == 1:
            C.append(A[i])
    
    D = list(np.array(C).sum(axis=0))
    if (False in [i >= X_skill for i in D[1:]]):
        continue
    else:
        flg = True
        ans = min(ans, D[0])

if flg:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N = str(input())
if N.isin('7'):
    print("Yes")
else:
    print("No")

Fixed submission:
N = str(input())
if '7' in N:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(_) for _ in input().split(" ")]
 
ans = sorted(range(1, len(A) + 1), key=lambda x:A[x - 1])
print(*ans)

Fixed submission:
N = int(input())

if N == 1:
    print(1)
elif N % 2 == 1:
    print((N // 2 + 1) / N)
else:
    print(0.5)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [str(_) for _ in input().split(" ")]

ans = [0 for _ in range(N)] 
for i in range(N):
    ans[i] = (str(A.index(str(i + 1)) + 1))

print(" ".join(ans))

Fixed submission:
import numpy as np

N = int(input())
A = [int(_) for _ in input().split(" ")]

ans = np.argsort(A)

for i in range(N):
    print(ans[i] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [str(_) for _ in input().split(" ")]

ans = [] 
for i in range(N):
    ans.append(str(A.index(str(i + 1)) + 1))

print(" ".join(ans))

Fixed submission:
import numpy as np

N = int(input())
A = [int(_) for _ in input().split(" ")]

ans = np.argsort(A)

for i in range(N):
    print(ans[i] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split(" "))
A = [int(input()) for i in range(Q)]

tmp = []
for i in range(N):
    tmp.append(A.count(i+1)) #正解数
# 得点は, 最初の点数 - 他人の正解数
# 他人の正解数は, 問題数 - 自分の正解数
# 得点は, 最初の点数 - 問題数 + 自分の正解数
# 得点 > 0 であれば, "Yes"
for i in range(N):
    if K - Q + tmp[i] > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N, K, Q = map(int, input().split(" "))    # N:人数, K:初期スコア, Q:問題数
A = [int(input()) for i in range(Q)]    # 正解者のリスト
B = [0 for i in range(N)]    # 正解数

for i in range(Q):
    num_ans_person = A[i] - 1
    B[num_ans_person] += 1

# 得点は, 最初の点数 - 他人の正解数
# 他人の正解数は, 問題数 - 自分の正解数
# 得点は, 最初の点数 - 問題数 + 自分の正解数
# 得点 > 0 であれば, "Yes"
for i in range(N):
    if K - Q + B[i] > 0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split(" "))
A = [int(input()) for i in range(Q)]

score = [K for i in range(N)]

for i in range(Q):
    num_ans_person = A[i] - 1
    score[num_ans_person] += 1
    for j in range(len(score)):
        score[j] += -1

for i in range(N):
    if score[i] > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N, K, Q = map(int, input().split(" "))    # N:人数, K:初期スコア, Q:問題数
A = [int(input()) for i in range(Q)]    # 正解者のリスト
B = [0 for i in range(N)]    # 正解数

for i in range(Q):
    num_ans_person = A[i] - 1
    B[num_ans_person] += 1

# 得点は, 最初の点数 - 他人の正解数
# 他人の正解数は, 問題数 - 自分の正解数
# 得点は, 最初の点数 - 問題数 + 自分の正解数
# 得点 > 0 であれば, "Yes"
for i in range(N):
    if K - Q + B[i] > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

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

for i in range(M):
    heapq.heapify(A)
    heapq.heappush(A, -(-heapq.heappop(A)// 2))

print(-sum(A))

Fixed submission:
import heapq

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

heapq.heapify(A)

for i in range(M):
    heapq.heappush(A, -(-heapq.heappop(A)// 2))
    
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
import math
import heapq

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

for i in range(M):
    print(A)
    heapq.heapify(A)
    heapq.heappush(A, -(-heapq.heappop(A)// 2))

print(-sum(A))

Fixed submission:
import heapq

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

heapq.heapify(A)

for i in range(M):
    heapq.heappush(A, -(-heapq.heappop(A)// 2))
    
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split(" "))
A = [int(_) for _ in input().split(" ")]

for i in range(M):
    tmp_index = A.index(max(A))
    A[tmp_index] = A[tmp_index] // 2    # ここが修正箇所

print(sum(A))

Fixed submission:
import heapq

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

heapq.heapify(A)

for i in range(M):
    heapq.heappush(A, -(-heapq.heappop(A)// 2))
    
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import math
import heapq

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

for i in range(M):
    heapq.heapify(A)
    heapq.heappush(A, heapq.heappop(A)/2)

B = [math.floor(-A[i]) for i in range(len(A))]
print(sum(B))

Fixed submission:
import heapq

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

heapq.heapify(A)

for i in range(M):
    heapq.heappush(A, -(-heapq.heappop(A)// 2))
    
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split(" "))
A = [int(i) for i in input().split(" ")]

for i in range(M):
    tmp_index = A.index(max(A))
    A[tmp_index] = A[tmp_index] / 2
    
import math
B = [math.floor(A[i]) for i in range(len(A))]
print(sum(B))

Fixed submission:
import heapq

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

heapq.heapify(A)

for i in range(M):
    heapq.heappush(A, -(-heapq.heappop(A)// 2))
    
print(-sum(A))
Buggy python submission (verdict: Runtime Error):
distance = []
for i in range(4):
    for j in range(i + 1, 4):
        distance.append(anntena[j] - anntena[i])
    
tmp = [i for i in distance if i  > k ]
if len(tmp) == 0:
    print("Yay!")
else:
    print(":(")

Fixed submission:
anntena  = [int(input()) for i in range(5)]
k = int(input())

distance = []
for i in range(4):
    for j in range(i + 1, 5):
        distance.append(anntena[j] - anntena[i])
    
tmp = [i for i in distance if i  > k ]
if len(tmp) == 0:
    print("Yay!")
else:
    print(":(")