Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
import collections
import bisect

def main():
    _,M=map(int,input().split())
    A = list(map(int, input().split()))
    A.sort()
    while M>0:
        a = A.pop()
        if a == 0:
            print(0)
            return
        if A:
            b = A.pop()
            while a >= b:
                a //= 2
                M -= 1
            bisect.insort(A, b)
        else:
            a //= 2**M
            M = 0
        bisect.insort(A, a)
    print(sum(A))

if __name__ == '__main__':
    main()


Fixed submission:
import sys
input=sys.stdin.readline
import heapq

def main():
    _,M=map(int,input().split())
    A = []
    for a in list(map(int, input().split())):
        heapq.heappush(A, -a)
    while M>0:
        a = -heapq.heappop(A)
        a //= 2
        M -= 1
        heapq.heappush(A, -a)
    print(-sum(A))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
import collections
import bisect

def main():
    _,M=map(int,input().split())
    A = list(map(int, input().split()))
    A.sort()
    while M>0:
        a = A.pop()
        if a == 0:
            print(0)
            return
        a //= 2
        M -= 1
        bisect.insort(A, a)
    print(sum(A))

if __name__ == '__main__':
    main()


Fixed submission:
import sys
input=sys.stdin.readline
import heapq

def main():
    _,M=map(int,input().split())
    A = []
    for a in list(map(int, input().split())):
        heapq.heappush(A, -a)
    while M>0:
        a = -heapq.heappop(A)
        a //= 2
        M -= 1
        heapq.heappush(A, -a)
    print(-sum(A))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
import collections
import bisect

def main():
    _,M=map(int,input().split())
    A = list(map(int, input().split()))
    A.sort()
    while M>0:
        a = A.pop()
        if a == 0:
            print(0)
            return
        a //= 2
        M -= 1
        bisect.insort(A, a)
    print(sum(A))

if __name__ == '__main__':
    main()


Fixed submission:
import sys
input=sys.stdin.readline
import heapq

def main():
    _,M=map(int,input().split())
    A = []
    for a in list(map(int, input().split())):
        heapq.heappush(A, -a)
    while M>0:
        a = -heapq.heappop(A)
        a //= 2
        M -= 1
        heapq.heappush(A, -a)
    print(-sum(A))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
import collections
import bisect

def main():
    N,M=map(int,input().split())
    A = list(map(int, input().split()))
    A.sort()
    while M>0:
        a = A.pop()
        a //= 2
        M -= 1
        bisect.insort(A, a)
    print(sum(A))

if __name__ == '__main__':
    main()


Fixed submission:
import sys
input=sys.stdin.readline
import heapq

def main():
    _,M=map(int,input().split())
    A = []
    for a in list(map(int, input().split())):
        heapq.heappush(A, -a)
    while M>0:
        a = -heapq.heappop(A)
        a //= 2
        M -= 1
        heapq.heappush(A, -a)
    print(-sum(A))

if __name__ == '__main__':
    main()