Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from bisect import insort
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a.sort()
for i in range(m):
    harf = a[n-1] // 2
    a[n-1:n] = []
    insort(a, harf)
print(sum(a))


Fixed submission:
from sys import stdin
import heapq
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a = [-1 * x for x in a]
heapq.heapify(a)
for i in range(m):
    harf = heapq.heappop(a)
    harf = ((harf*(-1))//2)*(-1)
    heapq.heappush(a,harf)
print(sum(a)*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import bisect
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a.sort()
sum = 0
for i in range(m):
    harf = a[n-1] // 2
    del a[n-1]
    bisect.insort_left(a, harf)
for i in range(n):
    sum += a[i]
print(sum)


Fixed submission:
from sys import stdin
import heapq
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a = [-1 * x for x in a]
heapq.heapify(a)
for i in range(m):
    harf = heapq.heappop(a)
    harf = ((harf*(-1))//2)*(-1)
    heapq.heappush(a,harf)
print(sum(a)*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import bisect
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a.sort()
sum = 0
for i in range(m):
    a[n-1] = a[n-1] // 2
    a.sort()
for i in range(n):
    sum += a[i]
print(sum)


Fixed submission:
from sys import stdin
import heapq
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a = [-1 * x for x in a]
heapq.heapify(a)
for i in range(m):
    harf = heapq.heappop(a)
    harf = ((harf*(-1))//2)*(-1)
    heapq.heappush(a,harf)
print(sum(a)*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import bisect
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a.sort()
sum = 0
for i in range(m):
    a[n-1] = a[n-1] // 2
    a.sort()
for i in range(n):
    sum += a[i]
print(sum)


Fixed submission:
from sys import stdin
import heapq
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a = [-1 * x for x in a]
heapq.heapify(a)
for i in range(m):
    harf = heapq.heappop(a)
    harf = ((harf*(-1))//2)*(-1)
    heapq.heappush(a,harf)
print(sum(a)*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import bisect
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a.sort()
sum = 0
for i in range(m):
    harf = a[n-1] // 2
    a.remove(a[n-1])
    bisect.insort_left(a, harf)
for i in range(n):
    sum += a[i]
print(sum)


Fixed submission:
from sys import stdin
import heapq
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
a = [-1 * x for x in a]
heapq.heapify(a)
for i in range(m):
    harf = heapq.heappop(a)
    harf = ((harf*(-1))//2)*(-1)
    heapq.heappush(a,harf)
print(sum(a)*(-1))