Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

for _ in range(M):
    a = A.pop()
    a2=a>>1
    bisect.insort_right(A,a2)
    #print(A2)

print(sum(A))

Fixed submission:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
import logging
import heapq
logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)

def main():
    N,M=[int(x) for x in input().split()]
    A=[-int(x) for x in input().split()]

    heapq.heapify(A)
    for _ in range(M):
        a = -heapq.heappop(A) // 2 # 最小値取得
        heapq.heappush(A, -a)
    
    print(-sum(A))

main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy

N,M=map(int,input().split())
A=list(map(int,input().split()))
A2=numpy.array(A)

for _ in range(M):
    # i = A.index(max(A))
    i = A2.argmax()
    a=A2[i]>>1
    A2[i]=a

print(sum(A2))

Fixed submission:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
import logging
import heapq
logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)

def main():
    N,M=[int(x) for x in input().split()]
    A=[-int(x) for x in input().split()]

    heapq.heapify(A)
    for _ in range(M):
        a = -heapq.heappop(A) // 2 # 最小値取得
        heapq.heappush(A, -a)
    
    print(-sum(A))

main()

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

for _ in range(M):
    a = A.pop()
    a2=a>>1
    bisect.insort_right(A,a2)
    #print(A2)

print(sum(A))

Fixed submission:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
import logging
import heapq
logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)

def main():
    N,M=[int(x) for x in input().split()]
    A=[-int(x) for x in input().split()]

    heapq.heapify(A)
    for _ in range(M):
        a = -heapq.heappop(A) // 2 # 最小値取得
        heapq.heappush(A, -a)
    
    print(-sum(A))

main()

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

for _ in range(M):
    i = A.index(max(A))
    a=A[i]>>1
    A[i]=a

print(sum(A))

Fixed submission:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
import logging
import heapq
logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)

def main():
    N,M=[int(x) for x in input().split()]
    A=[-int(x) for x in input().split()]

    heapq.heapify(A)
    for _ in range(M):
        a = -heapq.heappop(A) // 2 # 最小値取得
        heapq.heappush(A, -a)
    
    print(-sum(A))

main()

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N,M=map(int,input().split())
A=list(map(int,input().split()))
A2=sorted(A)

for _ in range(M):
    a = A2.pop()
    a2=a>>1
    bisect.insort_right(A2,a2)
    #print(A2)

print(sum(A2))

Fixed submission:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
import logging
import heapq
logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)

def main():
    N,M=[int(x) for x in input().split()]
    A=[-int(x) for x in input().split()]

    heapq.heapify(A)
    for _ in range(M):
        a = -heapq.heappop(A) // 2 # 最小値取得
        heapq.heappush(A, -a)
    
    print(-sum(A))

main()