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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k = (int(x) for x in input().split())

h = []
h = list(map(int,input().split()))

asum=0

if n<=k :
	print(0)
else:
	h=sorted(h,reverse=True)
	for i in range(k,n):
		asum += h[i]

	print(asum)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if K != 0:
  print(sum(H[:-K]))
else:
  print(sum(H))

Submission status: Accepted

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

print(sum(H[K:]))

Submission status: Accepted

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

print(sum(h[k:]))

Submission status: Accepted

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

H.sort(reverse=True)
print(max([0, sum(H[k:])]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = [int(s) for s in input().split()]
h_list = sorted([int(s) for s in input().split()])
for _ in range(min(n, k)):
    h_list.pop()
print(sum(h_list))

Submission status: Accepted

Solution code:
n,k=[int(_) for _ in input().split()]

h=[int(_) for _ in input().split()]

h.sort()

for i in range(min(k,n)):
  h[-i-1]=0
  
print(sum(h))

Submission status: Accepted

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

print(sum(a))

Submission status: Accepted

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

a = R[0 : m]
point = sum(a) 
if K >= N :
    point = 0
print(point)

Submission status: Accepted

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

H.sort(reverse=True)

for i in range(min(N,K)):
    H[i] = 0
print(sum(H))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
if N>K:
  H.sort()
  del H[N-K:]
  print(sum(H))
else:
  print(0)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
H = sorted(list(map(int, input().split())))
if n > k:
    H = H[:n-k]
else:
    H = []
print(sum(H))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort(reverse=True)
if K>=N:
  print(0)
else:
  ans=0
  for i in range(K,N):
    ans+=H[i]
  print(ans)

Submission status: Accepted

Solution code:
def resolve():
    n,k=map(int,input().split())
    h=list(map(int,input().split()))
    h.sort(reverse=True)
    if len(h)<=k:
        print("0")
    else:
        print(sum(h[k:]))
resolve()

Submission status: Accepted

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

print(sum(h[k:]))

Submission status: Accepted

Solution code:
n,k = map(int, raw_input().split(' '))
monsters = map(int, raw_input().split(' '))
monsters.sort()

print sum(monsters[:max(0,n-k)] or [0])

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
Hs = list(map(int, input().split()))
Hs.sort()
if K > N:
  print(0)
  exit()
Hs2 = Hs[0:N-K]
r = sum(Hs2)
print(r)

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n,k=nm()
h = nl()

sh = sorted(h)[::-1]

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

print(sum(sh[k:]))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort()
while k>0 and h:
  h.pop()
  k -= 1
if h:
  print(sum(h))
else:
  print(0)

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
H=[int(x) for x in input().split()]
H=sorted(H)
ans=0
if N<=K:
    print(0)
    exit()
else:
    for i in range(N-K):
        ans+=H[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

sorted_H_list = sorted(H_list, reverse=True)
target_H_list = sorted_H_list[K:]
answer = sum(target_H_list)

print(answer)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
print(sum(h[0:max(0,len(h)-k)]))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
H=list(map(int, input().split()))
if K!=0:print(sum(sorted(H)[:-K]))
else:print(sum(H))

Submission status: Accepted

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

print(sum)

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,k = mi()
h = li()

h.sort()

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque
from collections import defaultdict

def main():
    n, k = list(map(int,sys.stdin.readline().split()))
    h = list(map(int,sys.stdin.readline().split()))
    h.sort(reverse=True)
    if k > len(h):
        print("0")
        return 0
    else: print(sum(h[k:]))
    return 0

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
H = list(map(int, input().split()))
H2 = sorted(H, reverse=True)
ans = 0

print(sum(H2[K:]))

Submission status: Accepted

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

sort_H = sorted(H)
if N >= K:
    print(sum(sort_H[0:N-K]))
else:
    print('0')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = list(map(int,input().split()))
H = list(sorted(list(map(int,input().split())),key=lambda x: -x))
print(sum(H[K:]))

Submission status: Accepted

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

def calCount(h):
    if K > N:
        return 0
    return sum(h[K:])

H.sort(reverse=True)
print(calCount(H))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math 
import sys 
#t=int(sys.stdin.readline())
t=1
for _ in range(t):
    n,m=map(int,input().split())
    l=list(map(int,input().split()))
    l.sort()
    x=0
    for i in range(n-m):
        x+=l[i]
    print(x)

Submission status: Accepted

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(0,k):
    h[i]=0
  print(sum(h))

Submission status: Accepted

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

h.sort(reverse = True)

print(sum(h[k:]))

Submission status: Accepted

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

Submission status: Accepted

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

A=sorted(H)
if N-K>0:
    B=A[:N-K]
    print(sum(B))
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest


def resolve():
    N, K = [int(i) for i in input().split()]
    H = sorted([int(i) for i in input().split()])
    if N <= K:
        H = [0]
    else:
        # if K < (N - K):
        for i in range(K):
            H[len(H) - 1 - i] = 0
        # else:
        #     Hs = []
        #     for i in range(N - K):
        #         Hs.append(H[i])
        #     H = Hs
    print(sum(H))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 1
4 1 5"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """8 9
7 9 3 2 3 8 4 6"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """3 0
1000000000 1000000000 1000000000"""
        output = """3000000000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if len(H) >= K:
    H = sorted(H, reverse=True)
    del H[0:K]
else:
    H.clear()

print(sum(H))

Submission status: Accepted

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)
hissatu = 0
for i in range(k):
    hissatu += l[i]
total = 0
for j in l:
    total += j
print(total-hissatu)

Submission status: Accepted

Solution code:
# ABC153C

def f(n, k, h):
    if n <= k:
        print(0)
    else:
        h = sorted(h)[::-1]
        for i in range(k):
            h[i] = 0
        print(sum(h))

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

Submission status: Accepted

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


def main():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    assert N == len(H)
    H.sort(reverse=True)
    print(sum(H[K:]))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
ans = 0
for h in H[K:]:
  ans += h
print(ans)

Submission status: Accepted

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

h.sort(reverse=True)
t=0
if n>=k:
    for i in h[k:]:
        t+=i
print(t)

Submission status: Accepted

Solution code:
n,k = (int(x) for x in input().split())
h = [int(x) for x in input().split()]
sum = 0
result = True
h.sort(reverse=True)

if k < n:
    for i in range(k,len(h)):
        sum += h[i]
else:
    result = False

if result:
    print(sum)
else:
    print(0)

Submission status: Accepted

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

h.sort(reverse=True)

if n >= k:
    for i in range(k):
        h[i] = 0
    print(sum(h))
else: print(0)

Submission status: Accepted

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

if n <= k:
  arr = []
elif 0 < k < n:
  arr = arr[:n-k]
print(sum(arr))

Submission status: Accepted

Solution code:

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

h_sort=sorted(h)
# print(h_sort)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
List=list(map(int,input().split()))
S=sorted(List)[::-1]

del S[0:K]
print(sum(S))

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
h = sorted(h)
if k != 0:
    h = h[:-k]
print(sum(h))

Submission status: Accepted

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

print(sum(H[K:]))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    l.sort(reverse=True)
    ans=sum(l[k:])
    print(ans)
resolve()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    l.sort(reverse=True)
    if k>=n:
        ans=0
    else:
        ans=sum(l[k:])
    print(ans)

resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

H = H[K:]
print(sum(H))

Submission status: Accepted

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

h.sort(reverse=True)
for i in range(0,min(k,len(h))):
    h[i] = 0
hp = 0
for j in range(k,n):
    hp += h[j]

print(hp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = [int(_) for _ in input().split()]
h = sorted([int(_) for _ in input().split()])
if k >= n:
    print(0)
else:
    print(sum(h[:n - k]))

Submission status: Accepted

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

Hsort = sorted(H, reverse=True)

Huse = Hsort[K:]


print(sum(Huse))

Submission status: Accepted

Solution code:
N,K = map(int, input().split())
H = sorted(list(map(int, input().split())))
if K == 0:
  print(sum(H))
else:
  print(sum(H[:-K]))

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
h = list(map(int, input().split()))
h = sorted(h, reverse=True)
if len(h) > k:
    h = h[k:]
    print(sum(h))
elif len(h) <= k:
    print(0)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(sorted(H, reverse=True)[K:]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
import sys

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

if k >= n:
    print("0")
    sys.exit(0)

H.sort()
print(sum(H[0:len(H) - k]))

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort(reverse=True)
if k < n:
    for i in range(k):
        h[i] = 0
else:
    h = [0] * len(h)
print(sum(h))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
H_list = list(map(int, input().split()))
H_list = sorted(H_list, reverse=True)

res = H_list[K:]
print(sum(res))

Submission status: Accepted

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

print(sum(h[k:]))

Submission status: Accepted

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

H.sort(reverse = True)
#print(H)

if N > K:
    
    for i in range(K):
        H[i] = 0
    #print(H)
    print(sum(H))

else:
    print("0")

Submission status: Accepted

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

h.sort(reverse=True)
print(sum(h[k:]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if len(h_) <= k:
    print(0)
else:
    h_.sort(reverse = True)
    for i in range(k):
        h_[i] = 0
    print(sum(h_))

Submission status: Accepted

Solution code:
A,B = list(map(int,input().split()))
s = list(map(int,input().split()))
s1 = sorted(s,reverse = True)
s2 = s1[B::]
print(sum(s2))

Submission status: Accepted

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

Submission status: Accepted

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

if K>N:
  print(0)
else:
  H = sorted(H)
  print(sum(H[0:len(H)-K]))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri May  8 15:19:53 2020

@author: shinba
"""
from sys import exit

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

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

while k > 0:
    h.pop()
    k -= 1

print(sum(h))

Submission status: Accepted

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

h = sorted(list(map(int,input().split())))

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

Submission status: Accepted

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

mH = sum(sorted(H, reverse=True)[K:])

print(mH)

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    n, k = map(int, stdin.readline().split())
    h = list(map(int, stdin.readline().split()))
    h.sort()

    ans = 0
    for i in range(n - k):
        ans += h[i]
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

Solution code:
def main():
    n,k=map(int,input().split())
    h=list(map(int,input().split()))
    if k>=n:
        print(0)
        exit()
    h.sort(reverse=True)
    print(sum(h[k:]))
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def solve():
    N, K = map(int,input().split())
    H = list(map(int,input().split()))
    a = sorted(H, reverse = True)
    b = sum(a[K:])
    
    print(b)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

h = h[k:]

ans = sum(h)
print(ans)

Submission status: Accepted

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

print(sum(h))

Submission status: Accepted

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

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

a.sort(reverse = True)
ret = 0
for i in range(k, len(a)):
    ret += a[i]
print(ret)

Submission status: Accepted

Solution code:
import sys

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

a.sort(reverse = True)
ret = 0
for i in range(k, len(a)):
    ret += a[i]
print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if n <= k:
    print("0")
else:
    h.sort()
    h2 = h[:n-k]
    print(sum(h2))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
lst=list(map(int,input().split()))
total = 0
lst.sort(reverse=True)
if len(lst)>=k:
  del lst[0:k]
  print(sum(lst))
else:
  print(0)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
h_list = list(map(int, input().split()))
sorted_h_list = sorted(h_list, reverse=True)

cnt = 0
for h in sorted_h_list:
    if k > 0:
        k-=1
        continue
    cnt+=h
print(cnt)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
m = sorted(map(int, input().split()))[::-1]
print(sum(m[k:]) if len(m) > k else '0')

Submission status: Accepted

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

H.sort(reverse=True)
H=H[K:]
print(sum(H))

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
listH = list(map(int,input().split()))
listH.sort()
listH = listH[:max(0,N-K)]
print(sum(listH))

Submission status: Accepted

Solution code:
il1 = [int(k) for k in input().split()]
N = il1[0]
K = il1[1]
H = [int(k) for k in input().split()]

H.sort(reverse=True)

if len(H) <= K:
    counter = len(H)
else:
    counter = K

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

S = sum(H)

print(S)

Submission status: Accepted

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

if len(H) <= K:
  print(0)
else:
  del H[0:K]
  print(sum(H))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# C - Fennec vs Monster

N, K = map(int, input().split())
H = sorted([int(h) for h in input().split()])
H = H[:N - K]
print(sum(H) if K < N else 0)

Submission status: Accepted

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

Submission status: Accepted

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

h.sort(reverse=True)

if n < k:
    print(0)
else:
    print(sum(h[k:]))

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n, k = Is()
H = LI()
H.sort(reverse=True)
if n > k:
    print(sum(H[k:]))
else:
    print("0")

Submission status: Accepted

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

H = numpy.sort(H)
sum = 0
#print(H)
if N-K > 0:
  for i in range(N-K):
    sum = sum + H[i]
else:
    sum = 0
    
print(sum)

Submission status: Accepted

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

h.sort(reverse = True)

ans = sum(h[k:])

print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
if k>=len(a):
    print(0)
else:
    print(sum(a[k:]))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
h.reverse()
if n <= k:
  print(0)
else:
  ans=0
  for i in range(k,n):
    ans+=h[i]
  print(ans)

Submission status: Accepted

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

N,K = list(map(int, input().rstrip().split()))
H_list = list(map(int, input().rstrip().split()))
#-----

sort_H = sorted(H_list, reverse=True)
cnt = 0

for i in range(K, len(sort_H)):
    cnt += sort_H[i]

print(cnt)

Submission status: Accepted

Solution code:
def main():
    n, k = (int(x) for x in input().split())
    if n <= k:
        print(0)
        return
    hl = [int(x) for x in input().split()]
    hl = sorted(hl, reverse=1)[k:]
    print(sum(hl))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

N, K = map(int,input().split())
H = list(map(int,input().split()))
H.sort(reverse = True)

for i in range(K):
  H[min(i, N-1)] = 0

ans = 0
for i in H:
  ans += i
  
print(ans)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
h_sort = sorted(h, reverse=True)
count = 0
while (k > count) and (n > count):
    h_sort[count] = 0
    count += 1
print(sum(h_sort))

Submission status: Accepted

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

ans = 0

for i in range(N - K):
  ans += H[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

if (n > k):
    hx = sorted(h)[0: n - k]
    """
    hx = h.sort(reverse=True)
    for i in range(k):
        hx.pop(0)
    """
    ans += sum(hx)

print(ans)

Submission status: Accepted

Solution code:
N, K = [int(_) for _ in input().split()]
H = [int(_) for _ in input().split()]
H.sort(reverse=True)
if K >= N:
    print(0)
else:
    print(sum(H[K:]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC 153
N,K =map(int, input().split())
H = [int(i) for i in input().split(" ")]
if K ==0:
    print(sum((sorted(H))))
else:
    print(sum((sorted(H)[:-K])))

Submission status: Accepted

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

H_sorted = sorted(H, reverse = True)
cnt = 0

for i in range(K) :
    if i < N :
        H_sorted[i] = 0

for j in H_sorted :
    if j == 0 :
        continue
    else :
        cnt = cnt + j

print(cnt)

Submission status: Accepted

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

H = sorted(H,reverse=True)
ans = sum(H[K:])
print(ans)

Submission status: Accepted

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

H_list.sort(reverse=True)
H_list2 = H_list[K:]

print(sum(H_list2))

Submission status: Accepted

Solution code:
def main():
    N, K = list(map(int, input().split(' ')))
    H = list(map(int, input().split(' ')))
    H.sort()
    m = max([N - K, 0])
    print(sum(H[:m]))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
H = sorted(map(int, input().split()), reverse=True)

res = 0
for h in H:
    if K > 0:
        K -= 1
    else:
        res += h

print(res)