Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))


def comb(n, k):
    if k > n//2:
        k = n-k
    c, d = 1, 1
    for i in range(k):
        c *= n-i
        d *= i+1
    return c//d


A.sort()
a = A[-1]
k = bisect_left(A, a//2+1)
x = comb(a, A[k-1])
y = comb(a, A[k])
if x >= y:
    b = A[k-1]
else:
    b = A[k]
print(a, b)


### FIXED CODE ###

from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
A.sort()
if N == 2:
    print(A[1], A[0])
    exit()
a = A[-1]
k = bisect_left(A, a/2)
x = a/2-A[k-1]
y = A[k]-a/2
if x <= y:
    b = A[k-1]
else:
    b = A[k]
print(a, b)
### BUGGY CODE ###

def main():
    s = input()
    d = {0: 0}
    for i in s:
        d2 = dict()

        for j in d.keys():
            k = d[j]
            if i != "1":
                temp = max(j-1, 0)
                if temp not in d2:
                    d2[temp] = [k-1]
                else:
                    d2[temp].append(k-1)
            if i != "0":
                if j+1 not in d2:
                    d2[j+1] = [min(0, k+1)]
                else:
                    d2[temp].append(min(0, k+1))

        d = dict()
        for j in d2.keys():
            d[j] = max(d2[j])

        for i in d2.keys():
            if i-1 in d:
                if d[i] == d[i-1]:
                    d.pop(i)
                    continue
            if i-2 in d:
                if d[i] == d[i-2]:
                    d.pop(i)

    ans2 = 10**10
    for i, j in d.items():
        ans2 = min(ans2, i-j)
    print(ans2)


main()


### FIXED CODE ###

def main():
    S = input()
    size = [[[[0, 0]], []], [[], []]]
    length = 0

    for s in S:
        size2 = [[[], []], [[], []], [[], []]]
        if s != "0":
            for i in range(2):
                for j in range(2):
                    if size[i][j]:
                        for x, y in size[i][j]:
                            if y == length+i:
                                size2[i+1][j ^ 1].append([y+1, y+1])
                                if x != y:
                                    size2[i][j ^ 1].append([x+1, y-1])
                            else:
                                size2[i][j ^ 1].append([x+1, y+1])
        if s != "1":
            for i in range(2):
                for j in range(2):
                    if size[i][j]:
                        for x, y in size[i][j]:
                            if x == 0:
                                size2[i+1][j].append([0, 0])
                                if x != y:
                                    size2[i][j ^ 1].append([x+1, y-1])
                            else:
                                size2[i][j ^ 1].append([x-1, y-1])
        if len(size2[0][0]+size2[0][1]) == 0:
            size2 = size2[1:]
            length += 1
        else:
            size2.pop()
        for i in range(2):
            for j in range(2):
                size2[i][j] = sorted(size2[i][j])
        size = [[[], []], [[], []]]
        for i in range(2):
            for j in range(2):
                if len(size2[i][j]) == 0:
                    continue
                elif len(size2[i][j]) == 1:
                    size[i][j] = size2[i][j]
                    continue
                size[i][j] = [size2[i][j][0]]
                for x, y in size2[i][j][1:]:
                    p, q = size[i][j][-1]
                    if y <= q:
                        continue
                    if x <= q+2:
                        size[i][j][-1][1] = y
                    else:
                        size[i][j].append([x, y])
    print(length)


main()
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n - k + 1):
  b.append(1)
  for j in range(k):
    b[i] *= a[i+j]
    if b[i] > b[i-1]:
      print("Yes")
      break
  if b[i] <= b[i-1] and i != 0:
    print("No")

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [1] * (n-k+1)
for i in range(n-k):
  if a[k+i] > a[i]:
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

n, k = map(int, input().split())
h = [0] + list(map(int, input().split())) # index調整
dp = [0] * (n+1)

for i in range(2,n+1):
    start = max(1,i-k)
    dp[i] = min(list(map(lambda x,y:x+y, dp[start:i], list(map(lambda x:abs(h[i]-x), h[start:i])))))            
print(dp[n])

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
h = np.array([0] + list(map(int, input().split()))) # index調整
dp = np.zeros(n+1,dtype=np.int)

for i in range(2,n+1):
    start = 1 if i - k < 1 else i - k
    dp[i] = min((dp[start:i]+np.abs(h[i]-h[start:i])))            
print(dp[n])
### BUGGY CODE ###

N, M = map(int, input().split())

ac = []
wa = {str(i): 0 for i in range(1, N + 1)}

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC":
        ac.append(p_i)
    elif s_i == "WA" and p_i not in ac:
        wa[p_i] += 1
                
ac = set(ac)
wa = [count for p_i, count in wa.items() if p_i in ac]

print(len(ac), sum(wa))

### FIXED CODE ###

N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import math
n = int(input())
a = list(map(int, input().split()))
res = 1 
if min(a) == 0:
  res = 0
else:
  for i in range(n):
    res *= a[i]
    if res > 1000000000000000000:
      res = -1
      continue
print(res)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import math
n = int(input())
a = list(map(int, input().split()))
res = 1 
if 0 in a:
  res = 0
else:
  for num in a:
    res *= num
    if res > 10**18:
      res = -1
      break
print(res)
### BUGGY CODE ###

import numpy as np

N = int(input())
A_list = map(int, input().split())

# [活発度, もとの番号] のリストを降順に並べる
A_list = [[A, index] for index, A in enumerate(A_list)]
A_list.sort(reverse=True)

# print(A_list)

dp = [[0 for i in range(N+1)] for j in range(N+1)]

# right = 0
for left in range(N):
    activity = A_list[left][0]
    distance_from_left = abs(left - A_list[left][1])
    dp[left + 1][0] = dp[left][0] + activity * distance_from_left

# left = 0
for right in range(N):
    activity = A_list[right][0]
    distance_from_right = abs(N - 1 - right - A_list[right][1])
    dp[0][right + 1] = dp[0][right] + activity * distance_from_right

for left in range(1, N + 1):
    for right in range(1, N - left + 1):
        activity = A_list[left + right - 1][0]
        distance_from_left = abs((left - 1) - A_list[left + right - 1][1])
        distance_from_right = abs((N - right) - A_list[left + right - 1][1])
        score_if_appended_to_left\
            = dp[left - 1][right] + activity * distance_from_left
        score_if_appended_to_right\
            = dp[left][right - 1] + activity * distance_from_right
        dp[left][right] = max(score_if_appended_to_left,
                              score_if_appended_to_right)
        # print(dp)
print(np.max(dp))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
table = []
 
for i, a in enumerate(A):
    table.append([a,i])
table.sort()
 
# DP[i][j] 左端に i 個, 右端に j 個貪欲に詰めたときのうれしさ
DP = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(1,N+1):
    # i 人目 table[i-1] の幼児を移動させる
    baby, pos = table.pop()
    
    DP[i][0] = DP[i-1][0] + baby * abs(pos-i+1)
    DP[0][i] = DP[0][i-1] + baby * abs(pos-(N-i))
    for x in range(1,i):
        y = i - x
 
        #左端に置く場合と右端に置く場合でmax
        DP[x][y] = max(DP[x-1][y] + baby * abs(pos-x+1),\
                     DP[x][y-1] + baby * abs(pos-(N-y)))
 
ans = 0
for i in range(N+1):
    ans = max(ans, DP[i][N-i])
print(ans)
### BUGGY CODE ###

import math

N = int(input())
a = [int(input()) for _ in range(N)]
s = sum(a)

# Calculate counts of (R >= s / 2)
dp = [[0 for _ in range(s + 1)] for _ in range(N + 1)]
for i in range(N + 1):
    for j in range(s + 1):
        if i == 0:
            dp[i][j] = 1 if j == 0 else 0
        else:
            dp[i][j] = dp[i - 1][j] * 2 + (dp[i - 1][j - a[i - 1]] if j >= a[i - 1] else 0)
c0 = sum(dp[N][math.ceil(s / 2):s+2])

# Calculate counts of (R == s / 2 and G == s / 2)
dp = [[0 for _ in range(s // 2 + 1)] for _ in range(N + 1)]
for i in range(N + 1):
    for j in range(s // 2 + 1):
        if i == 0:
            dp[i][j] = 1 if j == 0 else 0
        else:
            dp[i][j] = dp[i - 1][j] + (dp[i - 1][j - a[i - 1]] if j >= a[i - 1] else 0)
c1 = dp[N][s // 2] if s % 2 == 0 else 0

ans = (3 ** N - 3 * c0 + 3 * c1) % 998244353
print(ans)

### FIXED CODE ###

import math
import numpy as np

N = int(input())
a = np.array([int(input()) for _ in range(N)])
s = np.sum(a)

# Counts of (R >= s / 2)
dp0 = np.zeros((N + 1, s + 1))
dp0[0, 0] = 1
# Counts of (R == s / 2 and G == s / 2)
dp1 = np.zeros((N + 1, s // 2 + 1))
dp1[0, 0] = 1

mod = 998244353
for i, x in enumerate(a):
    dp0[i + 1, :] += dp0[i, :] * 2 % mod
    dp0[i + 1, x:] += dp0[i, :-x] % mod
    dp1[i + 1, :] += dp1[i, :] % mod
    dp1[i + 1, x:] += dp1[i, :-x] % mod

c0 = int(np.sum(dp0[N][math.ceil(s / 2):]))
c1 = int(dp1[N][s // 2]) if s % 2 == 0 else 0

ans = (3 ** N - 3 * c0 + 3 * c1) % mod
print(ans)
### BUGGY CODE ###

import itertools
from collections import Counter

def SUMCHK():
    N = int(input())
    S = input()

    C=Counter(S)
    r = C['R']
    g = C['G']
    b = C['B']


    cnt = r * g * b

    sum = 0
    for i in range(0,N-2):
        for j in range(i,N-1):
            for k in range(j,N):
                if j - i == k - j:
                    if (S[i] != S[j]) and (S[i] != S[k] and S[j] != S[k]):
                        sum += 1
                        break

    cnt -= sum

    print(cnt)

SUMCHK()

### FIXED CODE ###

import itertools
from collections import Counter

N = int(input())
S = input()

C=Counter(S)
r = C['R']
g = C['G']
b = C['B']


cnt = r * g * b

for i in range(0,N-2):
    for j in range(i,N-1):
        k = j + j - i
        if k < N:
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                cnt -= 1

print(cnt)
### BUGGY CODE ###

import itertools
L, R = map(int, input().split())
 
remainder_list = [N%2019 for N in range(L, R+1)]
all_list = [(i*j)%2019 for i, j in list(itertools.combinations(remainder_list, 2))]
print(min(all_list))

### FIXED CODE ###

import itertools
L, R = map(int, input().split())

if R - L + 1 > 2019:
    remainder_list = [N%2019 for N in range(L, L+2019)]
else:
    remainder_list = [N%2019 for N in range(L, R+1)]  
remainder_list = list(set(remainder_list))
all_list = [(i*j)%2019 for i, j in list(itertools.combinations(remainder_list, 2))]
print(min(all_list))
### BUGGY CODE ###

n,q = map(int,input().split())
s = input()

for i in range(q):
    x,y = map(int, input().split())
    
    print(s[x-1:y].count("AC"))

### FIXED CODE ###

n,q = map(int,input().split())
s = input()

li = [0]*(n)
ans = 0

for i in range(n-1):
    if s[i:i+2] == "AC":
        ans += 1
    li[i+1] = ans

for i in range(q):
    x,y = map(int,input().split())
    print(li[y-1] - li[x-1])
### BUGGY CODE ###

def main():
    s = input()
    n = len(s)
    modlis = [0 for i in range(2019)]
    modlis[0]=1
    t = 0
    for i in range(n):
        t = (t+int(s[n-1-i])*10**i)%2019
        modlis[t]+=1

    ans = 0
    for i in range(2019):
        ans += (modlis[i]*(modlis[i]-1))//2
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    s = input()
    n = len(s)
    modlis = [0 for i in range(2019)]
    modlis[0]=1
    t = 0
    m = 1
    for i in range(n):
        t = (t+int(s[n-1-i])*m)%2019
        m = m*10%2019
        modlis[t]+=1

    ans = 0
    for i in range(2019):
        ans += (modlis[i]*(modlis[i]-1))//2
    print(ans)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

from itertools import permutations

N, M, R = map(int,input().split())
r = [i - 1 for i in map(int,input().split())]

d = [[float('inf')] * N for _ in range(N)]

for i in range(N):
    d[i][i] = 0

for i in range(M):
    a, b, c = map(int,input().split())
    d[a - 1][b - 1] = c
    d[b - 1][a - 1] = c

for k in range(N):
    for i in range(N):
        for j in range(N):
            if d[i][j] > d[i][k] + d[k][j]:
                d[i][j] = d[i][k] + d[k][j]

ans = 10 ** 12

for each in permutations(r):
    t_dis = 0
    for i in range(R - 1):
        t_dis += d[each[i]][each[i + 1]]

    ans = min(ans, t_dis)

print(ans)


### FIXED CODE ###

from itertools import permutations

N, M, R = map(int,input().split())
r = [i - 1 for i in map(int,input().split())]

d = [[float('inf')] * N for _ in range(N)]

for i in range(N):
    d[i][i] = 0

for i in range(M):
    a, b, c = map(int,input().split())
    d[a - 1][b - 1] = c
    d[b - 1][a - 1] = c

for k in range(N):
    for i in range(N):
        for j in range(N):
            if d[i][j] > d[i][k] + d[k][j]:
                d[i][j] = d[i][k] + d[k][j]

ans = 10 ** 12

for each in permutations(r):
    t_dis = 0
    for i in range(R - 1):
        t_dis += d[each[i]][each[i + 1]]

    ans = min(ans, t_dis)

print(ans)
### BUGGY CODE ###

import sys

input = sys.stdin.readline
n, m = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(m)]
BC.sort(key=lambda x: -x[1])

extend = A.extend
[extend([ls[1]] * ls[0]) for ls in BC]
A.sort(reverse=True)

print(sum(A[:n]))

### FIXED CODE ###

import sys

input = sys.stdin.readline
n, m = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(m)]
BC.sort(key=lambda x: -x[1])

maxi = n*2
extend = A.extend
[extend([ls[1]] * ls[0]) for ls in BC if len(A) <= maxi]
A.sort(reverse=True)

print(sum(A[:n]))
### BUGGY CODE ###

def calculate(n, m, id_list):
  result = 0
  for i in range(1, n+1):
    is_passed = True
    for id_list_index in range(0, m):
      if not((i >= id_list[id_list_index][0]) and (i <= id_list[id_list_index][1])) :
        is_passed = False
        break
        
    if is_passed:
      result = result + 1
    
  return result
  
  
import sys
 
n=0
m=0
id_list=[]
is_arg_ok = False
try:
  n, m  = map(int, input().split())
  for i in range(0, m):
    gate_min, gate_max = map(int, input().split())
    id_list.append([gate_min, gate_max])
  is_arg_ok = True
  
except:
  print('arg error')
  sys.exit(1)
 
calculated_num = calculate(n, m, id_list)
print(calculated_num)
sys.exit(0)

### FIXED CODE ###

import sys
n=0
m=0

n, m  = map(int, input().split())
_min, _max  = map(int, input().split())
for i in range(1, m):
  gate_min, gate_max = map(int, input().split())
  if (_max > gate_max):
    _max = gate_max
   
  if _min < gate_min:
    _min = gate_min
 
result_list = list(filter(lambda x : (_min <= x) and (x <= _max), range(1, n+1)))
result = len(result_list)

print(result)
sys.exit(0)
### BUGGY CODE ###

from heapq import heappush, heappop, merge
from collections import defaultdict, deque

N, Q = map(int, input().split())
events = []
for _ in range(N):
    s, t, x = map(int, input().split())
    events.append((s-x, 1, x))
    events.append((t-x, -1, x))
events = deque(sorted(events))
D = [int(input()) for _ in range(Q)]

constructions = []
under_construction = defaultdict(bool)
ans = ''
for d in D:
    while events:
        if events[0][0] > d:
            break
        _, flag, coord = events.popleft()            
        if flag > 0:
            heappush(constructions, coord)
            under_construction[coord] = True
        else:
            under_construction[coord] = False
    while constructions:
        x = heappop(constructions)
        if under_construction[x]: # x is the minimum coordinate under construction
            heappush(constructions, x)
            ans += str(x) + '\n'
            break
    else: # no constructions
        ans += '-1\n'
print(ans)

### FIXED CODE ###

from heapq import heappush, heappop, merge
from collections import defaultdict
import sys
F = sys.stdin
def single_input(): return F.readline().strip("\n")
def line_input(): return F.readline().strip("\n").split()

def solve():
    N, Q = map(int, line_input())
    events = []
    for _ in range(N):
        s, t, x = map(int, line_input())
        events.append((s-x, 1, x))
        events.append((t-x, -1, x))
    for _ in range(Q):
        d = int(single_input())
        events.append((d, 2, d))
    events = sorted(events)

    constructions = []
    under_construction = defaultdict(bool)
    ans = ''
    for _, flag, coord in events:
        if flag == 1:
            heappush(constructions, coord)
            under_construction[coord] = True
        elif flag == -1:
            under_construction[coord] = False
        else:
            while constructions:
                x = heappop(constructions)
                if under_construction[x]: # x is the minimum coordinate under construction
                    heappush(constructions, x)
                    ans += str(x) + '\n'
                    break
            else: # no constructions
                ans += '-1\n'
    print(ans)
    
if __name__ == "__main__":
    solve()
### BUGGY CODE ###

N, M, Q = map(int, input().split())

LR = [[0 for i in range(2)] for j in range(M)]
pq = [[0 for i in range(2)] for j in range(Q)]

for i in range(M):
    LR[i] = list(map(int, input().split()))

for i in range(Q):
    pq[i] = list(map(int, input().split()))

x = [[0 for i in range(N)] for j in range(N)]

# print(LR[0][0])

for i in range(M):
    # x[LR[i][1] - 1][LR[i][0] - 1] = x[LR[i][1] - 1][LR[i][0] - 1] + 1
    x[LR[i][1] - 1][LR[i][0] - 1] += 1

xacu = [[0 for i in range(N)] for j in range(N)]

for i in range(N):
    for j in range(N):
        if j == 0:
            xacu[i][j] = x[i][j]
        else:
            xacu[i][j] = xacu[i][j - 1] + x[i][j]

# print(xacu)

for i in range(Q):
    count = 0
    p = pq[i][0]
    for j in range(pq[i][1]):
        if p == 1:
            count = count + xacu[j][N - 1]
        else:
            count = count + xacu[j][N - 1] - xacu[j][p - 2]

    print(count)


### FIXED CODE ###

N, M, Q = map(int, input().split())

x = [[0 for i in range(N + 1)] for j in range(N + 1)]

for i in range(M):
    l, r = map(int, input().split())
    x[l][r] += 1

for i in range(1, N + 1):
    for j in range(1, N + 1):
        x[i][j] += x[i - 1][j] + x[i][j - 1] - x[i - 1][j - 1]

for i in range(Q):
    p, q = map(int, input().split())

    ans = x[N][q] - x[p - 1][q]
    print(ans)
### BUGGY CODE ###

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

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    

dots = XY[:]

import sys
INT_MAX = sys.maxsize

ans = INT_MAX

import itertools
for left_d, right_d in itertools.permutations(dots, 2):
    if left_d[0] < right_d[0]:
        left_x = left_d[0]
        right_x = right_d[0]
    else:
        left_x = right_d[0]
        right_x =  left_d[0]
    
    for under_d, top_d in itertools.permutations(dots, 2):
        if under_d[1] < top_d[1]:
            under_y = under_d[1]
            top_y = top_d[1]
        else:
            under_y = top_d[1]
            top_y = under_d[1]
            
        counter = 0
        for d in dots:
            if  (left_x <= d[0]) and (d[0] <= right_x) and (under_y <= d[1]) and (d[1] <= top_y):
                counter += 1
                
        if counter >= K:
            area = (top_y-under_y) * (right_x-left_x)
            ans = min(ans, area)    
print(ans)

### FIXED CODE ###

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

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    
dots = XY[:]

import sys
INT_MAX = sys.maxsize

ans = INT_MAX

import itertools
for ((left_x, _), (right_x, _)) in itertools.combinations(dots, 2):
    if left_x > right_x:
        left_x, right_x = right_x, left_x
    for ((_, under_y), (_, top_y)) in itertools.combinations(dots, 2):
        if under_y > top_y:
            under_y, top_y = top_y, under_y
        counter = 0
        for d_x, d_y in dots:
            if  (left_x <= d_x) and (d_x <= right_x) and (under_y <= d_y) and (d_y <= top_y):
                counter += 1
                
        if counter >= K:
            area = (top_y-under_y) * (right_x-left_x)
            if ans > area:
                ans = area
            
print(ans)
### BUGGY CODE ###

def main(S=None):
    if not S:
        S = input()
    r = [0]*2019
    r[0] = 1
    tmp = 0
    base = 1
    for s in S[::-1]:
        s = int(s) * base
        base *= 10
        tmp += s
        tmp %= 2019
        r[tmp] += 1
    count = 0
    for v in r:
        count += v*(v-1)//2
    print(count)
    return count


if __name__ == "__main__":
    # assert main("1817181712114") == 3
    # assert main("14282668646") == 2
    # assert main("2119") == 0
    main()


### FIXED CODE ###

def main(S=None):
    if not S:
        S = input()
    r = [0]*2019
    r[0] = 1
    tmp = 0
    base = 1
    for s in S[::-1]:
        s = int(s) * base
        base *= 10
        base %= 2019
        tmp += s
        tmp %= 2019
        r[tmp] += 1
    count = 0
    for v in r:
        count += v*(v-1)//2
    print(count)
    return count


if __name__ == "__main__":
    # assert main("1817181712114") == 3
    # assert main("14282668646") == 2
    # assert main("2119") == 0
    main()
### BUGGY CODE ###

def main():
    S = input()
    N = len(S)
    K = int(input())

    S1 = {}
    for i, s in enumerate(S):
        if not s in S1.keys():
            S1[s] = [i]
        else:
            S1[s].append(i)
    alp = sorted(list(S1.keys()))

    c = 0
    for a in alp:
        aset = set()
        inds = S1[a]
        for d in inds:
            for i in range(N-d+1):
                aset.add(S[d:d+i])
        L = len(aset)-1
        if L >= K-c:
            break
        c += L

    for _ in range(10):
        min = '何だこれはもうやめてくれよ'
        for a in aset:
            if a < min:
                min = a
        aset.discard(min)
        if min == '':
            continue
        c += 1
        if c >= K:
            ans = min
            break

    print(ans)



if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    S = input()
    N = len(S)
    K = int(input())

    S1 = {}
    for i, s in enumerate(S):
        if not s in S1.keys():
            S1[s] = [i]
        else:
            S1[s].append(i)
    alp = sorted(list(S1.keys()))

    c = 0
    for a in alp:
        aset = set()
        inds = S1[a]
        for d in inds:
            up = min(N-d+1, K+1)
            for i in range(up):
                aset.add(S[d:d+i])
        L = len(aset)-1
        if L >= K-c:
            break
        c += L

    for _ in range(10):
        M = '何だこれはもうやめてくれよ'
        for a in aset:
            if a < M:
                M = a
        aset.discard(M)
        if M == '':
            continue
        c += 1
        if c >= K:
            ans = M
            break

    print(ans)



if __name__=='__main__':
    main()
### BUGGY CODE ###

N,K = input().split()
H = input().split()

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

for i in range(int(times)):

    H.pop(H.index(max(H)))

H = [int(i) for i in H]

print(sum(H))

### FIXED CODE ###

enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = list(map(int,input().split()))

enemyHp.sort()

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0

if killerTimeK >= enemmyCountN:
    print(0)

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