Buggy python submission (verdict: Runtime Error):
def binary_search(l, value):
    if len(l) == 0:
        return 0
    if len(l) < 4:
        for i in range(len(l)):
            if value <= l[i]:
                return i
    low = 0
    high = len(l) - 1
    while low <= high:
        mid = (low + high) // 2
        if l[mid-1] <= value <= l[mid]:
            return mid
        elif l[mid] < value:
            low = mid + 1
        else:
            high = mid - 1
    return mid
    
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
d = deque(A)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = binary_search(d, tmp)
    d.insert(index, tmp)
print(sum(d))



Fixed submission:
n, m = map(int,input().split())
A = list(map(int,input().split()))
A = [x * -1 for x in A]
A.sort()
import heapq
import bisect
heapq.heapify(A)
for _ in range(m):
    min_ = heapq.heappop(A)
    tmp = min_ * -1 // 2 * -1
    index = bisect.bisect_left(A, tmp)
    heapq.heappush(A,tmp)
print(sum(A) * -1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
import bisect
d = deque(A)
print(1)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = bisect.bisect_left(d, tmp)
    d.insert(index, tmp)
print(sum(d))

Fixed submission:
n, m = map(int,input().split())
A = list(map(int,input().split()))
A = [x * -1 for x in A]
A.sort()
import heapq
import bisect
heapq.heapify(A)
for _ in range(m):
    min_ = heapq.heappop(A)
    tmp = min_ * -1 // 2 * -1
    index = bisect.bisect_left(A, tmp)
    heapq.heappush(A,tmp)
print(sum(A) * -1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
import bisect
d = deque(A)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = bisect.bisect_left(d, tmp)
    d.insert(index, tmp)
print(sum(d))

Fixed submission:
n, m = map(int,input().split())
A = list(map(int,input().split()))
A = [x * -1 for x in A]
A.sort()
import heapq
import bisect
heapq.heapify(A)
for _ in range(m):
    min_ = heapq.heappop(A)
    tmp = min_ * -1 // 2 * -1
    index = bisect.bisect_left(A, tmp)
    heapq.heappush(A,tmp)
print(sum(A) * -1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
import bisect
d = deque(A)
index = bisect.bisect_left(d, 2)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = bisect.bisect_left(d, tmp)
    d.insert(index, tmp)
print(sum(d))

Fixed submission:
n, m = map(int,input().split())
A = list(map(int,input().split()))
A = [x * -1 for x in A]
A.sort()
import heapq
import bisect
heapq.heapify(A)
for _ in range(m):
    min_ = heapq.heappop(A)
    tmp = min_ * -1 // 2 * -1
    index = bisect.bisect_left(A, tmp)
    heapq.heappush(A,tmp)
print(sum(A) * -1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
import bisect
d = deque(A)
index = bisect.bisect_left(d, 2)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = bisect.bisect_left(d, tmp)
    d.insert(index, tmp)
print(sum(d))

Fixed submission:
n, m = map(int,input().split())
A = list(map(int,input().split()))
A = [x * -1 for x in A]
A.sort()
import heapq
import bisect
heapq.heapify(A)
for _ in range(m):
    min_ = heapq.heappop(A)
    tmp = min_ * -1 // 2 * -1
    index = bisect.bisect_left(A, tmp)
    heapq.heappush(A,tmp)
print(sum(A) * -1)