Buggy python submission (verdict: Runtime Error):
import math
import bisect

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

def XX(A, M):
  if M <= 0:
    return
  A[0] = A[0]/2
  M -= 1
  for i in range(1, len(A)):
    if A[i] > A[0] and M > 0:
      A[i] = A[i]/2
      M -= 1
    else:
      break
  A.sort(reverse = True)
  XX(A, M)
  
XX(A, M)
A = list(map(math.floor, A))
print(sum(A))
  
           

Fixed submission:
import math
import bisect

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

def XX(A, M):
  if M <= 0 or A[0]<1:
    return
  A[0] = A[0]/2
  M -= 1
  for i in range(1, len(A)):
    if A[i] > A[0] and M > 0:
      A[i] = A[i]/2
      M -= 1
    else:
      break
  A.sort(reverse = True)
  XX(A, M)
  
XX(A, M)
A = list(map(math.floor, A))
print(sum(A))

Buggy python submission (verdict: Runtime Error):
import math
import bisect

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

def XX(A, M):
  if M <= 0:
    return
  A[0] = A[0]/2
  M -= 1
  for i in range(1, len(A)):
    if A[i] > A[0] and M > 0:
      A[i] = A[i]/2
      M -= 1
    else:
      break
  A.sort(reverse = True)
  XX(A, M)
  
A = list(map(math.floor, A))
XX(A, M)
print(sum(A))
  
           

Fixed submission:
import math
import bisect

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

def XX(A, M):
  if M <= 0 or A[0]<1:
    return
  A[0] = A[0]/2
  M -= 1
  for i in range(1, len(A)):
    if A[i] > A[0] and M > 0:
      A[i] = A[i]/2
      M -= 1
    else:
      break
  A.sort(reverse = True)
  XX(A, M)
  
XX(A, M)
A = list(map(math.floor, A))
print(sum(A))

Buggy python submission (verdict: Runtime Error):
A = list(map(math.floor, A))

Fixed submission:
import math
import bisect

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

def XX(A, M):
  if M <= 0 or A[0]<1:
    return
  A[0] = A[0]/2
  M -= 1
  for i in range(1, len(A)):
    if A[i] > A[0] and M > 0:
      A[i] = A[i]/2
      M -= 1
    else:
      break
  A.sort(reverse = True)
  XX(A, M)
  
XX(A, M)
A = list(map(math.floor, A))
print(sum(A))

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

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

while M > 0:
  A.insert(bisect.bisect_left(A, A[-1]/2, hi=len(A)-1), A[-1]/2)
  A.pop(-1)
  M -= 1
  
A = list(map(math.floor, A))
print(sum(A))
  
           

Fixed submission:
import math
import bisect

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

def XX(A, M):
  if M <= 0 or A[0]<1:
    return
  A[0] = A[0]/2
  M -= 1
  for i in range(1, len(A)):
    if A[i] > A[0] and M > 0:
      A[i] = A[i]/2
      M -= 1
    else:
      break
  A.sort(reverse = True)
  XX(A, M)
  
XX(A, M)
A = list(map(math.floor, A))
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import math
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse = True)

while M > 0:
  A[0] = A[0]/2
  A.sort(reverse = True)
  M -= 1

A = list(map(math.floor, A))
print(sum(A))

Fixed submission:
import math
import bisect

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

def XX(A, M):
  if M <= 0 or A[0]<1:
    return
  A[0] = A[0]/2
  M -= 1
  for i in range(1, len(A)):
    if A[i] > A[0] and M > 0:
      A[i] = A[i]/2
      M -= 1
    else:
      break
  A.sort(reverse = True)
  XX(A, M)
  
XX(A, M)
A = list(map(math.floor, A))
print(sum(A))