Problem:


Score : 300 points

Problem Statement

Fennec is fighting with N monsters.

The health of the i-th monster is H_i.

Fennec can do the following two actions:

Attack: Fennec chooses one monster. That monster's health will decrease by 1.

Special Move: Fennec chooses one monster. That monster's health will become 0.

There is no way other than Attack and Special Move to decrease the monsters' health.

Fennec wins when all the monsters' healths become 0 or below.

Find the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.

Constraints

1 \leq N \leq 2 \times 10^5

0 \leq K \leq 2 \times 10^5

1 \leq H_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
H_1 ... H_N

Output

Print the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.

Sample Input 1

3 1
4 1 5

Sample Output 1

5

By using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.

Sample Input 2

8 9
7 9 3 2 3 8 4 6

Sample Output 2

0

She can use Special Move on all the monsters.

Sample Input 3

3 0
1000000000 1000000000 1000000000

Sample Output 3

3000000000

Watch out for overflow.



Sample input:
3 1
4 1 5


Sample output:
5

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ii = pair<int, int>;
using ll = long long;

int32_t main(){
	ios::sync_with_stdio(0);	
	int n, k;
	cin >> n >> k;
	priority_queue<int> pq;
	for(int i=0; i<n; ++i){
		int x; cin >> x;
		pq.push(x);
	}
	while(k and not pq.empty()){
		pq.pop(), --k;
	}
	ll ans = 0;
	while(not pq.empty()) ans += pq.top(), pq.pop();
	cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
A = [list(map(int, input().split())) for _ in range(2)]
A[1].sort(reverse = True)
for i in range(A[0][1]):
  if A[1] == []:
    a = 0
    break
  A[1].pop(0)
  if A[1] != 0:
    a = sum(A[1])
print(a)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
h=list(map(int,input().split()))
if n<=k:
  print('0')
else:
  h.sort()
  h.pop([n-k:])
  print(sum(h))

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
H = list(map(int, input().split()))

H.sort()
for i in range(1,K+1):
    H[-i] = 0
print(sum(H))

Submission status: Runtime Error

Solution code:
3 0
1000000000 1000000000 1000000000

Submission status: Runtime Error

Solution code:
print(~-(1<<len(bin(int(input()))[2:])))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h =  list(map(int, input().split()))

def solve():
    if n <= k:
        return 0
    s = sum(h)
    h = sorted(h, reverse=True)
    for i in range(k):
        print(h[i])
        s -= h[i]
    return s

print(solve())

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
h = sorted(h, reverse=True)
for i in range(k):
    s -= h[i]
print(s)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
h = sorted(h, reverse=True)
for i in range(k):
    s -= h[k]
print(s)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
m = 0
for _ in range(k):
    a = 0
    m = 0
    index = 0
    for i, j in enumerate(h):
        if j > m:
            m = j
            index = i
    a += m
    del h[i]
print(s - m)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
for _ in range(k):
    a = 0
    m = 0
    index = 0
    for i, j in enumerate(h):
        if j > m:
            m = j
            index = i
    a += m
    del h[i]
print(s - m)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
l = list(map(int,input().split()))
if n <= k:
    print("0")
    sys.exit()
l = sorted(l,reverse = True)
for i in range(k):
    l.remove(l[0])
d = dict.fromkeys(l)
a = 0
for j in d.keys():
    a += j
print(a)

Submission status: Runtime Error

Solution code:
import sys
n,k = map(int,input().split())
l = list(map(int,input().split()))
if n <= k:
    print("0")
    sys.exit()
l = sorted(l,reverse = True)
for i in range(k):
    l.remove(l[i])
a = 0
for j in l:
    a += j
print(a)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
List = list(map(int, input().split()))
List.sort()
List.reverse()
ans=0

if len(List) == K-1:
    print(0)
    quit()

def Check(List,ans):
    if sum(List) <= 0:
        print(ans)
        quit()

#print(List)

i=0
while i<K:
    del List[0]
    i+=1

Check(List,ans)

j=0
while 1==1:
    ans+=List[j]
    List[j]=0
    Check(List,ans)
    j+=1

Submission status: Runtime Error

Solution code:
h,n = map(int,input().split())
a_ = list(map(int,input().split()))

a_.sort()
for i in range(n):
    a_[i] = 0
print(sum(a_))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
del h[5]
print(sum(h))

Submission status: Runtime Error

Solution code:
import numpy
N,K = map(int,input().split())
H = list(map(int,input().split()))

H = numpy.sort(H)
#print(H)

for i in range(K):
  H.remove(H[N-1-i])

print(sum(H))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
H = list(map(int,input().split()))

H = sorted(H)
#print(H)

for i in range(K):
  H.remove(H[N-1-i])

print(sum(H))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
for i in range(k):
  try:
    h.pop(0)
  except IndexError:
    pass
print(sum(h)+t)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
if h == 0:
  print(sum(h))
elif h >= n:
  print(0)
else:
  h.sort()
  print(sum(h[:n-k]))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort()
for i in range(k):
    h[n-i-1] = 0
print(sum(h))

Submission status: Runtime Error

Solution code:
N, K =  list(map(int, input().split()))
H = list(map(int, input().split()))

for i in range(K):
    m = max(H)
    H.remove(m)
if len(H) == 0:
    ret = 0
else:
    ret = sum(H)
print(ret)

Submission status: Runtime Error

Solution code:
from heapq import heappop,heapify
n,k=map(int,input().split())
q=[-int(i) for i in input().split()]
if k==0:
  print(sum(q))
  exit()
heapify(q)
for i in range(k):
  x=heappop(q)
print(-sum(q))

Submission status: Runtime Error

Solution code:
from heapq import heappop,heapify
n,k=map(int,input().split())
q=[-int(i) for i in input().split()]
heapify(q)
for i in range(k):
  x=heappop(q)
print(-sum(q))

Submission status: Runtime Error

Solution code:
N=int(input())
P=list(map(int,input().split()))
cnt=0
for i in range(N):
    M=min(P[:i+1])
    if M==P[i]:
        cnt+=1
print(cnt)

Submission status: Runtime Error

Solution code:
n,k=[int(x) for x in input().split()]
arr=[int(x) for x in input().split()]
s=0
if(n>k):
	for i in range(n-k):
  		s+=arr[i]
    print(s)
else:
  print(0)

Submission status: Runtime Error

Solution code:
import sys
n, k = map(int, sys.stdin.readline().split())
li = list(map(int, sys.stdin.readline().split()))
l = len(li)
t = 0
if l > k:
  li.sort().reverse()
  t = sum(li[k:])
print(t)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
hn = list(map(int,input().split()))
hn_s = hn.sort()
attack = 0

if k>=n:
  print("0")

elif k<n:
  for _ in range(n-k):
    hn_s.pop(-1)
  print(str(sum(hn_s)))

Submission status: Runtime Error

Solution code:
#入力部
n,k = map(int,input().split())
h = list(map(int,input().split()))

#攻撃:hを1減らす　必殺技:hをすべて減らす制限　k回
#hを降順にソート
h.sort(reverse = True)
#nがkより小さい時全部に必殺技が使えるから0
if n <= k:
    print(0)
#体力が多い順に必殺技を使用して残った体力の合計を出力
else:
    for i in range(k):
        s[i] = 0
print(sum(s))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
n=list(map(int,input().split()))
n.sort(reverse=True)
for i in range(b):
  n.remove(n[i])
print(sum(n))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
n=list(map(int,input().split()))
n.sort(reverse=True)
for i in range(b):
  n.remove(n[i])
print(sum(n))

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
if K-1 ==len(H):
    S = 0
elif K == 0:
    S = sum(H)
else:
    for i in range(K):
        del H[i]
    S =sum(H)
print(S)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort()
if k:
    print(sum(h[:-k]))
else
    print(sum(h))

Submission status: Runtime Error

Solution code:
n,k =map(int ,input().split())
h = list(map(int ,input().split()))
h.sort(reverse =True)
if n<k:
    print(0)
else:
    for i in range(k):
        h.pop(i)
    print(sum(h))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
if n-k+1 <= 0:
  print(0)
  quit()
else:
  L = l[0:n-K+1]
  L_sum = sum(L)
  print(L_sum)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
L = l[0:n-K+1]
L_sum = sum(L)
print(L_sum)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
L = l[0,n-K+1]
L_sum = sum(L)
print(L_sum)

Submission status: Runtime Error

Solution code:
n ,k = input().split();
n = int(n);
k = int(k);

H = list(map(int, input().split()));

#HPが多い敵を上からk体だけ減らす。
yowa = H.sort(reverse=True)[k+1:];

ans = sum(yowa);

print(ans);

Submission status: Runtime Error

Solution code:
h = list(map(int, input().split()))

h.sort()
h.reverse()

print(sum(h[k:]))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
H = list(map(int,input().split()))
H = sorted(H)[::-1]
for i in range(K):
  del H[0]
print(str(sum(H)))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
H = list(map(int,input().split()))
H = sorted(H)[::-1]
for i in range(K):
  del H[0]
print(str(sum(H)))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=-1
if len(c)<=b:
    print(0)
else:
    c.sort()
    for i in range(-1,-b-1,-1):
        c.pop(i)
        d-=1
    print(sum(c))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=-1
if len(c)<=b:
    print(0)
else:
    c.sort()
    for i in range(b):
        c.pop(d)
        d-=1
    print(sum(c))

Submission status: Runtime Error

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n, k = MI()

h = np.array(sorted([int(i) for i in input().split()]))
hmax = h.max()

if k >= len(h):
    print(0)
    exit()

h = np.delete(h, len(h) - k)
print(np.sum(h))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
H=[int(i) for i in input().split()]
H.append(0)
H.sort()
for _ in range(K):
  H.pop()
print(sum(H))

Submission status: Runtime Error

Solution code:
N,K=map(int, input().split())
H=list(map(int, input().split()))

H_sort = sorted(H, reverse=True)

if N <= K:
    print(0)
    quit()
for i in range(K):
    del H_sort[i]

print(sum(H_sort))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
h=h[::-1]
if k!=0:
  for i in range(k):
    h[i]=0

  
print(sum(h))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
h=[::-1]
if k!=0:
  for i in range(k):
    h[i]=0

  
print(sum(h))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[:n-k]))
//print(l)

Submission status: Runtime Error

Solution code:
n,k=map(input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[:n-k-1]))

Submission status: Runtime Error

Solution code:
N,K=map(int, input().split())
H=list(map(int, input().split()))

H_sort = sorted(H, reverse=True)

for i in range(K):
    del H_sort[i]

print(sum(H_sort))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse=True)
for i in range(k):
    li.remove(li[0])
print(sum(li))

Submission status: Runtime Error

Solution code:
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


H,K=input2()
h=input_array()

for _ in range(K):
	max_h=max(h)
	h.remove(max_h)
attacks=sum(h)

print(attacks)

Submission status: Runtime Error

Solution code:
A,B,X = map(int, input().split())

import math
def d(N): #桁を求める
    return int(math.log10(N)) +1

#2分探索法
N_min =0
N_max =10**9
while 1<(N_max - N_min):
    N=(N_max + N_min)//2
    if A*N +B*d(N) >X:
        N_max = N
    else:
        N_min =N
if A * N_max + B * d(N_max) <X:
    print(N_max)
else:
    print(N_min)

Submission status: Runtime Error

Solution code:
3 1
4 1 5

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
H = input().split()
H = [int h for h in H]
H = sorted(H)

if N > K:
    print(K + sum(H[:H-K]))
else:
    print(K)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
H = map(int,input().split()).sort()

print(sum(H[0:N-K]))

Submission status: Runtime Error

Solution code:
#C
NK = input().split(' ')
N = int(NK[0])
K = int(NK[1])
Hi = input().split(' ')
Hi.sort()
for s in range(K):
    Hi.pop(N - 1 - s)
count = 0
for j in range(N-K):
    count += int(Hi[j])
print(count)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h = [int(i) for i in input().split()]
for i in range(k):
    h.remove(max(h))
print(sum(h))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())

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

for _ in range(K):
    A.pop(0)


print(sum(A))

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
for i in range(K):
    H.pop()
print(sum(H))

Submission status: Runtime Error

Solution code:
N, K = map(int,input().split())
H = list(map(int,input().split()))
result = 0
if len(H) <= K:
    print(result)
else:
    H.sort()
    for i in range(1, K+1):
        H.remove(H[-i])
    result = sum(H)
    print(result)

Submission status: Runtime Error

Solution code:
N, K = map(int,input().split())
H = list(map(int,input().split()))
result = 0
if len(H) <= K:
    print(result)
else:
    H.sort()
    for i in range(1, K+1):
        H.remove(H[-i])
    for i in H:
        result += i
    print(result)

Submission status: Runtime Error

Solution code:
N, K = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
result = 0
if len(H) <= K:
    print(result)
else:
    for i in range(1, K+1):
        H.remove(H[-i])
    for i in H:
        result += i
    print(result)

Submission status: Runtime Error

Solution code:
import numpy as np
n,k = map(int,input().split())
num_list = list(map(int,input().split()))

num_list = np.sort(num_list)[::-1]
num_list = np.array(num_list)
for i in range(k):
    num_list = np.delete(num_list,0)
    
print(sum(num_list))

Submission status: Runtime Error

Solution code:
N, K = list(map(int,input().split()))
k = K + 1
hp = 0
H = list(map(int,input().split()))
Hs = sorted(H,reverse = True)
for i in range(0,K):
  Hs[i] = 0
for i in range(k,N):
  hp += Hs[i]

Submission status: Runtime Error

Solution code:
N, K = list(map(int64_t,input().split()))
k = K - 1
H = list(map(int64_t,input().split()))
Hs = sorted(H,reverse = True)
for i in range(0,K):
  Hs[i] = 0
print(sum(Hs))

Submission status: Runtime Error

Solution code:
N, K = list(map(int,input().split()))
k = K - 1
H = list(map(int,input().split()))
Hs = sorted(H,reverse = True)
for i in range(0,K):
  Hs[i] = 0
print(sum(Hs))

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  sort(h.begin(), h.end(), greater<int>());

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i < k) {
      ans++;
    } else {
      ans += h[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
hlist = list(map(int,input().split()))
hp_list = sorted(hlist)
if k <len(hlist):
  for i in range(k):
    del hp_list[-i-1]
  print(sum(hp_list))
else:
  print(0)

Submission status: Runtime Error

Solution code:
str = input().split()
#print(str)
n = int(str[0])
k = int(str[1])
a = list(map(int, input().split()))
sum = 0
a.sort()
for i in range(k):a.pop()
#print(a)
for i in range(n-k):
    sum += a[i]
print(sum)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
for i in range(k):
    h.pop()
print(sum(h))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
life=sorted(list(map(int,input().split())))
if n<k:
  print(0)
else
  ans=sum(life[k:])
  print(ans)

Submission status: Runtime Error

Solution code:
n,h=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
a.reverse()
for k in range(0,h):
  a[k]=0
print(sum(a))

Submission status: Runtime Error

Solution code:
N,K= map(int,input().split())
H = list(map(int,input().split()))
H.sort()
s = 0
for i in range(K):
  s += H[i]
print(s+K)

Submission status: Runtime Error

Solution code:
N,K= map(int,input().split())
H = list(map(int,input().split()))
H = sort(H)
s = 0
for i in range(N-K):
  s += H[i]
print(s+K)

Submission status: Runtime Error

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

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

# ソートする
hp_list.sort(reverse=True)

# 必殺技の回数ぶん除去
for i in range(k):
    hp_list.pop(0)

sum_hp = 0
for hp in hp_list:
    sum_hp += hp

print(sum_hp)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

if len(h)<=k:
  print(0)
  
else:
  for i in range(k):
    h.remove(h[i])
  print(sum(h))

Submission status: Runtime Error

Solution code:
list = input().split(" ")
N = int(list[0])
K = int(list[1])
list_hp = input().split(" ")
list_hp = [int(i) for i in list_hp]
list_hp = sorted(list_hp)

if K < N:
    for i in range(1,K+1):
        list_hp.pop(-i)
    print(sum(list_hp))
    
else:
    print(0)

Submission status: Runtime Error

Solution code:
HP, k = map(int, input().split())
enamy = list(map(int, input().split()))

enamy1 = sorted(enamy, reverse=True)
if n =< k:
  print(0)
else:
  del enamy1[0:k]
  print(sum(enamy1))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
h=[0]*10**9
h=list(map(int,input().split()))
H=max(h)

for i in range(k):
  H[i]=0

mon=0
for i in range(n):
  mon+=h[i]
  
print(mon)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
for i in range(k):
    h.remove(max(h))
print(sum(h))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
if n<=k :
    print(0)
else :
    sm = 0
    for i in range(n-k):
        sm += l[i]
    pritn(sm)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = list(map(int, input().split())).sort()
if n<=k :
    print(0)
else :
    sm = 0
    for i in range(n-k):
        sm += l[i]
    pritn(sm)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l)
if n<=k :
    print(0)
else :
    sm = 0
    for i in range(n-k):
        sm += l[i]
    pritn(sm)

Submission status: Runtime Error

Solution code:
n,k=map(int, input().split())
h=list(map(int,input().split()))
H=sorted(h,reverse=True)
if n>=k:
	for i in range(k):
		H[i]=0
print(sum(H))
else: 
	print(0)

Submission status: Runtime Error

Solution code:
n,k=map(int, input().split())
h=list(map(int,input().split()))
H=sorted(h,reverse=True)
for i in range(k):
	H[i]=0
print(sum(H))

Submission status: Runtime Error

Solution code:
n,k=map(int, input().split())
h=list(map(int,input().split()))
H=sorted(h)
for i in range(k):
 H[n-k+1]=0
print(sum(H))

Submission status: Runtime Error

Solution code:
def main():
    N,K = list(map(int,input().split()))
    H = list(map(int,input().split()))

    sorted_H = sorted(H,reverse=True)

    for i in range(K):
        sorted_H[i] = 0
    '''
    for _ in range(K):
        if(len(H) > 0):
            maximum = max(H)
            H.remove(maximum)
            '''

    print(sum(sorted_H))

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
l=[int(x) for x in input().rstrip().split()]
l.sort(reverse = True)

ans=0

del l[0:a]
ans = a
print(sum(l))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a,reverse=true)
for i in range(min(n,k)):
  pop(0)
print(sum(a))

Submission status: Runtime Error

Solution code:
N = input().rstrip()
n = N[0]
k = N[1]

h = list(map(int,input().split()))
h.sort(reverse=True)

m = 0
hit = 0
if k >= n :
  m = n
else:
  for i in range(k,n):
    hit += h[i]
  
  m = k + hit
  
print(m)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
monsters = list(map(int, input().split()))

monsters.sort(reverse=True)

if(len(monsters) > k):
    for i in range(k):
        monsters.pop(i)
        
    total_hp = sum(monsters)
    print(total_hp)
else: print(0)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
HP=sorted(H)
for i in range(K):
  del HP[0]
print(sum(HP))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
h=sorted(list(map(int,input().split())))
ans=0
for i in range(k):
  ans+=h[i]
print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if n-k <= 0:
    print(0)
else:
    ans = sum(H[:n-k])
print(ans)

Submission status: Runtime Error

Solution code:
kazu1 = list(map(int, input().split()))
kazu2 = list(map(int, input().split()))
n = 0
kazu2.sort(reverse=True)

kazu2[0:kazu1[1]-1] = 0

n += sum(kazu2)

print(n)

Submission status: Runtime Error

Solution code:
n,k = map(int, input().split())
h = list(map(int, input().split()))

h.sort(reversed=True)

h = h[k:]

print(sum(h))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
if K > 0:
  for i in range(K):
    H.pop(-1)
print(sum(H))

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = map(int,read().split())
N -= K
if N <= 0:
    print(0)
    exit()
    
for i in N:
    H.remove(max(H))
    
print(len(H))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))

h = sorted(h)
sum_of_k = 0
for i in range(k):
    sum_of_k += h[len(h)-i-1]
ans = sum(h)-sum_of_k
print(ans if ans >=0 else 0)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))

if n == k:
    sum = 0
else:
    h.sort(reverse=True)
    sum = 0
    hh = h[k: n - k + 1]
    for i in range(n-k):
        sum += int(hh[i])

print(str(sum))

Submission status: Runtime Error

Solution code:
H, n = map(int, input().split())
List = [[0 for i in range(4)] for j in range(n)]
for i in range(n):
    a, b = map(int, input().split())
    List[i][0] = b / a
    List[i][1] = b / H
    List[i][2] = a
    List[i][3] = b

def recal():
    for i in range(n):
        b = List[i][3]
        List[i][1] = b / H

sList = sorted(List)
MP = 0
k = 0
while H > 0:
    if sList[k][2] <= H:
        H -= sList[k][2]
        MP += sList[k][3]
        recal()
    else:
        if sList[k + 1][2] <= H:
            if sList[k][1] <= sList[k + 1][0]:
                H -= sList[k][2]
                MP += sList[k][3]
                recal()
                break
            else:
                H -= sList[k + 1][2]
                MP += sList[k + 1][3]
                recal()
                k += 1
        else:
            if sList[k][1] <= sList[k + 1][1]:
                H -= sList[k][2]
                MP += sList[k][3]
                recal()
                break
            else:
                H -= sList[k + 1][2]
                MP += sList[k + 1][3]
                recal()
                k += 1
print(MP)

Submission status: Runtime Error

Solution code:
inp = input().split()
n,k = map(int, inp)
nums = list(input().split())
nums_list = list(map(int, nums))
kill_en_hp = 0
if len(nums_list) < k:
    print(0)
else:
    nums_list.sort()
    nums_list_2 = nums_list[k:]
    print(sum(nums_list_2u))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = h.sort()

if k >= n:
  print(0)
  
else:
  print(sum(h[:n-k]))

Submission status: Runtime Error

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

A.sort
for i in range(K):
  A.pop()
print(sum(A))

Submission status: Runtime Error

Solution code:
special_moves = input().split(" ")

_, special_moves = int(inputs[0]), int(inputs[1])

health= input().split(" ")
health= [int(h) for h in health]
health.sort(reverse=True)
print(sum(health[special_moves:]))

Submission status: Runtime Error

Solution code:
import sys


def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


N, K = InL()
H = InL().sort()

if K >= N:
    print(0)
    sys.exit()

print(sum(H[0:N-K]))

Submission status: Runtime Error

Solution code:
H, K = map(int, input().split())
hp = list(int, map(input().split()))
hp.sort(reverse=True)
print(sum(hp[K:]))

Submission status: Runtime Error

Solution code:
H, K = map(int, input().split())
hp = list(map(input().split()))
hp.sort(reverse=True)
print(sum(hp[K:]))

Submission status: Runtime Error

Solution code:
H, K = map(int, input().split())
hp = list(map(input().split()))
hp_sorted = sorted(hp, reverse=True)
print(sum(hp_sorted[K:]))

Submission status: Runtime Error

Solution code:
H, K = map(int, input().split())
hp = list(map(input().split()))
hp_sorted = sorted(hp, reverse=True)
hp_new = list(hp_sorted[K:])
print(sum(hp_new))

Submission status: Runtime Error

Solution code:
H, K = map(int, input().split())
hp = list(map(input().split()))
hp_sorted = sorted(hp, reverse=True)
hp_new = hp_sorted[K:]
print(sum(hp_new))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort(reverse=True)
H.remove(H[0:K])
print(sum(H[K:]))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort(reverse=True)
for i in range(K):
  H.remove(H[i])
print(sum(H[K:]))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
T=H.sort(reverse=True)
T.remove(T[0:K])
print(K+sum(T[K:]))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort(reverse=True)
H.remove(H[0:K])
print(K+sum(H[K:]))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort(reverse=True)
for i in range(K):
  H.remove(H[i])
print(K+sum(H[K:]))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort(reverse=True)
for i in range(K):
  H.remove(H[i])
print(K+sum(H[K::]))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
nums = list(map(int, input().split()))
if n <= k:
    print(0)
else:
    for i in range(k):
        nums.pop(max(nums))
    print(sum(nums))

Submission status: Runtime Error

Solution code:
n,k = gets.chomp.split.map(&:to_i)
h = gets.chomp.split.map(&:to_i).sort.reverse!

k = [n, k].min

k.times do |i|
  h[i] = 0
end

puts h.sum

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
ListH = list(map(int, input().split()))

#ListH.sort(reverse=True)
sum=0

if N<=K:
    print(0)
else:
     
for i in range(N-K):
    sum+=ListH[i]

print(sum)

Submission status: Runtime Error

Solution code:
N,K=[int(s) for s in input().split(" ")]
ListH=[int(s) for s in input().split(" ")]

ListH.sort(reverse=True)
sum=0

if N > K:
    for i in range(K):
        ListH.pop(i)
        
    for i in range(N-K):
        sum+=ListH[i]
else:
    sum=0
    
print(sum)

Submission status: Runtime Error

Solution code:
N,K=[int(s) for s in input().split(" ")]
ListH=[int(s) for s in input().split(" ")]

ListH=sorted(ListH,reverse=True)
sum=0

if N > K:
    for i in range(K):
        ListH.pop(i)

    for i in range(N-K):
        sum+=ListH[i]
else:
    sum=0
    
print(sum)

Submission status: Runtime Error

Solution code:
N,K=[int(s) for s in input().split(" ")]
ListH=[int(s) for s in input().split(" ")]

ListH=sorted(ListH,reverse=True)

if N > K:
    for i in range(K):
        ListH.pop(i)

    sum=0
    for i in range(N-K):
        sum+=ListH[i]
else:
    sum=0
    
print(sum)

Submission status: Runtime Error

Solution code:
N,K=input().split()
H=input().split()
N=int(N)
K=int(K)
H_i=[int(s) for s in H]
H_i.sort()
ans=sum(H_i)
for N in range(K):
    ans = ans - H_i[N-1]
    N=N-1
if ans>0:
    print(ans)
else:
    print(int(0))

Submission status: Runtime Error

Solution code:
N,K=input().split()
H=input().split()
N=int(N)
K=int(K)
H_i=[int(s) for s in H]
H_i.sort()
ans=sum(H_i)
for N in range(K):
　　　　ans = ans - H_i[N-1]
　　　　N=N-1
if ans>0:
　　　　print(ans)
else:
　　　　print(int(0))

Submission status: Runtime Error

Solution code:
N,K=input().split()
H=input().split()
N=int(N)
K=int(K)
H_i=[int(s) for s in H]
H_i.sort()
ans=sum(H_i)
for N in range(K):
	ans = ans - H_i[N-1]
  	N=N-1
if ans>0:
  	print(ans)
else:
  	print(int(0))

Submission status: Runtime Error

Solution code:
sh = 0
kaisuu = at = 0
sh = sum(mlist)

while k > 0:
    at=max(mlist)
    mlist.remove(at)
    k -= 1
    sh = sh -at
        
kaisuu = kaisuu + sh

print(kaisuu)