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):
A,B,C=sorted(map(int,input().split()))

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

Solution (Python):
ABC = list(map(int,input().split()))
ABC.sort(reverse=True)
ans = ABC[0] - ABC[1]
mnn = ABC[2] + ans
if (ABC[0] - mnn) % 2 == 0:
    ans += (ABC[0] - mnn)//2
else:
    ans += (ABC[0] - mnn)//2 + 2
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 A + 2 <= C:
        A += 2
    else:
        A += 1
        B += 1
    ans += 1

print(ans)

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

def solve(A, B, C):
    
    
    
    
    count = 0

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

    return count

print(solve(A, B, C))

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

max_number = max(abc)
abc.remove(max_number)
others = abc

count = 0
count += (max_number - max(others))

gap = (max_number - (min(others) + count))
if gap % 2 == 0:
  count += gap / 2
else: 
  count += ((gap + 1) / 2) + 1

print(int(count))

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

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

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

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

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

Solution (Python):
a,b,c = map(int,input().split())
x = max(a,b,c)
y = (x-a) + (x-b) + (x-c)
if y&1:
  y += 3
answer = y//2
print(answer)

Solution (Python):
a,b,c = map(int,input().split())
max_ = max([a,b,c])
ls = [a,b,c]

if ls[0]%2 == ls[1]%2 == ls[2]%2:
    cnt = 3*max_- sum(ls)
    print(int(cnt/2))


else:
    ls.remove(max_)
    if ls[0]%2 == ls[1]%2:
        cnt = 2*max_- sum(ls) -2
        print(int(cnt/2 +1))    
    else:
        cnt = 2*max_- sum(ls) + 1
        print(int(cnt/2 +1))

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

Solution (Python):
a, b, c = sorted([ int(v) for v in input().split() ])

if a % 2 == b % 2 and c % 2 == b % 2:
  print((c-a)//2+(c-b)//2)
else:
  if a % 2 == b % 2:
    a += 1
    b += 1
  elif b % 2 == c % 2:
    b += 1
    c += 1
  else:
    c += 1
    a += 1
  print((c-a)//2+(c-b)//2+1)

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

Solution (Python):

import sys


def solve(A: int, B: int, C: int):
    L = [A,B,C]
    L.sort()
    res = L[2]*2 - L[0] - L[1]
    if res % 2 == 1:
        res += 3

    print(res//2)




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):
a = list(map(int,input().split()))
ans = 0
a.sort()
while a[0]+2 <= a[2]:
  a[0] = a[0] + 2
  a.sort()
  ans += 1

if a[0] == a[1] and a[1] ==a[2]:
  print(ans)  
elif a[0] == a[1] and not a[1] == a[2]:
  print(ans+1)
else:
  print(ans+2)

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

Solution (Python):
inpt = map(int, raw_input().split())
inpt.sort()
A = inpt[0]
B = inpt[1]
C = inpt[2]
tmp1 = (C-A)/2
tmp2 = (C-B)/2
A += tmp1*2
B += tmp2*2
memo = []
queue = [[tmp1+tmp2, [A, B, C]]]
while queue != []:
	now = queue.pop(0)
	if now[1][0] == now[1][1] and now[1][0] == now[1][2]:
		print now[0]
		break
	next = []
	for i in range(0, 3):
		lst1 = [now[1][0], now[1][1], now[1][2]]
		lst2 = [now[1][0]+1, now[1][1]+1, now[1][2]+1]
		lst1[i] += 2
		lst2[i] -= 1
		next.append(lst1)
		next.append(lst2)
	for i in range(0, 6):
		if next[i] not in memo:
			queue.append([now[0]+1, next[i]])

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

Solution (Python):
num1, num2, num3 = input().split(" ")
numList = [int(num1),int(num2),int(num3)]
numList.sort(reverse=True)
maxNum = numList[0]
midNum = numList[1]
minNum = numList[2]

count = 0

if midNum % 2 == 0 and minNum % 2 == 0:
    count += (midNum - minNum) // 2
    count += (maxNum - midNum)
elif midNum % 2 == 1 and minNum % 2 == 1:
    if maxNum % 2 == 0:
        maxNum += 2
        midNum += 2
        midNum += 2
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
        count += 2
    else:
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
else:
    if midNum % 2 == 0:
        maxNum += 1
        minNum += 1
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
        count += 1
    else:
        maxNum += 1
        midNum += 1
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
        count += 1
print(count)

Solution (Python):
num1, num2, num3 = input().split(" ")
numList = [int(num1),int(num2),int(num3)]
numList.sort(reverse=True)
maxNum = numList[0]
midNum = numList[1]
minNum = numList[2]

count = 0
if maxNum % 2 == 0:
    if midNum % 2 == 0 and minNum % 2 == 0:
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
    elif midNum % 2 == 1 and minNum % 2 == 1:
        maxNum += 2
        midNum += 2
        midNum += 2
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
        count += 2
    else:
        if midNum % 2 == 0:
            maxNum += 1
            minNum += 1
            count += (midNum - minNum) // 2
            count += (maxNum - midNum)
            count += 1
        else:
            maxNum += 1
            midNum += 1
            count += (midNum - minNum) // 2
            count += (maxNum - midNum)
            count += 1
else:
    if midNum % 2 == 0 and minNum % 2 == 0:
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
    elif midNum % 2 == 1 and minNum % 2 == 1:
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
    else:
        if midNum % 2 == 0:
            maxNum += 1
            minNum += 1
            count += (midNum - minNum) // 2
            count += (maxNum - midNum)
            count += 1
        else:
            maxNum += 1
            midNum += 1
            count += (midNum - minNum) // 2
            count += (maxNum - midNum)
            count += 1
print(count)

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

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

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

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

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

m = max(A, B, C)
diff = (m - A) + (m - B) + (m - C)

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

print(ans)

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

lst.sort()

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

sa = (C-A) + (C-B)
if sa%2 == 1:
    ans = 1
    sa += 1
else:
    ans = 0

ans =ans + sa//2

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 a+2 <= c:
    a += 2
  else:
    a += 1
    b += 1
  ans += 1
print(ans)

Solution (Python):
A, B, C = map(int, input().split())
max_v = max(A,B,C)
temp = (max_v - A) + (max_v - B) + (max_v - C)
ans = 0

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

Solution (Python):

import sys


def solve(A: int, B: int, C: int):
    mx = max(A, B, C)
    tmp = 0
    tmp += mx - A
    tmp += mx - B
    tmp += mx - C
    if tmp % 2 == 0:
        ret = tmp // 2
    else:
        ret = (tmp + 3) // 2
    print(ret)
    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):

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

cnt = 0



while not(l[0] == l[1] == l[2]):
    l = sorted(l)
    
    if l[0]+2 <= l[2]:
        l[0] += 2
        cnt += 1
    
    else:
        l[0] += 1
        l[1] += 1
        cnt += 1

print(cnt)

Solution (Python):

a, b, c = sorted(list(map(int, input().rstrip().split())), reverse=True)
cnt = 0
while (a + b + c + cnt * 2) % 3 != 0 or (b + c + cnt * 2) / 2 < a:
    cnt += 1
print(cnt)

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

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

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

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

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

L=[A,B,C]
L=sorted(L)
ans+=L[2]-L[1] 
if (L[2]-L[0]-ans)%2==0:
    ans+=(L[2]-L[0]-ans)//2
else:
    ans+=(L[2]-L[0]-ans)//2
    ans+=2
print(ans)

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

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

print(ans)

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


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


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if self.parent[i] == i:
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if rooti < rootj:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)





def main():
    a, b, c = intin()

    abc = [a, b, c]
    abc.sort()
    ans = 0

    while len(set(abc)) != 1:
        if abc[1] < abc[2]:
            abc[0] += 1
            abc[1] += 1
            ans += 1
            continue
        if abc[0] < abc[1]:
            abc[0] += 2
            ans += 1
            continue
        if abc[0] > abc[1]:
            abc[1] += 1
            abc[2] += 1
            ans += 1
            continue

    print(ans)



if __name__ == '__main__':
    main()

Solution (Python):
import math
L = sorted(list(map(int,input().split(' '))))
A,B,C = L[0],L[1],L[2]
X = C - A
Y = C - B

if X % 2 == 0 and Y % 2 == 0:
  print(int(X/2 + Y/2))
elif X % 2 == 1 and Y % 2 == 1:
  print(int(abs(X-Y)/2 + min(X,Y)))
else:
  print(int(math.ceil(X/2)+math.ceil(Y/2) + 1))

Solution (Python):
import math

A, B, C = map(int, input().split())
N = [A, B, C]
N.sort()

minN = N[0]
midN = N[1]
maxN = N[2]
diff1 = maxN - midN
diff2 = maxN - minN

if (diff1 % 2 == 0 and diff2 % 2 == 0) or (diff1 % 2 != 0 and diff2 % 2 != 0):
    print((diff1 + diff2) // 2)
else:
    print(math.ceil((diff1 + diff2) / 2) + 1)

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

Solution (Python):

def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
Bar=IL()
Bar.sort()
ans=0
for i in range(2):
    while Bar[i]+2<=Bar[2]:
        Bar[i]+=2
        ans+=1
if Bar[0]==Bar[1] and Bar[1]==Bar[2]:
    print(ans)
elif Bar[0]==Bar[1]:
    print(ans+1)
else:
    print(ans+2)

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

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

Solution (Python):
a, b, c = map(int, input().split())
am, bm, cm = a%2, b%2, c%2
ans = 1

if am == bm and bm == cm:
    ans -= 1
elif am == bm and bm != cm:
    a += 1
    b += 1
elif bm == cm and cm != am:
    b += 1
    c += 1
elif cm == am and am != bm:
    c += 1
    a += 1

m = max(a, b, c)
ans += int((m-a)/2+(m-b)/2+(m-c)/2)
print(ans)

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)




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







a.sort()
s = 0
s+=a[2]-a[1]
a[1]+=s
a[0]+=s

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

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

k = A[0]
l = A[1]
m = A[2]

if (2*m - k - l) % 2 == 0:
    print(int(m - (l+k)/2))
else:
    print(int(1 + m - (l + k - 1)/2))

Solution (Python):
A, B, C = map(int,input().split())
li = [A,B,C]
count = 0
while li[0]!=li[1] or li[0]!=li[2] or li[1]!=li[2]:
    li.sort(reverse=True)
    if li[2]+2 < li[0]:
        count += 1
        li[2] += 2

    elif li[2]+1 <= li[0] and li[1]+1 <= li[0]:
        count += 1
        li[1] += 1
        li[2] += 1

    else:
        count += 1
        li[2] += 2

print(count)

Solution (Python):
import numpy as np

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

lst = sorted(lst, reverse=True)
lst_odd = list(map(lambda x: x%2, lst))
ans = 0




n_plus2_1 = (lst[0] - lst[1]) // 2
lst[1] += 2 * n_plus2_1
ans += n_plus2_1
n_plus2_2 = (lst[0] - lst[2]) // 2
lst[2] += 2 * n_plus2_2
ans += n_plus2_2


if lst.count(lst[0]) == 1:
  ans += 1
elif lst.count(lst[0]) == 2:
  ans += 2

print(int(ans))

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

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

Solution (Python):
S = [int(i) for i in input().split()]
S.sort()
A = S[2]
B = S[1]
C = S[0]

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

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

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

l = sorted([A, B, C])
c = 0
while l[1] != l[2]:
	
	c += 1
	l[0] += 1
	l[1] += 1



if (l[0] == l[1] == l[2]):
	print(c)
	exit()

print(c + (l[1] - l[0] + 1) // 2 + (l[1] - l[0]) % 2)

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

p = max(A)
ans = 0
flag = 1
for i in range(3):
    A[i] = abs(A[i]-p)
    if A[i]%2 == 0:
        ans += A[i]/2
    else:
        ans += (A[i]+1)/2+flag
        if flag:
            flag = 0
        else:
            flag = 1
            ans -= 2
print(int(ans))

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

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

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

Solution (Python):
a,b,c=map(int,input().split())
max_n=max([a,b,c])
diff=3*max_n-a-b-c

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

Solution (Python):

import bisect





def main():
    a, b, c = map(int, input().split())
    ans = 0
    data = [a, b, c]
    data.sort()
    while 1:
        if data[0] == data[1] and data[0] == data[2]:
            break
        if data[2] > data[1] and data[2] > data[0]:
            data[1] += 1
            data[0] += 1
        else:
            data[0] += 2
        ans += 1
        data.sort()

    print(ans)







if __name__ == '__main__':
    main()

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

counter = (b - a) // 2

if (b - a) % 2 == 1:
    counter += 1
    c += 1
    
counter += (c - b)

print(counter)

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

m = max(A)
l = []
for a in A:
    if a != m:
        l.append(m - a)

if len(l) == 0:
    print(0)
    exit()
if len(l) == 1:
    if l[0] % 2 == 0:
        print(l[0] // 2)
    else:
        print(l[0] // 2 + 2)
    exit()

l.sort()

ans = 0

tmp = l[1] - l[0]

if tmp % 2 == 0:
    ans += tmp // 2 + l[0]
else:
    ans += tmp // 2 + 2 + l[0]

print(ans)

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

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

abc = [A,B,C]
ieven = []
iodd = []
for i in range(3):
    if abc[i] % 2 == 0:
        ieven += [i]
    else:
        iodd += [i]
        
if len(ieven) == 3 or len(iodd) == 3:
    abc.sort()
    ans = (abc[2]-abc[1])//2 + (abc[2]-abc[0])//2
else:
    if len(ieven) > len(iodd):
        abc[ieven[0]] += 1
        abc[ieven[1]] += 1
        abc.sort()
        ans = 1 + (abc[2]-abc[1])//2 + (abc[2]-abc[0])//2
    else:
        abc[iodd[0]] += 1
        abc[iodd[1]] += 1
        abc.sort()
        ans = 1 + (abc[2]-abc[1])//2 + (abc[2]-abc[0])//2
        
print(ans)

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a = f()
    a = sorted(a, reverse = True)

    b = a[0] - a[1] 
    c = a[0] - a[2] 


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




solve()

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

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

x.sort()

a = x[0]
b = x[1]
c = x[2]

import math
tmp = []

def inc(i, j):
    if i % 2 == j % 2:
        return int((j - i) / 2)
    else:
        return int(math.ceil((j - i) / 2) + 1)


tmp.append(c - a + b - a)


tmp.append(inc(a, b) + c - b)


tmp.append(inc(a, c) + inc(b, c))

print(min(tmp))

Solution (Python):
nums = sorted(list(map(int,input().split())))
group1 = []
group2 = []
ans = 0
for i in range(3):
 if nums[i] % 2==0:
     group1.append(i)
 else:
     group2.append(i)
max_len = max(len(group1),len(group2))
if max_len != 3:
    ans += 1
    if len(group1) == 2:
        for i in group1:
            nums[i] += 1
    else:
        for i in group2:
            nums[i] += 1
ans += (nums[2]-nums[0])//2 + (nums[2]-nums[1])//2
print(ans)

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

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

counter = 0
while (l[0] != l[1]) or (l[1] != l[2]):
    mi = min(l)
    ma = max(l)
    
    if ma - mi < 2:
        c = len([v for v in l if v == mi])
        if c == 2:
            counter += 1
        else:
            counter += 2
        break
    else:
        counter += (ma - mi) // 2
        for i in range(3):
            if l[i] == mi:
                l[i] += (ma - mi) // 2 * 2
                break
    
print(counter)

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

for i in a:
    if i%2 == 0:
        temp.append(0)
    else:
        temp.append(1)
        
if temp.count(1) == 2:
    for i in range(len(a)):
        if temp[i] == 1:
            a[i] += 1
    ans +=1
elif temp.count(0) == 2:
    for i in range(len(a)):
        if temp[i] == 0:
            a[i] += 1
    ans +=1

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

print(ans)

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

m = max(a)
s = sum(a)

if (m * 3 - s) % 2 == 0:
    print((m * 3 - s) // 2)
else:
    print(((m + 1)*3 - s) // 2)

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

Solution (Python):


def read_input():
    a, b, c = map(int, input().split())
    return a, b, c


def submit():
    a, b, c = read_input()

    top = max(a, b, c)
    buttom = min(a, b, c)
    mid = a + b + c - top - buttom

    ones = top - mid
    doubles = (top - (buttom + ones)) // 2

    if (top - (buttom + ones)) % 2 == 0:
        print(ones + doubles)
    else:
        print(ones + doubles + 2)

if __name__ == '__main__':
    submit()

Solution (Python):
from math import ceil
A, B, C = map(int, input().split())
ABC = [A, B, C]
big = max(ABC)
smal = min(ABC)
mid = sum(ABC) - big - smal

ans = big - mid
smal += ans
if (big - smal) % 2 == 0:
    ans += (big - smal) / 2
else:
    ans += (big - smal) / 2 + 1.5
print(int(ans))

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

F = [
    lambda x:x,
    lambda x:[x[0]+1,x[1]+1,x[2]  ],
    lambda x:[x[0]  ,x[1]+1,x[2]+1],
    lambda x:[x[0]+1,x[1]  ,x[2]+1],
    lambda x:[x[0]+2,x[1]+1,x[2]+1],
    lambda x:[x[0]+1,x[1]+2,x[2]+1],
    lambda x:[x[0]+1,x[1]+1,x[2]+2]
    ]

T = [0,1,1,1,2,2,2]

o = []
for i in range(7):
    f = F[i]
    r = sorted(f([A,B,C]))
    if (r[2] - r[0])%2:
        continue
    if (r[2] - r[1])%2:
        continue
    o.append(T[i]+(r[2]-r[0])//2+(r[2]-r[1])//2)

print(min(o))

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

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

Solution (Python):
li = [int(x) for x in input().split()]
ans = 0
bar = 0
odd = []
for ind,i in enumerate(li):
    bar+=i%2
    if(i%2==1):
        odd.append(ind)
if(bar == 0 or bar == 3):
    ans = 0
elif(bar == 1):
    for ind,i in enumerate(li):
        if(not ind in odd):
            li[ind]+=1
    ans = 1
else:
    for ind,i in enumerate(li):
        if(ind in odd):
            li[ind]+=1
    ans = 1
li.sort()
ans += (2*li[2]-li[0]-li[1])//2
print(ans)

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

L.sort(reverse = True)
d0 = L[0]%2
d1 = L[1]%2
d2 = L[2]%2

S = 2*L[0]-L[1]-L[2]

if d1==d2:
    print(int(S/2))

else:
    print(int((S+1)/2+1))

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

count = 0
if (b - a) % 2 == 0:
    count += (b - a) // 2
else:
    count += (b + 1 - a) // 2 + 1

count += c - b

print(count)

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

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

Solution (Python):
def main():
	A, B, C = map(int,input().split())
	m = max(A, B)
	m = max(m, C)
	diff = 3*m - (A + B + C)
	ans = diff//2
	if diff % 2 == 1:
		ans += 2
	print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
ABC = list(map(int, input().split()))
max_num = max(ABC)
abs_list = [abs(max_num-i) for i in ABC]
if sum(abs_list) % 2 == 0:
        res = int(sum(abs_list) / 2)
else:
        res = int((sum(abs_list)) / 2) + 2

print(res)

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

tmp = 0
def calc(ABC, tmp):
        max_num = max(ABC)
        abs_list = [abs(max_num-i) for i in ABC]
        if all(i % 2 == 0 for i in abs_list):
                return int(sum(abs_list) / 2) + tmp
        else:
                cnt = 0
                for i, v in enumerate(abs_list):
                        if v % 2 == 0:
                                continue
                        else:
                                ABC[i] += 1
                                cnt += 1
                if cnt <= 1:
                        for i, v in enumerate(ABC):
                                if max_num == v:
                                        ABC[i] += 1
                                        break
                return calc(ABC, tmp+1)


                        

print(calc(ABC, 0))

Solution (Python):


a =[int(j) for j in input().split()]
a.sort()
if abs(a[0]-a[1])%2==0 and abs(a[2]-a[1])%2==0 and abs(a[2]-a[0])%2==0:
    cnt=0
    cnt+=(a[2]-a[1])//2 +(a[2]-a[0])//2
    
elif abs(a[0]-a[1])%2==0:
    cnt=1
    cnt+=(a[2]-a[1])//2 +(a[2]-a[0])//2

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

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

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

hoge.sort()

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

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

count = 0
oe = [A%2, B%2, C%2]

if sum(oe) == 2:
    count += 1
    if A%2 == 0:
        B += 1
        C += 1
    elif B%2 == 0:
        A += 1
        C += 1
    else:
        A += 1
        B += 1
elif sum(oe) == 1:
    count += 1
    if A%2 == 1:
        B += 1
        C += 1
    elif B%2 == 1:
        A += 1
        C += 1
    else:
        A += 1
        B += 1
lst = sorted([A, B, C])
count += int((lst[1] - lst[0]) / 2)
count += int(lst[2] - lst[1])
print(count)