peterverebics/CodeNet_Python_118 huggingface dataset:
n,a,b = map(int,input().split())

if (b-a)%2 == 0:
    print(int((b-a)/2))
else:
    if a <= n-b:
        t = a + int((b-a)/2)
    else:
        t = n-b + 1 + int((b-a)/2)
    print(t)
n, a, b = map(int, input().split())
if (a + b) % 2 == 0:
    c = abs(a -b) // 2
else:
    c = 10 ** 20
print(min(max(a, b)-1, n-min(a, b)+1, c))
N,A,B = map(int,input().split())

sa = (A-B) if A>B else (B-A)

if( sa%2 == 0):
   print( int(sa/2) )
N, A, B = map(int, input().split())
d = A - B if A > B else B - A
d2 = d // 2
d3 = d % 2
if d3 == 0:
  ans = d2
else:
  bigger = B
  smaller = A
  if A > B:
    bigger = A
    smaller = B
  distance = N - smaller if N - smaller < bigger else bigger
  ans = distance

print(ans)
n,a,b=map(int,input().split())
if a==b:
    print(0)
    exit()
elif abs(a-b)%2==0:
    print(int(abs(a-b)/2))
else:
    print(min(a-1,n-b)+a+int((b-a-1)/2))
n,a,b=map(int,input().split())
if (a-b)%2==0:
  ans=(a-b)//2
else:
  ans=min(a-1,b-1,n-a,n-b)+1+(b-a-1)//2
print(ans)
N,A,B=map(int,input().split())
if (A-B)%2:
  print(min(max(A,B)-1,N-min(A,B)))
else:
  print(abs(A-B)//2)
N, A, B = map(int, input().split())

if (B-A) % 2 == 0:
    ans = (B-A)//2
else:
    ans = min(B-1, N-A)
print(ans)
#agc041 a
n,a,b=map(int,input().split())
ans=0
if (b-a)%2==0:
    ans=int((b-a)/2)
else:
    left=b-1
    right=n-a
    ans=min(left,right)
print(ans)
n, a, b = (int(x) for x in input().split())
if (b - a) % 2 == 0:
  ans = (b-a) // 2
else:
  ans = min(b-1,n-a)
print(ans)
N, A, B = map(int, input().split())

if (B-A) % 2 == 0:
  print((B-A)//2)
else:
  print(min(B-1,N-A))
N, A, B = map(int, input().split())

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

print(result)
N,A,B = map(int,input().split())

right = max([A,B])
left = min([A,B])

if (right-left)%2 == 0:
    ans = [N-left,(right-left)//2,right-1]
    print(min(ans))
else:
    x = ((N-right)+1)
    y = ((left-1)+1)
    ans = [N-left,right-1,((N-left+x)//2)+x,((right-y-1)//2)+y]
    print(min(ans))
N, A, B = [int(item) for item in input().split()]
if (B-A) % 2 == 0:
    print((B-A)/2)
else:
    d = min(N-B, A-1)
    print(d+1+(B-A-1)/2)
n, a, b = map(int ,input().split())

if (b-a) % 2 == 0:
	ans = (b-a) // 2
else:
	ans_2_1 = b-1
	ans_2_2 = n-a

	if b-a == 1:
		ans = min(ans_2_1, ans_2_2)
	else:
		ans_3_1 = (a-1) + (b-a+1-1-1)//2
		ans_3_2 = (n-b) + (n-(a+n-b+1))//2

		ans = min(ans_2_1,ans_2_2,ans_3_1,ans_3_2)

print(ans)
n,a,b = map(int,input().split())
if a % 2 == b % 2:
    print(abs(a-b)//2)
else:
    print(min(max(a-1,b-1),max(n-a,n-b)))
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

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

    if a==b:
        print(0)
    elif a==1:
        print(str(b))
    elif b==1:
        print(str(a))
    else:
        if a > b:
            print(a-b)
        else:
            print(b-a)

if __name__=="__main__":
    main()
def main():
    N, A, B = map(int, input().split())

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

if __name__ == "__main__":
    main()
N, A, B = map(int, input().split())

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

input = sys.stdin.readline


def main():
    N, A, B = map(int, input().split())

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

    print(ans)


if __name__ == "__main__":
    main()
N, A, B = map(int, input().split())

d = B - A

if (d % 2 == 0):
    ans = d // 2
else:
    left = B - 1
    right = N - A
    ans = min(left, right)

print(ans)
n, a, b = map(int, input().split())
a = min(a, b)
b = max(a, b)

if (b - a) & 1 == 0:
    print((b - a) // 2)
else:
    print(min(n - a, b - 1))
N,A,B=map(int,input().split())
if (B-A)%2==1:
   print(min(B-1,N-A))
elif (B-A)%2==0:
   print((B-A)//2)
from sys import maxsize

n, a, b = [int(i) for i in input().split()]

res = min(n-min(a,b), max(a,b)-1)
val = abs(a-b) // 2
if (a-b) % 2 == 0 and val < res:
    res = val

print(res)
n, a, b = map(int,input().split())
tmp = abs(a-b)

if tmp%2 == 0:
    print(tmp//2)
else:
    x = max(a-1,b-1)
    y = max(n-a,n-b)
    print(min(x,y))
x,y,z = map(int,input().split())

if (z-y)%2==0:
    print((z-y)//2)
else:
    ans = min(z-1, x-y)
    print(ans)
n,a,b = map(int, input().split())

nearside = 0
mintable = 0
maxtable = 0
# restore
if abs(a-b) % 2 == 0:
    print(int(abs(a-b) / 2))
else:
    if a < b:
        mintable = a
        maxtable = b
    else:
        mintable = b
        maxtable = a
    print(int(max(mintable - 1, n - maxtable)))
n, a, b = map(int, input().split())
def min(a, b):
  if a < b:
    return a
  return b

if (b-a)%2 == 0:
  print((b-a)//2)
else:
  print(min(b-1, n-a) + 1 + (b-a-1)//2)
n, a, b = map(int,input().split())
d = abs(a-b)
if d%2 == 0:
  print(d//2)
elif a-1 < n-b:
  print(b-1)
else:
  print(n-a)
n, a, b = map(int, input().split())
d = b - a
if d % 2 == 0:
    print(d//2)
else:
    dd = d//2
    ans = min(dd + a, n - b + 1 - dd)
    print(ans)
n, a, b = map(int, input().split())
d = b - a
if d % 2 == 0:
    print(d // 2)
else:
    if b - 1 > n - a:
        print(n - a)
    else:
        print(b - 1)
def solve():
  N, A, B = map(int, input().split())
  if (A-B)%2==0:
    return abs(A-B)//2
  ans = min(max(A,B)-1,N-min(A,B))
  return ans
print(solve())
n, a, b = map(int, input().split())

if (b-a)%2 == 0:
    ans = int((b-a)/2)
else:
    ans = int((b-a)/2) + min(a-1, n-b) + 1

print(ans)
n, a, b = map(int, input().split())
if (a + b) % 2 == 0:
    c = abs(a -b) // 2
else:
    c = 10 ** 20
print(min(max(a, b)-1, n-min(a, b), c))
#!/usr/bin/env python
# coding: utf-8

# In[10]:


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


# In[11]:


if (A-B)%2 == 0:
    ans = int((B-A)/2)
else:
    ans1 = A + int((B-A-1)/2)
    ans2 = (N-B+1) + int((N-(A+N-B+1))/2)
    ans = min(ans1, ans2)
print(ans)


# In[ ]:
N, A, B = list(map(int, input().split()))
if (B-A)%2 == 0:
  ans = int((B-A)/2)
else:
  ans = min(B-1, N-A)
print(ans)
N,A,B = map(int,input().split())
sub = abs(A-B)
if sub % 2 == 0:
  print(sub//2)
else:
  print(min(max(B-1,A-1),max(N-A,N-B)))
n,a,b=map(int,input().split())
if (b-a)%2 == 0:
 print(int((b-a)/2))
else:
 print(int(min(a-1,n-b)+1+((b-a-1)/2)))
N, A, B = map(int, input().split())

if abs(A - B)%2 == 0:
    print(abs(A - B)//2)
else:
    if N - A > B:
        print(B-1)
    else:
        print(N - A - 1)
def main():
    n, a, b = map(int, input().split())
    if (b-a) % 2 == 0:
        print((b-a)//2)
    else:
        print(min(n-a, b-1))

if __name__ == "__main__":
    main()
n, a, b = map(int, input().split())
if (b - a) % 2 == 0:
    ans = (b - a) // 2
ans = min((b - a - 1) // 2 + a, (n - b + 1 + (b - a - 1) // 2))

print(ans)
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    n,a,b = map(int,input().split())
    ans=0
    if (b-a) % 2 == 0:
        print((b-a) // 2)
    else:
        #bから1までの移動回数
        X = b-1
        #aからnまでの移動回数
        Y = n-a+1
        print(min(X, Y))

if __name__=="__main__":
    main()
def solve(N, A, B):
    if A % 2 == B % 2:
        return (B - A) / 2
    return min(A - 1, N - B) + 1 + (B - A - 1)//2

if __name__ == "__main__":
    n, a, b = map(int, input().split())
    print(solve(n, a, b))
N, A, B = map(int, input().split())
if (A - B) % 2 == 0:
    print(abs(A - B) // 2)
else:
    print(min(max(A - 1, B - 1), max(N - A, N - B)))
#!/usr/bin/env python3

def f(n,a,b):
    if (a + b) % 2:
        return min(max(a,b) - 1, n - min(a,b))
    else:
        d = b-a
        return d//2

def main():
    N,A,B = map(int,input().split())
    print(f(N,A,B))

if __name__ == '__main__':
    main()
a,b,c = map(int,input().split())
if (b-c) % 2 == 0:
    print((abs(b-c))//2)
elif max(b,c)-1 >= a-min(b,c):
    print(a-min(b,c))
else:
    print(max(b,c)-1)
N, A, B = map(int, input().split())

if abs(A-B) % 2 == 0:
    print(abs(A-B)//2)
else:
    top = (B-(A+1))//2 + A
    print(top)
n, a, b = map(int,input().split())

if (b - a) % 2 ==0:
    print((b-a)/2)
else:
    print(min(b-1,n-a))
N,A,B = map(int, input().split())
if (B-A)%2==0:
    print((B-A)//2)
else:
    print(max(N-B, A))
N,A,B=map(int,input().split())
if((A-B)%2==0):
 print(abs(A-B)//2)
else:
 print(min(B-1,N-A))
N,A,B=map(int,input().split())
key=B-A
if key%2==0:
  print(int(key/2))
else:
  if A>N/2:
    print(N-A)
  else:
    print(B-1)
N, A, B = map(int, input().split())

if abs(A-B) % 2 == 0:
  print(abs(A-B) // 2)
else:
  print(max(A-1, B-1))
import numpy as np

in_string = input()
in_arr = in_string.split()
N = np.int64(in_arr[0])
A = np.int64(in_arr[1])
B = np.int64(in_arr[2])

if ((A-B) % np.int64(2)) == np.int64(0):
    print(np.int64((B-A)/np.int64(2)))
else:
    if (N-B) > A-np.int64(1):
        print(int(A+((B-A)-1)/2))
    else:
        print(int(N-B+1+(N-(A+N-B+1))/2))
a,b,c =input().split()
N=int(a)
A=int(b)
B=int(c)
A_B=abs(A-B)
if A_B%2==0:
    print(int(A_B/2))
else:
# ONE(1)   A  B  N
    B_ONE=B-1
    A_N=N-A
    ans=0
    if (B-1)<=N-A:
        ans+=A
        ans+=int((A_B-1)/2)
        
    else:
        ans+=N-B+1
        ans+=int((A_B-1)/2)
    print(ans)
N, A, B = map(int, input().split())
dis = B-A
min1 = min(abs(1-B), N-A)
min2 = min(int((B-A)/2), min1)
print(min2) if (B-A)%2==0 else print(min1)
n, a, b = map(int, input().split())

if (b - a) % 2 == 0:
  ans = (b - a) // 2
else:
  ans = min(n - a, b - 1)

print(ans)
n, a, b = map(int, input().split())
diff = abs(a-b)
if diff % 2 == 0:
    print(diff // 2)
else:
    print(min(max(a, b)-1, n - min(a, b)))
n,a,b = map(int,input().split())

if (b-a)%2==0:
    print((b-a)//2) 
else:
    print(min(b-1,n-a))
n,a,b=map(int,input().split())
if (a-b)%2==0:
 print(int((b-a)/2))
else:
 print(min(int((2*(a-1)+b-a+1)/2),int((2*(n-b)+b-a+1)/2)))
n, a, b = map(int, input().split())
print(min(a-1,n-b)+1+int((b-a-1)/2) if (b-a)%2 else int((b-a)/2))
N, A, B = map( int, input().split() )

if ( A + B ) % 2 == 0:
  print( (abs( A - B ) + 1) // 2 )
else:
  print( max( A, B ) - 1 )
N,A,B = map(int,input().split())
if (A + B) % 2 == 0:
  print(B - (A + B) // 2)
else:
  print(min(N - A,B - 1))
n,a,b=map(int,input().split())
if a%2==b%2:
	c=(max(a,b)-min(a,b))//2
else:
	if abs(a-b)==1:
		c=min(n-min(a,b),max(a,b)-1)
	else:
		if n-max(a,b)>min(a,b):
			c=n-min(a,b)+(max(a,b)-min(a,b)-1)//2+1
		elif min(a,b)-1<max(a,b):
			c=max(a,b)+(max(a,b)-min(a,b)-1)//2+1
print(c)
N, A, B = map(int, input().split())

if abs(A-B) % 2 == 0:
    print(abs(A-B)//2)
else:
    top = (B-(A+1))//2 + A
    low = (B-A+1)//2+N-B-1
    print(min(top, low))
n, a, b = map(int, input().split())

if a-b & 1:
  mi = min(a - 1, n - b)
  print(mi + 1 + int(b - a - 1 // 2))
else:
  print(int(b - a // 2))
n,a,b=map(int,input().split())
if (b-a)%2==0:
    print((b-a)//2)
else:
    print((min(n-a,b-1)))
N, A, B = map(int, input().split())
if (A - B) % 2 == 0:
    print((B - A) // 2)
else:
    print(min(N-A, B-1))
N, A, B = map(int, input().split())
min1 = min(A-1, N-B)
ans = min1 + 1 + int((B-A-1)/2)
print(int((B-A)/2)) if (B-A)%2==0 else print(ans)
N,A,B = map(int,input().split())

right = max([A,B])
left = min([A,B])

if (right-left)%2 == 0:
    ans = [N-left,(right-left)//2,right-1]
    print(min(ans))
else:
    x = ((N-right)+1)
    y = ((left-1)+1)
    ans = [N-left,right-1,((N-A+x)//2)+x,((B-y-1)//2)+y]
    print(min(ans))
n,a,b = tuple(map(int,input().split()))

if abs(a-b)%2==0:
  print(abs(a-b)//2)
else:
  t = n-min(a,b)
  s = max(a,b)-1
  print(min(t,s))
N,A,B=map(int,input().split(' '))
if abs(B-A)%2==0:
    print(abs(B-A)//2)
else:
    print(min(A,N-A,B,N-B))
n,a,b=map(int,input().split())
ans =0

if abs(a-b)%2:
    ans = min(a+(b-a)//2,(n-b+1)+(n-a)//2)
else:
    ans = abs(a-b)//2
print(ans)
N,A,B=map(int,input().split())
if (B-A)%2==0:
    print((B-A)//2)
else:
    print(int(min(A-1,N-B)+1+(B-A-1)/2))
# coding: utf-8
# Your code here!
N,A,B=map(int,input().split())

if (A+B)%2==0:
    print(B-(A+B)//2)
else:
    print(min(B-1,N-A))
n, a, b = map(int, input().split())

if (b-a)%2 == 0:
    print(abs(b-a)//2)
else:
    s = n//2
    if a > s and b > s:
        print(n - min(a,b))
    elif a<= s and b <= s:
        print(max(a,b) - 1)
    else:
        print(min(max(a,b)-1, n-min(a,b)))
N,A,B=map(int,input().split())
key=B-A
if key%2==0:
  print(int(key/2))
else:
  if B>N/2:
    print(N-A)
  else:
    print(B-1)
n, a, b = map(int, input().split())

x = (b-a) % 2
if x == 1:
    ans = 0
    if (a-1) < (n-b):
        d = a-1
        b -= a
        ans += a
        ans += b // 2
    else:
        d = n-b
        a += b
        ans += (n-b) + 1
        ans += (n-a) // 2
    ans = min([ans, b-1, n-a])
    print(ans)
else:
    print((b-a+1)//2)
n, a, b = [int(i) for i in input().split()]
if (b - a) % 2 == 0:
    print((b - a) // 2)
else:
    print(min(b - 1, n - a))
N, A, B = map(int, input().split())
if (A-B)%2:
    if A > B:
        A, B = B, A
    a = (B-A-1)//2+A if B > 2*A else 10**9
    b = (N-A+(N-B+1))//2+N-B+1 if B > A+(N-B+1) else 10**9
    print(min(max(A, B)-1, N-min(A,B), a, b))
else:
    print(abs(A-B)//2)
def resolve():
    N,A,B=map(int,input().split())
    if (A-B)%2==0:
        print(abs(A-B)//2)
    else:
        print(min(max(A-1,B-1),max(N-A,N-B)))


resolve()
n, a, b = map(int, input().split())
if a > b:
    a, b = b, a
if (b - a) % 2:
    print(min(b - 1, n - a))
else:
    print((b - a) // 2)
n, a, b = map(int, input().split())
d = b - a
if d % 2 == 0:
    print(d // 2)
else:
    print(d // 2 + 1)
def main():

    N, A, B = map(int, input().split())
    if (B-A) % 2 == 0:
        return  (B-A) // 2
    else:
        a = A + (B-A-1)//2
        if N % 2 == 0:
            b = (N-B+1) + (N-B+A-1) // 2
        else:
            b = (N-B) + (N-B+A) // 2
        return min([a, b])

if __name__ == '__main__':
    print(main())
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    N,A,B=pin()
    tt=abs(A-B)
    if tt%2==0:
        print(tt//2)
        return
    else:
        s= max(A,B)-1
        t=N-min(A,B)
        print(min(s,t,(tt-1)//2+1))
#%%submit!
resolve()
n, a, b = map(int, input().split())


if (b-a) % 2 == 0:
    print((b-a)//2)
else:
    print(min(b-1, n-a))
n,a,b=input().split()
n,a,b=int(n),int(a),int(b)
c=max(a,b)
d=min(a,b)
sa=c-d
if sa%2==0:
    an=sa/2
else:
    if n-d>=c-1: #n-dが卓Nで待ち合わせ、c-1が卓1で待ち合わせ
        an=c-1
    else:
        an=n-d
an=int(an)
print(an)
n, a, b = map(int, input().split())

if (b - a) % 2 == 0:
    print(int((b - a) / 2))
elif (b - a) % 2 == 1:
    if a - 1 <= n - b:
        print((a - 1) + int((b - a + 1) / 2))
    elif a - 1 > n - b:
        print((n - b) + int((b - a + 1) / 2))
n,a,b=map(int, input().split())
print((b-a)//2 if (b-a)%2==0 else max(a,b)-1)
n, a, b = map(int, input().split())

ans = (b - a - 1)//2
if (b - a - 1) % 2 == 0:
   ans += 2
else:
   ans += 1

print(ans)
N, A, B = map(int, input().split())
Ad = min(A, B)
Bd = max(A, B)
if (Bd-Ad)%2 == 0:
  print(int((Bd-Ad)/2))
else:
  print(min(B-1, N-A))
N, A, B = map(int, input().split())

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

print(ans)
n, a, b = map(int,input().split())

if (a+b)%2 == 0:
	print(int((b-a)/2))
else:
	print(int(min(a-1,n-b)+1+(b-a-1)/2))
N, A, B = map(int, input().split())

if abs(A-B) % 2 == 1:
    print(min(A-1, B-1)+1+(B-A-1)//2)
else:
    print((B-A)//2)
n,a,b=map(int,input().split())
m=min(a,b)
M=max(a,b)
if (a+b)%2==0:
  print((M-m)//2)
elif M-m==1:
  print(min(m,n-m+1))
else:
  if m-1<=n-M:
    print((a+b-1)//2)
  else:
    print((n-a-b+1)//2)
def main():
    N, A, B = list(map(int, input().split(' ')))
    assert 1 <= A < B <= N
    if (B - A) % 2 == 0:
        print((B - A) // 2)
    else:
        if B - 1 <= N - A:
            print(A + max([0, B - A - 1]) // 2)
        else:
            print(N - B + max([0, B - A - 1]) // 2)


if __name__ == '__main__':
    main()
N, A, B = map(int, input().split())

df = abs(A - B)
dA = N - A
dB = B - 1

if df % 2 == 0:
    print(int(df // 2))
else:
    if A == 1 or B == N:
        print(((df - 1) // 2)+1)
    else:
        if dA > dB:
            print(dB)
        else:
            print(dA)
#!/usr/bin/env python
# coding: utf-8

# In[10]:


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


# In[15]:


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


# In[ ]:
n, a, b = map(int, input().split())

if (b - a) % 2 == 1:
    print(min(b-1, n-a))
else:
    print(b - a - 1)
N, A, B = map(int, input().split())
diff = abs(A - B)
if diff == 0:
    print(0)
    exit()
if diff % 2 == 0:
    print(diff//2)
    exit()
else:
    print(min(max(A - 1, B - 1), max(N - A, N - B)))
    exit()
n, a, b = map(int, input().split())

if (b - a) % 2 == 0:
    print(int((b-a)/2))
else:
    print(
        min(a-1, n-b)
        + 1
        + (b-a-1)//2
    )
import math

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

if (A - B) % 2 == 0:
    print(abs(A - B) // 2)

else:

    t1 = A - 1
    t2 = B - 1
    t3 = N - A
    t4 = N - B

    t = [t1, t2, t3, t4]

    ti = t.index(min(t))

    if ti == 0 or ti == 2:
        res = A + (abs(A - B) - 1) // 2
    else:
        res = B + (abs(A - B) - 1) // 2
    
    print(res)
n,a,b=map(int,input().split())
if abs(a-b)%2==0:
  print(abs(a-b)//2)
else:
  print(min(max(a-1,b-1),max(n-a,n-b)))
n, a, b = map(int, input().split())

if (b-a) % 2 != 0:
    ans = min(abs(1-b), abs(a-n))
else:
    if (b-a) != 2:
        ans = (b-a)//2 + 1
    else:
        ans = 1

print(ans)
def main():
    N, A, B = map(int, input().split())

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

if __name__ == "__main__":
    main()
N, A, B = map(int, input().split())
if (A-B)%2:
    if A > B:
        A, B = B, A
    a = (B-A-1)//2+A if B > A+1 else 10**20
    b = (N-A+(N-B+1))//2+N-B+1 if N > A+(N-B+1) else 10**20
    print(min(max(A, B)-1, N-min(A,B), a, b))
else:
    print(abs(A-B)//2)
n, a, b = map(int, input().split())
left = max(a - 1, b - 1)
right = max(n - a, n - b)
if (a - b) % 2 == 0:
    mid = abs((a - b) // 2)
else:
    mid = float('inf')
print(min(left, right, mid))
n = list(map(int,input().split()))
ans = 0
if n[1] % 2 == 0 and n[2] % 2 == 0:
  ans = n[2] + n[1]
  ans = ans // 2
  print(ans - n[1])
elif n[1] % 2 == 1 and n[2] % 2 == 1:
  ans = n[2] + n[1]
  ans = ans // 2
  print(ans - n[1])
else:
  if n[0] - n[2] <= n[1] - 1:
    ans = n[0] - n[1]
  else:
    ans = n[2] - 1
  print(ans)
import math

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

if (A - B) % 2 == 0:
    print(abs(A - B) // 2)

else:
    print(min(max(A - 1, B - 1), max(N - A, N - B)))
N,A,B = map(int,input().split())
A,B = min(A,B),max(A,B)
if abs(A-B)%2==0:
    print(abs(A-B)//2)
else:
    print(min(A,N-1-B)+abs((A-B)-1)//2)
N, A, B = map(int, input().split())
d = A - B if A > B else B - A
d2 = d // 2
d3 = d % 2
if d3 == 0:
  ans = d2
else:
  bigger = B
  smaller = A
  if A > B:
    bigger = A
    smaller = B
  distance = N - smaller if N - smaller < bigger else bigger - 1
  ans = distance

print(ans)
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

MOD = 10 ** 4 + 7

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

if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    print(min(B - 1, N - A))
N, A, B = map(int, input().split())

if abs(A-B) % 2 == 0:
  print(abs(A-B) // 2)
else:
  s = max(abs(A-N), abs(B-N))
  t = max(abs(A-1), abs(B-1))
  print(min(s, t))
N, A, B = list(map(int,input().split(" ")))

if (B-A)%2 == 0:
  print((B-A)//2)
else:
  if B-A == 1:
    if N - A >= B:
      print(B-1)
    else:
      print(N-A)
  else:
    if N-A >= B:
      print(B-(B-A)//2)
    else:
      print(N-A-(B-A)//2)
n, a, b = map(int, input().split())
d = min((b - a) // 2 + a, (n - b + 1 + (b - a - 1) // 2))

if (b - a) % 2 == 0:
    d = min(d, int((b - a) / 2))

print(d)
N, A, B = [int(i) for i in input().split()]
if((B-A)%2==0):
    print((B-A)//2)
else:
    print(min(N-A, B-1))
n,a,b = map(int,input().split())
if abs(b - a)%2 == 0:
    print(abs(b - a)//2)
else:
    print(min(max(a-1,b-1),max(n-a,n-b)))
N,A,B=map(int,input().split())
if (A-B)%2==0:
 print(int((B-A)/2))
else:
 print(min(int((A+B-1)/2),int((2*N-(A+B-1))/2)))
#agc041 a
n,a,b=map(int,input().split())
ans=0
if (b-a)%2==0:
    ans=int((b-a)/2)
else:
    left=a-1
    right=n-b
    ans=min(left,right)+(b-a-1)/2+1
print(ans)
N,A,B=map(int,input().split())
if (B-A)%2==0:
    print(int((B-A)/2))
else:
    print(min(A-1,N-B)+1+int((B-A-1)/2))
n,a,b=map(int,input().split())
ans =0

if (a-b)%2:
    ans = min(a+(b-a-1)//2,(n-b+1)+(b-a-1)//2)
else:
    ans = (a-b)//2
print(ans)
n, a, b = map(int, input().split())
# 偶奇一致
if a % 2 == b % 2:
    print((b - a) // 2)
else:
    # left = a - 1
    # right = n - b

    # if left > right:
    #     cnt = right + 1
    #     left = min(a + cnt, n)
    #     print((n - left) // 2 + cnt)
    # else:
    #     cnt = left + 1
    #     right = max(b - cnt, 1)
    #     print((right - 1) // 2 + cnt)

    print(min(a - 1, n - b) + 1 + (b - a + 1) // 2)
N,A,B=map(int,input().split())
d=B-A
if d%2==0:
    ans=d//2
else:
    # left
    ans=min(A-1,B-1)
    if d==1:
        ans+=1
    elif d>=2:
        ans+=d-2
        ans+=1
    # right
    tmp=N-max(A,B)
    if d==1:
        tmp+=1
    elif d>=2:
        tmp+=d-2
        tmp+=1
    # print(ans,tmp)
    ans=min(ans,tmp)
print(ans)
N, A, B = map(int, input().split())

if A % 2 == B % 2:
    print((A - B)  // 2)
else:
    print(min(B-1, N-A))
N, A,B = map(int, input().split())
ab = abs(A-B)
ab_ = (A+B)/2
if ab%2 ==0:
  print(ab//2)
else:
  if (A+B-2) <= (2*N -A -B):
    if A > B:
      print(A-1)
    else:
      print(B-1)
  else:
    if A > B:
      print(N-B)
    else:
      print(N-A)
def main():
    N,A,B=map(int,input().split())
    if abs(A-B)//2==abs(A-B)/2:
        print(abs(A-B)//2)
    else:
        print(min(max((N-A),(N-B)), min(A,B)))

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

if (B - A) % 2 == 0:
    print((B - A)//2)
elif N - A < N/2:
        print(N-A)
elif N - B > N/2:
        print(N-B)        
else:
    print(B - 1)
n, a, b = map(int, input().split())
if abs(a - b) % 2 == 0:
    print(abs(a - b) // 2)
else:
    print(min(b - 1, n - a))
n,a,b = map(int,input().split())
 
if (b-a)%2 == 0:
    print(int((b-a)/2))
else:
    print(min(a,n-b+1)+(b-a-1)//2)
# N = int(input())
N, A, B = [int(_) for _ in input().split()]
if (B - A) % 2 == 0:
    print((B-A) // 2)
else:
    print(min(N-A, B-1))
import math

N,a,b=map(int,input().split())
d=b-a
d=math.floor(d)+1
print(d)
N,A,B=map(int,input().split())

result = 0

if (A-B)%2 == 0:
    #差が偶数
    result = (B - A) / 2
else:
    #差が奇数
    result = min(A-1,N-B)+1+(B-A-1)/2

print(int(result))
N, A, B = map(int,input().split(" "))
ans = 0
diff = abs(A-B)

if diff % 2 == 0:
    ans = diff / 2
else:
    ans = min(A, N -B)
print(int(ans))
N, A, B = tuple(map(int, input().split()))
if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    print(min(B - 1, N - A))
N, A, B = map(int, input().split())
d = A - B if A > B else B - A
d2 = d // 2
d3 = d % 2
if d3 == 0:
  ans = d2
else:
  ans = A - 1 if A > B else B - 1

print(ans)
def main():
    N, A, B = list(map(int, input().split()))
    if (A ^ B) & 1:
        return min(B - 1, N - A)
    return (B - A) // 2

print(main())
N, A, B = map(int, input().split())

if (A+B)%2 == 0:
    print(max(A, B)-int((A+B)/2))
else:
    print(min((B-1), (N-A)))
n,a,b = map(int,input().split())
if (b-a)%2 == 0:
    print((b-a)//2)
else:
    print(min(max(n-a,n-b),max(a-1,b-1)))