Buggy python submission (verdict: Runtime Error):
import bisect
from collections import deque
N, M = map(int, input().split())
B = [int(x) for x in input().split()]
B = sorted(B)
A = deque([])
for i in range(N):
    A.append(B[i])
# print(A)
for i in range(M):
    value = A.pop()
    value = value//2
    bisect.insort_left(A, value)
# print(A)
ans = sum(A)
print(ans)


Fixed submission:
# 他参加者の回答を参考にした．現在のAtcoderでのpythonのバージョンではdequeにinsertできないので（全ての値に-1をかけて）heapqがよさそう？
import bisect
N, M = map(int, input().split())
B = [int(x) for x in input().split()]
A = sorted(B, reverse=True)
ite = 0
for i in range(M):
    A[ite] //= 2
    if ite < N - 1:
        if A[ite] < A[ite + 1] and A[0] < A[ite+1]:
            ite += 1
        else:
            A = sorted(A, reverse=True)
            ite = 0
    else:
        A = sorted(A, reverse=True)
        ite = 0

ans = sum(A)
print(ans)

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

N, M = map(int, input().split())
B = [int(x) for x in input().split()]
A = sorted(B)

# print(A)
for i in range(M):
    value = A.pop(N-1)
    value = value//2
    bisect.insort_left(A, value)
# print(A)
ans = sum(A)
print(ans)


Fixed submission:
# 他参加者の回答を参考にした．現在のAtcoderでのpythonのバージョンではdequeにinsertできないので（全ての値に-1をかけて）heapqがよさそう？
import bisect
N, M = map(int, input().split())
B = [int(x) for x in input().split()]
A = sorted(B, reverse=True)
ite = 0
for i in range(M):
    A[ite] //= 2
    if ite < N - 1:
        if A[ite] < A[ite + 1] and A[0] < A[ite+1]:
            ite += 1
        else:
            A = sorted(A, reverse=True)
            ite = 0
    else:
        A = sorted(A, reverse=True)
        ite = 0

ans = sum(A)
print(ans)

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

N, M = map(int, input().split())
B = [int(x) for x in input().split()]
A = sorted(B)

# print(A)
for i in range(M):
    value = A.pop(N-1)
    value = value//2
    bisect.insort_left(A, value)
# print(A)
ans = sum(A)
print(ans)


Fixed submission:
# 他参加者の回答を参考にした．現在のAtcoderでのpythonのバージョンではdequeにinsertできないので（全ての値に-1をかけて）heapqがよさそう？
import bisect
N, M = map(int, input().split())
B = [int(x) for x in input().split()]
A = sorted(B, reverse=True)
ite = 0
for i in range(M):
    A[ite] //= 2
    if ite < N - 1:
        if A[ite] < A[ite + 1] and A[0] < A[ite+1]:
            ite += 1
        else:
            A = sorted(A, reverse=True)
            ite = 0
    else:
        A = sorted(A, reverse=True)
        ite = 0

ans = sum(A)
print(ans)

Buggy python submission (verdict: Runtime Error):
import bisect
from collections import deque
N, M = map(int, input().split())
B = [int(x) for x in input().split()]
B = sorted(B)
A = deque()
for i in range(N):
    A.append(B[i])
#print(A)
for i in range(M):
    value = A.pop()
    value = value//2
    bisect.insort_left(A, value)
#print(A)
ans = sum(A)
print(ans)


Fixed submission:
# 他参加者の回答を参考にした．現在のAtcoderでのpythonのバージョンではdequeにinsertできないので（全ての値に-1をかけて）heapqがよさそう？
import bisect
N, M = map(int, input().split())
B = [int(x) for x in input().split()]
A = sorted(B, reverse=True)
ite = 0
for i in range(M):
    A[ite] //= 2
    if ite < N - 1:
        if A[ite] < A[ite + 1] and A[0] < A[ite+1]:
            ite += 1
        else:
            A = sorted(A, reverse=True)
            ite = 0
    else:
        A = sorted(A, reverse=True)
        ite = 0

ans = sum(A)
print(ans)

Buggy python submission (verdict: Runtime Error):
import bisect
from collections import deque
N, M = map(int, input().split())
B = [int(x) for x in input().split()]
B = sorted(B)
A = deque()
for i in range(N):
    A.append(B[i])
#print(A)
for i in range(M):
    value = A.pop()
    value = value//2
    bisect.insort_left(A, value)
#print(A)
ans = sum(A)
print(ans)


Fixed submission:
# 他参加者の回答を参考にした．現在のAtcoderでのpythonのバージョンではdequeにinsertできないので（全ての値に-1をかけて）heapqがよさそう？
import bisect
N, M = map(int, input().split())
B = [int(x) for x in input().split()]
A = sorted(B, reverse=True)
ite = 0
for i in range(M):
    A[ite] //= 2
    if ite < N - 1:
        if A[ite] < A[ite + 1] and A[0] < A[ite+1]:
            ite += 1
        else:
            A = sorted(A, reverse=True)
            ite = 0
    else:
        A = sorted(A, reverse=True)
        ite = 0

ans = sum(A)
print(ans)