Buggy python submission (verdict: Time Limit Exceeded):
import math
n,m = map(int,input().split())
 
a = input()
list1 = list(map(int,a.split()))
 
list1.sort()
 
for i in range(m):
    list1[-1] = math.floor(list1[-1]/2)
    list1.sort()
print(sum(list1))

Fixed submission:
import math
n,m = map(int,input().split())

a = input()
list1 = list(map(int,a.split()))
list1.sort()
list1.reverse()
i = 0
s = math.floor(list1[0]/2)

if n == 1:
    print(math.floor(list1[0]/(2**m)))
    exit()

while True:
    while True:
        if i+1 > n:
            break
        if list1[i] < s or m == 0:
            break
        list1[i] = math.floor(list1[i]/2)
        m -= 1
        i += 1
    if m == 0:
        break
    list1.sort()
    list1.reverse()
    s = math.floor(list1[0]/2)
    i = 0
print(sum(list1))

Buggy python submission (verdict: Runtime Error):
import math
n,m = map(int,input().split())

a = input()
list1 = list(map(int,a.split()))
list1.sort()
list1.reverse()
i = 0
s = math.floor(list1[0]/2)

if n == 1:
    print(math.floor(list1[0]/(2**m)))
    exit()

while True:
    while True:
        if list1[i] < s or m == 0:
            break
        list1[i] = math.floor(list1[i]/2)
        m -= 1
        i += 1
    if m == 0:
        break
    list1.sort()
    list1.reverse()
    s = math.floor(list1[0]/2)
    i = 0
print(sum(list1))


Fixed submission:
import math
n,m = map(int,input().split())

a = input()
list1 = list(map(int,a.split()))
list1.sort()
list1.reverse()
i = 0
s = math.floor(list1[0]/2)

if n == 1:
    print(math.floor(list1[0]/(2**m)))
    exit()

while True:
    while True:
        if i+1 > n:
            break
        if list1[i] < s or m == 0:
            break
        list1[i] = math.floor(list1[i]/2)
        m -= 1
        i += 1
    if m == 0:
        break
    list1.sort()
    list1.reverse()
    s = math.floor(list1[0]/2)
    i = 0
print(sum(list1))

Buggy python submission (verdict: Runtime Error):
import math
n,m = map(int,input().split())

a = input()
list1 = list(map(int,a.split()))
list1.sort()
list1.reverse()
cout = 0
cout_of_index = 0
cout_of_i = 0
kai = 0
def func(j):
    global list1
    global cout_of_i
    global kai
    global m
    if cout_of_i == m:
        kai = j
        return
    sd = math.floor(j/2)
    if sd >= list1[m-(cout_of_i+1)]:
        cout_of_i += 1
        func(sd)
    else:
        cout_of_i += 1
        kai = sd
        return 
    return 

if n == 1:
    print(math.floor(list1[0]/(2**m)))
    exit()
while True:
    if cout_of_i >= m:
        break
    s = max(list1)
    func(s)
    cout += kai
    list1[cout_of_index] = 0
    cout_of_index += 1
    

for i in range(cout_of_index,n):
    cout += list1[i]
print(cout)

Fixed submission:
import math
n,m = map(int,input().split())

a = input()
list1 = list(map(int,a.split()))
list1.sort()
list1.reverse()
i = 0
s = math.floor(list1[0]/2)

if n == 1:
    print(math.floor(list1[0]/(2**m)))
    exit()

while True:
    while True:
        if i+1 > n:
            break
        if list1[i] < s or m == 0:
            break
        list1[i] = math.floor(list1[i]/2)
        m -= 1
        i += 1
    if m == 0:
        break
    list1.sort()
    list1.reverse()
    s = math.floor(list1[0]/2)
    i = 0
print(sum(list1))

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

a = input()
list1 = list(map(int,a.split()))

for i in range(m):
    s = max(list1)
    list1[list1.index(s)]= math.floor(s/2)
print(sum(list1))

Fixed submission:
import math
n,m = map(int,input().split())

a = input()
list1 = list(map(int,a.split()))
list1.sort()
list1.reverse()
i = 0
s = math.floor(list1[0]/2)

if n == 1:
    print(math.floor(list1[0]/(2**m)))
    exit()

while True:
    while True:
        if i+1 > n:
            break
        if list1[i] < s or m == 0:
            break
        list1[i] = math.floor(list1[i]/2)
        m -= 1
        i += 1
    if m == 0:
        break
    list1.sort()
    list1.reverse()
    s = math.floor(list1[0]/2)
    i = 0
print(sum(list1))

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

a = input()
list1 = list(map(int,a.split()))

list1.sort()

for i in range(m):
    list1[-1] = math.floor(list1[-1]/2)
    list1.sort()
print(sum(list1))

Fixed submission:
import math
n,m = map(int,input().split())

a = input()
list1 = list(map(int,a.split()))
list1.sort()
list1.reverse()
i = 0
s = math.floor(list1[0]/2)

if n == 1:
    print(math.floor(list1[0]/(2**m)))
    exit()

while True:
    while True:
        if i+1 > n:
            break
        if list1[i] < s or m == 0:
            break
        list1[i] = math.floor(list1[i]/2)
        m -= 1
        i += 1
    if m == 0:
        break
    list1.sort()
    list1.reverse()
    s = math.floor(list1[0]/2)
    i = 0
print(sum(list1))