peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from itertools import combinations as combi

N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]

#/##//####
# M-1+N C N
max_num = 0
for l in combi(range(M-1+N), N):
    x = [t-s for t, s in zip(l, range(N))]
    # print(x)
    score = sum(d for a, b, c, d in ABCD if x[b-1]-x[a-1] == c)
    max_num = max(max_num, score)

print(max_num)
# Judge status: Accepted
import math
import itertools

n,d=map(int,input().split())
l=list()
for i in range(n):
    l.append(list(map(int,input().split())))
pp=0
for i,j in itertools.combinations(range(n),2):
    p=0
    for k in range(d):
        p += (l[i][k]-l[j][k])**2
    if math.sqrt(p)%1==0:
        pp+=1
print(pp)
# Judge status: Accepted
d, t, s = map(int, input().split())

if (d / s) <= t:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
c  = input()

if c == 'a' or 'i' or 'u' or 'e' or 'o':
  print('vowel')
else:
  print('consonant')
# Judge status: Accepted
print("NYoe s"[input().find("9")!=-1::2])
# Judge status: Accepted
a, b = map(int,input().split())
cnt = 0
for i in range(a, b+1):
    i_s = str(i)
    i_r = 0
    for j in range(len(i_s)):
        i_r *= 10
        i_r += int(i_s[-j-1])
    if i == i_r:
        cnt += 1
print(cnt)
# Judge status: Accepted
N,K=map(int,input().split())
p=list(map(int,input().split()))
su=[0]
for i in range(N):
    p[i]=((p[i]+1)/2)
    su.append(su[i]+p[i])
ans=0
for i in range(K,N+1):
    ans=max(ans,su[i]-su[i-K])
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
ans = [False]*n
for i in range(k):
  b = int(input())
  A = list(map(int,input().split()))
  for a in A:
    ans[a-1] = True

print(n-sum(ans))
# Judge status: Wrong Answer
n = int(input())
a = []
ans = 5

for i in range(5):
    a.append(int(input()))
    
for i in a:
    if n>i:
        if n%i == 0:
            ans += n//i-1
        else:
            ans += n//i
        n = n%i
        
print(ans)
# Judge status: Wrong Answer
A=[] #appendのために宣言が必要
while True:
    try:
        A.append(list(map(int,input().split())))
    except:
        break;
import itertools
B = list(itertools.permutations(range(1,A[0][0]+1)))
a = 0
b = 0
count = 0
for l in range(len(B)):
  count += 1
  if a != 0 and b != 0:
    break;
  else:
    if tuple(A[1]) == B[l]:
      a = count
 
    elif tuple(A[2]) == B[l]:
      b = count
    else:
      continue
print(abs(a-b))
# Judge status: Accepted
import sys

def solve():
    input = sys.stdin.readline
    A, B, C, K = map(int, input().split())
    sumL = 0
    if K <= A: 
        sumL += K
        K = 0
    else:
        sumL += A
        K -= A
    if K > B:
        K -= B
    else: K = 0
    if K > 0: sumL -= K
    print(sumL)

    return  0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
import math
A,B,H,M = map(int, input().split())
a = 360*H/12+30*M/60
b = 360*M/60
c = abs(a-b)
d = A**2+B**2-2*A*B*math.sin(math.radians(c))
print(math.sqrt(d))
# Judge status: Wrong Answer
a,b=map(int,input().split())
print((a+b)//2)
# Judge status: Wrong Answer
N,L=map(int,input().split())

tot=N*L+(N-1)*N/2
ans=[]


for i in range(N):
    ans.append(abs(L+i))

print(tot-min(ans))
# Judge status: Accepted
x, y = map(int, input().split())
count = abs(abs(x) - abs(y))
if x * y < 0:
    count += 1
elif x > y:
    count += 2
    if x == 0 or y == 0:
        count -= 1
print(count)
# Judge status: Wrong Answer
n = int(input())
from bisect import bisect 
ab = [list(map(int,input().split())) for i in range(n)]

ab.sort(key = lambda x: x[1])
ok = True
last = 0
for a,b in ab:
    if b-a>last:
        last += a
    else:
        ok = not ok
print('Yes' if ok else 'No')
# Judge status: Accepted
a = input()
l = a.split()
num = 500 * int(l[0])
pri = int(l[1])
if num < pri:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
def main():
    point_count = int(input())
    inf = 10 ** 10
    max_sum, min_sum, max_diff, min_diff = - inf, inf,  - inf, inf
    for _ in range(point_count):
        x, y = [int(x) for x in input().split()]
        max_sum = max(x + y, max_sum)
        min_sum = min(x + y, min_sum)
        max_diff = max(x - y, max_diff)
        min_diff = min(x - y, min_diff)
    return max(max_sum - min_sum, max_diff - min_diff)


if __name__ == '__main__':
    print(main())
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
n = max(a)
tmp = n / 2
r = n + 1
d = n + 1
for num in a:
    if num == n:
        continue
    d_tmp = abs(num - tmp)
    if d_tmp < d:
        d = d_tmp
        r = num
print(n, r)
# Judge status: Accepted
n = int(input())
l = [0]*(n+1)
l[0] = 2
l[1] = 1
for i in range(2,n+1):
	l[i] = l[i-1] + l[i-2]
print(l[n])
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
c = 0
for a,b in zip(A,B):
    c += min((b-a)//2, b-a)
print('Yes' if c>=0 else 'No')
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[1]:


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


# In[3]:


if C < D:
    if S[B-1:D].count("##") == 0 and S[A-1:C].count("##") == 0:
        print("Yes")
    else:
        print("No")
else:
    if S[B-2:D+1].count("...") >= 1 and S[A-1:C].count("##") == 0:
        print("Yes")
    else:
        print("No")


# In[ ]:
# Judge status: Accepted
a,b,c=input().split()
print(a[0]+b[0]+c[0])
# Judge status: Wrong Answer
n = int(input())
lst1 = list(map(int,input().split()))

lst2 = [0]*8

for i in range(n):
    for j in range(8):
        if lst1[i] < 400*(j+1):
            lst2[j] += 1
            break
    if lst1[i] >= 3200:
        lst2[7] += 1

ans = 0
for i in range(7):
    if lst2[i]:
        ans += 1

print(ans if not lst2[7] else ans +1)
print(ans+lst2[7])
# Judge status: Accepted
import itertools
import collections



N = int(input())
count = [0]*N*100
m = int(N**0.5)
for x, y, z in itertools.combinations_with_replacement(range(1, m+1), 3):
  n = x**2+y**2+z**2+x*y+y*z+z*x
  k = len(set({x, y, z}))
  if k == 1:
    count[n] += 1
  elif k == 2:
    count[n] += 3
  else:
    count[n] += 6

for n in range(1, N+1):
  print(count[n])
# Judge status: Accepted
from fractions import gcd

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

if len(set([i&-i for i in a])) != 1:
  print(0)
else:
  x = a[0]//2
  for i in range(1, len(a)):
      x = x*(a[i]//2//gcd(x,a[i]//2))

  print(M//x-M//(2*x))
# Judge status: Wrong Answer
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()

N = I()
v = LI()

v = sorted(v,reverse=True)

ans = 0

for i in range(N-1):
    ans += v[i]/(2**(i+1))

print(ans + v[N-1]//(2**(N-1)))
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1, n+1):
  if i % 3 != 0 and i % 5 != 0:
    ans += i
    
print(ans)
# Judge status: Accepted
x,y=map(int,input().split())

set1={1,3,5,7,8,10,12}
set2={4,6,9,11}
set3={2}

if x in set1 and y in set1:
  print("Yes")
elif x in set2 and y in set2:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
print(1 if input()=='0' else 0)
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split())
tmp = A*X + B*Y
if X >= Y:
    tmp = min(tmp,2*Y*C+(X-Y)*A)
else:
    tmp = min(tmp,2*X*C+(Y-X)*B)
tmp = min(tmp,max(X,Y)*2*C)
print(tmp)
# Judge status: Accepted
N = int(input())
A =[int(input()) for _ in range(N)]

B = sorted(A)
M, m = B[N-1], B[N-2]

for i in A:
    if i == M:
        print(m)
    else:
        print(M)
# Judge status: Accepted
N, K = map(int, input().split())

if N % K == 0 :
    print(0)
else :
    print(1)
# Judge status: Accepted
from collections import Counter
N = int(input())
S = list(input())
c = Counter(S[1:])
ans = 0+c["E"]
now = S[0]
e = c["E"]
w = 0
for i in range(1,N):
    if now == "W":
        w += 1
    now = S[i]
    if now == "E":
        e -= 1
    if w+e < ans:
        ans = w+e
print(ans)
# Judge status: Accepted
#Educational DP Contest
#A-Frog1

n = int(input())
#n,m = map(int,input().split())
lst1 = list(map(int,input().split()))

#dp table
dp = [0]*n


#process1
dp[1] = abs(lst1[1]-lst1[0])

for i in range(2,n):
    bb,b = abs(lst1[i]-lst1[i-2]),abs(lst1[i]-lst1[i-1])
    dp[i] = min(dp[i-2]+bb,dp[i-1]+b)

#output process
print(dp[-1])
# Judge status: Accepted
s = input()

if s[-1] != 's':
    print(s + 's')
else:
    print(s + 'es')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
eat_bef=0
ans=0
for i in range(len(a)):
    ans+=b[a[i]-1]
    if i>=1:
        if eat_bef+1==a[i]:
            ans+=c[eat_bef-1]
    eat_bef=a[i]
print(ans)
# Judge status: Wrong Answer
count = 0
A,B = map(int,input().split())

for i in range(A,B+1):
    if str(i)[:2] == str(i)[3:]:
        count += 1
print(count)
# Judge status: Accepted
a = list(input())
b = len(a)
while True:
  del a[-1]
  b -= 1
  if b % 2 == 0 and a[:b//2] == a[b//2:]:
    print(b)
    break
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
if a>=k:
    print(a-k,b)
elif a<k:
    print(0,b-(k-a))
else:
    print(0,0)
# Judge status: Wrong Answer
from bisect import bisect_left
n, m, k = map(int, input().split())
list_A = list(map(int, input().split()))
list_B = list(map(int, input().split()))

list_AS = []
list_BS = []
a = 0
b = 0
for i in list_A:
    a += i
    list_AS.append(a)

for i in list_B:
    b += i
    list_BS.append(b)
ans = 0

for i in range(n):
    j = bisect_left(list_BS, k-list_AS[i])
    if list_AS[i] + list_BS[j-1] <= k:
        ans = max(ans, i+j+1)

print(ans)
# Judge status: Wrong Answer
import math
k=int(input())

ans=0
for i in range(k):
  for j in range(k):
    q=math.gcd(i,j)
    for l in range(k):
      ans+=math.gcd(q,l+1)
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>8 or b>8:
  print("Yey!")
else:
  print(":(")
# Judge status: Accepted
n = int(input())
c = 0
for i,j in zip(map(int,input().split()),map(int,input().split())):
  if i > j:
    c -= i-j
  else:
    c += (j-i)//2
print('YNeos'[c<0::2])
# Judge status: Accepted
n = int(input())
s = [int(input()) for _ in range(n)]
s.sort()

if sum(s)%10==0:
    for i in range(n):
        if s[i]%10!=0:
            s.pop(i)
            print(sum(s))
            break
    else:
        print(0)
else:
    print(sum(s))
# Judge status: Wrong Answer
n,k = map(int,input().split())
s = list(map(int,input().split()))
s.sort()
ans = 0
for i in range(1,k+1):
  ans += (s[-i]+1)/2
print(ans)
# Judge status: Accepted
_,*l=[int(i)%4 for i in open(0).read().split()];f=l.count;print('YNeos'[f(0)+f(2)//2<len(l)//2::2])
# Judge status: Accepted
li = list(map(int,input().split()))
a=list(set(li))
if len(a)==2:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(5)]
mn = min(a)
print((n + mn - 1) // mn + 4)
# Judge status: Accepted
mod = 10**9 + 7
 
N = int(input())
 
ans = 1
 
for i in range(N):
    ans = ans*(i+1) % mod

print(ans)
# Judge status: Wrong Answer
import scipy.misc
N,P=map(int,input().split(' '))
A=list(map(int,input().split(' ')))
odd = 0
even = 0
for i in A:
    if i%2 !=0:
        odd += 1
    else:
        even += 1

ans = 0
if P ==1:
    for i in range(1,odd+1,2):
        ans += scipy.misc.comb(odd,i)
else:
    for i in range(0,odd+1,2):
        ans += scipy.misc.comb(odd,i)
ans = ans*(2**even)
print(int(ans))
# Judge status: Accepted
N=int(input())
A=[int(a) for a in input().split()]
ABS_SUM=sum(abs(a) for a in A)
ans=0
if 0 in A:
  ans=ABS_SUM
else:
  pal=sum(1 for a in A if a<0)
  if pal%2==0:
    ans=ABS_SUM
  else:
    ABS_MIN=min(abs(a) for a in A)
    ans=ABS_SUM-ABS_MIN*2
print(ans)
# Judge status: Accepted
K,X=map(int,input().split())
for i in range(X-K+1,X+K):
  print(i, end=" ")
# Judge status: Wrong Answer
N = int(input())
NN = N
L = []
for i in range(2,int(N**0.5)+1):
    if N % i == 0:
        L.append(i)
        N = N//i
import heapq
heapq.heapify(L)
n = len(L)
ans = 0
for i in range(n):
    a = heapq.heappop(L)
    L = [j/a for j in L]
    ans += 1
if ans != 0:
    print(ans)
else:
    if NN == 1:
        print(0)
    else:
        print(1)
# Judge status: Wrong Answer
n,*a=map(int,open(0).read().split())
b=sum(a)
c=1
ans=1
if a[0]==1 and n==0:
    print(1)
if a[0]>0:
    print(-1)
    exit()
for i in a[1:]:
    b-=i
    c=min(c*2-i,b)
    ans+=c
    if c<0:
        print(-1)
        exit()
print(ans+sum(a))
# Judge status: Accepted
a, b, c, d = map(int, input().split())


lower = max(a, c)
upper = min(b, d)

if upper >= lower:
    print(upper - lower)
else:
    print(0)
# Judge status: Accepted
import math
of = 10**9+7
n,m = map(int,input().split())
if abs(n-m) >= 2:
    print(0)
    exit()
if n == m:
    print(math.factorial(n)*math.factorial(m)*2 % of)
else:
    print(math.factorial(n)*math.factorial(m) % of)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

x, y = mapint()
cnt = 0
if x*y>0:
    if y<x:
        cnt += 2
    cnt += abs(x-y)
elif x*y==0:
    if x<y:
        cnt = y-x
    else:
        cnt = (x-y)+1
else:
    cnt += 1
    x *= -1
    cnt += abs(x-y)
print(cnt)
# Judge status: Accepted
N=int(input())

t = [0]
x = [0]
y = [0]
for i in range(N):
    t1,x1,y1=[int(i) for i in input().split()]
    t.append(t1)
    x.append(x1)
    y.append(y1)

flag=True

for i in range(N):
    zahyo=abs(x[i]-x[i+1])+abs(y[i]-y[i+1])
    jikansa=t[i+1]-t[i]
    if zahyo<=jikansa and zahyo%2==jikansa%2:
        continue
    else:
        flag=False
        break

if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, m = MAP()

print(n + (m - 2 * n) // 4 if m >= 2 * n else m // 2)
# Judge status: Accepted
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort()
ans = 0
for i in range(n-k):
    ans += h[i]
print(ans)
# Judge status: Accepted
alp = "abcdefghijklmnopqrstuvwxyz"
s = input()
K = int(input())
N = len(s)
T = ""
for i in range(N):
    n = alp.index(s[i])
    if i==N-1:
        T+=alp[(n+K)%26]
    else:
        if n!=0 and K>=26-n:
            T+="a"
            K-=(26-n)
        else:T+=alp[n]
print(T)
# Judge status: Accepted
def gcd(a, b):
    return b if a % b == 0 else gcd(b, a % b)


def lcm(a, b):
    return a // gcd(a, b) * b


n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
ans = a[0]
for x in range(1, n):
    ans = lcm(ans, a[x])

print(ans)
# Judge status: Accepted
import bisect
n=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
sm=0
for j in B:
  sm+=bisect.bisect_left(A,j)*(n-bisect.bisect_right(C,j))
print(sm)
# Judge status: Accepted
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
A,B = map(int,input().split())

if A==B:
    print("Draw")
else:
    if A == 1:
        A = 14
    if B == 1:
        B = 14
    print("Alice" if A > B else "Bob")
# Judge status: Wrong Answer
N = input()
N_list = list(N)
if N_list[-1] == 2 or N_list[-1] == 4 or N_list[-1] == 5 or N_list[-1] == 7 or N_list[-1] == 9:
    print("hon")
elif N_list[-1] == 0 or N_list[-1] == 1 or N_list[-1] == 6 or N_list[-1] == 8:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
N, K = map(int,input().split())
S = input()
ans = 0
for i in range(N-1):
  if S[i] == S[i+1]:
    ans += 1
print(min(N-1, ans + 2 * K))
# Judge status: Wrong Answer
N = int(input())

def is_lunlun(x):
    if x < 10:
        return True
    elif abs(int(str(x)[0])- int(str(x)[1])) > 1:
        return False
    else:
        return is_lunlun(int(str(x)[1:]))


K = 1
num = 1
while True:
    if is_lunlun(num + 1):
        K += 1
        num = num + 1
    else:
        K += 1
        num = num + 9
    if K >= N:
        break
print(num)
# Judge status: Wrong Answer
s=list(input())
k=int(input())
f=lambda x:(x-97)%26
for i in range(len(s)):
    j=26-f(ord(s[i]))
    if j>k:
        continue
    k-=j
    s[i]='a'
k%=26
s[-1]=chr(f(ord(s[-1])+k)+97)
print(*s,sep='')
# Judge status: Accepted
n = int(input())
a = [-1, 1] + list(map(int, input().split()))
cnt = [0] * (n+1)

for i in range(2, n+1):
    cnt[a[i]] += 1

for i in range(1, n+1):
    print(cnt[i])
# Judge status: Accepted
import fractions
 
ans=0
f=[0]
g=[0]
N = int(input())
A = list(map(int,input().split()))
for i in range(N-1):
    f.append(fractions.gcd(f[i],A[i]))
    g.append(fractions.gcd(g[i],A[N-i-1]))
for i in range(N):
    ans = max(ans,fractions.gcd(f[i],g[N-i-1]))
print(ans)
# Judge status: Wrong Answer
S = list(input())
f = False
c = 0

for i  in range(len(S) - 1):
    if i == len(S) - 2:
        break
    if S[i] != S[i + 1]:
        continue
    else:
        if S[i] == "0":
            S[i+1] = "1"
            c += 1
        else:
            S[i+1] = "0"
            c += 1

print(c)
# Judge status: Wrong Answer
# B
# 2020/03/27 8:52-
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x = sorted(x)
y = sorted(y)

xr = x[-1]
yl = y[0]

if xr <= yl and X < yl and xr <= Y:
    print('No War')
else:
    print('War')
# Judge status: Accepted
n,a,b=map(int,input().split())
cnt=0
for i in range(1, n+1):
  x=sum(map(int,str(i)))
  if a<=x<=b:
    cnt+=i
print(cnt)
# Judge status: Accepted
K,X = map(int,input().split())
if K*500>=X:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
p, q, r = map(int, input().split())
if p >= q and p >= r:
    print(q + r)
elif q >= p and q >= r:
    print(p + r)
else:
    print(p + q)
# Judge status: Accepted
q, h, s, d = map(int, input().split())
n = int(input())

ll = min(q*8, h*4, s*2, d)

res = 0
res += (n//2)*ll
n %= 2



res += min(q*4, h*2, s)*n


print(res)
# Judge status: Accepted
A = int(input())
B = int(input())
C = int(input())
X = int(input())

import itertools as it
ans = 0
for a,b,c in it.product(range(A+1), range(B+1), range(C+1)):
    if 500*a + 100*b + 50*c == X:
        ans += 1
print(ans)
# Judge status: Wrong Answer
n=int(input())
p=[int(x) for x in input().rstrip().split()]

cnt=0
for i in range(n-1):
  if p[i]==i+1:
    now=p[i+1]
    p[i+1]=p[i]
    p[i]=now
    cnt+=1
print(cnt)
# Judge status: Accepted
n = int(input())

x_max = 0
y_max = 0
x_min = 10**9
y_min = 10**9

p_arr = [0]*n
m_arr = [0]*n

for i in range(n):
  x, y = map(int, input().split())
  p_arr[i] = x + y
  m_arr[i] = x - y
  

p_dist = max(p_arr) - min(p_arr)
m_dist = max(m_arr) - min(m_arr)
dist_max = max(p_dist, m_dist)
  
  
print(dist_max)
# Judge status: Accepted
n=int(input())
if n==0:
  print(0)
  exit()
s=""
while n!=0:
  if n % 2 == 1:
    s = "1" + s
    n = (n-1)//2*(-1)
  else:
    s="0"+s
    n=n//2*(-1)
print(s)
# Judge status: Accepted
def knapsack1(weight_value, w):
    cur = [0] * (w + 1)
    
    for weight, value in weight_value:
        for i in reversed(range(weight, w + 1)):
            cur[i] = max(cur[i], cur[i - weight] + value)

    return cur[w]


def main():
    n, w = [int(x) for x in input().split()]
    weight_value = [None] * n
    for i in range(n):
        weight_value[i] = [int(x) for x in input().split()]
    return knapsack1(weight_value, w)


print(main())
# Judge status: Wrong Answer
s = sorted(str(input()), reverse = True)
t = sorted(str(input()), reverse = True)
print("Yes" if s < t else "No")
# Judge status: Accepted
n = int(input())
d = list(map(int,input().split()))
d.sort()
a = n//2-1
print(d[a+1]-d[a])
# Judge status: Wrong Answer
N, M = map(int, input().split())
ab = [map(int, input().split()) for _ in range(N)]
a, b = zip(*ab)
cd = [map(int, input().split()) for _ in range(M)]
c, d = zip(*cd)

for i in range(N):
    tmp_dist = 10 ** 8
    tmp_point = 0
    for j in range(M):
        if tmp_dist > abs(a[i] - c[j]) + abs(b[i] - d[j]):
            tmp_point = j + 1
        tmp_dist = min(tmp_dist, abs(a[i] - c[j]) + abs(b[i] - d[j]))
        
    else:
        print(tmp_point)
# Judge status: Accepted
from collections import defaultdict

n = int(input())
d = defaultdict(int)
m = 0
for i in range(n):
    s = input()
    d[s] += 1
    m = max(m,d[s])

ans = []
for k,v in d.items():
    if v == m:
        ans.append(k)

ans.sort()
for a in ans:
    print(a)
# Judge status: Accepted
n=int(input())
t=[]
for i in range(n):
  at,bt=map(int,input().split())
  t.append([bt,at])
t.sort()
temp=0
for i in range(n):
  temp=temp+t[i][1]
  if temp>t[i][0]:
    print("No")
    break
else:
  print("Yes")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

ans = 0
mod = 1000000007

for i in range(60):
    one_count =0
    zero_count = 0
    for j in range(N):
        if A[j] >> i & 1 == 1:
            one_count+=1
        else:
            zero_count+=1
    ans += (one_count*zero_count)*(2**i)
    ans = ans%mod
print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

ans = -1e18
ans = max(ans, a*c)
ans = max(ans, a*d)
ans = max(ans, b*c)
ans = max(ans, b*d)
print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

n, k = [int(x) for x in input().split()]
h = [int(input()) for _ in range(n)]

h.sort()

h1 = h[:k]
h2 = h[::-1][:k]

print(min(max(h1) - min(h1), max(h2) - min(h2)))
# Judge status: Accepted
N, L = map(int, input().split())
A = [L+i for i in range(N)]

A.remove(min(max(A), *[abs(a) for a in A]))

print(sum(A))
# Judge status: Accepted
x_list = list(map(int, input().split()))

for i in range(len(x_list)):
    if i+1 != x_list[i]:
        print(i+1)
# Judge status: Accepted
n,k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] -= 1
INF = 1001001001
dist = [INF]*n
dist[0]=0
now=0
flag = True
while 1:
    to = a[now]
    if dist[to]!=INF and flag:
        loop = dist[now] + 1 - dist[to]
        k-=1
        k %= loop
        flag = False
    else:
        dist[to]=dist[now]+1
        k-=1
    now = to
    if k == 0:
        print(to+1)
        break
# Judge status: Accepted
n=int(input())
i=0
point=0
while n>point:
    i+=1
    point+=i
noneed=point-n
for j in range(1,i+1):
    if j==noneed:
        continue
    print(j)
# Judge status: Accepted
a, b, x = map(int, input().split(' '))
answer = b//x - (a-1)//x
print(answer)
# Judge status: Accepted
from collections import Counter
n = int(input())
A = Counter(list(int(input()) for _ in range(n)))
ans = 0
for a in A.values():
  if a%2 == 1:
    ans += 1
print(ans)
# Judge status: Accepted
import sys    #インタプリタや実行環境に関する情報を扱うためのライブラリ
import os     #フォルダやファイルを操作
import math

N=int(input())
count=0

for i in range(N+1):
    if i==0:
        continue
    if i<10:
        count +=1
    if i<100:
        continue
    elif i<1000:
        count +=1
    elif i<10000:
        continue
    elif i<100000:
        count+=1

print(count)
# Judge status: Accepted
N = int(input())

ok_count = 0
for i in range(1, N + 1, 2):
    # 約数を8個もつものの数
    count = 0
    for j in range(1, i + 1):
        # print("{}".format(j))
        if i % j == 0:
            count += 1
    if count == 8:
        ok_count += 1
print(ok_count)
# Judge status: Accepted
a,b,c=map(int,input().split());print('YNeos'[c<=a+b or(a-b)**2<=(2*(a+b)-c)*c::2])
# Judge status: Accepted
k, s = map(int, input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    if k >= s - i - j >= 0:
      ans += 1

print(ans)