Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    tmp_max = a.pop()
    bisect.insort(a, tmp_max // 2)
print(sum(a))

Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
import math
import heapq
 
n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
for i in range(m):
    heapq.heapify(A)
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)
 
 
print(int(sum(A))*(-1))

Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    tmp_max = a.pop()
    bisect.insort(a, tmp_max // 2)
print(sum(a))

Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))

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

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
for i in range(m):
    heapq.heapify(A)
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))


Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))

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

n, m = map(int, input().split())
A = list(map(int, input().split()))
As = sorted(A, reverse = True)
aas = As[0:m]
bs = As[m:]
for i in range(m):
    ii = math.floor(aas[0]/2)
    aas[0] = ii
    if len(aas) > 1:
        if aas[0] < aas[1]:
            aas = sorted(aas, reverse=True)


print(int(sum(aas)+sum(bs)))


Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))

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

n, m = map(int, input().split())
A = list(map(int, input().split()))
As = sorted(A, reverse = True)
for i in range(m):
    ii = math.floor(As[0]/2)
    As[0] = ii
    if len(As) > 1:
        if As[0] < As[1]:
            As = sorted(As, reverse=True)


print(int(sum(As)))


Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))

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

n, m = map(int, input().split())
A = list(map(int, input().split()))
As = sorted(A, reverse = True)
for i in range(m):
    ii = math.floor(As[0]/2)
    As[0] = ii
    if As[0] < As[1]:
        As = sorted(As, reverse=True)


print(int(sum(As)))


Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
import math
 
n, m = map(int, input().split())
A = list(map(int, input().split()))
 
for i in range(m):
    mm = max(A)
    ii = math.floor(mm/2)
    ind = A.index(mm)
    A[ind] = ii
 
print(int(sum(A)))

Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))

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

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

for i in range(m):
    mm = max(A)
    ii = math.floor(mm/2)
    ind = A.index(mm)
    A[ind] = ii

print(int(sum(A)))


Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))