Problem:
 Score : 300 points    Problem Statement You are given three integers A , B and C . Find the minimum number of operations required to make A , B and C all equal by repeatedly performing the following two kinds of operations in any order:   Choose two among A , B and C , then increase both by 1 .  Choose one among A , B and C , then increase it by 2 .   It can be proved that we can always make A , B and C all equal by repeatedly performing these operations.      Constraints  0 \leq A,B,C \leq 50  All values in input are integers.         Input Input is given from Standard Input in the following format:  A  B  C       Output Print the minimum number of operations required to make A , B and C all equal.        Sample Input 1 2 5 4      Sample Output 1 2  We can make A , B and C all equal by the following operations:   Increase A and C by 1 . Now, A , B , C are 3 , 5 , 5 , respectively.  Increase A by 2 . Now, A , B , C are 5 , 5 , 5 , respectively.        Sample Input 2 2 6 3      Sample Output 2 5       Sample Input 3 31 41 5      Sample Output 3 23

Solution (Python):
a = list(map(int, input().split()))

a.sort()
ans = 0
ans += a[2] - a[1]
diff = a[2] - (a[0] + (a[2] - a[1]))
if diff % 2 == 0:
    ans += diff // 2
else:
    ans += diff // 2 + 2
print(ans)

Solution (Python):
a = list(map(int, input().split()))
a.sort()
c_b_diff = a[2] - a[1]
c_a_diff = a[2] - (a[0] + c_b_diff)
if c_a_diff % 2 == 1:
    print(c_b_diff + c_a_diff // 2 + 2)
elif c_a_diff == 0:
    print(c_b_diff)
else:
    print(c_b_diff + c_a_diff // 2)

Solution (Python):
ABC=list(map(int,input().split()))

ans,flag=0,True
cnt=[0]*3
while flag:
  ABC.sort()
  for i in range(3):
    if ABC[i]+2<=max(ABC):
      ABC[i]+=2
      ans+=1
    elif sum(cnt)==3:
      flag=False
    else:
      cnt[i]=1
if sum(ABC)==3*max(ABC):
  print(ans)
elif sum(ABC)==3*max(ABC)-1:
  print(ans+2)
elif sum(ABC)==3*max(ABC)-2:
  print(ans+1)

Solution (Python):
A, B, C = map(int, input().split())

tmpM = max(A, B, C)
ans = (abs(A - tmpM) + abs(B - tmpM) + abs(C - tmpM))
if ans  % 2 == 0:
    print(ans // 2)
else:
    print((ans // 2) + 2)

Solution (Python):
A, B, C = map(int, input().split())

tmpM = max(A, B, C)
tmp = A + B + C
if ((3 * tmpM) - tmp) % 2 == 0:
    print(((3 * tmpM) - tmp) // 2)
else:
    print((3 * (tmpM + 1) - tmp) // 2)

Solution (Python):
a, b, c = map(int, input().split())
a, b, c = sorted((a, b, c))
counter = 0
counter += (c - b) // 2
b += ((c - b) // 2) * 2
if c - b == 1:
  counter += 1
  a += 1
  b += 1
counter += (c - a) // 2
a += ((c- a) // 2) * 2
if c - a == 1:
  counter += 2
  a += 2
  b += 1
  c += 1

print(counter)

Solution (Python):
alphaList = sorted(list(map(int, input().split())))
a, b, c = alphaList[0], alphaList[1], alphaList[2]

cnt = int((b-a)/2)
a += cnt * 2

cnt += c - a + int((b - a) % 2)

print(cnt)

Solution (Python):
alphaList = sorted(list(map(int, input().split())))
a, b, c = alphaList[0], alphaList[1], alphaList[2]

cnt = int((b-a)/2)
a += cnt * 2

if b - a == 1:
    cnt += 1
    a += 1
    c += 1

cnt += c - a
a, b = c, c

print(cnt)

Solution (Python):
a,b,c = map(int,input().split())
dif = max(a,b,c)*3 - (a+b+c)
if dif%2 == 0:
  print(dif//2)
else:
  print(dif//2+2)

Solution (Python):
a, b, c = map(int, input().split())

ma = max(a, b, c)

if (ma * 3) % 2 == 0:
    if (a + b + c) % 2 == 0:
        print((ma*3-(a+b+c)) // 2)
    else:
        print(((ma+1)*3 -(a+b+c))//2)

else:
    if (a + b + c) % 2 == 1:
        print((ma*3-(a+b+c)) // 2)
    else:
        print(((ma+1)*3 -(a+b+c))//2)

Solution (Python):
abc = sorted(list(map(int, input().split())))

if abc[2] - abc[1] == 1:
    target = abc[1]
else:
    target = abc[2]

res = 0
for i in range(3):
    res += -(-(target - abc[i]) // 2)
    if (target - abc[i]) % 2 == 1:
        res += 1

print(res)

Solution (Python):
li = list(map(int, input().split()))
c = 0
while True:
    if li[0] == li[1] == li[2]:
        break
    li = sorted(li)
    if li[0] < li[1]:
        li[0] += 2
    else:
        li[0] += 1
        li[1] += 1
    c += 1
print(c)

Solution (Python):

abc = list(map(int, input().split()))
m = max(abc)
abc = [m-x for x in abc] 

abc.sort()
m = max(abc)
ans = 0

while m > 0:
    abc.sort()
    if m >= 2:
        abc[2] -= 2
        ans += 1
        m = max(abc)
    elif m == 1:
        if abc.count(1)==3:
            ans += 1
            print(ans)
            exit()
        elif abc.count(1)==2:
            abc[2] -= 1
            abc[1] -= 1
            ans += 1
            m = max(abc)
        elif abc.count(1)==1:
            ans += 2
            print(ans)
            exit()
print(ans)

Solution (Python):

import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        abc = list(map(int, input().split()))

        M = max(abc)
        if M % 2 == sum(abc) % 2:
            print((3 * M - sum(abc)) // 2)
        else:
            print((3 * (M + 1) - sum(abc)) // 2)



if __name__ == '__main__':
    AtCoder().main()

Solution (Python):

import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        abc = list(map(int, input().split()))

        M = max(abc)
        if 3 * M % 2 == sum(abc) % 2:
            print((3 * M - sum(abc)) // 2)
        else:
            print((3 * (M + 1) - sum(abc)) // 2)



if __name__ == '__main__':
    AtCoder().main()

Solution (Python):
A,B,C = sorted(map(int, input().strip().split(' ')))

ans = 0
if A % 2 != B % 2:
  A += 1
  C += 1
  ans += 1

ans += (B-A)//2
ans += C-B

print(ans)

Solution (Python):
A, B, C = sorted(map(int, input().split()))
cnt = C - B
cnt += (C - (A + cnt))//2 + (C - (A + cnt))%2*2
print(cnt)

Solution (Python):
l = sorted(map(int, input().split()))
x = (2*l[2]-l[0]-l[1])//2
print(x if sum(l)%2==3*l[2]%2 else x + 2)

Solution (Python):
a=sorted(list(map(int,input().split())))
x=a[2]-a[0];y=a[2]-a[1]
if x%2==y%2:
  print((x-y)//2+y)
else:
  if x%2==0:
    print(x//2+(y+1)//2+1)
  else:
    print(y//2+(x+1)//2+1)

Solution (Python):
A, B, C = map(int, input().split())
M = max(A, B, C); S = sum([A, B, C])
print((M * 3 - S) // 2 + (M * 3 - S) % 2 * 2)

Solution (Python):
a, b, c = sorted(map(int, input().split()))
res = (c - a) // 2 + (c - b) // 2
a = (c - a) % 2
b = (c - b) % 2
if a == 0 and b == 0:
    pass
elif a == 1 and b == 1:
    res += 1
else:
    res += 2
print(res)

Solution (Python):
a = sorted(list(map(int, input().split())))
if (a[1]-a[0])% 2 == 0:
    print((a[2]-a[1])+(a[1]-a[0])//2)
else:
    print((a[2]-a[1])+(a[1]-a[0])//2+2)

Solution (Python):
a, b, c = sorted(map(int, input().split()))






print((c - b) + ((b - a) // 2) + (2 if (b - a) % 2 else 0))

Solution (Python):
if __name__ == "__main__":
    A, B, C = map(int, input().split())
    
    max_v = max(A, B, C)
    min_v = min(A, B, C)
    
    num_list = [A, B, C]
    num_list.remove(max_v)
    if len(num_list) == 2:
        num_list.remove(min_v)
        if len(num_list) == 1:
            mid_v = num_list[0]
        else:
            mid_v = min_v
    else:
        mid_v = max_v
    
    ans = 0
    while True:
        if mid_v < max_v:
            ans += max_v - mid_v
            min_v += max_v - mid_v
            mid_v = max_v
            
        else:
            if min_v < max_v:
                if (max_v - min_v) % 2 == 0:
                    
                    ans += (max_v - min_v) / 2
                    
                    break
                else:
                    
                    
                    
                    ans += (max_v + 1 - min_v) / 2
                    ans += 1
                    
                    break
            else:
                break
    
    print(int(ans))

Solution (Python):
l = list(map(int, input().split()))
l.sort()
a = l[2] - l[1]
b = l[2] - l[0]

if a % 2 == 0 and b % 2 == 0:
    print(a // 2 + b // 2)
elif a % 2 == 0 or b % 2 == 0:
    print(a // 2 + b // 2 + 2)
else:
    print(a // 2 + b // 2 + 1)

Solution (Python):
a=sorted(list(map(int,input().split())))
n=2*a[2]-a[1]-a[0]
print(int(3/4-(-1)**n*3/4+n/2))

Solution (Python):
N=list(map(int,input().split()))
m=max(N)*3
s=sum(N)
if m%2==s%2:
  print((m-s)//2)
else:
  print((m-s+3)//2)

Solution (Python):
lst = list(map(int, input().split()))
lst.sort()

diff = lst[2]-lst[1]
res = -(-(lst[1]-lst[0])//2)+(lst[1]-lst[0])%2
print(diff+res)

Solution (Python):
A = list(map(int,input().split()))

A = sorted(A)
a,b,c = A
ans = c-b
if (b-a)%2 == 0:
    ans += (b-a)//2
else:
    ans += (b-a+1)//2 + 1
print(ans)

Solution (Python):
def resolve():
    a,b,c=sorted(list(map(int,input().split())))
    ans=c-b
    a+=c-b
    b=c
    if (c-a)%2==0: print(ans+(c-a)//2)
    else: print(ans+2+(c-a)//2)
resolve()

Solution (Python):
ABC = sorted(list(map(int,input().split())))
d1 = ABC[-1]-ABC[0]
d2 = ABC[-1]-ABC[1]
ans = 0
if d1 % 2 == 0 and d2 % 2 == 0:
    print(d1//2+d2//2)
elif d1 % 2 != 0 and d2 % 2 != 0:
    print(d1//2+d2//2+1)
else:
    if d1 % 2 == 0:
        ans += d1 // 2
        ans += d2 // 2 + 2
        print(ans)
    else:
        ans += d2 // 2
        ans += d1 // 2 + 2
        print(ans)

Solution (Python):
A, B, C = map(int, input().split())
L = [A, B, C]
even = []
odd = []
ans = 0

for i in L:
    if i % 2 == 0:
        even.append(i)
    else:
        odd.append(i)

if len(even) == 2:
    even[0] += 1
    even[1] += 1
    ans += 1
    num = even + odd
elif len(odd) == 2:
    odd[0] += 1
    odd[1] += 1
    ans += 1
    num = even + odd
else:
    num = L

num.sort()
ans_1 = (num[1] - num[0]) // 2
ans_2 = num[2] - num[1]
ans += ans_1 + ans_2
print(ans)

Solution (Python):
a, b, c = sorted(map(int, input().split()))
n = (c-a) + (c-b)
print(n//2+2 if n%2 else n//2)

Solution (Python):
a = list(sorted(map(int, input().split())))
if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2)
elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1)
else:
    if (a[2] - a[0]) % 2 == 1:
        a[0] += 2
        a[1] += 1
        a[2] += 1
    else:
        a[0] += 1
        a[1] += 2
        a[2] += 1
    a = sorted(a)
    if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 2)
    elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1 + 2)
    else:
        raise

Solution (Python):
a,b,c=map(int,input().split())
li=[a,b,c]
li=sorted(li,reverse=True)

if(li[0]*2-li[1]-li[2])%2==0:
    ans=(li[0]*2-li[1]-li[2])//2
else:
    ans=(li[0]*2-li[1]-li[2])//2+2
print(ans)

Solution (Python):
A, B, C = map(int, input().split())

A, B, C = sorted([A, B, C])

diff = (C-A) + (C-B)


if diff % 2 == 0:
  print(diff // 2)
else:
  print(diff // 2 + 2)

Solution (Python):
a, b, c = sorted(map(int,input().split()))
cnt = 0
while a!=b or b!=c:
  if a != c and b != c:
    a += 1
    b += 1
  elif a == c+1:
    c += 1
    b += 1
  elif b == c and a != c:
    a += 2
  cnt += 1
print(cnt)

Solution (Python):
a, b, c = map(int, input().split())

li = [a, b, c]
li.sort()

ans = 0
for i in range(2):
    cnt = (li[2] - li[i]) // 2
    li[i] += 2 * cnt
    ans += cnt

ans += li.count(max(li)) % 3
print(ans)

Solution (Python):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

L =  list(map(int, sys.stdin.readline().split()))
L.sort(reverse=True)

d1 = L[0] - L[1]
d2 = L[0] - L[2]

if (d1 % 2 == 0 and d2 % 2 == 0) or (d1 % 2 != 0 and d2 % 2 != 0):
    print((d1 + d2) // 2)
else:
    print((d1 + d2 + 1) // 2 + 1)

Solution (Python):
def main():
    A, B, C = map(int, input().split())
    num = sorted([A, B, C])
    ans = 0
    even = 0
    for i in range(3):
        if not num[i]&1:
            even += 1
    if even == 2:
        ans = 1
        for i in range(3):
            if not num[i]&1:
                num[i] += 1
    elif even == 1:
        ans = 1
        for i in range(3):
            if num[i]&1:
                num[i] += 1
    ans += (num[2] * 2 - num[0] - num[1]) // 2
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
import math
a, b, c = map(int, input().split())


def cnt(crnt, goal):
  diff = abs(goal - crnt)
  if crnt >= goal:
    return diff
  else:
    if diff % 2 == 0:
      return diff // 2
    else:
      return math.ceil(diff/2) + 1

ans = 10**10
for i in range(100):
  ca = cnt(a, i)
  cb = cnt(b, i)
  cc = cnt(c, i)
  csum = ca + cb + cc
  if ans > csum:
    ans = csum
print(ans)

Solution (Python):
(a, b, c) = sorted(int(tok) for tok in input().split())
moves = 0

moves += (c - b) // 2
b += (c - b) // 2 * 2

if b < c:
    moves += 1
    b += 1
    a += 1

moves += (c - a) // 2
a += (c - a) // 2 * 2

if a < c:
    moves += 2

print(moves)

Solution (Python):
a=sorted(list(map(int,input().split())))
cnt=0
while a[2]-a[0]>=2:
  a[0]+=2
  cnt+=1
while a[2]-a[1]>=2:
  a[1]+=2
  cnt+=1
a=sorted(a)
if a[0]<a[1]:
  cnt+=2
elif a[1]<a[2]:
  cnt+=1
print(cnt)

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


A = list(map(int, input().split()))
A.sort()

count = 0


if (A[1]-A[0])%2 == 1:
    A[0] += 1
    A[2] += 1
    count += 1


count += (A[1]-A[0])//2
count += (A[2]-A[1])

print(count)

Solution (Python):
abc=sorted(list(map(int,input().split())))

ans = 0
if (abc[1] - abc[0]) % 2 == 0:
  ans +=  (abc[1] - abc[0]) // 2
  abc[0] = abc[1]
else:
  ans += 1
  abc[1] += 1
  abc[2] += 1
  ans +=  (abc[1] - abc[0]) // 2
  abc[0] = abc[1]
print(ans + abc[2] - abc[1])

Solution (Python):
abc=list(map(int,input().split()))
a,b,c=sorted(abc)

ans=0


b_plus=c-b
b+=b_plus
a+=b_plus
ans+=b_plus


a_plus=(c-a)//2
a+=a_plus*2
ans+=a_plus


if a!=b:
    ans+=2

print(ans)

Solution (Python):

import sys
import math
from collections import defaultdict


sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


mod = 10**9 + 7


def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))



x = III()

ans = 0
while 1:
    x.sort()
    if x[0]==x[2]:
        break
    elif x[1]!=x[2]:
        x[0] += 1
        x[1] += 1
        ans += 1
    else:
        x[0] += 2
        ans += 1

print(ans)

Solution (Python):
A,B,C = sorted(list(map(int, input().split())))


cnt = 0

while B < C:
	A += 1
	B += 1
	cnt += 1

if (B - A) % 2 == 0:
	cnt += (B-A) // 2
else:
	cnt += ((B-A) // 2 + 2)

print(cnt)

Solution (Python):
ABC = sorted(list(map(int, input().split())))

diff_12 = ABC[1] - ABC[0]
middle = ABC[1]
mx = ABC[2]

ans = 0
ans += (diff_12+1) // 2
if (diff_12 % 2) == 1:
    ans += 1
ans += mx - middle

print(ans)

Solution (Python):
a, b, c = sorted(map(int, input().split()))

cnt = 0
while not (a == b == c):
    if (b - a) % 2 == 0:
        cnt = (b - a) // 2
        cnt += c - b
        print(cnt)
        exit()
    else:
        cnt = (b - a) // 2
        cnt += c - b + 2
        print(cnt)
        exit()


print(cnt)

Solution (Python):
import sys
from statistics import *
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

li = na()
li.sort()
ct = 0
dif = li[1] - li[0]
ct += dif // 2
li[0] += (dif // 2) * 2
if li[0] == li[1]:
    ct += li[2] - li[1]
else:
    ct += li[2] - li[0] + 1
print(ct)

Solution (Python):
A, B, C = map(int, input().split())
m = max(A, B, C)
s = A+B+C
if (3*m-s)%2 == 1:
  r = (3*(m+1)-s)//2
else:
  r = (3*m-s)//2
print(r)

Solution (Python):

import sys
from math import ceil

def solve(A: int, B: int, C: int):
    l = [A, B, C]
    l.sort()

    t = l[2]-l[1] + l[2] - l[0]

    if(t%2 == 0):
        print(ceil(t/2))
    else:
        print(ceil(t/2)+1)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    solve(A, B, C)

if __name__ == '__main__':
    main()

Solution (Python):
a = list(map(int, input().split()))
count = 0
a.sort()
count += int((a[2] - a[0])/2)
a[0] += int((a[2] - a[0])/2) * 2
a.sort()
count += int((a[2] - a[0])/2)
a[0] += int((a[2] - a[0])/2) * 2
a = list(map(lambda x:x-a[0], a))
if a == [0,0,0]:
  print(count)
elif a == [0,0,1]:
  print(count + 1)
else:
  print(count + 2)

Solution (Python):
a,b,c=sorted(map(int,input().split()));d=2*c-a-b;print(d//2+d%2*2)

Solution (Python):
t = sorted(list(map(int, input().split())), reverse=True)
m = max(t)
ans = 0
if t[1] % 2 != t[2] % 2:
    t[0] += 1
    t[1] += 1
    m += 1
    ans += 1
while any([x != m for x in t]):
    if t[1]+2 <= m: t[1] += 2
    elif t[2]+2 <= m: t[2] += 2
    elif t[1]+1 <= m and t[2]+1 <= m:
        t[1] += 1
        t[2] += 1
    ans += 1
print(ans)

Solution (Python):
list=sorted(list(map(int,input().split())))
count=0
while list[-1]-1>list[0] or list[-1]-1>list[1]:
  if list[0]<list[-1]-1:
    list[0]+=2
    count+=1
  if list[1]<list[-1]-1:
    list[1]+=2
    count+=1
if list[0]==list[1]==list[-1]-1:
  count+=1
elif list[0]==list[-1] and list[1]<list[-1]:
  count+=2
elif list[1]==list[-1] and list[0]<list[-1]:
  count+=2
else:
  pass
print(count)

Solution (Python):
nums = sorted(list(map(int, input().split())))
ans = 0
while nums[0] != nums[-1]:
  if nums[-1] - nums[0] >= 2:
    nums[0] += 2
  else:
    nums[0] += 1
    nums[1] += 1
  nums = sorted(nums)
  ans += 1
print(ans)

Solution (Python):
nums = sorted(list(map(int, input().split())))
ans = 0
while nums[0] != nums[-1]:
  if nums[-1] - nums[0] >= 2:
    nums[0] += 2
    nums = sorted(nums)
    ans += 1
  else:
    nums[0] += 1
    nums[1] += 1
    nums = sorted(nums)
    ans += 1
print(ans)

Solution (Python):
arr = list(map(int, input().split()))
arr.sort()
ans = arr[2] - arr[1]
arr[0] += ans
diff = arr[2] - arr[0]
ans += diff // 2 + (diff % 2) * 2
print(ans)

Solution (Python):
a,b,c=map(int,input().split())
s=max(a,b,c)*3-(a+b+c)
print(s//2 if s%2==0 else (s+3)//2)

Solution (Python):







a, b, c = map(int, input().split())
result = 0
while True:
  if a == b and b == c:
    break
  elif a != b and b != c and a != c:
    if a < b:
      if b < c:
        a += 1
        b += 1
      else:
        a += 1
        c += 1
    else:
      if a < c:
        a += 1
        b += 1
      else:
        b += 1
        c += 1
  else:
    if a == b:
      if a > c:
        c += 2
      else:
        a += 1
        b += 1
    elif b == c:
      if a > b:
        b += 1
        c += 1
      else:
        a += 2
    else:
      
      if a > b:
        b += 2
      else:
        a += 1
        c += 1
  result += 1
print(result)

Solution (Python):
x = [int(i) for i in input().split()]
x.sort()
ans = (x[1]-x[0])//2 + x[2] - x[1]
if (x[1]-x[0]) % 2 != 0:
    print(ans + 2)
else:
    print(ans)

Solution (Python):
ABC = list(map(int, input().split()))

ABC = sorted(ABC)

N = ABC[2] - ABC[1]
M = ABC[2] - ABC[0] - N

ans = N + M // 2

if M % 2 == 1:
    ans += 2

print(ans)

Solution (Python):

nums=sorted(list(map(int, input().split())))


rest=[i%2 for i in nums]


if sum(rest)==0 or sum(rest)==3:
    print(((nums[2]-nums[1])+(nums[2]-nums[0]))//2) 

elif sum(rest)==1:
    nums_2=[i+1 if i%2==0 else i for i in nums]
    print(((nums_2[2]-nums_2[1])+(nums_2[2]-nums_2[0]))//2+1) 

elif sum(rest)==2:
    nums_3=[i+1 if i%2==1 else i for i in nums]
    print(((nums_3[2]-nums_3[1])+(nums_3[2]-nums_3[0]))//2+1)

Solution (Python):
def main():
    a, b, c = sorted([int(i) for i in input().split()])
    m = max(a,b,c)
    if 3*m%2 == (a+b+c)%2:
        print((3*m-(a+b+c))//2)
    else:
        print((3*(m+1)-(a+b+c))//2)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
ary = list(map(int,input().split()))
count = 0

if ary[0] == ary[1] == ary[2]:
    print(0)
    sys.exit()


if (ary[0] + ary[1] + ary[2]) % 2 == 0:
    for i in range(3):
        if ary[i] % 2 == 1:
            ary[i] += 1
            count += 0.5

elif (ary[0] + ary[1] + ary[2]) % 2 == 1:
    for i in range(3):
        if ary[i] % 2 == 0:
            ary[i] += 1
            count += 0.5

while not ary[0] == ary[1] == ary[2]:
    ary.sort()
    ary[0] += 2
    count += 1

print(int(count))

Solution (Python):
a, b, c = map(int,input().split())
m = max(a,b,c)
a = abs(a-m)
b = abs(b-m)
c = abs(c-m)
cnt = 0
cnt += a//2 + b//2 + c//2
a -= a//2 * 2
b -= b//2 * 2
c -= c//2 * 2
if a + b + c == 2:
    cnt += 1
elif a + b + c == 1:
    cnt += 2

print(cnt)

Solution (Python):
ABC = list(map(int,input().split()))
ans = 0
for i in range(3):
  add = (max(ABC)-ABC[i])//2
  ans += add
  ABC[i] += add*2
ABC.sort()
if ABC[0] == ABC[2]:
  print(ans)
elif ABC[2] == ABC[1]:
  print(ans + 2)
else:
  print(ans + 1)

Solution (Python):
L = list(map(int,input().split()))
L.sort()

once = L[2]-L[1]
dif = L[2] - once - L[0]

if dif % 2 == 0:
    ans = once + dif // 2
else:
    dif += 1
    ans = 1 + once + dif // 2 

print(ans)

Solution (Python):
def main():
    A, B, C = map(int, input().split())
    A, B, C = sorted([A, B, C])
    if A == B == C:
        return 0
    elif B == C:
        if (B-A) % 2 == 0:
            return (B-A) // 2
        else:
            return (B-A+1) // 2 + 1
    elif A == B:
        return (C-B)
    else:
        if (B-A) % 2 == 0:
            return (B-A)//2 + C-B
        else:
            return (B-A+1)//2 + (C-B) + 1

if __name__ == '__main__':
    print(main())

Solution (Python):
a=sorted([int(i) for i in input().split()])
b=2*a[2]-a[1]-a[0]
if b%2==0:print(b//2)
else:print(b//2+2)

Solution (Python):
L = list(map(int, input().split()))

cnt = 0
while max(L)-min(L) > 1:
  L[L.index(min(L))] += 2
  cnt +=1
L.sort()
if L[0] == L[1] != L[2]:
  cnt += 1
elif L[0] != L[1]:
  cnt += 2
print (cnt)

Solution (Python):



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

abc_list = sorted([a, b, c])
c = 0

if (abc_list[1] - abc_list[0]) % 2 != 0:
    
    c += 1
    abc_list[1] += 1
    abc_list[2] += 1


c += (abc_list[1] - abc_list[0]) / 2
abc_list[0] += 2 * ((abc_list[1] - abc_list[0]) / 2)


c += (abc_list[2] - abc_list[1])
c = int(c)

print(c)

Solution (Python):
"""


 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())


 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  


a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654


char_list = list("abcd") 
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    a,b,c = map(int, sys.stdin.readline().split())
    
    
    
    wa = a+b+c
    m=max(a,b,c)

    if wa % 2== m %2:
        print((3*m-wa)//2)
    else:
        print((3*(m+1)-wa)//2)

Solution (Python):
A, B, C = map(int, input().split())
wa = A+B+C
maxnum = max(A, B, C)

if wa % 2 == maxnum % 2:
    print((3*maxnum-wa)//2)
else:
    print((3*(maxnum+1)-wa)//2)

Solution (Python):
nums = sorted(map(int, input().split()))
flag = 2 * nums[2] - sum(nums[:2])
ans = int(flag / 2)
print(ans if flag % 2 == 0 else ans + 2)

Solution (Python):
nums = sorted(map(int, input().split()))

flag = 2 * nums[2] - sum(nums[:2])
ans = int(nums[2] - 1/2 * sum(nums[:2]))
if  flag % 2 == 0:
    print(ans)
else:
    print(ans + 2)

Solution (Python):
A, B, C = map(int, input().split())
M = max(A, B, C)

if M % 2 == (A + B + C) % 2:
    X = M
else:
    X = M + 1

ans = (3 * X - (A + B + C)) // 2
print(ans)

Solution (Python):

A, B, C = list(map(int, input().split()))
m = max(A, B, C)
T = m * 3 if (A + B + C + m) % 2 == 0 else(m + 1) * 3  
print(str((T-A-B-C)//2))

Solution (Python):
abc = sorted(list(map(int, input().split())))

a0 = abc[2] - abc[0]
a1 = abc[2] - abc[1]

if (a0 + a1)%2 == 0:
  print((a0 + a1)//2)
else:
  print((a0 + a1 + 1)//2 + 1)

Solution (Python):
l=sorted(list(map(int,input().split())))
a=2*l[2]-l[1]-l[0]
print((a+3)//2 if a%2 else a//2)

Solution (Python):
l=list(map(int,input().split()))
l.sort()
s=2*l[2]-l[1]-l[0]
if s%2==0:
    print(s//2)
else:
    print((s+3)//2)

Solution (Python):
a = list(map(int, input().split()))
a.sort(reverse=True)
diff = a[0]*2 - a[1] - a[2]

if diff % 2 == 0:
    print(int(diff/2))
else:
    print(int((diff+3)/2))

Solution (Python):
import copy

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

max_v = max(a,b,c)


if max_v == b:
    tmp = a
    a = b
    b = tmp
elif max_v == c:
    tmp = a
    a = c
    c = tmp

tmp_b = (a-b) // 2
tmp_c = (a-c) // 2

if a - (b + 2 * tmp_b) + a - (c + 2 * tmp_c) == 2:
    ans = tmp_b + tmp_c + 1
elif a - (b + 2 * tmp_b) + a - (c + 2 * tmp_c) == 0:
    ans = tmp_b + tmp_c
else:
    ans = tmp_b + tmp_c + 2

print(ans)

Solution (Python):
As = sorted(list(map(int, input().split())))
"""
2つ選んで両方を1増やす
1つ選んで2増やす

2 5 4
2 6 3
偶奇が一致しているものを選ぶ
・全部一致している -> 差の総数を2で割る
・1つだけ異なる -> 一回、1つ選んで2増やす

"""
amari = [a%2 for a in As]

if sum(amari) == 0 or sum(amari) == 3:
    print(((As[2]-As[1])+(As[2]-As[0]))//2)

elif sum(amari) == 1:
    Bs = [a+1 if a%2==0 else a for a in As]
    print(((Bs[2]-Bs[1])+(Bs[2]-Bs[0]))//2 + 1)

elif sum(amari) == 2:
    Bs = [a+1 if a%2==1 else a for a in As]
    print(((Bs[2]-Bs[1])+(Bs[2]-Bs[0]))//2 + 1)

Solution (Python):
n=list(map(int,input().split()))
count=0
while not n[0]==n[1]==n[2]:
    if max(n)-min(n)>=2:
        n[n.index(min(n))] +=2
        count +=1
    elif max(n)-min(n)==1:
        point=[0,1,2]
        point.remove(n.index(min(n)))
        point.remove(n.index(max(n)))
        n[point[0]] +=1
        n[n.index(min(n))] +=1
        count +=1
print(count)

Solution (Python):
a = list(map(int, input().split()))
diff_a = sum(map(lambda x: max(a) - x, a))
if diff_a % 2 == 0:
    print(diff_a // 2)
else:
    print(diff_a // 2 + 2)

Solution (Python):
IN = [int(_) for _ in input().split()]
A, B, C = sorted(IN)


ans = C - B
A += C - B

if (C - A) % 2 == 1:
    ans += (C - A + 1) // 2
    ans += 1
else:
    ans += (C - A)//2
print(ans)

Solution (Python):
lst = list(map(int, input().split()))

sorted_lst = sorted(lst)

diff1 = sorted_lst[2] - sorted_lst[1]
diff2 = sorted_lst[2] - sorted_lst[0]
ans = 0
if (diff1 % 2 == 0 and diff2 % 2 == 0):
  ans = diff1 // 2 + diff2 // 2
elif (diff1 % 2 != 0 and diff2 % 2 != 0):
  ans = (diff1 - 1) // 2 + (diff2 - 1) // 2 + 1
elif (diff1 % 2 != 0 and diff2 % 2 == 0):
  ans = (diff1 - 1) // 2 + diff2 // 2 + 2
elif (diff1 % 2 == 0 and diff2 % 2 != 0):
  ans = (diff2 - 1) // 2 + diff1 // 2 + 2
print(ans)

Solution (Python):
abc=[int(i) for i in input().split()]

abc.sort()

def func(a,b,c):
    return int((c-a)/2+(c-b)/2)

if abc[0]%2==abc[1]%2:
    if abc[0]%2!=abc[2]%2:
        print(func(abc[0]+1,abc[1]+1,abc[2])+1)
    else:
        print(func(abc[0],abc[1],abc[2]))
else:
    if abc[0]%2==abc[2]%2:
        print(func(abc[0]+1,abc[1],abc[2]+1)+1)
    else:
        print(func(abc[0],abc[1]+1,abc[2]+1)+1)

Solution (Python):
A, B, C = map(int, input().split())
odd_num = 0
for e in [A, B, C]:
    if e % 2 == 1:
        odd_num += 1
        
if odd_num == 3 or odd_num == 0:
    ans = 0
    for e in [A, B, C]:
        ans += (max(A, B, C) - e) // 2
    print(ans)
else:
    ans = 1
    ABC = [A, B, C]
    if odd_num == 1:
        for i in range(3):
            if ABC[i] % 2 == 0:
                ABC[i] += 1
        for e in ABC:
            ans += (max(ABC) - e) // 2
    else:
        for i in range(3):
            if ABC[i] % 2 == 1:
                ABC[i] += 1
        for e in ABC:
            ans += (max(ABC) - e) // 2
            
    print(ans)

Solution (Python):
A,B,C=map(int,input().split())
total=abs(max(A,B,C)-A)+abs(max(A,B,C)-B)+abs(max(A,B,C)-C)

if total%2==0:
    print(total//2)
else:
    print((total+1)//2+1)

Solution (Python):
def main():
    A = list(map(int, input().split()))

    sort_A = sorted(A)

    cnt = 0

    cnt += (sort_A[2] - sort_A[0]) // 2
    sort_A[0] = sort_A[0] + ((sort_A[2] - sort_A[0]) // 2) * 2

    cnt += (sort_A[2] - sort_A[1]) // 2
    sort_A[1] = sort_A[1] + ((sort_A[2] - sort_A[1]) // 2) * 2

    sort_A.sort()
    if sort_A[0] == sort_A[1] == sort_A[2]:
        print(cnt)
    elif sort_A[1] == sort_A[2]:
        print(cnt + 2)
    elif sort_A[0] == sort_A[1]:
        print(cnt + 1)

    

main()

Solution (Python):
import heapq
ls = list(map(int, input().split()))
cnt = 0
heapq.heapify(ls)
a = heapq.heappop(ls)
b = heapq.heappop(ls)
c = heapq.heappop(ls)
cnt += (c - a) // 2
a += (c - a) // 2 * 2
cnt += (c - b) // 2
b += (c - b) // 2 * 2
if a == b == c:
    print(cnt)
else:
    if a == c or b == c:
        print(cnt + 2)
    else:
        print(cnt + 1)

Solution (Python):
import sys
import fractions
input=sys.stdin.readline

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

k = 0
while True:
    if a[0] == a[1] == a[2]:
        break
    a.sort()
    if a[1] == a[2]:
        a[0] += 2
        k += 1
    else:
        a[0] += 1
        a[1] += 1
        k += 1
print(k)

Solution (Python):
A, B, C = map(int, input().split())

if A % 2 == B % 2 == C % 2:
    N = max(A, B, C)
    ans = (N - A) // 2 + (N - B) // 2 + (N - C) // 2
    print(ans)
else:
    if A % 2 == B % 2:
        A += 1
        B += 1
    elif B % 2 == C % 2:
        B += 1
        C += 1
    else:
        C += 1
        A += 1
    N = max(A, B, C)
    ans = 1 + (N - A) // 2 + (N - B) // 2 + (N - C) // 2
    print(ans)

Solution (Python):
x,y,z = map(int,input().split())
n = sorted([x,y,z])
a = n[0]
b = n[1]
c = n[2]
count = 0
count += (c-a)//2
a += ((c-a)//2)*2
count += (c-b)//2
b += ((c-b)//2)*2
if a==b and a==c:
    print(count)
elif a!=b:
    print(count+2)
else:
    print(count+1)

Solution (Python):
import math
a=list(map(int,input().split()))
a.sort()
b=a[2]-a[0]
c=a[2]-a[1]
b-=c
if b%2!=0:
	k=1
else:
	k=0
print(c+math.ceil(b/2)+k)

Solution (Python):
def cal(a, b, c):
    z = max(a, b, c)
    return (3*z-a-b-c)//2


a, b, c = map(int, input().split())
odd_count = 0
for _ in a, b, c:
    if _ % 2 == 1:
        odd_count += 1

if odd_count in [0, 3]:
    print(cal(a, b, c))

elif odd_count == 1:
    if a % 2 == 0:
        a += 1
    if b % 2 == 0:
        b += 1
    if c % 2 == 0:
        c += 1
    print(cal(a, b, c)+1)

else:
    if a % 2 == 1:
        a += 1
    if b % 2 == 1:
        b += 1
    if c % 2 == 1:
        c += 1
    print(cal(a, b, c)+1)

Solution (Python):
import math
a=list(map(int,input().split()))
a.sort()
b=a[2]-a[0]
c=a[2]-a[1]
b-=c
if b%2!=0:
	k=1
else:
	k=0
print(c+math.ceil(b/2)+k)

Solution (Python):
a, b, c = map(int,input().split())
top = max(a,b,c)

time = (top - a)//2 + (top - b)//2 + (top - c)//2
rest = (top - a)%2 + (top - b)%2 + (top - c)%2

if rest == 1:
    time += 2
elif rest == 2:
    time += 1

print(time)

Solution (Python):
A,B,C =map(int,input().split())

res = 0
s = A+B+C
if (max(A,B,C)*3-s)%2 == 0:
    res = (max(A,B,C)*3-s)//2
else:
    res = ((max(A,B,C)+1)*3-s)//2
print(res)

Solution (Python):
a,b,c = map(int,input().split())
maxi = max([a,b,c])
sumi = sum([a,b,c])
diff = 3 * maxi - sumi
if diff % 2 == 0:
  print(diff//2)
else:
  print((diff+3)//2)