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:
h,k = map(int,input().split())
lst = list(map(int,input().split()))
lst.sort()
print(sum(lst[:len(lst)-k]))

Submission status: Wrong Answer

Solution code:
nn, kk = list(map(int,input().split()))
hh = list(map(int,input().split()))
hh.sort()
print(sum(hh[0:nn-kk]))

Submission status: Wrong Answer

Solution code:
nn, kk = list(map(int,input().split()))
hh = list(map(int,input().split()))

print(nn,kk,hh)

hh.sort()
print(hh[0:nn-1])
print(sum(hh[0:nn-kk]))

Submission status: Wrong Answer

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


k *= -1

del h[k:]

print(sum(h))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split(' '))
H_ls = list(map(int, input().split(' ')))
print(sum(H_ls[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:
  print(K+sum(sorted(H)[:len(H)-K]))

Submission status: Wrong Answer

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

print(sum(h[-k:]) if k != 1 else 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 N>K:
    x=max(H)
    print(sum(H)-x)
else:
    print(0)

Submission status: Wrong Answer

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

print(sum(h[k:]) if k!=1 else k)

Submission status: Wrong Answer

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

print(sum(h[-k:]) if k!=1 else k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if len(b) <= a[1]:
    print("0")
elif a[1]==0:
    print(sum(b))
else:
    del b[a[0]-1]
    b.sort(reverse=True)
    print(sum(b[a[1]-1:]))

Submission status: Wrong Answer

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

if len(b) <= a[1]:
    print("0")
elif a[1]==0:
    print(sum(b))
else:
    del b[a[0]-1]
    b.sort(reverse=True)
    print(sum(b[(a[1]-1):len(b)]))

Submission status: Wrong Answer

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

if len(b) <= a[1]:
    print("0")
elif a[1]==0:
    print(sum(b))
else:
    del b[a[0]-1]
    b.sort(reverse=True)
    print(sum(b[(a[1]-1):len(b)]))
    print(b[a[1]:])

Submission status: Wrong Answer

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

if len(b) <= a[1]:
    print("0")
else:
    del b[1]
    b.sort(reverse=True)
    print(sum(b[:a[1]]))

Submission status: Wrong Answer

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

b.sort(reverse=True)

if len(b) <= a[1]:
    print("0")
else :
    print(sum(b[:a[1]]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


    
for K in range(len(H)):
    SUM = SUM + H[K]

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-2])

print(ans)

Submission status: Wrong Answer

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

# N<=Kの場合、全てのモンスターを必殺技で倒して終了
# N>Kの場合、N体のモンスターのうち、体力が高い順に、K体を必殺技で倒す
# 残ったモンスターは、攻撃によって倒す

H = sorted(H, reverse=True)
ans = K
if N > K: ans += sum(H[K:])
  
print(ans)

Submission status: Wrong Answer

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=sum(c)
e=0
if a<=b:
  print(0)
else:
  for i in range(b):
    e=e+c[-i]
  print(d-e)

Submission status: Wrong Answer

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=sum(c)
e=0
if a<=b:
  print(0)
else:
  for i in range(b):
    e=e+c[-b]
  print(d-e)

Submission status: Wrong Answer

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=sum(c)
e=0
if a<b:
  print(0)
else:
  for i in range(b):
    e=e+c[-b]
  print(d-e)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

sum=0

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

print(sum+1)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
l=list(map(int,input().split()))
z=0
sorted(l)
for i in range(a-b):
  z+=l[i]
print(z)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
*H, = map(int,(input().split()))  
H.reverse()
if K <= len(H):
    del H[0:K]  
    print(sum(H))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
#https://atcoder.jp/contests/abc153/tasks/abc153_c
N,K =map(int,input().split())
M_List = sorted(list(map(int,input().split())))
if N<=K:
    print(0)
else:
    print(sum(M_List[:K*(-1)]))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

hh.sort()

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

Submission status: Wrong Answer

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

H = sorted(H)
H = H[:len(H)-N]

if N >= len(H):
    print(0)
else:
    print(sum(H))

Submission status: Wrong Answer

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

H = sorted(H)
H = H[len(H)-N:]

print(sum(H))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.buffer.readline
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = MAP()
h = LIST()
h.sort()

if k >= n:
    print(0)
else:
    print(sum(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]) if k >= n else 0)

Submission status: Wrong Answer

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

h.sort()
ans = sum(h[:n-1*k])

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
INPUT = list(input().split())
# monster N
N = int(INPUT[0])
# critical K
K = int(INPUT[1])
# monster list
M_list = np.sort(np.array(list(input().split()), dtype="int") )
k = -K
# futsu no kogeki de taosu
M_norm = M_list[:k]

# kogeki kaisu
count = np.sum(M_norm)

print(count)

Submission status: Wrong Answer

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

if n<=k:
  print(k)
  
else:
  a=sorted(a)
  b=n-k
  ans=0
  for x in range(n-k):
    ans+=a[x]
    
  print(ans+k)

Submission status: Wrong Answer

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

for i in range(min(K,N)):
    Monsters[i]=0
print(sum(Monsters))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
c=list(map(int,input().split()))

d=sorted(c)
if b==0:
    print(sum(d))
elif a>b:
    n=len(d[0:b])
    del d[0:b+1]
    m=sum(d)
    print(m)
else:
    print(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

h.sort(reverse=True)
ans = 0

if k == 0 :
    ans = sum(h)
elif k <= n :
    for i in range(k):
        h[i] = 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()))

sumh = sum(h)

if n <= k:
    print(0)
elif k == 0:
    print(sumh)
else:
    for i in range(k):
        sumh -= max(h)
        print(sumh)

Submission status: Wrong Answer

Solution code:
import heapq
n,k = map(int,input().split())
h = list(map(int,input().split()))
h = list(map(lambda i: i*(-1),h))
heapq.heapify(h)

if n <= k:
    print(0)
elif k == 0:
    print(sum(h)*(-1))
else:
    for i in range(k):
        heapq.heappop(h)*(-1)
        print(sum(h)*(-1))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math

def main():
  N, K = map(int, input().split())
  H = list(map(int, input().split()))
  
  if K >= N:
    print(0)
    return
  
  ans = 0
  l = sorted(H, reverse=True)
  
  del l[:K]
  print(l)
  
  ans += sum(l)
  
  print(ans)
  
  
main()

Submission status: Wrong Answer

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

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

H.sort()
H.reverse()
print(sum(H[n-k-1:]))

Submission status: Wrong Answer

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

    if k >= n:
        print(0)
        exit()
    total = sum(inlis[:-k])
    print(total)

    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    if k >= n:
        print(0)
    total = sum(inlis[:-k])
    print(total)

    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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()))
h.sort()
if n>k:
  ans=0
  for i in range(n-k-1):
    ans+=h[i]
  print(ans)
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


print(sum(H[K:])+min(K,N))

Submission status: Wrong Answer

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

if n<=k:
  print(0)
  sys.exit()

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

Submission status: Wrong Answer

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

H.sort()
H.reverse()

if n <= k:
  print(0)
else:
  print(sum(H[k+1:len(H)]))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
H = 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()))
if K > len(H):
    print(0)
elif K == 0:
    print(sum(H))
elif K < len(H):
    H.remove(max(H))
    print(sum(H))

Submission status: Wrong Answer

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

H.reverse()

cnt = 0

print(sum(H[K:]))

Submission status: Wrong Answer

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

H.reverse()

cnt = 0

for i in range(K,len(H)):
    cnt += H[i]

print(cnt)

Submission status: Wrong Answer

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

H.reverse()

cnt = 0

for i in range(K,len(H)):
    cnt += int(H[i])

print(cnt)

Submission status: Wrong Answer

Solution code:
mod = 1e9+7
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
    H, N = [int(x) for x in raw_input().split()]
    
    s = sum([int(x) for x in raw_input().split()])
    
    if s >= H:
        print('Yes')
    else:
        print('No')
    
    

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

h.sort(reverse=True)
del h[:k]

cnt=0
if h == []:
  print(0)
else:
  for i in range(len(h)):
    cnt += h[i]

print(cnt)

Submission status: Wrong Answer

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

h.sort(reverse=True)

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

print(cnt+1)

Submission status: Wrong Answer

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

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

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

a = h[k:]

print(sum(a))

Submission status: Wrong Answer

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

h.reverse()

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.reverse

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 = sorted(h)

h = h[:-k]

print(sum(h))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if K >= N:
    print(0)
else:
    heapify(H)
    while K > 0:
        H.pop(-1)
        K -= 1
    print(sum(H))

Submission status: Wrong Answer

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

def solve():
    global n, k, h
    if n <= k:
        return 0
    s = sum(h)
    h = sorted(h, reverse=True)
    for i in range(k):
        print(h[i])
        s -= h[i]
    return s

print(solve())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

ans = 0
for i in range(N):
    if i+1 > K:
        ans += sort[i]
    
print(ans)

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

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 N>K:
  H.sort()
  del H[N-K+1:]
  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 N>K:
  for count in range(K):
    H.remove(max(H))
    print(sum(H))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
h=input().split()
g=sorted(h,reverse=True)
s=0
if k>=n:
    print(0)
else:
    q=g[k:n]
    for i in q:
        i=int(i)
        s+=i
    print(s)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
h=input().split()
s=0
g=sorted(h,reverse=True)
t=0
i=0
if k>=n:
    print(0)
else:
    for i in g:
        if t<k:
            t+=1
        else:
            i=int(i)
            s+=i
    print(s)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
h=input().split()
s=0
g=sorted(h,reverse=True)
t=0
i=0
if k>=n:
    print(0)
else:
    for i in g:
        t+=1
        if t<=k:
            continue
        else:
            i=int(i)
            s+=i
    print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = list( map(int, input().split()) )
H.sort()
h = 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()
h = H[0:N-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)
import numpy as np
h = H[0:N-K]
#h = np.array(H[0: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()
import numpy as np
h = H[0:N-K]
#h = np.array(H[0: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()
import numpy as np
h = np.array(H[0:N-K])
print(h.sum())

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
List=list(map(int,input().split()))
S=sorted(List)
if K==0 and len(List)==N:
    i=1
elif K!=0 and len(List)==N:
    i=0
del S[i:K+1]
print(sum(S))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
List=list(map(int,input().split()))
S=sorted(List)
if K==0:
    i=1
else:
    i=0
del S[i:K+1]
print(sum(S))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
List=list(map(int,input().split()))
S=sorted(List)
if K==0:
    i=1
else:
    i=0
del S[i:K+1]
print(sum(S))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
List=list(map(int,input().split()))
S=sorted(List)
del S[0:K+1]
print(sum(S))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = list(map(int, input().split()))
print(H)
for i in range(min(K,N)):
    saidai = max(H)
    H.remove(saidai)
print(H)

print(sum(H))

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

if k>=n:
    print(0)
    
else:
    h.sort(reverse = True)
    print(sum(h[n-k-1:]))

Submission status: Wrong Answer

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

if len(a_) <= n:
    print('Yes')
else:
    a_.sort(reverse = True)
    for i in range(n):
        a_[i] = 0
    print(sum(a_))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = [int(h) for h in input().split()]
H = list(sorted(H, reverse = True))
print(H)
if len(H) <= K:
  print(0)
else:
  del H[0:K]
  print(sum(H))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
if len(h) <= k:
    print(0)
else:
    for _ in range(k):
        h.pop()
    print(sum(h))

Submission status: Wrong Answer

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

H = sorted(H)
ans = sum(H[K+1:])
print(ans)

Submission status: Wrong Answer

Solution code:
import heapq

n, k = map(int, input().split())
h = [-1 * int(i) for i in input().split()]
heapq.heapify(h)

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

for i in range(k):
  heapq.heappop(h)

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[:N-K]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if(n>k):
    for i in range(n-k):
        s+=arr[i]
    print(s)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = sorted(a)
if n <= k:
  print(0)
else:
  c = 0
  t = 0
  while t < n-k:
    c += a[t]
    t += 1
  print(c)

Submission status: Wrong Answer

Solution code:
import numpy as np
n, k = map(int,input().split())
h = np.array(input().split(),dtype=int)

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

Submission status: Wrong Answer

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

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

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]), + K)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

def calculate(n,k,arr):
    result = 0
    for i in range(n-k):
        result = result + arr[i]

    print(result)

calculate(N,K,ARR)

Submission status: Wrong Answer

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

ans = 0
for i in list_h:
    if k > 0:
        k = k - 1
        ans = ans + 1
    else:
        ans = ans + i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#153 Fennec vs Monster
n,k = map(int,input().split())
tairyoku = list(map(int,input().split()))
tairyoku.sort(reverse=True)

if k == 0:
    print(sum(tairyoku))
    
else:
    del tairyoku[:k]
    print(tairyoku)
    print(sum(tairyoku))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
H = [int(x) for x in input().split()]
H.sort()
if K == 0:
    K = -1
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(reverse=True)
if n <= k:
    print(0)
else:
    for i in range(k):
        h.pop(0)
        print(sum(h))

Submission status: Wrong Answer

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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, k = input_to_int_map()
    h = input_to_int_tuple()

    if n <= k:
        return 0

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


if __name__ == "__main__":
    print(main())

Submission status: Wrong Answer

Solution code:
import sys

n, k, *h = map(int, sys.stdin.read().split())

def main():
    print(sum(sorted(h)[:max(0, n-k)]))
    print(sum([]))

if __name__ ==  '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

n, k, *h = map(int, sys.stdin.read().split())

def main():
    print(sum(sorted(h)[:n-k]))

if __name__ ==  '__main__':
    main()

Submission status: Wrong Answer

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

h = sorted(h)
print(h)
h.reverse()

print(sum(h[k:]))

Submission status: Wrong Answer

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

print(sorted(H)[::-1][K:])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
h=map(int,input().split())
h=sorted(h)
if n<=k:
  print('0')
  exit()
for i in range(k):
  h[i-1]=0
print(sum(h))