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

ans = 0

if x[2] % 2 == x[1] % 2 == x[0] % 2:
  ans = (x[2] - x[1]) // 2 + (x[2] - x[0]) // 2
elif (x[2] % 2 == x[1] % 2 and x[2] % 2 != x[0] % 2) or (x[2] % 2 == x[0] % 2 and x[2] % 2 != x[1] % 2):
  ans = (x[2] - x[1]) // 2 + (x[2] - x[0]) // 2 + 2
else:
  ans = (x[2] - x[1]) // 2 + (x[2] - x[0]) // 2 + 1
  
print(ans)

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

max = max([A,B,C])
dif_sum = 3*max -A-B-C

cnt=0
if dif_sum % 2 == 0:
    cnt = dif_sum / 2
else:
    cnt = (dif_sum+1) / 2
    cnt += 1
print(int(cnt))

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

def get_num(n,x):
    if n>=x:
        return n-x
    else:
        return (x-n+1)//2 + (x-n)%2
ans = 10**9
for x in range(min(A,B,C),max(A,B,C)+2):
    ans = min(ans,get_num(A,x)+get_num(B,x)+get_num(C,x))
print(ans)

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

X = max(A, B, C)
K = A + B + C

if (3*X - K) % 2:
    print((3*(X+1) - K) // 2)
else:
    print((3*X - K) // 2)

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

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

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

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

dif = num[2] - num[1] + num[2] - num[0]

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

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

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

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

if A%2 == B%2 == C%2:
    ans = (3*Max-A-B-C) // 2
else:
    ABC = [A, B, C]
    ABC.sort()
    A, B, C = ABC[0], ABC[1], ABC[2]
    if A % 2 == B % 2:
        ans = (2*C-A-B-2) // 2 + 1
    else:
        ans = (2*(C+1)-A-B-1) // 2 + 1
print(ans)

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

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

Solution (Python):
N=[int(i) for i in input().split()]
N.sort()
a=N[0]
b=N[1]
c=N[2]
count=0
if (b-a)%2!=0:
  b+=1
  c+=1
  count=1
print(c-b+(b-a)//2+count)

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

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

Solution (Python):
import math
a=list(map(int,input().split()))
a.sort()
i,j=a[1]-a[0],a[2]-a[1]

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

Solution (Python):

import sys


def solve(A: int, B: int, C: int):
    integers = sorted([A, B, C])
    midMinDiff = integers[1] - integers[0]  
    step = 0
    if midMinDiff % 2 == 0:
        step += midMinDiff // 2
        step += integers[2] - integers[1]
    else:
        
        step += 1
        step += (midMinDiff + 1) // 2
        step += integers[2] - integers[1]
    print(step)
    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):




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


abc.sort(reverse=True)


cnt = 0

wsa = abc[0] * 2 - abc[1] - abc[2]

if wsa > 0 and wsa % 2 == 0:
    cnt -= 1



while abc[0] != abc[1] or abc[0] != abc[2]:
    if abc[0] == abc[1]:
        abc[2] += 2
    else:
        abc[1] += 1
        abc[2] += 1
    cnt += 1



    if max(abc) == abc[2]:
        abc[1] += 1
        abc[0] += 1
        cnt += 1
        break
        
print(cnt)

Solution (Python):
t = list(map(int, input().split()))
s = [t[0] % 2 , t[1] % 2 , t[2] % 2]
if s[0] == s[1] and s[0] == s[2]:
    print(int((max(t[0] , t[1] , t[2]) *3 - (t[0] + t[1] + t[2])) / 2))
else:
    if s.count(0) > s.count(1):
        for i in range(3):
            if s[i] == 0:
                t[i] += 1
        print(int((max(t[0] , t[1] , t[2]) *3 - (t[0] + t[1] + t[2])) / 2) + 1)
    else:
        for i in range(3):
            if s[i] == 1:
                t[i] += 1
        print(int((max(t[0] , t[1] , t[2]) *3 - (t[0] + t[1] + t[2])) / 2) + 1)

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

    max_value = max(inputs)
    max_i = inputs.index(max_value)

    ct = 0
    total = 0
    for input_i in inputs:
        if input_i == max_value:
            continue
            
        total += int((max_value - input_i)/2)
        if (max_value - input_i) % 2:
            ct += 1
        
    
    if ct == 0:
        ans = total
    elif ct == 1:
        ans = total + 2
    elif ct == 2:
        ans= total + 1
    
    print(ans)


main()

Solution (Python):
abc=[int(i) for i in input().split()]
abcm=max(abc)
ans=list(map(lambda x: abs(x-abcm),abc))
if sum(ans)%2==0:
    print(sum(ans)//2)
else:
    print(sum(ans)//2+2)

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

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

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

ans = 0
while(nums[0]<nums[2]-1):
    ans += 1
    nums[0]+=2
while(nums[1]<nums[2]-1):
    ans += 1
    nums[1]+=2

if nums[0]==nums[1]==nums[2]:
    ans += 0
elif nums[0] == nums[1]:
    ans += 1
else: ans += 2


print(ans)

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

gap_1 = lst[2] - lst[1]
gap_2 = lst[2] - lst[0]

if (gap_1 - gap_2) % 2 == 0:
    print(gap_2 + (gap_1 - gap_2) // 2)
else:
    print(gap_2 + (gap_1 - gap_2) // 2 + 2)

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

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

Solution (Python):
A,B,C = map(int,input().split())
max_ABC = max(A,B,C)
dif = [max_ABC - A,max_ABC - B,max_ABC - C]
odd_dif = [i for i in dif if i % 2 == 1]
even_dif = [i for i in dif if i % 2 == 0] 

if len(even_dif) == 3:
	ans = sum(dif)/ 2
elif len(even_dif) == 2:
	ans = (sum(dif) + 3) / 2
else:
	ans = sum(dif) / 2
	
print(int(ans))

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

D.sort()

Ans = (D[2] - D[0]) // 2
Ans += (D[2] - D[1]) // 2

a = D[2] % 2
b = D[0] % 2 + D[1] % 2

if a == 0:
  if b == 1:
    Ans += 2
  elif b == 2:
    Ans += 1
else:
  if b == 0:
    Ans += 1
  elif b == 1:
    Ans += 2

print(Ans)

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

counter = 0

li_wk = sorted([a, b, c], reverse=True)

if (li_wk[0] - li_wk[1]) >= 2:
    add_1 = (li_wk[0] - li_wk[1]) // 2
    li_wk[1] += (add_1 * 2)
    counter += add_1

if (li_wk[0] - li_wk[2]) >= 2:
    add_2 = (li_wk[0] - li_wk[2]) // 2
    li_wk[2] += (add_2 * 2)
    counter += add_2

if li_wk.count(li_wk[0]) == 3:
    pass
elif li_wk.count(li_wk[0]) == 2:
    counter += 2
else:
    counter += 1

print(counter)

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

Solution (Python):
def cal(x,y):
  if x>=y:
    return x-y
  else:
    a=y-x
    b=a//2
    if a%2!=0:
      b+=2
    return b
A,B,C=map(int,input().split())
ans=10**3

for i in range(51):
  kans=cal(A,i)+cal(B,i)+cal(C,i)
  ans=min(ans,kans)
print(ans)

Solution (Python):
import sys

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

ma = max(a, b, c)

at = (ma - a) // 2 * 2 + a
bt = (ma - b) // 2 * 2 + b
ct = (ma - c) // 2 * 2 + c

ans = 0
ans += (ma - a) // 2
ans += (ma - b) // 2
ans += (ma - c) // 2

dif = abs(ma - at) + abs(ma - bt) + abs(ma - ct)

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

Solution (Python):
import sys

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

ma = max(a, b, c)

at = (ma - a) // 2 * 2 + a
bt = (ma - b) // 2 * 2 + b
ct = (ma - c) // 2 * 2 + c

ans = 0
ans += (ma - a) // 2
ans += (ma - b) // 2
ans += (ma - c) // 2

dif = abs(ma - at) + abs(ma - bt) + abs(ma - ct)

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

Solution (Python):
import sys

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

ma = max(a, b, c)

at = (ma - a) // 2 * 2 + a
bt = (ma - b) // 2 * 2 + b
ct = (ma - c) // 2 * 2 + c

ans = 0
ans += (ma - a) // 2
ans += (ma - b) // 2
ans += (ma - c) // 2

dif = abs(ma - at) + abs(ma - bt) + abs(ma - ct)

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

Solution (Python):
import sys

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

ma = max(a, b, c)

at = (ma - a) // 2 * 2 + a
bt = (ma - b) // 2 * 2 + b
ct = (ma - c) // 2 * 2 + c

ans = 0
ans += (ma - a) // 2
ans += (ma - b) // 2
ans += (ma - c) // 2

dif = abs(ma - at) + abs(ma - bt) + abs(ma - ct)

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

Solution (Python):
import sys

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

ma = max(a, b, c)

at = (ma - a) // 2 * 2 + a
bt = (ma - b) // 2 * 2 + b
ct = (ma - c) // 2 * 2 + c

ans = 0
ans += (ma - a) // 2
ans += (ma - b) // 2
ans += (ma - c) // 2

dif = abs(ma - at) + abs(ma - bt) + abs(ma - ct)

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

Solution (Python):



from collections import deque, defaultdict

X = sorted(list(map(int, input().rstrip().split(' '))))
X = [x - X[0] for x in X]

memo = defaultdict(lambda: defaultdict(lambda: defaultdict(lambda: -1)))
q = deque([X + [0]])
while True:
    if len(q) == 0:
        break
    values = q.popleft()
    values, depth = values[:3], values[3]
    
    if values[0] == values[1] and values[1] == values[2]:
        print(depth)
        break
    elif memo[values[0]][values[1]][values[2]] != -1:
        continue
    
    gaps = [
        [1, 1, 0],
        [1, 0, 1],
        [0, 1, 1],
        [2, 0, 0],
        [0, 2, 0],
        [0, 0, 2],
    ]
    for gap in gaps:
        new_values = sorted([v + g for v, g in zip(values, gap)])
        new_values = [v - new_values[0] for v in new_values]
        q.append(new_values + [depth + 1])
        
    memo[values[0]][values[1]][values[2]] = 1

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

M = max(A,B,C)
x= 3*M-(A+B+C)

if x%2==0:
    ans = x//2
else:
    ans = (x-1)//2+2

print(ans)

Solution (Python):
A, B, C = map(int, input().split())
s = sorted([A, B, C])
count = s[2] - s[1]
count += (s[1] - s[0] + 1) // 2
count += (s[1] - s[0]) % 2
print(count)

Solution (Python):


import re

n = input()
n = re.split(" ",n)
for i in range(3):
    n[i] = int(n[i])
n.sort()
a = int(n[2]) - int(n[0])
b = int(n[2]) - int(n[1])


if(a % 2 == 1 and b % 2 == 1):
    print(int(a/2)+int(b/2) + 1)

elif(a % 2 == 0 and b % 2 == 0):
    print(int(a/2) + int(b/2))

else:
    print(int(a/2) + int(b/2) + 2)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    s = S()
    c = s.count("0")
    print(2*min(c,len(s)-c))
    return


def B():
    n = I()
    h = LI()
    ans = 0
    m = min(h)
    while m:
        ans += m
        k = max(h)
        for i in range(n):
            if h[i] >= m:
                h[i] -= m
                if h[i]:k = min(k,h[i])
            else:break
        m = k
    print(ans)
    return


def C():
    n,k = LI()
    x = LI()
    ans = float("inf")
    j = bisect.bisect_left(x,0)
    if n == 1:
        print(abs(x[0]))
        quit()
    if j < n:
        if x[j] == 0:
            k -= 1
            x.pop(j)
            n -= 1
    for i in range(n):
        if i < j:
            if abs(i-j) > k:continue
            elif abs(i-j) == k:ans = min(ans,abs(x[i]))
            elif k+i-1 < n:
                ans = min(ans,abs(x[i])+x[k+i-1]-x[i])
        else:
            if abs(i-j)+1 > k:continue
            elif abs(i-j)+1 == k:ans = min(ans,x[i])
            elif i-k+1 >= 0:
                ans = min(ans,abs(x[i])+x[i]-x[i-k+1])

    print(ans)
    return


def D():
    n = I()
    a = LI()
    ans = 0
    p = [1<<i for i in range(100)]
    for i in range(n):
        l = 0
        r = 100
        while r-l > 1:
            m = (l+r)//2
            if a[i]%p[m] == 0:
                l = m
            else:
                r = m
        ans += l
    print(ans)
    return


def E():
    s = LI()
    s.sort()
    ans = s[2]-s[1]
    s[0] += s[2]-s[1]
    s[1] = s[2]
    if s[0]%2 != s[1]%2:
        ans += (s[1]+1-s[0])//2+1
    else:
        ans += (s[1]-s[0])//2
    print(ans)
    return


def F():
    return


def G():
    return


def H():
    return


def I_():
    return


def J():
    return


if __name__ == "__main__":
    E()

Solution (Python):
List = [int(i) for i in input().split()]
count = 0
flag = 0
while(flag == 0):
    List.sort()
    if (List[0]==List[1]==List[2]):
        flag = 1
       
    elif (List[2]-List[0]>0) and (List[2]-List[1]>0):
        List[0]+=1
        List[1]+=1
        count += 1
        
    else:
        List[0]+=2
        count += 1
       

print(count)

Solution (Python):
import numpy as np
nums = np.array(list(map(int, input().split())))



count = 0
while(True):
    min_num = nums.min()
    nums_count = (nums == min_num).sum()
    if nums_count == 3:
        break
    indx = np.where(nums == min_num)[0]
    count += 1
    if nums_count == 2:
        nums[indx] += 1
    if nums_count == 1:
        nums[indx] += 2

print(count)

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

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

Solution (Python):
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')



A, B, C = 0, 0, 0


def set_inputs():
    global A, B, C
    A, B, C = get_li()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    
    x, y, z = sorted([A, B, C])
    xd, xm = divmod(x, 2)
    yd, ym = divmod(y, 2)
    zd, zm = divmod(z, 2)
    m = xm + ym + zm
    if m == 0 or m == 3:
        print(zd - xd + zd - yd)
    elif m == 2:
        print(zd - xd + zd - yd + 2)
    else:
        print(zd - xd + zd - yd + 1)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return zip(*(
        [t(x) for t, x in zip(types, input().split())]
        for _ in range(n)
    ))


if __name__ == '__main__':
    main()

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

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

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

count = 0

A += C - B
count += C - B

count += (C - A) / 2
count = int(count)

if (C - A) % 2 != 0 :
    count += 2

print(count)

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

a, b, c = nums
count = 0

while True:
  if b - a >= 2:
    a += 2
    count += 1
  elif c - b >=1:
    a += 1
    b += 1
    count += 1
  else:
    break
    
if a != b:
  count += 2
print(count)

Solution (Python):
A, B, C = map(int, input().split())
evens = [A%2 == 0, B%2 == 0, C%2 == 0]
even_c = sum(evens)
if even_c == 3 or even_c == 0:
    m = max(A, B, C)
    print(((m-A)+(m-B)+(m-C))//2)
elif even_c == 2:
    a = A+1 if A%2 == 0 else A
    b = B+1 if B%2 == 0 else B
    c = C+1 if C%2 == 0 else C
    m = max(a, b, c)
    print((((m-a)+(m-b)+(m-c))//2)+1)
elif even_c == 1:
    a = A+1 if A%2 != 0 else A
    b = B+1 if B%2 != 0 else B
    c = C+1 if C%2 != 0 else C
    m = max(a, b, c)
    print((((m-a)+(m-b)+(m-c))//2)+1)

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

Solution (Python):
from sys import stdin
l = [int(_) for _ in stdin.readline().rstrip().split()]
x=max(l)
if 3*x%2 == sum(l)%2:
    print(int((3*x-sum(l))/2))
else:
    print((3*x-sum(l)+3)//2)

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

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

Solution (Python):
a, b, c = map(int, input().split())
count = max(a, b, c)*3 - a - b - c

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

Solution (Python):
a, b, c = map(int, input().split())
r_a, r_b, r_c = a % 2, b % 2, c % 2
num = 0
if r_a == r_b and r_b == r_c:
    pass
elif r_a == r_b:
    a += 1
    b += 1
    num += 1
elif r_b == r_c:
    b += 1
    c += 1
    num += 1
else:
    a += 1
    c += 1
    num += 1
a, b, c = tuple(sorted([a, b, c], key=lambda x: -x))
num += (2 * a - b - c) // 2
print(num)

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

Solution (Python):


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

magic = max(a,b,c)*3-a-b-c

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

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

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

Solution (Python):
a, b, c = [int(i) for i in input().split(" ")]
mn, me, mx = sorted([a, b, c])

c = 0

if (me - mn) % 2 == 0:
    c += (me - mn) // 2
    mn = me
else:
    c += (me - 1 - mn) // 2 + 1
    mn = me
    mx += 1
    
c += mx - me

print(c)

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

_max = max([A,B,C])

answer = 0
answer += (_max-A)//2 + (_max-B)//2 + (_max-C)//2

_map = {0:0, 1:2, 2:1}
answer += _map[(_max-A)%2 + (_max-B)%2 + (_max-C)%2]

print(answer)

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

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

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

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)


"""
解説を読んで

最終的に行き着く数をXとする
XはA,B,Cの最大値または最大値＋１のどちらかである。
そうすると、3X - (A+B+C)を2で割った時に余り0となるようなXを求めれば良い
それはA,B,Cの最大値またはそれにプラス１した値である。

"""
A, B, C = LI()
X = max(A,B,C)
result1 = 3*X - (A+B+C)
result2 = 3*(X+1) - (A+B+C)
if result1%2 == 0:
    print(int(result1/2))
else:
    print(int(result2/2))

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

A, B, C = LI()

nums = sorted([A,B,C])
set_nums = list(set([A,B,C]))
result = 0
if len(set_nums) == 1:
    print(0)
elif len(set_nums) == 2:
    
    
    if nums[0] == nums[1]:
        result += nums[2]-nums[1]
        print(result)
        exit()
    elif nums[1] == nums[2]:
        
        result += (nums[1] - nums[0])//2
        if (nums[1]-nums[0]) % 2 != 0:
            result += 2
        print(result)
        exit()
else:
    
    result += nums[2]-nums[1]
    nums[0] += nums[2]-nums[1]
    result += (nums[2] - nums[0]) // 2
    if (nums[2] - nums[0]) % 2 != 0:
        result += 2

    print(result)

Solution (Python):
def solve(string):
    abc = sorted(map(int, string.split()))
    ans = 0
    oe = sum([_abc % 2 == 0 for _abc in abc])
    if 1 <= oe <= 2:
        for i, _ in enumerate(abc):
            if abc[i] % 2 == oe % 2:
                abc[i] += 1
        ans += 1
    return str(ans + (abc[-1] - abc[0]) // 2 + (abc[-1] - abc[1]) // 2)


if __name__ == '__main__':
    print(solve(input()))

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

Solution (Python):
lis = [int(x) for x in input().split()]
res = 0

lis.sort()
lis_dif = [x-lis[0] for x in lis]
res += (lis_dif[2]//2)*2 - (lis_dif[1]//2)
lis_bi = [x%2 for x in lis_dif]
res += lis_bi.count(1)

print(res)

Solution (Python):
import math
L=list(map(int,input().split()))
temp=0
count=0
for i in L:
    if i%2==0:
        temp+=1
if temp==0 or temp==2:
    
    for i in range(len(L)):
        if L[i]%2==0:
            L[i]+=1
            count+=1/2
    count//=1
    L.sort()
    count+=(L[1]-L[0])//2
    count+=(L[2]-L[1])
else:
    
    for i in range(len(L)):
        if L[i]%2!=0:
            L[i]+=1
            count+=1/2
    count//=1
    L.sort()
    count+=(L[1]-L[0])//2
    count+=(L[2]-L[1])
print(math.ceil(count))

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

if (A%2) == (B%2) == (C%2):
    x, y, z = sorted([A,B,C])
    diff = z*2 - x - y
    print(diff//2)

else:
    count_odd = 0
    count_even = 0
    for n in [A,B,C]:
        if n%2==1:
            count_odd += 1
        else:
            count_even += 1
    
    if count_odd == 2:
        if A%2 == 1:
            A += 1
        if B%2 == 1:
            B += 1
        if C%2 == 1:
            C += 1        
    else:
        if A%2 == 0:
            A += 1
        if B%2 == 0:
            B += 1
        if C%2 == 0:
            C += 1

    x, y, z = sorted([A,B,C])
    diff = z*2 - x - y
    print(diff//2 + 1)

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


X = 0

M = max(a, max(b, c))
if (3*M)%2 == (a+b+c)%2:
    X = M
else:
    X = M + 1

print(int((3*X - (a+b+c)) / 2))

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
sys.setrecursionlimit(1000000)


def A():
    s = S()
    a = s.count("a")
    b = s.count("b")
    c = 3-a-b
    if a&b&c:
        print("Yes")
    else:
        print("No")

def B():
    a,b,k = LI()
    ans = []
    for i in range(a,min(a+k,b+1)):
        ans.append(i)
    for i in range(max(a,b-k+1),b+1):
        ans.append(i)
    ans = list(set(ans))
    ans.sort()
    for i in ans:
        print(i)


def C():
    a,b,c = LI()
    ans = 0
    if a%2:
        if b%2:
            if not c%2:
                ans += 1
                a += 1
                b += 1
        else:
            ans += 1
            if not c%2:
                b += 1
                c += 1
            else:
                a += 1
                c += 1
    else:
        if b%2:
            ans += 1
            if not c%2:
                a += 1
                c += 1
            else:
                b += 1
                c += 1
        else:
            if c%2:
                ans += 1
                a += 1
                b += 1
    ans += (3*max(a,b,c)-a-b-c)//2
    print(ans)

def D():
    q = I()
    for i in range(q):
        a,b = LI()
        x = int((a*b)**0.5)
        y = math.ceil((a*b)/x)-1
        ans = x+y-2
        if a==b:
            ans += 1
        print(ans)


def E():
    s = S()
    f = {"N":0,"W":0,"S":0,"E":0}
    for i in s:
        f[i] = 1
    if f["N"]^f["S"]:
        print("No")
    elif f["W"]^f["E"]:
        print("No")
    else:
        print("Yes")

def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    C()

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

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

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

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

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

if (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
    print(str((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1)) 
elif (a[2] - a[0]) % 2 != 0 or (a[2] - a[1]) % 2 != 0:
    print(str((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 2))
else:
    print(str((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2))

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

step = 0

if (3 * max(nums) % 2) != (sum(nums) % 2):
    nums[1] += 1
    nums[2] += 1 
    step += 1

d1 = (nums[2] - nums[1])
d2 = nums[2] - (nums[0] + d1)

if d2 % 2 == 0:
    d2 = d2 // 2
else:
    d2 =  d2 // 2 + 1
step += (d1 + d2)

print(step)

Solution (Python):
from math import ceil

l = list(map(int,input().split()))
l.sort()
a = l[0]
b = l[1]
c = l[2]

res = 0
res += c-b
a += res
b = c

res += ceil((c-a)/2)
a += 2*ceil((c-a)/2)

if a == b:
    print(res)
else:
    print(res + 1)

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

Solution (Python):
X = [int(x) for x in input().split()]
X_bit = [x%2 for x in X]
flag = sum(X_bit)
if flag==0 or flag==3:
    diff = [max(X)-x for x in X]
    print(sum(diff)//2)
elif flag==1:
    X_ = [x+1 if x%2==0 else x for x in X]
    diff = [max(X_)-x for x in X_]
    print(sum(diff)//2+1)
elif flag==2:
    X_ = [x+1 if x%2==1 else x for x in X]
    diff = [max(X_)-x for x in X_]
    print(sum(diff)//2+1)