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

n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))

for i in range(m):
    a = A.pop(-1)
    a //= 2
    bisect.insort_left(A, a)

print(sum(A))


Fixed submission:
import heapq

n, m = map(int, input().split())
A = sorted(list(map(lambda x: int(x)*(-1), input().split())))

heapq.heapify(A)

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

print(-sum(A))

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

n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))

for i in range(m):
    a = A.pop(-1)
    a /= 2
    bisect.insort_left(A, a)

A = map(int, A)

print(sum(A))


Fixed submission:
import heapq

n, m = map(int, input().split())
A = sorted(list(map(lambda x: int(x)*(-1), input().split())))

heapq.heapify(A)

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

print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))

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

A = map(int, A)

print(sum(A))


Fixed submission:
import heapq

n, m = map(int, input().split())
A = sorted(list(map(lambda x: int(x)*(-1), input().split())))

heapq.heapify(A)

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

print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))

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

A = map(int, A)

print(sum(A))


Fixed submission:
import heapq

n, m = map(int, input().split())
A = sorted(list(map(lambda x: int(x)*(-1), input().split())))

heapq.heapify(A)

for i in range(m):
    a = heapq.heappop(A)
    a = a * (-1) // 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()))

while m > 0:
    i = A.index(max(A))
    A[i] = A[i]//2
    m -= 1

print(sum(A))


Fixed submission:
import heapq

n, m = map(int, input().split())
A = sorted(list(map(lambda x: int(x)*(-1), input().split())))

heapq.heapify(A)

for i in range(m):
    a = heapq.heappop(A)
    a = a * (-1) // 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 = sorted(A, reverse=True)

while m > 0:
    A[0] = A[0]//2
    m -= 1
    if A[0] < A[1]:
        A = sorted(A, reverse=True)

print(sum(A))

Fixed submission:
import heapq

n, m = map(int, input().split())
A = sorted(list(map(lambda x: int(x)*(-1), input().split())))

heapq.heapify(A)

for i in range(m):
    a = heapq.heappop(A)
    a = a * (-1) // 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()))

while m > 0:
    A = sorted(A, reverse=True)
    A[0] = A[0]//2
    m -= 1

print(sum(A))


Fixed submission:
import heapq

n, m = map(int, input().split())
A = sorted(list(map(lambda x: int(x)*(-1), input().split())))

heapq.heapify(A)

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

print(-sum(A))