peterverebics/CodeNet_Python_118 huggingface dataset:
A, B, K = map(int, input().split())

if A - K >= 0:
    print(0 ,B)
elif A + B - K >= 0:
    print(0, A+B-K)
else:
    print(0, 0)
a,b,k = [int(_) for _ in input().split()]

if a <= k:
  result = b - k + a
  print("0 "+str(result))
else:
  result = a - k
  print(str(result)+" "+str(b))
a,b,k = map(int,input().split())
a -= min(a,k)
k = k -a if k - a> 0 else 0
b -= min(b, k)
print(a,b)
a, b, k = [int(i) for i in input().split()]
maxs = max(0, a - k)
mins = min(0, a - k)
print(str(maxs) + " " + str(b + mins))
def solve():
    A, B, K = map(int, input().split())
    ans = []
    if A + B == K:
        ans = [0, 0]
    elif A + B < K:
        ans = [0, 0]
    elif K <= A:
        ans = [A-K, B]
    elif A < K <= B:
        ans = [0, B+A-K]
    elif K == 0:
        ans = [A, B]
    print(*ans)

# print(solve())
solve()
A,B,K=map(int,input().split())
ans=[0]*2

if A>=K:
  ans[0]=A-K
  ans[1]=B
else:
  ans[1]=B-(K-A)

print(ans[0],ans[1])
tk, ao, k = map(int, input().split())


for i in range(k):
    if tk == ao:
        tk = 0
        ao = 0
    break

    if tk >= 1:
        tk -= 1
    elif ao >= 1:
        ao -= 1
    elif tk == 0 and ao == 0:
        break
    
print(str(tk) +' '+str(ao))
A,B,K=map(int,input().split())
if A<=K and B<=K:
  print(0,0)
elif A<K and B>=K:
  print(0,B-A)
else:
  print(A-B,0)
A,B,K = map(int, input().split())

print(A-K+B) if K <= A else print(0) if (A+B) < K else print(A+B-K)
a, b, k = map(int, input().split())

if a >= k:
    print(a - k, b)
else:
    print(0, b - k + a)
a, b, k = [int(x) for x in input().split()]
if a >= k:
  a -= k
else:
  b -= k - a
  a = 0
print(a, b)
a,b,k = map(int,input().split())

a_af = a - min(a,k)
b_af = b - (k - min(a,k))
print(a_af,b_af)
A,B,K = map(int,input().split())

if A >= K:
    print(A-K,B)

else:
    print(0,B-(K-A))
def solve():
    A, B, K = map(int, input().split())
    ans = []
    if A+B <= K:
        ans = [0, 0]
    if A >= K:
        ans =[A-K, B]
    if A<K<=B:
        ans = [0, B+A-K]
    if K == 0:
        ans = [A, B]
    print(*ans)

# print(solve())

# def solve()が@return voidのとき
solve()
a, b, k = map(int, input().split())
if a <= k:
    print(0, (a+k)-b)
elif a > k:
    print((a-k), b)
a,b,k = list(map(int,input().split(' ')))
"""takahashi has a
   aoki has b
   loop k

for _ in range(k):
  if a >= 1:
    a -= 1
  elif b >= 1:
    b -= 1
  elif a == 0 and b == 0:
    break
"""
if a - k < 0:
  k = k - a
  a = 0
elif a -k >= 0:
  k = k - a
  a = a - k

if b -k < 0:
#  k = k - b
  b = 0
elif b -k >= 0:
#  k = k - b
  b = b - k

print(a,b)
import sys
A,B,K = map(int,input().split())
if A >= K:
    A -= K
    print(str(A) + ' ' + str(B))
    sys.exit(0)
else:
    B = B - (K-A)
    A = 0
if A==0 and B== 0:
    print(str(0) + ' ' + str(0))
else:
    print(str(A) + ' ' + str(B))
A, B, K = map(int, input().split())
taka,aoki = 0, 0
taka = max(0,A-K)
aoki = B + min(0,A-K)
print(taka,aoki)
a,b,k=map(int,input().split())

if a+b<=k:
    print(0,end=" ")
    print(0)
    #exit()
elif a<=k:
    print(0,end=" ")
    print(b-(k-a))
    #exit()
else:
    print(k-a,end=" ")
    print(b)
A, B, K = map(int, input().split())
print(max(0, A-K), min(B, B-K+A))
A, B, K = map(int, input().split())

# for i in range(K):
#     if A > 0:
#         A -= 1
#     elif B > 0:
#         B -= 1

if A >= K:
    A -= K
elif A+B >= K:
    A = 0
    B -= K-A
    if B < 0:
        B = 0
elif A+B < K:
    A = 0
    B = 0

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

# check
if A <= K:
    K = K - A
    A = 0
    B -= K
else:
    A -= K

print(A, B)
r=input().split()
A=int(r[0])
B=int(r[1])
K=int(r[2])
if K>=A+B:
    print("0 0")
elif K>=A:
    print("0 "+str(K-A+B))
else:
    print(str(A-K)+" "+str(B))
A,B,K = map(int,input().split())

print( A+B-K if A+B > K else 0)
A, B, K = map(int, input().split())
if A>=K:
    A = A - K
else:
    A = 0
    B = max(0,B-(K-A))
print(A, B, sep=' ')
def main():
    a, b, k = mapt(int, input().split(" "))
    if k <= a:
        print(k-a, b)
    elif k > a and a + b >= k:
        print(0, b-(k-a))
    else:
        print(0, 0)
A, B, K = map(int, input().split())

if A >= K :
    print(A-K, B)
else :
    print(0, B+A-K)
a,b,c=map(int,input().split())
if a >= c:
  a = a-c
else:
  b = b + a -c 
  a = 0
print(a,b)
A,B,K =map(int, input().split())
if A >= K:
    A = A - K 
    print(str(A)+ ' ' + str(B))
else:
    B = B - (K - A)
    print('0 ' + str(B))
a,b,c=map(int,input().split())

if c>a:
  rem1=c-a
  rem2=abs(rem1-b)
  print(0,rem2)
elif c<a:
  rem=a-c
  print(rem,b)
a,b,k=map(int,input().split())

a-=k
b+=min(0,a)
a=max(0,a)
print(a,b)
tk, ao, k = map(int, input().split())


if tk == ao:
    tk = 0
    ao = 0
    print(str(0) + str(0))

else:
    for i in range(k):
        if tk >= 1:
            tk -= 1
        elif ao >= 1:
            ao -= 1
        elif tk == 0 and ao == 0:
            break
    print(str(tk) +' '+str(ao))
import sys

def main():
    
    a,b,k = map(int, input().split())
    if a < k and b < k:
        print(0,0)
        sys.exit()
    else:    
        for i in range(k):
            if a > 0:
                a = a-1
            if a <= 0 and b > 0:
                b = b-1
                break
        print(a,b)

if __name__ == "__main__":
    main()
a,b,k=map(int,input().split())
if k<=a:
	A=a-k
	B=b
elif k>=a and k<=b:
	A=0
	B=b+a-k
else:A=B=0
print(A,B)
t_cookie, a_cookie, K = [int(i) for i in input().split(" ")]

t_cookie = t_cookie - K if t_cookie >= K else 0
a_cookie = a_cookie if t_cookie > K else a_cookie - ( K - t_cookie )

print(t_cookie,a_cookie)
a, b, k = map(int, input().split())
while k > 0:
  if a >= 1:
    a -= 1
  else:
    if b >= 1:
      b -= 1
    else:
      break
print(a, b)
a,b,k=map(int,input().split())
if a>k:a=a-k
if a<=k:
  a==0
  b=b+(a-k)
if a+b<=k:
  a==0
  b==0
print(a,b)
line = input()
a, b, k = line.split(" ")
a = int(a)
b = int(b)
k = int(k)
 
if k >= a+b:
    print(0,0)
else:
    if a - k < 0:
        print(0, b-(k-a))
    else:
        print(a + k, b)
a, b, k = [int(e) for e in input().split()]

ans = a + b - k

if ans < 0:
    ans = 0

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

if a >= k:
    a-=k
    print(a, b)
else:
    a = 0
    k -= a
    b = max(0, (b - k))
    print(a, b)
a, b, k = map(int, input().split())
if a == 0 and b == 0:
    a = 0
    b = 0
elif a < k:
    b -= k-a
    a = 0
else:
    a -= k
print(a, b)
l=list(map(int,input().split()))
A,B,K=l

K-=A
B-=K
print(0,B)
list = input().split(' ')
(A,B,K)=(int(list[0]),int(list[1]),int(list[2]))
if A >= K:
    A = A - K
elif 1 <= A < K:
    B = B - K + A
    A = 0
print(A,B)
a, b, k = map(int, input().split())

temp = a
a = max(0, a-k)
k -= temp
if k >= 1:
    b -= k
print(a, b)
A, B, K = map(int,input().split())
print(max(0, A - K), min(B, A + B - K))
a,b,k=map(int,input().split())
if k<=a:
 A=a-k
 B=b
elif k>=a and k<=b:
 A=0
 B=b+a-k
else:A=B=0
print(A,B)
base = input().split()
a = int(base[0])
b = int(base[1])
k = int(base[2])
if a>=k:
    print(a-k,b)
elif a+b<k:
    print(0,0)
else:
    print(0,k-a-b)
a,b,k = map(int, input().split())
if k <= a:
	a = k-a
else:
	if k-a <= b:
		b = b - (k-a)
		a=0
	else:
		a = 0
		b = 0
print(a,b)
# B - Greedy Takahashi
a,b,k = map(int,input().split())
if a < k:
    k -= a
    a = 0  
    if b < k:
        b = 0
    print(a,b-k)
else:
    print(a-k,b)
a,b,k = map(int,input().split())
if a>= k:
  a = a-k
  print(a,b)
elif a < k:
  k = k-a
  a = 0
  b = b-k
  print(a,b)
import os

def main():
    num_a,num_b,count = (int(x) for x in input().split())
    if count <= num_a:
        print(num_a - count,num_b)
    else:
        count -= num_a
        print(0,num_b - count)

if __name__ == "__main__":
    main()
a,b,k=map(int,input().split())
if a>=k:
  print(a-k,b)
else:
  print(0,b-k+a)
A, B, K = map(int, input().split())

if (K > A + B):
    print(0, 0)
else:
    print(max(0, A - K), max(0, A + B - K))
A,B,K=map(int,input().split())
for i in range(K):
  if A>=1:
    A-=1
  if B>=1:
    B-=1
print(A,B)
A,B,K=map(int,input().split())
if A>=K:
    A-=K
else:
    B-=max(K-A,0)
    A=0

print(A,B)
def solve(string):
    a, b, k = map(int, string.split())
    return "{} {}".format(max(0, a - k), max(0, a - k + b))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
a,b,k=input().split()
a,b,k=int(a),int(b),int(k)
if a>=k:
    taka=a-k
    ao=b
else:
    taka=0
    ao=a+b-k
print(taka,end=" ")
print(ao)
a,b,k=map(int,input().split())
if k<=a:
	print(a-k,b)
elif k>=a and k<=b:
	print(0,b+a-k)
else: print("0 0")
A,B,K = list(map(int,input().split()))
for i in range(K):
  if A != 0:
    A -= 1
  if A == 0 and B != 0:
    B -= 1
print('{} {}'.format(A,B))
a,b,k=map(int,input().split())
if a+b>=k:
    b=a+b-k
    a=0
else:
    a=0
    b=0
print(a,b)
a,b,k=map(int,input().split())
if a>=k:
    print(a-k, b)
else:
    print(0, a+b-k)
def main():
  [a, t, k] = [int(i) for i in input().split()]
  if a + t >= k:
    a = 0
    t = 0
  elif a >= k:
    a = 0
    t = t - (k -a)
  else:
    a = a - k
  print(a, t)

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

k1=(k+1)//2
k2=k//2
mn=min(a,b,k)
print("{} {}".format(max(0,a-k1),max(0,b-k2)))
A,B,K = input().split(" ")
A = int(A)
B = int(B)
K = int(K)

if K>=A:
  A = 0
  K -=A
  if K>=B:
    B = 0
  else:
    B -=K
else:
  A -=K
print(A,B)
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B, K = MAP()

print(max(0, A-K), min(B, B-(K-A)))
A,B,K=map(int,input().split())
if A>=K:
    print(A-K,B)
else:
    print(0,B-K+A)
a,b,c = map(int, input().split())
print(max(a - c, 0), b - abs(min(a - c, 0)))
A, B, K = map(int, input().split())

if A - K >= 0:
  res_A = A - K
  res_B = B
elif A - K < 0:
  res_A = 0
  res_B = B - abs(A - K)
print(res_A, res_B)
A,B,K = map(int, input().split())
if K <= A and A != 0:
    print(A-K, B)
elif B != 0:
    print(0,A+B-K)
else:
    print(0,0)
A,B,K=map(int,input().split())
if A>=K:
  print(str(A-K)+" "+str(B))
else:
  t=K-A+1
  print("0"+" "+str(t))
a,b,k = map(int,input().split())

if a <=k:
    print(0, a+b-k)
    
else:
    print(a-k,b)
a, b, k = list(map(int, input().split()))
if k > a:
  b -= k - a
  a = 0
else:
  a = a - k
print(a, b)
A, B, K = map(int, input().split())
C = K - A
if A >= K:
  A -= K
  print(A, B)
else:
  A *= 0
  B -= C
  print(A,B)
A,B,K = map(int,input().split())
K=K-A
B=B-K
if A > 0:
    A = 0
print(A,B)
a, b, k = map(int, input().split())

if a - k >= 0:
    print(a - k, b)
else:
    b = b - (k - a)
    print(0, b)
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))





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

    if A>=K:
        print(K-A,B)
    else:
        print(0,max(0,B-(K-A)))


if __name__ == "__main__":
    main()
A, B, K = map(int, input().split())
b = B - (K - A)
if A <= K and b >= 0:
    print(0, b)

if b < 0:
    print(0, 0)

else:
    print(A-K, B)
A, B, K = map(int, input().split())

if K <= A:
    print(A - K, B)
elif A < K <= B:
    print(0, B - (K - A))
else:
    print(0, 0)
import math
A, B, K = map(int, input().split())

if A > K:
    A = A - K
    print(A, end=" ")
    print(B)
    exit(0)

if K > A:
    K = K - A
    A = 0
    if K >= B:
        K = K - B
        B = 0
        print(A, end=" ")
        print(B)
        exit(0)
    if B > K:
        B = B - K
        print(A, end=" ")
        print(B)
        exit(0)
a, b, k = map(int, input().split())
for i in range(k):
  if a >= 1:
    a -= 1
  elif b >= 1:
    for j in range(k-i):
      b -= 1
      if b >= 1:
        break
    break
  else:
    break
print("{} {}".format(a, b))
import sys
A,B,K = map(int,input().split())

if not ( 0 <= A <= 10**12 and 0 <= B <= 10**12 and 0 <= K <= 10**12 ): sys.exit()
if not ( isinstance(A,int) and isinstance(B,int) and isinstance(K,int) ): sys.exit()

if K >= A:
    A = 0
    if (K - A) >= B:
        B = 0
    elif (K - A) < B:
        B = B - (K - A)
elif K < A:
    A = A - K
print(A,B)
A,B,K =map(int,input().split())

k=0
if A>0:
    k+=A
    A=0

if A==0 and B>0 and k<K:
    k = K-k
    B-=k

print(A,B)
A, B, K = map(int, input().split())
if K <= A:
    print(A - K, B)
elif K <= B:
    print(0, B - (K - A))
else:
    print(0, 0)
a,b,k=map(int,input().split())
if a==k:
  print('0',b)
  
elif a>k:
  print(a-k,b)
  
else:
  print('0',b+a-k)
a = list(map(int, input().split()))

if((a[0]+a[1]) == a[2]):
    a[0] = 0
    a[1] = 0
    print("%d %d"%(a[0],a[1]))

else:
    if(a[0] >= a[2]):
        a[0] = a[0] -a[2]
        a[2] = 0
        a[2] = a[2] - a[0]
    elif(a[1] >= a[2]):
        a[0] = 0
        a[1] = a[1] -a[2]
    else:
        a[1] = 0
print("%d %d"%(a[0],a[1]))
A, B, K = map(int, input().split())

if A >= K:
  print(A - K, B)
else:
  print(0, max(B - (A - K), 0))
a,b,k=map(int,input().split())
if k<=a:
    print(a-k,b)
elif a<k<=a+b:
    print(0,k-a)
elif a+b<k:
    print(0,0)
a,b,k = map(int, input().split())
if a <= k:
    a, k = 0, k-a
    b -= k
else:
    a -= k
print(str(a)+' '+str(b))
A, B, K = map(int, input().split())

if A >= K:
    print(str(A-K) + " " + str(B))
else:
    print("0 " + str(A+B-K))
A,B,K = map(int,input().split())
if A < K:
  print('%i %i'%(A-K,B))
else:
  print('%i %i'%(0,B-(A-K)))
A, B, K = map(int, input().split())

if max(A, B) <= K:
    A, B = 0, max(0, B-K+A)
elif K <= A:
    A -= K

print(A, B)
A, B, K = map(int,input().split())
if A >= K:
  r = A - K + B
else:
  r = B - (K - A)
r = 0 if r < 0 else r
print(r)
a, b, k = input().split()
a, b, k = int(a), int(b), int(k)

c = a - k


if c >= 0:
  print(c, b)
else:
  d = b - c
  if d <= 0:
    print(0, d)
  else:
    print(0, 0)
a,b,k=map(int,input().split())
if(k>a):
  a=0
  k=k-a
  if(k>=b):
    b=0
  else:
    b=b-k
elif(k==a):
  a=0
else:
  a=a-k

print("{} {}".format(a,b))
a,b,k=map(int,input().split())
if k<=a:
    print(k-a,b)
else:
    print(0,b-max((k-a),0))
a, b, k = map(int, input().split())

print(10 ** 12)

for _ in range(k):
    if a > 0:
        a -= 1
    else:
        if b > 0:
            b -= 1

print(a, b)
def main():
    a, b, k = map(int, input().split())
    if a > k:
        c = a-k
        d = b
    else:
        c = 0
        d = b-(k-a)
    print(c, d)


main()
a, b, k = map(int, input().split())

if a > k:
    a -= k
    print(a, b)
else:
    a = 0
    k -= a
    
    if b > k:
        b -= k
        print(a, b)
    else:
        b = 0
        print(a, b)
a, b, k = map(int,input().split())
k = k - a
if k >= 0:
    b = b - k
    print(0,b)
else:
    print(-k,b)
a,b,k=map(int,input().split())
b=max(0,b-min(a-k,0))
a=max(0,a-k)
print(a,b)
a,b,k=map(int,input().split())
if a <= k:
  print(0,end=' ')
else:
  print(a-k,end=' ')
s = a+b
if s >= k:
  print(s-k)
else:
  print(0)
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a, b, k = na()
res = k
if a > 0:
    i = min(k, a)
    res = k - i
    if res == 0:
        print(a - res, b)
i = min(res, b)
res -= i
if res > 0:
    print(0, 0)
else:
    print(0, b - i)
a,b,k = map(int, input().split())

Takahashi = 0
Aoki = 0

Takahashi = a - k

if Takahashi <= 0:
    Aoki = b + Takahashi
    Takahashi = 0
else:
    Aoki = b

print(Takahashi , Aoki)
def resolve():
    A, B, K = list(map(int, input().split()))
    taka = max(A-K, 0)
    ao = B-(K-A) if K > A else 0
    print(taka, ao)

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

if a-k <0:
    b = b-(k-a)
    a = 0
else:
    a = a-k
print(a,b)
a, b, k = map(int, input().split())
print("{} {}".format(a - k, b) if a >= k else "{} {}".format(0, b - (k - a)))
A, B, K = map(int, input().split())

if A >= K:
    A -= K
elif A < K and B >= K:
    B -= K - A
    A = 0
elif A < K and B < K:
    A = 0
    B = 0

print('{} {}' .format(A, B))
def solve():
    A,B,K = [int(i) for i in input().split()]
    if K >= A:
        B -= (K-A)
        A = 0
    else:
        A -= K
    print(A, B)

if __name__ == "__main__":
    solve()
A,B,K = [int(i) for i in input().split(" ")]

def check(A,B,K):
    if A >= K:
        A=-K
    else:
        result = K-A
        A = 0
        K = result
    B-=K
    return "{0} {1}".format(A,B)

print(check(A,B,K))
a,b,k = map(int, input().split())
if k >= a:
    k = k-a
    a = 0
else:
    a -= k

if k >= b:
    b = 0
else :
    b -= k
print(a,b)
a,b,k=map(int,input().split())
if k<a:
    print(k-a,b)
elif a<=k<a+b:
    print(0,b-(k-a))
else:
    print(0,0)
a, b, k = map(int, input().split())
if a==0 and b==0:
    print(0, 0)
elif k>a:
    print(0, end=" ")
    print(abs(b-(k-a)))
elif k<a:
    print(a-k, b)
elif a==k:
    print(0, b)
A, B, K = map(int, input().split())
if 0<=K<=A:print(A-K,B)
elif A<K<=B:print(0,B-K+A)
else:print(0,0)
x = list(map(int, input().split()))
a = x[0] - x[2]
b = x[1]
c = x[2] - x[0]
if a <= 0:
  a = 0
if a <= 0 and b >= 0:
  b -= c
print(str(a)+' '+str(b))
A,B,K = map(int,input().split())
if A > K:
    print(A-K,B)
elif A <= K:
    print(0,A+B-K)
elif A+B < K:
    print(0,0)
n, m, k = [int(s) for s in input().split()]
if k - n > 0:
  print(0, m - k + n)
else:
  print(n - k, m)
a, b, k = map(int, input().split())
if k < a:
  a=a-k
else:
  b=b-(k-a)
  a=0
print(a,b)
def main3():
    N, A, B = map(int, input().split())
    
    d = B - A
    if d % 2 == 0:
        print(d // 2)
    else:
        print(min(((d + 1) // 2 + N - B ), ((d + 1) // 2 + A - 1)))
         
if __name__ == "__main__":
    main3()
n,a,b = map(int,input().split())

check = abs(a-b)

if check%2 == 0:
    print(check//2)
    exit()

temp1 = min(max(a,b) - 1, n - min(a,b))
temp2 = min(min(a,b) - 1, n - max(a,b))
ans = min(temp1, temp2 + 1 + (check)//2)

print(ans)
import sys
input = sys.stdin.readline
 
 
def main():
    n,a,b = [int(i) for i in input().strip().split()]
    if (b-a) % 2 == 0:
        print(abs(b - a) // 2)
    else:
        ans = min(a - 1, n - b) + 1 + (b - a - 1) // 2
        print(ans)
    return 
 
 
 
if __name__ == "__main__":
    main()
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N,A,B=map(int,readline().split())
    if (B-A)%2==0:
        print((B-A)//2)
    else:
        print(min(N-B,A-1)+1+(B-A-1)//2)

if __name__=="__main__":
    main()
n, a, b = map(int, input().split())
print((b-a)//2 + min(a-1,n-b) + 1 if (b-a)%2 else (b-a)//2)
import sys
import math

def resolve():
    stdin = sys.stdin
    mod = 10**9 + 7
    ns = lambda: stdin.readline().rstrip()
    ni = lambda: int(ns())
    na = lambda: list(map(int, stdin.readline().split()))
    sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

    n, a, b = na()

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

if __name__ == "__main__":
    resolve()
N, A, B = (int(i) for i in input().split())  

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

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

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

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

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

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, a, b = MI()
    d = b - a
    ans = 0
    if d%2:
        temp = min(a-1, n-b)
        ans = (d-1)//2 + temp + 1
    else:
        ans = d//2
    print(ans)

if __name__ == '__main__':
    main()
n, a, b = map(int,input().split())
if a % 2 == b % 2:
    print((b-a)//2)
else:
    ans = min(n-b, a-1) + 1 + (b-a-1)//2
    print(ans)
s = list(map(int, input().split()))
N = s[0]
A = s[1]
B = s[2]

if (B - A) % 2 == 0:
  print((B - A) // 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( (B-A)//2 + 1 +min(A-1,N-B) )
n,a,b=map(int,input().split())
if (a+b)%2==0:
    print((b-a)//2)
else:
    print(min(((a-1)+(b-1)+1)//2,((n-a)+(n-b)+1)//2))
n,a,b = map(int,input().split())
if abs(a-b)%2 == 0:
  print(abs(a-b)//2)
else:
  print(min(2*n-a-b+1,a+b-1)//2)
n,a,b=map(int,input().split())
if a%2==b%2:
    print((b-a)//2)
    exit()
if a-1<n-b:
    print(a+(b-a-1)//2)
else:
    print(n-b+1+(b-a-1)//2)
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,a,b = iim()

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

margin = abs(a-b)

if (a % 2 == 0 and b % 2 == 0) or (a % 2 == 1 and b % 2 == 1):
    print(margin//2)
else:
    t = min(a-1, n-b) + 1 +(b-a-1)//2
    print(t)
n,a,b=map(int,input().split())
if (a-b)%2==0:
    print(abs(a-b)//2)
else:
    ans0=min(a,b)+abs(a-b)//2
    ans1=n-max(a,b)+1+abs(a-b)//2
    print(min(ans0,ans1))
N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    # N に向かうことを考える
    A_to_N_dis = N - B + 1
    A_to_N = A + A_to_N_dis
    tmp_ans = (N - A_to_N) // 2 + A_to_N_dis

    # 1に向かうことを考える
    B_to_1_dis = A - 1 + 1
    B_to_1 = B - B_to_1_dis
    ans = (B_to_1 - 1) // 2 + B_to_1_dis
    print(min(tmp_ans, ans))
n, a, b = map(int, input().split())
if (b - a) % 2:
    print((b - a - 1) // 2 + 1 + min(n - b, a - 1))
else:
    print((b - a) // 2)
n,a,b=map(int,input().split())
if (b-a)%2==0:
    print((b-a)//2)
else:
    c=(a-1)+(b-a+1)//2
    d=(n-b)+(b-a+1)//2
    print(min(c,d))
n,a,b=map(int, input().split())

print((b-a)//2 if (b-a)%2==0 else min(a-1,n-b)+1+(b-a-1)//2)
N,A,B=map(int,input().split())
if (A+B)%2==0:
	P=(B-A)//2
else:
	P=float("inf")
if (A+B)%2==1:
	Q=A
	Q+=(B-Q-(B-Q+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(A-1,N-B)+1+(B-A-1)//2)
n,a, b = map(int, input().split( ))
if (a-b)%2==0:
    print(abs(a-b)//2)
    exit()

if a<b:
    a,b = b,a
ans1 = b-1+(a-b+1)//2
ans2 = (n-a) + (n-(b+n-a)+1)//2

print(min(ans1,ans2))
N,A,B = map(int,input().split())
if abs(B-A)%2==0:
    print(abs(B-A)//2)
elif A<B:
    print(min(A-1,N-B)+1+(B-A-1)//2)
else:
    print(min(B-1,N-A)+1+(A-B-1)//2)
N, A, B=map(int, input().split())
if (B-A)%2==0:
  print((B-A)//2)
else:
  if A==1 or B==N:
    ans=(B-A-1)//2+1
  else:
    ans=min(A-1, N-B)+(B-A-1)//2+1
  print(ans)
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=map(int,input().split())
ans=0
 
if (B-A)%2==0:
  ans=(B-A)//2
else:
  if A-1<N-B:
    if B-A==1:
      ans=B-1
    else:
      ans=A+(B-A-1)//2
  else:
    if B-A==1:
      ans=N-A
    else:
      ans=N-B+1+(N-(A+N-B+1))//2
print(ans)
#!/usr/bin/env python3
n, a, b = map(int, input().split())
if (b - a) % 2 < 1:
    print((b - a) // 2)
else:
    print(min((a + b - 1) // 2, (2 * n - a - b + 1) // 2))