Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

nA = np.array(A)
nA = np.sort(nA)

for i in range(M):
    a = nA[-1]//2
    nA = np.delete(nA, -1)
    idx = np.searchsorted(nA, a)
    nA = np.insert(nA, idx, a)

print(np.sum(nA))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

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

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

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

A.sort()

for i in range(M):
    a = A.pop()//2
    idx = bisect_right(A, a)
    A.insert(idx, a)

print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

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

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
    if N>1 and A[0]<A[1]:
        A.sort(reverse=True)

print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

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

Buggy python submission (verdict: Runtime Error):
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
    if A[0]<A[1]:
        A.sort(reverse=True)

print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

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

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

A.sort()

for i in range(M):
    A[-1] = A[-1]//2
    A.sort()

print(sum(A))


Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

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

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

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

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

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)

ans = 0
print(sum([int(i) for i in A]))




Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

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

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)

ans = 0
for i in A:
    ans += int(i)

print(ans)



Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda a: int(a)*(-1), input().split()))

heapq.heapify(A)

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