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

ans = 50 * 10

for i in range(-100, 101):
  if a > i:
    ac = abs(a - i)
  else:
    ac = (abs(a - i) - 1) // 2 + 1 + abs(a - i) % 2 

  if b > i:
    bc = abs(b - i)
  else:
    bc = (abs(b - i) - 1) // 2 + 1 + abs(b - i) % 2 
    
  if c > i:
    cc = abs(c - i)
  else:
    cc = (abs(c - i) - 1) // 2 + 1 + abs(c - i) % 2 

  ans = min(ans, ac + bc + cc)
  
print(ans)

Solution (Python):
a, b, c = map(int, input().split())
max_value = max(a, b, c)
l = []
d = [a, b, c]
ans = 0
for i in d:
    if max_value-i != 0:
        l.append(max_value-i)
if len(l) == 0:
    print(ans)
    exit()
if len(l) == 1:
    if l[0] % 2 == 0:
        ans = l[0]//2
        print(ans)
        exit()
    else:
        ans = l[0]//2 + 2
        print(ans)
        exit()
if len(l) == 2:
    if sum(l) % 2 == 0:
        print(sum(l)//2)
        exit()
    if sum(l) % 2 == 1:
        print(sum(l)//2+2)
        exit()

Solution (Python):

def resolve():
    L=list(map(int,input().split()))
    LL=[0]*len(L)
    for i in range(len(L)):
        LL[i]=L[i]%2
    val=0
    if sum(LL)==0 or sum(LL)==3:
        for i in range(len(L)):
            val+=max(L)-L[i]
        val//=2
    elif sum(LL)==1:
        for i in range(len(LL)):
            if LL[i] == 0:
                L[i]+=1
        for i in range(len(L)):
            val += max(L) - L[i]
        val//=2
        val+=1
    else:
        for i in range(len(LL)):
            if LL[i] == 1:
                L[i]+=1
        for i in range(len(L)):
            val += max(L) - L[i]
        val//=2
        val+=1


    print(val)


resolve()

Solution (Python):
def main():
    num = list(map(int, input().split()))
    max_num = max(num)
    answer = 0
    for i in range(3):
        answer += (max_num - num[i]) // 2
        num[i] += ((max_num - num[i]) // 2) * 2
    num.sort()
    if num[0] == num[1] and num[1] != num[2]:
        answer += 1
    elif num[1] == num[0] + 1:
        answer += 2
    print(answer)


if __name__ == '__main__':
    main()

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

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

A, B, C = sorted((A, B, C))
ans = 0

if sum([C % 2 == a % 2 for a in (A, B, C)]) == 2:
    ans += 1
    if A % 2 == C % 2:
        A += 1
    else:
        B += 1
    C += 1

ans += sum([C - a for a in (A, B, C)]) // 2
print(ans)

Solution (Python):
a, b, c = map(int, input().split())
l = [a, b, c]
l.sort()
ans = l[2]-l[1]
l_ = [l[0]+ l[2]-l[1], l[2], l[2]]

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

print(ans)

Solution (Python):
a,b,c=map(int, input().split())
mx=max((a,b,c))
sm=sum((a,b,c))
d=mx*3-sm
print((d+3)//2 if d&1 else d//2)

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

sum = (a+b+c)

if a == b == c:
    print(0)
    exit()
else:
    for i in range(max(a,b,c)*3, 200, 3):
        if (i - sum) % 2 == 0:
            print((i - sum)//2)
            exit()

Solution (Python):
def main():
    A = [int(i) for i in input().split()]
    A.sort()
    B = [A[2]-A[0], A[2]-A[1]]
    ans = 0
    if all(b % 2 == 0 for b in B):
        ans += sum(b//2 for b in B)
    elif all(b % 2 == 1 for b in B):
        ans += sum((b-1)//2 for b in B) + 1
    else:
        ans += sum(b//2 for b in B) + 2
    print(ans)


if __name__ == '__main__':
    main()

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

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

a.sort()

a, b, c = a

a += (c - b)
ans = c - b

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

print(ans)

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

odd = len([a for a in A if a % 2 == 1])
even = 3 - odd

ans = 0
if odd == 3 or even == 3:
    pass
elif odd == 1:
    A = [a + 1 if (a % 2 == 0) else a for a in A]
    ans += 1
elif even == 1:
    A = [a + 1 if (a % 2 == 1) else a for a in A]
    ans += 1

MAXA = max(A)
for a in A:
    ans += (MAXA - a) // 2

print(ans)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

a = LIST()
ans = 0
a.sort()
m = a[-1]
d = 0
if 3 * m % 2 == sum(a) % 2:
    d = m
else:
    d = m + 1
ans = 0
while not a[0] == a[1] == a[2]:
    if a[0] < d and a[1] < d:
        ans += 1
        a[0] += 1
        a[1] += 1
    elif a[0] < m:
        ans += 1
        a[0] += 2
    else:
        ans += 1
        a[1] += 2
    if a[0] > d or a[1] > d:
        break
    debug(a)
print(ans)

Solution (Python):
A=list(map(int,input().split()))
ans=int(0)
m=max(A)
for i in range(3):
    now=int((m-A[i])/2)
    ans+=now
    A[i]+=2*now

check=int(0)
for i in range(3):
    check+=m-A[i]
if check==0:
    print(ans)
elif check==2:
    print(ans+1)
else:
    print(ans+2)

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

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    L = [int(i) for i in input().split()]
    L.sort()
    odd, even = 0, 0
    for l in L:
        if l % 2 == 0: even += 1
        else: odd += 1
    count = 0
    if even == 3 or odd == 3: count = 0
    elif even == 2:
        count += 1
        for i in range(3):
            if L[i] % 2 == 0: L[i] += 1
    elif odd == 2:
        count += 1
        for i in range(3):
            if L[i] % 2 == 1: L[i] += 1
    count += (L[2] - L[0]) // 2 + (L[2] - L[1]) // 2
    print(count)

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):

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

    ans = 0
    while True:
        a.sort()
        if a[0] == a[1] and a[1] == a[2]:
            break
        elif a[1] < a[2]:
            a[0] += 1
            a[1] += 1
        else:
            a[0] += 2
        ans += 1

    print(ans)

if __name__ == '__main__':
    main()

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

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

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

abc.sort()
ans = 0

while True:
    if abc[0] == abc[1] and abc[1] == abc[2]:
        print(ans)
        break

    if abc[1] != abc[2]:
        abc[0] += 1
        abc[1] += 1
        ans += 1
    elif abc[1] == abc[2] and abc[1] + 1 == abc[0]:
        abc[1] += 1
        abc[2] += 1
        ans += 1
    else:
        abc[0] += 2
        ans += 1

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

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

while 1:
    if abc[0]==abc[1]==abc[2]:
        print(ans)
        exit()

        
    if abc[1]!=abc[2]:
        abc[0]+=1
        abc[1]+=1
        ans+=1
    elif abc[1]==abc[2] and abc[1]+1==abc[0]:
        abc[1]+=1
        abc[2]+=1
        ans+=1
    else:
        abc[0]+=2
        ans+=1

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

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

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

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

Solution (Python):
n_list = list(map(int,input().split()))
n_list.sort()
num = 2 * n_list[2]
dummy = num - (n_list[0] + n_list[1])

a,b = divmod(dummy,2)
if b == 0:
  print(a)
else:
  print(a+2)

Solution (Python):

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

abc.sort()
def calc(a, b):
    if (a + b) % 2 == 0:
        return (b - a) // 2
    else:
        return -(-(b - a) // 2) + 1


print(calc(abc[0], abc[1]) + (abc[2] - abc[1]))

Solution (Python):
a,b,c=map(int,input().split())
p=a%2!=b%2 or b%2!=c%2
a,b,c=[a+((a%2==b%2)^(a%2==c%2)),b+((b%2==a%2)^(b%2==c%2)),c+((c%2==a%2)^(c%2==b%2))]
a,b,c=sorted([a,b,c])
print((c-a)//2+(c-b)//2+p)

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

ans = 0
if (b-a)%2 == 0:
    while b < c:
        a += 1
        b += 1
        ans += 1
    ans += (c-a)/2
else:
    while b <= c:
        a += 1
        b += 1
        ans += 1
    a += 1
    ans += 1
    ans += (b-a)/2

print(int(ans))

Solution (Python):
a,b,c=map(int,input().split())
if a%2==b%2 and b%2==c%2:
    a,b,c=sorted([a,b,c])
    ans=(c-a)//2+(c-b)//2
else:
    ax=a+(a%2==b%2 or a%2==c%2)
    bx=b+(b%2==a%2 or b%2==c%2)
    cx=c+(c%2==a%2 or c%2==b%2)
    a,b,c=sorted([ax,bx,cx])
    ans=(c-a)//2+(c-b)//2+1
print(ans)

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

if max(ABC)%2==sum(ABC)%2:
  print((3*max(ABC)-sum(ABC))//2)
else:
  print((3*(max(ABC)+1)-sum(ABC))//2)

Solution (Python):
import numpy as np

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

num = np.array(num)

ans = 0
for i in range(51):
    num = np.sort(num)
    if num[1] == num[2]:
        break

    else:
        num[0]+=1
        num[1]+=1
        ans+=1

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


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

Solution (Python):
nums = sorted(list(map(int,input().split())))
x = min(nums)
y = nums[1]
z = max(nums)
gap1 = z - y
gap2 = z - x - gap1
answer = 0
if gap2 % 2 == 0:
  answer = gap1 + gap2//2
else:
  answer = gap1 + gap2//2 + 2
print(answer)

Solution (Python):
n_list = list(map(int,input().split()))
n_list.sort()
num = 2 * n_list[2]
dummy = num - (n_list[0] + n_list[1])
a,b = divmod(dummy,2)
if b == 0:
  print(a)
else:
  print(a+2)

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

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

a = na()
m = max(a)
b = [abs(i - m) for i in a]
print(sum(b) // 2 + sum(b) % 2 * 2)

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

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

    a, amod = divmod((C-A),2)
    b, bmod = divmod((C-B),2)
    A += a * 2
    B += b * 2

    if C == A and C == B:
        return a + b
    elif C > A and C > B:
        return a + b + 1
    elif C > A and C == B:
        return a + b + 2
    elif C > B and C == A :
        return a + b + 2

def main():
    print(solve())

if __name__ == '__main__':
    main()

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

Solution (Python):
a, b, c = map(int, input().split())
d = (a % 2) + (b % 2) + (c % 2)
m = max(a, b, c)
s = a + b + c
ans1 = (3 * m - s) // 2
ans2 = (3 * (m + 1) - s) // 2
if d == 0 or d == 3:
    ans = ans1
elif d == 1:
    if m % 2 == 1:
        ans = ans1
    else:
        ans = ans2
else:
    if m % 2 == 0:
        ans = ans1
    else:
        ans = ans2
print(ans)

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

Solution (Python):
A, B, C = map(int, input().split())
M=max(A,B,C)
abc=sorted([M-A, M-B, M-C], reverse=True)[:2]


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

Solution (Python):
import sys













readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, c = list(map(int,readline().split()))

    ans = 0

    ap = a % 2
    bp = b % 2
    cp = c % 2

    if not(ap == bp == cp):
        ans += 1
        if ap == bp:
            a += 1
            b += 1
        elif bp == cp:
            b += 1
            c += 1
        else:
            c += 1
            a += 1

    ans += ((max(a, b, c) * 3) - (a + b + c)) // 2
    print(ans)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
a,b,c=map(int,input().split())
l=[]
l.append(a)
l.append(b)
l.append(c)
l.sort()
ans=0
if (3*l[2])%2==(sum(l))%2:
    print((3*l[2]-sum(l))//2)
else:
    print((3*(l[2]+1)-sum(l))//2)
'''
while max(l[0],l[1])<l[2]:
    l[0]+=1
    l[1]+=1
    ans+=1
if (l[2]-l[0])%2==0:
    ans+=(l[2]-l[0])//2
    print(ans)
else:
    print(ans+2)
'''

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

Solution (Python):
import sys

a, b, c = map(int, input().split())
sum_abc = a + b + c
    
flag = True
cnt = 0
while flag:
    if sum_abc//3 >= max(a, b, c):
        break
    else:
        sum_abc += 2
        cnt += 1


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

print("{}".format(cnt))

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

import numpy as np
ABC = np.array([A, B, C])

cnt = 0

while True:
    
    if np.sum(ABC == np.min(ABC)) == 3:
        print(cnt)
        break
    elif np.sum(ABC == np.min(ABC)) == 2:
        index = np.where(ABC == min(ABC))
        ABC[index] += 1
        cnt += 1
    else: 
        ABC[np.argmin(ABC)] += 2
        cnt += 1

Solution (Python):








import sys
sys.setrecursionlimit(10 ** 5 + 10)


def resolve():

    L=list(map(int,input().split()))
    l=[0,0,0]

    for i in range(3):
        if L[i]%2!=0:
            l[i]=1
    cnt=0
    if l.count(0)==2:
        index_num = [n for n, v in enumerate(l) if v %2==0]
        for j in index_num:
            L[j]+=1
        cnt+=1
    elif l.count(0)==1:
        index_num = [n for n, v in enumerate(l) if v %2==1]
        for j in index_num:
            L[j]+=1
        cnt+=1

    L.sort()
    print(cnt+(L[-1]-L[0])//2+(L[-1]-L[1])//2)



resolve()

Solution (Python):
c=list(map(int,input().split()))
m=max(c)
c.remove(m)
if c[0]%2!=c[1]%2:
    print((3*(m+1)-c[0]-c[1]-m)//2)
else:
    print((3*m+-c[0]-c[1]-m)//2)

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

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

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

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

print(ans)

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

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

cnt = 0

while True:
    n.sort()
    a, b, c = n[0], n[1], n[2]
    if a == b == c:
        break
    if a + 2 <= c:
        a += 2
    else:
        a += 1
        b += 1
    cnt += 1
    n[0], n[1], n[2] = a, b, c
print(cnt)

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

Solution (Python):
def main():
    abc = [int(x) for x in input().split()]
    cnt = 0
    while True:
        abc.sort()
        if abc[0] == abc[1] == abc[2]:
            break
        if abc[1] == abc[2]:
            abc[0] += 2
        else:
            abc[0] += 1
            abc[1] += 1
        cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

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

maxi=max(A,B,C)
mini=min(A,B,C)
midi=(A+B+C)-maxi-mini
s = (maxi-midi)+(maxi-mini)

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

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

Solution (Python):
a = sorted(list(map(int, input().split())))
ans = 0
max_mid = a[2] - a[1]
ans += max_mid
a[0] += max_mid

div, mod = divmod(a[2]-a[0], 2)
if mod == 1:
    mod += 1
print(ans + div + mod)

Solution (Python):
import sys
a,b,c = map(int, input().split())
if a == b and b == c:
    count=0
    print(count)
    sys.exit()
    
ls = [a,b,c]
ls.sort(reverse=True)
count = 0

if (ls[1]-ls[2])%2 != 0:
    ls[2] = ls[2]+1
    ls[0] = ls[0]+1
    count +=1

while ls[1] - ls[2] >= 2:
    ls[2] += 2
    count += 1

if ls[1] - ls[2] == 1:
    ls[2] += 1
    count +=1

dif = ls[0] - ls[1]
count = count + dif

print(count)

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

x=ma-(a+b+c-ma-mi)
y=(ma-x-mi)%2
z=((ma+y)-(x+mi))//2
print(x+y+z)

Solution (Python):




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


if __name__ == "__main__":
    main()

Solution (Python):
a,b,c=sorted(map(int,input().split()))
x=0
loopcounter=0
while a!=b or b!=c or c!=a:
    if a+1<=c and b+1<=c:
        a+=1
        b+=1
        x+=1
    elif a+2<=c:
        a+=2
        x+=1
    elif b+2<=c:
        b+=2
        x+=1       
    elif a!=b and b==c:
        a+=2
        b+=1
        c+=1
        x+=2
    if loopcounter>100000:
        break
    loopcounter+=1
print(x)

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

Solution (Python):

def Same_Integers(abc):

    ans = 0
    abc.sort()
    count = abc[2]*3 - abc[0] - abc[1] - abc[2]

    if count % 2 == 0:
        ans = int(count / 2)
    else:
        ans = int((count + 3) // 2)

    return ans

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

if __name__ == '__main__':
    main()

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

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

a,b,c = na()
d = max(a,b,c)*3-(a+b+c)
e = d//2 if d%2==0 else (d+3)//2

print(e)

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

Solution (Python):
X = list(map(int, input().split()))
p = max(X)
q = sum(X)
if (3 * p) % 2 != q % 2:
    p += 1

print(((3 * p) - q) // 2)

Solution (Python):
X = list(map(int, input().split()))
X.sort()
A, B, C = X
a, b, c = [x % 2 for x in X]

cnt = 0
if a == b:
    ope1 = C - B
    cnt += ope1
    B += ope1
    A += ope1
    cnt += (C - A) // 2
else:
    if c == a:
        C += 1
        A += 1
        cnt += 1

        cnt += (C - B) // 2
        cnt += (C - A) // 2
    else:
        C += 1
        B += 1
        cnt += 1

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

print(cnt)

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

Solution (Python):
data = input().split()
tab = [int(data[0]), int(data[1]),int(data[2])]
tab = sorted(tab)
a, b, c = tab[0], tab[1], tab[2]
res = 0
res += c - b
a += res
b += res

while (a < b):
    res += 1
    a += 2

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

Solution (Python):
import math
def mid(a,b,c):
  if (a<=b and b<=c) or (c<=b and b<=a): 
    return b
  elif (b<=a and a<=c) or (c<=a and a<=b): 
    return a
  elif (a<=c and c<=b) or (b<=c and c<=a): 
    return c
A,B,C = map(int,input().split())
middle = mid(A,B,C)
minimum = min(A,B,C)
m = max(A,B,C)
ans = m - middle
minimum += max(A,B,C) - middle
if (m - minimum)%2==0:
  ans += (m - minimum)//2
else:
  ans += math.ceil((m - minimum)/2)+1
print(ans)

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

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

Solution (Python):
import math
A,B,C=map(int,input().split())
s=[A,B,C]
t=sorted(s)
u=(t[2]-t[0],t[2]-t[1],0)
if u[0]%2==0 and u[1]%2==0:
    print(round(((u[0]+u[1])/2)))
elif u[0]%2==1 and u[1]%2==1:
    print(round((1+u[0]//2+u[1]//2)))
elif u[0]%2==1 and u[1]%2==0:
    print(round(((u[0]+1)/2+u[1]/2+1)))
else:
    print(round(((u[1]+1)/2+u[0]/2+1)))

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

Solution (Python):
li = [int(x) for x in input().split()]
li.sort()
tmp = li[2] * 3
buf = sum(li)

if buf%2 != tmp%2:
    ans = ((li[2] + 1) * 3 - buf) //2
else:
    ans = (li[2] * 3 - buf) // 2

print(ans)

Solution (Python):
a=[int(x) for x in input().split()]
a=sorted(a)
if((a[1]-a[0])%2==0):
    print((a[2]*3-sum(a))//2)
else:
    print(((a[2]+1)*3-sum(a))//2)

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

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

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

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

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

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

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

Solution (Python):
import numpy as np

S = input().split(" ")
A = int(S[0])
B = int(S[1])
C = int(S[2])

def calculate(a, b, c):

    arr = np.array([a,b,c])

    maxIndex = np.argmax(arr)
    maxValue = arr[maxIndex]

    sl = []
    for index,ar in enumerate(arr):
        if index == maxIndex:
            continue
        sl.append(maxValue - ar)

    if np.sum(sl) % 2 == 1:
        maxValue = maxValue + 1


    brr = np.array([maxValue-a,maxValue-b,maxValue-c])

    s = brr % 2
    print(np.sum(brr//2) + np.sum(s % 2) // 2)

calculate(A, B, C)

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

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

s = 0
if len(set(a)) == 1 :
  print(0)
elif a[0] == a[1]:
  print(a[2] -a[1])
else :
  if a[0]+1<a[1]:
    s +=(a[1]-a[0])//2
    a[0] = 2*s+a[0]
    if a[0] == a[1]:
      s+= a[2] -a[1]
    else :
      s+= a[2]-a[1] +2
  else :
      s+= a[2]-a[1] +2
  print(s)

Solution (Python):

import sys 
def main():
    input_list = list(map(int, input().split()))
    input_list.sort(reverse=True)
    
    diff = input_list[0] - input_list[1] + input_list[0] - input_list[2]
    ans = diff /2
    if diff % 2 == True:
        ans += 2

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

Solution (Python):

def main():
    import sys
    
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    
    from itertools import combinations, permutations
    
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    

    

    l = list(map(int, input().split()))
    l.sort()
    total = l[2]*2 - l[0] - l[1]
    if total % 2:
        print((total-1)//2+2)
    else:
        print(total//2)
    
if __name__ == '__main__':
    main()

Solution (Python):

a,b,c=map(int,input().split())
X=max(a,b,c)
if X%2^(a+b+c)%2:
    X+=1
ans=int((3*X-(a+b+c))/2)
print(ans)

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

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

Solution (Python):
abc = list(map(int, input().split()))
abc.sort()
max_n = abc[2]
mid_n = abc[1]
min_n = abc[0]

cnt = max_n - mid_n
if (max_n - min_n - cnt)%2 == 1:
    cnt += (max_n - min_n - cnt)//2 + 2
else:
    cnt += (max_n - min_n - cnt)//2
print(cnt)

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

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

desc = sorted([a,b,c], reverse=True)
d1, m1 = divmod(desc[0] - desc[1], 2)
d2, m2 = divmod(desc[0] - desc[2], 2)

ans = d1 + d2
if m1 + m2 == 2:
  ans += 1
elif m1 + m2 == 1:
  ans += 2

print(ans)

Solution (Python):



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

s = c - a
t = c - b

if s % 2 == t % 2:
    ans = (s + t) // 2
else:
    ans = (s + 1 + t + 1 + 1) // 2

print(ans)

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

s_m=l[1]-l[0]
m_l=l[2]-l[1]

if s_m%2==0:
    print(s_m//2+m_l)
else:
    print((s_m-1)//2+m_l+2)

Solution (Python):
a = list(map(int, input().split()))
count = 0
while True:
    a.sort(reverse=True)
    max_elem_count = a.count(max(a))
    if max_elem_count == len(a):
        break
    elif max_elem_count == 2:
        a[2] += 2
    elif max_elem_count == 1:
        a[1] += 1
        a[2] += 1
    count += 1
print(count)

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

ans=0
while a<c-1:
  a+=2
  ans+=1
while b<c-1:
  b+=2
  ans+=1
  
if a==c and b==c:
  print(ans)
elif a!=c and b!=c:
  print(ans+1)
else:
  print(ans+2)

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

l.sort()

count = 0
while l[2] - l[0] > 1:
    l[0] += 2
    count += 1
    l.sort()

if l[2] == l[1] != l[0]:
    count += 2
elif l[0] == l[1] != l[2]:
    count += 1

print(count)

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

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

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


while True:
    if (abc[2]-abc[0])%2==0:
        break
    ans+=1
    abc[2]+=1

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

Solution (Python):
A = list(map(int,input().split()))
A.sort()
B = []
for i in A:
    B.append(i%2)

ans = 0

if B.count(1) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1
elif B.count(0) == 1:
    for i in range(3):
        if B[i] == 1:
            A[i] += 1
    ans += 1

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

print(ans)

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

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

def biggest_idx(abc):
    res = -1
    for i, v in enumerate(abc):
        if i == 0 or v > abc[res]:
            res = i
    return res
def smallest_idx(abc):
    res = -1
    for i, v in enumerate(abc):
        if i == 0 or v < abc[res]:
            res = i
    return res

abc = list(map(int, input().split(' ')))
ans = 0
while abc[0] != abc[1] or abc[1] != abc[2]:
    is_mid = [1, 1, 1]
    biggest = biggest_idx(abc)
    is_mid[biggest] = 0
    smallest = smallest_idx(abc)
    is_mid[smallest] = 0
    if abc[biggest] - abc[smallest] >= 2:
        abc[smallest] += 2
        ans += 1
        continue
    mid = is_mid.index(1)
    if abc[biggest] - abc[smallest] == 1 and abc[biggest] == abc[mid]:
        abc[biggest] += 1
        abc[mid] += 1
        ans += 1
        continue
    if abc[biggest] - abc[smallest] == 1 and abc[mid] == abc[smallest]:
        abc[mid] += 1
        abc[smallest] += 1
        ans += 1
print(ans)

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

m = max([a,b,c])
if m % 2 == sum([a,b,c]) % 2:
    print(((3 * m) - sum([a,b,c])) // 2)
else:
    print((((m+1) - a) + ((m+1)-b) + ((m+1)-c)) // 2)