Buggy python submission (verdict: Runtime Error):
from heapq import heappush, heappop
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

Alist=sorted(Alist, reverse=True)

Blist=[]

def insert_list(list, value):
	start=0
	end=len(list)-1

	if value<list[len(list)-1]:
		list.insert(len(list), value)
		return list
	if value>list[0]:
		list.insert(0, value)
		return list
	while True:
		mid_point=int((start+end)/2)
		if value>list[mid_point]:
			if (end-start)<2:
				list.insert(start, value)
				return list
			else:
				end=mid_point
		else:
			if (end-start)<2:
				list.insert(end, value)
				return list
			else:
				start=mid_point

for i in range(K):
   if N==1:
      Alist[0]=Alist[0]/2**K
      break
   #Alist[0]=Alist[0]/2
  
   if len(Blist)==0:
      Blist.append(Alist.pop(0))
      Blist[0]=Blist[0]/2
   else:
      if Blist[0]>Alist[0]:
         Blist[0]=Blist[0]/2
         Blist=insert_list(Blist,Blist.pop(0))
      else:
         Blist.insert(0, Alist.pop(0))
         Blist[0]=Blist[0]/2
         Blist=insert_list(Blist,Blist.pop(0))
sum=0

for i in Alist:
   sum+=math.floor(i) 
    
for i in Blist:
   sum+=math.floor(i) 
print(int(sum))

Fixed submission:
from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))

Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappush, heappop
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math



Alist=sorted(Alist, reverse=True)

 


def insert_list(list, value):
	start=0
	end=len(list)-1

	if value<list[len(list)-1]:
		list.insert(len(list), value)
		return list
	if value>list[0]:
		list.insert(0, value)
		return list
	while True:
		mid_point=int((start+end)/2)
		if value>list[mid_point]:
			if (end-start)<2:
				list.insert(start, value)
				return list
			else:
				end=mid_point
		else:
			if (end-start)<2:
				list.insert(end, value)
				return list
			else:
				start=mid_point

for i in range(K):
   if N==1:
      Alist[0]=Alist[0]/2**K
      break
   Alist[0]=Alist[0]/2
   
   if len(Alist)>1:
      value=Alist.pop(0)
      Alist=insert_list(Alist,value)
sum=0

for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

Fixed submission:
from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

#print(Alist)
my_list = [9,8,7,4,7,1,3]

Alist=sorted(Alist, reverse=True)

def insert_list(list, value):
	start=0
	end=len(list)-1

	if value<list[len(list)-1]:
		list.insert(len(list), value)
		return list
	if value>list[0]:
		list.insert(0, value)
		return list
	while True:
		mid_point=int((start+end)/2)
		if value>list[mid_point]:
			if (end-start)<2:
				list.insert(start, value)
				return list
			else:
				end=mid_point
		else:
			if (end-start)<2:
				list.insert(end, value)
				return list
			else:
				start=mid_point

for i in range(K):
   Alist[0]=Alist[0]/2
   
   if len(Alist)>1:
      value=Alist.pop(0)
      Alist=insert_list(Alist,value)
sum=0
#print(Alist)
for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

Fixed submission:
from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))

Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

#print(Alist)
my_list = [9,8,7,4,7,1,3]

Alist=sorted(Alist, reverse=True)

def insert_list(list, value):
	start=0
	end=len(list)-1

	if value<list[len(list)-1]:
		list.insert(len(list), value)
		return list
	if value>list[0]:
		list.insert(0, value)
		return list
	while True:
		mid_point=int((start+end)/2)
		if value>list[mid_point]:
			if (end-start)<2:
				list.insert(start, value)
				return list
			else:
				end=mid_point
		else:
			if (end-start)<2:
				list.insert(end, value)
				return list
			else:
				start=mid_point

for i in range(K):
   Alist[0]=Alist[0]/2
   value=Alist.pop(0)
   Alist=insert_list(Alist,value)
sum=0
#print(Alist)
for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

Fixed submission:
from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

#print(Alist)
my_list = [9,8,7,4,7,1,3]

Alist=sorted(Alist, reverse=True)
#print(sorted(Alist, reverse=True))


for i in range(K):
   Alist[0]=Alist[0]/2
   Alist=sorted(Alist, reverse=True)
sum=0
#print(Alist)
for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

Fixed submission:
from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))

Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

#print(Alist)
my_list = [9,8,7,4,7,1,3]

Alist=sorted(Alist, reverse=True)
#print(sorted(Alist, reverse=True))


for i in range(K):
   Alist[0]=Alist[0]/2
   if N>1: 
      if Alist[0]<Alist[1]:
         temp=Alist[0]
         Alist[0]=Alist[1]
         Alist[1]=temp
         continue          
      if Alist[0]<Alist[i]:
         temp=Alist[0]
         Alist[0]=Alist[i]
         Alist[i]=temp
         continue
      if i>2:
         if Alist[0]<Alist[i-1]:
            temp=Alist[0]
            Alist[0]=Alist[i-1]
            Alist[i-1]=temp
            continue
   Alist=sorted(Alist, reverse=True)
sum=0
#print(Alist)
for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

Fixed submission:
from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))

Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

#print(Alist)
my_list = [9,8,7,4,7,1,3]

Alist=sorted(Alist, reverse=True)
#print(sorted(Alist, reverse=True))


for i in range(K):
   Alist[0]=Alist[0]/2
   if N>1: 
      if Alist[0]<Alist[1]:
         temp=Alist[0]
         Alist[0]=Alist[1]
         Alist[1]=temp
      if Alist[0]<Alist[i]:
         temp=Alist[0]
         Alist[0]=Alist[i]
         Alist[i]=temp
      if i>2:
         if Alist[0]<Alist[i-1]:
            temp=Alist[0]
            Alist[0]=Alist[i-1]
            Alist[i-1]=temp
sum=0
#print(Alist)
for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

Fixed submission:
from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))

Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

#print(Alist)
my_list = [9,8,7,4,7,1,3]

Alist=sorted(Alist, reverse=True)
#print(sorted(Alist, reverse=True))


for i in range(K):
   Alist[0]=Alist[0]/2
   if N>1: 
      if Alist[0]<Alist[1]:
         temp=Alist[0]
         Alist[0]=Alist[1]
         Alist[1]=temp
      if Alist[0]<Alist[i]:
         temp=Alist[0]
         Alist[0]=Alist[i]
         Alist[i]=temp
sum=0
#print(Alist)
for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

Fixed submission:
from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))

Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
Alist = [int(i) for i in input().split(' ')]
import math

my_list = [9,8,7,4,7,1,3]

Alist=sorted(Alist, reverse=True)

for i in range(K):
   Alist[0]=Alist[0]/2
   if N>1: 
      if Alist[0]<Alist[1]:
         temp=Alist[0]
         Alist[0]=Alist[1]
         Alist[1]=temp
      if Alist[0]<Alist[i]:
         temp=Alist[0]
         Alist[0]=Alist[i]
         Alist[i]=temp
sum=0

for i in Alist:
   sum+=math.floor(i) 
print(sum)

Fixed submission:
from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))