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:
#!/user/bin/env python
#pythonプログラムであることを示している

# -*- coding: utf-8 -*-
"""
このプログラムはPythonを書く際のテンプレとなっています。これをコピペしてコーディングを行なってください。
なお字下げしないこと！！
"""

__author_ = 'Maruta Yuzuha'
__version_ = '1.0.0'
__date__ = '2019/12/25'

def main():
    """
    ここでプログラムの解説を行う
     >>main()
    Hello world.
    0
    """
    s = list(map(int, input().split()))
    t = list(map(int, input().split()))

    a = 0  #勝つまでの回数
    b = s[0]#何匹か
    d = s[1]#必殺技の回数
    f = 0# Maxのいち
    for j in range(d):  #必殺技の回数
        c = sum(t)
        if c != 0:
            g = max(t)
            for i in range(b):
                if g == t[i]:
                    t[i] = 0
            t[f] = 0
            f = 0
        else:
            break
    a += sum(t)
    print(a)
    return 0

if __name__ == '__main__':
    #上記のifの記述によってこのスクリプトファイルが起動された時だけ実行する部分になる。
    #ちなみにスクリプトが "モジュールとして"インポートされた時には実行されない、

    #単体テスト:モジュールのdocstring(ドキュメンテーション文字列)に記載された全ての対話実行例が書かれている通りに動作するかを確認
    #python ファイル名 -v
    import doctest
    doctest.testmod()

    #実際にmain()を呼び出して、結果を得て、その結果でPythonシステムを終える
    import sys
    sys.exit(main())

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k,*h=map(int,open(0).read().split())
print(sum(sorted(h)[:min(n,n-k)]))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
bodies_count = list(map(int,input().split()))
enemy_life = list(map(int,input().split()))

if bodies_count[1] == 0:
    print(sum(enemy_life))
else:
    enemy_life.sort(reverse=True)
    if bodies_count[1] == 1:
        del enemy_life[0] 
    else:
        a = bodies_count[1]-1
        del enemy_life[0:a]

    if enemy_life != []:
        print(sum(enemy_life))
    else:
        print(0)
    # for i in range(bodies_count[1]):
    #     if enemy_life == []:
    #         print(count)
    #         break
    #     else:
    #         enemy_life.sort()
    #         print(enemy_life)
    #         enemy_life.pop(enemy_life.index(max(enemy_life)))

Submission status: Wrong Answer

Solution code:
n,k,*h=map(int,open(0).read().split())
print(sum(sorted(h)[:n-k]))

Submission status: Wrong Answer

Solution code:
import heapq

N,K = (int(x) for x in input().split())
H = list((-1)*(int(x)) for x in input().split())
heapq.heapify(H)

for _ in range(K):
    if len(H) == 1:
        print(0)
        break

    heapq.heappop(H)

if len(H) != 1:
    sum = 0
    for _ in range(len(H)):
        sum -= heapq.heappop(H)

    print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

H.sort()
N = int(N)
K = int(K)
sum = 0
if(N - K <= 0):
  	sum = 0
else:
	for i in range(N):
	  if(i < N - K):
	    	sum += int(H[i])

print(sum)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
bodies_count = list(map(int,input().split()))
enemy_life = list(map(int,input().split()))
count = 0

if bodies_count[1] == 0:
    print(sum(enemy_life))
else:
    enemy_life.sort(reverse=True)
    if bodies_count[1] == 1:
        del enemy_life[0]
    else:
        a = bodies_count[1]-1
        del enemy_life[0:a]
        print(sum(enemy_life))

    if enemy_life != []:
        print(sum(enemy_life))
    # for i in range(bodies_count[1]):
    #     if enemy_life == []:
    #         print(count)
    #         break
    #     else:
    #         enemy_life.sort()
    #         print(enemy_life)
    #         enemy_life.pop(enemy_life.index(max(enemy_life)))

Submission status: Wrong Answer

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

if K >= N:
    print(0)
elif N > K:
    if K == 0:
        print(sum(int(i) for i in H))
    else:
        H.remove(max(H))
        print(sum(int(i) for i in H))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
H = list(map(int,input().split()))
for i in range(K):
  maxH = max(H) - K
  if maxH<0:
    maxH =0
  H[H.index(max(H))] = maxH
sumh = sum(H)
print(sumh)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
bodies_count = list(map(int,input().split()))
enemy_life = list(map(int,input().split()))
count = 0

if bodies_count[1] == 0:
    print(sum(enemy_life))
else:
    enemy_life.sort(reverse=True)
    if bodies_count[1] == 1:
        del enemy_life[0]
    else:
        a = bodies_count[1]-1
        del enemy_life[0:a]

    if enemy_life != []:
        print(sum(enemy_life))
    # for i in range(bodies_count[1]):
    #     if enemy_life == []:
    #         print(count)
    #         break
    #     else:
    #         enemy_life.sort()
    #         print(enemy_life)
    #         enemy_life.pop(enemy_life.index(max(enemy_life)))

Submission status: Wrong Answer

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

Solution code:
# coding: utf-8
bodies_count = list(map(int,input().split()))
enemy_life = list(map(int,input().split()))
count = 0

if bodies_count[1] == 0:
    print(sum(enemy_life))
else:
    enemy_life.sort(reverse=True)
    a = bodies_count[1]-1
    del enemy_life[0:a]

    if enemy_life != []:
        print(sum(enemy_life))
    # for i in range(bodies_count[1]):
    #     if enemy_life == []:
    #         print(count)
    #         break
    #     else:
    #         enemy_life.sort()
    #         print(enemy_life)
    #         enemy_life.pop(enemy_life.index(max(enemy_life)))

Submission status: Wrong Answer

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


if N <= K:
    print(0)

elif K == 0:
    print('aaa')

else:
    H.reverse()
    print(sum(H[K:N+1]))

Submission status: Wrong Answer

Solution code:
a = []
a = input().split()
N = int(a[0])
K = int(a[1])
H = input().split()
H = [int(i) for i in H]
#print('N=', N, 'K=', K)
#print('H=', H)

H = sorted(H, reverse = True)
#print('sort H=', H)

if K == 0:
  H = H
if K == 1:
  del H[0]
if K > 1:
  del H[0 : K - 1]
#print('del H=', H)

T = sum(H)
print(T)

Submission status: Wrong Answer

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


if N <= K:
    print(0)

elif K == 0:
        print(int(sum(H)))

else:
    H.reverse()
    print(int(sum(H[K:N])))

Submission status: Wrong Answer

Solution code:
import math

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

enemys.sort(reverse=True)
count = 0
for e in enemys:
  if(k > 0):
    count += 1
    k -= 1
  else:
    count += e

print(count)

Submission status: Wrong Answer

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

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

A = sorted(input_hp,reverse=True)
try:
    [A.pop(_) for _ in range(input_line[1])]
    print(sum(A))
except IndexError:
    print('0')

Submission status: Wrong Answer

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

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

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

s_n = sorted(h_n)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if n < k:
    print("0")

s_n = sorted(h_n)

print(sum(s_n[:n - 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(n - k):
    ans += int(h[i])
print(ans)

Submission status: Wrong Answer

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

h.sort(reverse=True)
count = 0

for hp in h:
    if k >= 1:
        k -= 1
        h.pop(0)
    else:
        count += hp

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

use_clipboard=True
bbn=1000000007
	
#+++++

		
def main():
	n,k = map(int, input().split())
	hl=list(map(int, input().split()))
	if k > 0:
		ret = sum(hl[:-k])
	else:
		ret=sum(hl)
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
class input_clipboard:
	def __init__(self,s):
		self.input_l=s.splitlines()
		self.ii=0
		
	def input(self):
		ret = self.input_l[self.ii]
		self.ii+=1
		return ret

if __name__ == "__main__":
	if sys.platform =='ios':
		if use_clipboard:
			import clipboard
			input_text=clipboard.get()
			ic=input_clipboard(input_text)
			input = lambda : ic.input()
		else:
			sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Wrong Answer

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


if N <= K:
    print(0)

elif K == 0:
        print(sum(H))
else:
    H.reverse()
    print(sum(H[K:N]))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = list(map(int,input().split()))
if k == 0:
    print(sum(h))
elif (n-k) > 0:
    m = max(h)
    h.remove(m)
    print(sum(h))
else:
    print("0")

Submission status: Wrong Answer

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

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

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()
        del H[0:K]
        print(sum(H))

Submission status: Wrong Answer

Solution code:
import os
import sys
import heapq

def main():
    H , K = map(int , input().split())
    n_list = [s for s in input().split()]
    n_list = list(map(int,n_list))
    #print (n_list)
    #c = sum(int(i) for i in list)
    list_small = []
    new_list = []
    if K >= len(n_list) :
        print (str(0))
    elif K == 0 :
        c = sum(int(i) for i in n_list)
        print (str(c))
    else :
        list_small = heapq.nlargest(K,n_list)
        list_small = list(map(int,list_small))
        #print (list_small)
        new_list = list(set(n_list)-set(list_small))
        #print (list_small)
        #print (new_list)
        c = sum(int(i) for i in new_list)
        print (str(c))
    #print (str(X))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
if K == 0:
    pass
elif K <= N:
    H = H[(K+1):]
elif K > N:
    H.clear()
print(sum(H))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000000)
n, k = map(int , input().split())
h = list(map(int, input().split()))
count = 0
MOD = 1000000007
h.sort()
try:
    if(k != 0) : del h[-k]
    for i in h:
        count += i % MOD
    print(count)
except IndexError:
    count = 0
    print(count)

Submission status: Wrong Answer

Solution code:
import math
import sys

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

if (n-k) <= 0:
  print(0)
  sys.exit()
sum = 0
for i in range(n):
  if i > k-1:
    sum = sum + int(hlist[i])
print(sum)

Submission status: Wrong Answer

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

if K >= N:
  print(0)
 
elif K == 0:
  print(sum(H))

else:
  H.sort
  print(sum(H[K+1:]))

Submission status: Wrong Answer

Solution code:
from itertools import permutations, combinations

nums = input().split()
As = input().split()
H = nums[0]
N = nums[1]
A = []


N =int(N)

As = list(map(int, As))
As = sorted(As , reverse=True)
N-=1
if N != -1:
    if N == 0:
        N = 1
    del As[:N]

print(sum(As))

Submission status: Wrong Answer

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

# Input
s = [input() for i in range(2)]
NK = list(s[0].split())
HI = sorted(list(s[1].split()))

# Proccess
nk = int(NK[0])-int(NK[1])
del HI[nk:]

sum_h = 0
for i in range(nk):
  sum_h = sum_h +int(HI[i])

# Output							
print(sum_h)

Submission status: Wrong Answer

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

p = (N - K) - 1 

if N <= K:
    print(0)

elif K == 0:
        print(sum(H))
else:
    H.reverse()
    print(sum(H[p:N]))

Submission status: Wrong Answer

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

if K >= N:
  print(0)
 
elif K == 0:
  print(sum(H))

else:
  H.sort
  print(sum(H[K-1:]))

Submission status: Wrong Answer

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

if K >= N:
  print(0)
 
elif K == 0:
  print(sum(H))

else:
  H.sort
  print(sum(H[K+1:N-1]))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = list(map(int,input().split()))
if (n-k) > 0:
    m = max(h)
    h.remove(m)
    print(sum(h))
else:
    print("0")

Submission status: Wrong Answer

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

if(int(n)<=int(k)):
    print(0)
elif(int(k)==0):
    print(sum(mon))
else:
    
    def qs(seq):
        if len(seq) < 1:
            return seq
        pivot = seq[0]
        left = []
        right = []
    
        for i in range(1,len(seq)):
            if seq[i] >= pivot:
                left.append(seq[i])
            else:
                right.append(seq[i])
        left = qs(left)
        right = qs(right)
        foo = [pivot]
        return left + foo + right

    mon = qs(mon)

    for i in range(0,int(k)):
        mon[i] = 0
        at = at + 1
    
    h = sum(mon)

    while True:
        h = h - 1
    
        if(h == 0):
            break
        else:
            at = at + 1
        
    print(at)

Submission status: Wrong Answer

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

if K >= N:
  print(0)
 
elif K == 0:
  print(sum(H))

else:
  H.sort
  print(sum(H[K-1:N-1]))

Submission status: Wrong Answer

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=0
  for i in range(k):
    hps.pop()
  ans+=sum(hps)
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

Submission status: Wrong Answer

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=3
k=1
h=[4,1,5]
print(win(n,k,h))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
a=list(map(int,input().split()))
if K>=N:
	print(0)
b=sorted(a)
c=0
for i in range(N-K):
	c+=b[i]
print(c)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = list(map(int,input().split()))
if k > 0:
    m = max(h)
    h.remove(m)
    print(sum(h))
else:
    print(sum(h))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split(' '))
x = 0
h = input().split(' ')
H = sorted(h,reverse=True)
for i in range(K):
    if len(H) == 0:
        break
    else:
        H.pop(0)
for i in range(len(H)):
    x = x + int(H[i])
print(x)

Submission status: Wrong Answer

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

enemies = list(map(int, input().split()))[::-1]
enemies = enemies[K:]

if K >= N:
    print(0)
else:
    print(sum(enemies))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
Hlist = list(map(int, input().split()))
Hlist.sort(reverse=True)
if K == 0:
  print(sum(Hlist))
elif K == 1:
  del Hlist[0]
  print(sum(Hlist))
elif K == 2:
  del Hlist[0]
  del Hlist[0]
  print(sum(Hlist))
else:
  del Hlist[0:K-1]
  print(sum(Hlist))

Submission status: Wrong Answer

Solution code:
#体力と必殺技
prm = input().split()
nummons = int(prm[0])
ult = int(prm[1])

#各モンスターのhp
hp = input().split()
hp.sort(reverse=True)
allhp = 0

if nummons <= ult:
    print(0)
else:
    for i in range(ult):
        hp[i] = 0

    for chp in hp:
        allhp += int(chp)
    print(allhp)

Submission status: Wrong Answer

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)
"""
n=3
k=1
h=[4,1,5]
print(win(n,k,h))

Submission status: Wrong Answer

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

input_hp = input().split()

list_monster = []
for i in range(n):
  list_monster.append(int(input_hp[i]))
  
list_monster.sort() 
list_monster.reverse() #降順にソート

#使用できる必殺技の残りカウント
count = k 
  
if n <= k:
  print(0)
else:
  for i in range(k): #最初に持っていた必殺技の数だけ繰り返す
    count -= 1 #使用ごとに必殺技の残りカウントを減らす
    
    list_monster.pop(0)
    
number = 0

for i in range(len(list_monster)):
  number += list_monster[i]

print(number)

Submission status: Wrong Answer

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[K-1:N-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:
    if K==0:
        print(sum(H))
    elif K==1:
        H.reverse()
        del H[0]
        print(sum(H))
    else:
        H.reverse()
        del H[0:K-1]
        print(sum(H))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
Hlist = list(map(int, input().split()))
Hlist.sort(reverse=True)
if K == 0:
  print(sum(Hlist))
elif K == 1:
  del Hlist[0]
  print(sum(Hlist))
else:
  del Hlist[0:K-1]
  print(sum(Hlist))

Submission status: Wrong Answer

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

enemies = list(map(int, raw_input().split()))[::-1]
enemies = enemies[K:]

print(sum(enemies))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=input().split()
H=input()
H=H.split()
SUM=sum(int(i) for i in H)
A=(sorted(H, reverse=True)[:int(K)])
ASUM=sum(int(i) for i in A)
LO=int(SUM)-int(ASUM)
if(int(LO)<0):
  print(0)
elif(int(K)>=int(N)):
  print(0)
else:
  print(LO)

Submission status: Wrong Answer

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

r = 0 #全足し
e = 0 #ソート足し

if N <= K:
    print(0)

elif K == 0:
        print(sum(H))
else:
    H.reverse()
    for i in range(K):
        H.pop(0)
    else:
        print(sum(H))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
Hlist = list(map(int, input().split()))
Hlist.sort(reverse=True)
'''
print(Hlist)
'''
if K == 0:
  print(sum(Hlist))
elif K == 1:
  del Hlist[0]
  print(Hlist)
  print(sum(Hlist))
else:
  del Hlist[0:K-1]
  print(Hlist)
  print(sum(Hlist))

Submission status: Wrong Answer

Solution code:
import math
import sys

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


if (n-k) <= 0:
  print(0)
  sys.exit()
sum = 0
for i in range(n):
  if i > k-1:
    sum = sum + int(hlist[i])
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K != 0):
    rm = max(arr)
    arr.remove(rm)
  print(sum(arr))

Submission status: Wrong Answer

Solution code:
N, K = input().split()
N = int(N)
K = int(K)
H = input()
H = [int(i) for i in H.split()]
H.sort()
while (K > 0 and len(H) == 0):
  del H[-1]
  K -=1
print(sum(H))

Submission status: Wrong Answer

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

enemies = list(map(int, input().split()))[::-1]
enemies = enemies[K:]

print(sum(enemies))

Submission status: Wrong Answer

Solution code:
#体力と必殺技
prm = input().split()
nummons = int(prm[0])
ult = int(prm[1])

#各モンスターのhp
hp = input().split()
hp.sort(reverse=True)
allhp = 0
count = 0

if nummons <= ult:
    print(0)
else:
    for i in range(ult):
        hp[i] = 0
        count += 1

    for chp in hp:
        allhp += int(chp)
    print(allhp)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

r = 0 #全足し
e = 0 #ソート足し

if N <= K:
    print(0)

elif K == 0:
        for u in H:
            r += u
        else:
            print(r)
else:
    H.reverse()
    for i in range(K):
        H.pop(0)
    else:
        for i in H:
            e += i
        else:
            print(e)

Submission status: Wrong Answer

Solution code:
import numpy as np
import numpy

N,K =(float(x) for x in input().split())
list1 = np.array([float(s) for s in input().split()])


list2=np.sort(list1)
i=0
sum=0
while i<N-K:
  sum=sum+list2[i]
  i=i+1

print(sum)

Submission status: Wrong Answer

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

for i in range(k):
    h.pop()
    if len(h) == 0:
        break
print(0 if len(h) == 0 else sum(h))

Submission status: Wrong Answer

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:
	k=min(k,len(h))
	del h[-k]

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

print(total)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
N = list(map(int,input().split()))
N.sort()
print(sum(N))

Submission status: Wrong Answer

Solution code:
import math
import sys

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

sum = 0
if (n-k) <= 0:
  print(0)
  sys.exit()
for i in range(n-k):
  sum = sum + int(hlist[i])
print(sum)

Submission status: Wrong Answer

Solution code:


def main():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    H = sorted(H, reverse=True)
    count = 0
    if K >= N:
        print(0)
    elif K == 0:
        print(sum(H))
    else:
        for i in range(K):
            H[i] = 0
            print(sum(H))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
import numpy

N,K =(float(x) for x in input().split())
list1 = np.array([float(s) for s in input().split()])
print(list1)

list2=np.sort(list1)

i=0
sum=0
while i<N-K:
  sum=sum+list2[i]
  i=i+1

print(sum)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
l = [int(i) for i in input().split()]
ls = sorted(l)
if k == 0:
  print(sum(l))
else:
  print(sum(l[:-k]))

Submission status: Wrong Answer

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

INF = 1000000007
ans = 0

h.reverse()

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

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = sorted(list(map(int, input().split())))
if len(H) <= K:
    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().lower().split())
H = []
total = 0
input_string = input()
H = input_string.split()
H = list(map(int, H))

H.reverse()
del H[0:K]
print(sum(H))

Submission status: Wrong Answer

Solution code:
N,K=input().split()
H=input()
H=H.split()
SUM=sum(int(i) for i in H)
if(int(K)>int(N)):
  K=int(N)
A=(sorted(H, reverse=True)[:int(K)])
ASUM=sum(int(i) for i in A)
LO=int(SUM)-int(ASUM)
if(int(LO)<0):
  print(0)
else:
  print(LO)

Submission status: Wrong Answer

Solution code:
a, b=map(int,input().split())
l=list(map(int,input().split()))
if a<b:
  print(0)
elif a>b:
  l.sort(reverse=True)
  n=l[b:]
  s=sum(n)
  print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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<len(h):
	if k!=0:
	    del h[-k]
	for i in h:
		total+=i

print(total)

Submission status: Wrong Answer

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

if n < k:
    print('0')

h.sort()
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().split()))

cnt = 0
if K >= N:
    cnt = 0
elif 1 <= K < N:
    H.remove(max(H))
    cnt = sum(H)
elif K == 0:
    cnt = sum(H)

print(cnt)

Submission status: Wrong Answer

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

A_list = list(A)
counter = 0
A_list.sort()
A_list.reverse()

if K >= N:
    print(N)
else:
    for val in range(N - K):
        counter += int(A_list[val+K])
    print(counter)

Submission status: Wrong Answer

Solution code:
a, b=map(int,input().split())
l=list(map(int,input().split()))
if a<b:
  print(0)
elif a>b:
  l.sort()
  n=l[b:]
  s=sum(n)
  print(s)

Submission status: Wrong Answer

Solution code:
H,K=input().split()
H=input()
H=H.split()
SUM=sum(int(i) for i in H)
A=(sorted(H, reverse=True)[:int(K)])
ASUM=sum(int(i) for i in A)
LO=int(SUM)-int(ASUM)
if(int(LO)<0):
  print(0)
else:
  print(LO)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if k >= len(h):
    H = []
else:
    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:
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:
from sys import stdin


def main(inp1, inp2):
    n, k = [int(i) for i in inp1.split(sep=' ')]
    h_list = sorted([int(i) for i in inp2.split(sep=' ')])

    print(h_list)
    num_enemy = n
    enable_special = k

    if enable_special >= num_enemy:
        return 0
    elif enable_special == 0:
        return sum(h_list)
    else:
        return sum(h_list[:-enable_special])


if __name__ == '__main__':
    input1 = stdin.readline().rstrip()
    input2 = stdin.readline().rstrip()
    ret = main(input1, input2)
    print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Solution code:
import math
import sys

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

sum = 0
if (n-k) <= 0:
  print(0)
  sys.exit()
for i in range(n-k):
  sum = sum + int(hlist[i])
print(sum)

Submission status: Wrong Answer

Solution code:
H,K=input().split()
H=input()
H=H.split()
SUM=sum(int(i) for i in H)
A=(sorted(H, reverse=True)[:int(K)])
ASUM=sum(int(i) for i in A)
LO=int(SUM)-int(ASUM)
print(LO)

Submission status: Wrong Answer

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

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

print(sum(l))

Submission status: Wrong Answer

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