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

import numpy as np


def main():
    for _ in range(M):
        A2 = A.copy()
        A.sort()
        A[-1] = A[-1] // 2

    print(sum(A))


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = np.array(list(map(int, input().split())))
    main()

Fixed submission:
import heapq


def main():
    for _ in range(M):
        mx = heapq.heappop(A) * -1 // 2 * -1
        heapq.heappush(A, mx)

    print(sum(A) * -1)


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = [int(x) * -1 for x in input().split()]
    heapq.heapify(A)
    main()

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


def main():
    for _ in range(M):
        A.sort()
        A[-1] = A[-1] // 2

    print(sum(A))


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = np.array(list(map(int, input().split())))
    main()

Fixed submission:
import heapq


def main():
    for _ in range(M):
        mx = heapq.heappop(A) * -1 // 2 * -1
        heapq.heappush(A, mx)

    print(sum(A) * -1)


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = [int(x) * -1 for x in input().split()]
    heapq.heapify(A)
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    for _ in range(M):
        A.sort()
        A[-1] = A[-1] // 2

    print(sum(A))


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    main()

Fixed submission:
import heapq


def main():
    for _ in range(M):
        mx = heapq.heappop(A) * -1 // 2 * -1
        heapq.heappush(A, mx)

    print(sum(A) * -1)


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = [int(x) * -1 for x in input().split()]
    heapq.heapify(A)
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    for _ in range(M):
        mx = max(A)
        A[A.index(mx)] = mx // 2

    print(sum(A))


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    main()

Fixed submission:
import heapq


def main():
    for _ in range(M):
        mx = heapq.heappop(A) * -1 // 2 * -1
        heapq.heappush(A, mx)

    print(sum(A) * -1)


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = [int(x) * -1 for x in input().split()]
    heapq.heapify(A)
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    for _ in range(M):
        mx = max(A)
        A[A.index(mx)] = mx // 2

    print(sum(A))


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    main()

Fixed submission:
import heapq


def main():
    for _ in range(M):
        mx = heapq.heappop(A) * -1 // 2 * -1
        heapq.heappush(A, mx)

    print(sum(A) * -1)


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = [int(x) * -1 for x in input().split()]
    heapq.heapify(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):
    mx = max(A)
    A[A.index(mx)] = mx // 2

print(sum(A))

Fixed submission:
import heapq


def main():
    for _ in range(M):
        mx = heapq.heappop(A) * -1 // 2 * -1
        heapq.heappush(A, mx)

    print(sum(A) * -1)


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = [int(x) * -1 for x in input().split()]
    heapq.heapify(A)
    main()