Harryxun/stf_run huggingface dataset:
b, c = map(int, input().split())
a = list(map(int, input().split()))
d = sum(a)
new_a = list(reversed(sorted(a)))
e = 0
f = 0
g = 4*c
while new_a[e] >= d/g:
    e = e+1
    if e == n:
        break
    f = f+1
if f >= c:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n, m = map(int, input().split())
ai = list(map(int, input().split()))
required = sum(ai) / (4 * m)
count = 0
for a in sorted(ai, reverse=True):
    if a >= required:
        count += 1
    else:
        break
print("YNeos"[count < m::2])
import numpy as np

N = input()
# N = int(input())
# t = np.array(list(map(int, input().split())))
t = map(int, raw_input().split())

odd = t[0::2]
even = t[1::2]

rest = 0
for _k in [odd, even]:
    unique, count = np.unique(_k, return_counts=True)


print 'h'

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
from collections import Counter
N = input()
t = np.array(map(int, raw_input().split()))

odd = t[0::2]
even = t[1::2]
rest = 0

co = Counter(odd)
ce = Counter(even)

omc = co.most_common()
emc = ce.most_common()

if omc[0][0] == emc[0][0]:
    if len(omc) < 2 and len(emc) < 2:       # same
        rest = len(even)
    elif len(omc) < 2:
        rest = len(even)
    elif len(emc) < 2:
        rest = len(odd)
    else:
        or1 = len(odd) - co.most_common()[0][1]
        or2 = len(odd) - co.most_common()[1][1]
        er1 = len(even) - ce.most_common()[0][1]
        er2 = len(even) - ce.most_common()[1][1]

        if or1 + er2 > or2 + er1:
            rest = or2 + er1
        else:
            rest = or1 + er2
else:
    rest = len(odd) - co.most_common()[0][1] + len(even) - ce.most_common()[0][1]


print rest
n, m = map(int, input().split())
a = []
b = []
for i in range(n):
    a += list(map(int, input().split()))
for i in range(m):
    b += int(input())
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)


### FIXED CODE ###

n, m = map(int, input().split())
A = [map(int, input().split()) for _ in [None] * n]
b = [int(input()) for _ in [None] * m]
for a in A:
    print(sum(i * j for i, j in zip(a, b)))
A,B,C,K=map(int,input().split())
X=[1]*A
Y=[0]*B
Z=[-1]*C
ANS=X+Y+Z
cnt=0
for i in range(K):
    cnt+=ANS[i]
print(cnt)


### FIXED CODE ###

A,B,C,K=map(int,input().split())
if A>=K:
    print(K)
elif A+B>=K:
    print(A)
else:
    print(A-(K-A-B))
from sys import stdin
ans = 'No'
n = int(stdin.readline())
m = n
s = 0
while m:
 s += m%10
 m/=10
if n%m==0:
 ans = 'Yes'
print ans

### FIXED CODE ###

from sys import stdin
ans = 'No'
n = int(stdin.readline())
m = n
s = 0
while m:
 s += m%10
 m/=10
if n%s==0:
 ans = 'Yes'
print ans
n, d=map(int, input().split())
cnt=0

for i in range(n):
    x, y=map(int, input().split())
    tmp=x**2 + y**2
    if tmp<=d**2z:
        cnt+=1

print(cnt)

### FIXED CODE ###

n, d=map(int, input().split())
cnt=0

for i in range(n):
    x, y=map(int, input().split())
    tmp=(x**2 +y**2)**0.5
    if tmp<=d:
        cnt+=1

print(cnt)
import math

A, B = map(int, input().split())
g = math.gcd(A, B)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

print(len(make_divisors(g))-1)

### FIXED CODE ###

import fractions

A, B = map(int, input().split())
g = fractions.gcd(A, B)

def make_divisors(n):
    count = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            # print(i)
            flag = 1
            for j in range(2, int(i**0.5)+1):
                if i%j == 0:
                    flag = 0
                    break
            if flag == 1:
                count += 1
            if i != n // i:
                flag = 1
                for j in range(2, int((n // i)**0.5)+1):
                    if (n // i) %j == 0:
                        flag = 0
                        break
                if flag == 1:
                    count += 1
    return count

print(make_divisors(g))
r=input()
print(3*r*r)

### FIXED CODE ###

r=int(input())
print(3*r**2)
n = int(input())
a = 0
if n % 2:
  a = (n/2)^2
else:
  a = (n^2-1)/4
print(a)

### FIXED CODE ###

n = int(input())
a = 0
if n%2 == 0:
  a = (n/2)**2
else:
  a = (n**2-1)/4
print(int(a))
import sys
 
sys.setrecursionlimit(10 ** 6)
n = int(input())
 
edge = [[] for i in range(n)]
ans = [-1] * n
odd = []
even =[]
nums = [[],[],[]]
for i in range(1,n+1):
    nums[i % 3].append(i)
 
def dfs(x, last = -1, d = 0):
    if d % 2 == 0: even.append(x)
    else: odd.append(x)
    for nxt in edge[x]:
        if nxt == last:continue
        dfs(nxt, x, d + 1)
 
for i in range(n-1):
    a, b = map(int, input().split())
    a-=1
    b-=1
    edge[a].append(b)
    edge[b].append(a)
 
dfs(0)
 
# zerocnt = len(nums[0])
 
# if len(even) <= zerocnt:
#     for even_node in even:
#         ans[even_node] = nums[0].pop()
#     rest = nums[0] + nums[1] + nums[2]
#     for odd_node in odd:
#         ans[odd_node] = rest.pop()
 
# elif len(odd) <= zerocnt:
#     for odd_node in odd:
#         ans[odd_node] = nums[0].pop()
#     rest = nums[0] + nums[1] + nums[2]
#     for even_node in even:
#         ans[even_node] = rest.pop()
 

# else:
for num in nums[1]:
    ans[even.pop()] = num
for num in nums[2]:
    ans[odd.pop()] = num
rest = nums[0]
for even_node in even:
    ans[even_node] = rest.pop()
for odd_node in odd:
    ans[odd_node] = rest.pop()
 
print(*ans)

### FIXED CODE ###

import sys
 
sys.setrecursionlimit(10 ** 6)
n = int(input())
 
edge = [[] for i in range(n)]
ans = [-1] * n
odd = []
even =[]
nums = [[],[],[]]
for i in range(1,n+1):
    nums[i % 3].append(i)
 
def dfs(x, last = -1, d = 0):
    if d % 2 == 0: even.append(x)
    else: odd.append(x)
    for nxt in edge[x]:
        if nxt == last:continue
        dfs(nxt, x, d + 1)
 
for i in range(n-1):
    a, b = map(int, input().split())
    a-=1
    b-=1
    edge[a].append(b)
    edge[b].append(a)
 
dfs(0)
 
zerocnt = len(nums[0])
 
if len(even) <= zerocnt:
    for even_node in even:
        ans[even_node] = nums[0].pop()
    rest = nums[0] + nums[1] + nums[2]
    for odd_node in odd:
        ans[odd_node] = rest.pop()
 
elif len(odd) <= zerocnt:
    for odd_node in odd:
        ans[odd_node] = nums[0].pop()
    rest = nums[0] + nums[1] + nums[2]
    for even_node in even:
        ans[even_node] = rest.pop()
 

else:
    for num in nums[1]:
        ans[even.pop()] = num
    for num in nums[2]:
        ans[odd.pop()] = num
    rest = nums[0]
    for even_node in even:
        ans[even_node] = rest.pop()
    for odd_node in odd:
        ans[odd_node] = rest.pop()
 
print(*ans)
n = int(input())
i = 1

while True:
    x = i
    if  x % 3 == 0 or x % 10 ==3 or x / 10 == 0:
        print(" %d" i)
        i+=1
        if i > n:
            print()
            break


### FIXED CODE ###

#
# 5d
#

def main():
    n = int(input())
    s = ""
    for i in range(1, n+1):
        x = i
        if x % 3 == 0 or x % 10 == 3:
            s += " " + str(i)
        else:
            x //= 10
            while x:
                if x % 10 == 3:
                    s += " " + str(i)
                    break
                x //= 10
    print(s)


if __name__ == '__main__':
    main()
from fractions import gcd as g
def l(a,b):
  x=a*b/g(a,b)
  return int(x)
n=int(input())
if n==1:
  print(int(input()))
else:
  for _ in range(n):
    t=int(input())
    m=l(t,m)
  print(m)


### FIXED CODE ###

from fractions import gcd as g
def l(a,b):
  x=a*b//g(a,b)
  return x
n=int(input())
m=int(input())
for _ in range(n-1):
  t=int(input())
  m=l(m,t)
print(m)
A,B = map(int,input().split())

x = A + B
y = A - B
z = A * B

if x > y and x > z:
	answer = x

elif y > x and y >z:
	answer = y

elif z > x and z > y:
	answer = z
    
print(answer)
	

### FIXED CODE ###

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

x = A + B
y = A - B
z = A * B

if x >= y and x >= z:
	answer = x

elif y >= x and y >=z:
	answer = y

elif z >= x and z >= y:
	answer = z
    
print(answer)
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse = True)
if N % 2 == 1:
  if A.count(A[-1]) == 0:
    print(0)
    exit(0)
else:
  if A.count(A[-1]) == 1:
    print(0)
    exit(0)
res = 1
i = 0
while i <= N - 1:
  if A[i] == A[i + 1]:
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res)



### FIXED CODE ###

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

A.sort()
mod = 10 ** 9 + 7
i = 0
res = 0
if N == 1:
  if A[0] == 0:
    print(1)
  else:
    print(0)
  exit(0)
if N % 2 == 1:
  res = 1
  i = 1
  if A[0] == A[1]:
    print(0)
    exit(0)
  if A[0] == 1:
    print(0)
    exit(0)
else:
  res = 2
  i = 2
  if A[0] != A[1]:
    print(0)
    exit(0)
  if A[0] == 0:
    print(0)
    exit(0)
while i < N - 1:
  if A[i] == A[i + 1]:
    if N % 2 == 0:
      if A[i] != 2 * (i / 2 + 1) - 1:
        res = 0
        break
    else:
      if A[i] != 2 * (i // 2 + 1):
        res = 0
        break
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res % mod)
from math import math

k = int(input())
count = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            count += gcd(gcd(j,l),i)
print(count)


### FIXED CODE ###

from math import gcd
K=int(input())
ans=0 
 
for i in range(1,K+1):
  for j in range(1,K+1):
    for l in range(1,K+1):
      ans+= gcd(gcd(l,j),i)
 
print(ans)
n, m = map(int, raw_input().split())
a = np.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = np.c_[a, (map(int, raw_input().split()))]
b = np.array(map(int, raw_input().split()))
for i in xrange(m-1):
	b = np.r_[b, (map(int, raw_input().split()))]
for i in xrange(n):
	print b.dot(a)[i]

### FIXED CODE ###

n, m = map(int, raw_input().split())
 
a = [[0]*m for i in xrange(n)]
 
b = [0]*m
 
for i in xrange(n):
    tmp = map(int, raw_input().split())
    for j in xrange(m):
        a[i][j] = tmp[j]
for i in xrange(m):
    b[i] = input()
for i in xrange(n):
    tmp = 0
    for j in xrange(m):
        tmp += a[i][j] * b[j]
    print tmp
while True:
    e = int(raw_input())
 
    if e == 0: break

    x, y, z, ans = 0, 0, 0, e

    for z in range(e):
        if z**3 > e: break
        for y in range(e):
            if y**2 + z**3 > e: break
            x = e - y**2 - z**3
            ans = min(ans, x+y+z)

    print ans



### FIXED CODE ###

#!/usr/bin/env python3

from math import sqrt

while True:
    e = int(input())

    if e == 0: break
    z, ans = 0, e

    while z ** 3 <= e:
        y = int(sqrt(e - z**3))
        x = e - y**2 - z**3
        ans = min(ans, x + y + z)
        z += 1

    print(ans)
N,X = (input().split())
L = list(map(int, input().split()))
x = int(X)
n = int(N)
position = 0
count = 0
while position <= x:
    position += L[count]
    count += 1
if n+1 < count:
    print(count)
else:
    print(n+1)

### FIXED CODE ###

n, x = list(map(int, input().split()))
li = list(map(int, input().split()))

ans = 1
pos = 0
for i in range(n):
	pos = pos + li[i]
	if pos <= x:
		ans += 1
print(ans)
D,T,S=(int(x) for x in input().split())
if D >S*T:
  print('no')
elif:
  print('yes')

### FIXED CODE ###

D,T,S=(int(x) for x in input().split())
if D >S*T:
  print('No')
else:
  print('Yes')
N,Q=map(int, input().split())
s=input()
S=len(s)
A=[]
for i in range(Q):
  x,y=input().split()
  A.append((x,y))
  
if N==1:
  for x,y in A:
    if s[0]==x:
      print(0)
      exit()
  print(1)
  exit()
  
def L(d):
  for x,y in A:
    if s[d]==x and y=='L':
      d-=1    
    if s[d]==x and y=='R':
      d+=1
    if d<0:
      return False
  return True

ok,ng=S,-1
mid=(ok+ng)//2
for i in range(50):
  mid=(ok+ng)//2
  if L(mid):
    ok=mid
  else:
    ng=mid
p=ok
if ok==S:
  print(0)
  exit()

def R(d):
  for x,y in A:
    if s[d]==x and y=='L':
      d-=1    
    if s[d]==x and y=='R':
      d+=1
    if d>=S:
      return False
  return True

ok,ng=-1,S
mid=(ok+ng)//2
for i in range(50):
  mid=(ok+ng)//2
  if R(mid):
    ok=mid
  else:
    ng=mid
q=ok

print(q-p+1)

### FIXED CODE ###

N,Q=map(int, input().split())
s=input()
S=len(s)
A=[]
for i in range(Q):
  x,y=input().split()
  A.append((x,y))
  
if N==1:
  for x,y in A:
    if s[0]==x:
      print(0)
      exit()
  print(1)
  exit()
  
def L(d):
  for x,y in A:
    if s[d]==x and y=='L':
      d-=1    
    if s[d]==x and y=='R':
      d+=1
    if d<0:
      return False
    elif d==S:
      d-=1
  return True

ok,ng=S,-1
mid=(ok+ng)//2
while abs(ok-ng)>1:
  mid=(ok+ng)//2
  if L(mid):
    ok=mid
  else:
    ng=mid
p=ok
if ok==S:
  print(0)
  exit()

def R(d):
  for x,y in A:
    if s[d]==x and y=='L':
      d-=1    
    if s[d]==x and y=='R':
      d+=1
    if d>=S:
      return False
    elif d<0:
      d+=1
  return True

ok,ng=-1,S
mid=(ok+ng)//2
while abs(ok-ng)>1:
  mid=(ok+ng)//2
  if R(mid):
    ok=mid
  else:
    ng=mid
q=ok

print(q-p+1)
def main():
    X = input()
    under2 = int(X[-2] + X[-1])
    X = int(X)

    if X < 100:
        ans = 0
    else:
        if under2 <= 5:
            ans = 1
        else:
            cnt = 0
            while under2 > 5:
                under2 -= 5
                cnt += 1
            cnt += 1

            if X >= cnt * 100:
                ans = 1
            else:
                ans = 0
    
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    X = input()
    X = int(X)

    if X < 100:
        ans = 0
    else:
        X = str(X)
        under2 = int(X[-2] + X[-1])
        X = int(X)
        if under2 <= 5:
            ans = 1
        else:
            cnt = 0
            while under2 > 5:
                under2 -= 5
                cnt += 1
            cnt += 1

            if X >= cnt * 100:
                ans = 1
            else:
                ans = 0
    
    print(ans)

if __name__ == '__main__':
    main()
N = int(input()) # 地点の候補数
T, A = map(int, input().split()) # T:平均気温 A:温度
H = list(map(int, input().split())) #標高(x)

list = [A-(T - i * 0.006) for i in H]

print(list.index(min(abs(list)))+1)


### FIXED CODE ###


N = int(input()) # 地点の候補数
T, A = map(int, input().split()) # T:平均気温 A:温度
H = list(map(int, input().split())) #標高(x)

list = [abs(A-(T - i * 0.006)) for i in H]

print(list.index(min(list))+1)
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


A, B, C, D = map(int, input().split())
CD = C * D // gcd(C, D)
AC = math.ceil(A / C)
BC = math.ceil(B / C)
C = math.ceilBC - AC + 1
AD = math.ceil(A / D)
BD = math.ceil(B / D)
D = BD - AD + 1
ACD = math.ceil(A / CD)
BCD = math.ceil(B / CD)
CD = BCD - ACD + 1
print((B-A+1) - (C + D - CD))

### FIXED CODE ###

import sys
input = sys.stdin.readline
from fractions import gcd
def lcm(a, b):
    return a*b // gcd(a, b)
def group(s, t, u):
    su = (s - 1) // u
    tu = t // u
    return  tu - su

A, B, C, D = map(int, input().split())
ABC = group(A, B, C)
ABD = group(A, B, D)
ABCD = group(A, B, lcm(C,D))
U = B - A + 1
print(U-(ABC+ABD-ABCD))
a = input()
b = input()
c = input()

tmp = a
a = b
b = tmp

tmp = a
a = c
c = tmp

print(a, b, c)


### FIXED CODE ###

a,b,c=(int(x) for x in input().split())

a,b = b,a
a,c = c,a

print(a, b, c)
import math
from functools import reduce

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(reduce(math.gcd, *a))

### FIXED CODE ###

import fractions
from functools import reduce

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(reduce(fractions.gcd, a))
A,B,C,D = map(int, input().split())

def gcd(a, b):
    while b > 0:
        a,b = b, a%b
    return a

def count(n):
    c = n//C
    d = n//D
    g = gcd(C, D)
    l = C*D//gcd
    return n -c -d +n//l

print(count(B) - count(A-1))


### FIXED CODE ###

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

def gcd(a, b):
    while b > 0:
        a,b = b, a%b
    return a

def count(n):
    c = n//C
    d = n//D
    g = gcd(C, D)
    l = C*D//g
    return n -c -d +n//l

print(count(B) - count(A-1))
import sys
while 1:
	N=input()
	sys.stdout.write('\n')
	i = 1
	while 1:
		if (i % 3) == 0:
			sys.stdout.write(" ")
			sys.stdout.write("%d" % i)
		else :
			if (i % 10 ) == 3:
				sys.stdout.write(' ')
				sys.stdout.write("%d" % i)
		if i+1  >  N:
			break
		i += 1

### FIXED CODE ###

import sys
N=input()
i = 1
for i in range(1,N+1):
    if (i % 3) == 0 :
        sys.stdout.write(" ")
        sys.stdout.write("%d" % i)
    else:
        if (i % 10 ) == 3 :
            sys.stdout.write(' ')
            sys.stdout.write("%d" % i)
        else:
            if (i/10)%10 == 3:
                #print (i/10)%10,"a"
                sys.stdout.write(' ')
                sys.stdout.write("%d" % i)
            else:
                if (i/100)%10 == 3:
                    sys.stdout.write(' ')
                    sys.stdout.write("%d" % i)
                else:
                    if (i/100)%10 == 3:
                        sys.stdout.write(' ')
                        sys.stdout.write("%d" % i)
                    else:
                        if(i/1000)%10 == 3:
                            sys.stdout.write(' ')
                            sys.stdout.write("%d" % i)
print ""
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]
tmp = [-1]*n
for j in range(m):
         if tmp[(sc[j][0]-1)] != sc[j][1]:
                  if tmp[(sc[j][0]-1)] != -1:
                           print(-1)
                           exit()
         tmp[(sc[j][0]-1)] = sc[j][1]
if tmp[0] == -1 and len(tmp) >= 2:
         print(-1)
         exit()
elif tmp[0] == -1 and len(tmp) == 1:
         print(0)
         exit()
else:
         for k in range(n):
                  if tmp[k] == -1:
                           tmp[k] = 0
                  print("{}".format(tmp[k]), end = "")


### FIXED CODE ###

a = []
for i in range(3):
         a.append( list(map(int,input().split())))
n = int(input())
b = [int(input()) for j in range(n)]
for k in range(3):
         for l in range(3):
                  for m in range(n):
                           if a[k][l] == b[m]:
                                    a[k][l] = -1
if a[0][0] == a[0][1] == a[0][2] == -1 or  a[1][0] == a[1][1] == a[1][2] == -1 or  a[2][0] == a[2][1] == a[2][2] == -1 or  a[0][0] == a[1][0] == a[2][0] == -1 or  a[0][1] == a[1][1] == a[2][1] == -1 or  a[0][2] == a[1][2] == a[2][2] == -1 or  a[0][0] == a[1][1] == a[2][2] == -1 or  a[0][2] == a[1][1] == a[2][0] == -1 :
         print("Yes")
else:
         print("No")
N=int(input())
S=input()
c=0
for i in range(N):
  if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
    c+=1
print(c)

### FIXED CODE ###

N=int(input())
S=input()
c=0
if len(S)>2:
  for i in range(1,N-1):
    if S[i-1]=="A" and S[i]=="B" and S[i+1]=="C":
      c+=1
print(c)
a,b,c,d = map(int, input().split())
s = a*b
t = c*d
if s > t = print(s)
else: print(t)

### FIXED CODE ###

a,b,c,d = map(int, input().split())
s = a*b
t = c*d
if s > t: print(s)
else: print(t)
s = input()

b = int(s[:2])
a = int(s[2:])

print(b)
print(a)

def yorm(i):
    flag = 'none'
    if 0<i<12:
        flag = 'MM'
    elif i<100:
        flag = 'YY'
    return flag
   
ans = bf+af
if len(ans) != 4:
    ans = 'NA'
if ans == 'MMMM':
    ans = 'AMBIGUOUS'
if ans == 'YYYY':
    ans = 'NA'
print(ans)

### FIXED CODE ###

s = input()

b = int(s[:2])
a = int(s[2:])

def yorm(i):
    flag = 'none'
    if 0<i<=12:
        flag = 'MM'
    elif i<100:
        flag = 'YY'
    return flag

bf = yorm(b)
af = yorm(a)
   
ans = bf+af
if len(ans) != 4:
    ans = 'NA'
if ans == 'MMMM':
    ans = 'AMBIGUOUS'
if ans == 'YYYY':
    ans = 'NA'
print(ans)
a,b,c=map(int,input().split())
if a=b=c or a!=b!=c:
  print('No')
else:
  print('Yes')


### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b!=c or a!=b==c or a==c!=b:
  print('Yes')
else:
  print('No')
import math
def solution():
    a, b, h, m  = map(int, input().split())
    return (a**2 + b**2 -2*a*b*round(math.cos(2*math.pi*(h/12 - m/60)), 9))**0.5

print(solution())

### FIXED CODE ###

def solution():
    n = int(input())
    bon = [3]
    pon = [0, 1, 6, 8]
    last = n % 10
    if last in bon:
        return 'bon'
    elif last in pon:
        return 'pon'
    else:
        return 'hon' 
    
print(solution())
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
if N & 1:
    ans1 = 2*sum(A[N//2:])-A[N//2]-A[N//2+1]-2*sum(A[:N//2])
    ans2 = 2*sum(A[N//2+1:])-2*sum(A[:N//2+1])+A[N//2]+A[N//2-1]
else:
    ans1 = 2*sum(A[N//2:])-A[N//2]-2*sum(A[:N//2])+A[N//2-1]
    ans2 = 2*sum(A[N//2+1:])-A[N//2+1]-2*sum(A[:N//2+1])+A[N//2]
print(max(ans1, ans2))

### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
if N & 1:
    ans1 = 2*sum(A[N//2:])-A[N//2]-A[N//2+1]-2*sum(A[:N//2])
    ans2 = 2*sum(A[N//2+1:])-2*sum(A[:N//2+1])+A[N//2]+A[N//2-1]
else:
    if N == 2:
        ans1 = ans2 = abs(A[0]-A[1])
    else:
        ans1 = 2*sum(A[N//2:])-A[N//2]-2*sum(A[:N//2])+A[N//2-1]
        ans2 = 2*sum(A[N//2+1:])-A[N//2+1]-2*sum(A[:N//2+1])+A[N//2]
print(max(ans1, ans2))
from collections import deque


def shuffle(target, num):
    que = deque(list(target))
    [que.append(que.popleft()) for _ in range(int(num))]
    return "".join(que)

text = input()
count = input()
while text != '-':
    for _ in range(int(count)):
        n = input()
        text = shuffle(text, n)
    print(text)
    text = input()
    count = input()



### FIXED CODE ###

from collections import deque

def shuffle(target, num):
    que = deque(list(target))
    [que.append(que.popleft()) for _ in range(int(num))]
    return "".join(que)

text = input()
while True:
    if text == "-": break
    count = input()
    for _ in range(int(count)):
        n = input()
        text = shuffle(text, n)
    print(text)
    text = input()
def root(x):
    if x == parent[x]:
        return x
    y = root(parent[x])
    relative[x] += relative[parent[x]]
    parent[x] = y
    return y
def unite(a, b, w):
    pa = root(a); pb = root(b)
    if pa < pb:
        parent[pb] = pa
        relative[pb] = relative[a] + w
    else:
        parent[pa] = pb
        relative[pa] = relative[b] - w
while 1:
    N, M = map(int, input().split())
    if N == M == 0:
        break
    *parent, = range(N+1)
    relative = [0]*(N+1)
    for i in range(M):
        cmd = input().split()
        if cmd[0] == '!':
            a, b, w = map(int, cmd[1:])
            unite(a-1, b-1, w)
        else:
            a, b = map(int, cmd[1:])
            if root(a-1) != root(b-1):
                print("UNKNOWN")
            else:
                print(relative[b-1] - relative[a-1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
def root(x):
    if x == parent[x]:
        return x
    y = root(parent[x])
    relative[x] += relative[parent[x]]
    parent[x] = y
    return y
def unite(a, b, w):
    pa = root(a); pb = root(b)
    pw = relative[a] + w - relative[b]
    if pa < pb:
        parent[pb] = pa
        relative[pb] = pw
    else:
        parent[pa] = pb
        relative[pa] = -pw
while 1:
    N, M = map(int, input().split())
    if N == M == 0:
        break
    *parent, = range(N)
    relative = [0]*N
    for i in range(M):
        cmd = input().split()
        if cmd[0] == '!':
            a, b, w = map(int, cmd[1:])
            unite(a-1, b-1, w)
        else:
            a, b = map(int, cmd[1:])
            if root(a-1) != root(b-1):
                print("UNKNOWN")
            else:
                print(relative[b-1] - relative[a-1])
a=input()
b=input()
c=input()
a=int(a)
b=int(b)
c=int(c)
avarage=(a+b+c)/2
if a!=avarage and b!=avarage and c!=avarage:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a,b,c=map(int,input().split())
a=int(a)
b=int(b)
c=int(c)
avarage=(a+b+c)/2
if a!=avarage and b!=avarage and c!=avarage:
    print("No")
else:
    print("Yes")
nums = input().split()
a = int(num[0])
b = int(num[1])

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

### FIXED CODE ###

x = input().split(' ')
a = int(x[0])
b = int(x[1])

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