Buggy python submission (verdict: Runtime Error):
import sys
import heapq
input = sys.stdin.readline

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

for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))

print(sum(a)*(-1))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] *= -1
heapq.heapify(a)
 
for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))
    
print(sum(a)*(-1))

Buggy python submission (verdict: Runtime Error):
import sys
import heapq
input = sys.stdin.readline

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

for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))

print(sum(a))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] *= -1
heapq.heapify(a)
 
for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))
    
print(sum(a)*(-1))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)

for cnt in range(m):
    if a[0] == 0:
        break
    a[0] = a[0] // 2
    if a[0] < a[1]:
         a.sort(reverse = True)

print(sum(a))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] *= -1
heapq.heapify(a)
 
for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))
    
print(sum(a)*(-1))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)

for cnt in range(m):
    a[0] = a[0] // 2
    if a[0] < a[1]:
         a.sort(reverse = True)

print(sum(a))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] *= -1
heapq.heapify(a)
 
for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))
    
print(sum(a)*(-1))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)

for cnt in range(m):
    a[0] = a[0] // 2
    if a[0] // 2 < a[1]:
         a.sort(reverse = True)

print(sum(a))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] *= -1
heapq.heapify(a)
 
for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))
    
print(sum(a)*(-1))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)

cnt = 0
while cnt < m:
    if a[0] // 2 < a[1]:
        a[0] = a[0] // 2
        cnt += 1
        a.sort(reverse = True)
    else:
        a[0] = a[0] // 2
        cnt += 1
print(sum(a))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] *= -1
heapq.heapify(a)
 
for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))
    
print(sum(a)*(-1))

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):
    if a[0] == 0:
        break
    a[0] = a[0] // 2
    a.sort(reverse = True)
print(sum(a))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] *= -1
heapq.heapify(a)
 
for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))
    
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):
    maxa = max(a)
    if maxa == 0:
        break
    a[a.index(maxa)] = maxa // 2
print(sum(a))

Fixed submission:
import sys
import heapq
input = sys.stdin.readline
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] *= -1
heapq.heapify(a)
 
for cnt in range(m):
    temp = heapq.heappop(a)*(-1)
    if temp == 0:
        break
    heapq.heappush(a, (temp//2)*(-1))
    
print(sum(a)*(-1))