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

def is_even(n):
  if n % 2 == 0:
    return True
  else:
    return False

def f(a,b,c_max):
  return (2 * c_max - a - b) // 2

num_even = sum(1 for n in nums if is_even(n))

if num_even == 0 or num_even == 3:
  result = f(*nums)
elif num_even == 1:
  if is_even(nums[2]):
    result = f(nums[0]+1, nums[1]+1, nums[2]) + 1
  else:
    result = f(nums[0], nums[1], nums[2]+1)+1
elif num_even == 2:
  if not is_even(nums[2]):
    result = f(nums[0]+1, nums[1]+1, nums[2]) + 1
  else:
    result = f(nums[0], nums[1], nums[2]+1)+1

print(result)

Solution (Python):

"""
Created on Wed Aug  8 12:24:08 2018

@author: Yuki
"""

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

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

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

Solution (Python):
import numpy as np

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



max_v = max(max(A, B), C)

res = 3 * max_v - (A + B + C)
if res % 2 == 0:
    f = int(res / 2)
    print(f)
else:
    res += 3
    f = int(res / 2)
    print(f)

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(10000)




def chkprint(*args):
    names = {id(v): k for k, v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))




def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]




dp = None


def main():
    t = 0
    A = li_input()

    while max(A) - min(A) > 1:
        t += 1
        A[A.index(min(A))] += 2

    if A.count(max(A)) == 2:
        t += 2
    elif A.count(max(A)) == 1:
        t += 1

    print(t)


main()

Solution (Python):
a, b, c = map(int, input().split())
cou = 0
abc = []
for i in a, b, c:
    m = (max(a, b, c) - i) // 2
    cou += m
    abc.append(2 * m + i)
if abc.count(max(abc)) == 2:
    cou += 2
elif abc.count(max(abc)) == 1:
    cou += 1


print(cou)

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

count = 0
while True:
	abc.sort()

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

print(count)

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

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

ABC = [A,B,C]

ans = 0

while 1:
    ABC.sort()
    
    if ABC[0] == ABC[1] and ABC[1] == ABC[2]:
        break
    
    elif ABC[0] == ABC[1]:
        ABC[0]+=1
        ABC[1]+=1
        
        ans += 1
        
    else:
        ABC[0] += 2
        
        ans += 1
        
print(ans)

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

Solution (Python):
a,b,c=map(int,input().split())
for i in range(max(a,b,c),1000):
    ans=3*i-(a+b+c)
    if 0<=ans and ans%2==0:
        print(ans//2)
        exit()

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

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

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

cnt = 0
while A!=B or B!=C or C!=A:
    A,B,C = sorted([A,B,C])
    
    if A==B:
        A += 1
        B += 1
        cnt += 1
        
    else:
        A += 2
        cnt += 1
        
print(cnt)

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

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

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

Solution (Python):
a,b,c = input().split()
nums = []
nums.append(a)
nums.append(b)
nums.append(c)

nums = list(map(int,nums))

nums.sort()
count = 0

while(not (nums[0]==nums[1] and nums[1]==nums[2])):
	if(nums[1] == nums[0]):
		sa = nums[2]-nums[1]
		nums[1] += sa
		nums[0] += sa
		count += sa
		break
	elif(nums[1] - nums[0] >= 2):
		nums[0] += 2
		count += 1
		nums.sort()

	elif(nums[1] - nums[0] ==1):
		sa = nums[2] - nums[1]
		nums[1] += sa
		nums[0] += sa
		count += sa
		nums[0] += 2
		count += 1
		nums.sort()

print(count)

Solution (Python):


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

    if (max(abc) % 2 == 0 and sum(abc) % 2 == 0) or (max(abc) % 2 != 0 and sum(abc) % 2 != 0):
        M = max(abc)
    else:
        M = max(abc) + 1

    print((3 * M - sum(abc)) // 2)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
from collections import defaultdict 
import sys,heapq,bisect,math,itertools,string

sys.setrecursionlimit(10**8)


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

aa = [A,B,C]
aa.sort()


ans = 0

while aa[2]-aa[0] > 1:
	aa[0] += 2
	ans += 1
	
	
while aa[2]-aa[1] > 1:
	aa[1] += 2
	ans += 1
	
nn = aa[2]*2 - aa[1] - aa[0]	
	
if nn == 2:
	print(ans+1)
elif nn == 1:
	print(ans+2)
else:
	print(ans)

Solution (Python):

a = []

A = input().split()
for f in range(0,3):
    a.append(int(A[f]))

c = 0


while a[0] != a[1] or a[1] != a[2] or a[0] != a[2]:
    a.sort()
    b = []
    for i in range(0,3):
        d = a[i]%2
        if d == 0:
            b.append("o")
        else:
            b.append("e")
    if b.count("o") == 3 or b.count("e") == 3:
        a[0] = a[0] +2
        c = c + 1
        continue
    elif b.count("o") == 2:
        n = b.index("e")
        if n == 2:
            a[0] = a[0] + 1
            a[1] = a[1] + 1
            c = c+1
        elif n == 0:
            a[2] = a[2] + 1
            a[1] = a[1] + 1
            c = c+1
        elif n == 1:
            a[0] = a[0] + 1
            a[2] = a[2] + 1
            c = c+1
    elif b.count("e") == 2:
        n = b.index("o")
        if n == 2:
            a[0] = a[0] + 1
            a[1] = a[1] + 1
            c = c+1
        elif n == 0:
            a[2] = a[2] + 1
            a[1] = a[1] + 1
            c = c+1
        elif n == 1:
            a[0] = a[0] + 1
            a[2] = a[2] + 1
            c = c+1        

print(c)

Solution (Python):

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

a = l[0]%2
b = l[1]%2
c = l[2]%2

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

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

Solution (Python):
a, b, c = list(map(int, input().split()))
ans = 0
if a%2==b%2==c%2:
  pass
elif a%2==b%2:
  a, b = a+1, b+1
  ans += 1
elif a%2==c%2:
  a, c = a+1, c+1
  ans += 1
else:
  b, c = b+1, c+1
  ans += 1

t = max(a, b, c)
ans += abs(t-a)//2+abs(t-b)//2+abs(t-c)//2
print(ans)

Solution (Python):
A, B, C = map(int, input().split())
A, B, C = sorted([A, B, C])
count1 = C - B
count2 = (C - (A + count1)) // 2
if A + count1 + count2 * 2 < C:
    count1 += 2
print(count1 + count2)

Solution (Python):


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

maxABC = max(ABC)
sumABC = sum(ABC)


if maxABC % 2 != sumABC % 2:
	
	maxABC += 1

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

print(ans // 2)

Solution (Python):


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


ABC.sort()

cnt = 0
while ABC[0] <= ABC[2] - 2:
	ABC[0] += 2
	cnt += 1
while ABC[1] <= ABC[2] - 2:
	ABC[1] += 2
	cnt += 1

if ABC[0] == ABC[1] == ABC[2]:
	print(cnt)
	exit()
elif ABC[0] == ABC[2] or ABC[1] == ABC[2]:
	cnt += 2
	print(cnt)
	exit()
elif ABC[0] == ABC[1]:
	cnt += 1
	print(cnt)
	exit()

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


def solve(m):
    ans = 0
    while True:
        m = sorted(m)
        if m[0] == m[1] == m[2]:
            print(ans)
            return

        if m[-1] >= m[0] + 2:
            m[0] += 2
            ans += 1
        else:
            m[0] += 1
            m[1] += 1
            ans += 1


solve(n)

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

a.sort()

n0 = abs(a[2]-a[0])//2 + abs(a[2]-a[1])//2
if a[2] % 2 == 1 and a[0] % 2 == 0 and a[1] % 2 == 0:
  n0 += 1
elif a[2] % 2 == 0 and a[0] % 2 == 1 and a[1] % 2 == 1:
  n0 += 2
elif a[2] % 2 == 1 and a[0] % 2 == 1 and a[1] % 2 == 1:
  pass
elif a[2] % 2 == 0 and a[0] % 2 == 0 and a[1] % 2 == 0:
  pass
else:
  n0 += 2
  
print(n0)

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

a.sort()

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

Solution (Python):
a,b,c  = map(int,input().split())
list_sort = sorted([a,b,c])
i = 0
while ((list_sort[0]!=list_sort[2]) and (list_sort[1]!=list_sort[2])):
    i += 1
    list_sort[0] = list_sort[0]+1
    list_sort[1] = list_sort[1]+1
import math
if (list_sort[1] - list_sort[0]) % 2 == 0:
    i += int((list_sort[1] - list_sort[0]) / 2)
else:
    i += math.floor((list_sort[1] - list_sort[0]) / 2)
    i += 2
print(i)

Solution (Python):
x = input().split()

a = int(x[0])
b = int(x[1])
c = int(x[2])
count = 0

x = [a,b,c]

Max = max(x)
x.remove(max(x))

if x[0]%2 != x[1]%2:
	Max += 1
	x[0] += 1
	count += 1

x = [Max - x[0], Max - x[1]]


count += sum(x)/2
print(int(count));

Solution (Python):
A, B, C = map(int, input().split())
ans = 0
while True:
	if A == B == C:
		break
	A, B, C = sorted([A, B, C])
	if C - A > 1:
		A += 2
	else:
		A += 1
		B += 1
	ans += 1
print(ans)

Solution (Python):

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

    a.sort()

    op0 = (a[2] - a[0])//2
    a[0] += 2 * op0

    op1 = (a[2] - a[1])//2
    a[1] += 2 * op1

    if a[0] == a[2] and a[1] == a[2]:
        print(op0+op1)
    elif a[0] < a[2] and a[1] == a[2]:
        print(op0+op1+2)
    elif a[0] == a[2] and a[1] < a[2]:
        print(op0+op1+2)
    elif a[0] < a[2] and a[1] < a[2]:
        print(op0+op1+1)


if __name__ == '__main__':
    main()

Solution (Python):
A, B, C = map(int, input().split())
ans = 0
while not A == B == C:
	A, B, C = sorted([A, B, C])
	if C - A > 1:
		A += 2
	else:
		A += 1
		B += 1
	ans += 1
print(ans)

Solution (Python):
A, B, C = map(int, input().split())
ans = 0
while not A == B == C:
	A, B, C = sorted([A, B, C])
	if C - A > 1:
		A += 2
	else:
		A += 1
		B += 1
	ans += 1
print(ans)

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

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

ct = 0
while True:
    if a.count(max(a)) == 3:
        break
    if max(a) == min(a) + 1 and a.count(max(a)) == 1:
        ct += 1
        break
    tmp = min(a)
    tmp += 2
    a.remove(min(a))
    a.append(tmp)
    ct += 1
print(ct)

Solution (Python):
A,B,C = (int(i) for i in input().split())

num = [A,B,C]
num.sort()

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

print(int(ans))

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

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

if sum_n % 2 == M % 2:
    print((M - sum_n) // 2)
else:
    print((M - sum_n) // 2 + 2)

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

Solution (Python):
a,b,c=map(int,input().split())
d=max(a,b,c)
ad=d-a
bd=d-b
cd=d-c
ope=0
ope+=int(ad/2)+int(bd/2)+int(cd/2)
if ad%2==0 and bd%2==0 and cd%2==0:
  print(ope)
elif ad%2 + bd%2 + cd%2 == 1:
  print(ope+2)
else:
  print(ope+1)

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

max_n = max(ls)


ls = list(map(lambda x:max_n-x, ls))

sum_n = sum(ls)

if sum_n % 2 == 0:
    print(sum_n//2)

else:
    print(sum_n//2 + 2)

Solution (Python):
A, B, C = map(int, input().split())
count = 0
while not A == B == C:
	A, B, C = sorted([A, B, C])
	if C - A > 1:
		A += 2
		count += 1
	else:
		A += 1
		B += 1
		count += 1
print(count)

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

x = c - b
y, z = divmod(b - a, 2)
print(x + y + z * 2)

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

def main():
    list = [A, B, C]
    list.sort()

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

    d = d1 + d2
    
    if d % 2 == 0:
        ans = d // 2
    else:
        ans = d // 2 + 2

    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
A,B,C = map(int, input().split())
d = [A,B,C]
d.sort()
n = 0
while d[0]+2 <= d[2]:
  d[0] += 2
  n += 1
while d[1]+2 <= d[2]:
  d[1] += 2
  n += 1
if d[0] == d[1] and d[0] != d[2]:
  print(n+1)
elif d[0] == d[1] and d[0] == d[2]:
  print(n)
else:
  print(n+2)

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

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

T = C*2 - A - B

if T%2 == 1:
  print(int(T/2)+2)

else:
  print(int(T/2))

Solution (Python):
n = list(map(int,input().split()))
counter = 0
while True:
	n = sorted(n)
	if n[2] - n[0] == 1:
		n[0] += 1
		n[1] += 1
		counter += 1
	if n[2] - n[0] > 1:
		n[0] += 2
		counter += 1
	if n[0] == n[1] == n[2]:
		break
print(counter)

Solution (Python):
A,B,C = map(int,input().split())
 
counter = 0
 
while not A == B == C:
    A,B,C = sorted([A,B,C])
    if C - A > 1:
        A += 2
        counter += 1
    else:
        A += 1
        B += 1
        counter += 1
        
print(counter)

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

Solution (Python):
S = list(map(int, input().split()))
M = max(S)
r = sum(M - i for i in S)
print((r + 3 * (r % 2)) // 2)

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

Solution (Python):
import math
def kaisuu(hoge):
	a = sorted(hoge)
	A = a[2]
	B = a[1]
	C = a[0]
	return math.floor(A-((B+C)/2))


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

count = 0
for i in X:
	if i % 2 == 0:
		count+=1

if count == 0 or count == 3:
	print(kaisuu(X))
elif count == 1:
	for i in range(3):
		if X[i] % 2 == 1:
			X[i]+=1
	print(kaisuu(X)+1)
else:
	for i in range(3):
		if X[i] % 2 == 0:
			X[i]+=1
	print(kaisuu(X)+1)

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

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

subd1 = num_list[0] - num_list[1]
subd2 = num_list[0] - num_list[2]

if subd1 % 2 == subd2 % 2:
    ret = (subd1+ subd2) // 2
else:
    ret = (subd1+ subd2 + 1) // 2 + 1

print(ret)

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

x = (a[1]-a[0])//2
y = (a[1]-a[0])%2
if y == 1:
    a[2]+=1
counter +=x+y
z = (a[2]-a[1])//2
s = (a[2]-a[1])%2
counter += (z*2)+s

print(int(counter))

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

if (N[1] - N[0])%2 == 0:
    result = int((N[1] - N[0])/2) + N[2] - N[1]

else:
    result = int((N[1] - N[0])/2) + N[2] - N[1] + 2 

print(result)

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

Solution (Python):
a = list(map(int, input().split()))
a.sort()
first, second, third = a[2], a[1], a[0]

x, y = first - second, first - third

res = 0
res += min(x, y) + abs(x - y) // 2

if abs(x - y) % 2 == 0:
    print(res)
else:
    print(res + 2)

Solution (Python):

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

X.sort()

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

print(ans)

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

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

Solution (Python):
a = list(map(int,input().split()))
a = [x-min(a) for x in a]
a.sort()
A = a[2]
B = a[1]
C = a[0]
if B%2 == 0:
    print(int(A-B/2))
else:
    print(int(A-(B-1)/2+1))

Solution (Python):
A,B,C=map(int,input().split())
saidai=max(A,B,C)
saishou=min(A,B,C)
count=0

if  saidai==saishou:
    print(0)
    exit()


if (saidai*3-(A+B+C))%2==0:
    count=int((saidai*3-(A+B+C))/2)
else:
    count=2+int((saidai*3-(A+B+C))/2)

print(count)

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

Solution (Python):
A, B, C = map(int, input().split())
min_v, med_v, max_v = sorted([A, B, C])
count = 0
i = 0
while i != 10:
    i += 1
    
    if min_v == med_v and med_v == max_v:
        print(count)
        break
    elif min_v != med_v and med_v != max_v and max_v != min_v:
        count += max_v - med_v
        min_v += max_v - med_v
        med_v = max_v
    elif min_v == med_v:
        count += max_v - med_v
        min_v = max_v
        med_v = max_v
    elif med_v == max_v and max_v - min_v != 1:
        count += int((max_v - min_v) / 2)
        min_v += int((max_v - min_v) / 2) * 2
    else:
        count += 1
        min_v = max_v
        max_v += 1

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

v1 = data[2] - data[1]
v2 = data[0] + v1

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

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

abc = sorted(abc)
ans = 0
while abc[0] != abc[2]:
    if abc[2] - abc[0] >= 2:
        abc[0] += 2
    else:
        abc[0] += 1
        abc[1] += 1
    abc = sorted(abc)
    ans += 1
print(ans)

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

B = [A[0]-min(A),A[1]-min(A),A[2]-min(A)]
B.sort()

ans = 0
if B[1] >= 2:
    ans += int(B[1] / 2)
    B[2] -= int(B[1] / 2) * 2
    B[1] %= 2

print(int(ans + sum(B)))

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

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

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

ope = 0

while T[1]!=T[0]:
    ope += 1
    T[1] += 1
    T[2] += 1
    
while T[2]<T[0]:
    ope += 1
    T[2] += 2

if T[0]==T[2]:
    print(ope)
    
else:print(ope+1)

Solution (Python):
import math
A, B, C = map(int, input().split(' '))
diff = max([A, B, C]) * 3 - A - B - C
if diff % 2 == 1:
    print(math.ceil(diff / 2) + 1)
else:
    print(math.ceil(diff / 2))

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

if __name__ == '__main__':
    main()

Solution (Python):
def abc093c():
    abc = sorted(list(map(int, input().split())))
    return abc[2] - abc[1] + (abc[1] - abc[0]) // 2 + 2 * ((abc[1] - abc[0]) % 2)


print(abc093c())

Solution (Python):
import numpy as np

n = np.array(list(map(int, input().split())))
neven = len(np.where(n % 2 == 0)[0])

if neven == 3 or neven == 0:
    n = np.sort(n)
    print(int((n[2] - n[1]) / 2 + (n[2] - n[0]) / 2))
elif neven == 2:
    no = n[n % 2 != 0]
    ne = n[n % 2 == 0]
    ne = ne + 1
    n = np.sort(np.concatenate([no, ne]))
    print(1 + int((n[2] - n[1]) / 2 + (n[2] - n[0]) / 2))
elif neven == 1:
    no = n[n % 2 != 0]
    ne = n[n % 2 == 0]
    no = no + 1
    n = np.sort(np.concatenate([no, ne]))
    print(1 + int((n[2] - n[1]) / 2 + (n[2] - n[0]) / 2))

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


odd_num = 0
for i in numbers:
    if i % 2 != 0:
        odd_num += 1

max_ = max(numbers)
numbers.remove(max_)
min_ = min(numbers)
numbers.remove(min_)
middle = numbers[0]

def even(a, b, c, count=0): 
    count += (c - b) // 2 + (c - a) // 2
    print(count)
    

if odd_num == 0:
    even(min_, middle, max_)


elif odd_num == 1:
    if max_ % 2 == 0:
        max_ += 1
    if middle % 2 == 0:
        middle += 1
    if min_ % 2 == 0:
        min_ += 1
    even(min_, middle, max_, 1)


elif odd_num == 2:
    if max_ % 2 != 0:
        max_ += 1
    if middle % 2 != 0:
        middle += 1
    if min_ % 2 != 0:
        min_ += 1
    even(min_, middle, max_, 1) 


else:
    even(min_, middle, max_)

Solution (Python):
def c_same_integers(A, B, C):
    
    
    
    m = max(A, B, C)
    initial_total = A + B + C  

    parity = 3 * m % 2 == initial_total % 2
    final_value = m if parity else m + 1  
    
    ans = (3 * final_value - initial_total) // 2
    return ans

A,B,C = [int(i) for i in input().split()]
print(c_same_integers(A, B, C))

Solution (Python):
l = list(map(int, input().split()))
count = 0
while True:
  if l[0] == l[1] == l[2]:
    print(count)
    break
  
  l = sorted(l)

  if l[1] == l[2] and not l[0] == l[1]:
    l[0] += 2
  else:
    l[0] += 1
    l[1] += 1
  
  count += 1

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

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

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

max_num = max(a,b,c)
diff = max_num * 3 - sum([a,b,c])

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

Solution (Python):
A, B, C = sorted(map(int, input().split()))
x, y = C - A, C - B
ans, a, b = x // 2 + y // 2, x % 2 == 1, y % 2 == 1
ans += (a & b) + 2*(a ^ b)
print(ans)

Solution (Python):
a = [int(i) for i in input().split()]
count = 0

def double_puls():
    a[0] += 1
    a[1] += 1
    

while True:
    a.sort()
    if a[0] == a[1] and a[1] == a[2]:
        break
    if a[2] >= a[1]+1:
        double_puls()
        count += 1
    elif a[1] == a[2]:
        a[0] += 2
        count += 1
    elif a[0] == a[1]:
        double_puls()
        count += 1

print(count)

Solution (Python):

a,b,c=map(int,input().split())
x=max(a,b,c)
total=a+b+c
for i in range(x,100):
    ans=3*i-total
    if ans%2==0:
        print(ans//2)
        exit()

Solution (Python):


x = [int(i) for i in input().split()]

x.sort()
a = x[0]
b = x[1]
c = x[2]

k = b-a
j = c-b

cnt = 0
cnt += j

if k % 2 == 0:
    cnt += k/2
else:
    cnt += k/2 +1.5
print(int(cnt))

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

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

Solution (Python):
def main():
    a = list(map(int, input().split()))
    a.sort()
    C,B,A = a
    AB = A-B
    AC = A-C
    if AB%2==0 and AC%2==0:
        return AB//2 + AC//2
    elif AB%2==1 and AC%2==1:
        return AB//2 + AC//2 + 1
    else:
        return AB//2 + AC//2 + 2


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

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

m = max(A, B, C)
num1 = min(A, B, C)
num2 = min(max(A, B), C) if A == num1 or B == num1 else min(max(B, C), A)
count = 0

if (m - num1) % 2 == (m - num2) % 2:
    if (m - num1) % 2 == 0:
        count += (m - num1) / 2
        count += (m - num2) / 2
    else:
        count += (m - num1) // 2
        count += (m - num2) // 2
        count += 1
    print(int(count))

else:
    if (m - num1) % 2 == 0:
        count += (m - num1) / 2
        count += (m - num2) // 2
        count += 2
    else:
        count += (m - num2) / 2
        count += (m - num1) // 2
        count += 2
    print(int(count))

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

Solution (Python):
mondai = input()

mondai = mondai.rstrip().split(" ")
kazu=[]
for i in range(3):
    if int(mondai[i])>=10:
        kazu.append(mondai[i])
        i +=1
    else:
        mondai[i]="0"+str(mondai[i])
        kazu.append(mondai[i])
        i +=1
kazu.sort(reverse=True)

sa1=int(kazu[0])-int(kazu[1])
sa2=int(kazu[0])-int(kazu[2])

if (int(kazu[1]) + int(kazu[2]))%2==0:
    print(int((int(sa1)+int(sa2))/2))
else:
    print(int((int(sa1)+int(sa2)-1)/2+2))

Solution (Python):
ns = [int(n) for n in input().split()]
ans = 0
while True:
    ns = sorted(ns)
    a = ns[0]
    b = ns[1]
    c = ns[2]
    if a == b and b == c:
        break
    elif a == b:
        if abs(a - c) >= 2:
            ns[1] = a + 2
        else:
            ns[0] = a + 1
            ns[1] = a + 1
        ans = ans + 1
    elif b == c:
        if abs(a - b) == 1:
            ans = ans + 2
            break
        else:
            ns[0] = a + 2
            ans = ans + 1
    else:
        ns[0] = a + 2
        ans = ans + 1
print(ans)

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

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

Solution (Python):
S = list(map(int, input().split()))
S.sort(reverse  = True)
A, B, C = S[0], S[1], S[2]

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

Solution (Python):
a , b, c = map(int,input().split())
aaa = [a,b,c]
m = max(a,b,c)
aaaa = list(sorted(aaa))
x = aaaa[0]
y = aaaa[1]
z = aaaa[2]
sousa = 0

if (3 * m) % 2 == (a + b + c) % 2:
    truemax = m    
else:
    truemax = m + 1
    
    
while x <= truemax:
    sousa = sousa + 1
    x = x + 2
    
while y <= truemax:
    sousa = sousa + 1
    y = y + 2
    
b = list(sorted([x,y,z]))

xx = b[0]
yy = b[1]
zz = b[2]
    
sousa = sousa + (3 * truemax -xx -yy -zz) //2
print(sousa)

Solution (Python):
a , b, c = map(int,input().split())
aaa = [a,b,c]
m = max(a,b,c)
aaaa = list(sorted(aaa))
x = aaaa[0]
y = aaaa[1]
z = aaaa[2]
sousa = 0

if (3 * m) % 2 == (a + b + c) % 2:
    truemax = m    
else:
    truemax = m + 1
    
    
while x <= truemax:
    sousa = sousa + 1
    x = x + 2
    
while y <= truemax:
    sousa = sousa + 1
    y = y + 2
    
b = list(sorted([x,y,z]))

xx = b[0]
yy = b[1]
zz = b[2]
    
sousa = sousa + (3 * truemax -xx -yy -zz) //2
print(sousa)

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

Solution (Python):
m = list(map(int, input().split()))
A = m[0]
B = m[1]
C = m[2]

ans = 0
m.sort()

while (m[0] != m[1] and m[0] != m[1] - 1):
    m[0] += 2
    ans += 1

if m[0] == m[1]:
    ans += m[2] - m[1]
else:
    m[0]+=1
    m[2]+=1
    ans+=1
    ans += m[2] - m[1]

print(ans)

Solution (Python):
numList = input().split()
numList = list(map(int, numList))
commandList = [
	[2,0,0],
	[0,2,0],
	[0,0,2],
	[0,1,1],
	[1,0,1],
	[1,1,0]
]
numListList = [numList]

def search(depth):
	global numListList
	tmpList = []
	for numList in numListList:
		for command in commandList:
			sumedList = sumList(numList, command)
			if check(sumedList, depth+1):
				return
			tmpList.append(sumedList)
	numListList = tmpList
	search(depth+1)

def sumList(list1, list2):
	return [list1[0]+list2[0], list1[1]+list2[1], list1[2]+list2[2]]

def check(numList, count):
	if numList[0] == numList[1] and numList[1] == numList[2]:
		print(count)
		return True

	if numList[0] == numList[1]:
		return check2(numList[0], numList[2], count)

	if numList[1] == numList[2]:
		return check2(numList[1], numList[0], count)

	if numList[0] == numList[2]:
		return check2(numList[0], numList[1], count)

	return False

def check2(num1, num2, count):
	if num1 > num2:
		if (num1-num2)%2 == 0:
			print(int(count+(num1-num2)/2))
			return True
		else:
			print(int(count+(num1-num2)/2)+2)
			return True
	else:
		print(int(count+(num2-num1)))
		return True

if check(numList, 0):
	pass
else:
	search(0)