Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()


import bisect
import math

for i in range(m):
  maxx=math.floor(a[-1]/2)
  a.pop(-1)
  a.insert(bisect.bisect_left(a,maxx),maxx)

print(sum(a))

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))

import heapq
import math

def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

heapq._heapify_max(a)

for i in range(m):
  temp=math.floor(_heappop_max(a)/2)
  _heappush_max(a,temp)

print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()


import bisect
import math

for i in range(m):
  maxx=math.floor(a[-1]/2)
  a.pop(-1)
  a.insert(bisect.bisect_left(a,maxx),maxx)

print(sum(a))

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))

import heapq
import math

def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

heapq._heapify_max(a)

for i in range(m):
  temp=math.floor(_heappop_max(a)/2)
  _heappush_max(a,temp)

print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil

n,m=map(int,input().split())
a=list(map(int,input().split()))
goukei=sum(a)
sorta=sorted(a, reverse=True)
waribiki=0

for i in range(m):
  waribiki+=ceil(max(a)/2)
  ind=a.index(max(a))
  a[ind]//=2
print(goukei-waribiki)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))

import heapq
import math

def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

heapq._heapify_max(a)

for i in range(m):
  temp=math.floor(_heappop_max(a)/2)
  _heappush_max(a,temp)

print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil

n,m=map(int,input().split())
a=list(map(int,input().split()))
goukei=sum(a)
sorta=sorted(a, reverse=True)
waribiki=0

for i in range(m):
  waribiki+=ceil(max(a)/2)
  ind=a.index(max(a))
  a[ind]//=2
print(goukei-waribiki)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))

import heapq
import math

def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

heapq._heapify_max(a)

for i in range(m):
  temp=math.floor(_heappop_max(a)/2)
  _heappush_max(a,temp)

print(sum(a))