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

num ,m =map(int,input().split())

arr = [-i for i in list(map(int,input().split()))]
hq.heapify(arr)

for i in range(m):
    arr[0] = -1*(-1*arr[0]//2)
    hq.heapify(arr)

    
print(-1*sum(arr))
        

Fixed submission:
import heapq as hq

num ,m =map(int,input().split())

arr = [-i for i in list(map(int,input().split()))]
hq.heapify(arr)

for i in range(m):
    hq.heappush(arr, -1*(-1*hq.heappop(arr)//2))

    
print(-1*sum(arr))

Buggy python submission (verdict: Time Limit Exceeded):
num ,m =map(int,input().split())
if num == 1:
    s = int(input())
    print(s//(2**m))
    
else:
    arr = sorted(list(map(int,input().split())),reverse=True)

    for i in range(m):
        for j in range(len(arr)-1):
            if arr[j]//2 >= arr[j+1]:
                arr[j] = arr[j] //2
                break
            else:
                arr[j] = arr[j] //2
                
                if arr[j] < arr[j+1]:
                    arr[j],arr[j+1] = arr[j+1],arr[j]
                    if len(arr) >= j+3:
                        if arr[j+1] < arr[j+2]:
                            arr = sorted(arr,reverse=True)
                break

    print(sum(arr))
        

Fixed submission:
import heapq as hq

num ,m =map(int,input().split())

arr = [-i for i in list(map(int,input().split()))]
hq.heapify(arr)

for i in range(m):
    hq.heappush(arr, -1*(-1*hq.heappop(arr)//2))

    
print(-1*sum(arr))

Buggy python submission (verdict: Runtime Error):
num ,m =map(int,input().split())
if num == 1:
    s = int(input())
    print(s//(2**m))
    
else:
    arr = sorted(list(map(int,input().split())),reverse=True)

    for i in range(m):
        for j in range(len(arr)):
            if arr[j]//2 < arr[j+1]:
                arr[j] = arr[j] //2
                
                if arr[j] < arr[j+1]:
                    arr[j],arr[j+1] = arr[j+1],arr[j]
                    if len(arr) >= j+2 and arr[j+1] < arr[j+2]:
                        arr[j+1],arr[j+2] = arr[j+2],arr[j+1]
                break

    print(sum(arr))

Fixed submission:
import heapq as hq

num ,m =map(int,input().split())

arr = [-i for i in list(map(int,input().split()))]
hq.heapify(arr)

for i in range(m):
    hq.heappush(arr, -1*(-1*hq.heappop(arr)//2))

    
print(-1*sum(arr))

Buggy python submission (verdict: Runtime Error):
num ,m =map(int,input().split())
if num == 1:
    s = int(input())
else:
    arr = sorted(list(map(int,input().split())),reverse=True)

if num == 1:
    print(s//(2**m))
    
else:
    for i in range(m):
        for j in range(len(arr)):
            if arr[j]//2 < arr[j+1]:
                arr[j] = arr[j] //2
                
                if arr[j] < arr[j+1]:
                    arr[j],arr[j+1] = arr[j+1],arr[j]
                break
    print(sum(arr))
        

Fixed submission:
import heapq as hq

num ,m =map(int,input().split())

arr = [-i for i in list(map(int,input().split()))]
hq.heapify(arr)

for i in range(m):
    hq.heappush(arr, -1*(-1*hq.heappop(arr)//2))

    
print(-1*sum(arr))

Buggy python submission (verdict: Runtime Error):
num ,m =map(int,input().split())
arr = sorted(list(map(int,input().split())),reverse=True)

for i in range(m):
    for j in range(len(arr)):
        if arr[j]//2 < arr[j+1]:
            arr[j] = arr[j] //2
            arr.sort(reverse=True)
            break
print(sum(arr))
    

Fixed submission:
import heapq as hq

num ,m =map(int,input().split())

arr = [-i for i in list(map(int,input().split()))]
hq.heapify(arr)

for i in range(m):
    hq.heappush(arr, -1*(-1*hq.heappop(arr)//2))

    
print(-1*sum(arr))

Buggy python submission (verdict: Runtime Error):
num ,m =map(int,input().split())
arr = sorted(list(map(int,input().split())),reverse=True)
print(arr)

for i in range(m):
    for j in range(len(arr)):
        if arr[j]//2 < arr[j+1]:
            arr[j] = arr[j] //2
            arr.sort(reverse=True)
            break

    print(arr)

print(sum(arr))
    

Fixed submission:
import heapq as hq

num ,m =map(int,input().split())

arr = [-i for i in list(map(int,input().split()))]
hq.heapify(arr)

for i in range(m):
    hq.heappush(arr, -1*(-1*hq.heappop(arr)//2))

    
print(-1*sum(arr))

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

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


print(sum(arr))
    

Fixed submission:
import heapq as hq

num ,m =map(int,input().split())

arr = [-i for i in list(map(int,input().split()))]
hq.heapify(arr)

for i in range(m):
    hq.heappush(arr, -1*(-1*hq.heappop(arr)//2))

    
print(-1*sum(arr))