peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n,x=list(map(int,input().split()))
l=list(map(int,input().split()))
d=0
cnt=0
for i in range(len(l)):
    if d>=x:
        print(i+1)
        exit()
    d+=l[i]
# Judge status: Accepted
s = str(input())
j = 0
f = 0
e = 0
for i in range(len(s)):
    if s[i] == "A" and j == 0:
        j = 1
        f = i
    elif s[i] == "Z":
        e = i
print(e - f + 1)
# Judge status: Wrong Answer
L=[int(input()) for _ in range(5)]
k=int(input())
for i in range(1,5):
  if L[i]-L[i-1]>0:
    print(":(")
    exit()
print("Yay!")
# Judge status: Wrong Answer
#!/usr/bin/env python3
n,x = map(int,input().split())
a = list(map(int,input().split()))
def gcd(a,b):
    if b > a: a,b = b,a
    while b > 1:
        #print(a,b)
        a,b = b,a%b
    return a
cur_gcd = 1
a.sort()
for i in range(n):
    if x != a[i]:
        cur_gcd = gcd(cur_gcd,abs(x-a[i]))
        #print(cur_gcd)
print(cur_gcd)
# Judge status: Accepted
x, y, a, b, c = map(int, input().split())

red = list(map(int, input().split()))
green = list(map(int, input().split()))
colorless = list(map(int, input().split()))

red.sort(reverse = True)
green.sort(reverse = True)
colorless.sort(reverse = True)

ret = red[:x] + green[:y]
ret.sort()

for i in range(len(colorless)):
    if ret[i] < colorless[i]:
        ret[i] = colorless[i]
    else:
        break

print(sum(ret))
# Judge status: Wrong Answer
n=int(input())
m=n//2
x=sorted(map(int,input().split()))

for i in range(m):
    print(x[m-1])
for i in range(m,n):
    print(x[m])
# Judge status: Wrong Answer
X,N = map(int,input().split())
p = list(map(int, input().split()))

for i in range(X):
  if X-i not in p:
    print(X-i)
    break
  elif X+i not in p:
    print(X+i)
    break
  else:
    continue
# Judge status: Wrong Answer
s = input()
x = 'keyence'
cnt = 0
for i in s:
    if x[cnt] == i:
        cnt += 1
        if cnt == 6:
            print('YES')
            break
else:
    print('NO')
# Judge status: Accepted
a, b = map(int, input().split())

if a < 0 and b < 0:
    if (b - a) % 2 == 0:
        print('Negative')
    else:
        print('Positive')
elif a < 0 and b >= 0:
    print('Zero')
else:
    print('Positive')
# Judge status: Accepted
a,b,c,x,y = map(int,input().split())
ans = 0
if a+b <= c*2:
    ans = a*x+b*y
else:
    if x>y:
        ans = min(2*c*y+(x-y)*a, 2*c*x)
    else:
        ans = min(2*c*x+(y-x)*b, 2*c*y)
print(ans)
# Judge status: Accepted
A,B,K = map(int,input().split())

if K <= A :
    print(A-K,B)
elif A < K < A + B :
    print(0,A+B-K)
else:print(0,0)
# Judge status: Accepted
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i in a:
    for j in b:
        if j not in i:
            print('No')
            exit()
print('Yes')
# Judge status: Accepted
n = int(input())
p = 1
for i in range(1,n+1):
    p *= i
    p = p%1000000007
print(p)
# Judge status: Wrong Answer
N = [input().split() for l in range(2)]
#print(N)

length = int(N[0][0])
sum = 0

array = []

for i in range(length):
  tmp = []
  for j in range(length):
    if i != j:
      tmp.extend(N[1][j])
  array.append(sorted(tmp))

#print(array)
for line in array:
  print(line[int(len(line)/2)+1-1])
# Judge status: Wrong Answer
N, M = map(int, input().split())

for i in range(M):
  L, R = map(int, input().split())
  
  if i == 0:
    top = R
    bottom = L
  
  top = min(top, R)
  bottom = max(bottom, L)

print(top-bottom+1)
# Judge status: Wrong Answer
s=input()
k=int(input())
m=len(s)

word={j:26-i for i,j in enumerate([chr(_) for _ in range(97,97+26)])}
number={i:j for i,j in enumerate(chr(_) for _ in range(97,97+26))}
number[26]="a"
ans=""

for i,j in enumerate(s):
    if i==m-1 and k>0:
        k %=26
        if k>word[j]:ans +=number[k-word[j]]
        else:ans +=number[26-word[j]+k]
    elif word[j]<=k:
        k -=word[j]
        ans +="a"
    else:ans +=j

print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a < c < b or b < c < a:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = sum(map(int, input().split()))

if N <= 21:
  print("win")
else:
  print("bust")
# Judge status: Accepted
flag=True
a=list(input())
a=sorted(a)
while len(a)>0 and flag:
    n=a.count(a[0])
    if n%2==0:
        a=a[n:]
    else:
        flag=False
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s=input()

if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def resolve():
    '''
    code here

    '''
    import math

    N, M = [int(item) for item in input().split()]

    deff = N - M

    if deff == -1:
        N, M = M, N

    if deff == 0:
        res = (math.factorial(N)**2 * 2) % (10**9+7)

    elif abs(deff) == 1:
        res = (math.factorial(N) **2 // N ) % (10**9+7)

    else:
        res = 0
    
    print(res)

if __name__ == "__main__":
    resolve()
# Judge status: Accepted
N = int(input())

d = {}
S = set()

for i in range(N):
    s,p = input().split()
    p = int(p)
    S.add(s)
    if s in d:
        d[s].append([p, i+1])
        continue
    d[s] = []
    d[s].append([p, i+1])
S = list(S)
S.sort()

for key in S:
    L = d[key]

    L = sorted(L, reverse=True)
    for l in L:
        print(l[1])
# Judge status: Wrong Answer
n = int(input())
a = []
for i in range(n):
    a.append(int(input()) - 1)

if not 1 in a:
    print(-1)

hst = []
btn = 0
cnt = 0

while cnt <= 10**5:
    hst.append(btn)
    btn = a[btn]
    cnt += 1
    if btn == 1:
        print(cnt)
        exit()

print(-1)
# Judge status: Accepted
import sys
N = int(input())
ans = 0
def dfs(n):
    if n == N:
        print('Yes')
        sys.exit()
    if n > N:
        return

    dfs(n+4)
    dfs(n+7)

dfs(0)
print('No')
# Judge status: Wrong Answer
import math
import fractions
a,b,c,d=map(int,input().split())
base=b-a+1

n_c=math.floor(b/c)-math.ceil(a/c)+1
n_d=math.floor(b/d)-math.ceil(a/d)+1
cd=c*d/fractions.gcd(c,d)
n_cd=math.floor(b/cd)-math.ceil(a/cd)+1
print(base-n_c-n_d+n_cd)
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for i in range(n)]
b = list(set(a))
maxnum = max(b)

for i in range(n):
    if a[i] != maxnum or len(b) == 1:
        print(b[-1])
    else:
        print(b[-2])
# Judge status: Wrong Answer
for i in range(365):
  print(i%26)
# Judge status: Accepted
a,b = map(int,input().split())
print(-(-(a+b)//2))
# Judge status: Accepted
import sys

s = input()
t = input()
difl = []

for i in range(len(s)-len(t)+1):
    if s[i:i+len(t)] == t:
        print(0)
        sys.exit()
    else:
        dif = 0
        for j in range(len(t)):
            if s[j+i] != t[j]:
                dif += 1
    difl.append(dif)

print(min(difl))
# Judge status: Wrong Answer
import itertools

n = int(input())
ans_d = {i: 0 for i in range(1,10087)}

p = itertools.product(range(1, 42), range(1, 42), range(1, 42))

for x, y, z in p:
    cnt = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (x * z)
    ans_d[cnt] += 1

for i, j in ans_d.items():
    print(j)
    if i == n:
        break
# Judge status: Accepted
N,M = map(int, input().split())
if N%2 == 1:
    for i in range(M):
        print(i+1,N-1-i)
else:
    if (N//2)//2 >= M:
        for i in range(M):
            print(i+1,(N//2)-i)
    else:
        for i in range((N//2)//2):
            print(i+1,(N//2)-i)
        for i in range(M-(N//2)//2):
            print((N//2)+1+i,N-1-i)
# Judge status: Accepted
from collections import deque
N,M = map(int,input().split())

graph = [[] for _ in range(N)]
flag = [0] * N

for i in range(M):
  A, B = map(int,input().split())
  A -= 1
  B -= 1
  graph[A].append(B)
  graph[B].append(A)
  
D = deque()
D.append(0)
visited = [False] * N
visited[0] = True

while D:
  v = D.popleft()
  for nv in graph[v]:
    if visited[nv] == True:
      continue
    visited[nv] = True
    flag[nv] = v
    D.append(nv)
    
print("Yes")
for i in range(1,N):
  print(flag[i] + 1)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int,input().split()))
A.sort()
ap = 10**9+7
for a in A:
    r = a%ap
    if r>0:ap = r
print(ap)
# Judge status: Wrong Answer
n, m = map(int,input().split())
ans = [1]*m

for i in range(n):
    x = list(map(int,input().split()))
    x.pop(0)
    for j in range(m):
        if j not in x:
            ans[j-1] = 0

print(ans.count(1))
# Judge status: Accepted
#!/usr/bin/env python3

A, B = [int(x) for x in input().split(" ")]

ans = 0
kazu = 1
while B > kazu:
    ans += 1
    kazu = kazu - 1 + A

print(ans)
# Judge status: Accepted
li = set(map(int, input().split()))
print(len(li))
# Judge status: Accepted
a,b = map(int,input().split())
from fractions import gcd
print(a//gcd(a,b) * b)
# Judge status: Wrong Answer
n = int(input())
cands = set([])

def dfs(count,i):
  if count ==0:
    cands.add(tuple(i))
  for j in range(1,count+1):
    dfs(count-j,i+[j])
dfs(n,[])

from itertools import permutations

ans = []
for c in cands:
  s = ''
  for i in range(len(c)):
    s += chr(97+i)* c[i]
    ans.extend(list(permutations(s,n)))
ans = list(set(ans))
ans.sort()
for i in range(len(ans)):
  for j in range(n):
    if ord(ans[i][j])-97 > j:
      break
  else:
    print(''.join(ans[i]))
# Judge status: Accepted
# -*- coding: utf-8 -*-
n = int(input())

coin = [1]
for i in range(1, 6):
    coin.append(pow(9, i))
for i in range(1, 7):
    coin.append(pow(6, i))

inf = pow(10, 10)
dp = [inf for _ in range(n + 1)]
dp[0] = 0
for i in range(1, n + 1):
    for j in range(len(coin)):
        if i - coin[j] >= 0:
            dp[i] = min(dp[i], dp[i - coin[j]] + 1)
print(dp[n])
# Judge status: Wrong Answer
N, M = map(int, input().split(' '))

_min = 1
_max = N

for _ in range(M):
    l, r = map(int, input().split(' '))
    _min = max(_min, l)
    _max = min(_max, r)

print(_max - _min + 1)
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(min(a,b))
# Judge status: Accepted
N, M = map(int, input().split())
P = [[] for _ in range(N+1)]
ite = []

for _ in range(M):
    p, y = map(int, input().split())
    P[p].append(y)
    ite.append([p, y])

dic = {}
for p in range(N+1):
    P[p] = sorted(P[p])
    for i, y in enumerate(P[p]):
        i += 1
        dic[y] = '{}{}'.format(str(p).zfill(6), str(i).zfill(6))

for i in range(M):
    p, y = ite[i]
    print(dic[y])
# Judge status: Accepted
a,b,c = map(int,input().split())

print("Yes" if a+b>=c else "No")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
f=0
g=0
ans="DENIED"
for i in range(n):
  if a[i]%2==0:
    f=1
    if (a[i]%3==0 or a[i]%5==0):
      continue
    else:
      g=1
if f==1 and g==0:
  ans="APPROVED"
if f==0 and ans=="DENIED":
  ans="APPROVED"
print(ans)
# Judge status: Accepted
s,t=input().split()
print(t,s,sep="")
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
for i in range(n): p[i] -= 1

ans = 0
for i in range(n-1):
    if p[i] == i:
        ans += 1
        p[i], p[i+1] = p[i+1], p[i]

print(ans)
# Judge status: Wrong Answer
s = input()
a = len(s)
for i in range(a):
    print('x',sep="")
# Judge status: Accepted
n = int(input())
c = [[0 for j in range(10)] for i in range(10)]

for i in range(1,n+1):
    t = str(i)
    c[int(t[0])][int(t[-1])] += 1
    
ans = 0
for i in range(1,10):
    for j in range(1,10):
        ans += c[i][j]*c[j][i]
print(ans)
# Judge status: Wrong Answer
N=int(input())
list=[]
for i in range(N):
  s=input()
  s=sorted(s)
  list.append(s)
  list=sorted(list)
t=0
for i in range(N-1):
  if list[i]==list[i+1]:
    t+=1
print(t)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
nu = int(readline())
if nu % 2 == 1:
    print(0)
else:
    nu //= 2
    answ = 0
    while nu:
        nu //= 5
        answ += nu
    print(answ)
# Judge status: Accepted
n,k,x,y = (int(input()) for i in range(4))
result = 0
for _ in range(n):
    if _ < k:
        result += x
    elif _ >= k:
        result += y
print(result)
# Judge status: Wrong Answer

S, W = map(int, input().split())

print("unsafe" if S < W else "safe")
# Judge status: Accepted
[n,m]=list(map(int,input().split()))
roads=[]
for i in range(m):
    road=list(map(int,input().split()))
    roads.append(road)
ans=[]
for i in range(n):
    kaisu=0
    for j in range(m):
        if roads[j][0]==i+1 or roads[j][1]==i+1:
            kaisu+=1
    ans.append(kaisu)

for i in range(n):
    print(ans[i])
# Judge status: Wrong Answer
a = int(input())
total = a + a**2 + a**3
print(a)
# Judge status: Accepted
#A-Product

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

#a,bの積を表示
s = a*b

#余りが奇数か偶数で場合分け
if s%2 == 0:
    print("Even")

else:
    print("Odd")
# Judge status: Wrong Answer
D, N = list(map(int, input().split()))
print(N*100**D)
# Judge status: Wrong Answer
n,k=map(int,input().split())
hi=[]
for i in map(int,input().split()):
    hi.append(i)
if n<=k:
    print(0)
else:
    hi.sort
    hsum=0
    for i in range(n-k):
        hsum=hsum+hi[i]
    print(hsum)
# Judge status: Accepted
k = int(input())
print(-(-k//2)*(k+(-k//2)))
# Judge status: Wrong Answer
n , m = map (float,input().split())
s = n * m
print(int(s))
# Judge status: Accepted
a,b,c = map(int,input().split())
print(max(a,b,c)*9+a+b+c)
# Judge status: Accepted
n,y=map(int,input().split())
c=0
for i in range(n+1):
    for j in range(n-i+1):
        if 9*i+4*j+n==y//1000:
            print(i,j,n-i-j)
            c=1
            break
    if c==1:
        break
if c!=1:
    print(-1,-1,-1)
# Judge status: Accepted
n = int(input())
t, a = map(int,input().split())
beta = 0.006
H = list(map(int,input().split()))
import numpy as np 
H = np.array(H) 
use = t - beta * H - a 
use = use**2 
pre_answer = min(use)
use = list(use) 
ans = 1 + use.index(pre_answer) 
print(ans)
# Judge status: Wrong Answer
n,k = map(int,input().split())
#print(n,k)
s=list(input())
#print(s)
print(s[k-1].lower())
# Judge status: Accepted
N = int(input())

for i in range(N):
    if 2 ** (i+1) > N:
        print(2**i)
        break
# Judge status: Wrong Answer
import collections
N = int(input())
L = list(map(int,input().split()))
C = collections.Counter(L)
C = sorted(C.items(), key=lambda x: x[1], reverse=True)
ans = 0
for i in range(min(3,len(C))):
  ans += C[i][1]
print(ans)
# Judge status: Accepted
K=int(input())
num=7
count = 0
checkK = [0 for j in range(K)]
result = ""

flag = True
while(flag):
    count += 1
    if num%K==0:
        flag = False
        result = str(count)
    num = (num*10+7)%K
    checkK[num] += 1
    if checkK[num] == 2:
        flag = False
        result = "-1"
print(result)
# Judge status: Accepted
n = int(input())
ans = 800*n - 200*(n//15)
print(ans)
# Judge status: Accepted
import fractions
 
import math
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
n = int(input())
a = list(map(int,input().split()))

c=0

z=lcm_list(a)

for i in range(0,n):
  c+=(z//a[i])
#print(z)
print(c%((10**9)+7))
# Judge status: Wrong Answer
import math


# def calc(n, c, d):
#     return n-(math.floor(n / c) +
#               math.floor(n / d) - math.floor(n / (c * d / math.gcd(c, d))))
def calc(n, c, d):
    return n-(n // c +
              n // d - n // (c * d / math.gcd(c, d)))


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

    print(int(calc(b, c, d)-calc(a-1, c, d)))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N,X,T = map(int,input().split())

if N % X == 0:
    print(T*N/X)
else:
    print(T*(int(N/X)+1))
# Judge status: Accepted
# Problem A - キャンディーとN人の子供イージー

# input process
N = int(input())

ans = N * (1 + N)
ans = ans // 2

print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    T, A = map(int, input().split())
    H = list(map(int, input().split()))

    mindiff = pow(10, 6)
    for i in range(N):
        temprature = T - 0.006*H[i]
        diff = abs(temprature - A)
        if diff < mindiff:
            ans = i+1
            mindiff = diff
    
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
from math import floor
temp_list = [int(input()) for _ in range(6)]
n = temp_list.pop(0)
print(5 + floor(n / min(temp_list)))
# Judge status: Accepted
import numpy as np
c1 = list(map(int,input().split()))
A = np.array(c1)
c1 = list(map(int,input().split()))
B = np.array(c1)
c1 = list(map(int,input().split()))
C = np.array(c1)

D = A-B 
D1 = list(D)
D1 = set(D1)
if len(D1) == 1:
    pass 
else:
    print('No')
    exit()

E = B-C
E1 = list(E)
E1 = set(E1) 
if len(E1)== 1:
    print('Yes') 
else:
    print('No')
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
while a>0 and c>0:
    a=a-d
    c=c-b
if a>c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S = input() [::-1]
ans = 0
mod = 0
ten = 1
count = [0]* 2019
count[0] = 1
for i in range(len(S)):
    mod = (mod + int(S[i]) * ten) % 2019
    ten = ten*10 % 2019
    count[mod] += 1
for c in count:
    ans += c*(c-1)//2
print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python
# coding: utf-8

# In[15]:


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


# In[16]:


total = sum(A)
ans = total
left = 0
for i in A:
    left += i
    right = total - left
    ans = min(ans, abs(left - right))
    print(left, right, ans)
print(ans)


# In[ ]:
# Judge status: Wrong Answer
s=input()
k=int(input())
for i in range(min(len(s),k)):
  if s[i]!="1":
    print(s[i])
    break
print(1)
# Judge status: Accepted
N,K=map(int,input().split())
c=1
while (N//K)>0:
  c = c + 1
  N = N//K
print(c)
# Judge status: Accepted
a,b=map(int,input().split())
for price in range(1,10000+1):
  if int(price*0.08) == a and int(price*0.10) == b:
    print(price)
    quit()
print(-1)
# Judge status: Accepted
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

A,B,C = I()
K = i()
m = max(A,B,C)
ans = A+B+C+m*(2**K-1)
print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if ( c - 1 ) // b + 1 <= (a - 1) // d + 1 :
  print("Yes")
else:
  print("No")
# Judge status: Accepted
S = input()
acgt = {'A','C','G','T'}
m = 0
c = 0
for s in S:
  if s in acgt:
    c+=1
    m = max(m,c)
  else:
    m = max(m,c)
    c = 0
print(m)
# Judge status: Wrong Answer
x, y, z = map(int, input().split())
count = 1
if x != y:
    count += 1
if x != z:
    count += 1
print(count)
# Judge status: Wrong Answer
import sys

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

if A >= 1000000000000 or B >= 1000000000000 or K >= 1000000000000:
    print("0 0")
    sys.exit()
else:
    for i in range(0, K):
        if A >= 1:
            A -= 1
            if A == 0:
                if B >= 1:
                    B -= 1
    
print("{} {}".format(A, B))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
num = 1
A.sort()
for i in range(N):
    num *= A[i]
    if num > 10 ** 18:
        num = -1
        break
print(num)
# Judge status: Wrong Answer
s = input()
a = []
for i in range(len(s)-2):
  a.append(abs(753 - int(s[i:i+2])))
print(min(a))
# Judge status: Wrong Answer
s = int(input())
val = 0
for i in range(1,4):
  a = s**i
  val +=a
  print(val)
# Judge status: Accepted
N = int(input())
s = input()
t = input()

L = N - 1
for i in range(N):
    if (s[i:N + 1] == t[0:L + 1]):
        print(N * 2 - len(s[i:]))
        exit()
    L -= 1

print(N * 2)
# Judge status: Accepted
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
li=list(set(s))
print(max(0,max(s.count(li[i])-t.count(li[i]) for i in range(len(li)))))
# Judge status: Accepted
n,*a=map(int,open(0).read().split())
t=sum(a);v=w=1
for q in a:
  if(w:=min(2*(w-q),t:=t-q))<0:print(-1);exit()
  v+=w
print(v)
# Judge status: Accepted
a,b,x = map(int, input().split())


if a == 0:
    print(b//x+1)
else:
    print(b//x-(a-1)//x)
# Judge status: Wrong Answer
K,S = map(int,input().split())
res = 0
for a in range(K):
  for b in range(K):
    for c in range(K):
      if a+b+c == S:
        res += 1
        break
      break
print(res)
# Judge status: Accepted
n = str(input())
l = len(n)
c = 0

for i in range(l):
    c = c + int(n[i])

if c % 9 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import numpy as np

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

S = np.array(list(input()), dtype='U1')
 
x = np.sum(S[1:] == S[:-1])
 
x += 2*K
x = min(x, N-1)
print(x)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
l.sort()

k_1 = l[(n//2)-1]
k_2 = l[(n//2)]
print(k_2-k_1)
# Judge status: Accepted
import collections
N,M=map(int,input().split())
a=[]
for _ in range(N):
    tmp=list(map(int,input().split()))
    a+=tmp[1:]
c=collections.Counter(a)
ans=0
for val in c.values():
    if val==N:
        ans+=1

print(ans)
# Judge status: Accepted
n, a, b = map(int, input().split())
ans = (b - a) // 2 if (b - a) % 2 == 0 else min(a - 1, n - b) + (b - a - 1) // 2 + 1
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
if a<=0 and 0<=b:
  print('Zero')
elif 0<a:
  print('Positive')
else:
  if (b-a)%2==0:
    print('Negative')
  else:
    print('Positive')
# Judge status: Accepted
N = int(input())
L = sorted(list(map(int,input().split())))[::-1]
if L[0] >= sum(L[1:]) :
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
x = int(input())

# x までの素数を探す
prim_numbers = []
for divider in range(2, int(np.sqrt(x))):
    if x % divider == 0:
        continue
    else:
        prim_numbers.append(divider)


def is_primt(q):
    for divider in prim_numbers:
        if q % divider == 0:
            return False
    return True


while True:
    if is_primt(x):
        print(x)
        exit()
    else:
        x += 1
        continue
# Judge status: Accepted
N = int(input())
S =list(input())
ans = N
W = 0
E = S.count('E')

for i in range(N):
    if S[i] =='E':
        E -= 1
    ans = min(ans, W+E)
    if S[i] == 'W':
        W += 1
print(ans)
# Judge status: Accepted
x,y = map(int,input().split())
y //= 2
print(x + y)
# Judge status: Wrong Answer
a, b = list(map(int, input().split()))
# x = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
# n = int(input())
# n, m = list(map(int, input().split()))
if a <= 6:
    print(0)
elif a <= 12:
    print(int(b/2))
else:
    print(b)
# Judge status: Accepted
week = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI':5, 'SAT':6}
day = input()
print(7 - week[day])
# Judge status: Accepted
def resolve():
    ab, bc, ca = list(map(int, input().split()))
    print(ab*bc//2)
    

if '__main__' == __name__:
    resolve()
# Judge status: Accepted
a=int(input())
b=int(input())
print(6//(a*b))
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
x = int(int(input())/50)

cnt = 0

for i in range(a + 1):
  for j in range(b + 1):
    for k in range(c + 1):
      s = int(i + j*2 + k*10)
      if s == x:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
import math
N = int(input())
a = math.factorial(N)
print(a)
x = a % (10**9+7)
print(x)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
l=(a+b+c)-min(a,b,c)*3
if l % 2==0:
  print(l/2)
else:
  print(l/2+2)
# Judge status: Wrong Answer
a,b,c = list(map(int,input().strip().split()))
for i in range(1,a):
  if a ** i % b == c:
    print("YES")
    exit()
print("NO")
# Judge status: Accepted
# 136 C
import numpy as np
N = int(input())
H = list(map(int, input().split()))
H = np.array(H)

ans = 'Yes'
for i in range(N-2, -1, -1):
    if (H[i] - H[i+1])>0:
        if (H[i] - H[i+1])==1:
            H[i] += -1
        else:
            ans='No'
            break
print(str(ans))
# Judge status: Accepted
N = int(input())
ans = 0
for i in range(1, N+1):
    n = N // i
    ans += n*(n+1)*i//2
print(ans)