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

int_list_min = sorted(int_list)

max_diff = int_list_min[2] - int_list_min[0]
min_diff = int_list_min[2] - int_list_min[1]
ans = 0

if (max_diff + min_diff)%2 == 1:
    ans += 1
    min_diff += 1

ans += (max_diff - min_diff)//2 + min_diff
print(ans)

Solution (Python):



import sys

ls = list(map(int, input().split()))
ls.sort()
cnt = 0

for i in [0, 1]:
    c = (ls[2] - ls[i]) // 2
    cnt += c
    ls[i] += 2 * c


if (ls[0] == ls[1]) & ((ls[2] - 1) == ls[1]):
    cnt += 1
elif (ls[0] == (ls[2] - 1)) | (ls[1] == (ls[2] - 1)):
    cnt += 2

print(cnt)

Solution (Python):
def solve(a,b,c):
	ans = 0
	if (a&1) != (b&1) and (a&1) != (c&1):
		ans += 1
		b += 1
		c += 1
	elif (b&1) != (a&1) and (b&1) != (c&1):
		ans += 1
		a += 1
		c += 1
	elif (c&1) != (a&1) and (c&1) != (b&1):
		ans += 1
		a += 1
		b += 1

	return ans + (c-b)//2 + (c-a)//2

print(solve(*sorted(map(int,input().split()))))

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

mval = lst[-1]
sval = sum(lst)
cn = mval + (sval-mval) % 2
n = (cn * 3 - sval) // 2
print(n)

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

mval = max(lst)
sval = sum(lst)
cn = mval + (sval-mval) % 2
n = (cn * 3 - sval) // 2
print(n)

Solution (Python):
import numpy as np


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


vals = np.array([A, B, C])
vals = np.sort(vals)

sumval = vals.sum()



cn = vals[-1] + np.sum(vals[:2]) % 2

n = (3 * cn - sumval) // 2

print(n)

Solution (Python):
a,b,c = map(int,input().split())
ans = 100000
for i in range(-10,60):
    cnt = 0
    for x in [a,b,c]:
        while(x < i):
            x += 2
            cnt += 1
        cnt += x-i
    ans = min(ans,cnt)
print(ans)

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

n = abs(max - b) + abs(max - c) + abs(max - a)
if n % 2 == 0:
    print(n//2)
else:
    print((n+3) // 2)

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

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

Solution (Python):
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

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

Solution (Python):
ABC = list(map(int, input().split()))
odds = [x for x in ABC if x % 2]
evens = [x for x in ABC if x % 2 == 0]

ans = 0
if len(odds) == 2:
    odds[0] += 1
    odds[1] += 1
    ans += 1
elif len(evens) == 2:
    evens[0] += 1
    evens[1] += 1
    ans += 1
ABC = sorted(odds + evens)
ans += (ABC[2] - ABC[0]) // 2 + (ABC[2] - ABC[1]) // 2
print(ans)

Solution (Python):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq

abc = lma()
abc.sort()
b = abc[2] - abc[0]
c = abc[2]  -abc[1]
if b%2 == 0 and c%2 == 0:
    ans = b//2+c//2
elif b%2==1 and c%2 ==1:
    ans = (b-1)//2 + (c-1)//2 +1
else:
    ans = b//2 + c//2 +2   
print(ans)

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    ans = 0
    a, b, c = map(int, input().split())
    if a%2 != c%2 and b%2 != c%2:
        ans += 1
        a += 1
        b += 1
    elif b%2 != a%2 and c%2 != a%2:
        ans += 1
        b += 1
        c += 1
    elif c%2 != b%2 and a%2 != b%2:
        ans += 1
        c += 1
        a += 1
    a, b, c = sorted([a, b, c])
    ans += (c-a) // 2
    ans += (c-b) // 2
    print(ans)


if __name__ == '__main__':
    main()

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

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

A.sort()
a_max = A[2]
a_middle = A[1]
a_min = A[0]
ans = 0

if sum(A)%2 != (3*a_max)%2: 
    ans += 1
    a_max += 1
    a_middle += 1

ans += a_max-a_middle
ans += (a_max-(a_min+(a_max-a_middle)))//2

print(ans)

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

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

ans = 0

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

Solution (Python):

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

lst.sort()
count = 0
while len(set(lst)) != 1:
    for i in range(len(lst)-2):
        if lst[i] <= lst[i+1]-2:
            lst[i] += 2
        elif lst[i] <= lst[i+2] and lst[i+1] <= lst[i-1]:
            lst[i] += 1
            lst[i+1] += 1
    count += 1
    lst.sort()
    
print(count)

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

cnt = 0

cnt += N[2] - N[1]
x, y = divmod(N[1] - N[0], 2)
cnt += x + y * 2

print(cnt)

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

count = 0

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

while A!= B or B!= C or C!= A:
  if(C- A>= 2):
    lista[0]+= 2
  else:
    lista[0]+= 1
    lista[1]+= 1
  lista.sort()
  A = lista[0]
  B = lista[1]
  C = lista[2]
  count+= 1
  
print(count)

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

Solution (Python):
L = sorted(list(map(int, input().split())))
cnt = 0
while L[0]<L[2]-2:
    cnt+=1
    L[0]+=2
while L[1]<L[2]-2:
    cnt+=1
    L[1]+=2
if L[0]%2 == L[1]%2 and L[1]%2 == L[2]%2:
    if(L[0]<L[2]):
        cnt += 1
    if(L[1]<L[2]):
        cnt += 1
else:
    if L[0]==L[1]:
        cnt+=1
    elif L[1]==L[2]: 
        cnt+=2
    else:
        cnt+=3


print(cnt)

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

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

m = max(a, b, c)
sub = 3 * m - a - b - c

if sub % 2 != 0:
    sub += 3

print(sub // 2)

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

D.sort()

A=D[2]-D[1]
D[1]+=A
D[0]+=A
result=A

if (D[1]-D[0])%2==0:
    result+=(D[1]-D[0])//2
else:
    result+=(D[1]-D[0])//2+2

print(result)

Solution (Python):
l = list(map(int, input().split()))
ref = max(l)*3 - sum(l)

if ref%2 == 0:
    ans = ref//2
else:
    ans = ref//2 + 2

print(ans)

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

Solution (Python):
X = [int(x) for x in input().split()]
list.sort(X,reverse=True)
A,B,C = X[0],X[1],X[2]
count = 0

while A!=B or B!=C or C!=A:
    if (B-C)%2 == 1 and A==B:
        A=A+1
        B=B+1
        count = count + 1
    elif B!=C and (B-C)%2 == 0:
        while B!=C:
            C = C + 2
            count = count + 1
    else:
        B = B + 1
        C = C + 1
        count = count + 1

print(count)

Solution (Python):



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


def main():
    m = max(A, B, C)
    s = sum([m - A, m - B, m - C])
    ans = (s + 1) // 2
    if s % 2 == 1:
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

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

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

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

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

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

count = 0
while not (a == b == c):
    count += 1
    a, b, c = sorted([a, b, c])
    if a == b:
        a += 1
        b += 1
    else:
        a += 2
print(count)

Solution (Python):
def solve():
    A = list(map(int, input().split()))
    A.sort(reverse=True)
    diff_0_1 = A[0] - A[1]
    A[1] += diff_0_1
    A[2] += diff_0_1
    cnt = diff_0_1

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

if __name__ == '__main__':
    solve()

Solution (Python):

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

Solution (Python):


import numpy as np
a,b,c = map(int,input().split())
L = np.array([a,b,c])
d = (L%2).sum()

def calc(a,b,c):
    e = a+b+c
    max1 = max(a,b,c)
    min1 = min(a,b,c)
    mid = e - max1 - min1
    return (max1*2 - mid - min1)//2
    
if d == 3 or d == 0:
    print(calc(a,b,c))
elif d == 1:
    if a%2 ==1:
        b +=1
        c +=1
        print(calc(a,b,c)+1)
    elif b%2 == 1:
        a +=1
        c +=1
        print(calc(a,b,c)+1)
    elif c%2 == 1:
        a +=1
        b +=1
        print(calc(a,b,c)+1)
elif d == 2:
    if a%2 == 0:
        b +=1
        c +=1
        print(calc(a,b,c)+1)
    elif b%2 == 0:
        a +=1
        c +=1
        print(calc(a,b,c)+1)
    elif c%2 == 0:
        a +=1
        b +=1
        print(calc(a,b,c)+1)

Solution (Python):
A = list(map(int, input().split()))
A.sort()
ans = 0
count = [0, 0]
for a in A:
    if a & 1:
        count[1] += 1
    else:
        count[0] += 1
if (count[0] == 0)or(count[1] == 0):
    m = A[2]
    ans += (3*m-sum(A))
    ans //= 2
else:
    if (A[1]-A[0]) & 1:
        m = A[2]+1
        ans += (3*m-sum(A))
        ans //= 2
    else:
        m = A[2]
        ans += (3*m-sum(A))
        ans //= 2
print(ans)

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

if __name__ == '__main__':
    main()

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

Solution (Python):
A, B, C = sorted(map(int, input().split()))
a,b=divmod(2*C-A-B,2)
print(a+b*2)

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect


class Scanner():
    def int():
        return int(sys.stdin.readline().rstrip())

    def string():
        return sys.stdin.readline().rstrip()

    def map_int():
        return [int(x) for x in Scanner.string().split()]

    def string_list(n):
        return [input() for i in range(n)]

    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    def roundUp(a, b):
        return -(-a // b)

    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    def toLowerMultiple(a, x):
        return (a // x) * x

    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


MOD = int(1e09) + 7


def main():
    
    A, B, C = Scanner.map_int()
    ans = 0
    if not A % 2 == B % 2 == C % 2:
        ans += 1
        if A % 2 == B % 2:
            A += 1
            B += 1
        elif B % 2 == C % 2:
            B += 1
            C += 1
        else:
            A += 1
            C += 1
    D = max(A, B, C)
    ans += (D-A)//2
    ans += (D-B)//2
    ans += (D-C)//2
    print(ans)


if __name__ == "__main__":
    main()

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

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

count=numSort[2]-numSort[1]
count+=(numSort[2]-(numSort[0]+count))/2
count=int(count) if count.is_integer() else int(count+1.5)

print(count)

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

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

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

Solution (Python):
def examC():
    ABC = LI(); ABC.sort()
    judge = ABC[2]*2-ABC[1]-ABC[0]
    ans = judge//2 + (judge%2)*2
    print(ans)
    return

def examD():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = 10**18

if __name__ == '__main__':
    examC()

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

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

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

print(ans)

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

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

Solution (Python):
a,b,c=sorted(list(map(int,input().split())))
cnt=0
while b<c:
    a+=1
    b+=1
    cnt+=1
while a<c:
    a+=2
    cnt+=1
print(cnt if a==c else cnt+1)

Solution (Python):

import sys


def solve(A: int, B: int, C: int):
    a = sorted([A, B, C])
    o = sum([x & 1 for x in a])
    c = 0 < o and o < 3
    if o == 2:
        for i in range(3):
            a[i] += a[i] & 1
    elif o == 1:
        for i in range(3):
            a[i] += 1 - (a[i] & 1)
    print((2*a[2] - a[1] - a[0]) // 2 + c)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    solve(A, B, C)

if __name__ == '__main__':
    main()

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

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

    abc.sort()

print(ans)

Solution (Python):
import numpy as np

abc = np.array([int(a) for a in input().split()])
abc = abc - np.array([np.min(abc)] * 3)
abc = np.sort(abc)
ans = 0
if abc[1] == 0:
    ans = abc[2]
elif abc[1] % 2 == 0:
    ans += abc[1] // 2
    ans += abc[2] - abc[1]
else:
    ans += 1
    abc[0] += 1
    abc[2] += 1
    ans += (abc[1] - abc[0]) // 2
    ans += abc[2] - abc[1]
print(ans)

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

Solution (Python):
A, B, C = map(int, input().split())
maximam = max(A, B, C)
count = (maximam-A)//2 + ( maximam-B)//2 + (maximam-C)//2
A +=((maximam-A)//2*2)
B +=((maximam-B)//2*2)
C +=((maximam-C)//2*2)
if A==B and B == C:
  print(count)
elif (A==B and A==maximam) or (C==B and C==maximam) or (A==C and C==maximam):
  print(count+2)
else:
  print(count+1)

Solution (Python):
A, B, C = map(int, input().split())
c = 0
if A == B == C:
  print(0)
else:
  while(True):
    if max(A, B, C) >= 2 + min(A, B, C):
      A, B, C = max(A, B, C), A + B + C - max(A, B, C) - min(A, B, C), min(A, B, C) + 2
    else:
      A, B, C = max(A, B, C), A + B + C - max(A, B, C) - min(A, B, C) + 1, min(A, B, C) + 1
    c += 1
    if A == B == C:
      break
  print(c)

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

Solution (Python):
a,b,c=map(int,input().split())
ans=0
while 1:
    if a==b and b==c:
        print(ans)
        break
    ans+=1
    if a==min(a,b,c):
        a+=1
        if a==min(a,b,c):
            a+=1
        elif b==min(a,b,c):
            b+=1
        else :
            c+=1
    elif b==min(a,b,c):
        b+=1
        if a==min(a,b,c):
            a+=1
        elif b==min(a,b,c):
            b+=1
        else :
            c+=1
    else :
        c+=1
        if a==min(a,b,c):
            a+=1
        elif b==min(a,b,c):
            b+=1
        else :
            c+=1

Solution (Python):


import copy
import sys
import math


tmp = input().split()
a,b,c = list(map(lambda a: int(a), tmp))

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

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

dif = 3*max_l - sum_l
if dif % 2 == 0:
    print(dif // 2)
else:
    print((dif // 2) + 2)

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

C -= A
B -= A
ans = 0
ans += C%2
C -= C%2
ans += B%2
B -= B%2
ans += 2*(C//2)
ans -= B//2
print(ans)

Solution (Python):
a, b, c = map(int, input().split())
a1 = max(a,b,c)
c1 = min(a,b,c)
b1 = a+b+c-a1-c1

if b1%2 ==c1%2:
    print(int((2*a1-c1-b1)/2))
else:
    print(int((2*(a1+1)-c1-b1)/2)+1)

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

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

Solution (Python):
X,Y,Z=sorted(list(map(int,input().split(' '))))
print((Z-Y)+(Y-X)//2+2*((X-Y)%2))

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


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

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

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())

A, B, C = sorted([A, B, C])

x = C - B
y = C - A
def func(x, y):
  return ((y-x)//2 + x)

if ((x-y) % 2) == 1:
  print(1 + func(x, y+1))
else:
  print(func(x, y))

Solution (Python):
tin = [int(i) for i in input().split(' ') ]
A,B,C = tin[0],tin[1],tin[2]
if (A+B+C - max(A,B,C)) % 2 == 0:
  print(int((3*max(A,B,C) - A - B - C)/2))
else:
  print( int( (3*max(A,B,C) - A - B - C - 1)/2 + 2 ) )

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

c=a[0]%2+a[1]%2+a[2]%2
ans=0
if(c==0 or c==3):
    ans+=a[2]-a[0]+a[2]-a[1]
    ans//=2
else:
    if(c==1):
        for i in range(3):
            if(a[i]%2==0):
                a[i]+=1
    elif(c==2):
        for i in range(3):
            if(a[i]%2!=0):
                a[i]+=1
    ans+=1
    ans+=(a[2]-a[0]+a[2]-a[1])//2

print(ans)

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


parity=list(map(lambda x: x % 2,[a,b,c]))

if len(set(parity))==1:
    print(int((3*max(a,b,c)-a-b-c)/2))
else:
    if (b-a)%2==0:
        ex=1
    else:
        ex=2
    print(int((max(a,b,c)-a)/2)+int((max(a,b,c)-b)/2)+int((max(a,b,c)-c)/2) + ex)

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

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

Solution (Python):
temp = list(map(int, input().split()))
temp.sort()
a, b, c = temp[0], temp[1], temp[2]
count = 0

while(c - b > 1):
    b += 2
    count += 1

while(b - a > 1):
    a += 2
    count += 1

if a == b == c: print(count)
elif c - b == 1 and b - a == 1: print(count + 3)
elif c - b == 1 and b - a == 0: print(count + 1)
else: print(count + 2)

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

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

nums.sort()

ans = 0
while nums[0] != nums[-1]:
    if nums[0] < nums[1]:
        nums[0] += 2
    else:
        nums[0] += 1
        nums[1] += 1
    ans += 1
    nums.sort()
print(ans)

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

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

Solution (Python):
ABC = map(int, raw_input().split())
max_num = max(ABC)
res = 0
rest = 0
for v in ABC:
    res += (max_num - v) / 2
    rest += (max_num - v) % 2
sum_num = max_num * 3 - rest
while sum_num % 3 != 0:
    sum_num += 2
    res += 1
print res

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

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

ret = 0

m = A % 2 + B % 2 + C % 2

if m == 3 or m == 0:
    pass
else:
    ret += 1
    if m == 2:
        if A % 2 == 0:
            B += 1
            C += 1
        elif B % 2 == 0:
            A += 1
            C += 1
        else:
            A += 1
            B += 1
    else:
        if A % 2 == 1:
            B += 1
            C += 1
        elif B % 2 == 1:
            A += 1
            C += 1
        else:
            A += 1
            B += 1

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

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


if __name__ == '__main__':
    main()

Solution (Python):
def inpl(): return [int(i) for i in input().split()]
C, B, A = sorted(inpl())
if (B-C)%2 == 0:
    print((2*A -B -C)//2)
else:
    print((2*A -B -C +3)//2)

Solution (Python):
def inpl(): return [int(i) for i in input().split()]
A, B, C = inpl()
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 == 0:
    print((2*A -B -C)//2)
else:
    print((2*A -B -C +3)//2)

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

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

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

count = 0
while B - A >= 2 or C - A >= 2:
    A += 2
    count += 1

while A - B >= 2 or C - B >= 2:
    B += 2
    count += 1

while B - C >= 2 or A - C >= 2:
    C += 2
    count += 1


t = sorted([A, B, C])
if t[0] == t[2]:
    print(count)
elif t[0] == t[1]:
    print(count + 1)
else:
    print(count+2)

Solution (Python):
N=1
for t in range(N):
    x, y, z = list(map(int, input().split()))
    if (x == y and y == z):
        print(0)
        continue
    cost = 0
    l = sorted([x, y, z])

    cost += (l[2] - l[1])

    a = l[0] + l[2] - l[1]

    if (l[2] - a)%2 == 0:
        cost += (l[2] - a)//2
    else:
        cost += ((l[2] - a)//2 + 2)

    print(cost)

Solution (Python):

t=1
for i in range(t):
	x,y,z=map(int,input().split())
	ma=max(x,y,z)
	mi=min(x,y,z)
	if(x==ma):
		if(y<z):
			m=x-y
			n=x-z
		else:
			m=x-z
			n=x-y
	elif(y==ma):
		if(x<z):
			m=y-x
			n=y-z
		else:
			m=y-z
			n=y-x
	else:
		if(x<y):
			m=z-x
			n=z-y
		else:
			m=z-y
			n=z-x
	ans=n+(m-n)//2
	if((m-n)%2==1):
		ans+=2
	print(ans)

Solution (Python):
def noofrupees(x,y,z):
    if(x==y and x==z):
        return 0
    elif(x==y):
        if(x<z):
            return z-x
        else:
            if(x%2==0 and z%2==0):
                return int((x-z)/2)
            elif(x%2!=0 and z%2!=0):
                return int((x-z)/2)
            else:
                z = z-1
                return int((x-z)/2)+1
    elif(x==z):
        if(x<y):
            return y-x
        else:
            if(x%2==0 and y%2==0):
                return int((x-y)/2)
            elif(x%2!=0 and y%2!=0):
                return int((x-y)/2)
            else:
                y = y-1
                return int((x-y)/2)+1
    elif(y==z):
        if(y<x):
            return x-y
        else:
            if(y%2==0 and x%2==0):
                return int((y-x)/2)
            elif(y%2!=0 and x%2!=0):
                return int((y-x)/2)
            else:
                x = x-1
                return int((y-x)/2)+1
    

t=1;
for v in range(t):
    x,y,z = map(int,input().split())
    if(x!=y and x!=z and y!=z):
        list1 = [x,y,z]
        list1.sort()
        s = list1[2] - list1[1]
        list1[0]+=s
        list1[1]+=s
        print(s+noofrupees(list1[0],list1[1],list1[2]))
    else:
        print(noofrupees(x,y,z))

Solution (Python):
N=1
for t in range(N):
    x, y, z = list(map(int, input().split()))
    if (x == y and y == z):
        print(0)
        continue
    cost = 0
    l = sorted([x, y, z])

    cost += (l[2] - l[1])

    a = l[0] + l[2] - l[1]

    if (l[2] - a)%2 == 0:
        cost += (l[2] - a)//2
    else:
        cost += ((l[2] - a)//2 + 2)

    print(cost)

Solution (Python):

lis = []
N=1
for T in range(N):
	c = list(map(int, input().split()))
	maxi = max(c)
	sum = 0
	for i in c:
		sum = sum + (maxi - i)
	if sum%2 == 0:
		lis.append(sum//2)
	else:
		lis.append((sum+3)//2)
for i in lis:
	print(i)

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

Solution (Python):
def ans(a,b,c):
    return c - (a + b) / 2

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

odd = 0
even = 0

for i in range(3):
    if l[i] % 2 == 0:
        even = even + 1
    else:
        odd = odd + 1

if abs(even - odd) == 3:
    l.sort()
    print(int(ans(l[0], l[1], l[2])))

elif even - odd == 1:
    for i in range(3):
        if l[i] % 2 == 0:
            l[i] = l[i] + 1
    
    l.sort()
    print(int(1 + ans(l[0], l[1], l[2])))

elif odd - even == 1:
    for i in range(3):
        if l[i] % 2 == 1:
            l[i] = l[i] + 1
    
    l.sort()
    print(int(1 + ans(l[0], l[1], l[2])))

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

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

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

a.sort()
B=a[1]
A=a[0]
C=a[2]
count=0
if (B-A)%2==0:
    count+=(B-A)/2
else:
    count+=(B-A+1)/2+1

count+=C-B

print count

Solution (Python):

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

hoge = l[2] - l[1]
ans = hoge

l[0] += hoge
fuga = l[2] - l[0]

if fuga % 2 == 0:
    ans += fuga // 2
else:
    ans += fuga // 2 + 2

print(ans)

Solution (Python):
x = list(map(int,input().split()))
x.sort()
a = x[2]-x[0]
b = x[2]-x[1]

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

Solution (Python):

a,b,c = sorted([int(x) for x in input().split()])
ret = (c-a)//2 + (c-b)//2
a = a + 2*((c-a)//2)
b = b + 2*((c-b)//2)

if a==b and b==c:
    print(ret)
elif a<c and b<c:
    print(ret+1)
else:
    print(ret+2)