peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, w = list(map(int, raw_input().split()))
weights = []
values = []

for _ in range(n):
    wi, vi = list(map(int, raw_input().split()))
    weights.append(wi)
    values.append(vi)

dp = [[0 for __ in range(w+1)] for _ in range(n+1)]

for i in range(1, n+1):
    for j in range(1, w+1):
        dp[i][j] = max(dp[i-1][j], dp[i-1][j-weights[i-1]] + values[i-1] if weights[i-1] <= j else 0)

print(dp[n][w])
# Judge status: Accepted
n = int(input())
if n == 0:
  print(0)
else:
  ans = ""
  now = 0
  while n:
    r = n % (2**(now+1))
    if r:
      ans = "1" + ans
      n -= (-2)**now
    else:
      ans = "0" + ans
    now += 1
  print(ans)
# Judge status: Accepted
n, m = map(int,input().split())
 
l1 = []
l2 = []
for i in range(m):
    a,b = map(int,input().split())
    if a==1:
        l1.append(b)
    elif b==n:
        l2.append(a)

if len(set(l1)&set(l2)) >=1:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
K = int(input())
if K % 2 == 0:
    print((K // 2) ** 2)
else:
    print((K // 2) * ((K // 2) + 1))
# Judge status: Accepted
X = int(input())
print(X // 500 * 1000 + (X % 500) // 5 * 5)
# Judge status: Wrong Answer
a,b,h,m = map(int,input().split())
t = 60 * h + m#経過時間
aa = divmod(t / 360,2) 
bb = divmod(t / 30,2)
aaa = aa[1]
bbb = bb[1]
import math
if aaa >= bbb:
    θ = (aaa - bbb)
else:
    θ = (bbb - aaa)
theta = divmod(θ,1)
theta1 = theta[1] * math.pi
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(theta1))
print(c)
# Judge status: Accepted
n = int(input())
num_list = [int(i) for i in input().split()]
count = 0

for i in range(1,n):
    if num_list[i] < num_list[i-1]:
        count += (num_list[i-1] - num_list[i])
        num_list[i] = num_list[i-1]

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

if len(S) > K:
    print(S[:K]+"...")
else:
    print(S)
# Judge status: Accepted
import numpy as np

N, M = map(int, input().split())
a = [input().split() for i in range(N)]
# a = [[int(i[0]), int(i[1])] for i in a]
a = np.array(a, dtype='int64')
a = a[a[:, 0].argsort(), :]

mysum = 0
coin = 0
for c in a:
    if mysum + c[1] < M:
        mysum += c[1]
        coin += c[0] * c[1]
    else:
        d = M - mysum
        coin += d * c[0]
        break

print(coin)
# Judge status: Accepted
a,b = map(int, input().split())
if a <= b:
  print(a)
else:
  print(a-1)
# Judge status: Wrong Answer


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

subms = [input().split(" ") for i in range(M)]

setto = set()
penalties = 0 
correct = 0 
for sub in subms:
    sub[0] = int(sub[0])
    if sub[0] not in setto and sub[0] <= N:
        if sub[1] == "WA":
            penalties += 1
        if sub[1] == "AC":
            correct += 1
            setto.add(sub[0])

print(correct, penalties)
# Judge status: Accepted
n=int(input())
Range=[]
ans,end=0,-1*(10**9+1)
for i in range(n):
  x,y=list(map(int,input().split()))
  Range.append([x-y,x+y])
Range.sort(key=lambda X: X[1])

for R in Range:
  if end <= R[0]:
    ans += 1
    end=R[1]
  else:
    continue
print(ans)
# Judge status: Accepted
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

cnt = 0
for i in range(N):
    cnt += A[i] //2
    if i < N-1 and A[i+1] > 0:
        A[i+1] -= A[i]%2
        cnt += A[i]%2

print(cnt)
# Judge status: Accepted
a, b = map(int, input().split())

if a <= b:
  print(a)
else:
  print(a - 1)
# Judge status: Accepted
N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
cnt = 0
for elem in a:
  if x >= elem:
    cnt += 1
    x -= elem
  else:
    break
print(cnt if cnt != N or x == 0 else cnt - 1)
# Judge status: Accepted
a, b, c = map(int, input().split())

if a <= c and c <= b:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))

c_4=0
c_2=0

for i in l:
  if i%4==0:
    c_4+=1
  elif i%2==0:
    c_2+=1

if c_2==1:
  num=n
else:
  num=n-c_2
  
if num//2 <= c_4:
  ans="Yes"
else:
  ans="No"
  
print(ans)
# Judge status: Accepted
n, k = map(int,input().split())
li = list(map(int,input().split()))

for i in range(k):
    now = [0]*n

    for j in range(n):
        x = li[j]
        now[max(0,j-x)] += 1
        if j+x+1 < n:
            now[j+x+1] -= 1
    
    for j in range(n-1):
        now[j+1] += now[j]

    li = now
    if min(li) >= n:
        break

print(*li)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    A,B=map(int,input().split())
    for i in range(1,101):
        if int(i*0.08)==A and int(i*0.1):
            print(i)
            exit()
    print(-1)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,d = map(int,input().split())

m = d*2-1

if n%m==0:
    print(n//m)
else:
    print(n//m + 1)
# Judge status: Wrong Answer
from collections import Counter
from itertools import combinations

N = int(input())
S = input()

cnter = Counter(S)
alpha = set(cnter)

ans = 0

for i in range(1, len(alpha) + 1):
    if i == 1:
       ans += len(S)
    else:
        for pat in combinations(alpha, i):
            tmp = 1
            for v in pat:
                tmp *= cnter[v]
            ans += tmp

print(ans)
# Judge status: Accepted



n = list(map(int, list(input())))[::-1] + [0]
sum1 = sum(n)
for i in range(len(n)-1):
    if n[i] > 5 or (n[i]==5 and n[i+1]>4):
        n[i] = 10-n[i]
        n[i+1] += 1
print(min(sum1, sum(n)))
# Judge status: Accepted
N,P=map(int,input().split(' '))
A=list(map(int,input().split(' ')))
for i in A:
    if i%2 != 0:
        print(2**(N-1))
        exit()
if P ==0:
    print(2**N)
else:
    print(0)
# Judge status: Wrong Answer
N,K=map(int,input().split())
d=list(map(int,input().split()))

n=str(N)
flag=0

# for i in range(10):
#     if i not in d:
#         print(i)

for i in range(10000):
    S=N+i
    flag=0
    for j in range(len(str(S))):
        if int(str(S)[j]) not in d:
            flag+=1
            if flag==len(str(S)):
                print(S)
                break
    else:
        continue
    break
# Judge status: Accepted
n,q = map(int,input().split())

s=input()

dp = [0]*n

for i in range(1,n):
    if s[i-1] == 'A' and s[i] == 'C':
        dp[i] = dp[i-1] + 1
    else:
        dp[i] = dp[i-1]
#print(dp)
for _ in range(q):
    a, b = (int(x) for x in input().split())
    print(dp[b-1]-dp[a-1])
# Judge status: Accepted
#141 b
ki=["R","U","D"]
gu=["L","U","D"]
s=input()
ans=True
i=1
for c in s:
    if ans==False:
        break
    if i%2==1:
        if c not in ki:
            ans=False
    if i%2==0:
        if c not in gu:
            ans=False
    i+=1
print("Yes" if ans else "No")
# Judge status: Accepted
N, M = map(int, input().split())
LL = 0
RR = N
for i in range(M):
    L, R = map(int, input().split())
    if LL < L:
        LL = L
    if RR > R:
        RR = R
print(max(0, RR - LL + 1))
# Judge status: Wrong Answer
import math

N, K = map(int, input().split())
A = [-1] + list(map(int, input().split()))

m = 1
i = A.index(m)
left = math.ceil((i - 1) / (K - 1))
right = math.ceil((N - i) / (K - 1))
if (i - 1) % (K - 1) == 0 or (N - i) % (K - 1) == 0:
    print(right + left)
else:
    print(right + left - 1)
# Judge status: Accepted
from collections import OrderedDict
from collections import defaultdict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k] += 1
    else:
        ans.update({k: 1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
# Judge status: Wrong Answer
from collections import defaultdict

data = defaultdict()
for i in range(3):
    s = input()
    data[chr(ord("a") + i)] = s
cnt = defaultdict(int)
turn = "a"
while 1:
    cnt[turn] += 1

    if cnt[turn] == len(data[chr(ord(turn))]):
        ans = ord(turn) - (ord("a") - ord("A"))
        break

    turn = data[chr(ord(turn))][cnt[turn]]
print(chr(ans))
# Judge status: Accepted
a = [1, 2, 3]
for i in range(2):
  a.remove(int(input()))
  
print(a[0])
# Judge status: Accepted
X,Y,Z=map(int,input().split())
ans=[Z,X,Y]
print(*ans)
# Judge status: Accepted
import numpy as np

N, K = map(int, input().split())
p = np.array(list(map(int, input().split())))

e = (p + 1) / 2

# print(e)

cum_e = np.zeros(N + 1)
cum_e[1:] = np.cumsum(e)

# print(cum_e)

s = cum_e[K:] - cum_e[:-K]

print(max(s))
# Judge status: Accepted
N = int(input())
s = input()
t = input()
ans = 2*N
for i in range(N):
  A = s[:i] + t
  if A[:N] == s:
    ans = N+i
    break
print(ans)
# Judge status: Accepted
import itertools
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

l=list([a,b,c,d,e])
sum=99999
for v in itertools.permutations(l):
    s1=0
    for i in range(0,len(v)-1):
        d=v[i]
        if d%10!=0:
            d+=10-(d%10)
        s1+=d
    s1+=v[-1]    
    sum=min(s1,sum)
print(sum)
# Judge status: Accepted
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = min(a) + min(b)
for _ in range(M):
    x, y, c = map(int, input().split())
    if a[x-1]+b[y-1]-c < ans:
        ans = a[x-1]+b[y-1]-c
    else:
        pass
print(ans)
# Judge status: Wrong Answer
import math
N, x = map(int, input().split())
L = [int(x) for x in input().split()]
ans = 0
for i in L[1:N-1]:
    ans += i
m = math.floor((N-1)/2)
if L[0] > x:
    ans += L[0] - x
if L[N-1] > x and (N-1)%2 == 0:
    ans += L[N-1] - x
ans -= m * x
if ans < 0:
    ans = 0
print(ans)
# Judge status: Accepted
print(chr(ord(input())+1))
#ord() 文字からユニコード
#chr() ユニコードから文字
# Judge status: Accepted
from fractions import gcd

A,B=map(int,input().split())
p=set([1])
g=gcd(A,B)
for d in range(2,g):
    while g%d==0:
        p.add(d)
        g//=d
    if (d*d>=g): break
if g>=2:
    p.add(g)
print(len(p))
# Judge status: Wrong Answer
n=int(input())
l=[int(input()) for i in range(n)]

num=l[0]
cnt=1
for i in range(10**5):
  num=l[num-1]
  cnt+=1
  if num==2:
    break
    
if cnt==10**5:
  cnt=-1
  
print(cnt)
# Judge status: Accepted
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
from collections import defaultdict
dd = defaultdict(int)

N,K=MI()
A=LI()

for i in range(N):
    dd[A[i]]+=1
    
li=[]

for k,v in dd.items():
    li.append(v)
    
li.sort(reverse = True)

print(N - sum(li[:min(K,N)]))
# Judge status: Accepted
import sys
MOD = 998244353


def main():
    n, *d = map(int, sys.stdin.buffer.read().split())
    e = [0]*n
    for i in d:
        e[i] += 1
    ans = e[0]
    for i in d[1:]:
        ans *= e[i-1]
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
import math
a, b = map(int, input().split())


for i in range(1251):
    aa=math.floor(0.08*i)
    bb=math.floor(0.1*i)
    if aa==a and bb==b :
        print(i)
        sys.exit()
print(-1)
# Judge status: Accepted
N = input()
if N[0] == N[1] == N[2] or N[3] == N[1] == N[2]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import numpy as np
n = int(input())
a = np.sort(np.array([int(x) for x in input().split()]))
max_num = np.max(a)+1
dp = np.array([True]*(max_num))

if np.all(a==a[0]):
    print(0)
elif np.count_nonzero(a==1)  == 1:
    print(1)
else:
    for i in range(1,max_num):
        if dp[i] and i in a:
            for j in np.arange(i*2, max_num, i):
                dp[j] = False
    print(dp)
    print(np.count_nonzero(dp[a] == True))
# Judge status: Wrong Answer
S = input().split(" ")
n = int(S[0])
k = int(S[1])
arr = []
for i in range(n):
    arr.append(int(input()))

def calculate(n,k,arr):
    arr.sort()
    drr = []
    for i in range(1,n):
        drr.append(arr[i] - arr[i-1])
    drr.sort()
    drr = drr[:k-1]
    print(sum(drr))

calculate(n,k,arr)
# Judge status: Accepted
x,n = input().split()
x=int(x)
list=input().split()
diff = 200
for i in range(-1, 102):
    if str(i) not in list and abs(i-x) < diff:
        diff = abs(i-x)
        ans = i
print(ans)
# Judge status: Wrong Answer
from string import ascii_lowercase
from itertools import product
n = int(input())
alphabets = ascii_lowercase[:n]

def check(s):
    if s[0] == 'a':
        now = 'a'
        for i in range(1, n):
            if s[i] == chr(ord(now)+1) or s[i] == chr(ord(now)) or s[i] == 'a':
                now = s[i]
            else:
                return False
        return True
    return False

for s in product(alphabets, repeat=n):
    if check(s):
        print(*s, sep='')
# Judge status: Accepted
s=input()
a=list(s).count('a')
b=list(s).count('b')
c=list(s).count('c')
if(max(a,b,c)-min(a,b,c)>1):
    print("NO")
else:
    print("YES")
# Judge status: Accepted
s = input()
s_len = len(s)
s = 'x' *s_len
print(s)
# Judge status: Wrong Answer
a, b, c = map(int,input().split())

a2 = 0
while a2 <= b:
    a2 += a
a2 -= b

c0 = set()
a3 = a%b
c0.add(a3)
if a3 == c:
    ans = 'YES'
else:
    ans = 'NO'
while True:
    a3 += a2
    a3 %= b
    if a3 == c:
        ans = 'YES'
        break
    if a3 in c0:
        break
    c0.add(a3)

print(ans)
# print(c0)
# Judge status: Accepted
import math
N, K = map(int,input().split())
print(math.ceil((N-1)/(K-1)))
# Judge status: Accepted
N=input()
res = 0
for i in N:
    res += int(i)
    
if res%9 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
p = []
for _ in range(N):
    x, y = map(int, input().split())
    p.append((x, y))
p.sort()
x1, y1 = p[0]
x2, y2 = p[1]
if x1 <= x2 and y1 <= y2:
    print(abs((x1 + y1) - (x2 + y2)))
elif x1 <= x2 and y1 >= y2:
    print(abs((x1 - y1) - (x2 + y2)))
elif x1 >= x2 and y1 >= y2:
    print(abs((x1 + y1) - (x2 + y2)))
elif x1 >= x2 and y1 <= y2:
    print(abs((x1 - y1) - (x2 + y2)))
# Judge status: Accepted
N,x=map(int, input().split())
A=list(map(int, input().split()))
ans=0
if A[0]>x:
    ans+=A[0]-x
    A[0]=x
for i in range(1,N):
    if A[i]+A[i-1]>x:
        y=A[i]+A[i-1]-x
        A[i]-=y
        ans+=y
print(ans)
# Judge status: Accepted
x, y = map(int,input().split())

A =[1,3,5,7,8,10,12]
B =[4,6,9,11]

if (x in A and y in A) or (y in B and x in B):
  print("Yes")
  
else:
  print("No")
# Judge status: Accepted
n,m=map(int,input().split())
s,t=set(),set()
for _ in range(m):
  a,b=map(int,input().split())
  if a==1:t.add(b)
  if b==n:s.add(a)
if s&t:print("POSSIBLE")
else:print("IMPOSSIBLE")
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=list(map(int,input().split()))
import numpy as np
a=np.array(a)
temp=np.argmin(a)
import math
if n==k:
  print(1)
else:
  print(math.ceil(temp/(k-1))+math.ceil((n-temp-1-temp%(k-1))/(k-1)))
# Judge status: Wrong Answer
l=list(set(input()))
l.sort()
#print(l)
flag=1
for i in range(len(l)):
    if not(ord(l[i])==i+97):
        print(chr(i+97))
        flag=0
        break
if flag==1:
    print("None")
# Judge status: Wrong Answer
import math
N = int(input())
dp=[100000]*(100000+1)
dp[0]=0
dp[1:5]=range(1,6)
for n in range(6,N+1):
  k6=int(math.log(n,6))
  k9=int(math.log(n,9))
  dp[n]=min(dp[n],dp[n-6**k6]+1,dp[n-9**k9]+1,dp[n-1]+1)
print(dp[N])
# Judge status: Accepted
def main():
    X = list(map(int, input().split()))
    for i, x in enumerate(X):
        if x == 0:
            print(i + 1)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c,k=map(int,input().split())
abc=a+b+c
k2=k%2
if k2==0:
  ans=a-b
else:
  ans=b-a
print(ans)
# Judge status: Accepted
s = input()
cnt = 0
ans = 0
for x in s:
    if x in ['A', 'C', 'G', 'T']:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
ans = max(ans, cnt)
print(ans)
# Judge status: Accepted
X, Y = map(int,input().split())
ans = 0
while X <= Y:
    ans += 1
    X *= 2
print(ans)
# Judge status: Accepted
import fractions

A,B,C,D = map(int,input().split())
LCM = (C*D)//fractions.gcd(C,D)
ans = B-A-(B//C-(A-1)//C)-(B//D-(A-1)//D)+(B//LCM-(A-1)//LCM)+1
print(ans)
# Judge status: Wrong Answer
import math

a, b, t = [int(x) for x in input().split()]
print(math.ceil((t + 0.5) % a) * b)
# Judge status: Accepted
N = int(input())
low = [0] * N;  up = [0] * N;
for i in range(N):
    low[i], up[i] = [int(x) for x in input().split()]

low.sort()
up.sort(reverse = True)

if N % 2 == 0:
    k = N // 2
    ans = 0
    l1 = low[k - 1]
    l2 = low[k]
    u1 = up[k - 1]
    u2 = up[k]
    ans = u1 + u2 - l1 - l2 + 1
else:
    k = (N - 1) // 2
    l = low[k]
    u = up[k]
    ans = u - l + 1

print(ans)
# Judge status: Accepted
a,b,c,d=[int(_) for _ in input().split()]

print(max(0,min(b,d)-max(a,c)))
# Judge status: Accepted
N = int(input())
print(-(-N//2))
# Judge status: Accepted

def resolve():
    s=list(input())
    t=list(input())
    ss=sorted(s)
    tt=sorted(t,reverse=True)
    if ss<tt:
        print('Yes')
    else:
        print('No')


resolve()
# Judge status: Accepted
N,M = map(int, input().split())
A = [int(a) for a in input().split()]

A.sort(reverse=True)
if A[M-1] >= sum(A)/4/M:
    ans = "Yes"
else:
    ans = "No"
print(ans)
# Judge status: Wrong Answer
in_len = input().split(" ")
in_d = input().split(" ")

in_n = in_len[0]
in_k = int(in_len[1])

cmp_len = ['0','1','2','3','4','5','6','7','8','9']
use_num = sorted(list(set(cmp_len) - set(in_d)), reverse=False)
use_cnt = 10 - in_k
out = []

for i in range(len(in_n)):
  for j in range(use_cnt):
    if(in_n[i] <= use_num[j]):
      out.append(use_num[j])
      break

print("".join(out))
# Judge status: Wrong Answer
h=int(input())
w=int(input())
n=int(input())
b=max(h,w)
print(b)
num=0
a=0
while a<n:
	num+=1
	a+=b
print(num)
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))
from fractions import gcd
for i in range(n):
	a[i]//=2
from copy import copy
b=copy(a)
c=[]

for i in range(n):
	cnt=0
	while b[i]%2==0:
		cnt+=1
		b[i]//=2
	c.append(cnt)
for i in range(n-1):
	if c[i]!=c[i+1]:
		print(0)
		exit()

a_gcd=a[0]
for i in range(1,n):
	a_gcd=a_gcd*a[i]//gcd(a_gcd,a[i])
print((m+a_gcd)//(a_gcd*2))
# Judge status: Accepted
x = input()
if x[1] == x[2] and (x[0] == x[1] or x[2] == x[3]  ):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
A,B = map(int,input().split())
def func(a,b):
  for i in range(1,10):
    for j in range(1,10):
      if a*b == i*j:
        print(a*b)
        return i,j
  if a*b != i*j:
    print(-1)
func(A,B)
# Judge status: Wrong Answer
#!/usr/bin/python

input_data = list(map(int,input().split()))

d1 = input_data[0]
d2 = input_data[1]
d3 = input_data[2]
total = 0

d4 = d2 / d1
if d4 > d3:
    total += 1

print(total)
# Judge status: Accepted
x, a, b = map(int, input().split())
if abs(x-a) < abs(x-b):
    print('A')
else:
    print('B')
# Judge status: Accepted
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
l_d = [0]*(n-1)
r_d = [0]*(n-1)
for i in range(n-1):
    l_d[i] = gcd(l_d[i-1], a[i])
    r_d[i] = gcd(r_d[i-1], a[n-i-1])
ans = max(l_d[-1], r_d[-1])
for i in range(n-2):
    ans = max(ans, gcd(l_d[i], r_d[n-i-3]))
print(ans)
# Judge status: Accepted
S=list(input())

prev = ""
ans = 0
tmp = ""

for s in S:
    tmp += s
    if tmp != prev:
        ans += 1
        prev = tmp
        tmp = ""

print(ans)
# Judge status: Wrong Answer
N = int(input())
d = map(int, input().split())
d = sorted(d, reverse = False)
print (d)

ans = d[N//2] - d[N//2-1]
print (ans)
# Judge status: Wrong Answer
from math import atan
a, b, x = map(int, input().split())
if x >= b / 2:
    print(atan(a / (2 * b - 2 * x)))
else:
    print(atan(2 * a * x / b ** 2))
# Judge status: Wrong Answer
n, m = map(int, input().split())
stores = [tuple(map(int, input().split())) for _ in range(n)]
dict_stores = dict(stores)
sorted_dict = sorted(dict_stores.items(), key=lambda x: x[0])
total = 0
ans = 0
for cost, number in sorted_dict:
    total += number
    if total > m:
        diff = m - (total - number)
        ans += cost * diff
        break
    else:
        ans += cost * number
print(ans)
# Judge status: Accepted
N = input().strip()
if N[0]==N[1]==N[2] or N[1]==N[2]==N[3]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
a = list(map(int,input().split()))
count_list = [0]*(max(a)+1)
ans = 0
for i in a:
    count_list[i]+=1
for i in range(1,max(a)):
    ans = max(ans,count_list[i-1]+count_list[i]+count_list[i+1])
print(ans)
# Judge status: Accepted
n = int(input())
print((n+1)//2 / n)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

Clist = []
for count in range(len(A)+1):
    Clist.append(0)

for count in range(len(A)):
    Clist[A[count]-1] = Clist[A[count]-1] + 1

for count in range(0,len(A)+1):
    print(Clist[count])
# Judge status: Accepted
n=int(input())
a=[int(input()) for i in range(n)]
b=sorted(a,reverse=True)
first,second=b[0],b[1]

for i in range(n):
  print(second if a[i]==first else first)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
ans=False
if abs(a-c)<=d:
  ans=True
if abs(a-b)<=d and abs(b-c)<=d:
  ans=True
if ans:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a,b = (int(x) for x in input().split())
if a > b:
	print(str(b)*a)
else:
	print(str(a)*b)
# Judge status: Accepted
A,B,C = list(map(int,input().split()))
if (10*B + C) % 4 == 0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
a= int(input())
b = input().split()
count = 0
for i in range(a-1):
    if i >= 1:
        if abs(int(b[i-1])-int(b[i])) < abs(int(b[i-1])-int(b[i+1])) and abs(int(b[i+1])-int(b[i])) < abs(int(b[i-1])-int(b[i+1])):
            count += 1
print(count)
# Judge status: Accepted
l, r, d = map(int, input().split())
print(r//d - (l-1)//d)
# Judge status: Wrong Answer
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


n = int(input())
divisors_list = make_divisors(n)
ans = []
for i in range(len(divisors_list) // 2):
    move = divisors_list[i] + divisors_list[-1 - i] - 2
    ans.append(move)
print(min(ans))
# Judge status: Accepted
n=int(input())
ans=[0 for i in range(1+10**5)]
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            a=i**2+j**2+k**2+i*j+j*k+k*i
            ans[a]+=1
for i in range(1,n+1):
    print(ans[i])
# Judge status: Wrong Answer
N,C,K=list(map(int,input().split()))
import sys
l=[r.rstrip() for r in sys.stdin.readlines()]
l=list(map(int,l))
l.sort()
ans=0
from collections import deque
l=deque(l)
for j in range(N):
   A=l.popleft()
   if l != deque([]):
      B=l[0]
   else:
      B=0
   for i in range(C-1):
      if A <= B <= A+K:
         B = l.popleft()
         if l == deque([]):
            break
   ans+=1
   if l == deque([]):
      break
print(ans)
# Judge status: Wrong Answer
length = int(input())
s = input()

if s[:length // 2] == s[length // 2:]:
    print("yes")
else:
    print("no")
# Judge status: Accepted
n = int(input())
letters_mapping = {num: {num2:[] for num2 in range(10)} for num in range(10)}

for num in range(1, n + 1):
    first_letter = str(num)[0]
    last_letter = str(num)[-1]
    letters_mapping[int(first_letter)][int(last_letter)].append(num)

count = 0
for i, v in letters_mapping.items():
    for j, x in letters_mapping[i].items():
        for num in letters_mapping[i][j]:
            count += len(letters_mapping[j][i])
            
print(count)
# Judge status: Accepted
def main():
    N, A, B = map(int, input().split())

    diff = B-A
    if diff % 2 == 0:
        print(diff//2)
    else:
        print(min(A-1,N-B) + 1 + (diff-1)//2)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b,c=list(map(int,input().split()))
if a<=c and c<=b:print('YES')
else:print('NO')
# Judge status: Wrong Answer
# k = int(input())
listA = [0,1,2,3,4,5,6,7,8,9]
k = int("15")
z = 10

q = k // z
mod = k % z
if q == 0:
    print(str(listA[mod - 1]))
else:
    print(str(q + 1)+ str(listA[mod - 2]))

# for i in range(k):

# print([1,2,3,4,5,6,7,8,9,10,11,12,21,22,23,24,25,26,27,28,29,210,211,212][int(input()) - 1])