Buggy python submission (verdict: Runtime Error):
program D
    implicit none
    integer::n,m,i
    real(8)::ans
    real(8),allocatable::a(:)
    read*,n,m
    allocate(a(n))
    read*,a
    if ( n == 1) then
        ans = a(0) * (0.5) ** m
    else
        do i = 0 , m
            a(maxloc(a,1)) = a(maxloc(a,1)) * 0.5
        end do
        ans = sum(a)
    end if
    print*,ans
end program D

Fixed submission:
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
a = [ -i for i in a ]
heapq.heapify(a)

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))
if len(a) == 1:
    ans = a[0] * (0.5) ** m
    print(int(ans))
    exit()
for i in range(m):
    a[a.index(max(a))] = a[a.index(max(a))] // 2
print(sum(a))

Fixed submission:
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
a = [ -i for i in a ]
heapq.heapify(a)

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))
if len(a) == 1:
    ans = a[0] * (0.5) ** m
    print(int(ans))
    exit()
for i in range(m):
    a[a.index(max(a))] = a[a.index(max(a))] // 2
print(sum(a))

Fixed submission:
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
a = [ -i for i in a ]
heapq.heapify(a)

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))
if len(a) == 1:
    ans = a[0] * (0.5) ** m
    print(int(ans))
    exit()
for i in range(m):
    a[a.index(max(a))] = a[a.index(max(a))] // 2
print(sum(a)) 

Fixed submission:
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
a = [ -i for i in a ]
heapq.heapify(a)

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))
if len(a) == 1:
    ans = a[0] * (0.5) ** m
    print(int(ans))
    exit()
while m > 0:
    a.sort(reverse=True)
    #print(m)
    plus = a[0] - a[0]//2
    ngtv = a[1] - a[1]//2
    if plus > ngtv:
        m -= 1
        a[0] = a[0]//2
    else:
        m -= 1
        a[1] = a[1]//2
    #print(a)
print(sum(a))


Fixed submission:
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
a = [ -i for i in a ]
heapq.heapify(a)

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))
if len(a) == 1:
    ans = a[0] * (0.5) ** m
    print(int(ans))
    exit()
while m > 0:
    a.sort(reverse=True)
    #print(m)
    plus = a[0] - a[0]//2
    ngtv = a[1] - a[1]//2
    if plus > ngtv:
        m -= 1
        a[0] = a[0]//2
    else:
        m -= 1
        a[1] = a[1]//2
    #print(a)
print(sum(a))

Fixed submission:
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
a = [ -i for i in a ]
heapq.heapify(a)

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