Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
from bisect import insort_left
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()
    A = sorted(A)

    for _ in range(M):
        value = A[-1] // 2
        A.pop(-1)
        insort_left(A, value)

    print(sum(A))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


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

    minus_A = list(map(lambda x: x*(-1), A))
    heapify(minus_A)
    for i in range(M):
        temp = heappop(minus_A) * (-1)
        heappush(minus_A, temp//2 * (-1))

    print(sum(minus_A) * (-1))


if __name__ == '__main__':
        main()
### BUGGY CODE ###

n,k = map(int,input().split())

mod = 10**9+7

all_num = k**n
ans = 0

dp = [0]*(k+1)

for i in range(k):
    tmp = k-i
    #print(tmp)
    #print(tmp,tmp,tmp)
    kazu = 1
    kakeru = 2
    heru = 0
    #print(tmp,k)
    while tmp * kakeru <= k:
        heru += dp[tmp*kakeru]
        kazu += 1
        kakeru += 1
        #print(tmp*kakeru,k)
        
    
    if tmp == 1:
        ans += all_num
        ans %= mod
        break
    ans += tmp*(kazu**n-heru)
    all_num -= (kazu**n-heru)
    #print(tmp,kazu,n,heru)
    dp[tmp] = kazu**n-heru
    ans %= mod
    #print(ans,tmp,kazu)
    
print(ans)


### FIXED CODE ###

n,k = map(int,input().split())

mod = 10**9+7

all_num = pow(k,n,mod)
#all_num = k**n


ans = 0

dp = [0]*(k+1)

for i in range(k):
    tmp = k-i
    #print(tmp)
    #print(tmp,tmp,tmp)
    kazu = 1
    kakeru = 2
    heru = 0
    
    if tmp == 1:
        ans += all_num
        ans %= mod
        break
    
    #print(tmp,k)
    for i in range(k//tmp-1):
        #print(i)
        heru += dp[tmp*kakeru]
        kazu += 1
        kakeru += 1
    """
    while tmp * kakeru <= k:
        heru += dp[tmp*kakeru]
        kazu += 1
        kakeru += 1
        #print(tmp*kakeru,k)
    """ 
    
    kazu = pow(kazu,n,mod)-heru
    #kazu = kazu**n-heru
    ans += tmp*(kazu)
    all_num -= (kazu)
    #print(tmp,kazu,n,heru)
    dp[tmp] = kazu
    ans %= mod
    #print(ans,tmp,kazu)
    
print(ans)
### BUGGY CODE ###

import sys
flush = sys.stdout.flush

d = {"V":0, "M":1, "F":2}
def check(i):
    print(i)
    flush()
    s = input()
    if s[0] == "V":
        exit()
    return d[s[0]]

n = int(input())
left = 0
right = n-1
ls = check(left)
rs = check(right)

while right-left > 1:
    mid = (right+left)//2
    if check(mid) == ls:
        left = mid
    else:
        right = mid

### FIXED CODE ###

import sys
flush = sys.stdout.flush

d = {"M":0, "F":1}
def check(i):
    print(i)
    flush()
    s = input()
    if s[0] == "V":
        exit()
    return d[s[0]]

n = int(input())
left = 0
right = n-1
ls = check(left)
rs = check(right)

while right-left > 1:
    mid = (right+left)//2
    c = check(mid)
    if (c+mid-left)%2 == ls:
        left = mid
        ls = c
    else:
        right = mid
### BUGGY CODE ###

#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

ans=chk=1
for i in s:
    chk=1
    for j in range(2,p):
        chk*=int(i)
        ans+=chk
        if ans>=p:
            print(i)
            exit()

### FIXED CODE ###

s=input()
k=int(input())
x=-1
y=""
for a,i in enumerate(s):
    if i!="1":
        x=a
        y=i
        break

if x!=-1 and x+1<=k: print(y)
else: print(1)
### BUGGY CODE ###

a,b=map(int,input().split())
for i in range(a,10**18,a):
  if i%b!=0:
    print(i)
    exit()
  else:
    print(-1)

### FIXED CODE ###

a,b=map(int,input().split())
if a%b==0:
    print(-1)
else:
    print(a)
### BUGGY CODE ###

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

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

ans=0

for i in range(K+1):
  temp=(M*(M-1)**(N-1-i)*cmb(N-1,i))%998244353
  ans+=temp

print(ans%998244353)

### FIXED CODE ###

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

MOD=998244353

ans=0
temp2=1
#temp4=(M-1)**(N-1)%MOD

def getInvs(n, MOD):
  invs = [1] * (n+1)
  for x in range(2, n+1):
    invs[x] = (-(MOD//x) * invs[MOD%x]) % MOD
  return invs

invs = getInvs(max(N+3,M-1), MOD)

Vec=[0]*N
#inv=1
#for i in range(MOD-2):
#  inv*=M-1
#  inv%=MOD

'''
for i in range(K+1):
  if i == 0:
    temp1=M
    temp1*=(M-1)**(N-1)%MOD
    temp1%=MOD
    ans+=temp1*temp2%MOD
    #print(cmb)
  else:
    temp1*=invs[M-1]%MOD
    temp2*=(N-i)*invs[i]
    temp2%=MOD
    ans+=temp1*temp2%MOD
    cmb=cmb*(N-i-1)*i*invs[i]%MOD
    #print(cmb)
'''
for i in range(N):
  if i == 0:
    temp1=M
    Vec[N-i-1]=temp1
  else:
    temp1*=(M-1)*(N-i)
    temp1*=invs[i]
    temp1%=MOD
    Vec[N-i-1]=temp1


ans=sum(Vec[:K+1])

print(ans%MOD)
### BUGGY CODE ###

import math

N=int(input())


ans=0

i=1
ans=0
while i<=N:
    j=1
    while j<=N:
        k=1
        while k<=N:
            ans+=math.gcd(math.gcd(i,j),k)
            k+=1
        j+=1
    i+=1
print(ans)



### FIXED CODE ###

import math

N=int(input())


ans=0

i=1
ans=0
while i<=N:
    j=1
    while j<=N:
        k=1
        while k<=N:
            ans+=math.gcd(math.gcd(i,j),k)
            k+=1
        j+=1
    i+=1
print(ans)
### BUGGY CODE ###

n,k=map(int,input().split())
h=[int(i) for i in input().split()]
h.insert(0,0)
ans=[0]*(n+1)
ans[1]=0
ans[2]=abs(h[2]-h[1])
for i in range(3,n+1):
    m=1000000000000000
    boo=False
    for j in range(i-1,i-k-1,-1):
        if j>=1:
            m=min(m,ans[j]+abs(h[i]-h[j]))
            boo=True
        else:
            break
    ans[i]=m
print(ans[n])


### FIXED CODE ###

n,k=map(int,input().split())
h=[int(i) for i in input().split()]
h.insert(0,0)
ans=[0]*(n+1)
ans[1]=0
ans[2]=abs(h[2]-h[1])
for i in range(3,n+1):
    m=1000000000000000
    boo=False
    for j in range(i-1,i-k-1,-1):
        if j>=1:
            m=min(m,ans[j]+abs(h[i]-h[j]))
            boo=True
        else:
            break
    ans[i]=m
print(ans[n])
### BUGGY CODE ###

n, m = map(int, input().split())
alist = []
blist = []
for _ in range(m):
    a, b = map(int, input().split())
    alist.append(a - 1)
    blist.append(b - 1)

c = {i : set((i, )) for i in range(n)}
answers = [n * (n - 1) // 2]
for a, b in zip(reversed(alist), reversed(blist)):
    answers.append(answers[-1])

    c1 = c[a]
    c2 = c[b]
    if b in c1: 
        continue
    answers[-1] -= len(c1) * len(c2)
    c3 = (c1 | c2)
    for i in c3:
        c[i] = c3

for i in reversed(range(m)):
    print(answers[i])


### FIXED CODE ###

class UnionFind(object):
    def __init__(self, size):
        self.size = size
        self.parents = list(range(size))
        self.counts = [1] * size

    def find(self, x):
        history = []
        while self.parents[x] != x:
            history.append(x)
            x = self.parents[x]
        
        for i in history: 
            self.parents[i] = x
        return x
    
    def union(self, x1, x2):
        y1 = self.find(x1)
        y2 = self.find(x2)
        if y1 != y2:
            self.parents[y2] = y1
            self.counts[y1] += self.counts[y2]

    def count(self, x):
        return self.counts[self.find(x)]
    
if __name__ == '__main__':
    n, m = map(int, input().split())
    alist = []
    blist = []
    for _ in range(m):
        a, b = map(int, input().split())
        alist.append(a - 1)
        blist.append(b - 1)

    answers = [n * (n - 1) // 2]
    uf = UnionFind(n)

    for a, b in zip(reversed(alist), reversed(blist)):
        answers.append(answers[-1])
        c = uf.find(a)
        d = uf.find(b)
        if c == d: 
            continue
  
        answers[-1] -= uf.count(a) * uf.count(b)
        uf.union(a, b)

    for i in reversed(range(m)):
        print(answers[i])
### BUGGY CODE ###

from collections import defaultdict
import itertools

import numpy as np


def main():
    H, W, M = map(int, input().split())
    HW = [list(map(int, input().split())) for _ in range(M)]

    A = np.zeros(H, dtype=np.int64)
    B = np.zeros(W, dtype=np.int64)

    dh = defaultdict(list)
    for h, w in HW:
        A[h - 1] += 1
        B[w - 1] += 1
        dh[h - 1].append(w - 1)

    maxA = np.max(A)
    maxB = np.max(B)

    # 最大値を取るindex
    ind_A = np.arange(H)[A == maxA]
    ind_B = np.arange(W)[B == maxB]

    # 解の候補の数
    nn = len(ind_A) * len(ind_B)

    # Mより候補の数のほうが多いとok
    # 少ないときはM以下なので可算
    ans = maxA + maxB

    if nn <= M:
        for h, w in itertools.product(ind_A, ind_B):
            if w not in dh[h]:
                break
        else:
            ans -= 1

    print(ans)


main()


### FIXED CODE ###

import itertools

import numpy as np


def main():
    H, W, M = map(int, input().split())
    HW = [list(map(int, input().split())) for _ in range(M)]

    A = np.zeros(H, dtype=np.int64)
    B = np.zeros(W, dtype=np.int64)

    for h, w in HW:
        A[h - 1] += 1
        B[w - 1] += 1

    maxA = np.max(A)
    maxB = np.max(B)

    # 最大値を取るindex
    ind_A = np.arange(H)[A == maxA]
    ind_B = np.arange(W)[B == maxB]

    # 解の候補の数
    nn = len(ind_A) * len(ind_B)

    # Mより候補の数のほうが多いとok
    # 少ないときはM以下なので可算
    ans = maxA + maxB

    if nn <= M:
        for h, w in HW:
            if A[h - 1] == maxA and B[w - 1] == maxB:
                nn -= 1

    print(ans if nn else ans - 1)


main()
### BUGGY CODE ###

import sys
from itertools import combinations

# https://ikatakos.com/pot/programming_algorithm/data_structure/union_find_tree
class UnionFind:
    def __init__(self, n):
        # 負  : 根であることを示す。絶対値はランクを示す
        # 非負: 根でないことを示す。値は親を示す
        self.table = [-1] * n
        self.n = n
        self.max_inconvenience = n * (n - 1) // 2

    def _root(self, x):
        stack = []
        tbl = self.table
        while tbl[x] >= 0:
            stack.append(x)
            x = tbl[x]
        for y in stack:
            tbl[y] = x
        return x

    def find(self, x, y):
        return self._root(x) == self._root(y)

    def inconvenience(self):
        res = self.max_inconvenience
        for i, j in combinations(range(self.n), 2):
            if self.find(i, j):
                res -= 1
        return res

    def union(self, x, y):
        r1 = self._root(x)
        r2 = self._root(y)
        if r1 == r2:
            return
        # ランクの取得
        d1 = self.table[r1]
        d2 = self.table[r2]
        if d1 <= d2:
            self.table[r2] = r1
            if d1 == d2:
                self.table[r1] -= 1
        else:
            self.table[r1] = r2


def main():
    input = sys.stdin.buffer.readline
    n, m = map(int, input().split())
    bridges = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]
    ans = [0] * m
    ans[-1] = n * (n - 1) // 2
    uf = UnionFind(n)
    for i in range(m - 2, -1, -1):
        uf.union(*bridges[i + 1])
        ans[i] = uf.inconvenience()
    for i in range(m):
        print(ans[i])


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from itertools import combinations

# https://ikatakos.com/pot/programming_algorithm/data_structure/union_find_tree
class UnionFind:
    def __init__(self, n):
        self.table = [-1] * n
        self.n = n
        self.inconvenience = n * (n - 1) // 2

    def _root(self, x):
        stack = []
        tbl = self.table
        while tbl[x] >= 0:
            stack.append(x)
            x = tbl[x]
        for y in stack:
            tbl[y] = x
        return x

    def find(self, x, y):
        return self._root(x) == self._root(y)

    def union(self, x, y):
        r1 = self._root(x)
        r2 = self._root(y)
        if r1 == r2:
            return
        d1 = self.table[r1]
        d2 = self.table[r2]
        self.inconvenience -= d1 * d2
        if d1 <= d2:
            self.table[r2] = r1
            self.table[r1] += d2
        else:
            self.table[r1] = r2
            self.table[r2] += d1


def main():
    input = sys.stdin.buffer.readline
    n, m = map(int, input().split())
    bridges = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]
    ans = [0] * m
    ans[-1] = n * (n - 1) // 2
    uf = UnionFind(n)
    for i in range(m - 2, -1, -1):
        uf.union(*bridges[i + 1])
        ans[i] = uf.inconvenience
    for i in range(m):
        print(ans[i])


if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)

def dfs(v,val):
  cnt[v]+=val
  checked[v]=1
  for u in g[v]:
    if checked[u]==1:
      continue
    dfs(u,cnt[v])

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
for _ in range(q):
  v,val=map(int,input().split())
  cnt[v]+=val
checked=[0]*(n+1)
checked[1]=1
dfs(1,0)
print(*cnt[1:])

### FIXED CODE ###

import collections

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
for _ in range(q):
  v,val=map(int,input().split())
  cnt[v]+=val
q=collections.deque()
q.append(1)
checked=[0]*(n+1)
while q:
  v=q.pop()
  checked[v]=1
  for u in g[v]:
    if checked[u]==1:
      continue
    cnt[u]+=cnt[v]
    q.append(u)
print(*cnt[1:])
### BUGGY CODE ###

def s():
	n,*o=open(0)
	n=int(n)
	r=list(range(n))
	print(sum((n-a-b)*all(o[(i+b)%n][(a+j)%n]==o[(j+b)%n][(a+i)%n]for i in r for j in r)for a,b in zip(r+[0]*n,[0]*~-n+r)))
s()

### FIXED CODE ###

n,*o=open(0)
n=int(n)
r=list(range(n))
print(sum((n-a-b)*all(o[(i+b)%n][(a+j)%n]==o[(j+b)%n][(a+i)%n]for i in r for j in r[i:])for a,b in zip(r+[0]*n,[0]*~-n+r)))
### BUGGY CODE ###

n = int(input())
list = input().split()

int_list = [ int(n) for n in list ]

isDist = True

for a in range(n):
  if int_list.count(int_list[a]) != 1:
    print("NO")
    isDist = False
    break;

if isDist is True:
    print("YES")

### FIXED CODE ###

n = int(input())
list = input().split()
 
int_list = [ int(n) for n in list ]
int_list.sort()

isDist = True
 
for a in range(n-1):
  if int_list[a] == int_list[a+1]:
    print("NO")
    isDist = False
    break;
 
if isDist is True:
    print("YES")
### BUGGY CODE ###

N = int(input())
H = list(map(int, input().split()))
max_count = 0
for i in range(0, N-1):
  tmp_count = 0
  for j in range(i, N-1):
    if H[j] >= H[j+1]:
      tmp_count=tmp_count+1
    else:
      break
  if tmp_count>max_count:
    max_count=tmp_count
print(max_count)

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
tmp = 0
s = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    tmp += 1
    s = max(s, tmp)
  else:
    tmp = 0
    
print(s)
### BUGGY CODE ###

def nprime(x):
  prim=[]
  i=1
  while(1):
    i+=1
    non=False
    for num in prim:
      if i%num==0:
        non=True
        break
    if non:
      continue
    elif(i>=x):
      return i
    prim.append(i)

print(nprime(int(input())))

### FIXED CODE ###

import math
def prim(x):
  for i in range(2,math.floor(math.sqrt(x))):
    if not x%i:
      return 0
  return 1

def np(x):
  while(1):
    if prim(x):
      return x
    else:
      x+=1
      
print(np(int(input())))
### BUGGY CODE ###

N = int(input())
X = input()
ans = [1 for _ in range(N)]

def popcount(n):
  c = 0
  n = str(bin(n))[2:]
  for _ in range(len(n)):
    if n[_] == '1':
      c += 1
  return c

l = 0
for k in range(N):
  if X[k] == '1':
    l+=1
firstpop = [l for _ in  range(N)]

intN = int(X, 2)

start = []
if N == 1:
  if X[0] == '1':
    ia = 0
    firstpop[0] -= 1
  else:
    ia = 1
    firstpop[0] += 1
  start.append(ia)

else:
  for k in range(N):
    if X[k] == '1':
      ia = intN - 2**(N-k-1)
      firstpop[k] -= 1
    else:
      ia = intN + 2**(N-k-1)
      firstpop[k] += 1
    start.append(ia)

mp = l + 1
poplist = [0]
for _ in range(1, mp):
  poplist.append(popcount(_))


for k in range(N):
  if firstpop[k] == 0:
    ans[k] = 0
  else:
    start[k] %= firstpop[k]

for k in range(len(start)):
  for count in range(10*5):
    if start[k] == 0:
      ans[k] += count
      break
    else:
      start[k] = start[k] % poplist[start[k]]

for k in range(N):
  print(ans[k])

### FIXED CODE ###

N = int(input())
X = input()
ans = [1 for _ in range(N)]
#original 1 count
l = 0
for k in range(N):
  if X[k] == '1':
    l+=1
if l == 0:
  for _ in range(N):
    print(1)
  exit()
if l == 1:
  if X[-1] == '1':
    for _ in range(N-1):
      ans[_] = 2
  else:
    ans[-1] = 2 
  for k in range(N):
    if X[k] =='1':
      ans[k] = 0 
  for _ in range(N):
    print(ans[_])
  exit()


intN = int(X, 2)
N1 = intN %(l-1)
N0 = intN % (l+1)


start = []
if N == 1:
  if X[0] == '1':
    print(0)
    exit()
  else:
    print(1)
    exit()
else:
  s1 = 1
  s0 = 1
  for k in range(N-1, -1, -1):
    if X[k] == '1':      
      ia = (N1 - s1)%(l-1)
    else:
      ia = (N0 + s0)%(l+1)
    start.append(ia)
    s1 = s1*2%(l-1)
    s0 = s0*2%(l+1)
start = start[::-1]
"""
ml = len(bin(l+1))-2
poplist = [0 for _ in range(N)]
t = 1
while t < N + 1:
  t *= 2
  for k in range(t//2, N, t):
    for j in range(t//2):
      if k+j>N-1:
        break
      poplist[k+j] += 1
"""

def popcount(n):
  c = 0
  n = bin(n)[2:]
  for k in range(len(n)):
    if n[k] == '1':
      c+=1
  return c

for k in range(len(start)):
  for count in range(10*5):
    if start[k] == 0:
      ans[k] += count
      break
    else:
      start[k] = start[k] % popcount(start[k])

for k in range(N):
  print(ans[k])
### BUGGY CODE ###

N = int(input())

A = []
a, *an = map(int, input().split())
A.append(a)
A += an
A.sort()

Node = []
score = 0
Node.append(A.pop())

#print(A)

for n in range(N - 1):
    score += Node[0]
    num = A.pop()
    Node = Node[1:]
    Node.append(num)
    Node.append(num)

#print(Node)
print(score)

### FIXED CODE ###

N = int(input())

A = []
a, *an = map(int, input().split())
A.append(a)
A += an
A.sort()

Node = []
score = 0
Node.append(A.pop())

#print(A)
start = 0

for n in range(N - 1):
    score += Node[start]
    num = A.pop()
    start += 1
    #Node = Node[1:]
    Node.append(num)
    Node.append(num)

#print(Node)
print(score)
### BUGGY CODE ###

def main():
    num = int(input())
    for i in range(num):
        X = " " + input()
        Y = " " + input()
        lx = len(X)
        ly = len(Y)
        T = [0] * ly
        for j in range(1,lx):
            C = T[:]
            for k in range(1,ly):
                k1 = k-1
                if X[j] == Y[k]:
                    T[k] = C[k1] + 1
                elif C[k] < T[k1]:
                    T[k] = T[k1]
        print(T[k])

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    num = int(input())
    A = []
    for i in range(num):
        X = input()
        Y = " " + input()
        lx = len(X)
        ly = len(Y)
        T = [0] * ly
        for j in range(lx):
            xj = X[j]
            C = T[:]
            for k in range(1,ly):
                k1 = k-1
                if xj == Y[k]:
                    T[k] = C[k1] + 1
                elif T[k] < T[k1]:
                    T[k] = T[k1]
        print(T[k])
if __name__ == '__main__':
    main()
### BUGGY CODE ###

n,k=map(int,input().split())
A=list(map(int,input().strip().split(" ")))
ANS=[]
for i in range(200000):
    ANS.append(A.count(i))
ANS.sort(reverse=True)
B=[e for e in ANS if e>0]

P=[]
if len(B)<=k:
    print(0)
else:
    for i in B[k:]:
        P.append(i)
    print(sum(P))

### FIXED CODE ###

n,k=map(int,input().split())
A=list(map(int,input().strip().split(" ")))
dict={}

for i in A:
    if i in dict:
        dict[i] += 1
    else:
        dict[i] = 1

X=[]
sorted_A = sorted(dict.items(), key=lambda x: x[1], reverse=True)
for i,v in sorted_A:
    X.append(v)

ans=0
if len(X)>k:
    for i in X[k:]:
        ans+=i
print(ans)
### BUGGY CODE ###

N = input()
data = list(map(lambda x :int(x)%2,input().strip().split()))
res = sum(data)
if res ==1:
  print(0)
else:
  data.sort()
  tmp = data[0]
  cnt = 0
  while tmp!=1:
    tmp/=2
    cnt+=1
  print(cnt)

### FIXED CODE ###

N = input()
data = list(map(lambda x :int(x),input().strip().split()))
data.sort()
tmp = data[0]
cnt =0
while tmp >1:
    if sum(list(map(lambda x:x%(2**(cnt+1)), data))) >= 1:break
    tmp//=2
    cnt+=1
print(cnt)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

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


def countSubZeroRange(numbers):
    counter = 0
    for i in range(1, N + 1):  # i : 長さ
        for j in range(N - i + 1):
            if sum(numbers[j:j + i]) == 0:
                counter += 1
    return counter


print(countSubZeroRange(list(numbers)))


### FIXED CODE ###

# -*- coding: utf-8 -*-
from scipy.misc import comb
import collections

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


def countSubZeroRange(numbers):
    Sums = [0]
    for number in numbers:
        Sums.append(Sums[-1] + number)
    zeroSumCounts = 0
    for key, value in collections.Counter(Sums).items():
        zeroSumCounts += comb(value, 2, 1)
    return zeroSumCounts


print(countSubZeroRange(numbers))
### BUGGY CODE ###

x, y, z, k = map(int, input().split())
m = []
for _ in range(3):
    m.append(sorted(list(map(int, input().split())), reverse=True))
 
def sorted_sum(list_a, list_b):
    s = []
    for x in list_a:
        for y in list_b:
            s.append(x + y)
    return sorted(s, reverse=True)
 
ans = sorted_sum(sorted_sum(m[0], m[1])[0:k], m[2])
for i in range(0, k):
    print(ans[i])

### FIXED CODE ###

x, y, z, k = map(int, input().split())
m = []
for _ in range(3):
    m.append(sorted(list(map(int, input().split())), reverse=True))

def sorted_sum(list_a, list_b, limit):
    s = []
    for x in list_a:
        for y in list_b:
            s.append(x + y)
    return sorted(s, reverse=True)[0:limit]


def consume_diff(s, a_val, list_b, b_index):
    diff = a_val - list_b[b_index]
    for i in range(b_index + 1, len(list_b)):
        if list_b[b_index] - list_b[i] > diff:
            break
        s.append(a_val + list_b[i])



ans = sorted_sum(sorted_sum(m[0], m[1], k), m[2], k)
for i in range(min([k, len(ans)])):
    print(ans[i])
### BUGGY CODE ###

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

### FIXED CODE ###

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 _ in range(m):
  x=heapq.heappop(a)
  x=((x*(-1))//2)*(-1)
  heapq.heappush(a,x)










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