Buggy python submission (verdict: Time Limit Exceeded):
n, m = input().split()
N = int(n)
M = int(m)

A = list(map(int, input().split()))
A.sort(reverse=True)

for _ in range(M):
    A[0] = A[0] // 2
    A.sort(reverse=True)
print(sum(A))


Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
it = 0
for i in range(M):
    A[it]=A[it]//2
    if it<N-1:
        if A[it]<A[it+1] and A[0]<A[it+1]:
            it+=1
        else:
            A.sort(reverse = True)
            it = 0
    if it == N-1:
        A.sort(reverse = True)
        it = 0
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = input().split()
N = int(n)
M = int(m)

A = list(map(int, input().split()))

for _ in range(M):
    a = max(enumerate(A), key=lambda x: x[1])

    A[a[0]] = a[1] // 2

print(sum(A))


Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
it = 0
for i in range(M):
    A[it]=A[it]//2
    if it<N-1:
        if A[it]<A[it+1] and A[0]<A[it+1]:
            it+=1
        else:
            A.sort(reverse = True)
            it = 0
    if it == N-1:
        A.sort(reverse = True)
        it = 0
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = input().split()
N = int(n)
M = int(m)

A = list(map(int, input().split()))

for _ in range(M):
    mx = max(A)
    k = A.index(mx)
    A[k] = mx // 2

print(sum(A))


Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
it = 0
for i in range(M):
    A[it]=A[it]//2
    if it<N-1:
        if A[it]<A[it+1] and A[0]<A[it+1]:
            it+=1
        else:
            A.sort(reverse = True)
            it = 0
    if it == N-1:
        A.sort(reverse = True)
        it = 0
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import math
n, m = input().split()
N = int(n)
M = int(m)

A = list(map(int, input().split()))

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

print(sum(A))


Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
it = 0
for i in range(M):
    A[it]=A[it]//2
    if it<N-1:
        if A[it]<A[it+1] and A[0]<A[it+1]:
            it+=1
        else:
            A.sort(reverse = True)
            it = 0
    if it == N-1:
        A.sort(reverse = True)
        it = 0
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import math
n, m = input().split()
N = int(n)
M = int(m)

A = list(map(int, input().split()))

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

print(sum(A))

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
it = 0
for i in range(M):
    A[it]=A[it]//2
    if it<N-1:
        if A[it]<A[it+1] and A[0]<A[it+1]:
            it+=1
        else:
            A.sort(reverse = True)
            it = 0
    if it == N-1:
        A.sort(reverse = True)
        it = 0
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import math
n, m = input().split()
N = int(n)
M = int(m)

A = [int(a) for a in input().split()]

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

print(sum(A))

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
it = 0
for i in range(M):
    A[it]=A[it]//2
    if it<N-1:
        if A[it]<A[it+1] and A[0]<A[it+1]:
            it+=1
        else:
            A.sort(reverse = True)
            it = 0
    if it == N-1:
        A.sort(reverse = True)
        it = 0
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import math
n, m = input().split()
N = int(n)
M = int(m)

A = [int(a) for a in input().split()]

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

count = 0
for i in A:
    count += i

print(count)

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
it = 0
for i in range(M):
    A[it]=A[it]//2
    if it<N-1:
        if A[it]<A[it+1] and A[0]<A[it+1]:
            it+=1
        else:
            A.sort(reverse = True)
            it = 0
    if it == N-1:
        A.sort(reverse = True)
        it = 0
print(sum(A))