Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    stuff = list(map(int, input().split()))

    if N == 1:
        print(math.floor(stuff[0] / (2**M)))
        sys.exit()

    for i in range(M):
        stuff[stuff.index(max(stuff))] = math.floor(stuff[stuff.index(max(stuff))] / 2)

    print(sum(stuff))


if __name__ == '__main__':
    main()

Fixed submission:
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from heapq import heappush, heappop
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


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

    for i in range(M):
        heappush(stuff, -math.floor(-heappop(stuff) / 2))

    print(-sum(stuff))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    stuff = list(map(int, input().split()))

    if N == 1:
        print(math.floor(stuff[0] / (2**M)))
        sys.exit()

    for i in range(M):
        stuff[stuff.index(max(stuff))] = math.floor(stuff[stuff.index(max(stuff))] / 2)

    print(sum(stuff))


if __name__ == '__main__':
    main()

Fixed submission:
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from heapq import heappush, heappop
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


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

    for i in range(M):
        heappush(stuff, -math.floor(-heappop(stuff) / 2))

    print(-sum(stuff))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

# input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    stuff = list(map(int, input().split()))

    for i in range(M):
        stuff[stuff.index(max(stuff))] = math.floor(stuff[stuff.index(max(stuff))] / 2)

    print(sum(stuff))


if __name__ == '__main__':
    main()

Fixed submission:
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from heapq import heappush, heappop
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


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

    for i in range(M):
        heappush(stuff, -math.floor(-heappop(stuff) / 2))

    print(-sum(stuff))


if __name__ == '__main__':
    main()