peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
d,t,s =map(int,input().split())
if d/s <=t :
    print('Yes')
else :
    print('No')
# Judge status: Accepted
x = int(input())

print(int(9 - (x-399)/200))
# Judge status: Wrong Answer
n, m = list(map(int, input().split()))

moves = [list(map(int, input().split())) for i in range(m)]

possibilities = [False] * n
possibilities[0] = True
nums = [1] * n

for i in range(m):
    x = moves[i][0] - 1
    y = moves[i][1] - 1

    if possibilities[x]:
        possibilities[y] = True

    nums[x] -= 1
    nums[y] += 1
    # if nums[x] == 0:
    #     possibilities[x] = False

ans = 0
for j in range(n):
    if possibilities[j] and (nums[j] > 0):
        ans += 1
print(ans)
# Judge status: Wrong Answer
import numpy as np

n = int(input())
h = list(map(int, input().split()))
D = [0] * (n + 1)
D[1:] = np.diff(h)
max_cnt = cnt = 0
for i in range(n - 1, -1, -1):
    if D[i] <= 0:
        cnt += 1
    else:
        max_cnt = max(max_cnt, cnt)
        cnt = 0
print(max_cnt)
# Judge status: Accepted
from collections import deque
s = input()
t = input()

u = deque(s)
ok = False
for i in range(len(s)):
  u.rotate(1)
  if ''.join(u) == t:
    ok = True
    
print('Yes' if ok else 'No')
# Judge status: Wrong Answer
n,k=map(int,input().split())
d=list(map(int,input().split()))
for i in range(n,10000):
  s=str(i)
  ok=True
  t_str=""
  for ss in s:
    if int(ss) in d:
      ok=False
      break
    t_str+=ss
  if ok:
    print(int(t_str))
    exit(0)
# Judge status: Accepted
a,b,c=map(str,input().split())
print(c,a,b)
# Judge status: Accepted
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v-w<=0:
  print("NO")
else:
  if abs(a-b)/(v-w)<=t:
    print("YES")
  else:
    print("NO")
# Judge status: Accepted
n, m = [int(x) for x in input().split()]

count_set = set(range(1, m + 1))
for _ in range(n):
    temp_list = [int(x) for x in input().split()]
    temp_list[0] = 0
    count_set &= set(temp_list)
print(len(count_set))
# Judge status: Wrong Answer
N = int(input())
for i in range(N, 999):
    a = str(i)
    if a[0] == a[1] and a[1] == a[2]:
        print(a)
        exit()
# Judge status: Accepted
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

N = int(input())
An = [int(input()) for i in range(N)]
Asort = sorted(An, reverse=True)

for A in An:
    if A != Asort[0]:
        print(Asort[0])
    else:
        print(Asort[1])
# Judge status: Wrong Answer
s=input()
ans=0
for i in range(1,4):
  if s[0]==s[i]:
    ans+=1

if ans==1:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
 
def solve(N, A):
  
  prev = 1 - A[0]
  rt = 1
  for a in A[1:]:
    if a > prev * 2:
      print(-1)
      return
    prev = prev * 2 - a
    rt += prev + a
  print(rt)
  
solve(N, A)
# Judge status: Wrong Answer
from sys import stdin

n = stdin.readline().rstrip()
a = [int(x) for x in stdin.readline().rstrip().split()]

minc = 10**9

for b in a:
    count = 0
    while True:
        if b % 2 == 1: break
        b = b//2
        count = count + 1

    minc = min([minc, count])

print(minc)
# Judge status: Wrong Answer
S=input()[::-1]
ans=0
#支払う枚数
array = list(map(int, S))
L=len(array)
for i,n in enumerate(array):
    if n<= 5 :
        ans+=n
    elif n > 5:
        ans+= 10-n
        if i <L-1:
            array[i+1] +=1
        else:
            ans +=1
                
print( ans)
# Judge status: Accepted
n,m = [int(x) for x in input().split()]
a = []
b = []
for _ in range(n):
    a.append(input())
for _ in range(m):
    b.append(input())


ans = False
for i in range(n-m+1):
    for j in range(n-m+1):
        tmp = True
        for y in range(m):
            for z in range(m):
                tmp &= a[i+y][j+z] == b[y][z]
        if tmp:
            ans = True
if ans:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a,b,c,d = map(int, input().split())
count = 0

#最大公約数
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a
 #最小公倍数
def lcm(a,b):
    return a*b // gcd(a,b)

gcd_num = lcm(c,d)

#a
a_count = a // c
a_count = a_count + (a//d)
a_count = a_count - (a//gcd_num)

#b
b_count = b // c
b_count = b_count + (b//d)
b_count = b_count - (b//gcd_num)

print((b-a)-  b_count + a_count)
# Judge status: Accepted
from fractions import gcd
a,b,c,d = map(int, input().split())
def f(p):
  if a % p ==0:
    return(b//p - a//p + 1)
  else:
    return(b//p - a//p)
  
print(b-a+1 - (f(c)+f(d) - f(int(c*d/gcd(c,d)))))
# Judge status: Accepted
n,k = map(int,input().split())
has = [False] * n

for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in a:
        has[j - 1] = True
print(has.count(False))
# Judge status: Wrong Answer
a, b = map(int, input().split())

if a*b/2 ==1:
  print("Odd")
else :
  print("Even")
# Judge status: Accepted
S = input()
id = 0
keyence = "keyence"
for i in range(len(S)):
    if S[i] == keyence[id]:
        id += 1
    else:
        break
id2 = 1
for i in reversed(range(id, len(S))):
    if S[i] == keyence[-id2]:
        id2 += 1
    else:
        break

if id + id2 - 1 >= 7:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s = list(input())
n = len(s)
list = []
#print(s)
for i in range(n-2):
  A = int(s[i]+s[i+1]+s[i+2])
  #print(A)
  B = abs(A-753)
  #print(B)
  list.append(B)
print(min(list))
# Judge status: Wrong Answer
S = input()
a = S.count("a")
b = S.count("b")
c = S.count("c")
if a == b == c:
    print("YES")
elif a == b == c+1:
    print("YES")
elif a == b+1 == c+1:
    print("YES")
else:
    print("No")
# Judge status: Accepted
import numpy as np

n, m = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)

if (np.count_nonzero(a >= np.sum(a)/(4*m)) >= m):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

a,b,c=mp()
if a<=c<=b:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n,k = map(int,input().split())
a = list(map(int,input().split()))
def check(t):
  ans = 0
  for aa in a:
    if aa > t:
      ans += aa//t
max = 10**9
min = 0
while max-min>1:
  mid = (max+min)/2
  if check(mid):
    max = mid
  else:
    min = mid
print(max)
# Judge status: Accepted
#75 C - 怪文書
import collections
n = int(input())
S = [input() for _ in range(n)]

cnt = collections.Counter(S[0])
for s in S[1:]:#O (50)
    for a in cnt.keys():# O(26)
        if a in s:# O(50)
            cnt[a] = min(cnt[a],s.count(a))# O(50)
        else:
            cnt[a] = 0
            
ans = [key*value for key,value in cnt.items() if value > 0]
ans = sorted(ans,reverse = False)
print(''.join(ans))
# Judge status: Accepted
i=input()
if i=="5 7 5" or i=="7 5 5" or i=="5 5 7":
  print("YES")
else:
  print("NO")
# Judge status: Accepted
a=input()
if len(set(a[1:]))==1 or len(set(a[:3]))==1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import bisect
N=int(input())
A=[]
ans=0
for i in range(N):
    a=int(input())
    A.append(a)
cl=[A[-1]]
ans=1
for i in range(N-1)[::-1]:
    a=A[i]
    if a>=cl[-1]:
        cl.append(a)
        ans+=1
    else:
        b=bisect.bisect_right(cl,a)
        cl[b]=a
print(ans)
# Judge status: Accepted
# C - Traveling
# https://atcoder.jp/contests/abc086/tasks/arc089_a

# dt = ti+1 −ti
# dist = abs(xi+1 − xi)+abs(yi+1 − yi)

# キーポイント: パリティ
# x + y は毎秒ごとに必ず偶奇が入れ替わる。

n = int(input())

T = 0
X = 0
Y = 0

cnt = 0

for i in range(n):
    t,x,y= map(int,input().split())

    if abs(x-X) + abs(y-Y) <= (t-T) and (x+y)%2 == t%2:
        cnt += 1
    T,X,Y = t,x,y
print("Yes" if cnt == n else "No")
# Judge status: Wrong Answer
n, d = map(int, input().split())
cnt = 0
for _ in range(n):
  x, y = map(int, input().split())
  if (x * x + y * y <= d):
    cnt = cnt + 1
print(cnt)
# Judge status: Accepted
from itertools import accumulate, count

n = int(input())

cumsum_ = accumulate(count(1))
cumsum = []
for x in cumsum_:
    if x >= n:
        cumsum.append(x)
        break
    else:
        cumsum.append(x)

x = cumsum[-1] - n
for i in range(1, len(cumsum)+1):
    if i != x:
        print(i)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
K = sum(A)
S = 0

for i in range(N-1):
    K = K - A[i]
    S = S + A[i]*K

ans = S%(10**9+7)

print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
cnt = 0
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([a,b])
L.sort()

cnt = 0
sum1 = 0
for i in range(n):
    price  = L[i][0]*L[i][1]
    num = L[i][1]
    if cnt + num <= m:
        cnt +=num
        sum1 +=price
    elif cnt + num > m:
        num = m - cnt
        sum1 += num*L[i][0]
        break
print(sum1)
# Judge status: Wrong Answer
a = int(input())
print(a+a^2+a^3)
# Judge status: Accepted
n, m = map(int,input().split())
li = []
ans = []
#市, 年, 出力順で格納

for i in range(m):
    x = list(map(int,input().split()))
    x.append(i)
    li.append(x)

li.sort()

for i in range(len(li)):
    if i == 0:
        y = 1
    elif li[i][0] == li[i-1][0]:
        y += 1
    else:
        y = 1
    li[i].append(str(li[i][0]).rjust(6,'0') + str(y).rjust(6,'0'))

li.sort(key=lambda x: x[2])

for i in li:
    print(i[3])
# Judge status: Wrong Answer
W,H,N = map(int,input().split())

grid = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    grid.append(array)

left = 0
right = W
up = H
down = 0

for i in range(N):
  if grid[i][2] == 1:
    left = grid[i][0]
  elif grid[i][2] == 2:
    right = grid[i][0]
  elif grid[i][2] == 3:
    down = grid[i][1]
  elif grid[i][2] == 4:
    up = grid[i][1]
  
print((right-left)*(up-down))
# Judge status: Accepted
N, W = map(int, input().split())
 
import numpy as np
dp = np.zeros(W + 1, dtype='int64')
 
for i in range(1, N + 1):
    w, v = map(int, input().split())
    dp[w:W+1] = np.maximum(dp[w:W+1], dp[:W-w+1] + v)
 
print(dp[-1])
# Judge status: Wrong Answer
import bisect

n = int(input())
al = list(map(int,input().split()))
al.sort()

if n == 1:
    print(1)
    exit()
elif n == 2:
    if abs(al[0] - al[1]) <= 2:
        print(2)
    else:
        print(1)


ans = 0
for i in range(n):
    idx = bisect.bisect_right(al,al[i]+2)
    if idx == n:
        idx -= 1
    tmp = idx - i
    ans = max(ans,tmp)


print(ans)
# Judge status: Accepted
n = int(input())
d = sorted(list(map(int, input().split())))
t = n//2
if d[t-1] == d[t]:
    print(0)
else:
    print(d[t]-d[t-1])
# Judge status: Wrong Answer
s = input()
t = input()

for i in range(len(s) - len(t) + 1)[::-1]:
    for j, (ns, nt) in enumerate(zip(s[i:i+len(t)], t)):
        print(j, ns, nt)
        if ns != nt and ns != '?':
            break
        if j == len(t) -1:
            ans = s[:i] + t + s[i+len(t):]
            print(ans.replace('?', 'a'))
            exit()
print('UNRESTORABLE')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
l = [i for i in range(a, 101, a)]
ans = "NO"
for i in l:
    if i % b == c:
        ans = "YES"
print(ans)
# Judge status: Accepted
N, H = map(int, input().split())
a = []
b = []
for i in range(N):
    a1, b1 = map(int, input().split())
    a.append(a1)
    b.append(b1)

am = max(a)

bm = []
for i in range(N):
    if b[i] > am:
        bm.append(b[i])
bm.sort()

ans = 0
while len(bm) > 0:
    attack = bm.pop()
    H -= attack
    ans += 1

    if H <= 0:
        print(ans)
        exit()

print(ans + -(-H//am))
# Judge status: Accepted
n=int(input())
keep=1
while keep**2<=n:
  keep+=1
print((keep-1)**2)
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

print((max(A, B, C) * 2 ** K) + A + B + C - max(A, B, C))
# Judge status: Accepted
N, K = map(int, input().split())
ans = [True]*N
for i in range(K):
  d = int(input())
  l = list(map(int, input().split()))
  for a in l:
    ans[a-1] = False
print(sum(ans))
# Judge status: Accepted
S=input()
A=S[0:int((len(S)-1)/2)]
B=S[int((len(S)+3)/2):-1]
def kaibun(s):
    a,b="",""
    for i in range(len(s)):
        a = a+s[i]
        b = s[i]+b
    return a==b
print('Yes' if (kaibun(S) and kaibun(A) and kaibun(B)) else 'No')
# Judge status: Accepted
from collections import defaultdict
N, M = map(int,input().rstrip().split())
d = defaultdict(lambda: 0)
for _ in range(N):
    A, B = map(int,input().rstrip().split())
    d[A] += B
ans=0
for k in sorted(d.keys()):
    if d[k]<=M:
        ans += k*d[k]
    else:
        ans += k*M
    M -= d[k]
    if M<=0:break
print(ans)
# Judge status: Accepted
N, K = list(map(int, input().split()))
a = []
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    a.extend(A)
print(N - len(set(a)))
# Judge status: Wrong Answer
s = input()
s[0] + s[1] + s[2]
# Judge status: Accepted
a = [int(i) for i in input().split()]
ans = set()
for i in a:
    ans.add(i)
print(len(ans))
# Judge status: Accepted
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
n = int(input())
xs = list(map(int,input().split()))
min_x = sum(xs) / n
x_z = Decimal(str(min_x)).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
ans = 0
for i in xs:
    ans += (x_z - i)**2
print(ans)
# Judge status: Accepted
N = int(input())
lista = list(map(int, input().split()))
lista.sort(reverse= True)

count = 0
area = 1

for i in range(len(lista)- 1):
  if(lista[i] == lista[i+ 1]):
    del lista[i]
    area*= lista[i]
    count+= 1
    if(count == 2):
      break
      
if(count == 2):
  print(area)
else:
  print(0)
# Judge status: Accepted
n, k, s = map(int, input().split())
sub = []
if s == 10**9:
    for i in range(n):
        if i < k:
            sub.append(s)
        else:
            sub.append(1)
else:
    for i in range(n):
        if i < k:
            sub.append(s)
        else:
            sub.append(s+1)
print(*sub)
# 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)
INF = 10**9
mod = 10**9+7

a,b,c = I()
if b-a == c-b:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n = int(input())
s = input()
l = s.find('#')
r = s.rfind('.')
if l<0 or r<0:
    print(0)
    exit()
a = len(list(filter(lambda x: x == '.', s[l:])))
b = len(list(filter(lambda x: x == '#', s[r::-1])))
print(min([a, len(s[l:])-a, b]))
# Judge status: Accepted
a, b, c = map(int, input().split())
if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
    print(0)
elif (a and b and c) % 2 != 0 :
    print(min(a * b, b * c, c * a))
# Judge status: Accepted
d,n=map(int,input().split())
li = [i * 10 ** (2*d) for i in range(2*n) if i % 100 != 0]
print(li[n-1])
# Judge status: Accepted
X = int(input())
if (X == 3 or X == 5 or X == 7):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N = int(input())
div, mod = divmod(N, 15)
x = N * 800
y = div * 200

print(x - y)
# Judge status: Wrong Answer

def main():
    x, y = map(int, input().split())
    if x * 4 <= y or y % 2!=0:
        print('No')
    else:
        print('Yes')


if __name__ == "__main__":
    main()
# Judge status: Accepted
n=int(input())
t,a=map(int,input().split())
h=[abs(a-(t-int(i)*0.006)) for i in input().split()]
print(h.index(min(h))+1)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(2,n-1):
    for j in range(n-i):
        if a[j]<i and a[j]+a[j+i]==i:
            count+=1
print(count)
# Judge status: Wrong Answer
p = ["a", "e", "i", "o", "u"]
c = input()
if c in p:
    print("vowel")
else:
    print("consolant")
# Judge status: Accepted
from fractions import gcd
from functools import reduce


input()
print(reduce(gcd, map(int, input().split())))
# Judge status: Accepted
a, b, m = list(map(int, input().split()))

refrigerator = list(map(int, input().split()))
microwave = list(map(int, input().split()))



min_price = min(refrigerator) + min(microwave)

for i in range(m):
    x, y, c = list(map(int, input().split()))
    min_price = min(min_price, refrigerator[x-1]+microwave[y-1]-c)
    
print(min_price)
# Judge status: Accepted
#template
from collections import Counter
def inputlist(): return [int(j) for j in input().split()]
#template
A,B = inputlist()
ans = 0
count = 1
while True:
    if count >= B:
        break
    count += A-1
    ans +=1
print(ans)
# Judge status: Wrong Answer
N = 7
K = 4
S = 'ABACBAC'

print(S[ : K-1]+ S[K-1].lower() + S[K : ])
# Judge status: Accepted
n=int(input())
x=list(map(int,input().split()))
ans=10**9
for i in range(1,101):
    s=0
    for j in x:
        s+=(i-j)**2
    ans=min(s,ans)
print(ans)
# Judge status: Wrong Answer
k,n=map(int,input().split())
hoge=list(map(int,input().split()))
ans=hoge[0]+k-hoge[-1]
for i in range(n-1):
  ans=max(ans,hoge[i+1]-hoge[i])
  
print(ans)
# Judge status: Wrong Answer
n,k = map(int,input().split())
A = list(map(int,input().split()))

if sum(A)-n <= k:
    print(1)
    exit()
elif k == 0:
    print(max(A))
    exit()
top = 10**9
bottom = 1
def ok(x):
    res = 0
    for a in A:
        res += a//x
    return res <= k
while top - bottom > 1:
    mid = (top + bottom)//2
    if ok(mid):
        top = mid
    else:
        bottom = mid
print(top)
# Judge status: Accepted
# https://atcoder.jp/contests/abc134/tasks/abc134_e

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
from collections import deque
from bisect import bisect_left

N = INT()
A = []

for _ in range(N):
    A.append(INT())

t = deque([A[0]])
for a in A[1:]:
    i = bisect_left(t, a) - 1
    if i == -1:
        t.appendleft(a)
    else:
        t[i] = a

print(len(t))
# Judge status: Wrong Answer
N=int(input())
ans=0
for i in range(N) :
    if len(str(i))%2==0 :
        ans+=0
    else :
        ans+=1
print(ans-1)
# Judge status: Wrong Answer
q,h,s,d = map(int,input().split())
n = int(input())
h = min(q*2,h)
s = min(h*2,s)
d = min(s*2,d)
ans = 0
a_list = [2,1,0.5,0.25]
a = []
for i in a_list:
    a.append(n//i)
    n = n%i
print(int(a[0]*d+a[1]*s+a[2]*h+a[3]*q))
# Judge status: Accepted
import bisect
N = int(input())
A = sorted(map(int,input().split()))
B = sorted(map(int,input().split()))
C = sorted(map(int,input().split()))
print(sum(bisect.bisect_left(A,b)*(N-bisect.bisect_right(C,b)) for b in B))
# Judge status: Wrong Answer
n=int(input())
s=input()
x=0
a=[]
for i in range(n):
    if s[i]=="I":
        x+=1
    else:
        x-=1
    a.append(x)
print(max(a))
# Judge status: Accepted
import sys
input = sys.stdin.readline
N,M = map(int,input().split())
#低いやつを引いていく感じ
Hlist = list(int(x) for x in input().split())

flag = [1]*N

for i in range(M):
    A,B = map(int, input().split())
    A -= 1
    B -= 1
    if(Hlist[A] == Hlist[B]) :
        flag[A] = 0
        flag[B] = 0
    elif(Hlist[A] > Hlist[B]) :
        flag[B] = 0
    else:
        flag[A] = 0
print(sum(flag))
# Judge status: Accepted
A, B, T = map(int, input().split())

print(B*(T//A))
# Judge status: Wrong Answer
x = input("x:")
if x == 0:
  print(1)
if x == 1:
  print(0)
# Judge status: Accepted
a, b, c = map(int, input().split())
if (c - a - b) ** 2 - (4 * a * b) > 0 and c - a - b > 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,m,x=map(int,input().split())
l=[]
for i in range(n):
  l.append(list(map(int,input().split())))
s=[]
a=[0]*(m+1)
s.append(a)
for i in range(n):
  newl=[]
  for j in s:
    new=[j[k]+l[i][k] for k in range(m+1)]
    newl.append(new)
  s.extend(newl)
ans=float('inf')
for i in s:
  for j in range(m):
    if i[j+1]<x:break
  else:
    ans=min(ans,i[0])
if ans==float('inf'):
  print(-1)
else:
  print(ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
cnt=0
for i in range(N):
    cnt+=min(A[i]+A[i+1],B[i])
    A[i+1]=max(0,min(A[i]+A[i+1]-B[i],A[i+1]))
print(cnt)
# Judge status: Accepted
K, X = map(int, input().split())
ans = ''

for i in reversed(range(-K+1,K)):
  if i != -K+1:
    ans += str(X-i) + ' '
  else:
    ans += str(X-i)

print(ans)
# Judge status: Accepted
A, B = map(int, input().split())

if (A + B) & 1 == 1:
    print('IMPOSSIBLE')
else:
    print((A + B) // 2)
# Judge status: Accepted
n=int(input())
low=[]
high=[]
for i in range(n):
    a,b=map(float,input().split())
    low.append(a)
    high.append(b)
low.sort()
high.sort()
if n%2==0:
    low_avg=(low[n//2-1]+low[n//2])/2
    high_avg=(high[n//2-1]+high[n//2])/2
    ans=(high_avg-low_avg)*2+1
else:
    ans=high[(n-1)//2]-low[(n-1)//2]+1
print(int(ans))
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())

print((a + b) * h // 2)
# Judge status: Wrong Answer
N = int(input())

res = 0
for i in range(1,N+1):
    if N % i == 0:
        if i % 2 == 1:
            res += 1

print(res)
# Judge status: Accepted
import sys
N = int(input())
S = [int(input()) for _ in range(N)]
t = sum(S)
if t % 10 != 0:
    print(t)
    sys.exit()

res = 0
for s in S:
    if (t - s) % 10 != 0:
        res = max(res, t - s)
print(res)
# Judge status: Accepted
N,K=map(int,input().split())
d=[]
a=[]
for i in range(K):
    d.append(int(input()))
    a.append(list(map(int,input().split())))
    
aa=[0]*N
counts=0

for k in a:
    for j in k:
        aa[j-1]+=1
        
for x in aa:
    if x==0:
        counts+=1

print(counts)
# Judge status: Wrong Answer
N,M,K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a,b = [0],[0]
for i in range(N):
  a.append(a[i]+A[i])
for j in range(M):
  b.append(b[j]+B[j])
ans = 0
#print(a,b,N+1)
for i in range(N+1):
  if a[i] > K:
    break
  j = 0
  while K - a[i] >= b[j]:
    if j >= M:
      break
    j = j+1
  j = j-1
  ans = max(ans,i+j)

print(ans)
# Judge status: Wrong Answer
N = int(input())

A = []
for i in range(20):
    if 6**i<=N:
        A.append(6**i)
for i in range(1,20):
    if 9**i<=N:
        A.append(9**i)
AA = sorted(A,reverse=True)
        
INF = float("inf")
dp=[INF]*(N)
dp[0]=1

for i in range(N):
    for j in AA:
        dp[i]=min(dp[i-j]+1,dp[i])
    
#print(dp)
print(dp[-1])
# Judge status: Wrong Answer
x,y,z=map(int,input().split())

print((x-1)//(y+z))
# Judge status: Accepted
N, D = list(map(int, input().split()))
XY = [tuple(map(int, input().split())) for _ in range(N)]

count = 0
for x, y in XY:
    if x**2 + y**2 <= D**2:
        count += 1
print(count)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print("A" if abs(a-b)>abs(a-c) else "B")
# Judge status: Wrong Answer
from itertools import product
n,k = map(int, input().split())
d = list(map(int, input().split()))

nums = []
for i in range(10):
  if i not in d: nums.append(i)

m = str(n)
for i in range(len(m), len(m)+1):
  for j in product(nums, repeat=i):
    ans = ""
    for k in j: ans += str(k)
    if int(ans) >= n:
      print(ans)
      exit()
# Judge status: Accepted
a,b,c=(int(x) for x in input().split())
if a==b:
  if a==c:
    print("No")
  else:
    print("Yes")
else:
  if a==c:
    print("Yes")
  elif b==c:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
import sys
from collections import Counter
from collections import deque
import math
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,m=mp()
if m<2:
    print(0)
    exit()
if n>=2*m:
    print(m//2)
    exit()
print(n+(m-2*n)//4)
# Judge status: Accepted
n,m = map(int,input().split())
pre = [[] for _ in range(n)]
num=[]
for i in range(m):
    p,y = map(int,input().split())
    pre[p-1].append([i,y])
for i in range(n):
    pre[i].sort(key=lambda x:x[1])
    for j in range(len(pre[i])):
        num.append([pre[i][j][0],('0'*5+str(i+1))[-6:]+('0'*5+str(j+1))[-6:]])
num.sort(key=lambda x:x[0])
for k in num:
    print(k[1])