peterverebics/CodeNet_Python_118 huggingface dataset:
#!/usr/bin/env python3

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

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

print(ans)
i = input()
N, A, B = i.split()

N = int(N)
A = int(A)
B = int(B)

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

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

diff = B - A

if diff % 2 == 0:
    ans = diff / 2
else:
    # 左端で会う
    d1 = A - 1  # Aが左に到達するまでにd戦する
    ans1 = d1 + (diff - 1) / 2 + 1

    # 右端で会う
    d2 = N - B  # Bが右端まで到達するのにd戦必要
    ans2 = d2 + (diff - 1) / 2 + 1

    ans = min(ans1, ans2)
    # print(ans1, ans2)

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

p = b-a-1

if p%2==0:
    print(b-1)
else:
    print((p+1)//2)
N,A,B=map(int, input().split())
def find(N,A,B):
  if (A+B)%2==0:
    return int((B-A)/2)
  
  elif B-A==3:
    if (A-1)<=(N-B):
      A=1-A
      return int((B-A)/2)

    if (A-1)>(N-B):
      B=2*N-B
      return int((B-A)/2)
    
  else:
    return int((B-A)/2+2)
print(find(N,A,B))
def main():
    N, A, B = map(int, input().split())
    if A % 2 == B % 2:
        return abs(A - B)//2
    else:
        return min(max((N-A), (N-B)), max((A-1), (B-1)))
print(main())
N,A,B=map(int,input().split())
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)
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())

ans = 0

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

else:
    if B > A:
        ans = min(N-A, B-1)
    if A > B:
        ans = min(N-B, A-1)


print(ans)
N,A,B = map(int, input().split())
if (A-B)%2 ==0:
  print(A/B/2)
else:
  print(min(A-1,N-B)+1+(B-A-1)/2)
N,A,B = map(int, input().split())
if (B-A)%2==0:
    print((B-A)//2)
else:
    print(max(B-1, N-A))
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 = (N-A - (N-B+1))//2+N-B
    print(top)
def main():
    n, a, b = map(int, input().split())

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

    print(ans)

if __name__ == '__main__':
    main()
n, a, b = map(int, input().split())
if (b-a)%2==0:
    print(abs(a-b)//2)
else:
    print(min(n-b, n-a))
n,a,b = map(int, input().split())
if (b-a)%2 == 0:
  print(((b-a)//2))
else:
  print(min(a-1,n-b)+1+(b-a-1//2))
n, a, b = list(map(int, input().split()))

dis = abs(a-b)

if dis % 2 == 0:
  print(dis // 2)

else:
  high = n - min(a, b)
  low = max(a, b) - 1
  print(min(high, low))
N,A,B = map(int,input().split())

dif = abs(A-B)
if(dif%2 == 0):
  ans = dif//2
else:
  #A1_diff = A-1
  B1_diff = B-1
  AN_diff = N-A
  #BN_diff = N-B
  ans = min(B1_diff, AN_diff)
print(ans)
N,A,B = map(int,input().split())
if (B-A) % 2 == 0:
    print((B-A)//2)
else:
    print(min(N-A, B-1))
import sys
import re

l = sys.stdin.readline()
l = l.split(' ')
l = [int(str) for str in l]

n = l[0]
a = l[1]
b = l[2]

if(abs(a-b)%2==0):
	print(int(abs(a -b)/2))
else:
	smax = max( a - 1, b - 1)
	emax = max( n - a, n - b)
	tmin = min( smax, emax)
	print(int(tmin))

sys.stdout.flush()
N,A,B = map(int,input().split())
if (A - B) % 2 == 0:
	print(int((B - A)/2))
else:
	print(min(A - 1,N - B) + 1 + (B - A - 1)//2)
def TableTennisTraining():

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

    if (num[1] - num[2]) % 2 == 0:
        
        print(abs(num[1] - num[2])/2)
    
    else:
        
        right = max([num[0] - num[1], num[0] - num[2]])
        
        left = max([num[1] - 1, num[2] - 1])
        
        print(min([right, left]))

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

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

if( sa%2 == 0):
   print( sa/2 )
n, a, b = [int(w) for w in input().split()]
if (a + b) % 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((B-A-1)//2+min(A-1, N-B)+1)
n, a, b = map(int, input().split())
ans = 0

if (b-a)%2 == 0:
    ans = (b-a) // 2
else:
    ans = min(2*n-a-b-1, a+b-3)
    
print(ans)
from decimal import *
def resolve():

    n,a, b = map(int, input().split())
    if (b-a)%2 == 1:
        ans=Decimal(min(a-1,n-b)+1+(b-a-1)/2)
    else:
        ans=Decimal(((b-a)/2))

    print(ans)

resolve()
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 = d2 + 2

print(ans)
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())

print(min(2*n-a-b,a+b-2)+1)
print(max(min(n-1,a-1),min(n-b,b-1)))
N, A, B = map(int, input().split())


d = B-A
if d%2 == 1:
    d = min((B + (N-B)*2 + 1) - A, B - (-A-1))

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

p = b-a-1

if p%2==0:
    print(min(b-1,n-a))
else:
    print((p+1)//2)
N,A,B = map(int,input().split())
A_pos = A
B_pos = B
count = 0
while not A_pos == B_pos:
  if A_pos == B_pos -1:
    B_pos += 1
    count += 1
    continue
  A_pos = A_pos +1
  B_pos = B_pos -1
  count += 1
print(count)
N, A, B = map(int, input().split())

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

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

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

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

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

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

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

if abs(a-b)%2 == 0: print(abs(a-b)-1)
else: print(min(max(a,b)-1, n-min(a,b)))
N, A, B = map(int, input().split())
diff = B - A
if diff % 2 == 0:
    print(diff//2)
else:
    print(min(N-A, B-1))
N,A,B = [int(x) for x in input().split()]
if abs(A-B)%2==0:
  print(min(max(A-1,B-1),max(N-A,N-B),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 (a-b)%2 == 0:
    print(abs(a-b)//2)
else:
    print(min(n-b+(b-a-1)//2, a+(b-a-1)//2))
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-1-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) )
import math
n,a,b=map(int,input().split())

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

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

if (b - a) % 2 == 0:
  print(int(b - (a+b)/2))
else:
  if (a - 1) > (n - b):
    print((n-b) + 1 + int(n - (n+a+(n-b)+1)/2))
  else:
    print((a-1) + 1 + int(b-(a-1)-1 - (b-(a-1)-1 + 1)/2))
in_string = input()
in_arr = in_string.split()
N = int(in_arr[0])
A = int(in_arr[1])
B = int(in_arr[2])

if ((B-A) % 2) == 0:
    print(int((B-A)/2))
else:
    if (N-B) > A-1:
        print(int(A+((B-A)-1)/2))
    else:
        print(int(N-B+1+((N-(A+N-B+1))/2)))
N,A,B=map(int,input().split())
if (B-A)%2==0:
 print(int((B-A)/2))
else:
 print(min(int((A+B-1)/2),int((2*N-A-B+1)/2)))
n,a,b=map(int,input().split())
if (a-b)%2==0:
 print(int((b-a)/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(max(b-1,n-a))
strargs = input()

n, a, b = map(lambda x: int(x), strargs.split())

if (b - a) % 2 == 0:
  print((b - a)//2)
  
elif a - 1 < n - b:
  newB = b - a
  print(a + (newB-1)//2)

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

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

if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    # Aが卓1で勝利して調整
    a = A + (B - A - 1) // 2
    # Bが卓Nで敗北して調整
    b = N - B + 1 + (N - B + 1 - A) // 2
    print(min(a, 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))
def main2():
    N, A, B = map(int, input().split())

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

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

    print(int(ans))
resolve3()
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)
N,A,B=map(int,input().split())
A_B=B-A
if A_B%2==0:
    print(int(A_B/2))
else:
# ONE(1)   A  B  N
    if N-B<=A-1:
        ans=N-B+1+int((A_B)/2)
        
    else:
        ans=A+ int((A_B)/2)
    print(ans)
n,a,b=map(int,input().split())
ans=0
if abs(a-b) % 2 == 0:
    ans=abs(a-b)//2
else:
    y = n-a if b > n-a else b
    ans = y-1

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

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

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

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

nearside = 0
mintable = 0
maxtable = 0
center = abs(a-b) / 2
# restore
if abs(a-b) % 2 == 0:
    print(int(center))
else:
    if a < b:
        mintable = a
        maxtable = b
    else:
        mintable = b
        maxtable = a
    
    if n/2 >= mintable and n/2 <= maxtable:
        print(int(max(mintable - 1, n - maxtable))) 
    elif n/2 >= maxtable:
        print(maxtable-1)
    else:
        print(n - mintable)
n, a, b = map(int, input().split())
# 卓1で遭遇
hoge = max(a, b) - 1
# 卓nで遭遇
huga = n - min(a, b)
# a, b間で遭遇
if (max(a, b) - min(a, b)) % 2 == 0:
  piyo = min(a, b) + (max(a, b) - min(a, b)) // 2
  ans = abs(min(hoge, huga, piyo) - max(a, b))
else:
  ans = abs(min(hoge, huga))
print(ans)
n = list(map(int,input().split()))
ans = 0
if n[1] % 2 == 0 and n[2] % 2 == 0:
  ans = n[2] - n[1]
  print(ans//2)
else:
  if n[0] - n[2] < n[1] - 1:
    ans = n[0] - n[1]
  else:
    ans = n[2] - 1
  print(ans)
N,A,B = list(map(int,input().split()))
a = A - 1
b = N - B
c = B - A
if c%2==0:
  res = c/2
elif a<b:
  res = B - 1
else:
  res = N - A
print(res)
n, a, b = map(int, input().split())
if (a+b)%2:
  if a-1 <= 5-b:
    print(b-1)
  else:
    print(5-a)
else:
  print((b-a)//2)
N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    if B - A == 1: 
        print(min(N-A, B-1))
    elif A == 1:
        print(1+(B-1-A)//2)
    elif B == N:
        print(1+(B-A-1)//2)
    else:
        print(min(A+(B-A-1)//2, N-B+1+(B-A+1)//2))
n, a, b = map(int, input().split())

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

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

ans = min(ans, B - 1, N - A)
print(ans)
import sys
input = sys.stdin.readline

N, A, B = map(int, input().split())
if (A + B) % 2 == 0:
    print((A + B) // 2 - A)
else:
    print(min(B-1, N-A))
n, a, b = (int(x) for x in input().split())
if (b - a) % 2 == 0:
  ans = (b - a) // 2
elif (b - 1) < (n - a):
    ans = b - 1
else:
    ans = n - a
print(ans)
n,a,b=map(int,input().split())
if (a-b)%2==0:
    print(abs(a-b)//2)
else:
    if a>b:
        a,b=b,a
    
    print(min(max(a-1,b-1),max(n-a,n-b),max((a+b-1)//2,(2*n-a-b+1)//2)))
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(abs(a-b)//2)
else:
  print(min(n-min(a,b),max(a,b)-1))
N, A, B = map(int, input().split())

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

if a == b+1:
    ans = b

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

if a<b:
    a,b = b,a

print(min(n-b,a-1))
n,a,b = map(int,input().split())

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

dif = B-A
if dif%2 == 0:
  print(int(dif/2))
else:
  print(min(A-1, N-B)+1+int((dif-1)/2))
n, a, b = map(int, input().split())
if (a-b)%2 == 0:
    print(abs(a-b)//2)
else:
    if a+b>=n+1:
        print(max([n-a, n-b]))
    else:
        print(max([a, b]))
from math import ceil


def main():
    n, a, b = map(int, input().split())
    print(ceil((b - a) / 2) if a % 2 == b % 2 else min(max(a, b) - 1, n - min(a, b)))


if __name__ == '__main__':
    main()
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+=N-B+1
        ans+=int((A_B-1)/2)
        
    else:
        ans+=A
        ans+=int((A_B-1)/2)
    print(ans)
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)))
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    if abs(a - b) % 2 == 0:
        print(abs(a - b) // 2)
    else:
        res1 = max(a, b) - 1
        res2 = n - min(a, b)
        print(min(res1, res2))


if __name__ == '__main__':
    resolve()
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,a,b=map(int,input().split())
    if (b-a)%2==0:print((b-a)//2)
    else:print(min((b-a+1)//2,(2*n-b+1-a)//2))

if __name__=='__main__':
    main()
n,a,b=map(int,input().split())

if (b-a)%2==0:
  ans=(b-a)/2
else:
  ans=(a+b)//2
  
print(int(ans))
#!/usr/bin/env python3

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

ans = 10**18+1

if a > b:
    a, b = b, a
ans = []
ans.append(max(a-1, b-1))
ans.append(max(n-a, n-b))

if abs(a-b) % 2 == 0:
    ans.append(abs(a-b)//2)
else:
    a_tmp, b_tmp = 1, b-a
    ans.append(a + abs(a_tmp+b_tmp)//2)

    a_tmp, b_tmp = a+(n-b)+1, n
    ans.append(n-b+1 + abs(a_tmp+b_tmp)//2)
print(min(ans))
n, a, b = map(int, input().split())
if (a+b) % 2 == 1:
  if a+b < 1+n:
    a = 1 - a
  else:
    a = 2 * n + 1 - a
print((a-b)/2 if a > b else (b-a)/2)
def main():
    N, A, B = map(int, input().split())

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

if __name__ == '__main__':
    main()
n, a, b = map(int, input().split())
if (b - a) % 2 == 0:
    print((b-a) // 2)
    exit()
else:
    print(min(b - 1, n - a))
    exit()
n,a,b = map(int,input().split())
if abs(b - a)%2 == 0:
    x = abs(b - a)//2
    y = min(max(a-1,b-1),max(n-a,n-b))
    print(min(x,y))
else:
    print(min(max(a-1,b-1),max(n-a,n-b)))
x,y,z = map(int, input().split())
print(abs(y-z)//2)
n, a, b = map(int, input().split())

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


distance = B - A
ans = 0
while distance % 2 != 0 and distance != 1:
    A_dis= A - 1
    B_dis= B - N
    
    if(A_dis < B_dis):
        if(A != 1 ):
            A -= 1
        B -= 1
    else:
        if(B != N):
            A += 1
        B += 1
    ans += 1
    distance = B - A


if(distance%2==0):
    ans += distance//2
else:
    ans+=2

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

if a == 1 and b-a <= 2:
    print(1)
elif b == n and b-a <= 2:
    print(1)


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(int(abs(A-B)//2))
else:
	print(min(N-min(A,B),max(A,B)-1))
# coding: utf-8
s = list(map(int,input().split()))
if abs((s[1]-s[2])) % 2 == 0:
    print(abs(s[1]-s[2])//2)
else:
    if abs(1-s[2])>abs(s[0]-s[1]):
        print(s[0]-s[1])
    else:
        print(abs(1-s[2]))
N,A,B = map(int,input().split())
if (A-B)%2 == 0:
    print(abs(A-B)//2)
    exit()
print(min(A+(abs(A-B)-1)//2,N-B+(abs(A-B)-1)//2))
N, A, B = map(int, input().split())
distance = abs(A - B)
if distance % 2 == 1:
    print(min(N - A, B - 1))
else:
    print(distance//2)
n,a,b=map(int,input().split())
ch=abs(a-b)
if ch%2==0:
  ans=int(ch/2)
else:
  num1=max(a,b)
  num2=min(a,b)
  ans=min(n-num2,num1-1)
print(ans)
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)) == 0:
    print(np.int64((B-A)/2))
else:
    if (N-B) > A-1:
        print(np.int64((A+(B-A-1)/2)))
    else:
        print(np.int64((N-B+1)+(N-(A+N-B+1))/2))
n,a,b=[int(x) for x in input().split()]

if (a-b)%2==0:
  print((a+b)//2)
else:
  print(min(a-1,n-b)+1+(b-a-1)//2)
# https://atcoder.jp/contests/agc041/tasks/agc041_a¥

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

if a - b % 2 == 0:
    ans = (a - b) // 2
else:
    ans = min(a, n - b)
print(ans)
n, a, b = [int(i) for i in input().split()]
a_distance = a-1
b_distance = n-b
ab_distance = b - a

if ab_distance % 2 == 0:
  result = ab_distance/2
else:
  if a_distance < b_distance:
    result = a_distance + (ab_distance-1)/2 + 1
  else:
    result = b_distance + (ab_distance-1)/2 + 1
print(int(result))
N,A,B = map(int,input().split())

if (B-A) % 2 == 0:
    print(int((B-A)/2))
else:
    if A-1<N-B:
        print(int(A-1+1+((B-1)-A)/2))
    else:
        print(int(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:
  print(min(B-1, N-A))
n,a,b = map(int,input().split())
s = abs(a-b)
if s % 2 == 0:
    print(s // 2)
else:
    if a > b:
        if n-a > b-1:
            print(a-1)
        elif n-a <= b-1:
            print(n-b)
    else:
        if n-b > a-1:
            print(b-1)
        elif n-b <= a-1:
            print(n-a)
s = list(map(int, input().split()))
N = s[0]
A = s[1]
B = s[2]

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:
    ans = min(max(A, B)-1, N-min(A, B))
    print(ans)
n, a, b = [int(i) for i in input().split()]
a_distance = a-1
b_distance = n-b
ab_distance = b - a

if ab_distance % 2 == 0:
  result = ab_distance/2
  print("A")
elif ab_distance % 2 == 1:
  if a_distance < b_distance:
    result = a_distance + (ab_distance-1)/2 + 1
    print("B")
  else:
    result = b_distance + (ab_distance-1)/2 + 1
    print("C")
print(int(result))
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 dA > dB:
        print(dB)
    else:
        print(dA)
N,A,B = [int(x) for x in input().split()];
print(A);
print(B);
print(N);
#lm = int(A + (B-A-1)/2);
lm = A + int((B-A-1)/2);
#print(lm);
#rm = int(N-B+1 + (B-A-1)/2);
rm = N-B+1 + int((B-A-1)/2);
#print(rm);
if (B-A)%2 == 0 :
    print(int((B-A)/2));
else :
    print(min(lm,rm));
n,a,b = map(int,input().split())
if (b-a)%2 == 0:
  print(min((b-a)//2,n-a,b-1))
else:
  print(min(n-a,b-1))
N, A, B = map(int, input().split())
dis = B-A
min1 = min(abs(0-B), N-A)
print(int((B-A)/2)) if (B-A)%2==0 else print(min1-1)
N,A,B = map(int,input().split())
if A % 2 == B % 2:
    print((B - A) // 2)
else:
    print(min(B - 1, N - A))
def count(x,y):
    return abs((x-y)/2)

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


if (A-B)%2==0:
    ans=count(A,B)

else:
    
    if (A-1)<(N-B):
        ans=A
        A=1
        B=B-ans
    else:
        ans=N-B+1
        A=A+ans
        B=N
    
    ans+=count(A,B)

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

if (B-A)%2 == 0:
	print((B-A)//2)
else:
	print((B-A)//2 + min(A,N-B))
N,A,B= map(int,input().split())
if (B-A)%2 == 0:
  print((B-A)//2)
else:
  print(min(int(B-1),int(N-A)))
n, a, b = map(int, input().split())
if (b-a)%2 == 0:
  print((b-a)//2)
elif b-1 < n-a:
  print(b-1)
else:
  print(n-a)
N, A, B = map(int, input().split())
cnt = 0
if (A + B) % 2:
    if A - 1 < N - B:
        cnt += A
        B = max(1, B - A - 2)
        A = 1
    else:
        cnt += N - B + 1
        A = min(N, A + N - B + 1)
        B = N
print(cnt + B - (A + B) // 2)
n, a, b = map(int, input().split())
# 卓1で遭遇
hoge = min(a, b) - 1
# 卓2で遭遇
huga = n - max(a, b)
# a, b間で遭遇
if (max(a, b) - min(a, b)) % 2 == 0:
  piyo = min(a, b) + (max(a, b) - min(a, b)) // 2
  ans = min(hoge, huga, piyo)
else:
  ans = min(hoge, huga)
print(ans)
N, A, B =map(int,input().split())
d = abs(B-A)
ans = 0
if d % 2 == 0:
    ans = d // 2
else:
    if N - B >= A - 1:
        ans = B - 1
    else:
        ans = N - A

print(ans)
N,A,B=map(int,input().split())
if (A+B)%2==0:
	P=B-(A+B)//2
else:
	P=float("inf")
if (A+B)%2==1:
	Q=A-1
	B-=Q
	Q+=1
	B-=1
	Q+=B-(B+1)//2
else:
	Q=float("inf")
if (A+B)%2==1:
	R=N-B+1
	B=N
	A-=R
	R+=B-(A+B)//2
else:
	R=float("inf")
print(min(P,Q,R))
N,A,B = map(int,input().split())

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

N = int(N)
A = int(A)
B = int(B)

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