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:
n,k=map(int,input().split())
h=[int(i) for i in input().split()]
h.sort
a=0
if n>k:
  for j in range(n-k):
    a+=h[j]
  print(a)
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

A.sort
if N > K:
  for i in range(K):
    A.pop()
  print(sum(A))
else:
  print("0")

Submission status: Wrong Answer

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

A.sort
if N > K:
  for i in range(K):
    A.pop()
  print(A)
else:
  print("0")

Submission status: Wrong Answer

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

A.sort
if N >= K:
  for i in range(K):
    A.pop()
  print(A)
else:
  print("0")

Submission status: Wrong Answer

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

cnt = sum(HL) - max(HL)
print(cnt)

Submission status: Wrong Answer

Solution code:
n,k,*a=map(int,open(0).read().split())
a.sort()
a+=[0]
print(sum(a[:~k])+k)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

for i in range(int(K)):
    if i+1 == int(K):
        break
    hp.remove(max(hp))
    
print(sum(hp))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
if k >= n:
    print(0)

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
if k >= n:
    print(0)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def get_input_line():
    return list(map(int, input().split()))
n, k = get_input_line()
h_list = get_input_line()

print(sum(h_list[k:]))

Submission status: Wrong Answer

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

Nlife = sorted(life, reverse=True)


if K >= 1:
  del Nlife[:K-1]
  

answer = sum(Nlife)

print(answer)

Submission status: Wrong Answer

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

Nlife = sorted(life)


if K >= 1:
  del Nlife[:K-1]
  

answer = sum(Nlife)

print(answer)

Submission status: Wrong Answer

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

Nlife = sorted(life)


if K >= 1:
  del Nlife[:K+1]
  

answer = sum(Nlife)

print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = (int(z) for z in input().split())
a = [int(z) for z in input().split()]
a.sort()
sm = 0
for i in range(k,n):
  sm += a[i]
print(sm)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

fennec = input().split(" ")
N = int(fennec[0])
K = int(fennec[1])
enemys = input().split(" ")
enemys.sort()
ans = 0
if K < N:
    if K == 0:
        for i in enemys:
            ans += int(i)
        print(ans)
    else:
        del enemys[-K:]
        for i in enemys:
            ans += int(i)
        print(ans)
else:
	print("0")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
  x = [int(i) for i in input().split()]
  y = [int(i) for i in input().split()]
  y.sort()
  z = y[:-x[1]]
  print(sum(z))
if __name__== "__main__":
  main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(int(1e6))

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

H.sort()
n = len(H) - K
ans = sum(H[:n])
print(ans)

Submission status: Wrong Answer

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

    H.sort()
    if K != 0 :
        h = H[K - 1:N - 1]
        print(sum(h))
    else:
        print(sum(H))
resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ListH.sort()
sum=0

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

print(sum)

Submission status: Wrong Answer

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

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

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

print(sum)

Submission status: Wrong Answer

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

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

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

print(sum)

Submission status: Wrong Answer

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

if K < N and  K != 0:
    print(sum(H[: -K]))
elif K > N:
    print(0)
else:
    print(sum(H))

Submission status: Wrong Answer

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

if K < N and  K != 0:
    print(sum(H[: -K]))
elif K > N:
    print(N)
else:
    print(sum(H))

Submission status: Wrong Answer

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

if K < N and  K != 0:
    print(sum(H[: -K]))
else:
    print(sum(H))

Submission status: Wrong Answer

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

list_H.sort()

list_H_left = list_H[:(-1)*K]

sum = 0
while list_H_left :
    sum += list_H_left[0]
    list_H_left.pop(0)

print(sum)

Submission status: Wrong Answer

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

h = sorted(h)
del h[n-k:n]

print(sum(h))

Submission status: Wrong Answer

Solution code:
NK = input().split()
N = int(NK[0])
K = int(NK[1])
Hs = input().split()
Hs = [int(h) for h in Hs]

import numpy as np
Hs = np.array(Hs)
Hs = np.sort(Hs, kind="quick_sort")
s = np.sum(Hs[0:-K]) if K < N else 0
print(s)

Submission status: Wrong Answer

Solution code:
NK = input().split()
N = int(NK[0])
K = int(NK[1])
Hs = input().split()
Hs = [int(h) for h in Hs]

import numpy as np
Hs = np.array(Hs)
Hs = np.sort(Hs, kind="quick_sort")
s = np.sum(Hs[0:-K])
print(s)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def merge_sort(arr):
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    # ここで分割を行う
    left = arr[:mid]
    right = arr[mid:]

    # 再帰的に分割を行う
    left = merge_sort(left)
    right = merge_sort(right)

    # returnが返ってきたら、結合を行い、結合したものを次に渡す
    return merge(left, right)


def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged

ll = merge_sort(ls)
print(sum(ll[:n-k-1]))

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, k = map(int, input().split())
if n <= k:
  print(0)
elif k == 0:
  print(list(map(int, input().split())))
else:
  h = sorted(list(map(int, input().split())))
  print(sum(h[:n-k]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

else:
	h.sort(reverse = True)

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

	print(k)

Submission status: Wrong Answer

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

if len(h) <= k:
	print(len(h))

else:
	h.sort(reverse = True)

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

	print(sum(h) + k)

Submission status: Wrong Answer

Solution code:
from sys import stdin

N,K=map(int,stdin.readline().rstrip().split())
H=sorted(list(map(int,stdin.readline().rstrip().split())))

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

Submission status: Wrong Answer

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

H.sort()

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

Submission status: Wrong Answer

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

healths = input().split()
res = 0

healths.sort()
for i in range(n-k):
    res = res + int(healths[i])

print(res)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python
# -*- coding: UTF-8 -*-
n,k = input().split()
k = int(k)
n =int(n)

healths = input().split()
res = 0

healths.sort()
for i in range(n):
    if i >= n-k:
        break
    res = res + int(healths[i])

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

H.sort()

H = H[0 : N - K]

for val in H:
  sum = sum + val
  
print(sum)

Submission status: Wrong Answer

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

ans = sum(h[:-k])
print(ans)

Submission status: Wrong Answer

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

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

H = [int(x) for x in input().split()]

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

Submission status: Wrong Answer

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

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

H = [int(x) for x in input().split()]
if K != 0:
    remaining = H[0:-K]
else:
    remaining = H[:]

print(sum(remaining))

Submission status: Wrong Answer

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

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

H = [int(x) for x in input().split()]
if K != 0:
    remaining = H[0:-K]
else:
    remaining = H

print(sum(remaining))

Submission status: Wrong Answer

Solution code:
l, k = map(int, input().split(" "))
if k >= l:
  print(0)
else:
  print(sorted(map(int, input().split(" ")))[:l-k])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

sum_hp = 0

print(hp)
hp.sort()
print(hp)

for i in range(k):
    if(len(hp)> 0):
        hp.pop()

print(hp)

for j in hp:
    sum_hp = sum_hp + int(j)

print(str(sum_hp))

Submission status: Wrong Answer

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

sum_hp = 0

hp.sort()

for i in range(k):
    if(len(hp)> 0):
        hp.pop()


for j in hp:
    sum_hp = sum_hp + int(j)

print(str(sum_hp))

Submission status: Wrong Answer

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

sum_hp = 0

hp.sort()

for i in range(k):
    if(len(hp)> 0):
        hp.pop()


for j in hp:
    sum_hp = sum_hp + int(j)

print(sum_hp)

Submission status: Wrong Answer

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

H = H[:K-1]

print(sum(H))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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)-sum([i for i in range(K)]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
#入力
N, K = map(int, input().split())
li = list(map(int,input().split()))
list.sort(li, reverse = True)

#出力
a = list(np.zeros(K))
if N - K>=0:
    b = list(np.ones(N-K))
    a.extend(b)
else:
    a = list(np.zeros(N))

print(np.dot(a, li))

Submission status: Wrong Answer

Solution code:
import numpy as np
#入力
N, K = map(int, input().split())
li = list(map(int,input().split()))
list.sort(li, reverse = True)

#出力
a = list(np.zeros(K))
if N - K>0:
    b = list(np.ones(N-K))
    a.extend(b)
else:
    a = list(np.zeros(N))

print(np.dot(a, li))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
count = 0
 
while len(h) > 0:
  if k > 0:
    k -= 1
    h.remove(max(h))
    break

for i in h:
  count += i
      
print(count)

Submission status: Wrong Answer

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


remain_monster = N - K
new_list = sorted(List, reverse=True)

monsterHP = sum(new_list[remain_monster:])

print(monsterHP)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000) 

N, K = map(int, input().split())
List = list(map(int, input().split()))
A = 0

remain_monster = N - K
new_list = sorted(List, reverse=True)

monsterHP = sum(new_list[remain_monster:])

print(monsterHP)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

intEnemyHp = [int(i) for i in enemyHp]
enemyHp.sort()

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0

if killerTimeK >= enemmyCountN:
    print(0)

else:
    for i in range(resultEnemyCount):
        countNormal += intEnemyHp[i]
    print(countNormal)

Submission status: Wrong Answer

Solution code:
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

enemyHp.sort()

intEnemyHp = [int(i) for i in enemyHp]

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0

if killerTimeK >= enemmyCountN:
    print(0)

else:
    for i in range(resultEnemyCount):
        countNormal += intEnemyHp[i]
    print(countNormal)

Submission status: Wrong Answer

Solution code:
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

enemyHp.sort()

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0

if killerTimeK >= enemmyCountN:
    print(0)

else:
    for i in range(resultEnemyCount):
        countNormal += int(enemyHp[i])
    print(countNormal)

Submission status: Wrong Answer

Solution code:
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

enemyHp.sort()

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0

if killerTimeK >= enemmyCountN:
    print('0')

else:
    for i in range(resultEnemyCount):
        countNormal += int(enemyHp[i])
    print(countNormal)

Submission status: Wrong Answer

Solution code:
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

enemyHp.sort()

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0


for i in range(resultEnemyCount):
    countNormal += int(enemyHp[i])

print(countNormal)

Submission status: Wrong Answer

Solution code:
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

enemyHp.sort()
print(enemyHp)
resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0


for i in range(resultEnemyCount):
    countNormal += int(enemyHp[i])

print(countNormal)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

sum = 0

H = sorted(H)

answer = 0

for i in H[:N-K]:
    answer += i

print(answer)

Submission status: Wrong Answer

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

n = len(A)
A.sort()
print(sum(A[:n-k]))

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()

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

Submission status: Wrong Answer

Solution code:
N, K = [int(i) for i in input().split(' ')]
H = list(reversed([int(i) for i in input().split(' ')]))
print(sum(H[K:]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

h = sorted(h,reverse=True)

attack_n = 0

if k >= n:
    attack_n = 0

else:
    for i in h[n-k-1:]:
        attack_n += i

print(attack_n)

Submission status: Wrong Answer

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

h = sorted(h,reverse=True)

attack_n = 0

if k >= n:
    pass

else:
    for i in h[n-k-1:]:
        attack_n += i

print(attack_n)

Submission status: Wrong Answer

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

sorted(h)

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

Submission status: Wrong Answer

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

sorted(h)

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

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
arr = [int(x) for x in input().split()]
k = min(n,k)
arr.sort()
arr = arr[:-k]
print(sum(arr))

Submission status: Wrong Answer

Solution code:
n,k = (int(x) for x in input().split())
h_lst = [int(x) for x in input().split()]
h_lst.sort()
del h_lst[(-1)*k:]
print(sum(h_lst))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
print(N,K)
H = list(map(int, input().split()))
#H = input().split()
#print(H)
if N<=K:
  print(0)
else:
  # Hの中身を入れ替えて大きいものから順に必殺技で倒す
  # つまり、配列をカットする
  # 配列の残りの和が倒すのに必要な数
  H.sort(reverse=True)
  newH = H[K:]
  sumH = sum(newH)
  print(sumH)

Submission status: Wrong Answer

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

hissatsu = n-k

if hissatsu <= 0:
  print(0)
else:
  print(sum(monsters[-hissatsu:]))

Submission status: Wrong Answer

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

if N < K:
    times = N
else:
    times = K

H_i = [int(i) for i in H]
H_sum = sum(H_i)

for i in range(times):
    H_sum -= max(H_i)

print(H_sum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

max = max(data)
sum = sum(data)

print(sum - max)

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,m = LI()
    a = sorted(LI())
    if n <= m:
        return m

    return sum(a[:n-m])


print(main())

Submission status: Wrong Answer

Solution code:
# ABC153
# C

N, K = input().split()
H_list = input().split()
H_list.sort(reverse=True)

count = 0
for i in range(int(K),len(H_list)):
    count += int(H_list[i])

print(count)

Submission status: Wrong Answer

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

atackTimes = 0

monsterList.sort()
if K == 0:
    for hp in monsterList[:-K]:
        atackTimes += hp
else:
    for hp in monsterList:
        atackTimes += hp

print(atackTimes)

Submission status: Wrong Answer

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

atackTimes = 0

monsterList.sort()
for hp in monsterList[:-K]:
    atackTimes += hp

print(atackTimes)

Submission status: Wrong Answer

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

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 :
  sum(H)
else :
  H.sort()
  print(sum(H[:N-K]))

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

H = S1[0]
K = S1[1]

if K == 0:
    print(sum(S2))
else:
    print(sum(S2[:-K]))

Submission status: Wrong Answer

Solution code:
import sys
n, k = map(int, sys.stdin.readline().split())
h = []
h.extend(sorted(map(int, sys.stdin.readline().split())))

del h[-k:]

print(sum(h))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = input().split()
l = sorted(h)
if (k >= len(h)):
    b = 0
else:
    m = k*(-1)
    f = l[:m]
    b = sum(int(i) for i in f)
print(b)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = input().split()
l = sorted(h)
if (k >= len(h)):
    b = 0
else:
    m = k*(-1)
    del l[m:]
    b = sum(int(i) for i in l)
print(b)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = input().split()
l = sorted(h)
if (k >= len(h)):
    l.clear()
    b = 0
else:
    o = len(h)
    p = o-k
    del l[p:]
    b = sum(int(i) for i in l)
print(b)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = input().split()
l = sorted(h)
if (k >= len(h)):
    l.clear()
else:
    o = len(h)
    p = o-k
    del l[p:]
b = sum(int(i) for i in l) 
print(b)

Submission status: Wrong Answer

Solution code:
h,n = map(int,input().split())
g = input().split()
G = sorted([int(j) for j in g])
del G[-n::]
print(sum(G))

Submission status: Wrong Answer

Solution code:
def main():
    n, k = [int(i) for i in input().split()]
    num = [int(i) for  i in input().split()]
    if k >= n:
        return 0
    else:
        num = sorted(num)
        return sum(num[:-k])
print(main())

Submission status: Wrong Answer

Solution code:
def main():
    n, k = [int(i) for i in input().split()]
    num = [int(i) for  i in input().split()]
    if k >= n:
        return 0
    else:
        l = sorted(num)
        return sum(num[:-k])
print(main())

Submission status: Wrong Answer

Solution code:
def main():
    n, k = [int(i) for i in input().split()]
    num = [int(i) for  i in input().split()]

    sorted(num)
    return sum(num[:-k])
print(main())

Submission status: Wrong Answer

Solution code:
def main():
    n, k = [int(i) for i in input().split()]
    num = [int(i) for  i in input().split()]

    sorted(num)
    del num[-k:]
    return sum(num)
print(main())

Submission status: Wrong Answer

Solution code:
def main():
    n, k = [int(i) for i in input().split()]
    num = [int(i) for  i in input().split()]

    deleat(num,k)

def deleat(lst, cun):
    sorted(lst)
    del lst[-cun:]
    print(sum(lst))
main()

Submission status: Wrong Answer

Solution code:
line=input()
data=input()
line=line.split()
data=data.split()
num=0
if int(line[0])<=int(line[1]):
    print(0)
else:
    data=[int(s) for s in data]
    for i in range(len(data)-int(line[1])):
        num+=data[i]
    print(num)

Submission status: Wrong Answer

Solution code:
N, K = list(map(int, input().split()))
enemy = sorted(list(map(int, input().split())), reverse=True)
 
if K > len(enemy):
  print(0)
  
sum = 0
for x in enemy[K:]:
  sum += x
print(sum)

Submission status: Wrong Answer

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

if K > len(enemy):
  print(0)
  

print(sum(enemy[K:]))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split()) ###n:モンスターの数，k:必殺技の回数
h=sorted(list(map(int,input().split()))) ###h:モンスターの体力

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

Submission status: Wrong Answer

Solution code:
def add_num(List):
  res=0
  for y in List:
    res += y
  print(res)

N, K=map(int,input().split())
List=list(map(int,input().split()))
if N <= K:
  print(0)
elif K != 0:
  x=List.index(max(List))
  List.pop(x)
  add_num(List)
else:
  add_num(List)