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):
from sys import stdin
import math

li = list(map(int,stdin.readline().rstrip().split()))

li.sort(reverse = True)

point = 0
su = sum(li)%2
sai = li[0]%2

if sum(li) == 1:
    print(1)
    exit()

else:
    if su != sai:
        li[0] += 1
        point += 1
    point += (li[0]*2-li[1]-li[2])//2

print(point)

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

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

A = L[0]
B = L[1]
C = L[2]

dif1 = C - A
dif2 = C - B

if (dif1 + dif2) % 2 == 0:
  print(int((dif1 + dif2)/2))
  
else:
  print(((dif1 + dif2) // 2 ) + 2)

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

Solution (Python):
key_num = list(int(x) for x in input().split())
key_num.sort()
ans = 0

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

key = key_num[2]*2 - key_num[1] - key_num[0] - ans*2
if key == 2:
    ans += 1
elif key == 1:
    ans += 2

print(ans)

Solution (Python):
a = sorted(list(map(int, input().split())))
cnt = 0
while a[1] != a[2]:
    a[0] += 1
    a[1] += 1
    cnt += 1

while a[0] < a[2]:
    a[0] += 2
    cnt += 1
if (a[2] - a[0]) % 2 == 1:
    cnt += 1
print(cnt)

Solution (Python):
import numpy as np
a = [int(x) for x in input().split()]

count = 0
while True:
    if (a[0] == a[1] and a[1] == a[2]):
        break
    elif (max(a) - min(a) >= 2):
        a[np.argmin(a)] += 2
        count += 1
        
    else:
        a = [x+1 if i != np.argmax(a) else x for i, x in enumerate(a)]
        count += 1
        
print(count)

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

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

Solution (Python):
a ,b, c = map(int, input().split())
m = max(a, b, c)
for i in range(100000):
        mod1 = 3*(m + i) % 2
        mod2 = (a + b + c) % 2
        if mod1 == mod2:
                print((3*(m + i) - (a + b + c))//2)
                exit()

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


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

print(count)

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

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

Solution (Python):
number = list(map(int,input().split()))
count = 0
while True:
	if len(set(number)) == 1:
		break
	number.sort()
	if number[0] == number[1]:
		number[0] += 1
		number[1] += 1
		count+=1
	else:
		number[0] += 2
		count+=1

print(count)

Solution (Python):
A, B, C = sorted([int(x) for x in input().split()])
ans = 0
ans += C - B
ans += (C - (A + ans)) // 2 + (C - (A + ans)) % 2 * 2
print(ans)

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



ans = 0
if a%2 == 0 and b%2 == 0 and c%2 == 0:
    pass
elif a%2 == 1 and b%2 == 1 and c%2 == 1:
    pass

elif a%2 == 0 and b%2 == 1 and c%2 == 1:
    b += 1
    c += 1
    ans += 1
elif a%2 == 1 and b%2 == 0 and c%2 == 1:
    a += 1
    c += 1
    ans += 1
elif a%2 == 1 and b%2 == 1 and c%2 == 0:
    a += 1
    b += 1
    ans += 1
elif a%2 == 0 and b%2 == 0 and c%2 == 1:
    a += 1
    b += 1
    ans += 1
elif a%2 == 0 and b%2 == 1 and c%2 == 0:
    a += 1
    c += 1
    ans += 1
elif a%2 == 1 and b%2 == 0 and c%2 == 0:
    b += 1
    c += 1
    ans += 1

while not a == b == c:
    if a == min(a, b, c):
        a += 2
        ans += 1
    
    if a == b == c:
        break

    if b == min(a, b, c):
        b += 2
        ans += 1

    if a == b == c:
        break

    if c == min(a, b, c):
        c += 2
        ans += 1

    if a == b == c:
        break
print(ans)

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

ans = 0


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

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

print(ans)

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

Solution (Python):
a, b, c = map(int, input().split())
ans = 0
while True:
    if a == b and b == c:
        break
    a, b, c = sorted([a, b, c])
    if a == b:
        a += 1
        b += 1
    else:
        a += 2
    ans += 1
print(ans)

Solution (Python):


import sys

import math








def main():
    *n, = (int(x) for x in sys.stdin.readline().split())
    n.sort()
    diff = n[2] * 2 - n[1] - n[0]
    print(diff // 2 if diff % 2 == 0 else math.ceil(diff / 2) + 1)
    


if __name__ == "__main__":
    
    main()

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

ans = 0
while max(A, B, C) > min(A, B, C):
    A, B, C = sorted([A, B, C])
    if B == C:
        A += 2
    else:
        A += 1
        B += 1
    ans += 1
print(ans)

Solution (Python):
A,B,C = map(int,input().split())
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        if mid - maxi != 1:
            i = (maxi+1-mid)//2
            mid = maxi + 1
    
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        if mini - maxi != 1:
            j = (maxi+1-mini)//2
            mini = maxi + 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print(i+j+k+l)
else:
    print(i+j+k+l+1)

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

Solution (Python):
da = list(map(int, input().split()))
ma = max(da)
ma *= 3
su = da[1] + da[2] + da[0]
if (ma - su) % 2:
    ma += 3
print((ma - su)//2)

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

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

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

Solution (Python):
A, B, C = map(int, input().split())
res = 0
while (not (A == B == C)):
    A, B, C = sorted((A, B, C))
    if A < B <= C:
        A += 2
        res += 1
    A, B, C = sorted((A, B, C))
    if A <= B < C:
        A += 1
        B += 1
        res += 1

print(res)

Solution (Python):
abc = list(map(int, input().rstrip("\n").split()))
parities = [n % 2 for n in abc]
i = (parities.count(0) < parities.count(1))
new_abc = list()

ans = 0

if len(set(parities)) == 2:
    for num, parity in zip(abc, parities):
        if parity == i:
            num += 1
        new_abc.append(num)
    ans += 1
else:
    new_abc = abc

max_ = max(new_abc)
new_abc.remove(max_)

for num in new_abc:
    ans += (max_ - num) // 2

print(ans)

Solution (Python):
import math
l = sorted([int(i) for i in input().split()])
x =  (2*l[2] - l[1]-l[0])
if x%2 == 0:
    print(x//2)
else:
    print(math.ceil(x/2) + 1)

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

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

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

Solution (Python):
a,b,c = sorted(map(int,input().split()))
count = 0
count += (c-a) // 2
count += (c-b) // 2
ca = (c-a) % 2
cb = (c-b) % 2
if ca and cb:
  count += 1
elif ca or cb:
  count += 2
print(count)

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

ans = 0

while a[2] > a[1]:
    a[0] += 1
    a[1] += 1
    ans += 1

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

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

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

for i in range(3):
    while ABC[i]<max(ABC)-1:
        ABC[i]+=2
        c+=1

if ABC.count(max(ABC))==3:
    print(c)
elif ABC.count(max(ABC))==2:
    print(c+2)
else:
    print(c+1)

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

Solution (Python):

import sys

nums = (int(i) for i in sys.stdin.readline().rstrip().split())
a, b, c = sorted(nums)

if (b - a) % 2 != 0:
  a += 1
  c += 1
  if a == b:
    print(c - b + 1)
  else:
    diff = b - a
    print(c - b + diff // 2 + 1)
else:
  diff = b - a
  print(c - b + diff // 2)

Solution (Python):
A, B, C = map(int, input().split())
_max = max(A, B, C)
sum = A + B + C
ans = 0

for i in range(51):
    a = sum % 3
    b = sum / 3  
    
    if a == 0 and  b >= _max:
        print(ans)
        break
    else:
        ans += 1
        sum += 2

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




sum_ = A + B + C
max_sum = max(A,B,C) * 3

ans = 0

if (sum_ % 2) == (max_sum % 2):
    ans = (max_sum - sum_) // 2
else:
    ans = ((max(A,B,C) + 1 ) * 3 - sum_) // 2

print(ans)

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

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

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

print(ans)

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

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

n = (vals[2] - vals[0]) + (vals[2] - vals[1])

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

Solution (Python):



def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    nums = list(map(int, input().split()))
    i = 0
    while True:
        if len(set(nums)) == 1:
            print(i)
            break

        nums.sort()
        if nums[0] == nums[1]:
            nums[0] += 1
            nums[1] += 1
        else:
            nums[0] += 2
        
        i += 1

if __name__ == '__main__':
    main()

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

Solution (Python):
import heapq
class PriorityQueue:
	"""
	動的に優先度付きで値をpopする
	値を変更してから再度ソートして取り出すみたいな操作をするなら
	Priority Queue!
	"""
	def __init__(self,num_list=None,reverse=False):
		self.reverse = reverse
		self.heap = []
		if num_list != None :
			for num in num_list:
				self.push(num)

	def push(self,num):
		heapq.heappush(self.heap,-num if self.reverse else num)

	def pop(self):
		num = heapq.heappop(self.heap)
		return -num if self.reverse else num
	
	def get(self):
		return list(map(lambda x: x*(-1),self.heap))


def cmd1(a,b):
	return a+1,b+1

def cmd2(n):
	return n+2

a,b,c = map(int,input().split())
const = min(a,b,c)
a -= const
b -= const
c -= const
count = 0
pq = PriorityQueue(num_list=[a,b,c],reverse=True)
total = 0
while True :
	num_max = pq.pop()
	a = pq.pop()
	b = pq.pop()

	a_req = num_max - a
	b_req = num_max - b
	
	if num_max == a == b :
		break

	if a_req > 0 and b_req > 0:
		a,b = cmd1(a,b)
		total += 1
	else :
		b = cmd2(b)
		total += 1
	pq.push(num_max)
	pq.push(a)
	pq.push(b)
print(total)

Solution (Python):
item=list(map(int,input().split()))
item.sort()
times=0
while sum(item)/3!=item[0]:
  if item[1]==item[2]:
    item[0]+=2
    times+=1
    item.sort()
  else:
    item[0]+=1
    item[1]+=1
    times+=1
    item.sort()
print(times)

Solution (Python):
x = list(map(int,input().split()))
ans = 0
while x[0]!=x[1] or x[1]!=x[2]:
    x = sorted(x,reverse=True)
    if x[0]==x[1]:
        x[2]+=2
        ans+=1
    else:
        x[1]+=1
        x[2]+=1
        ans+=1
print(ans)

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

if A%2==B%2!=C%2:
    A,B=A+1,B+1
    cnt=1
elif B%2==C%2!=A%2:
    B,C=B+1,C+1
    cnt=1
elif C%2==A%2!=B%2:
    C,A=C+1,A+1
    cnt=1

A,B,C=min(A,B,C),A+B+C-min(A,B,C)-max(A,B,C),max(A,B,C)

print(cnt+(C-A)//2+(C-B)//2)

Solution (Python):
import sys

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

A = sorted(A)

cnt = 0
for i in range(2):
    tmp = int((A[2] - A[i]) / 2)
    A[i] += tmp * 2
    cnt += tmp

A = sorted(A)
if A[0] == A[1] and A[1] == A[2]:
    print(cnt)
    sys.exit()
elif A[0] == A[1]:
    A[0] += 1
    A[1] += 1
    cnt += 1
elif A[1] == A[2]:
    A[0] += 2
    A[1] += 1
    A[2] += 1
    cnt += 2

print(cnt)

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

ABC.sort()


miin = min(ABC)

ABC[0] -= miin
ABC[1] -= miin
ABC[2] -= miin

res=0


if ABC[1] %2 != 0:
        res+=1
        ABC[1] -= 1


res+= (ABC[1]/2) + (ABC[2] - ABC[1])


print(int(res))

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

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

m = max(A, B, C)
diff = [m - A, m - B, m - C]
s = sum(diff)
if s % 2 == 0:
    print(s // 2)
else:
    print((s // 2) + 2)

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

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

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

Solution (Python):
def slove():
    import sys
    import bisect
    import collections
    import fractions
    import heapq
    input = sys.stdin.readline
    a, b, c = list(map(int, input().rstrip('\n').split()))
    cnt = 0
    while True:
        a, b, c = sorted([a, b, c])
        if abs(a - c) >= 2:
            a += 2
            cnt += 1
        else:
            if a == b == c:
                print(cnt)
                exit()
            if a == b:
                a += 1
                b += 1
                cnt += 1
            elif b == c:
                b += 1
                c += 1
                cnt += 1
            elif a == c:
                a += 1
                c += 1
                cnt += 1


if __name__ == '__main__':
    slove()

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

Solution (Python):
a,b,c = map(int,input().split())
cnt=0
x=[a,b,c]
while x[0]!=x[1] or x[1]!=x[2] or x[2]!=x[0]:
    x.sort()
    if x[2]>=x[0]+2:
        x[0]+=2
        cnt+=1
    else:
        x[0]+=1
        x[1]+=1
        cnt+=1
print(cnt)

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

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

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


while len(set(abc))!=1:
  if abc[2]-abc[1] > 0 and abc[2]-abc[0] > 0:
    abc[0] += 1
    abc[1]+=1
  elif abc[2]-abc[1] > 0:
    abc[1] += 2
  else:
    abc[0] += 2
  answer+=1
  abc.sort()

print(answer)

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

X = 2 * C - A - B
if X % 2 == 0:
    print(X//2)
else:
    print((X+3)//2)

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

Solution (Python):
abc = list(map(int, input().split()))
x = 0
y = 0
ans = 1
for i in range(3):
    if abc[i]%2==0:
        x+=1
    else:
        y+=1
if x==2:
    for i in range(3):
        if abc[i]%2==0:
            abc[i]+=1
elif y==2:
    for i in range(3):
        if abc[i]%2==1:
            abc[i]+=1
else:
    ans -= 1
abc.sort(reverse=True)
ans = ans + (abc[0]-abc[1])//2 + (abc[0]-abc[2])//2
print(ans)

Solution (Python):
def test():
    a = list(map(int,input().split()))
    odd = 0; even = 0; result = 0
    for i in range(3):
        if a[i] % 2 == 1:
            odd += 1
        else:
            even += 1

    if odd == 2:
        result += 1
        for i in range(3):
            if a[i] % 2 == 1:
                a[i] += 1
    elif even == 2:
        result += 1
        for i in range(3):
            if a[i] % 2 == 0:
                a[i] += 1
    m = max(a)
    for i in range(3):
        result += (m-a[i])//2
    print(result)


if __name__ == "__main__":
    test()

Solution (Python):
a, b, c = map(int,input().split())
array = [a,b,c]
array.sort()
ans = 0
d = array[2] - array[1]
e = array[2] - array[0]
ans += (d // 2) + (e // 2)
if d % 2 == 0 and e % 2 == 0:
    print(ans)
elif d % 2 == 0 or e % 2 == 0:
    print(ans+2)
else:
    print(ans+1)

Solution (Python):


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

dic=2*l[-1]-l[0]-l[1]

if dic%2==0:
    if l[0]%2==1 and l[1]%2==1 and l[-1]%2==0 or l[0]%2==0 and l[1]%2==0 and l[-1]%2==1:
        print((l[-1]-l[0])//2+(l[-1]-l[1])//2+1)
    else:
        print((l[-1]-l[0])//2+(l[-1]-l[1])//2)
    
else:
    print((l[-1]-l[0])//2+(l[-1]-l[1])//2+2)

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

ABC.sort()



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

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


ans += ABC[2] - ABC[1]

print(ans)

Solution (Python):
import numpy as np
*a, = map(int,input().split())
a = np.array(a)
dp = [0]*3
count = 0
if a[0] == a[1] == a[2]:print(0);exit()
for i in range(3):
    if a[i] % 2 == 1:dp[i] = 1
if dp.count(1) == 2:
    for i in range(len(a)):
        if dp[i] == 1:a[i] += 1
    count += 1
    while not a[0] == a[1] == a[2]:
        a[np.argmin(a)] += 2
        count += 1
elif dp.count(0) == 2:
    for i in range(len(a)):
        if dp[i] == 0:a[i] += 1
    count += 1
    while not a[0] == a[1] == a[2]:
        a[np.argmin(a)] += 2
        count += 1
else:
    while not a[0] == a[1] == a[2]:
        a[np.argmin(a)] += 2
        count += 1
print(count)

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

Solution (Python):
abc = list(map(int,input().split()))
odd = []
even = []
for i in abc:
    if i%2==0:
        even.append(i)
    else:
        odd.append(i)
if (not odd) or (not even):
    print(sum([(max(abc)-x)//2 for x in abc]))
else:
    if len(odd) ==1:
        even = [x+1 for x in even]
    else:
        odd = [x+1 for x in odd]
    abc = odd+even
    print(sum([(max(abc)-x)//2 for x in abc])+1)

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








result = 0
while True:
    if A == B and B == C:
        break
    elif A != B and B != C and A != C:
        if A < B:
            if B < C:
                A += 1
                B += 1
            else:
                A += 1
                C += 1
        else:
            if A < C:
                A += 1
                B += 1
            else:
                B += 1
                C += 1
    else:
        if A == B:
            if A > C:
                C += 2
            else:
                A += 1
                B += 1
        elif B == C:
            if A > B:
                B += 1
                C += 1
            else:
                A += 2
        else:
            
            if A > B:
                B += 2
            else:
                A += 1
                C += 1
    result += 1
print(result)

Solution (Python):
a,b,c=map(int,input().split())
ans=0
ma=max(a,b,c)
mi=min(a,b,c)
mj=a+b+c-ma-mi
ans+=(ma-mi)//2
mi+=((ma-mi)//2)*2
ans+=(ma-mj)//2
mj+=((ma-mj)//2)*2
if ma==mi==mj:
    print(ans)
elif ma==mi+1 and ma==mj+1:
    print(ans+1)
else:
    print(ans+2)

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

s=a[-1]*3

if (s-sum(a))%2==0:
    print(((s-sum(a)))//2)
else:
    print(((s+3-sum(a)))//2)

Solution (Python):
import sys

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

def main():
    a=list(map(int, input().split()))
    a.sort()
    ans=a[2]-a[1]
    a[0]+=ans
    a[1]+=ans
    d=a[1]-a[0]
    ans+=d//2
    ans+=(d%2)*2
    print(ans)

main()

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

Solution (Python):
l = [int(i) for i in input().split()]
cnt = 0
while not(l[0] == l[1] == l[2]):
  cnt += 1
  if l[0]-l[1]==l[0]-l[2]==1 or l[1]-l[0]==l[1]-l[2]==1 or l[2]-l[0]==l[2]-l[1]==1:
    print(cnt)
    exit()
  else:
    l[l.index(min(l))] += 2
print(cnt)

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


q1,mod1 = divmod((ABC[2] - ABC[0]), 2)
q2,mod2 = divmod((ABC[2] - ABC[1]), 2)

cnt = q1 + q2

if mod1 == mod2 == 0:
    print(cnt)
elif mod1 == mod2 == 1:
    print(cnt + 1)
else:
    print(cnt + 2)

Solution (Python):
l = list(map(int, input().split()))
l = sorted(l)
res = l[2] - l[1]
q, r = divmod(l[1]-l[0], 2)
res = res + q + r * 2
print(res)

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a = inpl()
a.sort()
b = (a[1]-a[0]) // 2
c = a[2] - a[1]
if (a[1] - a[0]) % 2 == 0:
    print(b + c)
else:
    print(b + c + 2)

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

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

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

Solution (Python):
A, B, C = map(int, input().split())
sumof3 = A + B + C
maxof3 = max(A, B, C)
oddeven = sumof3 % 2
oe_of_max = maxof3 % 2
if oddeven != oe_of_max:
    maxof3 += 1
ans = (maxof3 * 3 - sumof3) // 2
print(ans)

Solution (Python):
a,b,c=map(int,input().split())
lst=[a,b,c]
lst.sort()
dif1=lst[2]-lst[1]
dif2=lst[2]-lst[0]
q1,mod1=divmod(dif1,2)
q2,mod2=divmod(dif2,2)
dif3=min(dif1,dif2)
if mod1==mod2:
  if mod1==0:
    print(q1+q2)
  else:
    print(q1+q2+1)
else:
  print(q1+q2+2)

Solution (Python):
ls=[int(s) for s in input().split()]
x=sum(ls)
y=max(ls)*3
if (y-x)%2==0:
  print((y-x)//2)
else:
  print((y+3-x)//2)

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

Solution (Python):
import sys
from functools import reduce
import copy
import math
from pprint import pprint


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    nums = string_to_int(inputs[0])
    max_num = max(nums)
    sum_num = sum(nums)

    count = 0
    while sum_num % 3 != 0 or (sum_num // 3) < max_num:
        count += 1
        sum_num += 2
    return count


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

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

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

Solution (Python):
A,B,C =[int(x) for x in input().split()]
d = max(A,B,C)
l = [d-A,d-B,d-C]
su = sum(l)
if su%2==0:
  print(su//2)
else:
  print(1+(su+1)//2)

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

if (li[2]-li[0])%2 != (li[2]-li[1])%2:

    if li[2]%2 == li[0]%2:
        li[2] += 1
        li[0] += 1
    else:
        li[2] += 1
        li[1] += 1
    ans += 1

d = min(li[2]-li[0],li[2]-li[1])
e = max(li[2]-li[0],li[2]-li[1])
ans += d + (e-d)//2
print(ans)

Solution (Python):
abc = sorted(map(int, input().split()))
o = [i%2 for i in abc]
b = 0
if o.count(1)==1:
    b += 1
    for i in range(3): abc[i] += 1^o[i]
if o.count(1)==2:
    b += 1
    for i in range(3): abc[i] += o[i]
print((abc[2]-abc[1])//2+(abc[2]-abc[0])//2+b)

Solution (Python):
def solve():
    T = list(map(int, input().split()))
    l = [t%2 for t in T]
    count = 0
    if sum(l) == 1:
        odd = T.pop(l.index(1))
        count += abs(T[0] - T[1]) // 2
        if max(T[0],T[1]) <= odd:
            count += odd - max(T[0],T[1])
        else:
            count += (max(T[0],T[1]) - odd)//2 + 2
    elif sum(l) == 2:
        even = T.pop(l.index(0))
        count += abs(T[0] - T[1]) // 2
        if max(T[0],T[1]) <= even:
            count += even - max(T[0],T[1])
        else:
            count += (max(T[0],T[1]) - even)//2 + 2
    else:
        m = T.pop(T.index(max(T)))
        count += abs(T[0] - T[1]) // 2
        count += abs(m - max(T[0],T[1]))
        
    return count
        

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

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

m = max(arr)

cnt = 0

for i in range(3):
    if m - arr[i] >= 2:
        x = (m - arr[i]) // 2
        cnt += x

        arr[i] += x*2


arr.sort()

if arr[0] == arr[1] and arr[1] == arr[2]:
    pass
elif arr[0] < arr[1] and arr[1] < arr[2]:
    cnt += 3
elif arr[0] == arr[1] and arr[1] < arr[2]:
    cnt += 1
else:
    cnt += 2

print(cnt)

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

target = max(a, b, c)
if (target*3 - a - b - c) % 2 == 1:
    target += 1

res = (target*3 - a - b - c) // 2

print(res)

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

Solution (Python):
L = [int(x) for x in input().split()]

L.sort()
M = max(L)
for i in range(3):
    L[i] -= M
    
ans = -L[1]
L[0] += ans
if L[0]%2 == 0:
    ans -= L[0]//2
else:
    ans -= (L[0]-1)//2-1
    
print(ans)

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

ans = 0
while (C-A) > 1:
    A += 2
    ans += 1

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

if A == C:
    if B != C:
        B += 2
        A += 1
        C += 1
        ans += 2
else:
    if B == C:
        A += 2
        B += 1
        C += 1
        ans += 2
    else:
        A += 1
        B += 1
        ans += 1
print(ans)

Solution (Python):


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

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

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

Solution (Python):


import numpy
data = list(map(int, input().split()))
cost = 0

max_index = numpy.argmax(data)
m = data.pop(max_index)
if abs(data[0]-data[1])%2 == 1:
    cost += 2
cost += (abs(data[0]-data[1])//2 + m - max(data))
print(cost)

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

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

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

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

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

diff = ABC[2] - ABC[1]
ret = diff
ABC[0] += diff
ABC[1] += diff

ret += (ABC[1] - ABC[0]) // 2
if (ABC[1] - ABC[0]) % 2 == 1 :
    ret += 2
    
print(ret)

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

if As[-1]-As[0]>=2:
  step = (As[-1]-As[0])//2
  As[0] += step * 2
  ans += step
  
if As[-1]-As[1]>=2:
  step = (As[-1]-As[1])//2
  As[1] += step * 2
  ans += step
    
As = sorted(As)
if As[0]==As[1] and As[-1]>As[1]:
  ans += 1
  
elif As[0]<As[1] and As[1]==As[-1]:
  ans += 2
    
print(ans)

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

if a % 2 == b % 2 == c % 2:
  pass
elif a % 2 == b % 2:
  out += 1
  a += 1
  b += 1
elif a % 2 == c % 2:
  out += 1
  a += 1
  c += 1
else:
  out += 1
  b += 1
  c += 1
  
l = sorted([a, b, c])
while True:
  if l[1] == l[2]:
    break
  out += 1
  l[0] += 1
  l[1] += 1
while True:
  if l[0] == l[1]:
    break
  out += 1
  l[0] += 2

print(out)

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

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

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

ans=0

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


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

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

if N[0]==N[1]==N[2]:
    ans=0

N.sort()
x=N[2]-N[1]
y=N[1]-N[0]

if x%2==1 and y%2==0:
    ans=y//2+x
elif x%2==1 and y%2==1:
    ans=(x+y)//2+(x+1)//2+1
elif x%2==0 and y%2==0:
    ans=x//2+(x+y)//2
else:
    ans=x//2+(x+y+1)//2+1

print(ans)