qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n,k=map(int,input().split())
c=sorted(list(map(int,input().split())))
if k>n:
  print(0)
else:
  print(sum(c[:n-k])

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


Fixed code:
n,k=map(int,input().split())
l=list(map(int,input().split()))
l=sorted(l)[::-1]
print(sum(l[k:]))
Buggy code:
n,k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
k = min(k,len(h))
del h[:k]
print(sum(h))

Fixed code:
n,k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
k = min(k,len(h))
del h[:k]
print(sum(h))
Buggy 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)

Fixed 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(sum(m))
Buggy code:
# coding: utf-8
bodies_count = list(map(int,input().split()))
enemy_life = list(map(int,input().split()))
count = 0

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

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



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

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

    if enemy_life != []:
        print(sum(enemy_life))
    else:
        print(0)
    # for i in range(bodies_count[1]):
    #     if enemy_life == []:
    #         print(count)
    #         break
    #     else:
    #         enemy_life.sort()
    #         print(enemy_life)
    #         enemy_life.pop(enemy_life.index(max(enemy_life)))
Buggy code:
N,K=map(int,input().split())
H=[map(int,input().split())]


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

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

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

Fixed 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(sum(tairyoku))
Buggy code:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
h=[::-1]
if k!=0:
  for i in range(k):
    h[i]=0

  
print(sum(h))


Fixed 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))
Buggy code:
N, K = map(int, input().split())
H = list(map(int, input().split())).sort(reverse=True)
ans = 0
if len(H) - K <= 0:
    print(0)
else:
    ans += sum(H[K:])
    print(ans)

Fixed code:
N, K = map(int, input().split())
*H, = map(int, input().split())
H.sort(reverse=True)
ans = 0
if len(H) - K <= 0:
    print(0)
else:
    ans += sum(H[K:])
    print(ans)
Buggy code:
n, k = map(int, input().split())
h = list(map(int, input().split()))

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

print(sum(h[k:]))

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

h = sorted(h)

h.reverse()

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

Fixed 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[len(b)-1-i]=0
    if i==len(b1)-1:
        break

print(sum(b1))
Buggy 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))

Fixed 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(-1*sum(h))
Buggy code:
n,k=[int(x) for x in input().split()]
arr=[int(x) for x in input().split()]
s=0
if(n>k):
	for i in range(n-k):
  		s+=arr[i]
    print(s)
else:
  print(0)

  

Fixed code:
n,k=[int(x) for x in input().split()]
arr=[int(x) for x in input().split()]
s=0
arr.sort()
if(n>k):
    for i in range(n-k):
        s+=arr[i]
    print(s)
else:
  print(0)
Buggy code:
[n,k]=[int(x) for x in input().split()]
h=[int(x) for x in input().split()]
h.sort()
if n<=k:
  print("0")
else:
  print(str(sum(h[:-k])))

Fixed code:
[n,k]=[int(x) for x in input().split()]
h=[int(x) for x in input().split()]
h.sort()
if n<=k:
  print("0")
else:
  print(str(sum(h[:len(h)-k])))
Buggy code:
H, K = map(int, input().split())
H = sorted(list(map(int, input().split())))

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


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

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

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

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

Fixed 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))
Buggy 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:]))


Fixed 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)-sum(H[0:k]))
Buggy 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)


Fixed 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(0)
Buggy code:
N, K = map(int, input().split())
A = map(int, input().split())

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

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

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

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

if K >= N:
    print(0)
else:
    for val in range(N - K):
        counter += int(A_list[val+K])
    print(counter)
Buggy 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)
else :
    for i in range(k):
        h[i] = 0
    print(sum(h))    


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

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

h.sort(reverse=True)

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

        

Fixed code:
def f(h,k):
    N=len(h)
    t=0
    h.sort()
    for i in range(N-k):
        t+=h[i]
    return t
N,k=map(int,input().split())
h=list(map(int,input().split()))
print(f(h,k))
Buggy code:
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if K >= N:
  print(N)
else:
  print(sum(H[:N-K]))

Fixed code:
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if K >= N:
  print(0)
else:
  print(sum(H[:N-K]))
Buggy code:
n,k = map(int,input().split())
h = list(map(int,input().split()))

del h[n::]
h.sort()
if k != 0:
  del h[-k:]
print(h)
print(sum(h))

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

del h[n::]
h.sort()
if k != 0:
  del h[-k:]
print(sum(h))
Buggy 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:]))

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

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

health_inp = input().split(" ")
monsters_health = [int(h) for h in health_inp]
monsters_health.sort(reverse=True)
print(sum(monsters_health[special_moves:]))
Buggy code:
x = input().split(" ")
n = int(x[0])
k = int(x[1])
h = list(map(int,input().split(" ")))

h.sort(reverse=True)
print(h)

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

Fixed code:
x = input().split(" ")
n = int(x[0])
k = int(x[1])
h = list(map(int,input().split(" ")))

h.sort(reverse=True)

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

H.sort(reverse=True)
if N < K:
    K = N
for i in range(K):
    H[i] = 0
print(H)
ans = sum(H)
print(ans)

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

H.sort(reverse=True)
if N < K:
    K = N
for i in range(K):
    H[i] = 0
#print(H)
ans = sum(H)
print(ans)
Buggy 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(N-K):
    sum+=ListH[i]

print(sum)

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


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

    print(sum)
Buggy 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:]))

Fixed 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(reverse=True)

if k >= n:
    print(0)
else:
    print(sum(h[k:]))
Buggy code:
l=[int(x) for x in input().rstrip().split()]
l.sort(reverse = True)

ans=0

del l[0:a]
ans = a
print(sum(l))

Fixed code:
h,a = [int(x) for x in input().rstrip().split()]
l=[int(x) for x in input().rstrip().split()]
l.sort(reverse = True)

ans=0

del l[0:a]
ans = a
print(sum(l))
Buggy 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)


Fixed 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(sum(D))
Buggy 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)

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

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

  sum_count = 0
  sum_count = sum(lst[:-k])
  print(sum_count)




Fixed code:
n, k = map(int, input().split())
lst = sorted(list(map(int, input().split())))

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

Fixed 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_i):
  sum = 0
  H_i = H_i[K:]
  for hp in H_i:
    hp = int(hp)
    sum += hp
  print(sum)
else:
  print(0)
Buggy 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)

Fixed 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)
Buggy 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)
  

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

Fixed code:
n, k = map(int, input().split())
arr = [int(j) for j in input().split()]
if k>= n:
	print(0)
else:
	arr.sort(reverse=True)
	print(sum(arr[k:]))
Buggy code:
n,k = map(int, input().split())
h = list(map(int, input().split()))

h.sort()

h = h[k:]

print(sum(h))

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

h.sort(reverse=True)

h = h[k:]

print(sum(h))
Buggy code:
N, K = map(int,input().split())
N_hp = list(map(int,input().split()))
N_hp.sort(reverse=True)
sum_turn = sum(N_hp[K:])
print(K+sum_turn)

Fixed code:
N, K = map(int,input().split())
N_hp = list(map(int,input().split()))
N_hp.sort(reverse=True)
del N_hp[:K]
sum_turn = sum(N_hp)
print(sum_turn)
Buggy code:
a, b=map(int,input().split())
l=list(map(int,input().split()))
if a<b:
  print(0)
elif a>b:
  l.sort()
  n=l[b:]
  s=sum(n)
  print(s)

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

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


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

if K >= N:
  print(0)
elif K == 0:
  print(sum(H))
else:
  print(sum(H[:-K]))
Buggy code:
n, k = map(int, input().split())
b = list(map(int, input().split()))

b.sort(reverse=True)
ans = 0

while k > 0:
    if n < 0:
        break
    else:
        del b[:k]
        n -= k

if n == 0:
    print('0')
else:
    print(sum(b))

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

b.sort(reverse=True)
ans = 0

del b[:k]
n -= k

if n < 0:
    print('0')
else:
    print(sum(b))
Buggy code:
import numpy as np

E, H = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))

if H>=E:
  print("0")
else:
  A = np.sort(A)
  Ans = A[:-H].sum()
  print(Ans)

Fixed code:
import numpy as np

E, H = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))

if H>=E:
  print("0")
else:
  A = np.sort(A)
  if H>0:
    Ans = A[:-H].sum()
  else:
    Ans = A[:].sum()
  print(Ans)
Buggy code:
n, k = map(int, input().split())
H = sorted(list(map(int, input().split())))
if n <= k:
  print(0)
else:
  print(sum(H[:k]))

Fixed 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]))
Buggy code:
# coding utf-8
import math
import sys


N, K = map(int, input().rstrip().split())

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

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

print(ans)


Fixed code:
# coding utf-8
import math

N, K = map(int, input().rstrip().split())

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

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

print(ans)
Buggy code:
import numpy as np
import numpy

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

list2=np.sort(list1)

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

print(sum)

Fixed code:
import numpy as np

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


list2=np.sort(list1)

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

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


Fixed code:
a,b=map(int,input().split())
n=list(map(int,input().split()))
n.sort(reverse=True)
n[0:b]=[]
print(sum(n))
Buggy code:
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())))
print(sum(H[:-K]))

Fixed code:
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())))
print(sum(H[:N-min(N,K)]))
Buggy code:
n,k = map(int,input().split())
hs = list(map(int,input().split()))

hs.sort()

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



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

hs.sort()

print(sum(hs[:len(hs)-k]))
Buggy code:
n,k = [int(x) for x in input().split()]
m = [int(x) for x in input().split()]
m.sort()
print(sum(m[0:n-k]))

Fixed code:
n,k = [int(x) for x in input().split()]
m = [int(x) for x in input().split()]
m.sort()
if n<k:
  k = n
print(sum(m[0:n-k]))
Buggy code:
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
print(sum(a[k:-1]))


Fixed code:
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
print(sum(a[k:]))
Buggy code:
from sys import stdin


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

    print(h_list)
    num_enemy = n
    enable_special = k

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


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

Fixed code:
from sys import stdin


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

    num_enemy = n
    enable_special = k

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


if __name__ == '__main__':
    input1 = stdin.readline().rstrip()
    input2 = stdin.readline().rstrip()
    ret = main(input1, input2)
    print(ret)
Buggy 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))

Fixed code:
N, K = map(int, input().split())
H = [int(h) for h in input().split()]
H = list(sorted(H, reverse = True))

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


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

if n <= k:
    print(0)
    exit()
print(sum(h[k:n]))
Buggy 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)

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

h = sorted(h)

attack_n = 0

if k >= n:
    attack_n = 0

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

print(attack_n)
Buggy code:
n,k=map(int,input().split())
h=list(map(int,input().split()))
if n<=k:
    print(k)
else:

    h.sort(reverse=True)

    print(sum(h[k:]))

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

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

Fixed 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]))
Buggy code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
listsort=sorted(A, reverse=True)
print(listsort)
del listsort[0:K]
print(sum(listsort))

Fixed code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
listsort=sorted(A, reverse=True)
del listsort[0:K]
print(sum(listsort))
Buggy code:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
c=0
for i in range(k):
    h.pop(0)

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


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

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


Fixed code:
N,K=map(int,input().split())
List=list(map(int,input().split()))
S=sorted(List)[::-1]

del S[0:K]
print(sum(S))
Buggy code:
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))

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

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

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