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

n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n) :
  a[i] *= -1

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

print(sum(a)*-1)

Fixed submission:
import heapq

n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n) :
  a[i] *= -1

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

print(sum(a)*-1)

Buggy python submission (verdict: Time Limit Exceeded):
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)
  at = -1*(-1*heapq.heappop(a)//2)
  heapq.heappush(a, at)

print(sum(a)*-1)

Fixed submission:
import heapq

n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n) :
  a[i] *= -1

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

print(sum(a)*-1)

Buggy python submission (verdict: Time Limit Exceeded):
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)
  at = -1*(-1*heapq.heappop(a)//2)
  heapq.heappush(a, at)

print(sum(a)*-1)

Fixed submission:
import heapq

n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n) :
  a[i] *= -1

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

print(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) :
  a[n-1] = a[n-1]//2
  b = a[0:n-1]
  index = bisect.bisect_right(b,a[n-1])
  a.insert(index,a[n-1])
  del a[-1]

print(sum(a))

Fixed submission:
import heapq

n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n) :
  a[i] *= -1

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

print(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) :
  a[n-1] = a[n-1]//2
  b = a[0:n-1]
  index = bisect.bisect_right(b,a[n-1])
  if index == n-1 :
    continue
  at = a[index]
  a[index] = a[n-1]
  a[index+2:n] = a[index+1:n-1]
  a[index+1] = at

print(sum(a))

Fixed submission:
import heapq

n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n) :
  a[i] *= -1

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

print(sum(a)*-1)

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

for i in range(m) :
  index = a.index(max(a))
  a[index] = a[index]//2
  
print(sum(a))

Fixed submission:
import heapq

n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n) :
  a[i] *= -1

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

print(sum(a)*-1)

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

for i in range(m) :
  index = a.index(max(a))
  a[index] = a[index]//2
  
print(sum(a))

Fixed submission:
import heapq

n,m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n) :
  a[i] *= -1

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

print(sum(a)*-1)