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())
A_list = list(map(int, input().split()))
n = len(A_list)
if N <= K:
    print(0)
elif K == 0:
    ans = sum(A_list)
    print(ans)
else:
    A_list.sort()
    A_list.pop(-K)
    ans = sum(A_list)
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N,K = map(int,input().split())
H = np.array(list(input().split()),np.int64)
np.sort(H)
if K > N:
    K = N
H[N-K:N] = 0
ans = np.sum(H)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n, k = MI()

h = np.array(sorted([int(i) for i in input().split()]))
hmax = h.max()

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

if k == 0:
    print(np.sum(h))
    exit()

h = np.delete(h, len(h) - k)
print(np.sum(h))

Submission status: Wrong Answer

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

print(ans if N > K else N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
H=sorted(list(map(int,input().split())))
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()
h=h[::-1]

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

else:
  print(sum(h))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import heapq
ceruleans, skills = map(int, input().split())
HP = list(map(lambda x: int(x) * (-1), input().split()))

for i in range(skills):
  heapq.heappop(HP)
  if HP == []:
    break

print(- sum(HP))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
if k != 0:
    print(sum(h[k+1:]))
else:
    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+1:]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import os

def main():
	num, count = map(int, input().split())
	monster_hp = list(map(int, input().split()))

	if num <= count:
		print(0)
	else:
		if count == 0:
			print(sum(monster_hp))
		else:
			monster_hp.sort(reverse=True)
			print(sum(monster_hp[num - count - 1:]))
	
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

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

print(sum(Hn[::-1][K:]))

Submission status: Wrong Answer

Solution code:
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


H,K=input2()
h=input_array()

sorted_h=sorted(h)
if len(sorted_h[:-K])<1:
	print(0)
else:
	print(sum(sorted_h[:-K]))

Submission status: Wrong Answer

Solution code:
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


H,K=input2()
h=input_array()

sorted_h=sorted(h)
if len(sorted_h)<1:
	print(0)
else:
	print(sum(sorted_h[:-K]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#C
NK = input().split(' ')
N = int(NK[0])
K = int(NK[1])
Hi = input().split(' ')
if K >= N:
    print(0)
else:
    Hi.sort()
    for s in range(K):
        Hi.pop(N - 1 - s)
    count = 0
    for j in range(N-K):
        count += int(Hi[j])
    print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

h = sorted(h)
H = h[k:]
sum_ = sum(H)
print(sum_)

Submission status: Wrong Answer

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

list_a = sorted(a, reverse = True)

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

Submission status: Wrong Answer

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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

sum = 0
a.sort()
print(a)
for i in range(min(n,k)): a.pop()
#print(a)
for i in range(len(a)):
    sum += a[i]
print(sum)

Submission status: Wrong Answer

Solution code:
NK= input().split()
N= int(NK[0])
K= int(NK[1])
H= input().split()
lis1=[]
for i in range (len(H)):
    lis1.append(int(H[i]))
def bubbleSort(arr):
    for i in range (len (arr)):
        for j in range (len(arr)-i-1):
            if (arr[j]>arr[j+1]):
                arr[j]^=arr[j+1]
                arr[j+1]^=arr[j]
                arr[j]^=arr[j+1]
    return arr

b= bubbleSort(lis1)
if (K>= N):
    print(0)
if(K<N):
    for j in range(K):
        b.remove(b[-1])
    sum=0   
    for k in range(len(b)):
        sum= sum+int(b[k])
    
print(sum)

Submission status: Wrong Answer

Solution code:
NK= input().split()
N= int(NK[0])
K= int(NK[1])
H= input().split()
lis1=[]
for i in range (len(H)):
    lis1.append(int(H[i]))
def bubbleSort(arr):
    for i in range (len (arr)):
        for j in range (len(arr)-i-1):
            if (arr[j]>arr[j+1]):
                arr[j]^=arr[j+1]
                arr[j+1]^=arr[j]
                arr[j]^=arr[j+1]
    return arr

b= bubbleSort(lis1)
if (K>= N):
    print(0)
else:
    for j in range(K):
        b.remove(b[-1])
    sum=0   
    for k in range(len(b)):
        sum= sum+int(b[k])
    
print(sum)

Submission status: Wrong Answer

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

y=sorted(H)
y.sort(reverse=True)
x=0
print(x)
for i in range (K,N):
    x=x+y[i]
    
print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if K >= N:
  print(0)
else:
  I = sorted(H)
  a = 0
  for i in range(N-K):
    a += H[i]
  print(a)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# 初期入力
N,K = (int(x) for x in input().split(" "))
H = list(map(int, input().split()))
tuujou_attack = 1

# N種類のモンスター、K回の必殺技、モンスターは　H　の体力
# 体力の多いモンスターから必殺技で倒す。必殺技が使えなくなったら通常攻撃
nokori_kaisu = 0
H_sorted = sorted(H)
if N <= K:
    nokori_kaisu = 0
else:
    nokori_hissatuwaza = N -K
    del H[nokori_hissatuwaza:]
    nokori_kaisu = sum( H ) # 体力少ないほうから　N-K　まで、通常攻撃「１」

print(nokori_kaisu)

Submission status: Wrong Answer

Solution code:
# 初期入力
N,K = (int(x) for x in input().split(" "))
H = list(map(int, input().split()))
tuujou_attack = 1

# N種類のモンスター、K回の必殺技、モンスターは　H　の体力
# 体力の多いモンスターから必殺技で倒す。必殺技が使えなくなったら通常攻撃
nokori_kaisu = 0
H_sorted = sorted(H)
if N <= K:
    nokori_kaisu = 0
else:
    nokori_hissatuwaza = N -K
    nokori_kaisu = sum( H[:nokori_hissatuwaza] ) # 体力少ないほうから　N-K　まで、通常攻撃「１」

print(nokori_kaisu)

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:
a=input().split()
(n,m)=map(int,a)
b=input().split()
b1=list(map(int,b))
b1=sorted(b1)
for i in range(m):
    b1[i]=0
    if i==len(b1)-1:
        break

print(sum(b1))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
sorted(h)
ans = 0
if len(h) == n:
    for i in range(k):
        try:
            h.pop()
        except:
            pass
    for x in h:
        ans += x
    print(ans)

Submission status: Wrong Answer

Solution code:
nk = input().split()
hl = input().split()


n = int(nk[0])
k = int(nk[1])

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

	h = sorted(hl)
	hp = 0

	for i in hl:
		hp = hp + int(i)



	for i in range(k):
		hp = hp - int(h[-1-i])

	print(hp)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
sorted(h)
s = 0
for i in range(k):
    try:
        h.pop()
    except:
        pass
if len(h) == 0:
    print(0)
else:
    for x in range(n-k):
        s += h[x]
    print(s)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
sorted(h)
s = 0
for i in range(k):
    try:
        h.pop()
    except:
        pass
if len(h) == 0:
    print(0)
else:
    for x in h:
        s += x
    print(s)

Submission status: Wrong Answer

Solution code:
nk=input().rstrip().split(" ")
n=int(nk[0])
k=int(nk[1])
hps=input().rstrip().split(" ")
shps=sorted(hps)
#print(shps)
answer=0
for i in range(n-k):
    answer+=int(shps[i])
print(answer)

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = list(map(int,input().split()))
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 = list(map(int,input().split()))
if K == 0:
    print(sum(H))
if K >= N:
    print(0)
else:
    print(sum(H[:-K]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

hpstr = input().split()
hp = []

for i in range(n):
  hp.append(int(hpstr[i]))

hp.sort()

print(hp)

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

Submission status: Wrong Answer

Solution code:
data = input().split()

n = int(data[0])
k = int(data[1])

hp = input().split()
hp.sort()

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

print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
s = list(map(int, input().split()))
if k > len(s):
    k = len(s)
s = s[::-1]
print(sum(s[k:]))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
s = list(map(int, input().split()))
# s.sort()
if k > len(s):
    k = len(s)
for i in s:
    for j in range(1, k+1):
        s[s.index(max(s))]=0
print(sum(s))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#Nモンスターの数
#H[i]モンスターの体力
#K必殺技の回数

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

if k >= n:
    print(0)
    exit()
else:
    for i in range(k):
        h.pop()

print(sum(h))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split(' '))
H = sorted(map(int, input().split(' ')))
print(H)
if(K >= N):
    print(0)
    exit(0)
for j in range(K):
    H[N - j - 1] = 0
print(sum(H))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split(' '))
H = sorted(map(int, input().split(' ')))
if(K >= N):
    print(0)
    exit(0)
for j in range(K):
    H[K - j - 1] = 0
print(sum(H))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if N <= K:
  print(N)
else:
  print(sum(lst[K:])+K)

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 n<k:
    k = n
for i in range(0,k):
    hlist[i] = 0

print(sum(hlist))

Submission status: Wrong Answer

Solution code:
list = input().split(" ")
N = int(list[0])
K = int(list[1])
list_hp = input().split(" ")
list_hp = [int(i) for i in list_hp]
list_hp = sorted(list_hp)
print(list_hp)

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

Submission status: Wrong Answer

Solution code:
HP, k = map(int, input().split())
enamy = list(map(int, input().split()))

enamy1 = sorted(enamy, reverse=True)
del enamy1[0:k]
print(sum(enamy1)+k)

Submission status: Wrong Answer

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

H = list(input().split())

H.sort()

sum = 0

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

Submission status: Wrong Answer

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

H = list(input().split())

H.sort()

sum = 0;

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=(int(x) for x in input().split())
a=list(int(y) for y in input().split())
b=sorted(a)
print(sum(b[0:N-K]))

Submission status: Wrong Answer

Solution code:
from collections import deque

# ans = True
# print(["Yes", "No"][ans])

h, k, *a = map(int, open(0).read().split())
if h <= k:
    print(k)
    exit()

a.sort()
q = deque(a)

[q.pop() for _ in range(k)]
print(sum(q))

Submission status: Wrong Answer

Solution code:
from collections import deque

h, k, *a = map(int, open(0).read().split())
if h <= k:
    print(k)
    exit()

a.sort()
q = deque(a)

[q.pop() for _ in range(k)]
print(q)
print(sum(q))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

def judge(config , monster_info):
    config = config.split()
    monster_num = int(config[0])
    deathblow_num = int(config[1])
    
    monster_info = monster_info.split()
    monster_info = sorted(monster_info)
    monster_info.reverse()
    monster_info = monster_info[deathblow_num:]
    result = 0
    for num in monster_info:
        result = result + int(num)
    return result
        

def main():
    configration = input()
    information = input()
    answear = judge(configration , information)
    print(answear)
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# ABC 153C
import numpy as np
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = np.array(h)

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

Submission status: Wrong Answer

Solution code:
# ABC 153C
import numpy as np
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = np.array(h)
if k >= n:
  print('0')
else:
    if k>0:
        print(str(np.sum(h[:-k])))
    else:
        print(str(np.sum(h)))

Submission status: Wrong Answer

Solution code:
import numpy as np
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = np.array(h)
if k >= n:
  print('0')
else:
  print(str(np.sum(h[:-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:
    a=h[:-k]
    ans=sum(a)

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

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
H=list(map(int,input().split()))
H2=H[::-1]
for i in range(k):
    if len(H2)>0:
        H2.pop(len(H2)-1)
print(sum(H2))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
H=list(map(int,input().split()))
H2=H[::-1]
for i in range(k):
    if len(H)>0:
        H.pop(n-i-1)
print(sum(H))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
#print("n={}, k={}".format(n,k))

h = input().split()
#print(h)

hs = sorted(h)
#print(hs)

#必殺技によって倒したあとのモンスターの数
if n >= k: 
  num_mon = n - k 
else:
  num_mon = 0
print(num_mon)

#攻撃するモンスターの体力のリスト
mon_att = hs[0:num_mon]
print(mon_att)

#攻撃する回数の最小値
min_att = sum(map(int, mon_att))
print(min_att)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
#print("n={}, k={}".format(n,k))

h = input().split()
#print(h)

hs = sorted(h)
#print(hs)

#攻撃するモンスターの体力のリスト
mon_att = hs[0:len(hs)-k]
#print(mon_att)

#攻撃する回数の最小値
min_att = sum(map(int, mon_att))
print(min_att)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
#print("n={}, k={}".format(n,k))

h = input().split()
#print(h)

hs = sorted(h)
#print(hs)

#攻撃するモンスターの体力のリスト
mon_att = hs[0:len(hs)+1-k]
#print(mon_att)

#攻撃する回数の最小値
min_att = sum(map(int, mon_att))
print(min_att)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = list(map(int,input().rstrip().split()))
n = N[0]
k = N[1]

h = list(map(int,input().split()))
h.sort(reverse=True)

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

Submission status: Wrong Answer

Solution code:
N = list(map(int,input().rstrip().split()))
n = N[0]
k = N[1]

h = list(map(int,input().split()))
h.sort(reverse=True)

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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc153/tasks/abc153_c
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n, k = map(int, input().split())
    hl = list(map(int, input().split()))
    hl.sort()
    hl = hl[:(n - k)]
    print(sum(hl))
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc153/tasks/abc153_c
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n, k = map(int, input().split())
    hl = list(map(int, input().split()))
    hl.sort()
    hl = hl[:k]
    print(sum(hl))
    return 


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
H=list(map(int,input().split()))
lis=[]
for _ in range(K):
  high=max(H)
  lis.append(high)
  if H==[]:
    H=[0]
    break
print(sum(H)-sum(lis))

Submission status: Wrong Answer

Solution code:
from collections import deque

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

D = deque(H)

for _ in range(K):
    if N == 0:
        break
    D.pop()
    N -= 1

print(D)

Submission status: Wrong Answer

Solution code:
from collections import deque

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

D = deque(H)

for _ in range(K):
    if N == 0:
        break
    D.pop()
    N -= 1

print(H)

Submission status: Wrong Answer

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

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

H.sort(reverse=True)

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

Submission status: Wrong Answer

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

h.sort()

h = h[k:]

print(sum(h))

Submission status: Wrong Answer

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

h.sort()

h = h[k+1:]

print(sum(h))

Submission status: Wrong Answer

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

h.sort()

h = h[k+1:]
print(sum(h))

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = map(int,read().split())
N -= K
if N <= 0:
    print(0)
    exit()
    
H.sort()
    
print(sum(H[:N - K + 1]))

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = map(int,read().split())
N -= K
if N <= 0:
    print(0)
    exit()
    
H.sort()
    
print(sum(H[:N - K]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

hs.sort()

print(sum(hs[:-k]))

Submission status: Wrong Answer

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

hs.sort()

print(sum(hs[:-3]))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
#hp=list(map(int,input().split()))
hp=[int(x) for x in input().split()]
hp.sort()
if n>k:
	re=sum(hp[:n-k])
else:
	re=len(hp)
print(re)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
#hp=list(map(int,input().split()))
hp=[int(x) for x in input().split()]
hp.sort()
if n>=k:
	re=sum(hp[:n-k])
else:
	re=len(hp)
print(re)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
#hp=list(map(int,input().split()))
hp=[int(x) for x in input().split()]
hp.sort()
if n>=k:
	re=sum(hp[:n-k])
else:
	re=sum(hp)
print(re)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
#hp=list(map(int,input().split()))
hp=[int(x) for x in input().split()]
hp.sort()
re=sum(hp[:n-k])
print(re)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
#hp=list(map(int,input().split()))
hp=[int(x) for x in input().split()]
sorted(hp)
re=sum(hp[:n-k])
print(re)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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:
    h.sort()
    print(h[:-k])
    print(sum(h[:-k]))

Submission status: Wrong Answer

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

#敵を弱い順に並べる
teki_list.sort()
#強いやつに必殺技を使う
if k <= len(teki_list) and k != 0:
    del teki_list[-k:]
else:
    del teki_list[:]

print(sum(teki_list))

Submission status: Wrong Answer

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

#敵を弱い順に並べる
teki_list.sort()
#強いやつに必殺技を使う
if k <= len(teki_list):
    del teki_list[-k:]
else:
    del teki_list[:]

print(sum(teki_list))

Submission status: Wrong Answer

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

#敵を弱い順に並べる
teki_list.sort()
#強いやつに必殺技を使う
del teki_list[-k:]

print(sum(teki_list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
feneck = input().split()
H = input().split()
H_i = [int(h) for h in H]

N = int(feneck[0])
K = int(feneck[1])

list.sort(H_i, reverse=True)

if K < len(H):
  sum = 0
  H_i = H[K:]
  for hp in H_i:
    hp = int(hp)
    sum += hp
  print(sum)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
feneck = input().split()
H = input().split()

N = int(feneck[0])
K = int(feneck[1])

list.sort(H, reverse=True)

if K < len(H):
  sum = 0
  H = H[K:]
  type(H)
  for hp in H:
    hp = int(hp)
    sum += hp
  print(sum)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
#python 3.5.2

# Online Python compiler (interpreter) to run Python online.
# Write Python 3 code in this online editor and run it.
inputa = input()

n,k= inputa.split()
K=int(k)
N=int(n)
inputb=input()
Monsters=inputb.split()
Monsters.sort(reverse=True)
# print(Attacks)
cnt=0
if(K==0):
    for j in range(len(Monsters)):
        cnt+=int(Monsters[j])
else:
    M=len(Monsters)
    if(M>K):
        MonstersRem=Monsters[K:]
        for i in range(len(MonstersRem)):
          cnt=cnt+int(MonstersRem[i])
    else:
        cnt=0
    
print(cnt)

Submission status: Wrong Answer

Solution code:
inputa = input()

n,k= inputa.split()
K=int(k)
N=int(n)
inputb=input()
Monsters=inputb.split()
Monsters.sort(reverse=True)
# print(Attacks)
cnt=0
M=len(Monsters)
if(M>K):
    MonstersRem=Monsters[K:]
    for i in range(len(MonstersRem)):
      cnt=cnt+int(MonstersRem[i])
else:
    cnt=0
    
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(sum(Nli[0:N-K]))

Submission status: Wrong Answer

Solution code:
x = [int(i) for i in input().split(" ")]
s = x[1]
m = [int(i) for i in input().split(" ")]
if s == 0:
  print(sum(m))
else:
  m = sorted(m)[0:-s:1]
  print(m)

Submission status: Wrong Answer

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