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):
ABC = list(map(int, input().split()))
cnt = 0
while len(set(ABC))!=1:
    A = sorted(ABC)[0]
    B = sorted(ABC)[1]
    C = sorted(ABC)[2]
    if ABC[0]%2==ABC[1]%2==ABC[2]%2:
        A += 2
        cnt += 1
    else:
        A += 1
        B += 1
        cnt += 1
    ABC = A,B,C
print(cnt)

Solution (Python):
'''
Created on 2020/08/17

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  A=list(map(int,pin().split()))
  A.sort()
  t=A[2]
  ans=0
  if A[0]%2!=A[1]%2:
    ans+=1
    A[1]+=1
    A[2]+=1
  ans+=A[2]-A[1]+(A[1]-A[0])//2
  print(ans)
  return 

main()

Solution (Python):




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)


def resolve():
    I = list(map(int, input().split()))
    I.sort()

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


if __name__ == "__main__":
    
    resolve()

Solution (Python):
def resolve():
    A, B, C = map(int, input().split())
    D = max(max(A, B), C)
    ans = (D * 3 - A - B - C)
    print(ans//2 if ans %2 == 0 else (ans+3)//2)
resolve()

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

res1 = a+b+c
res2 = max(a, b, c)*3
if (res2-res1)%2==0:
  print((res2-res1)//2)
else:
  res3 = (max(a, b, c)+1)*3
  print((res3-res1)//2)

Solution (Python):
def solve():

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

    X = sorted(X, reverse=True)

    X_max = max(X) 
    n = 0

    while X[0] > X[1]:
        X[1] += 1
        n += 1
    while X[0] > X[2]:
        X[2] += 1
        n += 1
    if n%2 == 1:
        n += 3

    ans =int(n / 2)

   
    print(ans)
    
    

if __name__ == "__main__":
    solve()

Solution (Python):
def main():
    A, B, C = map(int, input().split())
    max_num = max(A, B, C)
    t = 3 * max_num - A - B - C
    ans = 0

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

    print(ans)


if __name__ == "__main__":
    main()

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

    cnt = 0
    while True:
        if abs(abc[2] - abc[0]) <= 1 and abs(abc[2] - abc[0]) <= 1:
            break
        abc[0] += 2
        abc = sorted(abc)
        cnt += 1
    ans = cnt
    if abc[0] == abc[1] and abc[1] == abc[2]:
        ans = cnt
    elif abc[2] == abc[1]:
        ans += 2
    elif abc[0] == abc[1]:
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
a = list(map(int,input().split()))
b = []
tmp = max(a)
for i in range(3):
    b.append(tmp-a[i])
if sum(b)%2==0:
    print(sum(b)//2)
else:
    print(sum(b)//2+2)

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

ans = 0

while C - A >= 2:
    A += 2
    ans += 1

while C - B >= 2:
    B += 2
    ans += 1


if A == B == C:
    print(ans)
elif C - A == 1 and C - B == 1:
    ans += 1
    print(ans)
else:
    ans += 2
    print(ans)

Solution (Python):
A = list(map(int, input().split()))
A.sort()
g=0
k=0
cnt=0
for i in A:
    if i%2==0:
        g+=1
if g==0 or g==3:
    cnt=(2*A[2]-A[0]-A[1])/2
elif g==1:
    for i in range(3):
        if A[i]%2==1:
            A[i]+=1
    cnt=(2*A[2]-A[0]-A[1])/2+1
elif g==2:
    for i in range(3):
        if A[i]%2==0:
            A[i]+=1
    cnt=(2*A[2]-A[0]-A[1])/2+1
    
print(int(cnt))

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

cnt = 0
if a%2 != b%2:
    c += 1
    a += 1
    cnt += 1

while True:
    if a == c or b == c:
        break
    a += 1
    b += 1
    cnt += 1
if a == c:
    print(cnt)
else:
    print(cnt+(c-a)//2)

Solution (Python):
X = list(map(lambda x: int(x), input().split(" ")))
X.sort()

print(X[2] - X[1] + int((X[1] - X[0]) / 2) + 2 * ((X[1] - X[0]) % 2))

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

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

m = max(a, b, c)
s = sum([a, b, c])
if (3 * m - s) % 2 == 0:
    print((3 * m - s) // 2)
else:
    print((3 * m + 3 - s) // 2)

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

else:
    if c%2==1:
        print((c*3+3-sum([a,b,c]))//2);exit()
    else:
        print((c*3-sum([a,b,c]))//2)
        exit()

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

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

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

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

    ans= 0
    even = []
    odd = []
    for i in [a, b, c]:
        if i % 2== 0:
            even.append(i)
        else:
            odd.append(i)
    if len(even) == 1:
        ans += 1 
        odd[0] += 1
        odd[1] += 1
        m = max(max(even), odd[0]+1)
        even.extend(odd)
        for i in even:
            ans += (m-i)//2
    elif len(even) == 2:
        ans += 1 
        even[0] += 1
        even[1] += 1
        m = max(max(even),odd[0])
        even.extend(odd)
        for i in even:
            ans += (m-i)//2
    elif len(even) == 3 or len(odd) == 3:
        m = max(max(even, odd))
        for i in max(even, odd):
            ans += (m-i)//2
    print(ans)
resolve()

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

Solution (Python):
A = list(map(int, input().split()))
A.sort()
ans = 0
tmp = A[2] - A[1]
ans += tmp
A[0] += tmp

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

print(int(ans))

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

ans = 0
ans += abc[2]-abc[1]
abc[0] += abc[2]-abc[1]
abc[1] += abc[2]-abc[1]

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

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

Solution (Python):
ABC= list(map(int, input().split()))
M = max(ABC)
ans = 0
for i in range(3):
    ABC[i] = M - ABC[i]
    ans += ABC[i] // 2
    ABC[i] = ABC[i] % 2

if sum(ABC) == 2:
    ans += 1
elif sum(ABC) == 1:
    ans += 2
else:
    ans += 0
print(ans)

Solution (Python):
a, b, c = sorted(map(int, input().split()))
x = b - a
cnt = c - b + x // 2
print((cnt + 2, cnt)[x % 2 == 0])

Solution (Python):
def main():
    a = list(map(int, input().split()))
    a.sort()
    A, B, C = a[0], a[1], a[2]
    ans = 0
    ans += C-B
    A = A + ans
    B = B + ans
    ans += (B-A) // 2
    A += ((B-A) // 2) * 2
    if A != B:
        ans += 2
    print(ans)
main()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A = list(map(int, readline().split()))

    Asum = sum(A)
    Amax = max(A)

    if Asum % 2 == 3 * Amax % 2:
        ans = (3 * Amax - Asum) // 2
    else:
        ans = (3 * (Amax + 1) - Asum) // 2

    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A = list(map(int, readline().split()))

    A.sort()

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

    if A[0] == A[1]:
        if A[0] < A[2]:
            ans += 1
    else:
        ans += 2

    print(ans)
    return


if __name__ == '__main__':
    main()

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

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

Solution (Python):
A, B, C = sorted(list(map(int, input().split())))
r = C-B
B += r
A += r
s = C-A
if s % 2 == 0:
    s = s//2
else:
    s = (s//2) + 2
print(r+s)

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

A.sort()

t1 = A[2] - A[1]
t2 = A[1] - A[0]

if t2 % 2 == 0:
    print(t1 + t2 // 2)

else:
    print(t1 + t2 // 2 + 2)

Solution (Python):
A,B,C = map(int,input().split())
ans = 0
Aj = 0
Bj = 0
Cj = 0
if(A % 2 == 1):
  Aj = 1
if(B % 2 == 1):
  Bj = 1
if(C % 2 == 1):
  Cj = 1
if(Aj == Bj and Bj == Cj):
  pass
else:
  if(Aj == Bj):
    A += 1
    B += 1
    ans += 1
  if(Bj == Cj):
    B += 1
    C += 1
    ans += 1
  if(Aj == Cj):
    A += 1
    C += 1
    ans += 1
mokuhyo = max(A,B,C)
while(A != mokuhyo):
  A += 2
  ans += 1
while(B != mokuhyo):
  B += 2
  ans += 1
while(C != mokuhyo):
  C += 2
  ans += 1
print(str(ans))

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

a,b,c = sorted(lis)

bc = c-b
ab = b-a

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

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

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

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

Solution (Python):
a,b,c=map(int,input().split())
a,b,c=sorted([a,b,c])
d1,d2 = c-a,c-b

if d1==d2:print(d1)
elif (d1-d2)%2==1:print(d2+(d1-d2+1)//2+1)
else:print(d2+(d1-d2)//2)

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

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

a = abs(l[0]-l[1])%2
b = abs(l[1]-l[2])%2
c = abs(l[0]-l[2])%2

if a==0:
    if b==0:
        ans = (l[2]-l[0] + l[2]-l[1]) /2
    else:
        ans = 1 + (l[2]-(l[0]+1) + l[2]-(l[1]+1))/2
else:
    if b==0:
        ans = 1 + ((l[2]+1)-l[0] + (l[2]+1)-(l[1]+1))/2
    else:
        ans = 1 + ((l[2]+1)-(l[0]+1) + (l[2]+1)-l[1])/2
print(int(ans))

Solution (Python):
def f(abc,c):
    m = max(abc)
    a = 0
    for i in abc:
        a += (i < m)
    if a == 0:
        return c
    c += 1
    if a <= 1:
        for i,x in enumerate(abc):
            if x < m:
                abc[i] += 2
                break
        return f(abc,c)
    else:
        for i,x in enumerate(abc):
            if x < m:
                abc[i] += 1
        return f(abc,c)


abc = list(map(int, input().split()))
print(f(abc,0))

Solution (Python):
l = sorted(list(map(int,input().split())))
x = abs(l[2]-l[0])
y = abs(l[2]-l[1])

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):
abc=sorted(list(map(int,input().split())))
abc[1]-=abc[0]
abc[2]-=abc[0]
abc[0]=0

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

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

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

Solution (Python):
import sys
import itertools

import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



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

ans = 0
if C % 2 == 0:
    if A % 2 == 0 and B % 2 == 1:
        ans += 1
        A += 1
        C += 1
    elif A % 2 == 1 and B % 2 == 0:
        ans += 1
        B += 1
        C += 1
    elif A % 2 == 1 and B % 2 == 1:
        ans += 1
        A += 1
        B += 1
else:
    if A % 2 == 0 and B % 2 == 1:
        ans += 1
        B += 1
        C += 1
    elif A % 2 == 1 and B % 2 == 0:
        ans += 1
        A += 1
        C += 1
    elif A % 2 == 0 and B % 2 == 0:
        ans += 1
        A += 1
        B += 1

while C > A:
    A += 2
    ans += 1

while C > B:
    B += 2
    ans += 1

print(ans)

Solution (Python):
A,B,C=map(int,input().split())
odd = A%2+B%2+C%2
answer = 0
if odd == 1:
  answer = 1
  if not A%2:
    A += 1
  if not B%2:
    B += 1
  if not C%2:
    C += 1
elif odd == 2:
  answer = 1
  if A%2:
    A += 1
  if B%2:
    B += 1
  if C%2:
    C += 1
D = sorted([A,B,C])
answer += (D[2]-D[0])//2+(D[2]-D[1])//2
print(answer)

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

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

b1=a[2]-a[0]
b2=a[2]-a[1]

if b1%2==0 and b2%2==0:
    print(b1//2+b2//2)
elif b1%2==1 and b2%2==1:
    print(b1//2+b2//2+1)
else:
    print(b1//2+b2//2+2)

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

if all([i % 2 == 0 for i in A]) or all([i % 2 == 1 for i in A]):
    print((A[0] - A[1] + A[0] - A[2]) // 2)
else:
    if [i % 2 == 0 for i in A].count(True) == 2:
        for i in range(3):
            if A[i] % 2 == 0:
                A[i] += 1
        print((A[0] - A[1] + A[0] - A[2]) // 2 + 1)
    else:
        for i in range(3):
            if A[i] % 2 == 1:
                A[i] += 1
        print((A[0] - A[1] + A[0] - A[2]) // 2 + 1)

Solution (Python):
A,B,C = sorted(map(int,input().split()))
D = 2*C-A-B

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

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

max_num = max(a,b,c)

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

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

Solution (Python):
a, b, c = map(int, input().split())
ans = 0
lst = sorted([a, b, c])
while not lst[0]==lst[1]==lst[2]:
    ans += 1
    if lst[0] == lst[1]:
        lst[0] += 1
        lst[1] += 1
    elif lst[1] == lst[2]:
        if lst[2]-lst[0] >= 2:
            lst[0] += 2
        else:
            lst[1] += 1
            lst[2] += 1
    else:
        lst[0] += 2
        lst.sort()

print(ans)

Solution (Python):
li = list(map(int,input().split()))
su = sum(li)
ma = max(li)

if su%2 == ma%2:print(int((ma*2-(su-ma))/2))
else:print(int(((ma+1)*2-(su-ma)+1)/2))

Solution (Python):


def is_eaven(n):
    if n%2==0:
        return 1
    else:
        return 0

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


ans=0

tempL=[]

if L[0]==L[1]==L[2]:
    print(ans)
    exit()

for l in L:
    tempL.append(is_eaven(l))
if all (tempL) or not any(tempL):   
    pass
elif tempL.count(0)==2:
    for i in range (2):
        if tempL[i]==0:
            L[i]+=1
    ans+=1
elif tempL.count(1)==2:
    for i in range (2):
        if tempL[i]==1:
            L[i]+=1
    ans+=1
else:
    pass

if L[0]==L[1]==L[2]:
    print(ans)
    exit()

L.sort()

ans+=(L[2]-L[0])//2

if L[0]==L[1]==L[2]:
    print(ans)
    exit()

ans+=(L[2]-L[1])//2
print(ans)

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

porpose = max(A)
if (3*porpose-sum(A))%2 == 1:
    porpose+=1

print((3*porpose-sum(A))//2)

Solution (Python):
a,b,c=map(int,input().split())
x=sorted([a,b,c])
count=0
if sum(x)%2==x[2]%2:
    while True:
        if x[1]==x[2] and x[0]==x[2]:
            break
        elif x[1]==x[2] and x[0]!=x[2]:
            x[0]+=2
        else:
            x[1]+=1
            x[0]+=1
        count+=1

else:
    x[2]+=1
    x[0]+=1
    count+=1
    while True:
        if x[1]==x[2] and x[0]==x[2]:
                break
        elif x[1]==x[2] and x[0]!=x[2]:
            x[0]+=2
        else:
            x[1]+=1
            x[0]+=1
        count+=1
print(count)

Solution (Python):
from collections import Counter
abc = list(map(int, input().split()))

ans = 0
m = max(abc)
for i in range(len(abc)):
    count = (m-abc[i])//2
    ans += count
    abc[i] = abc[i]+2*count

abc = Counter(abc)

if len(abc)==1:
    print(ans)
else:
    key = [k for k, v in abc.items() if v == 2][0]
    if key == m:
        print(ans+2)
    else:
        print(ans+1)

Solution (Python):

a, b, c = map(int, input().split())
m = max(a, b, c)
s = a + b + c
diff = 3 * m - s

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

print(ans)

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

Solution (Python):
a=list(map(int,input().split()))
b=0
if a[0]==a[1]==a[2]:
  f=False
else:
  f=True
  
while f:
  if max(a)-min(a)>1:
    a.sort()
    a[0]+=2
    b+=1
  else:
    a.sort()
    a[0]+=1
    a[1]+=1
    b+=1
  if a[0]==a[1]==a[2]:
    f=False

print(b)

Solution (Python):
arr = list(int(a) for a in input().split())





arr.sort()
A = 0
B = arr[1] - arr[0]
C = arr[2] - arr[0]


ans = B // 2


B -= ans * 2
C -= ans * 2
ans += B + C

print(ans)

Solution (Python):
A,B,C = map(int,input().split())
ans = 0
if A%2 == B%2 == C%2:
    ans -= 1
elif A%2 == B%2:
    A += 1
    B += 1
elif B%2 == C%2:
    B += 1
    C += 1
else:
    C += 1
    A += 1
D = [A,B,C]
D.sort()
ans += (2*D[2]-D[1]-D[0])//2
print(ans+1)

Solution (Python):
A,B,C = sorted(int(X) for X in input().split())
Count = 0
if A!=C and B!=C:
    Count += C-B
    A += C-B
if A!=C:
    Count += (C-A)//2 + 2*((C-A)%2!=0)
print(Count)

Solution (Python):
A = list(map(int, input().split()))
A.sort()
Ans = 0
temp = (A[2] - A[0])//2
Ans += temp
A[0] += temp*2
temp = (A[2] - A[1])//2
Ans += temp
A[1] += temp*2
if A[0] == A[1] == A[2]:
    print(Ans)
elif A[0] == A[1]:
    print(Ans+1)
else:
    print(Ans+2)

Solution (Python):
a, b, c = map(int, input().split())
if (a+b+c)%2 :
    if a%2 and b%2 and c%2 :
        total = a + b + c
        mx = max(a,b,c)
        diff = 3*mx - total
        print(diff//2)
    else :
        if not a%2 :
            a += 1
        if not b%2 :
            b += 1
        if not c%2 :
            c += 1
        total = a + b + c
        mx = max(a,b,c)
        diff = 3*mx -total
        ans = 1 + diff//2
        print(ans)
else :
    if not (a%2 or b%2 or c%2) :
        total = a + b + c
        mx = max(a,b,c)
        diff = 3*mx -total
        print(diff//2)
    else :
        if a%2 :
            a += 1
        if b%2 :
            b += 1
        if c%2 :
            c += 1
        total = a + b + c
        mx = max(a,b,c)
        diff = 3*mx - total
        ans = 1 + diff//2
        print(ans)

Solution (Python):
import statistics
import math
abc = list(map(int,input().split()))
max = max(abc)
med = statistics.median(abc)
min = min(abc)
cop = (max-med)+(max-min)
if cop%2 == 0:
	print(cop//2)
else:
	print(math.ceil(cop/2)+1)

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    a, b, c = map(int, input().split())
    r = 0
    if a % 2 == b % 2 == c % 2:
        pass
    else:
        
        if (a + b + c) % 2 == 1:
            a += 1 if a % 2 == 0 else 0
            b += 1 if b % 2 == 0 else 0
            c += 1 if c % 2 == 0 else 0
        
        else:
            a += 1 if a % 2 == 1 else 0
            b += 1 if b % 2 == 1 else 0
            c += 1 if c % 2 == 1 else 0
        r += 1
    r += ((max(a, b, c) * 3 - (a + b + c)) // 2)
    print(r)

if __name__ == '__main__':
    main()

Solution (Python):
a = list(map(int, input().split()))
t = sum(a)
ans = 0
while t%3 > 0 or t < max(a)*3:
    ans, t = ans+1, t+2

print(ans)

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

dist1=a[2]-a[0]
dist2=a[2]-a[1]

if (dist1%2)==0 and (dist2%2)==0:
  ans=(dist1+dist2)//2
  print(ans)
  
elif (dist1%2)==1 and (dist2%2)==1:
  ans=(dist1+dist2)//2
  print(ans)
  
elif (dist1%2)==0 and (dist2%2)==1:
  ans=(dist1//2)+(dist2+1)//2
  print(ans+1)
  
else:
  ans=(dist2//2)+(dist1+1)//2
  print(ans+1)

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re












import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
a,b,c = readInts()
s = a+b+c
k = max(a,b,c)*3 - s
if k%2 == 0:
    print(k//2)
else:
    print(k//2 + 2)

Solution (Python):
a, b, c = map(int, input().split(" "))
max_v = max(a, b, c)
sum_v = a + b + c
cc = 0
if max_v % 2 == sum_v %2:
    cc = (3 * max_v - sum_v) // 2
else :
    cc = (3 * (max_v + 1) - sum_v) // 2

print(cc)

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

Solution (Python):
A, B, C = sorted(map(int, input().split()))
B, C = B-A, C-A
def calc(x):
  return (x+x%2)//2+x%2 if x>0 else -x
print(min(calc(i)+calc(i-B)+calc(i-C) for i in range(51)))

Solution (Python):




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

ans = 0

s1 = abc[2] - abc[0]
s2 = abc[2] - abc[1]


if s1 > 0:
    
    if s1 % 2 == 0 and s2 % 2 == 0:
        ans = s1 // 2 + s2 // 2
        
    
    elif s1 % 2 > 0 and s2 % 2 > 0:
        s1 = s1 - 1
        s2 = s2 - 1
        ans = s1 // 2 + s2 // 2 + 1
    
    else:
        ans = s1 // 2 + s2 // 2 + 2


print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

v = inl()
v.sort()


def solve():
    k1 = (v[2] - v[0]) // 2
    v[0] += 2 * k1
    k2 = (v[2] - v[1]) // 2
    v[1] += 2 * k2
    if v[0] == v[1] == v[2]:
        return k1 + k2
    elif v[0] == v[1] == (v[2] - 1):
        return k1 + k2 + 1
    else:
        return k1 + k2 + 2


print(solve())

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

s = sum([i%2 for i in n])

if s == 0 or s == 3:
    m = max(n)
    res = 0
    for i in n:
        res += (m-i)//2
    print(res)
elif s == 1:
    for i in range(3):
        if n[i]%2 == 0:
            n[i] += 1
    res = 1
    m = max(n)
    for i in n:
        res += (m-i)//2
    print(res)
else:
    for i in range(3):
        if n[i]%2:
            n[i] += 1
    res = 1
    m = max(n)
    for i in n:
        res += (m-i)//2
    print(res)

Solution (Python):
A = sorted(list(map(int,input().split())))
cnt = 0
n = (A[2]-A[0])//2
cnt += n
A[0] += 2*n
n = (A[2]-A[1])//2
cnt += n
A[1] += 2*n
A = sorted(A)
if A[0]<A[1]==A[2]:
    cnt += 2
elif A[0]==A[1]<A[2]:
    cnt += 1
print(cnt)

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

Solution (Python):
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 = sorted(list(map(int, input().split(" "))))
count = 0
a[0] += a[2] - a[1]
count += a[2] - a[1]

if (a[2] - a[0]) % 2 == 0:
  print(count +  ((a[2] - a[0]) // 2))
else:
  print(count +  ((a[2] - a[0]) // 2) + 2)

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

if a >= b and a >= c:
    if (2*a - b - c) % 2 == 0:
        print(int((2*a - b - c)/2))
    else:
        print(int((2*a - b - c)//2 + 2))
elif b >= a and b >= c:
    if (2*b -a -c) %2 == 0:
        print(int((2*b -a -c)/2))
    else:
        print(int((2*b -a -c)//2 +2))
else:
    if (2*c -b-a) % 2 ==0:
        print(int((2*c -b-a)/2))
    else:
        print(int((2*c -b-a)//2 +2))

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

ABC.sort(reverse = True)

step1 = ABC[0] - ABC[1]
step2 = ABC[0] - ABC[2] - step1

if step2 % 2 == 0:
    result  = int(step2 / 2) + step1
else:
    result = int(step2 / 2) + step1 + 2
print(result)

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

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

ac =abcs[2]-abcs[0]
bc =abcs[2]-abcs[1]

res = 0

res += ac//2
res += bc//2

dx = ac % 2
dy = bc % 2

if dx + dy ==0:
    print(res)
elif dx + dy ==2:
    print(res+1)
else:
    print(res+2)

Solution (Python):
abc = list(map(int, input().split()))
abc.sort()
ans = abc[2] - abc[1]
abc[0] += ans

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

print(ans)

Solution (Python):
nums = [int(w) for w in input().split()]

nums.sort()
ans = 0
if (nums[1]-nums[0]) % 2 == 1:
    nums[0] -= 1
    ans += 1

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

Solution (Python):
A, B, C = map(int, input().split())
s = sorted([A, B, C])
a = s[2] - s[0]
b = s[2] - s[1]

a_odd = a % 2 == 1
b_odd = b % 2 == 1

ans = a // 2 + b // 2

if a_odd and b_odd:
    ans += 1
elif a_odd and not b_odd:
    ans += 2
elif not a_odd and b_odd:
    ans += 2

print(ans)

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

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

Solution (Python):
def main():
    num = sorted(map(int, input().split()))

    cnt = 0
    a = num[2] - num[1]
    cnt += a
    num[0] += a

    if (num[2] - num[0]) % 2 == 0:
        cnt += (num[2] - num[0]) // 2
    else:
        cnt += (num[2] - num[0]) // 2 + 2

    print(cnt)


if __name__ == "__main__":
    main()

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    num_list = i_list()

    num_list.sort()

    diff = num_list[2] * 2 - num_list[1] - num_list[0]

    ans = diff / 2

    if diff % 2 == 1:
        ans += 2
    
    print(int(ans))

if __name__ == '__main__':
    main()

Solution (Python):
def resolve():
    A = sorted([int(i) for i in input().split()])
    if max(A) * 3 % 2 == sum(A) % 2:
        print((max(A) * 3 - sum(A)) // 2)
    else:
        print(((max(A) + 1) * 3 - sum(A)) // 2)


resolve()

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    ans = 0
    A, B, C = map(int, input().split())
    ma, mi = max(A,B,C), min(A,B,C)
    if ma*3%2 != (A+B+C)%2:
        ma += 1
    ans = (ma*3-(A+B+C))//2 + (ma*3-(A+B+C))%2
    print(ans)

if __name__ == '__main__':
    main()

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

print((a[2] - a[1]) + (a[1] - a[0]) // 2 + (a[1] - a[0]) % 2 * 2)

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    ABC = il()
    mx = max(ABC)
    sm = sum(ABC)
    m = mx * 3 - sm
    while m % 2 != 0:
        m += 3
    print(m//2)


if __name__ == '__main__':
    main()

Solution (Python):
a = list(map(int, input().split()))
s, m, b = sorted(a)
cnt = 0
m_s = m - s
cnt += b - m
cnt += m_s // 2

if m_s % 2 == 1:
    cnt += 2
print(cnt)

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

ans=0
ans+=C-B


ans +=(B-A)//2

if A%2 != B%2:
    ans+=2

print(ans)

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

Solution (Python):
A,B,C=map(int,input().split())
X,Y,Z=sorted([A,B,C])

K=0
while Y<Z:
    X+=1
    Y+=1
    K+=1

while X<Y:
    X+=2
    K+=1

if X!=Y:
    K+=1
print(K)