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: Wrong Answer

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

N = INPUT[0]
K = INPUT[1] # 必殺技の回数

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

sorts = sorted(enemy)

if N < K:
    print('0')
elif K == 0:
    print(sum(enemy))
else:
    target = sorts[:len(sorts) - 1]
    print(sum(target))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
a=list(int(x) for x in input().split())
a.sort()
s=0
if k <= n:
	print(0)
else:
		s = sum(a[:n-k])
		print(s)

Submission status: Wrong Answer

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

H = h[k:]

if len(H) == 0:
  print(0)
elif k == 0:
  print(sum(H))
else:
  print(sum(H)//k)

Submission status: Wrong Answer

Solution code:
import math

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

sum = 0
for i in range(n-k):
  sum = sum + int(hlist[i])
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

H, AT = map(int, input().split())
HPs = sorted(map(int, input().split()))
count = 0

# 敵の数 H
# 必殺でHP0 AT回
# 敵HP多い順 HPs

# 残った個体数
left = H - AT
if left > 0:
  for i in range(AT, H):
    count = count + HPs[i]
  print(count)
else:
  print(0)

Submission status: Wrong Answer

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

l = h[0:(n-k)]

print(sum(l))

Submission status: Wrong Answer

Solution code:
n, k= map(int, input().split())
h = list(map(int, input().strip().split()))
import numpy as np
hnp = np.asarray(h)
if(k >= n):
    print(0)
else:    
    s = n-k
    print(np.sum(hnp[:s]))

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
enemy = list(map(int, input().split()))
enemy.sort(reverse=True)
ans = 0
nokori = 999

if k > 0:
    nokori = n-k

if nokori <= 0:
    print(0)
else:
    if k > 0:
        for i in range(n-k-1,n):
            ans += enemy[i]
    else:
        i = 0
        for i in range(0,n):
            ans += enemy[i]
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
a = input().split()  
b= input().split()
bb = [int(s) for s in b]
if int(a[0])>=int(a[1]):
 print("0")
 sys.exit()
else:
 for _ in range(0,int(a[1])):
  try:
   bb.remove(max(bb))
  except:
   print("0")
   sys.exit()
print(sum(bb))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
enemy = list(map(int, input().split()))
enemy.sort(reverse=True)
ans = 0
nokori = 999

if k > 0:
    nokori = n-k

if nokori <= 0:
    print(0)
else:
    if k > 0:
        for i in range(n-k-1,n):
            ans += enemy[i]
    else:
        i = 0
        for i in range(0,n-1):
            ans += enemy[i]
    print(ans)

Submission status: Wrong Answer

Solution code:
args = input().split()
args2 = input().split()
args2.sort()
N = int(args[0])
K = int(args[1])
S = 0

for i in range(N-K):
	S += int(args2[i])

if S <= 0:
	print(0)
else:
	print(S)

Submission status: Wrong Answer

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

l = h[0:(n-k)+1]

print(sum(l))

Submission status: Wrong Answer

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

d.reverse()
del d[0:k]

print(sum(d))

Submission status: Wrong Answer

Solution code:
import math
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
ans=0
if k>=n:
    ans=0
else:
    list_new=l[0:n-k]
    ans_pre=sum(list_new)
print(ans)

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
enemy = list(map(int, input().split()))
enemy.sort(reverse=True)
ans = 0
nokori = 0

if k > 0:
    nokori = n-k
else:
    nokori = n

if nokori <= 0:
    print(0)
else:
    if k > 0:
        for i in range(n-k-1,n):
            ans += enemy[i]
    else:
        i = 0
        for i in range(0,n-1):
            ans += enemy[i]
    print(ans)

Submission status: Wrong Answer

Solution code:
args = input().split()
args2 = input().split()
args2.sort()
N = int(args[0])
K = int(args[1])
S = 0

for i in range(N-K):
	S += int(args2[i])

print(S)

Submission status: Wrong Answer

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

b.sort(reverse=True)
ans = 0

while k > 0:
    if n < 0:
        break
    else:
        del b[:k]
        n -= k

if n == 0:
    print('0')
else:
    print(sum(b))

Submission status: Wrong Answer

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

H.sort()
H.reverse()
print(H)
del H[:k]
a=sum(H)
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if __name__=='__main__':
    if (K>=N):
        print(0)
    elif K==0:
        print(sum(H))
    else:
        print(sum(H[-K-1:]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if n<k:
    print("0")
elif k == 0:
    print(sum(h))
else:
    n = h[:k+1]
    print(sum(n))

Submission status: Wrong Answer

Solution code:
import math
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
ans=0
if k>=n:
    ans=n
else:
    list_new=l[0:n-k]
    ans=sum(list_new)
print(ans)

Submission status: Wrong Answer

Solution code:
i = list(map(int, input().split()))
j= list(map(int, input().split()))
x=sorted(j, reverse=True)
z=0

if i[1]>=len(j):
  print(0)
else:
  for a in range(i[0],len(x)):
    z+=x[a]
  print(z)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K = input().split()
H = list(input().split())
N = int(N)
K = int(K)
H = [int(h) for h in H]
H.sort()
print(sum(H[0:N - K]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from heapq import heapify, heappop
from math import ceil
N, K = map(int, input().split())
H = list(map(int, input().split()))
# N=3
# K=0
# H=[1000000000,1000000000,1000000000]

Hminus = list(map(lambda x: x*(-1), H))
# print(type(Hminus))
heapify(Hminus)
# print(Hminus)
if K > len(H):
    print(len(H))
else:
    for _ in range(K):
        heappop(Hminus)
    print(sum(Hminus)*(-1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=list(map(int,input().split()))
H=list(map(int,input().split()))
H=sorted(H,reverse=True)
if N[1]>=len(H):
    print(len(H))
else:
    while N[1]>=1:
        del(H[0])
        N[1]-=1
    print(sum(H))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = (int(x) for x in input().split())
H = list(map(int, input().split()))
if k != 0:
    H.sort()
    del H[:k]
print(sum(H))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input().split()
n, k = int(s[0]), int(s[1])

ss = input().split()
l = [int(i) for i in ss]

l.sort()

ans = l[:n-k]

print(sum(ans))

Submission status: Wrong Answer

Solution code:
s = []
for i in range(2):
    s.append(input().split())
n = int(s[0][0])
k = int(s[0][1])
answer = 0
hs = s[1]
print(hs)
h = [int(a) for a in hs]
print(h)
h.sort()
print(h)
h.reverse()
if(k<n):
    for i in range(k,n):
        answer = answer + h[i]
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
H.reverse()
if K==0:
        pass
elif K==1:
        del H[0]
else:
   del H[0:K-1]
a = 0

for i in H:
        a+=i
print(a)

Submission status: Wrong Answer

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

arr = sorted(arr)
arr[:min(n,k)] = [0]*min(n,k)

print(sum(arr))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
listsort=sorted(A, reverse=True)
print(listsort)
del listsort[0:K]
print(sum(listsort))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

M.sort(reverse=True)

k = HK[1]

while k > 0:
    if (len(M) > 0):
        break
    M.pop(0)
    k -= 1

damage = 0
for i in range(len(M)):
    damage += M[i]

print(damage)

Submission status: Wrong Answer

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

a.sort()

counter = 0
if K > len(a):
  counter = 0
else:
  print(a)
  for _ in range(K):
      a.pop(-1)
  counter = sum(a)
print(counter)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N=list(map(int,input().split()))
H=list(map(int,input().split()))
count=0
H=sorted(H,reverse=True)
if N[1]>=len(H):
    print(len(H))
else:
    while N[1]>=1:
        del(H[0])
        N[1]-=1
        count+=1
    print(sum(H))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = input().split()
total=0
 
if(K>=len(H)):
  print(0)
else:
  temp = sorted(H)
  temp = temp[: len(temp)-K]
  for i in temp:
    total+=int(i)
  print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
enemy = list(map(int, input().split()))
enemy.sort(reverse=True)
ans = 0
nokori = 0
if k > 0:
    nokori = n-k
else:
    nokori = n

if nokori <= 0:
    print(0)
else:
    if k >0:
        nokori = n-k-1
    else:
        nokori = 0
    for i in range(nokori,n):
        ans += enemy[i]
    print(ans)

Submission status: Wrong Answer

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

# N monsters
# No.i monster vitalitiy is Hi
# two actions
# attack : reduce 1 vitaility
# special: make vitality 0. Fenek can use K times of specials.

H.sort(reverse=True)

if N <= K:
    print(0)
    exit()


r_H = H[K:]


sum_H = 0
for hp in r_H:
    sum_H += hp

print(sum_H)
print(10**9)
print(2*10**14)

Submission status: Wrong Answer

Solution code:
N=list(map(int,input().split()))
H=list(map(int,input().split()))
count=0
H=sorted(H,reverse=True)
if N[1]>=len(H):
    print(len(H))
else:
    while N[1]>=1:
        del(H[0])
        N[1]-=1
        count+=1
    print(count+sum(H))

Submission status: Wrong Answer

Solution code:
x = input().split(" ")
n = int(x[0])
k = int(x[1])
h = list(map(int,input().split(" ")))

h.sort(reverse=True)
print(h)

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

Submission status: Wrong Answer

Solution code:
arr = input().split(" ")
N = int(arr[0])
K = int(arr[1])

HP_arr = input().split(" ")
HP_arr.sort(reverse=True)
HP_arr = [int(i) for i in HP_arr ]

if(K > 0):
    if(K == 1):
        del HP_arr[:K]
        print(sum(HP_arr))
    else:
        del HP_arr[:K-1]
        print(sum(HP_arr))
else:
    print(sum(HP_arr))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = input().split()
total=0
 
if(K==len(H)):
  print(0)
else:
  temp = sorted(H)
  temp = temp[: len(temp)-K]
  for i in temp:
    total+=int(i)
  print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)

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

h.reverse()

if k>=n:
    print(0)

else:
    ans = 0
    v = h[k:]
    for i in v:
        ans += i
    print(ans)

Submission status: Wrong Answer

Solution code:
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
result = sum(reversed(sorted(H)[K:]))
print(int(result))

Submission status: Wrong Answer

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

if n < a:
  print(0)
  
aaa = list(map(int, input().strip().split()))

aaa = sorted(aaa, reverse=True)
h = 0
for i in range(a, n):
  h += aaa[i]
  
print(h)

Submission status: Wrong Answer

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

M.sort(reverse=True)

k = HK[1]

while k > 0 | len(M) > 0:
    M.pop(0)
    k -= 1

damage = 0
for i in range(len(M)):
    damage += M[i]

print(damage)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
hi=[]
for i in map(int,input().split()):
    hi.append(i)
hi.sort
hsum=0
for i in range(n-k):
    hsum=hsum+hi[i]
print(hsum)

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
c=a.split()
N=int(c[0])
K=int(c[1])
A=b.split()
ans=0
A.sort(reverse=True)
if(N<=K):print(0)
else:
    for i in range(N-K):
        ans = ans+int(A[N-1-i])
    print(ans)

Submission status: Wrong Answer

Solution code:
arr = input().split(" ")
N = int(arr[0])
K = int(arr[1])

HP_arr = input().split(" ")
HP_arr.sort(reverse=True)
HP_arr = [int(i) for i in HP_arr ]

if(K > 0):
    del HP_arr[:K]
    print(sum(HP_arr))
else:
    print(sum(HP_arr))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = input().split()
total=0
 
if(K==len(H)):
  print(0)
else:
  temp = sorted(H)
  while K>0:
    temp=temp[:-1]
    K-=1
  for i in temp:
    total+=int(i)
  print(total)

Submission status: Wrong Answer

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

h.sort()

print(sum(h[:n-k]))

Submission status: Wrong Answer

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

h_L.sort(reverse=True)
#print(h_L)
if k ==0:
    print(sum(h_L))
else:
    print(sum(h_L[k+1:]))

Submission status: Wrong Answer

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

h_sorted = sorted(h)
print(sum(h_sorted[:-k]))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

h_L.sort()

if k ==0:
    print(sum(h_L))
else:
    print(sum(h_L[k+1:]))

Submission status: Wrong Answer

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

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

h = sorted(map(int, input().split()))
print(sum(h[0:n-k]) + k)

Submission status: Wrong Answer

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

if k == 0:
    print(sum(H))
    exit()

H.sort(reverse=True)
del H[:k + 1]
if not H:
    print(0)
else :
    print(sum(H))

Submission status: Wrong Answer

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

import math

# H,N=3,1
# l=[4,1,5]

import sys
if N>=len(l):
    print(l)
    sys.exit()

    
sort_l=sorted(l)
delete_l=sort_l[:len(l)-N]
print(sum(delete_l))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
K, N = list(map(int, input().split()))
h = list(map(int, input().split()))
#倒す数
a = K-N
if 0>=a:
  print(0)
else:
  print(sum(sorted(h[:a])))

Submission status: Wrong Answer

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

if k == 0:
    print(sum(H))
    exit()

H.sort(reverse=True)
del H[:k + 1]
print(sum(H))

Submission status: Wrong Answer

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

n, k = map(int, input().split())
H = sorted([int(i) for i in input().split()], reverse = True)

if k == 0:
    print(sum(H))
elif k >= n:
    print(0)
else:
    print(sum(H[(n-k-1):]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
monster_num,k = map(int,input().split(" "))
hp = list(map(int,input().split(" ")))
hp = sorted(hp, reverse = True)
print(hp)
total = 0
for i in hp:
    total += i
    
s = 0
for i in range(k):
    if s <= len(hp) - 1:
        total -= hp[s]
        s += 1

print(total)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n,k=map(int, input().split())
h=list(map(int, input().split()))
b =sorted(h)[0:-n]

#攻撃回数
print(sum(b))

Submission status: Wrong Answer

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

if (n<=k):
  print(0)
else:

  sum_count = 0
  sum_count = sum(lst[:-k])
  print(sum_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = input().split()
n = int(x[0])
k = int(x[1])

h = input().split()

sorted(h,reverse=True)

if n-k <= 0:
    print(0)
    exit()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
inp = input().rstrip().split(" ")
N = int(inp[0])
K = int(inp[1])
inp = input().rstrip().split(" ")
HP = [0 for i in range(N)]
for i in range(N):
  HP[i] = int(inp[i])
HP.reverse()
ans = 0
for i in range(N):
  if i >= K:
    ans += HP[i]
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k, *h = map(int, open(0).read().split())

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

h.sort()

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

print(sum)

Submission status: Wrong Answer

Solution code:
import sys,collections,math,random,fractions,bisect;sys.setrecursionlimit(10**7)
sr = sys.stdin.readline; P = print; P2 = lambda x: print(*x, sep="\n")
def I(i=0): t = [int(x)-i for x in sr().split()];return t 
def S(): t = sr().split(); return t if len(t) > 1 else t[0]
L1,L2,L3,L4, = [],[],[],[]

N,K = I()
A = I()
if N == K:
    print(0)
else:
    print(sum(sorted(A)[:N-K]))

Submission status: Wrong Answer

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

import math

# H,N=3,1
# l=[4,1,5]

import sys
if N>=len(l):
    print(l)
    sys.exit()

    
sort_l=sorted(l)
delete_l=sort_l[:len(l)-N]
score=0
for i in delete_l:
    score+=(math.ceil(i/H))
print(score)

Submission status: Wrong Answer

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

ls = sorted(ls)

if len(ls)<k+1:
  print(0)
else:
  print(sum(ls[:-k]))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
if n<=k:
    print(k)
else:
    ll=l[k:n-1]
    print(sum(ll)+k)

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
c=a.split()
N=int(c[0])
K=int(c[1])
A=b.split()
ans=0
A.sort()
if(N<=K):print(0)
else:
    for i in range(N-K):
        ans = ans+int(A[K-1+i])
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
h, k = ([int(s) for s in input().split()])
healths = [int(s) for s in input().split()]
healths.sort()
if k == 0:
	print(sum(healths))
to_attack = healths[:-k]

print(sum(to_attack))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

h_L.sort()

print(sum(h_L[k+1:]))

Submission status: Wrong Answer

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

del h[n::]
h.sort()
del h[-k:]
print(sum(h))

Submission status: Wrong Answer

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

# H を高い順にソート
# 上からK個削除
# SUM

sortedList = sorted(H)
s = 0
for i in range(N - K):
    s += H[i]

print(s)

Submission status: Wrong Answer

Solution code:
h,n=[int(x) for x in input().split()]
a=list(map(int,input().split()))
sorted(a)
a=a[-n:]
print(sum(a))

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc153/tasks/abc153_c
import numpy as np
N, K = map(int, input().split())
H = np.array(list(map(int, input().split())), dtype='int64')
H.sort()
# print('H', H)
if N <= K:
    print(0)
    exit()
if K == 0:
    print(H.sum())
    exit()
subset = H[:K + 1]
# print(subset)
print(subset.sum())

Submission status: Wrong Answer

Solution code:
N, K = [int(i) for i in input().split()]
mon_list = [int(i) for i in input().split()]
mon_list = sorted(mon_list, reverse=True)
if N <= K:
    output = 0
else:
    if K != 0:
        output = sum(mon_list[:K])
    else:
        output = sum(mon_list)
print(output)

Submission status: Wrong Answer

Solution code:
H, K = map(int, input().split())
array = list(map(int, input().split()))
A = sorted(array, reverse=True)
del A[0:K-1]
print(sum(A))

Submission status: Wrong Answer

Solution code:
import sys


def main():
    k = int(input().replace('\n','').split()[1])
    tmp = input().replace('\n','').split()
    tmp.sort(reverse=True)
    n=0
    for i in tmp[k:]:
        n+=int(i)
    print(n)
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

h.reverse()

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

else:
    h = h[k:]
    print(sum(h))

Submission status: Wrong Answer

Solution code:
#C
import heapq

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

if K >= N:
    print(0)
else:
    for _ in range(K):
        heapq.heappop(H)
        break
    print(-sum(H))

Submission status: Wrong Answer

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

    h.sort(reverse=True)

    print(sum(h[k:]))

Submission status: Wrong Answer

Solution code:
import numpy as np

E, H = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))

if H>=E:
  print("0")
else:
  A = np.sort(A)
  Ans = A[:-H].sum()
  print(Ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import math
from collections import deque
input = sys.stdin.readline
N, K = map(int,input().split())
H = list(map(int,input().split()))
ans = 0
for i in range(N-K):
    ans += H[i]
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s.sort()
print(sum(s[:-k]))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
lists=list(map(int,input().split()))
if len(lists)<=k:
    print(0)
elif len(lists)>k:
    sub=lists[:len(lists)-k]
    print(sum(sub))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import numpy as np


DEBUG = True
dprint = print if DEBUG else lambda *x : x

N, K = [int(str) for str in input().strip().split()]
H = [int(str) for str in input().strip().split()]

if K == 0:
    print(sum(H))
elif K >= len(H):
    print(0)
else:
    H.sort(reverse=True)
    print(sum(H[:K]))

Submission status: Wrong Answer

Solution code:
import math

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

if N <= K:
  print(0)
elif K == 0:
  print(sum(H))
else:
  H.sort()
  h = H[:-K]
  print(h)
  print(sum(h))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

H.sort()

cnt = 0
for i in range(N):
    if K > 0:
        K -= 1
    else:
        cnt += H[i]

print(cnt)

Submission status: Wrong Answer

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

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

for i in h:
    if k != 0:
        h.remove(max(h))
        k -= 1
        
print(sum(h))