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):
t = list(map(int,input().split()))

t.sort()

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

Solution (Python):
A = list(map(int,input().split()))
A.sort()
ret = 0
ret += A[2]-A[1]
A[1] += ret
A[0] += ret
while A[0] < A[1]:
  ret += 1
  A[0] += 2
if A[0] > A[1]:
  ret += 1
print(ret)

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

Solution (Python):
A, B, C = list(map(int, input().split()))
H = [A, B, C]
S = [A%2, B%2, C%2]

def kouhan(l):
  ans = (3 * max(l) - sum(l)) //2
  return ans

if S == [0,0,0] or S == [1,1,1]:
  count = kouhan(H)
  
elif S.count(1) == 2:
  for i in range(3):
    if H[i]%2 == 1:
      H[i] += 1
  count = 1
  count += kouhan(H)
  
elif S.count(1) == 1:
  for i in range(3):
    if H[i]%2 == 0:
      H[i] += 1
  count = 1
  count += kouhan(H)


print(count)

Solution (Python):
a, b, c = sorted([int(x) for x in input().split()])
ans = c - b
a += ans
if (c - a) % 2 == 0:
    print(ans + (c - a) // 2)
else:
    print(ans + (c - a) // 2 + 2)

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

n1=abc[2]-abc[0]
n2=abc[2]-abc[1]

if (n1-n2)%2==0:
    print((n1-n2)//2+n2)
else:
    print((n1-n2+1)//2+n2+1)

Solution (Python):
A = list(map(int, input().split()))
m = max(A)
if A[0]%2==A[1]%2==A[2]%2:
  print((m-A[0])//2 + (m-A[1])//2 + (m-A[2])//2)
else:
  A.sort()
  ans = 0
  if (A[2]-A[0])%2 == (A[2]-A[1])%2:
    ans += (A[1]-A[0])//2 + A[2]-A[1]
  else:
    ans += (A[1]-A[0])//2 + A[2]-A[1] + 2
  print(ans)

Solution (Python):

a,b,c=sorted(map(int,input().split()))
x,y=b-a,c-a
print(y-x//2+(x%2))

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

Solution (Python):
C, B, A = sorted([int(i) for i in input().split()])
ans = (A-B)//2+(A-C)//2
if (A-B) & 1 and (A-C) & 1:
    ans += 1
elif (A-B) & 1 or (A-C) & 1:
    ans += 2
print(ans)

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

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

dif_a = c-a
dif_b = c-b
result = dif_b
dif_a -= dif_b
if dif_a%2==0:
    result += dif_a//2
else:
    result -= (-dif_a)//2 - 1
print(result)

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

while True:
    if (3*i-A-B-C)%2==0:
        print((3*i-A-B-C)//2)
        break
    else:
        i=i+1

Solution (Python):



from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe




def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(x):
    print(x,file=sys.stderr)
def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)

def pin(type=int):
    return map(type,input().split())


"""
"""




def resolve():
    A=sorted(list(pin()))
    B=[a%2 for a in A]
    ans=0
    odd=[]
    even=[]
    for i in range(len(B)):
        if B[i]==0:odd.append(i)
        else:even.append(i)
    if len(odd)==1:
        for x in even:
            A[x]+=1
        ans+=1
    elif len(even)==1:
        for y in odd:
            A[y]+=1
        ans+=1
    ans+=(A[2]*2-A[1]-A[0])//2
    print(ans)
    return 0
    
    

"""


"""
"""
お前カッコ閉じるの忘れてるだろ
"""
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2 5 4"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """2 6 3"""
        output = """5"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """31 41 5"""
        output = """23"""
        self.assertIO(input, output)

if __name__ == "__main__":
    resolve()

Solution (Python):
abc = list(map(int, input().split(' ')))
count = 0

while(True):
    abc = sorted(abc, reverse=True)

    if abc[0] == abc[1] == abc[2]:
        break
    elif abc[1] == abc[2]:
        abc[1] += 1
        abc[2] += 1
    else:
        abc[2] += 2
    count += 1
print(count)

Solution (Python):
arr = input("")
num = [int(n) for n in arr.split()]
num.sort()
ans = (num[2]-num[0])//2 + (num[2]-num[1])//2
num[0] = (num[2]-num[0])//2*2+num[0]
num[1] = (num[2]-num[1])//2*2+num[1]


if(num[0]==num[1] and num[0]==num[2]):
    print(ans)
elif (num[0]==num[1] and num[0]!=num[2]):
    print(ans+1)
elif(num[0] == num[2] and num[1]!=num[2]):
    print(ans+2)
elif(num[1] == num[2] and num[0]!=num[2]):
    print(ans+2)
elif(num[0] == num[1] and num[0]!=num[2]):
    print(ans+1)

Solution (Python):
X=list(map(int,input().split()))
X.sort()
A=X[-1]-X[0]
B=X[-1]-X[1]
ans=0
if (A-B)>1:
  ans=(A-B)//2
ans+=B
if (A-B)%2==1:
  ans+=2
print(ans)

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

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

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

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

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

x = L[0]-L[1]
y = L[0]-L[2]
count = 0

while x!= 0 or y != 0:
    if (x+y)%2 == 1:
        y += 1
        count += 1
    if x%2 == 0 and x>0:
        x -= 2
        count += 1
    elif y%2 == 0 and y>0:
        y -= 2
        count += 1
    elif x%2 == 1 and y%2 == 1:
        x -= 1
        y -= 1
        count += 1
    else:
        break
print(count)

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

Solution (Python):
l=list(map(int,input().split()));k=max(l)*3-sum(l);print(k//2+k%2*2)

Solution (Python):
l=list(map(int,input().split()))
k=max(l)*3-sum(l)
print(k//2+2*(k%2))

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

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

count = 0
while(True):
  if arr[1] < arr[2]:
    arr[1]+= 1
    arr[0]+=1
    count+=1
  else:
    break
    
while(True):
  if arr[0] < arr[2]:
    arr[0] +=2
    count+=1
  else:
    break
    
if arr[0] == arr[1] == arr[2]:
  print(count)
else:
  print(count+1)

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

ans=0
SA=L[0]-L[1]
ans+=SA
L[2]+=SA
L[1]+=SA

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

Solution (Python):
import collections
a,b,c = map(int,input().split())
lists = [str(a%2),str(b%2),str(c%2)]
abc = [a,b,c]
an = []
if len(set(lists)) != 1:

    d = collections.Counter(lists)
    jud = int(d.most_common()[0][0])
    for i in range(3):
        if jud == int(lists[i]):
            an.append(i)
    for i in an:
            abc[i] += 1
    cnt = 1
else:
    cnt = 0

while 1:
    Max = max(abc)
    count = 0
    for i in range(3):
        if Max == abc[i]:
            count += 1
    if count == 1:
        cnt += 1
        for i in range(3):
            if Max != abc[i]:
                abc[i] += 1

    elif count == 2:
        cnt += abs(max(abc) - min(abc)) // 2
        abc.sort()
        abc[0] += abs(max(abc) - min(abc))
    elif count == 3:
        break

print(cnt)

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

def main():
    nums = sorted(map(int, input().split()))
    plus1 = nums[2] - nums[1]
    if (nums[2] - nums[0] - plus1) % 2 == 0:
        print(int(plus1 + (nums[2] - nums[0] - plus1) / 2))
    else:
        print(int(plus1 + ((nums[2] - nums[0] - plus1) + 1) / 2 + 1))

if __name__ == '__main__':
    main()

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

L = [A, B, C]
L.sort(reverse = True)

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

print(ans)

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

odds = list(filter(lambda x: x % 2 == 1, abc))
ans = 0
if len(odds) == 1:
    for i in range(len(abc)):
        if abc[i] % 2 == 0:
            abc[i] += 1
    ans = 1
elif len(odds) == 2:
    for i in range(len(abc)):
        if abc[i] % 2 == 1:
            abc[i] += 1
    ans = 1

abc.sort()
print((abc[2] * 2 - abc[0] - abc[1]) // 2 + ans)

Solution (Python):
import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A = [int(x) for x in readline().split()]
s = max(A) * 3 - sum(A)
print(s // 2 if s % 2 == 0 else (s + 3) // 2)

Solution (Python):
x = list(map(int, input().split()))
x.sort()
a, b, c = x
ans = 0
if (c - a) % 2 == (c - b) % 2:
    print((2 * c - a - b)//2)
else:
    print((2 * c + 1 - a - b)//2 + 1)

Solution (Python):
a, b, c = map(int, input().split())
abc = sorted([a, b, c])
even = 0
for i in abc:
    if i % 2 == 0:
        even += 1
ans = 0
if even == 0 or even == 3:
    ans = (abc[2] - abc[0]) // 2 + (abc[2] - abc[1]) // 2
elif even == 1:
    abc = [i + 1 if i % 2 == 1 else i for i in abc]
    ans = (abc[2] - abc[0]) // 2 + (abc[2] - abc[1]) // 2 + 1
else:
    abc = [i + 1 if i % 2 == 0 else i for i in abc]
    ans = (abc[2] - abc[0]) // 2 + (abc[2] - abc[1]) // 2 + 1

print(ans)

Solution (Python):



def plus1(num_list :list) ->(list,int):
    num_list.sort()
    count = 0
    
    diff_1 = num_list[2] - num_list[1]
    count += diff_1
    num_list[0]+= diff_1
    num_list[1]+= diff_1
    
    return num_list,count


num_list = list(map(int, input().rstrip().split()))


num_list,count = plus1(num_list)


num_2times = (num_list[1] - num_list[0]) // 2
num_list[0] += num_2times *2
count += num_2times


if (num_list[1] - num_list[0]) % 2 != 0:
    num_list[0] += 2
    count += 1
    
    num_list,c = plus1(num_list)
    count += c
    
print(count)

Solution (Python):
a,b,c=map(int,input().split())
x=[a,b,c]
cnt=0
if a%2==0 and b%2==0 and c%2==1:
    a+=1
    b+=1
    cnt+=1
elif a%2==0 and b%2==1 and c%2==0:
    a+=1
    c+=1
    cnt+=1
elif a%2==1 and b%2==0 and c%2==0:
    b+=1
    c+=1
    cnt+=1
elif a%2==1 and b%2==0 and c%2==1:
    a+=1
    c+=1
    cnt+=1
elif a%2==1 and b%2==1 and c%2==0:
    a+=1
    b+=1
    cnt+=1
elif a%2==0 and b%2==1 and c%2==1:
    b+=1
    c+=1
    cnt+=1
x=[a,b,c]
print(cnt+(3*max(x)-sum(x))//2)

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

cnt = 0
while a <= b-2:
    a += 2
    cnt += 1

while a <= c-1 or b <= c-1:
    a += 1
    b += 1
    cnt += 1

if a == b == c:
    print(cnt)
else:
    print(cnt + 1)

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

Solution (Python):


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

if (a[1] -a[0])%2 == 0:
    print((a[-1]*3-sum(a))//2)
else:
    print((a[-1]*3+3-sum(a))//2)
"""
x = a[-1]-a[1]
y = a[1] -a[0]
def dist(n):
    if n % 2 == 0: return n//2
    else: return n//2+2
print(min(2*x+y,dist(y)+x,dist(x+y)+dist(x)))"""

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

ans = 0
while s % 3 != 0 or s < max(a) * 3:
  s += 2
  ans += 1
print(ans)

Solution (Python):
abc = sorted(list(map(int,input().split())))
x = abc[0]
y = abc[1]
z = abc[2]
cnt = (z-x)//2 + (z-y)//2
if z == 2*((z-x)//2)+x and z == 2*((z-y)//2)+y:
    print(cnt)
elif z > 2*((z-x)//2)+x and z > 2*((z-y)//2)+y:
    print(cnt + 1)
else:
    print(cnt + 2)

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

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

Solution (Python):
A, B, C = map(int, input().split())
num = []
num.append(A)
num.append(B)
num.append(C)
answer = 0

if (num[0] % 2 == 0 and num[1] % 2 == 0 and num[2] % 2 == 0) or (num[0] % 2 != 0 and num[1] % 2 != 0 and num[2] % 2 != 0):
    pass
elif (num[0] % 2 == 0 and num[1] % 2 == 0) or (num[0] % 2 != 0 and num[1] % 2 != 0):
    num[0] += 1
    num[1] += 1
    answer += 1
elif (num[2] % 2 == 0 and num[1] % 2 == 0) or (num[2] % 2 != 0 and num[1] % 2 != 0):
    num[2] += 1
    num[1] += 1
    answer += 1
elif (num[0] % 2 == 0 and num[2] % 2 == 0) or (num[0] % 2 != 0 and num[2] % 2 != 0):
    num[0] += 1
    num[2] += 1
    answer += 1

num.sort()

answer += (num[2] - num[0]) // 2
answer += (num[2] - num[1]) // 2

print(answer)

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

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

target=A[-1]
if sum(A)%2!=A[-1]%2:
    target+=1
    
print((target*3-sum(A))//2)

Solution (Python):
A,B,C = list(map(int,input().split()))
a1 = A+B+C
a2 = 3*max(A,B,C)

if a1%2==a2%2:
  print((a2-a1)//2)
else:
  print((a2-a1+3)//2)

Solution (Python):

import math
import heapq
import bisect
import numpy as np
from collections import Counter


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

ans = (A[2]-A[1]) + (A[1]-A[0])//2 + ((A[1]-A[0])%2)*2
print(ans)

Solution (Python):
a=list(map(int,input().split()))
a=sorted(a)
maxim=a[-1]
for i in range(3):
    a[i]=a[-1]-a[i]

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

Solution (Python):
def main():
    numbers = list(map(int, input().split(" ")))
    numbers.sort()
    diff = 3 * numbers[2] - sum(numbers)
    if diff % 2:
        answer = (diff + 3) // 2
    else:
        answer = diff // 2
    print(answer)


if __name__ == '__main__':
    main()

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

count = 0
while(True):
    if arr[1] < arr[2]:
        arr[1] += 1
        arr[0] += 1
        count += 1
    else:
        break

while(True):
    if arr[0] < arr[2]:
        arr[0] += 2
        count += 1
    else:
        break

if arr[0] == arr[1] == arr[2]:
    print(count)
else:
    print(count+1)

Solution (Python):
l = list(map(int, input().split()))
l.sort()
C = l.pop()
if sum(l) % 2 == 0:
  print(C - sum(l)//2)
else:
  print(C - (sum(l) - 3)//2)

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

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

diff = (ABC[2] - ABC[1]) + (ABC[2] - ABC[0])

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

print(ans)

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

A,B,C = list_[0],list_[1],list_[2]

ans = 0
while A < B:
  A += 2
  ans += 1
if B < A:
  B += 1
  C += 1
  ans += 1
while B < C:
  B += 1
  ans += 1
  
print(ans)

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

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

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

Solution (Python):
a,b,c=map(int,input().split())
aa,bb,cc=a%2,b%2,c%2
def check(a,b,c):
    max_=max(a,b,c)
    ans=((max_-a)//2)+((max_-b)//2)+((max_-c)//2)
    return ans
if aa==bb==cc:
    print(check(a,b,c))
else:
    if aa==bb and aa!=cc:
        print(check(a+1,b+1,c)+1)
    elif cc==bb and aa!=cc:
        print(check(a,b+1,c+1)+1)
    else:
        print(check(a+1,b,c+1)+1)

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

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

x = 0

while A[0] < A[2] - 1:
    A[0] += 2
    x += 1

while A[1] < A[2] - 1:
    A[1] += 2
    x += 1

if A[0] == A[1] == A[2]:
    x = x

elif A[0] == A[1]:
    x = x + 1

else:
    x = x + 2

print(x)

Solution (Python):
a, b, c = map(int, input().split())
minimum = min(a, b, c)
maximum = max(a, b, c)
middle = sum((a, b, c)) - (minimum + maximum)
ans = 0
tmp = minimum

while tmp <= (middle - 2):
    tmp += 2
    ans += 1

if tmp == middle:
    ans += (maximum - tmp)
else:
    maximum += 1
    ans += (maximum - tmp)
print(ans)

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

lmax = max(A,B,C)
l.remove(lmax)
lmin = min(l)
l.remove(lmin)
lmid = l[0]
ans = 0

if lmax==lmid and lmid == lmin:
    print(0)
    exit()

if lmax==lmid:
    if (lmid-lmin)%2==0:
        ans += (lmid-lmin)//2
        print(ans)
        exit()
    else:
        ans += (lmid-1-lmin)//2
        ans += 2
        print(ans)
        exit()

if lmid == lmin:
    ans += lmax - lmid
    print(ans)
    exit()

if (lmid-lmin)%2 == 0:
    ans += (lmid-lmin)//2
    ans += lmax - lmid
else:
    ans += (lmid-1-lmin)//2
    ans += (lmax-lmid)
    ans += 2
print(ans)

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

delta = abs(ABC[2]-ABC[0])+abs(ABC[2]-ABC[1])

if delta % 2:
    print((delta+1)//2+1)
else:
    print(delta//2)

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

print(int(ans))

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

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

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

Solution (Python):
abc = list(map(int, input().split()))
abc.sort()
abc_min,abc_middle,abc_max = abc
step1 = abc_max - abc_middle
abc_min += step1
step2 = (abc_max - abc_min)//2
step3 = (abc_max - abc_min)%2 * 2
print(step1+step2+step3)

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


cnt = 0

while val[1] < val[2]:
    val[1] += 1
    val[0] += 1
    cnt += 1
while val[0] < val[2]:
    val[0] += 2
    cnt += 1
if val[0] > val[2]:
    val[1] += 1
    val[2] += 1
    cnt += 1
print(cnt)

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

A, B, C = sorted(ABC)

answer = 0
if (A - B) % 2:
  A += 1
  C += 1
  answer += 1  
answer += (B - A) // 2
answer += C - B

print(answer)

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

A, B, C = ABC

answer = 0
if (A - B) % 2:
  A += 1
  C += 1
  answer += 1  
answer += (B - A) // 2
answer += C - B

print(answer)

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

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

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

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

num0 = [A, B, C]
max_num = max([A, B, C])

diff = [max_num - A, max_num - B, max_num - C]

while True:
    
    
    res = 0
    for i in range(3):
        if diff[i] != 0:
            mod = diff[i] % 2
            div = int(diff[i] / 2)
            res += div
            res += mod / 2
            num0[i] += (2 * div + mod)
    
    integer = int(res)

    if res - integer == 0 and num0[0] == num0[1] and num0[1] == num0[2]:
        break

    max_num += 1
    diff = [max_num - A, max_num - B, max_num - C]
    num0 = [A, B, C]

print(int(res))

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


num0 = [A, B, C]
max_num = max([A, B, C])
res = 0

diff = [max_num - A, max_num - B, max_num - C]

while True:
    div_c = 0
    mod_c = 0
    for i in range(3):
        if diff[i] != 0:
            mod = diff[i] % 2
            div = int(diff[i] / 2)
            div_c += div
            mod_c += mod / 2
            num0[i] += (2 * div + mod)
    res = div_c + mod_c
    integer = int(res)

    if res - integer == 0 and num0[0] == num0[1] and num0[1] == num0[2]:
        break

    max_num += 1
    diff = [max_num - A, max_num - B, max_num - C]
    num0 = [A, B, C]

print(int(res))

Solution (Python):
a,b,c=sorted(list(map(int,input().split())))
p,q=(c-a)//2,(c-b)//2
r=p+q
a,b=a+2*p,b+2*q
if a==c and b==c:
  print(r)
elif a==c or b==c:
  print(r+2)
else:
  print(r+1)

Solution (Python):
def main():
    A, B, C = sorted(map(int, input().split()))
    print((2 * C - A - B) // 2 + 2 if (2 * C - A - B) % 2 else
          (2 * C - A - B) // 2)
    return


main()

Solution (Python):
n = sorted((map(int,input().split())))
M = max(n)
print((3*M-sum(n))//2 if sum(n)%2==M*3%2 else (3*(M+1)-sum(n))//2)

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

odd_even = [0]*3
change_cnt = 0

for i in range(3):
    if A[i] % 2 == 0:
        odd_even[i] = 0
    else:
        odd_even[i] = 1
    
if sum(odd_even) == 1:
    change_cnt +=1
    for i in range(3):
        if odd_even[i] == 0:
            A[i] += 1
elif sum(odd_even) == 2:
    change_cnt += 1
    for i in range(3):
        if odd_even[i] == 1:
            A[i] += 1

max_val = max(A)
max_idx = A.index(max_val)

for i in range(3):
    while A[i] != max_val:
        change_cnt += 1
        A[i] += 2

print(change_cnt)

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

Solution (Python):
def solve(a, b, c):
    
    
    
    
    l = sorted((a, b, c))
    d1, d2 = l[2] - l[0], l[2] - l[1]
    return d2 + (d1 - d2 + 1) // 2 + (0 if (d1 - d2) % 2 == 0 else 1)

_a, _b, _c = list(map(int, input().split()))
print(solve(_a, _b, _c))

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

y = (x-a) + (x-b) + (x-c)

if y&1:
    
    y += 3
ans = y//2
print(ans)

Solution (Python):

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

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

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    a = [int(x) for x in input().split()]
    a.sort()

    ans = -(-(a[1] - a[0]) // 2)
    ans += a[2] - a[1]
    if (a[1] - a[0]) & 1:
        ans += 1

    print(ans)


    
    

if __name__ == '__main__':
    main()

Solution (Python):
X = sorted(list(map(int, input().split())))
d1 = X[2]-X[0]
d2 = X[2]-X[1]

ans = d1//2 + d2//2
k = (d1&1) + (d2&1)
if k==2:
    ans += 1
elif k==1:
    ans += 2
print(ans)

Solution (Python):
A,B,C=sorted(map(int,input().split()));print(C-B+(B-A+1)//2+((A&1)^(B&1)))

Solution (Python):
A,B,C = map(int,input().split())
Top = max(A,B,C)
Bottom = min(A,B,C)
Middle = A+B+C - Top - Bottom
if (Middle - Bottom)%2 != 0:
  Top += 1
  Bottom += 1
  Answer = (Top -Middle) + (Middle - Bottom)//2 +1
else:
  Answer = (Top - Middle) + (Middle - Bottom)//2
print(Answer)

Solution (Python):
a = list(map(int,input().split()))
a.sort()
k=0
r1=(a[2]-a[0])//2
r2=(a[2]-a[1])//2
k += r1+r2
a[0] += r1 * 2
a[1] += r2 * 2
if a[0]==a[1] and a[0]<a[2]:
  print(k+1)
elif a[0]<a[1] and a[1]==a[2]:
  print(k+2)
elif a[0]==a[2] and a[0]>a[1]:
  print(k+2)
else:
  print(k)

Solution (Python):
A,B,C = map(int,input().split())
L = sorted([A,B,C])
a,b = L[2]-L[0],L[2]-L[1]
ans = 0
if a%2 == b%2:
    ans = (a+b)//2
else:
    ans = (a+b+3)//2
print(ans)

Solution (Python):

x, y, z = sorted([int(i) for i in input().split()])[::-1]

cnt = 0
if (y % 2 == 0 and z % 2 == 0) or (y % 2 != 0 and z % 2 != 0):
    
    
    cnt += (y - z) // 2
else:
    
    x += 1
    y += 1
    
    cnt += 1 + (y - z) // 2

print(cnt + (x - y))

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

s=a[2]*2-a[0]-a[1]
if s&1:
  print((s+3)//2)
else:
  print(s//2)

Solution (Python):
import math

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

if ((max([A, B, C]) * 3) - (A + B + C)) % 2 == 0:
  ans = ((max([A, B, C]) * 3) - (A + B + C)) / 2
else:
  X = max([A, B, C]) + 1
  ans = (X * 3 - (A + B + C)) / 2

print(math.floor(ans))

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

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

Solution (Python):
a = sorted(map(int, input().split()))
ans = 0
diff = a[1] - a[0]
if diff > 0:
    ans += diff // 2
    a[0] += diff // 2 * 2

diff = a[2] - a[1]
if diff > 0:
    ans += diff
    a[1] += diff
    a[0] += diff
if a[0]+1 == a[1] and a[1]+1 == a[2]:
    print(ans+3)
elif a[0]+1 == a[1] and a[1] == a[2]:
    print(ans+2)
elif a[0] == a[1] and a[1]+1 == a[2]:
    print(ans+1)
else:
    print(ans)

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

A.sort()
ans = 0
while True:
  if A[0]==A[1] and A[0] == A[2]:
    break
  if A[0]==A[1]: 
    A[0] += 1
    A[1] += 1
  else:
    A[0] += 2
  A.sort()
  ans += 1

print(ans)

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


odds = 0
even = 0
for a in A:
  if a%2 == 0:
    even += 1
  else:
    odds += 1

ans = 0

if even == 2: 
  ans += 1
  for i in range(3):
    if A[i]%2==0:
      A[i] += 1
      
elif odds == 2:
  ans += 1
  for i in range(3):
    if A[i]%2==1:
      A[i] += 1
      


ma = max(A)
for i in range(3):
  ans += (ma-A[i])//2
print(ans)

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

ret = 0
while True:
    if A == B and B == C:
        print(ret)
        exit()

    ret += 1
    A, B, C = sorted([A, B, C])
    if B < C:
        A += 1
        B += 1
    elif B == C:
        A += 2

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

def search(a,b,c):
    lst = [0,0,0]
    if a%2 == b%2:
        lst = [1,1,0]
        if a%2==c%2:
            lst = [1,1,1]
    elif a%2 == c%2:
        lst = [1,0,1]
    else:
        lst = [0,1,1]
    return lst


def make(a,b,c):
    lst = [a,b,c]
    lst.sort()
    lst[0] += 2
    return lst[0],lst[1],lst[2]

if __name__ == "__main__":
    ans = 0
    l = search(a,b,c)
    if sum(l) == 3:
        pass
    else:
        ans += 1
        a += l[0]
        b += l[1]
        c += l[2]
    while a != b or a != c:
        a,b,c = make(a,b,c)
        ans += 1
    print(ans)

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

memo1 = abc[2]-abc[0]
memo2 = abc[2]-abc[1]

if memo1%2 == memo2%2:
    print((memo1+memo2)//2)
else:
    print(((memo1+memo2)//2)+2)

Solution (Python):
from collections import defaultdict

ABC = sorted(map(int, input().split()))

count = 0
D = defaultdict(list)
for i, x in enumerate(ABC):
    D[x % 2].append(i)
for l in D.values():
    if len(l) == 2:
        count += 1
        for i in l:
            ABC[i] += 1
count += (ABC[2] - ABC[0]) // 2 + (ABC[2] - ABC[1]) // 2
print(count)

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

ret = 0

if not (A%2 == B%2 and B%2 == C%2):
    
    ret += 1
    if A%2 == B%2:
        A += 1
        B += 1
    elif B%2 == C%2:
        B += 1
        C += 1
    else:
        A += 1
        C += 1

max_elem = max(A,B,C)

ret += (max_elem-A)//2 + (max_elem-B)//2 + (max_elem-C)//2

print(ret)

Solution (Python):
number = sorted([int(i) for i in input().split()])
cnt = number[2]-number[1]
number[0] += cnt

while number[0] < number[2]:
    number[0] += 2
    cnt += 1
print(cnt if number[0]==number[2] else cnt+1)

Solution (Python):
abc = sorted(list(map(int, input().split())), reverse=True)
ans = 0

if abc[1]%2 != 0 and abc[2]%2 == 0:
    ans += 1
    abc[0] += 1
    abc[1] += 1

elif abc[1]%2 == 0 and abc[2]%2 != 0:
    ans += 1
    abc[0] += 1
    abc[2] += 1

ans += abc[0] - abc[1]
ans += (abc[1] - abc[2])//2

print(ans)

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

ans = 3 * max(a, b, c) - (a + b + c)

if ans % 2 == 0:
    print(int(ans / 2))
elif ans % 2 == 1:
    print(int((ans + 3) / 2))

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

X = A[0] - A[1]
Y = A[0] - A[2]
ans = 0

if (X % 2 == 0) and (Y % 2 == 0):
    ans = X//2 + Y//2
elif (X % 2 == 1) and (Y % 2 == 1):
    ans = X//2 + Y//2 + 1
else:
    ans = X//2 + Y//2 + 2

print(ans)

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

M = max(X)

if 3*M %2 == sum(X)%2:
    N = (3*M-sum(X))/2

else:
    N = (3*(M+1)-sum(X))/2

print(int(N))