Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()

A.sort(reverse=True)

index = 0
for i in range(M):
    A[index] = A[index] // 2
    aMax = A[index]
    for j in range(N):
        if aMax < A[i]:
            aMax = A[i]
            index = i
            break

print(sum(A))

Fixed submission:
import heapq
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()
h = []
for i in range(N):
    heapq.heappush(h, -A[i])

for i in range(M):
    tmp = heapq.heappop(h)
    tmp = -(-tmp // 2)
    heapq.heappush(h, tmp)


print(-sum(h))

Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()

A.sort(reverse=True)

index = 0
for i in range(M):
    A[index] = A[index] // 2
    aMax = A[index]
    for j in range(N):
        if aMax < A[i]:
            aMax = A[i]
            index = i
            break

print(sum(A))

Fixed submission:
import heapq
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()
h = []
for i in range(N):
    heapq.heappush(h, -A[i])

for i in range(M):
    tmp = heapq.heappop(h)
    tmp = -(-tmp // 2)
    heapq.heappush(h, tmp)


print(-sum(h))

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

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()

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

print(sum(A))

Fixed submission:
import heapq
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()
h = []
for i in range(N):
    heapq.heappush(h, -A[i])

for i in range(M):
    tmp = heapq.heappop(h)
    tmp = -(-tmp // 2)
    heapq.heappush(h, tmp)


print(-sum(h))

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

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()

A.sort(reverse=True)
for i in range(M):
    A[0] = (A[0]) // (2)
    if A[0] < A[1]:
        A.sort(reverse=True)

print(sum(A))

Fixed submission:
import heapq
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()
h = []
for i in range(N):
    heapq.heappush(h, -A[i])

for i in range(M):
    tmp = heapq.heappop(h)
    tmp = -(-tmp // 2)
    heapq.heappush(h, tmp)


print(-sum(h))

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(M):
    A[0] = (A[0]) // (2)
    A.sort(reverse=True)

print(sum(A))

Fixed submission:
import heapq
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()
h = []
for i in range(N):
    heapq.heappush(h, -A[i])

for i in range(M):
    tmp = heapq.heappop(h)
    tmp = -(-tmp // 2)
    heapq.heappush(h, tmp)


print(-sum(h))

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(M):
    A[0] = (A[0]) // (2)
    A.sort(reverse=True)

print(sum(A))

Fixed submission:
import heapq
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()
h = []
for i in range(N):
    heapq.heappush(h, -A[i])

for i in range(M):
    tmp = heapq.heappop(h)
    tmp = -(-tmp // 2)
    heapq.heappush(h, tmp)


print(-sum(h))