Harryxun/stf_run huggingface dataset:
N,K=map(int,input().split())
L=list(map(int,input().split()))
L=sorted(L)
if K==0:
  print(sum(L))
else:
	print(sum(L[:-K]))


### FIXED CODE ###

N=int(input())
cnt=0
while N>0:
  N//=2
  cnt=cnt*2+1
print(cnt)
import numpy as np

n, m = map(int, input().split())

a = np.array(list(map(int, input().split())))
lcm = np.lcm.reduce(a)

half_lcm = lcm / 2
ans = 0
while True:
    if not sum((half_lcm * 2) % a):
        flg = True
        break

    half_lcm += lcm
    if half_lcm > m:
        break

if flg:
    ans = (m - half_lcm) // lcm + 1

print(int(ans))

### FIXED CODE ###

import functools
import sys

n, m = map(int, input().split())
a = list(map(lambda x: x // 2, map(int, input().split())))

# A[0]を素因数分解して2で割り切れる回数を数える
div = 0

a_0 = a[0]
while a_0 % 2 == 0:
    a_0 /= 2
    div += 1

# print("count = " + str(div))#

# Aのすべての整数がA[0]と同じ回数2で割り切れるか調べる
for i in range(1, len(a)):
    div2 = 0
    tmp_a = a[i]
    while tmp_a % 2 == 0:
        tmp_a /= 2
        div2 += 1
    # print("A[" + str(i) + "] count = " + str(div2))#
    if div2 != div:
        print("0")
        sys.exit()


def gcd(x, y):
    if x == 0:
        return y

    return gcd(y % x, x)


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x * y // gcd(x, y)
    return functools.reduce(lcm, iter)


lc = least_common_multiple(a)
ans = 0
a = 1

ans = m // lc
if ans == 0:
    print(0)
    sys.exit()
if ans % 2 == 0:
    print(ans // 2)
else:
    print(ans // 2 + 1)
s = input()
t = input()
s = sorted(s)
t = sorted(t, reverse=1)
if s<t:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

a,b = map(int, input().split())
s = (a+b)//2
if (a+b)%2:
  print(s+1)
else:
  print(s)
import sys
sys.setrecursionlimit(999999999)
from functools import lru_cache
@lru_cache(maxsize=32)
def solve(cnt,nokori):
    if nokori<6:
        return cnt+nokori

    for six in range(10,-1,-1):
        if 6**six <= nokori:
            break
    for nine in range(10,-1,-1):
        if 9**nine <= nokori:
            break

    res1 = solve(cnt+1,nokori-6**six)
    if nine != 0:
        res2 = solve(cnt+1,nokori-9**nine)
    else:
        res2=10**9

    return min([res1,res2])

print(solve(0,n))

### FIXED CODE ###

n = int(input())

import sys
sys.setrecursionlimit(999999999)
from functools import lru_cache
@lru_cache(maxsize=32)
def solve(cnt,nokori):
    if nokori<6:
        return cnt+nokori

    for six in range(10,-1,-1):
        if 6**six <= nokori:
            break
    for nine in range(10,-1,-1):
        if 9**nine <= nokori:
            break

    res1 = solve(cnt+1,nokori-6**six)
    if nine != 0:
        res2 = solve(cnt+1,nokori-9**nine)
    else:
        res2=10**9

    return min([res1,res2])

print(solve(0,n))
k,n=input().split()
n=int(n)
k=int(k)
s=input()
n=n-1
print(f"{s[:n]}{chr(ord(s[n])+32)}{s[n+1:]}")

### FIXED CODE ###

n,K=input().split()
n=int(n)
K=int(K)
S=input()
print(S[:(K-1)]+chr(ord(S[K-1])+32)+S[(K):])
n = list(input())
if list[0] == list[1] == list[2] or list[1] == list[2] == list[3]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = list(input())
if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
    print('Yes')
else:
    print('No')
from itertools import permutations

n, m = map(int, input().split())
paths = set()

for i in range(n) :
    _a, _b = map(int, input().split())
    paths.add((_a, _b))
    paths.add((_b, _a))
    
# print(sum(all(s in paths for s in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))



### FIXED CODE ###

from itertools import permutations

n, m = map(int, input().split())
paths = set()

for i in range(m) :
    _a, _b = map(int, input().split())
    paths.add((_a, _b))
    paths.add((_b, _a))
    
print(sum(all(s in paths for s in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    for j in range(l + i, r + 1):    
    res.append((i * j) % 2019)
  if(3 in res and 673 in res):
    print(0)
  else:
    print(res[0] * res[1])


### FIXED CODE ###

l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append(i % 2019)
  res.sort()
  ans = 2019 * 2019
  for hoge in res:
    for fuga in res:
      if(hoge != fuga and ans > ((hoge * fuga) % 2019)):
        ans = (hoge * fuga) % 2019
  print(ans)
N = int(input())
C = list(input())
ans = 0
r = 0
l = N - 1
while r+1 < l or r < N - 1:
    if C[r] == 'W':
        while True:
            if C[l] == 'R':
                ans += 1
                l -= 1
                break
            else:
                l -= 1
                if r+1 == l:
                    break
    r += 1
print(ans)

### FIXED CODE ###

N = int(input())
C = list(input())
ans = 0
r = 0
l = N - 1
while r < l:
    if C[r] == 'W':
        while True:
            if C[l] == 'R':
                ans += 1
                l -= 1
                break
            else:
                l -= 1
                if r == l:
                    break
    r += 1
print(ans)
a = list(map(int, input().split()))
if a[0]%2==0 || a[1]%2==0 :
  print("Even")
else:
  print("Odd")	

### FIXED CODE ###

a = list(map(int,input().split()))
if (a[0]%2==0) or (a[1]%2==0) :
  print("Even")
else:
  print("Odd")
W, H, x, y = map(int,input().split())
duplicate = 1 if W/x==2 and H/y==2 else 0
x_min = min((W-x)*H, x*H)
y_min = min(W*(H-y), W*y)
area = max(x_min, y_min)
print(area, duplicate)


### FIXED CODE ###

W,H,x,y = map(int,input().split())
scale = W*H/2
div = 0
if x==W/2 and y==H/2:
  div = 1
print(scale,div)
n = int(input())
aas = list(set(sorted(list(map(int, input().split())))))
if len(aas) == 1:
    print(0)
    exit()
#aas_max = aas[-1]
i = 0
while i != len(aas):
    j = i + 1
    while j != len(aas):
        if aas[j]%aas[i] == 0:
            del aas[j]
        else:
            j += 1
    i += 1
print(len(aas))

### FIXED CODE ###

n = int(input())
aas = sorted(list(map(int, input().split())))
aas_len = len(aas)
if aas_len == 1:
    print(1)
    exit()
aas_max = aas[-1]
arr = [1]*(aas_max+1)
for i in range(aas_len):
    if arr[aas[i]] == 0:
        continue
    if arr[aas[i]] == 1:
        arr[aas[i]] = 2
    else:
        arr[aas[i]] = 0
        continue
    idx = aas[i]*2
    while idx <= aas_max:
        arr[idx] = 0
        idx += aas[i]
res = 0
for i in aas:
    if arr[i] != 0:
        res += 1
print(res)
#coding:utf-8
n1, n2, n3, n4 = map(str, input().split())
n = ''.join(n1, n2, n3, n4)

if '1'.count(n) == 1 and '9'.count(n) == 1 and '7'.count(n) == 1 and '4'.count(n) == 1:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

#coding:utf-8
n = input().split()

if '1' in n and '9' in n and '7' in n and '4' in n:
  print('YES')
else:
  print('NO')
A,B=map(int,input().split)
x=[A+B,A-B,A*B]
print(max(x))

### FIXED CODE ###

A,B=map(int,input().split())
x=[A+B,A-B,A*B]
print(max(x))
#%%
import math 

a, b, x = map(int, input().split())
if x >= a*a*b/2:
    y = 2*(b-x/(a**2))
    ans = math.degrees(math.atan(a/y))
    print(90 - ans)
else:
    y = 2*(x/(a*b))
    ans = math.degrees(math.atan(y/b))
    print(90 - ans)

### FIXED CODE ###

#%%
import math 

a, b, x = map(int, input().split())
if x == a*a*b:
    print(0)
elif x >= a*a*b/2:
    y = 2*(b-x/(a**2))
    ans = math.degrees(math.atan(a/y))
    print(90 - ans)
else:
    y = 2*(x/(a*b))
    ans = math.degrees(math.atan(y/b))
    print(90 - ans)
A, B, C = str(input())
D = int(input())

if D >= A + C:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A, B, C, D = map(int, input().split())

if abs(A - C) <= D:
    print("Yes")
elif abs(A - B) <= D and abs(B - C) <= D:
    print("Yes")
else:
    print("No")
w,h,x,y,r = map(int, input().split())

a = "n"

if (x > r) and (y > r):
    if(x+r < w) and (y+r < h):
        a = "y"


if a = "y":
    print("Yes")
else:
    print("No")



### FIXED CODE ###

w,h,x,y,r = map(int, input().split())

a = True

if x < r or w - r < x :
    a = False

if y < r or h - r < y :
    a = False


if a:
    print("Yes")
else:
    print("No")
import sys

y = sys.stdin.readline()
y = int(y)

x = sys.stdin.readline()

x_list = x.split(" ")

for i in range(y):
  x_list[i] = int(x_list[i])

for i in range(1, y):
  if x_list[i] < x_list[i - 1]:
    for j in range(0, i - 1):
      if x_list[j] > x_list[i]:
        temp = x_list[i]
        for p in range(0, i):
          q = i - p
          x_list[q] = x_list[q - 1]
        x_list[j+1] = temp
      elif x_list[0] > x_list[i]
        for p in range(0, i):
          q = i - p
          temp = x_list[i]
          x_list[q] = x_list[q - 1]
        x_list[0] = temp
  for k in range(0, y):
    print x_list[k],
  print " "

### FIXED CODE ###

import sys

def insertionSort(x_list,y):
  for i in range(1, y):
    v = x_list[i]
    j = i - 1
    while j >= 0 and x_list[j] > v:
      x_list[j + 1] = x_list[j]
      j -= 1
    x_list[j+1] = v
    for k in range(0, y):
      print x_list[k],
    print

y = sys.stdin.readline()
y = int(y)

x = sys.stdin.readline()

x_list = x.split(" ")

for i in range(y):
  x_list[i] = int(x_list[i])

for k in range(0, y):
  print x_list[k],
print

insertionSort(x_list, y)
costs = [2,5,5,4,5,6,3,7,6]

N, M = map(int, input().split())
A = list(map(int, input().split()))
neginf = -1 * 1e20
D = [neginf]*(N+1)

def dp(n_match):
    D[0] = 0
    for n in range(1,n_match+1):
        arr = [D[n-costs[a-1]] if n-costs[a-1]>=0 else neginf for a in A]
        D[n] = max(arr)+1

def main():
    if N==0:
        print('0')
        return
    dp(N)
    n = N
    ans = ''
    while n>0:
        for a in A:
            arr = [a for a in A if D[n-costs[a-1]]==D[n]-1]
        a = max(arr)
        ans += str(a)
        n -= costs[a-1]
    print(ans)
    return

main()

### FIXED CODE ###

costs = [2,5,5,4,5,6,3,7,6]

N, M = map(int, input().split())
A = list(map(int, input().split()))
neginf = -1 * 1e20
D = [neginf]*(N+1)

def dp(n_match):
    D[0] = 0
    for n in range(1,n_match+1):
        arr = [D[n-costs[a-1]] if n-costs[a-1]>=0 else neginf for a in A]
        D[n] = max(arr)+1

def main():
    dp(N)
    n = N
    ans = ''
    while n>1:
        arr = [ a for a in A if  n-costs[a-1]>=0 and D[n-costs[a-1]]==D[n]-1 ]
        if len(arr)>0:
            a = max(arr)
            ans += str(a)
            n -= costs[a-1]
        else:
            break
    print(ans)

main()
#coding:utf-8
n = int(input())
num = len(str(n))
tmp = pow(10, num)-1
s = 0
for i in range(num+1):
    if i == num:
        s = sum(list(map(int, str(tmp-9*pow(10, num-1)+(int(str(n)[0])-1)*pow(10, num-1)))))
        break
    elif tmp-pow(10, i) <= n:
        s = sum(list(map(int, str(tmp-pow(10, i)))))
        break
if sum(list(map(int. str(n)))) > s:
    print(sum(list(map(int. str(n)))))
else:
    print(s)

### FIXED CODE ###

#coding:utf-8
n = int(input())
num = len(str(n))
tmp = pow(10, num)-1
s = 0
for i in range(num+1):
    if i == num:
        s = sum(list(map(int, str(tmp-9*pow(10, num-1)+(int(str(n)[0])-1)*pow(10, num-1)))))
        break
    elif tmp-pow(10, i) <= n:
        s = sum(list(map(int, str(tmp-pow(10, i)))))
        break
if sum(list(map(int, str(n)))) > s:
    print(sum(list(map(int, str(n)))))
else:
    print(s)
a,b,c,d = map(int, raw_input().split())
if abs(a-c)<=d:
    print("yes")
else:
    if abs(a-b)<=d and abs(b-c)<=d:
        print("yes")
    else:
        print("no")


### FIXED CODE ###

a,b,c,d = map(int, input().split())

if abs(a-c)<=d:
    print("Yes")
else:
    if abs(a-b)<=d and abs(b-c)<=d:
        print("Yes")
    else:
        print("No")
for word in s:
    try:
        dic[word]+=1
    except:
        dic[word]=1

m=0
l=0
for word, e in dic.items():
   if e>m:
       m=e
       w1=word
   if len(word)>l:
       l=len(word)
       w2=word

print w1, w2

### FIXED CODE ###

s = raw_input().split()
c1 = 0
c2 = 0
for w in set(s):
    c=s.count(w)
    if c>c1: c1,w1 = c,w
    c=len(w)
    if c>c2: c2,w2 = c,w
print w1, w2
if a*b%2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a,b = list(map(int, input().split()))
if a*b%2 == 0:
  print("Even")
else:
  print("Odd")
N = int(input())
h = list(map(int, input.split()))

MAX_COST = 1001001001

cost_dp = [MAX_COST for _ in range(N)]

cost_dp[0] = 0

for i in range(N):
  if i == 1:
    cost_dp[1] = cost_dp[0] + abs(h[1] - h[0])
  else:
    cost_dp[i] = min(cost_dp[i-1] + abs(h[i] - h[i-1]), cost_dp[i-2] + abs(h[i] - h[i-2]))

print(cost_dp[N-1])

### FIXED CODE ###

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

MAX_COST = 1001001001

cost_dp = [MAX_COST for _ in range(N)]

cost_dp[0] = 0

for i in range(N):
  if i == 0:
    continue
  elif i == 1:
    cost_dp[1] = cost_dp[0] + abs(h[1] - h[0])
  else:
    cost_dp[i] = min(cost_dp[i-1] + abs(h[i] - h[i-1]), cost_dp[i-2] + abs(h[i] - h[i-2]))

print(cost_dp[N-1])
n = input()

d = [1000 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]

def BFS(s):
  q = []
  q.append(s)
  d[s] = 0
  while q.length != 0:
    u = q.pop(0)
    for v in range(n):
      if M[u][v] == 0 and d[v] != 1000:
        d[v] = d[u] + 1
        q.append(v)
  for i in range(n):
    print i+1, d[i]

for i in range(n):
  G = map(int, raw_input().split())
  for j in range(G[1]):
    M[G[0]-1][G[2+j]-1] = 1

BFS(0)

### FIXED CODE ###

n = input()
  
d = [-1 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
color = [0 for i in range(n)]
  
def BFS(s):
  color[0] = 1
  q = []
  q.append(s)
  d[s] = 0
  while len(q) != 0:
    u = q[0]
    q.pop(0)
    for v in range(n):
      if M[u][v] == 1 and color[v] == 0:
        color[v] = 1
        d[v] = d[u] + 1
        q.append(v)
  color[u] = 2
  for i in range(n):
    print i+1, d[i]
  
for i in range(n):
  G = map(int, raw_input().split())
  for j in range(G[1]):
    M[G[0]-1][G[2+j]-1] = 1
  
BFS(0)
import copy
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [1] * n
for _ in range(math.log(n)):
    for i in range(n):
        light = 0
        for j in range(n):
            if i < j:
                if (j - a[j] - 0.5) < i:
                    light += 1
            else:
                if (j + a[j] + 0.5) > i:
                    light += 1
        b[i] = light
    a = copy.deepcopy(b)
print(a)

### FIXED CODE ###

# ac
import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit('(i8[::1],)', cache=True)
def update(a):
    n = len(a)
    b = np.zeros_like(a)       # aと同じ形状の配列を生成(https://deepage.net/features/numpy-zeros.html)
    for i, x in enumerate(a):  # enumerateはindex, valueを返す
        l = max(0, i - x)      # lampの照らす範囲の下限（左側）
        r = min(n - 1, i + x)  # lampの上限（右側）
        b[l] += 1              # 以下imos法
        if r + 1 < n:          # r+1はx=nの時（最後のサイクル）r+1=nでindexの指定に失敗するから弾く（indexは0~n-1）
            b[r + 1] -= 1
    b = np.cumsum(b)           # bの要素の累積和（フィボナッチ数列みたいな）（imos法の締め）
    return b


n, k = map(int, readline().split())
a = np.array(read().split(), np.int64)

k = min(k, 41)                 # 今回の制限範囲のnなら41回も試行すればaの値が全て上限に達するのでそれ以上の試行は不要（解説PDF）
for _ in range(k):
    a = update(a)
print(' '.join(map(str, a)))   # joinメソッドはstrを''で区切って連結する
N,W=int(input())
Wlist=[]
Vlist=[]
for i in range(N):
  w,v=map(int,input().split())
  Wlist+=[w]
  Vlist+=[v]
dp=[[0 for p in range(N)] for i in range(W)]
for i in range(N):
  wi=Wlist[i]
  for j in range(W):
    if j+wi<W:
    dp[i][j+wi]=max(dp[i-1][j]+Vlist[i],dp[i][j+wi])
    else:
      break
print(max(dp[N-1]))

### FIXED CODE ###

N,W=map(int,input().split())
Wlist=[]
Vlist=[]
for i in range(N):
  w,v=map(int,input().split())
  Wlist+=[w]
  Vlist+=[v]
dp=[[0 for p in range(W+1)] for i in range(N)]
for i in range(W+1):
  if i>=Wlist[0]:
    dp[0][i]=Vlist[0]
for i in range(1,N):
  wi=Wlist[i]
  for j in range(W+1):
    if j-wi>=0:
      dp[i][j]=max(dp[i-1][j-wi]+Vlist[i],dp[i-1][j])
    else:
      dp[i][j]=max(dp[i-1][j],dp[i][j])
print(max(dp[N-1]))
while True:
    s=0
    s=input().split()
    a=s[0]
    b=s[1]
    if a=="A":
        a=10
    if a=="B":
        a=11
    if a=="C":
        a=12
    if a=="D":
        a=13

    if a=="E":
        a=14
    if a=="F":
        a=15

    if b=="A":
        b=10
    if b=="B":
        b=11
    if b=="C":
        b=12
    if b=="D":
        b=13

    if b=="E":
        b=14
    if b=="F":
        b=15

    if a>b:
        print(">")
    elif b>a:
        print("<")
    else:
        print("=")
    


### FIXED CODE ###


s=0
s=input().split()
a=s[0]
b=s[1]
if a=="A":
    a=10
if a=="B":
    a=11
if a=="C":
    a=12
if a=="D":
    a=13

if a=="E":
    a=14
if a=="F":
    a=15

if b=="A":
    b=10
if b=="B":
    b=11
if b=="C":
     b=12
if b=="D":
    b=13

if b=="E":
     b=14
if b=="F":
     b=15

if a>b:
    print(">")
if b>a:
    print("<")
if a==b:
    print("=")
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

#tempは空白の箱に過ぎず、一番最初のfor文では確定演出で問答無用にXの値になる。
#for文が2週目に突入してからが、tempの分かれ目。2回目のfor文でも一致はせず素直に3が代入される。
#最後のif文　temp == x-1 が一致するのは　１回目と2回目　or 2回目と3回目が連番。つまり-1して一致すれば連続


#満足度を記録していくための変数
cnt = 0

#1つ前に食べた料理を記録するための変数
temp = ""

#料理を食べた順番に処理していく
for x in A:
    
    #食べた料理の満足度を追加
    cnt += B[x-1]
    
    #今食べた料理が1つ前に食べた料理のi+1かどうかを確認
    if temp == x - 1:
        cnt += C[temp-1]
        
    #今食べた料理を記録    
    temp = x
#全ての料理に対して処理が終わったら満足度を出力   
print(cnt)

### FIXED CODE ###

N = int(input())

print(N**3)
n = int (raw_input())
a = map(int, raw_input().split())
a.reverse()
for i in a:
print i

### FIXED CODE ###

n = int(raw_input())
a = map(int,raw_input().split())
a.reverse()
for i in a:
    print i,
from fractions import gcd
import math
a,b,c,d = map(int,input().split())


an1 = math.floor(b/c)
an2 = math.floor((a-1)/c)
an3 = math.floor(b/d)
an4 = math.floor((a-1)/d)

gcd = round(c * d / gcd(c, d))

an5 = math.floor(b/gcd)
an6 = math.floor((a-1)/gcd)
an = an1-an2 + an3-an4 -(an5-an6)
print((b-a+1)-an)

    

### FIXED CODE ###

s = list(input())
count = 0
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        count += 1

if count > 0:
    print("Bad")
else:
    print("Good")
N,M = map(int,input().split())

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(g)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')



### FIXED CODE ###

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

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(b)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
a, b = map (int, input().split())

if a < 10 and b < 10
  print (a*b)

else:
  print (-1)

### FIXED CODE ###

a, b = map (int, input().split())

if a < 10 and b < 10:
  print (a*b)

else:
  print (-1)
from sys import stdin
N = int(stdin.readline().rstrip())
A = []
for i in range(N):
    A.append(int(input()))

A.sort()


if N % 2 != 0:
    ans1 = 0
    tmp = [-1,-1] + [2]*((N-1)//2) + [-2]*((N-2)//2)
    for i,j in zip(sorted(tmp),A):
        ans1 += (i*j)
    
    ans2 = 0
    tmp = [1,1] + [2]*((N-2)//2) + [-2]*((N-1)//2)
    for i,j in zip(sorted(tmp),A):
        ans2 += (i*j)
    print(max(ans1,ans2))
else:
    tmp = [-1,1] + [2]*((N-2)//2) + [-2]*((N-2)//2)
    for i,j in zip(sorted(tmp),A):
        ans += (i*j)
    print(ans)

### FIXED CODE ###

from sys import stdin
N = int(stdin.readline().rstrip())
A = []
for i in range(N):
    A.append(int(input()))

A.sort()


if N % 2 != 0:
    ans1 = 0
    tmp = [-1,-1] + [2]*((N-1)//2) + [-2]*((N-2)//2)
    for i,j in zip(sorted(tmp),A):
        ans1 += (i*j)
    
    ans2 = 0
    tmp = [1,1] + [2]*((N-2)//2) + [-2]*((N-1)//2)
    for i,j in zip(sorted(tmp),A):
        ans2 += (i*j)
    print(max(ans1,ans2))
else:
    ans = 0
    tmp = [-1,1] + [2]*((N-2)//2) + [-2]*((N-2)//2)
    for i,j in zip(sorted(tmp),A):
        ans += (i*j)
    print(ans)
x = input()
print(x**3)


### FIXED CODE ###

input_1 = int(input())
cal=(input_1)**3
print(cal)
N = int(input())
a = [0 for i in range(N)]
st = input().split()
for i in range(N):
  a[i] = int(st[i])
m = min(a); M = max(a)
b = [0 for i in range(M - m + 1)]
for i in range(N):
  b[a[i]-m] += 1
c = [0 for i in range(M - m + 1)]
c[0] = b[0] + b[1]
c[M - m] = b[M - m] + b[M - m - 1]
for i in range(1, M - m):
  c[i] = b[i-1] + b[i] + b[i+1]
print(max(c))


### FIXED CODE ###

N = int(input())
a = [0 for i in range(N)]
st = input().split()
for i in range(N):
  a[i] = int(st[i])
m = min(a); M = max(a)
b = [0 for i in range(M - m + 1)]
for i in range(N):
  b[a[i]-m] += 1
c = [0 for i in range(M - m + 1)]
if len(b) >= 2:
	c[0] = b[0] + b[1]
	c[M - m] = b[M - m] + b[M - m - 1]
	for i in range(1, M - m):
	  c[i] = b[i-1] + b[i] + b[i+1]
	print(max(c))
else:
  print(max(b))
#!/usr/bin/env python3
import sys
MOD = 1000000007  # type: int

def permutations_count(n, k):
    if k == 0:
        return 1
    return n * permutations_count(n-1, k-1) % MOD

def solve(N: int, K: int, a: "List[int]", b: "List[int]"):
    matrix = [[] for _ in range(N+1)]
    for i in range(N-1):
        matrix[a[i]].append(b[i])
        matrix[b[i]].append(a[i])
    
    visited = [0]*(N+1)

    from collections import deque
    queue = deque([1])
    
    answer = K
    while queue:
        q = queue.pop()
        if q == 1 and visited[q] == 0:
            answer *= permutations_count(K-1,len(matrix[1]))
        else: #q!=1 or visited==1
            if visited[q] == 0:
                answer *= permutations_count(K-2,len(matrix[q])-1) #親ノード引いてる
                answer%=MOD
            else:
                continue

        visited[q] = 1

        for child_node in matrix[q]:
            queue.append(child_node)

    print(answer%MOD)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, K, a, b)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
MOD = 1000000007  

def solve(N: int, K: int, a: "List[int]", b: "List[int]"):
    matrix = [[] for _ in range(N+1)]
    for i in range(N-1):
        matrix[a[i]].append(b[i])
        matrix[b[i]].append(a[i])
    
    visited = [0]*(N+1)

    from collections import deque
    queue = deque()
    visited[1]=1
    answer = K
    num = K-1
    for node in matrix[1]:
        answer *= num
        answer %= MOD

        num -= 1
        queue.append(node)

    while queue:
        q = queue.popleft()
        if visited[q] != 0:
            continue
        visited[q] = 1

        num = K-2
        for child_node in matrix[q]:
            if visited[child_node] == 0:
                answer *= num
                answer %= MOD
                num -= 1
                queue.append(child_node)
        answer %= MOD

    print(answer%MOD)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, K, a, b)

if __name__ == '__main__':
    main()