Problem:


Score : 400 points

Problem Statement

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?

Constraints

All values in input are integers.

1 \leq N, M \leq 10^5

1 \leq A_i \leq 10^9

Input

Input is given from Standard Input in the following format:

N M
A_1 A_2 ... A_N

Output

Print the minimum amount of money required to buy all the items.

Sample Input 1

3 3
2 13 8

Sample Output 1

9

We can buy all the items for 9 yen, as follows:

Buy the 1-st item for 2 yen without tickets.

Buy the 2-nd item for 3 yen with 2 tickets.

Buy the 3-rd item for 4 yen with 1 ticket.

Sample Input 2

4 4
1 9 3 5

Sample Output 2

6

Sample Input 3

1 100000
1000000000

Sample Output 3

0

We can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.

Sample Input 4

10 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

Sample Output 4

9500000000



Sample input:
3 3
2 13 8


Sample output:
9

Submission status: Time Limit Exceeded

Solution code:
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))

for _ in range(M):
  A[-1] = int(A[-1]/2)
  A.sort()
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
lst = [int(i) for i in input().split()]
lst.sort()
for x in range(m):
    lst[-1] //= 2
    if n != 1 and lst[-1] < lst[-2]:
        lst.sort()
print(sum(lst))

Submission status: Time Limit Exceeded

Solution code:
import math

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

for i in range(m):
    mm = max(A)
    ii = math.floor(mm/2)
    ind = A.index(mm)
    A[ind] = ii

print(int(sum(A)))

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
arr = list(map(int, input().split()))
for _ in range(m):
    _max = max(arr)
    i = arr.index(_max)
    arr[i] = _max // 2
print(sum(arr))

Submission status: Time Limit Exceeded

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))

a=sorted(a)
if n==1:
  for i in range(m):
    a[0]=a[0]//2
else:
  for i in range(m):
    if a[n-2]>a[n-1]:
      a=sorted(a)
    a[n-1]=a[n-1]//2

ans=sum(a)
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

for _ in range(M):
    A = sorted(A, reverse=True)
    if A[0] == 0:
        break
    A[0] //= 2

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
n,m=map(int, input().split())
a=list(map(int, input().split()))

while(m>0):
    max_index=a.index(max(a))
    a[max_index] = a[max_index]//2
    m-=1
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
import sys, math
#import numpy as np

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

for i in range(M):
    #max_a = A_list.max()
    #index = A_list.argmax()
    index = A_list.index(max(A_list))
    A_list[index] = math.floor(A_list[index] / 2)
    #print(A_list)
    
print(sum(A_list))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

n, m = map(int, input().split())
a = np.array(list(map(int, input().split())))

for i in range(m):
  idx = a.argmax()
  a[idx] //= 2

print(np.sum(a))

Submission status: Time Limit Exceeded

Solution code:
n,m = map(int,input().split())
aa = list(map(int,input().split()))
for i in range(m):
    aa.sort()
    aa[-1]=aa[-1]//2
print(sum(aa))

Submission status: Time Limit Exceeded

Solution code:
N,M = map(int, input().split())
A = sorted(list(map(int, input().split())),reverse=True)
value = sum(A)

for i in range(M):
    value = value-max(A)+max(A)//2
    for j in range(N):
        if A[j] == max(A):
            A[j] //= 2
            break

print(value)

Submission status: Time Limit Exceeded

Solution code:
#l=list(map(int, input().split()))
n,m=map(int, input().split())
l=list(map(int, input().split()))

a = sorted(l, reverse=True)

for i in range(m):
    a[0] = a[0]//2
    a = sorted(a, reverse=True)

print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
def test():
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    for i in range(m):
        a[a.index(max(a))] = max(a)//2
    print(sum(a)) 


if __name__ == "__main__":
    test()

Submission status: Time Limit Exceeded

Solution code:
[n, m] = list(map(int, input().split()))
a = list(map(int, input().split()))

import numpy as np

a = np.array(a)

for _m in range(m):
    a[np.argmax(a)] = int(a[np.argmax(a)]/2)

print(np.sum(a))

Submission status: Time Limit Exceeded

Solution code:
n,m = (int(i) for i in input().split()) 
a = [int(i) for i in input().split()]
a.sort(reverse=True)
for i in range(m):
    down = a[0]
    a.remove(down)
    a.append(down//2)
    a.sort(reverse=True)
    
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
n,m=map(int,input().split())

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

for i in range(m):
	A[A.index(max(A))]//=2
	
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
    a.sort(reverse=True)
    a[0] = a[0] >> 1
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
a=input().split(" ")
N=int(a[0])
M=int(a[1])
b=input().split(" ")
list_price=[]
for i in range(N):
    list_price.append(int(b[i]))

for i in range(M):
    newlist=[]
    for p in range(N):
        newlist.append((list_price[p]-(list_price[p]/2)//1))
    list_price[newlist.index(max(newlist))]=(list_price[newlist.index(max(newlist))]/2)//1
print(int(sum(list_price)))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

# N = int(input())
N,M = list(map(int, input().split()))
As = np.array(list(map(int, input().split())))

# As.sort(reverse=True)
#
# for i in range(N-1):
#     A = As[i]
#     A_next = As[i+1]
#     while A > A_next and M>0:
#         A = A//2
#         M -= 1
#         print("use",M)
#
#     As[i] = A
#     print(As)
# print(sum(As))


for i in range(M):
    ind = np.argmax(As)
    As[ind] = As[ind] // 2

print(np.sum(As))

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
value = list(map(int, input().split()))
for i in range(m):
  value.sort(reverse = True)
  value[0] = value[0] // 2
ans = 0
for i in range(n):
  ans += value[i]
print(ans)

Submission status: Time Limit Exceeded

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

A.sort(reverse=True)
if len(A) == 1:
    A[0] = A[0] // (2**M)
else:
    while M > 0:
        #割引券なくなるまで
        # index:0 と index:1 を比較して一気に何枚が使う
        m = A[0] // A[1]
        if m <= M:
            A[0] //= (2**m)
            M -= m
        else:
            A[0] //= (2**M)
            M = 0
        if A[0] < A[1]:
            A.sort(reverse=True)
        #print('Hoo')
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
N, M = map(int, input().split())
items = list(map(int, input().split()))
for _ in range(M):
	items[items.index(max(items))] //= 2
print(sum(items))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

def main():
    N, M = [int(x) for x in input().split()]
    orig = np.array([int(x) for x in input().split()], dtype=np.float64)
    A = np.copy(orig)
    p = [0] * N
    for _ in range(M):
        x = np.argmax(A)
        p[x] += 1
        # 2のpowの桁数が大きくなりすぎることを避ける
        if A[x] < 1:
            continue
        A[x] = orig[x] / (2 ** p[x])
    print(A.astype(np.int64).sum())

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import bisect

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
for _ in range(m):
    am = a.pop()
    am = am // 2
    bisect.insort_left(a, am)
    
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
import array

n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
a = array.array("L", a)
for i in range(m):
    a[-1] //= 2
    for j in range(1, n):
        if a[-j] > a[-j - 1]:
            break
        a[-j], a[-j - 1] = a[-j - 1], a[-j]
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
import math
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))

for i in range(M):
  A[-1] = A[-1] //2
  A = sorted(A)
  
print(sum(A))

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(M):
    A.sort(reverse = True)
    A[0] = A[0]//2
for i in range(len(A)):
    ans +=A[i]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import log2
N, M = map(int, input().split())
A = list(map(int, input().split()))

for i in range(M):
    A.sort()
    A[-1] = (A[-1]//2)

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import bisect

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

for _ in range(M):
  discount = a_l[-1]//2
  a_l = a_l[:-1]
  bisect.insort_right(a_l,discount)

print(sum(a_l))

Submission status: Time Limit Exceeded

Solution code:
temp = list(map(int, input().split()))
N = temp[0] #品物の数
M = temp[1] #割引券の枚数
A = list(map(int, input().split())) #品物の値段のリスト

A.sort(reverse=True)

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

total = 0
for i in range(N):
  total += A[i]
print(total)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N, M = map(int, input().split())
A = np.array(list(map(int, input().split())))

for i in range(M):
  A.sort()
  A[-1] /= 2

print(int(np.sum(np.floor(A))))

Submission status: Time Limit Exceeded

Solution code:
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
q=[]
for i in range(n):
  q.append((-1)*a[i])
for k in range(m):
  heapq.heapify(q)
  ma=heapq.heappop(q)
  if ma%2==0:
    heapq.heappush(q,ma//2)
  else:
    heapq.heappush(q,ma//2+1)
print(sum(q)*(-1))

Submission status: Time Limit Exceeded

Solution code:
S = list(map(int, input().split()))
N = S[0]
M = S[1]
A = list(map(int, input().split()))


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

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N,M = map(int, sys.stdin.readline().split())
list_A = list(map(int, sys.stdin.readline().split()))

for i in range(M):
    list_A.sort(reverse=True)
    list_A[0] = int(list_A[0]/2) 

ans = 0

for i in range(N):
    ans += list_A[i]

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
a = list([int(x) for x in input().split()])

for i in range(m):
    a[a.index(max(a))] = max(a)//2
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
def main():
    n, m = (int(i) for i in input().split(' '))

    objs = [int(i) for i in input().split(' ')]

    for i in range(m):
        max_value = 0
        max_value_index = 0
        for j in range(len(objs)):
            if max_value < objs[j]:
                max_value = objs[j]
                max_value_index = j

        objs[max_value_index] = max_value // 2

    print(sum(objs))


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

def ans() :
    n, m  = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()

    for i in range(m):
        a[-1] = a[-1] >> 1
        a.sort()

    print(sum(a))

if __name__ == '__main__':
    ans()

Submission status: Time Limit Exceeded

Solution code:
import sys


def input(): return sys.stdin.readline().strip()


def main():
    N, M = map(int, input().split())
    prices = [[int(a), int(i)] for i, a in enumerate(input().split())]

    for _ in range(M):
        i = max(prices)[1]
        prices[i][0] //= 2

    ans = sum(map(lambda x: x[0], prices))
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import bisect

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

a.sort()

for i in range(m):
    div_a = a.pop(-1)
    div_a = div_a // 2
    bisect.insort_left(a, div_a)

ans = sum(a)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
value = sum(a)
used = []
import math
for i in range(m):
  if value == 0:
    break
  
  if used != []:
    if a != []:
      if max(used) < a[-1]:
        value -= math.ceil(a[-1]/2)
        used.append(math.floor(a[-1]/2))
        a = a[:-1]
      else:
        use = max(used)
        value -= math.ceil(use/2)
        used[used.index(use)] //= 2
    else:
      use = max(used)
      value -= math.ceil(use/2)
      used[used.index(use)] //= 2
  else:
    value -= math.ceil(a[-1]/2)
    used.append(math.floor(a[-1]/2))
    a = a[:-1]
print(value)

Submission status: Time Limit Exceeded

Solution code:
import bisect
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N, M = map(int, input().split())
        A = list(map(int, input().split()))

        A.sort()
        for _ in range(M):
            bisect.insort(A, A.pop() // 2)

        print(sum(A))


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Time Limit Exceeded

Solution code:
import math
N , M = map(int, input().split())
A = list(map(int , input().split()))
#print(A)
for _ in range(M):
    max_index = A.index(max(A))
    A[max_index] = A[max_index] / 2
A = list(map( lambda x : math.floor(x) , A ))
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(m):
    a.sort()
    maxa=a[len(a)-1]
    maxa = maxa // 2
    a[len(a)-1] = maxa
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
from bisect import bisect_left
from math import floor


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

    for _ in range(M):
        x = A.pop() / 2

        i = bisect_left(A, x)

        A.insert(i, x)

    ans = 0

    for a in A:
        ans += floor(a)

    print(ans)


if __name__ == '__main__':
    p_d()

Submission status: Time Limit Exceeded

Solution code:
N,M=map(int, input().split())
A=list(map(int, input().split()))
A.index(max(A))
for i in range(M):
    A[A.index(max(A))]=A[A.index(max(A))]//2
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(int(1e6))

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

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

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
def main():
    [N, M] = [int(num) for num in input().split()]
    A = [int(num) for num in input().split()]

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

    A = [a//1 for a in A]
    print(int(sum(A)))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
cost=sum(A)
for i in range(M):
    if A[N-1]%2==0:
        cost-=A[N-1]//2
    else:
        cost=cost-A[N-1]//2-1
    A[N-1]=A[N-1]//2
    if A[N-2]>A[N-1]:
        A.sort()
print(cost)

Submission status: Time Limit Exceeded

Solution code:
n,m = map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)

for i in range(m):
    a[0]=a[0]//2
    a.sort(reverse=True)

print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
s = input().split()
N = int(s[0])
M = int(s[1])
A = list(map(int, input().split()))

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

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(1000000)

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

def solve(A, M):
    if len(A) > 1:
        if M==1:
            B = sum(A[1:]) + A[0]//2
        else:
            A = [A[0]//2] + A[1:]
            A.sort(reverse=True)
            B = solve(A, M-1)
    else:
        B = A[0] // (2**M)
    return B

Alist.sort(reverse=True)
B = solve(Alist, M)
print(B)

Submission status: Time Limit Exceeded

Solution code:
import math

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

for i in range(M):
    A[-1] /= 2
    A = sorted(A)

for j in range(N):
    A[j] = math.floor(A[j])

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import math

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

A = list(map(int,input().split(" ")))
maxs = 0
k = 0
for i in range(M):
    maxs = max(A)
    k = A.index(maxs)
    A[k] = math.floor(A[k] / 2)

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse = True)

while m > 0:
    found = False
    for i in range(n-1):
        if a[i] < a[i+1]:
            a[i+1] = int(a[i+1] / 2)
            found = True
            break
    if not found:
        a[0] /= 2
    m -= 1
sum = 0
for a_i in a:
    sum += int(a_i)
print(sum)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin


def main():
    N, M = [int(x) for x in stdin.readline().rstrip().split()]
    As = [int(x) for x in stdin.readline().rstrip().split()]
    As.sort()
    for _ in range(M):
        As[-1] /= 2
        As.sort()
    print(sum([int(x) for x in As]))


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
for i in range(m):
	a[0] = a[0]//2
	a.sort(reverse=True)
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
n, m = [int(v) for v in input().split()]
values = sorted([int(v) for v in input().split()], reverse=True)

def insert(arr, val):
    left, right = 0, len(arr) - 1
    while right - left > 1:
        index = (left + right) // 2
        if val <= arr[index]:
            left = index
        else:
            right = index
    return arr[0:(left + 1)] + [val] + arr[(left + 1):]

for _ in range(m):
    v = values[0] >> 1
    values = insert(values[1:], v)

print(sum(values))

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
for i in range(m):
    b = a.pop(0)
    a.append(b // 2)
    a.sort(reverse=True)
ans = sum(a)
print(ans)

Submission status: Time Limit Exceeded

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


print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
N,M = input().split()
N = int(N)
M = int(M)
price_list = input().split()
for i in range(N):
  price_list[i] = int(price_list[i])

for m in range(M):
  max_num = price_list.index(max(price_list))
  price_list[max_num] = int(price_list[max_num] / 2)
print(sum(price_list))

Submission status: Time Limit Exceeded

Solution code:
N,M=map(int,input().split())
# N,M=3,3
A = list(map(int,input().split()))
A.append(-1)
# A=[2,13,8]

# print(N,M,A)
Val = sorted(A,reverse=True)
# print("割引前",Val)

#Ｍ枚の商品券を持っているため
for i in range(M):
    Val[0]= Val[0]//2
    if Val[0] < Val[1]:
        Val = sorted(Val,reverse=True)

# print("計算後",Val)
print(sum(Val)+1)

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
a = [int(i) for i in input().split()]

a.sort(reverse=True)

for _ in range(m):
    a[0] = a[0] // 2
    
    #swap
    rank = 0
    a0 = a[0]
    for i in range(1, n):
        if a[i] <= a0:
            break
        else:
            a[i-1] = a[i]
            a[i] = a0

print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
import bisect

n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
for _ in range(m):
    a = A.pop() // 2
    i = bisect.bisect(A, a)
    A.insert(i, a)
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(m):
  a[a.index(max(a))] //= 2
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import bisect

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

for i in range(M):
    max_price = A_list.pop()
    bisect.insort(A_list, max_price // 2)

print(sum(A_list))

Submission status: Time Limit Exceeded

Solution code:
import bisect

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

for i in range(m):
  a = aaa.pop(-1)
  a = a // 2
  insert_index = bisect.bisect_left(aaa, a)
  aaa.insert(insert_index, a)
  
print(sum(aaa))

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
src = list(map(int, input().split()))
def waru(org_list):
    new = sorted(org_list, reverse=True)
    new[0] = new[0]//2
    return new
for _ in range(m):
    src = waru(src)
print(sum(src))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

n,m = map(int,input().split())
a = np.array(list(map(int,input().split())))

for _ in range(m):
    idx = a.argmax()
    a[idx] = np.floor(a[idx]/2)
print(np.sum(a))

Submission status: Time Limit Exceeded

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

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

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
for i in range(m):
    l[0]=l[0]//2
    if len(l)>1:
        if l[0]<l[1]:
            l.sort(reverse=True)
print(sum(l))

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))

while m>0:
    max_a_ind=a.index(max(a))
    a[max_a_ind]=a[max_a_ind]//2
    m-=1

print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
n,m = map(int, input().split())
lst = list(map(int, input().split()))
# lst.sort(reverse=True)

for i in range(m):
    lst.sort(reverse=True)
    lst[0]=int(lst[0]/2)

    # if lst[0]<lst[1]:
    #     lst[0],lst[1]=lst[1],lst[0]
print(sum(lst))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n, m = map(int, input().split())
a = np.array(list(map(int, input().split())))
for i in range(m):
    a[np.argmax(a)] //= 2
print(np.sum(a))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# abc141/abc141_d
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    A = i2nn()
    A2 = sorted(A, reverse=True)
    for _ in range(M):
        discount(A2, N)
    print(sum(A2))
    return

def discount(A, N):
    A[0] = A[0] >> 1
    for i in range(N - 1):
        if A[i] < A[i+1]:
            A[i], A[i+1] = A[i+1], A[i]
        else:
            break
    # print(A)

main()

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
arr = sorted(list(map(int, input().split())), reverse=True)
for _ in range(m):
    _max = max(arr)
    i = arr.index(_max)
    arr[i] = _max // 2
print(sum(arr))

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A)

from bisect import bisect_left

for _ in range(m):
    x = A.pop()
    x = x//2
    A.insert(bisect_left(A, x), x)

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
n,m=map(int,input().split())
a =list( map(int,input().split()))

for ii in range(m):
    a[a.index(max(a))] = int(a[a.index(max(a))] / 2)

print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
import sys
INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
sys.setrecursionlimit(10 ** 9)


def main():
    N, M = MAP()
    A = LIST()

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

    print(sum(A))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N, M=(int(i) for i in input().split())
A=[int(i) for i in input().split()]
A.sort(reverse=True)


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

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
n,m = map(int,input().split())
As = list(map(int,input().split()))
for i in range(m):
  As.sort(reverse = True)
  As[0] = int(As[0]/2)
print(sum(As))

Submission status: Time Limit Exceeded

Solution code:
S = list(map(int, input().split()))
N = S[0]
M = S[1]
A = list(map(int, input().split()))


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

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
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))

Submission status: Time Limit Exceeded

Solution code:
# D
N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

for i in range(M):
    A[-1] = A[-1]//2
    A.sort()
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n, m = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
count = 0
while(count<m):
  idx = np.argmax(A)
  A[idx] = A[idx] / 2.0
  count +=1
print(A.sum())

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
    b = a.pop(a.index(max(a)))
    a.append(b // 2)
ans = sum(a)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
for i in range(M):
    A = sorted(A)
    A[N-1] //= 2
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import bisect
N,M = map(int,input().split())
As = [int(i) for i in input().split()]

As.sort()

for _ in range(M):
    takai = As.pop()
    takai//=2
    bisect.insort_left(As,takai)
print(sum(As))

Submission status: Time Limit Exceeded

Solution code:
import heapq

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

heapq.heapify(A)
#print(A)

for i in range(M):
    A[0] = -(-A[0] // 2)
    heapq.heapify(A)

ans = - sum(A)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import bisect
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    b = a.pop(-1) // 2
    a.insert(bisect.bisect(a, b), b)
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
N, M = map(int, input().split(" "))
As = list(map(int, input().split(" ")))

for _ in range(M):
  i = As.index(max(As))
  As[i] = As[i]//2

print(sum(As))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
data=input().rstrip().split(" ")
data[0]=int(data[0])
data[1]=int(data[1])
yen=input().rstrip().split(" ")
for i in range(data[0]):
    yen[i]=int(yen[i])
    
for i in range(data[1]):
    yen=sorted(yen,reverse=True)
    yen[0]=int(yen[0]/2)

ans=0
for i in range(data[0]):
    ans= ans + yen[i]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import bisect
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N, M = map(int, input().split())
        A = list(map(int, input().split()))

        A.sort()
        for _ in range(M):
            v = A[-1] // 2
            A.pop()
            bisect.insort(A, v)

        print(sum(A))


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Time Limit Exceeded

Solution code:
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort(reverse=True)
for i in range(m):
  a[0]=a[0] // 2
  for j in range(1,n):
    if(a[0]>a[j]):
      a.insert(j,a[0])
      del a[0]
      break
sumer=0
for i in range(n):
  sumer=sumer+a[i]
print(sumer)

Submission status: Time Limit Exceeded

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

for i in range(M):
    ind = A.index(max(A))
    A[ind] = A[ind]/2
    # print(A)

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

Submission status: Time Limit Exceeded

Solution code:
import math
n, m = map(int, input().split())
a = list(map(float, input().split()))
a.sort()
#print(a)
for _ in range(m):
  a[a.index(max(a))]/= 2

sum = 0
for i in range(len(a)):
     sum += int(math.floor(a[i]))
print(sum)

Submission status: Time Limit Exceeded

Solution code:
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
for i in range(M):
    A[0] = int(A[0] / 2)
    A = sorted(A, reverse=True)
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import math
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
    a = sorted(a)[::-1]
    # print(a)
    a[0] = a[0] / 2
sum = 0
# print(a)
for i in range(n):
    sum += math.floor(a[i])
print(sum)

Submission status: Time Limit Exceeded

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

# dp = [[0 for i in range(N)] for _ in range(M)]

# sortedA = sorted(A,reverse=True)

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

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
A = sorted(a,reverse=True)
ct=0
for i in range(m):
    j=A.index(max(A))
    A[j]=int(A[j]/2)
    ct+=1
print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import math
N, M = list(map(int, input().split()))
A = list(map(float ,input().split()))

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

  
print(sum(list(map(int, A))))

Submission status: Time Limit Exceeded

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))

for i in range(m):
		A = sorted(A, reverse=True)
		A[0] = int(A[0]/2)

print(sum(A))