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

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, -(-a//2))
    if sum(A) == 0:
        break
    
print(-sum(A))

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

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, -(-a//2))

print(-sum(A))

Buggy python submission (verdict: Runtime Error):
import heapq
N, M = [int(_) for _ in input().split()]
A = [-int(_) for _ in input().split()]

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, -(-a//2))
    print(A)
    if sum(A) == 0:
        break
    
print(-sum(A))

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

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, -(-a//2))

print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
A = list(map(int, input().split()))
value = sum(A)
A.append(-1)

cards = M

for i in range(M):
    A = sorted(A,reverse=True)
    p = 0
    while A[p] == max(A) > 0 and cards >= 1:
        A[p] //= 2
        p += 1
        cards -= 1
    if cards == 0 or max(A) == 0:
        break

A.pop()
print(sum(A))

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

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, -(-a//2))

print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
A = list(map(int, input().split()))
value = sum(A)
A.append(-10**9)

cards = M

for i in range(M):
    A = sorted(A,reverse=True)
    p = 0
    while A[p] == max(A) and cards >= 1:
        A[p] //= 2
        p += 1
        cards -= 1
    if cards == 0 or max(A) == 0:
        break

A.pop()
print(sum(A))

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

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, -(-a//2))

print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
A = sorted(list(map(int, input().split())),reverse=True)
value = sum(A)

for i in range(M):
    value = value-max(A)+max(A)//2
    for j in range(N):
        if A[j] == max(A):
            A[j] //= 2
            break

print(value)

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

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, -(-a//2))

print(-sum(A))

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

for i in range(M):
    A[0] //= 2
    A = sorted(A,reverse=True)

print(sum(A))

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

heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, -(-a//2))

print(-sum(A))