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:

N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    new_arr = sorted(arr)
    ans = new_arr[:-K]
  elif (K ==0):
    ans = arr
print(sum(ans))

Submission status: Runtime Error

Solution code:
#Fennec vs Monsters python3
H=[]       #Health of ith monster.
Attack = 1 #Decrease Monster's health by 1.
move=0     #Decrease Monster's health to 0.
N=1        #Number of monsters 
count = 0
i=0
N=int(input())
K=int(input())     #number of special moves.
for i in range(0,N):
        value = int(input())
        H.append(value) #Health of ith monster.
i = 0
if K==0:
    countA = sum(H)
elif K>=len(H):
    countA = 0
elif K<len(H):
    H.sort()
    H=H[0:len(H)-K]
    countA = sum(H)

print (countA)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    new_arr = sorted(arr)
    ans = new_arr[:-K]
  else:
    ans = arr
print(sum(ans))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
H = [int(a) for a in input().split()]
if N <= K:
    print(int(0))
elif K == 0:
    print(sum(H))
else:
    Hs = H[0,:N-K]
    print(sum(Hs))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
input_line = list(map(int,input().split()))
input_hp = list(map(int,input().split()))
try:
    [(input_hp.sort(reverse=True) ,input_hp.pop(_)) for _ in range(input_line[1])]
    print(sum(input_hp))
except IndexError:
    print(‘0’)

Submission status: Runtime Error

Solution code:

N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    # for i in range(K):
      # arr.remove(max(arr))
    new_arr = sorted(arr)
    ans = new_arr[:-K]
  print(sum(ans))

Submission status: Runtime Error

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

# スペース区切りの整数の入力
b, c = map(int, input().split())
# 空白区切り入力 List
s = input().split()

s_list = []
s_list = [int(s) for s in s]
list.sort(s_list, reverse=True)

num = 0
sum = 0
if(c < len(s_list)):
	for num in range(c):
		s_list.pop(num)
	for inp in s_list:
		sum = sum + int(inp)
print(sum)

Submission status: Runtime Error

Solution code:
import math

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

H.sort(reverse=True)
if K >= N:
    print(0)
elif K >= 1:
    [H.pop(i) for i in range(K)]
    print(sum(H))
else:
    print(sum(H))

Submission status: Runtime Error

Solution code:
def f(h,k):
    N=len(h)
    t=0
    h.sort()
    for i in range(k-1):
        t+=h[i]
    return sum(h)-t
N,k=map(int,input().split())
h=list(map(int,input().split()))
print(f(h,k))

Submission status: Runtime Error

Solution code:
sumDmg = 0
firstLine = input().split()
secondLine = input().split()
integerSecondLine = []
for n in range(len(secondLine)):
	integerSecondLine.append(int(secondLine[n]))
sortedLine = reversed(integerSecondLine)
if int(firstLine[1]) >= int(firstLine[0]):
    print("0")
else:
	for p in range(int(firstline[1])):
		sortedLine.pop(p)
	for q in range(len(sortedLine)):
		sumDmg = sumDmg + sortedLine[q]
	print(sumDmg)

Submission status: Runtime Error

Solution code:
import sys
a,b=map(int,input().split())
c=list(map(int,input().split()))
if a<=b:
  print(0)

else:
  f=0
  d=0

  c.sort()
  e=-1
  f=0
  for i in range(a):
    d+=c[i]
  

  for i in range(b):
    if b>0:
      b-=1
      f+=1
      
      d-=c[e]
      e-=1
      if d<=0:
        print(f)
        sys.exit()
      
for i in range(a+e+1):
  f+=c[i]

print(f)

Submission status: Runtime Error

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

h.sort(reverse=True)

for i in range(k):
    h.pop(0)

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 K <= N and K != 0:
    H.remove(H[:K])
elif K > N and K != 0:
    H.clear()
print(sum(H))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
a,b=map(int,input().split())
c=list(map(int,input().split()))
if a<=b:
  print(0)

else:
  f=0
  d=0

  c.sort()
  e=-1
  f=0
  for i in range(a):
    d+=c[i]
  

  for i in range(b):
    if b>=0:
      b-=1
      f+=1
      
      d-=c[e]
      e-=1
      if d<=0:
        print(f)
        sys.exit()
      
  
  f+=c[e]
  f+=c[e-1]

  print(f)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
H = [int(a) for a in input().split()]
if N <= K:
    print(int(0))
elif K == 0:
    print(sum(H))
else:
    import numpy
    Harray = numpy.array(sort(H))
    for n in range(0,(N-K)):
       A += Hs[n]
       n += 1

	print(Harray)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
hps=list(map(int,input().split()))
hps.sort()
if k>n:
  print(n)
elif k==n:
  print(k)
else:
  ans=k
  for i in range(k):
    hps.pop()
  ans+==sum(hps)
  print(ans)

Submission status: Runtime Error

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

Monst = list(range(N))
Monst = input().split()
Monst.sort()

if K >= N:
    print("0")

else:
    for i in range(K):
     Monst.pop(-1 - i)

    sum = 0
    for i in range(len(Monst)):
        sum = sum + int(Monst[i])

    print(sum)

Submission status: Runtime Error

Solution code:
attack = raw_input().split()
monster = raw_input().split()
monster = [int(x) for x in monster] 
for i in range(0,int(attack[1])):
    monster.remove(max(monster))
print(sum(monster))

Submission status: Runtime Error

Solution code:
h, n = [int(x) for x in input().split()]
listk = [int(x) for x in input().split()]
listk.sort()
count = 0
for i in range(0,n):
    listk.pop()
print(sum(listk))

Submission status: Runtime Error

Solution code:
[H, N] = [int(x) for x in input().split()]
A = list(map(int, input().split()))
arr = sorted(A, reverse=True)
while N > 0:
    arr.pop(0)
    N -= 1
    if N == 0:
        break
print(sum(arr))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def win(n,k,h):
    m=sorted(h)
    s=n-k
    sum1=0
    for i in range(s):
        sum1+=h[i]
    return sum1

#Driver code
n=int(input("N"))
k=int(input("K"))
h=[]
for i in range(n):
    t=int(input("h"))
    h.append(t)
print(win(n,k,h))

Submission status: Runtime Error

Solution code:
import sys
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=0
c.sort()
e=-1
f=0
for i in range(a):
  d+=c[i]
  

for i in range(b):
  if b>=0:
    b-=1
    f+=1
      
    d-=c[e]
    e-=1
    if d<=0:
      print(f)
      sys.exit()

  
f+=c[e]
f+=c[e-1]

print(f-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def win(n,k,h):
    m=sorted(h)
    s=n-k
    sum1=0
    for i in range(s):
        sum1+=h[i]
    return sum1

#Driver code
n=int(input("N"))
k=int(input("K"))
h=[]
for i in range(n):
    t=int(input("h"))
    h.append(t)
print(win(n,k,h))

Submission status: Runtime Error

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

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

while(True):
    if(K > 0):
        HP_arr.pop(0)
        K -= 1
    else:
        break

print(sum(HP_arr))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;
using ll=long long;

#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cint int t;cin>>t;while(t--)
#define rep(i,n) for(ll i=0;i<n;i++)
#define pii pair<int,int>
typedef vector<int> vint;
#define fi first
#define se second

ll mod=1e9+7;

int main(){
    faster;

    int h,n;
    cin>>n>>h;

    int a[n];
    rep(i,n){
        int x;
        a[i]=x;
    }

    sort(a,a+n);
    reverse(a,a+n);
    ll sum=0;
    for(int i=h;i<n;i++){
        sum+=a[i];
    }
    cout<<sum<<endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
H,K=map(int,input().split())
 
ln=list(map(int,input().split()))
 
sum=0

if K!=0:
	ln.sort(reverse=True)
	for A in range(K):
		ln[A]=0
 
for A in ln:
  sum+=A
 
print(sum)

Submission status: Runtime Error

Solution code:
[H, N] = [int(x) for x in input().split()]
A = list(map(int, input().split()))
count = 0

arr = sorted(A, reverse=True)
while N > 0:
    arr.pop(0)
    N -= 1
    if N == 0:
        break
for x in arr:
    count += x

print(count)

Submission status: Runtime Error

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

ln=list(map(int,input().split()))
 
sum=0

ln.sort(reverse=True)
for A in range(K):
	ln[A]=0
 
for A in ln:
  sum+=A
 
print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

h.sort()
total=0

if k!=0:
	del h[-k]

if k<len(h):
	for i in h:
		total+=i

print(total)

Submission status: Runtime Error

Solution code:
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort(reverse=True)
#print(L)
for x in range(K-1):
    del L[0]
   # print(L)
print(sum(L))

Submission status: Runtime Error

Solution code:
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort(reverse=True)
#print(L)
for x in range(K-1):
    del L[0]
    print(L)
print(sum(L))

Submission status: Runtime Error

Solution code:
def testA():
    max_num = 0
    for i in range(10 ** 8):
        if max_num < i:
            max_num = i
    return max_num
monster, hisatu = map(int, input().split())
m_life = list(map(int, input().split()))
count = 0
if hisatu >= len(m_life):
    print(0)
else:
    while hisatu > 0:
        m_life.remove(testA(m_life))
        hisatu -= 1
    for i in m_life:
        count += i
    print(count)

Submission status: Runtime Error

Solution code:
[H, N] = [int(x) for x in input().split()]
A = list(map(int, input().split()))
count = 0

arr = sorted(A, reverse=True)
while N > 0:
    arr.pop(0)
    N -= 1
for x in arr:
    count += x

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(K):
  max_num = 0
  for i in range(len(H)):
    if max_num < H[i]:
      max_num = H[i]
  H.remove(max_num)

attack = 0

for i in range(len(H)):
  attack += H[i]
  
print(attack)

Submission status: Runtime Error

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

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:
N, K = map(int,input().split())
H = list(map(int, input().split()))

H_sorted = sorted(H, reverse=True)


for i in range(K):
	del H_sorted[0]

print(sum(H_sorted))

Submission status: Runtime Error

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

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

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    for i in range(0, K):
        H.pop(i)

    print(sum(H))

Submission status: Runtime Error

Solution code:
[n,k]=[int(x) for x in onput().split()]
h=[int(x) for x in lnput().split()]
if n<=k:
  print("0")
else:
  print(str(sum(h[k:])))

Submission status: Runtime Error

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

num = 0
if hi == []:
    print(0)
else:
    for i in hi:
        num += i
    print(num)

Submission status: Runtime Error

Solution code:
N, K = input().split()
N = int(N)
K = int(K)
H = input().split()
H = [int(h) for h in H]
H.sort(reverse = True)
# print(H)
for k in range(0, K):
    H[k] = 0
# print(H)
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_.pop()

s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[j+1] = s[j] + h_[j]

print(s[-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort()
#print(L)
for x in range(K):
    del L[-1]
print(sum(L))

Submission status: Runtime Error

Solution code:
n,k = map(int, input().split())
h = list(map(int, input().split()))
s_h = sorted(h)
if k != 0:
  for i in range(k):
    s_h.pop()
print(sum(s_h))

Submission status: Runtime Error

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

h.sort()
for j 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_ = sorted(h)

for i in range(k):
    h_.pop()

s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[i+1] = s[i] + h_[i]

print(s[-1])

Submission status: Runtime Error

Solution code:
import sys
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=0
c.sort()
e=-1
f=0
for i in range(a):
  d+=c[i]

for i in range(b):
   if b>0:
      b-=1
      f+=1
      
      d-=c[e]
      e-=1
    if d<0:
      print(f)
      sys.exit()
while 1:
  d-=c[e]
  f+=1
  if d<0:
    print(f)
  else:
    pass

Submission status: Runtime Error

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

N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    for i in range(0, K):
        H.pop(i)

    print(sum(H))

Submission status: Runtime Error

Solution code:
import math

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

H.sort(reverse=True)
if K >= N:
    print(0)
elif K >= 1:
    for i in range(K):
        H.pop(i)
    print(sum(H))
else:
    print(sum(H))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
monster, hisatu = map(int, input().split())
m_life = list(map(int, input().split()))
count = 0
if hisatu >= len(m_life):
    print(0)
else:
    for range(hisatu):
        m_life.remove(max(m_life))
    for i in m_life:
        count += i
    print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
if K >= N:
    print(0)
elif K == 0:
    answer = np.sum(H)
    print(answer)
else:
    ind = np.argpartition(H, -K)[-K:]
    print(ind)
    top_k = H[ind]
    answer = np.sum(H) - np.sum(top_k)
    print(answer)

Submission status: Runtime Error

Solution code:
def sort(A):
    if len(A) < 2:
        return A
    c = len(A)//2
    return merge(sort(A[:c]), sort(A[c:]))

def merge(X, Y):
    if len(X) < 1:
        return Y
    if len(Y) < 1:
        return X
    if (X[0] < Y[0]):
        return [Y[0]]+ merge(X, Y[1:])
    else:
        return [X[0]] + merge(X[1:], Y)

N, K = map(int, input().split())
enemyHP = list(map(int, input().split()))
enemyHP = sort(enemyHP)
if(len(enemyHP) <= K):
    print(0)
else:
    print(sum(enemyHP[K:]))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

for i in range(K):
  saidai = max(H)
  H.remove(saidai)

attack = 0

for i in range(len(H)):
  attack += H[i]
  
print(attack)

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-1-i] = 0

s = sum(h)

print(s)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

sum=0

for _ in range(K):
  ln[ln.index(max(ln))]=0

for A in range(ln):
  sum+=ln[A]

print(sum)

Submission status: Runtime Error

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: Runtime Error

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

if K >= N:
	print(0)
elif: K == 0:
    print(sum(H))
else:
	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)

for i in range(k):
  h_.pop()

print(sum(h_))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
monster, skill = map(int,input().split())

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

monster_hp.sort()

attack_count = 0

while(skill>0):
    skill -= 1
    if len(monster_hp) > 0:    
        monster_hp.pop(-1)
    print(monster_hp)

for hp in monster_hp:
    attack_count += hp

print(attack_count)

Submission status: Runtime Error

Solution code:
N,K=(int(x) for x in input().split())
H=list(map(int, input().split()))
A = sorted(H, reverse=True)
i=0

if K >= N:
    print('0')
else:
    
    for i in range(K):
        A.pop(i)
        i=i+1
    B=sum(A)
    print(B)

Submission status: Runtime Error

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

if K != 0:
  for i in range(K):
    H.pop(0)

Hsum = sum(H)

print (Hsum)

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(200000)

def dfs(i, special):
    if (i > N - 1):
        return 0
    if (special > 0):
        return dfs(i + 1, special - 1)
    if MONSTERS[i] <= 1:
        return 1 + dfs(i + 1, special)
    else:
        MONSTERS[i] -= 1
        return 1 + dfs(i, special)

N, K = map(int, input().split())
MONSTERS = map(int, input().split())
MONSTERS = list(reversed(sorted(MONSTERS)))
print(dfs(0, K))

Submission status: Runtime Error

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

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

input_hp.sort(reverse=True)

tec_count = input_line[1]

if input_line[0] <= input_line[1]:
    print('0')
else:
    for i in range(tec_count):
        input_hp.pop(i)
    result = sum(input_hp)
    print(result)

Submission status: Runtime Error

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

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

H_s = sorted(H, reverse=True)
H_s[:N] = 0

print(sum(H_s))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

i = 0
for i in range(N-1):
    H = H - h[i]

if H > 0:
    print(No)
else:
    print(Yes)

Submission status: Runtime Error

Solution code:
A = list(input().split(" "))
N = int(A[0])
K = int(A[1])
H = list(input().split(" "))
sum = 0
H.sort()
for i in range(K):
    H[N-1-i] = "0"
for i in range(N):
    sum += int(H[i])
print(sum)

Submission status: Runtime Error

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

i=0

if K >= N:
    print('0')
else:
    A = sorted(H, reverse=True)
    for i in range(K):
        A.pop(i)
        i=i+1
    B=sum(A)
    print(B)

Submission status: Runtime Error

Solution code:
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)
#print(damage)
if N>K:
  for i in range(K):
    del damage[i]

  A=sum(damage)
  print(A)

else:
  print(0)

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())
H = list(map(int, input().split()))

H.sort(reverse=True)

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

Submission status: Runtime Error

Solution code:
HK = list(map(int,input().split(" ")))
HP = list(map(int,input().split(" ")))
H = HK[0]
K = HK[1]
HP.sort(reverse=True)
sum_a = sum(HP[K:N])
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)

for i in range(K):
  H.pop(0)

Hsum = sum(H)

print (Hsum)

Submission status: Runtime Error

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

if K >= N:
    print(0)
else:
    H.sort(reverse=True)
    for i in range(0, K):
        H.pop(i)
    
    print(sum(H))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
HK = list(map(int,input().split(" ")))
HP = list(map(int,input().split(" ")))
H = HK[0]
K = HK[1]
HP.sort(reverse=Ture)
sum_a = sum(HP[K:N])
print(sum_a)

Submission status: Runtime Error

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

H = input().split()

H_s = sorted(H, reverse=True)
H_s[:N] = 0

print(sum(H_s))

Submission status: Runtime Error

Solution code:
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)
#print(damage)
if N>K:
  for i in range(K):
    del damage[i]

  for i in range(N-K):
    A+=damage[i]
  print(A)

else:
  print(0)

Submission status: Runtime Error

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

for i in range(len(h)):
    c+=h[i]
print(c)

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 = input().split(" ")
H = list(map(int, input().split()))
sorted_H = sort(H)
K = int(K)
print(sum(H[:-K]))

Submission status: Runtime Error

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

H.sort()

if K < N:
    for x in range(K):
        H.pop(-x-1)
    print(sum(H))

else:
    print('0')

Submission status: Runtime Error

Solution code:
h,n = input().split()
w = input().split()

for i in range(0,int(n)):
    h = int(h) - int(w[i])

if(h<=0):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
A = list(input().split(" "))
N = int(A[0])
K = int(A[1])
H = list(input().split(" "))
sum = 0
H.sort()
for i in range(K):
    H[N-1-i] = 0
for i in range(N):
    sum += int(H[i])
print(sum)

Submission status: Runtime Error

Solution code:
HK = list(map(int,input().split(" ")))
HP = list(map(int,input().split(" ")))
H = HK[0]
K = HK[1]
HP.reverse()
sum_a = sum(HP[K:N])
print(sum_a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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=1
# H=[4,1,5]

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

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
a=list(int(x) for x in input().split())
s=0
if k <= n:
	print(s)
else:
	i for i in range(n-k):
		s += i
		print(s)

Submission status: Runtime Error

Solution code:
def main():
  N, K = map(int, input().split())
  
  H = sorted(list(map(int, input().split())), reverse=True)
 
  n =  sum(H)
  
  if K == 0:
    print(n)
  else:
    for i in range(K):
      n -= H[i]
    print(n)
    
  return 0

if __name__ == "__main__":
  main()

Submission status: Runtime Error

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

desc_h = sorted(h, reverse=True)
for i in range(k):
  desc_h.pop(0)

print(sum(desc_h))

Submission status: Runtime Error

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

if N<=K:
  print(0)
elif K==0:
  print(sum(H))
else:
  for i in range(K):
    maxh=max(H)
    H=H.remove(maxh)
  print(sum(H))

Submission status: Runtime Error

Solution code:
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

damage.sort(reverse=True)
#print(damage)
for i in range(attack[1]):
  del damage[i]

for i in range(attack[0]-attack[1]):
  A+=damage[i]

print(A)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if N<=K:
  print(0)
else:
  for i in range(K):
    maxh=max(H)
    H=H.remove(maxh)
  print(sum(H))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
h=list(map(int,input().split()))
ha=sorted(h,reverse=True)
for i in range(b):
  ha[i]=0
j=0
for t in ha:
  j+=t
print(j)

Submission status: Runtime Error

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