Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
N, M=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
for i in range(M):
  tmp=A[-1]//2
  A.pop(N-1)
  A.insert(bisect_left(A, tmp), tmp)
  if A[-1]==0:
    break
print(sum(A))

Fixed submission:
import heapq
N, M=map(int, input().split())
A=list(map(int, input().split()))
A=list(map(lambda x: -x, A))
heapq.heapify(A)
for i in range(M):
  heapq.heappush(A, (heapq.heappop(A)+1)//2)
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left
N, M=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
for i in range(M):
  tmp=A[-1]//2
  A.pop(N-1)
  A.insert(bisect_left(A, tmp), tmp)
  if A[-1]=0:
    break
print(sum(A))

Fixed submission:
import heapq
N, M=map(int, input().split())
A=list(map(int, input().split()))
A=list(map(lambda x: -x, A))
heapq.heapify(A)
for i in range(M):
  heapq.heappush(A, (heapq.heappop(A)+1)//2)
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N, M=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
if N==1:
  print(A[0]//(2**M))
else:
  while M>0:
    while M>0 and A[-1]>=A[-2]:
      A[-1]=A[-1]//2
      M-=1
    A.sort()
  print(sum(A))

Fixed submission:
import heapq
N, M=map(int, input().split())
A=list(map(int, input().split()))
A=list(map(lambda x: -x, A))
heapq.heapify(A)
for i in range(M):
  heapq.heappush(A, (heapq.heappop(A)+1)//2)
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
N, M=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
if N==1:
  print(A[0]//(2**M))
else:
  while M>0:
    while M>0 and A[-1]>=A[-2]:
      A[-1]=A[-1]//2
      M-=1
    idx=bisect_left(A, A[-1])
    A.insert(idx, A[-1])
    A.pop()
  print(sum(A))

Fixed submission:
import heapq
N, M=map(int, input().split())
A=list(map(int, input().split()))
A=list(map(lambda x: -x, A))
heapq.heapify(A)
for i in range(M):
  heapq.heappush(A, (heapq.heappop(A)+1)//2)
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
N, M=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
if N==1:
  print(A[0]//(2**M))
else:
  while M>0:
    while M>0 and A[-1]>=A[-2]:
      A[-1]=A[-1]//2
      M-=1
    idx=bisect_left(A, A[-1])
    A.insert(idx, A[-1])
    A.pop()
  print(sum(A))

Fixed submission:
import heapq
N, M=map(int, input().split())
A=list(map(int, input().split()))
A=list(map(lambda x: -x, A))
heapq.heapify(A)
for i in range(M):
  heapq.heappush(A, (heapq.heappop(A)+1)//2)
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left
N, M=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
while M>0:
  while M>0 and A[-1]>A[-2]:
    A[-1]=A[-1]//2
    M-=1
  idx=bisect_left(A, A[-1])
  A.insert(idx, A[-1])
  A.pop()
print(sum(A))

Fixed submission:
import heapq
N, M=map(int, input().split())
A=list(map(int, input().split()))
A=list(map(lambda x: -x, A))
heapq.heapify(A)
for i in range(M):
  heapq.heappush(A, (heapq.heappop(A)+1)//2)
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
N, M=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
for i in range(M):
  A[-1]=A[-1]//2
  idx=bisect_left(A, A[-1])
  A.insert(idx, A[-1])
  A.pop()
print(sum(A))

Fixed submission:
import heapq
N, M=map(int, input().split())
A=list(map(int, input().split()))
A=list(map(lambda x: -x, A))
heapq.heapify(A)
for i in range(M):
  heapq.heappush(A, (heapq.heappop(A)+1)//2)
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(int, input().split()))
A=list(map(lambda x: -x, A))
heapq.heapify(A)
for i in range(M):
  heapq.heappush(A, (heapq.heappop(A)+1)//2)
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(int, input().split()))
A=list(map(lambda x: -x, A))
heapq.heapify(A)
for i in range(M):
  heapq.heappush(A, (heapq.heappop(A)+1)//2)
print(-sum(A))