TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
n,m = map(int,input().split())
item = list(map(int,input().split()))
 
item.sort(reverse=True)
s = 0
 
while s == 0:
    for i in range(n):
        item[i] = int(item[i]/2)
        m -= 1
        if m == 0:
            s = 1
            break
        continue
    item.sort(reverse=True)
    break
        
 
print(sum(item))

n,m = map(int,input().split())
item = list(map(int,input().split()))


item.sort(reverse=True)


while m != 0:
    
    
    for i in range(n):
        
        
        if i == 0:
            item[i] = int(item[i]/2)
            m -= 1
            temp = item[i]
            if m == 0:
                break
            continue
        
        
        if item[i] > temp:
            item[i] = int(item[i]/2)
            m -= 1
            if m == 0:
                break
            continue
        
        
        item.sort(reverse=True)
        break


print(sum(item))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
tmp = list(map(int,(input().split())))
n = tmp[0]
m = tmp[1]

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

while (m > 0): 
  ai.sort(reverse=True)
  for i in range(n-1):
    if ai[i] >= ai[i+1] :
      m -= 1
      ai[i] = ai[i] // 2

for i in range(n):
  sum += ai[i]

# print(ai)
print(sum)

import heapq

tmp = list(map(int,(input().split())))
n = tmp[0]
m = tmp[1]

ai = []
tmp = list(map(int,(input().split())))
for i in range(n):
  heapq.heappush(ai, -tmp[i])

for i in range(m):
  maxp = - heapq.heappop(ai)
  maxp = maxp // 2
  heapq.heappush(ai, -maxp)
  
sum = 0
for i in range(n):
  sum += -ai[i]

#print(ai)
print(sum)

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
from heapq import heappushpop, heappush, heappop, heapify
N, M = map(int, input().split())
a = [-int(a) for a in input().split()]
heapify(a)
t = heappop(a) / 2
for _ in range(M):
  t = heappushpop(a, t) / 2
heappush(a, t)
print(sum(int(-x) for x in a))


from heapq import heappushpop, heappush, heappop, heapify
N, M = map(int, input().split())
a = [-int(a) for a in input().split()]
heapify(a)
t = heappop(a) / 2
for _ in range(M - 1):
  t = heappushpop(a, t) / 2
heappush(a, t)
print(sum(int(-x) for x in a))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
from collections import deque

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

A = deque(A)
A = sorted(A)

for i in range(M):
    temp = A.pop() // 2

    for j in range(N)[::-1]:
        if j>0:
            if A[j-1] <= temp:
                A.insert(j,temp)
                print(A)
                break
        else:
            A.insert(0,temp)

print(sum(A))


from heapq import heappop,heappush

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

H = []

for i in A:
    heappush(H, -i)

for _ in range(M):
    heappush(H, -((-heappop(H)//2)) )

print(-sum(H))


Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
N, M = map(int, input().split())

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

a = list(map(lambda x: x*(-1), A_list))

import heapq
import math


heapq.heapify(a)

print(a)


for i in range(M):
        max_p = heapq.heappop(a)
        max_p = max_p / 2
        heapq.heappush(a, max_p)

res=0
for i in range(N):
        a[i] = -a[i]
        res += math.floor(a[i])

print(res)

N, M = map(int, input().split())

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

a = list(map(lambda x: x*(-1), A_list))

import heapq
import math


heapq.heapify(a)



for i in range(M):
        max_p = heapq.heappop(a)
        max_p = max_p / 2
        heapq.heappush(a, max_p)

res=0
for i in range(N):
        a[i] = -a[i]
        res += math.floor(a[i])

print(res)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
from sys import stdin
import heapq

n,m = map(int, input().split())
a = [int(x)*(-1) for x in stdin.readline().rstrip().split()]
heapq.heapify(a)

for i in range(m):
    temp = heapq.heappop(a)//2
    heapq.heappush(a,temp)

print(sum(a)*(-1))


from sys import stdin
import heapq

n,m = map(int, input().split())
a = [int(x)*(-1) for x in stdin.readline().rstrip().split()]
heapq.heapify(a)

for i in range(m):
    temp = (-1)*heapq.heappop(a)//2
    heapq.heappush(a,temp*(-1))

print(sum(a)*(-1))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import collections
n, k, q = map(int, input().split())
A = [int(input()) for _ in range(q)]
a_c = collections.Counter(A)
cnt = 0
x = ['No'] * n
if q-k < 0:
	for a in range(n):
		print('Yes')
	exit()
for i,j in a_c.items():
  if j > q-k:
    x[i-1] = 'Yes'
for k in x:
	print(k)

import heapq

n, m = map(int, input().split())
lis = []

for i in input().split():
  heapq.heappush(lis, -int(i))

for j in range(m):
  tmp = -heapq.heappop(lis)
  heapq.heappush(lis, -int((tmp/2)))

print(-sum(lis))

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x: x*(-1), a))
for i in range(m):
    heapq.heappush(a, heapq.heappop(a)//2)
print(sum(a)*-1)


import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x: x*(-1), a))
heapq.heapify(a)
for i in range(m):
    heapq.heappush(a, -1*(-heapq.heappop(a)//2))
print(sum(a)*-1)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq

n,m = map(int,input().split())
li = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(li)
for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  
print(-sum(a))

import heapq

n,m = map(int,input().split())
li = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(li)
for _ in range(m):
    tmp_min = heapq.heappop(li)
    heapq.heappush(li, (-1)*(-tmp_min//2))  
print(-sum(li))

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import heapq
import fractions
L = list(map(int, input().split()))
A = list(map(int, input().split()))
heapq.heapify(A)
for i in range(L[1]):
    mx = heapq.heappop(A)
    heapq.heappush(A, mx//2)
print(sum(A))

#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import heapq
import fractions
L = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [n*(-1) for n in A]
heapq.heapify(A)
for _ in range(L[1]):
    mx = heapq.heappop(A)*(-1)
    heapq.heappush(A, (mx//2)*(-1))

print(sum(A)*(-1))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(0,M):
    A[A.index(max)]=int(A[A.index(max)])

print(sum(A))

N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(0,M):
    A[A.index(max(A))]=int(A[A.index(max(A))])

print(sum(A))

import heapq
N, M = map(int, input().split())
A = list(map(lambda x:int(x)*(-1), input().split()))
heapq.heapify(A)
for i in range(0,M):
    a=heapq.heappop(A)
    heapq.heappush(A,(-1)*(-a//2))
print(-sum(A))



Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, M = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))

heapq.heapify(A)

for _ in range(M):
    dis = heapq.heappop(A)
    heapq.heappush(A, dis//2)

print(-1*sum(A))


import heapq
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))

heapq.heapify(A)

for _ in range(M):
    dis = heapq.heappop(A)
    heapq.heappush(A, dis//2)

print(-1*sum(A))


import heapq
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))

heapq.heapify(A)

for _ in range(M):
    dis = heapq.heappop(A)
    heapq.heappush(A, -(-dis//2))

print(-1*sum(A))


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq
import math
import sys
input = sys.stdin.readline


def main():
    n, m = map(int, input().split())

    if n == 1:
        a = int(input())
        for i in range(m):
            a //= 2
        print(a)
        exit()

    a = (list(map(int, input().split())))
    a = [-1 * i for i in a]
    heapq.heapify(a)

    for i in range(m):
        tmp = math.ceil(heapq.heappop(a) / 2)
        heapq.heappush(a, tmp)

    a = [-1 * i for i in a]
    print(sum(a))


import heapq
import math
import sys
input = sys.stdin.readline


def main():
    n, m = map(int, input().split())

    if n == 1:
        a = int(input())
        for i in range(m):
            a //= 2
        print(a)
        exit()

    a = (list(map(int, input().split())))
    a = [-1 * i for i in a]
    heapq.heapify(a)

    for i in range(m):
        tmp = math.ceil(heapq.heappop(a) / 2)
        heapq.heappush(a, tmp)

    a = [-1 * i for i in a]
    print(sum(a))


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
# -*-coding: utf-8 -*-
import heapq
def main():
    N, M = map(int, input().split())
    A = list(map(lambda x: int(x)*(-1), input().split()))
    heapq.heapify(A)

    for _ in range(M):
        tmp_min = heapq.heappop(A)
        heapq.heappush(a, (-1)*(-tmp_min//2))
    
    print(-sum(A))
if __name__ == '__main__':
    main()

# -*-coding: utf-8 -*-
import heapq
def main():
    N, M = map(int, input().split())
    A = list(map(lambda x: int(x)*(-1), input().split()))
    heapq.heapify(A)

    for _ in range(M):
        tmp_min = heapq.heappop(A)
        heapq.heappush(A, (-1)*(-tmp_min//2))
    
    print(-sum(A))
if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
from heapq import heapify, heappop, heappush
 
N, M = map(int, input().split())
A = [-1*int(i) for i in input().split()]

heapify(A)

for i in range(M):
    n = -1 * heappop(A)
    heappush(A, -1*(n//2))
    print(n, A)
 
print(-1*sum(A))

from heapq import heapify, heappop, heappush
 
N, M = map(int, input().split())
A = [-1*int(i) for i in input().split()]

heapify(A)

for i in range(M):
    n = -1 * heappop(A)
    heappush(A, -1*(n//2))
    #print(n, A)
 
print(-1*sum(A))

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq
N ,M = list(map(int,input().split()))
A = [int(x) for x in input().split()]
h = []
for i in range(N):
  heapq.heappush(h,-A[i])
for i in range(M):
  x = heapq.heappop(h)
  heapq.heappush(h,x//2)
print(-sum(h))

import heapq
N, M = list(map(int,input()))
h = []
for x in input().split():
  heappush(h, x)
print(heappop(h))
print(heappop(h))

import heapq
N, M = list(map(int,input().split()))
h = []
for x in input().split():
  heapq.heappush(h, -int(x))
for i in range(M):
  x = -heapq.heappop(h)
  x //= 2
  heapq.heappush(h,-x)
print(-sum(h))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
N,M=map(int,input().split())
*A,=map(int,input().split())
A=sorted(A)

while M:
    A[-1]//=2
    M-=1
    i=-2
    while M and (-N<=i and A[i]>=A[-1]):
        A[i]//=2
        M-=1
        print(A)
        i-=1
    A.sort()

print(sum(A))

N,M=map(int,input().split())
*A,=map(int,input().split())
from heapq import*
B=[]
for a in A:
    B.append(-a)
heapify(B)
for i in range(M):
    b=heappop(B)
    b=0--b//2
    heappush(B,b)
print(-sum(B))

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
A.sort(reverse=True)
print(A)
for i in range(0,M):
    A[0]=int(A[0]/2)
    A.sort(reverse=True)
    print(A)

print(sum(A))

import heapq
N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(A)
    
for i in range(0,M):
    tmp=heapq.heappop(A)
    heapq.heappush(A,-int(-tmp/2))
print(-sum(A))

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq
import sys
from io import StringIO
import unittest


n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)

for _ in range(m):
	tmp_min = heapq.heappop(a)
	heapq.heappush(a, (-1) * (-tmp_min // 2))
	print(-sum(a))

import heapq
import sys
from io import StringIO
import unittest

def resolve():
    n, m = map(int, input().split())
    a = list(map(lambda x: int(x) * (-1), input().split()))
    heapq.heapify(a)

    for _ in range(m):
        tmp_min = heapq.heappop(a)
        heapq.heappush(a, (-1) * (-tmp_min // 2))
    print(-sum(a))

import heapq
import sys
from io import StringIO
import unittest

n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1) * (-tmp_min // 2))
print(-sum(a))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
I = list(map(int,input().split()))
N = I[0]
M = I[1]
A = list(map(int,input().split()))

for i in range(M):
    num = index(max(A))
    A[num] = A[num] / 2

B = map(int,A)
ans = sum(B)
print(ans)

import heapq
I = list(map(int,input().split()))
N = I[0]
M = I[1]
A = list(map(lambda x:-x,map(int,input().split())))
heapq.heapify(A)
for i in range(M):
    num = heapq.heappop(A)
    num = math.ceil(num / 2)
    heapq.heappush(A,num)

print(-sum(A))

I = list(map(int,input().split()))
N = I[0]
M = I[1]
A = list(map(int,input().split()))

for i in range(M):
    num = index(max(A))
    A[num] = A[num] / 2

A = map(int,A)
ans = sum(A)
print(ans)

import heapq
import math
I = list(map(int,input().split()))
N = I[0]
M = I[1]
A = list(map(lambda x:-x,map(int,input().split())))
heapq.heapify(A)
for i in range(M):
    num = heapq.heappop(A)
    num = math.ceil(num / 2)
    heapq.heappush(A,num)

print(-sum(A))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
n,m=map(int,input().split())
a=list(map(int,input().split()))
c=0
while True:
    a.sort()
    a1=a[:n//2]
    a2=a[n//2:]
    while True:
        if c==m:
            print(sum(a1)+sum(a2))
            exit()
        if len(a2)==0:
            a=a1
            break
        k=a2.pop(-1)
        while True:
            k=k//2
            c+=1
            if k<=a1[-1]:
                a1.append(k)
                break

import heapq
n,m = map(int,input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
for i in range(m):
  min = heapq.heappop(a)
  heapq.heappush(a, (-min//2)*(-1))
print(-sum(a))

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import numpy as np
import heapq
n = list(map(int, input().split()))
h = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(h)
for i in range(n[1]):
    small = heapq.heappop(h)
    heapq.heappush(h, -1*(-small)//2)
print(-sum(h))

import numpy as np
import heapq
n = list(map(int, input().split()))
h = list(map(lambda x: int(x)*-1, input().split()))
heapq.heapify(h)
for i in range(n[1]):
    small = heapq.heappop(h)
    heapq.heappush(h, -1*(-small//2))
print(-sum(h))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq

N,M = map(int,input().split())

A = [int(i)*-1 for i in input().split()]
heapq.heapify(A)

for _ in range(M):
  max = heapq.heappop(A)
  heapq.heappush(A,max//2)





print(sum(A)*-1)  




import heapq

N,M = map(int,input().split())

A = [int(i)*-1 for i in input().split()]
heapq.heapify(A)

for _ in range(M):
  print(A)
  max = heapq.heappop(A) * -1
  heapq.heappush(A,(max//2)*-1)





print(sum(A)*-1)  




import heapq

N,M = map(int,input().split())

A = [int(i)*-1 for i in input().split()]
heapq.heapify(A)

for _ in range(M):
  max = heapq.heappop(A) * -1
  heapq.heappush(A,(max//2)*-1)





print(sum(A)*-1)  




Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq
import sys
input = sys.stdin.readine
n, m = map(int, input().split(" "))
liste = list(map(int, input().split(" ")))
liste = [(-1 * i) for i in liste]
heapq.heapify(liste)
for i in range(m):
    maxi = heapq.heappop(liste)
    maxi /= 2
    heapq.heappush(liste, int(maxi))
liste = [(-1 * i) for i in liste]
print(sum(liste))

import heapq
n, m = map(int, input().split(" "))
liste = list(map(int, input().split(" ")))
liste = [(-1 * i) for i in liste]
heapq.heapify(liste)
for i in range(m):
    maxi = heapq.heappop(liste)
    maxi /= 2
    heapq.heappush(liste, int(maxi))
sum = 0
for i in liste:
    sum += (-1 * i)
print(sum)

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import numpy as np
N, M = map(int, input().split())
As = np.array( list( map(float, input().split()) ) )
As /= 2.0
As.sort()
N1 = int(N/2)
for _ in range(M):
    As[-1] /= 2.0
    if As.size == 1:
      continue
    elif (As[-1] < As[-2]):
        As[-N1:].sort()

ans = np.sum(np.floor(As*2.0))
print(int(ans))

import heapq
N, M = map(int, input().split())
a_list = [-float(i) for i in input().split()]
heapq.heapify(a_list)
for _ in range(M):
    _ = heapq.heapreplace(a_list, a_list[0]/2.0)
ans = sum([-int(i) for i in a_list])
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b=mi()
l=list(mi())
l=list(map(lambda x: x*-1 , l))
heapq.heapify(l)
for i in range(b):
  s=heapq.heappop(l)
  s=(-1)*(-1*s)//2
  heapq.heappush(l,s)
ans=0
for i in range(a):
  d=heapq.heappop(l)
  ans+=(-1)*d
print(ans)

import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b=mi()
l=list(mi())
l=list(map(lambda x: x*-1 , l))
heapq.heapify(l)
for i in range(b):
  s=heapq.heappop(l)
  s=(-1)*(((-1)*s)//2)
  heapq.heappush(l,s)
ans=0
for i in range(a):
  d=heapq.heappop(l)
  ans+=(-1)*d
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
n, m = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
print(a)
for _ in range(m):
    idx = a.index(max(a))
    a[idx] //= 2
print(sum(a))

import heapq as hp
n, m = (int(x) for x in input().split())
a = [int(x)*(-1) for x in input().split()]
hp.heapify(a)
for _ in range(m):
    min = hp.heappop(a)
    hp.heappush(a, (-1)*(-min//2))
print(-sum(a))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
# -*- coding: utf-8 -*-
import heapq

num_product, num_coupon = [int(s) for s in input().split()]
price_list = []
for s in input().split():
  heapq.heappush(price_list, int(s)*-1)

for i in range(num_coupon):
  min = price_list[0]
  heapq.heapreplace(price_list, min//2)

sum = 0
for price in price_list:
  sum -= price

print(sum)

# -*- coding: utf-8 -*-
import heapq

num_product, num_coupon = [int(s) for s in input().split()]
price_list = []
for s in input().split():
  heapq.heappush(price_list, int(s)*-1)

for i in range(num_coupon):
  min = price_list[0]
  heapq.heapreplace(price_list, (min*-1//2)*-1)

sum = 0
for price in price_list:
  sum -= price

print(sum)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
n,m=list(map(int, input().split()))
a=list(map(int, input().split()))
b=[-a[i] for i in range(n)]

import heapq
heapq.heapify(b)

for i in range(m):
	maximum=heapq.heappop(b)
	maximum=maximum//2
	heapq.heappush(b,maximum)
print((sum(b))*(-1))



n,m=list(map(int, input().split()))
a=list(map(int, input().split()))
b=[-a[i] for i in range(n)]
#print(b) => [-1, -9, -3, -5]

import heapq
heapq.heapify(b)
#print(b) => [-9, -5, -3, -1]

for i in range(m):
	maximum=heapq.heappop(b)

	
	maximum=-(-maximum//2)
	heapq.heappush(b,maximum)
print((sum(b))*(-1))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
n,m=map(int,input().split())
A=[int(i) for i in input().split()]

A.sort()
A.reverse()
#print(A)
if n==1:
    ans=A[0]//(2**m)
    print(ans)
else:
    A.append(0)
    big=A[0]
    stc=0
    now=0
    while m>0:
        A[now]=A[now]//2
        m-=1
        big=A[0]
        for i in range(n-1):
            if A[i+1]>=big and m>0:
                A[i+1]=A[i+1]//2
                m-=1
            else:
                A.sort()
                A.reverse()
                break
        print(A)
    else:
        print(sum(A))
        

n,m=map(int,input().split())
A=[int(i) for i in input().split()]

A.sort()
A.reverse()
#print(A)
if n==1:
    ans=A[0]//(2**m)
    print(ans)
else:
    A.append(0)
    big=A[0]
    stc=0
    now=0
    while m>0:
        A[now]=A[now]//2
        m-=1
        big=A[0]
        for i in range(n-1):
            if A[i+1]>=big and m>0:
                A[i+1]=A[i+1]//2
                m-=1
            else:
                A.sort()
                A.reverse()
                break
        #print(A)
    else:
        print(sum(A))
        

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
N,M = map(int, input().split())
import heapq
A = list(map(int, input().split()))
A = [(-x,x) for x in A]
heapq.heapify(A)
def conf(A, M):
    if M > 0:
        a = heapq.heappop(A)[1]
        heapq.heappush(A, (-int(a/2), int(a/2)))
    else:
        return A
    return conf(A, M-1)
B = [a[1] for a in A]
print(sum(B))

N,M = map(int, input().split())
import heapq
A = list(map(int, input().split()))
A = [(-x,x) for x in A]
heapq.heapify(A)
for _ in range(M):
    a = heapq.heappop(A)[1]
    heapq.heappush(A, (-int(a/2), int(a/2)))
B = [a[1] for a in A]
print(sum(B))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
from enum import Enum
from queue import Queue

import numpy as np

import collections
import bisect
import sys
import math
import heapq

from scipy.sparse.csgraph import floyd_warshall

N,M = map(int,input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)

for _ in range(M):
    tmp_min = heapq.heappop(A)
    heapq.heappush(A, (-1)*(-tmp_min/2))
print(-sum(A))


from enum import Enum
from queue import Queue

import numpy as np

import collections
import bisect
import sys
import math
import heapq

from scipy.sparse.csgraph import floyd_warshall

N,M = map(int,input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)

for _ in range(M):
    tmp_min = heapq.heappop(A)
    heapq.heappush(A, (-1)*(-tmp_min//2))
print(-sum(A))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
#!/usr/bin/env python
# coding: utf-8

# In[69]:


#import copy
import numpy as np

N, M = map(int, input().split())
As = np.sort(np.array(list(map(int, input().split()))))[::-1]
"""
3 3
2 13 8

4 4
1 9 3 5
"""


# In[70]:


As


# In[71]:


#As[0] = As[0] // 2
#arg = 0
for i in range(M):
    if i == 0:
        arg = 0
    else:
        arg = np.argmax(As[:i+1])
    #print(arg)
    As[arg] = As[arg] // 2
    #As[:i+1] = np.sort(As[:i+1])[::-1]
    #As[0] = As[0] // 2


# In[72]:


print(As)
print(sum(As))


# In[ ]:






#!/usr/bin/env python
# coding: utf-8

# In[8]:


# import copy
#import numpy as np
import heapq

N, M = map(int, input().split())

def int_minus(s):
    return -int(s)

As = list(map(int_minus, input().split()))
"""
3 3
2 13 8

4 4
1 9 3 5
"""


# In[10]:


heapq.heapify(As)


# In[17]:


for i in range(M):
    mx = heapq.heappop(As)
    heapq.heappush(As, -(-mx//2))


# In[19]:


#print(As)
print(-sum(As))


# In[ ]:






Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq

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

B = []

for i in A:
    B.append(-i)

heapq.heapify(B)
print(*B)
for i in range(M):
    tmp = heapq.heappop(B)
    heapq.heappush(B,-1*(-tmp//2))

print(-sum(B))

import heapq

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

B = []

for i in A:
    B.append(-i)

heapq.heapify(B)

for i in range(M):
    tmp = heapq.heappop(B)
    heapq.heappush(B,-1*(-tmp//2))

print(-sum(B))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
N,M = map(int, input().split())
A = [int(a) for a in input().split()]

A.sort(reverse=True)
List = [[] for i in range(100)]
for i in range(M):
    temp = bin(A[i])
    List[len(temp)-3].append(A[i])

List.reverse()
List = [i for i in List if i != []]
for i in range(len(List)):
    List[i].sort(reverse=True)
c = 0
cnt = 0
while cnt < M:
    for i in range(cnt+1):
        for j in range(len(List[i])):
            List[i][j] = List[i][j]//2
            c += 1
            if c == M:
                c = M+1
                break
        if c > M:
            break
    cnt += 1
            
ans = 0
for i in range(len(List)):
    ans += sum(List[i])
            
print(ans)

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

import heapq

h = []
for i in range(N):
    heapq.heappush(h, A[i]*(-1))
    
for i in range(M):
    temp = heapq.heappop(h)
    temp *= (-1)
    temp //= 2
    temp *= (-1)
    heapq.heappush(h, temp)
    
print(sum(h)*(-1))

Verdicts: Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
N,M = map(int, input().split())
A = list(map(int,input().split())).sort()

for i in range(N):
	A[N] // 2
	A.sort()

B = sum(A)

print(B)

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

for i in range(N):
	A[N] = A[N]// 2
	A.sort()

B = sum(A)

print(B)

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

A.sort(reverse = True)
i = 0
for j in range(M):
	A[i] = A[i]//2
	if i <= N-2 and A[i] < A[i+1] and A[0] < A[i+1]:
		i += 1
	else :
		A.sort(reverse=True)
		i = 0
print(str(sum(A)))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):

from heapq import heapify, heapreplace
 
n, m = list(map(int, input().split()))
aaa = [-a for a in map(int, input().split())]

heapify(aaa)
 
for _ in range(m):
    heapreplace(aaa, aaa[0] // 2)
    
    
    
print(-sum(aaa))



import heapq
N, M = map(int, input().split())
A = [-i for i in list(map(int, input().split()))]

heapq.heapify(A)
for m in range(M):
    A_max = -heapq.heappop(A)  
    heapq.heappush(A, -(A_max // 2))
print(-sum(A))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
from heapq import heappush, heappop
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

Blist=Alist
#print(Alist)
my_list = [9,8,7,4,7,1,3]


heap = []
 
for i in Alist:
    heappush(heap, i)
Alist=heap
def insert_list(list, value):
	start=0
	end=len(list)-1

	if value<list[len(list)-1]:
		list.insert(len(list), value)
		return list
	if value>list[0]:
		list.insert(0, value)
		return list
	while True:
		mid_point=int((start+end)/2)
		if value>list[mid_point]:
			if (end-start)<2:
				list.insert(start, value)
				return list
			else:
				end=mid_point
		else:
			if (end-start)<2:
				list.insert(end, value)
				return list
			else:
				start=mid_point

for i in range(K):
   Alist[0]=Alist[0]/2
   
   if len(Alist)>1:
      value=Alist.pop(0)
      Alist=insert_list(Alist,value)
sum=0

for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

from heapq import heappush, heappop
N, K = list(map(int, input().split()))

Alist = [int(i) for i in input().split(' ')]
import math

Blist=Alist
#print(Alist)
#my_list = [9,8,7,4,7,1,3]


heap = []
 
for i in Alist:
    heappush(heap, -i)
Alist=heap
def insert_list(list, value):
	start=0
	end=len(list)-1

	if value<list[len(list)-1]:
		list.insert(len(list), value)
		return list
	if value>list[0]:
		list.insert(0, value)
		return list
	while True:
		mid_point=int((start+end)/2)
		if value>list[mid_point]:
			if (end-start)<2:
				list.insert(start, value)
				return list
			else:
				end=mid_point
		else:
			if (end-start)<2:
				list.insert(end, value)
				return list
			else:
				start=mid_point

for i in range(K):
   Alist[0]=Alist[0]/2
   
   if len(Alist)>1:
      value=Alist.pop(0)
      Alist=insert_list(Alist,value)
sum=0

for i in Alist:
   sum+=math.floor(i) 
print(int(sum))

from heapq import heappush, heappop
import math
 
N,M = [int(i) for i in input().split(' ')]
inputList = [int(i) for i in input().split(' ')]
list = []
 
for i in inputList:
    heappush(list, -i)
 
for _ in range(M):
    heappush(list, math.ceil(heappop(list)/2))
    
print(-sum(list))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import bisect

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

Ai.sort()
for _ in range(M):
    value = int(Ai.pop() / 2)
    bisect.insort(Ai, value)

sum(Ai)

from collections import deque

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

Ai.sort(reverse=True)
Ai_deque = deque(Ai)
kari = deque()
for _ in range(M):
    try:
        if Ai_deque[0] > kari[0]:
            value = Ai_deque.popleft() // 2
        else:
            value = kari.popleft() // 2
    
    except:
        if not kari:
            value = Ai_deque.popleft() // 2
        else:
            value = kari.popleft() // 2
    
    kari.append(value)
    
print(sum(Ai_deque) + sum(kari))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq
n,m = map(int,input().split())
a = [int(i) * (-1) for i in input().split()]
 
heapq.heapify(a)

print(a)
 
for _ in range(m):
	a_min = heapq.heappop(a)
	heapq.heappush(a,(-(-a_min//2)))

print(-sum(a))

import heapq
n,m = map(int,input().split())
a = [int(i) * (-1) for i in input().split()]
 
heapq.heapify(a)

for _ in range(m):
	a_min = heapq.heappop(a)
	heapq.heappush(a,(-(-a_min//2)))

print(-sum(a))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
sum = sum(A)
num = 0
for i in range(M):
    B = max(A)
    num += B - B // 2
print(sum-num)

import heapq
N,M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))
heapq.heapify(A)
ans = 0
for i in range(M):
    most_expensive = -heapq.heappop(A)
    most_expensive //= 2
    heapq.heappush(A, -most_expensive)
print(-sum(A))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is going to buy N items one by one.  The price of the i-th item he buys is A_i yen (the currency of Japan).  He has M discount tickets, and he can use any number of them when buying an item.  If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.  What is the minimum amount of money required to buy all the items?

Submission attempts (in order):
import heapq
from sys import stdin
n,m = map(int,stdin.readline().split())
*l, = map(lambda x:-int(x),stdin.readline().split())
heapq.heapify(l)
for i in [0]*m:
  a=heapq.heappop(l)
  heapq.heappush(l, a//2)
print(-(sum(l)))

import math
import sys
log2 = math.log2
n,m = map(int,input().split())
l = sorted(list(map(int,input().split())))
l.reverse()
if n == 1:
  print(l[0]//(2**m))
  sys.exit()
  
yl = [0]*n
flag = False
logl = [int(log2(i)) for i in l]
ans = 0
while True:
  for i in range(n-1):
    if logl[i]>logl[i+1]:
      logl[i] -= 1
      yl[i] += 1
      m -= 1
      if m == 0:
        flag = True
        break
  if flag:
    break
for i,j in zip(l,yl):
  ans += i//(2**j)
print(ans)

import heapq
from sys import stdin
n,m = map(int,stdin.readline().split())
*l, = map(lambda x:-int(x),stdin.readline().split())
heapq.heapify(l)
for i in [0]*m:
  a=heapq.heappop(l)
  heapq.heappush(l, -(-a//2))
print(-(sum(l)))

Verdicts: Wrong Answer

Wrong Answer

Accepted