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 = 0
l = [a,b,c]
maa = max(l)
l.remove(maa)
maa2 = max(l)
l.remove(maa2)
maa3 = l[0]
for i in range(maa-maa2):
    maa3 += 1
    maa2 += 1
    ans += 1
if (maa-maa3)%2 == 0:
    ans += (maa-maa3)/2
    print(int(ans))
else:
    ans += (maa-maa3+1)/2
    print(int(ans+1))

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

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

Solution (Python):
import math
A,B,C = map(int,input().split())
k = [A,B,C]
k.sort()
k.reverse()
ans = 0
ans += k[0]-k[1]
now = k[2]
now += ans
if (k[0]-now)%2 == 0:
    ans += math.ceil((k[0]-now)/2)
    print(ans)
else:
    ans += math.ceil((k[0]-now)/2)
    ans += 1
    print(ans)

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

if (b-a)%2 == 0:
    ans = c-b+(b-a)//2
else:
    ans = c-b+math.ceil((b-a)/2) + 1
print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

    print(ans)

resolve()

Solution (Python):
A, B, C = map(int,input().split())
L = [A%2,B%2,C%2]
ALL = [A,B,C]
cnt = 0

if L.count(0) == 3 or L.count(0) == 0:
    cnt += 0
elif L.count(0) == 2:
    for i in range(3):
        if L[i] == 0:
            ALL[i] += 1
    cnt += 1
elif L.count(0) == 1:
    for i in range(3):
        if L[i] == 1:
            ALL[i] += 1
    cnt += 1

ans = 3*max(ALL)- sum(ALL)

print(ans//2+cnt)

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

a = All[0]
b = All[1]
c = All[2]
aa = a%2
bb=b%2
cc =c%2

if aa == bb and aa == cc: 
  ans = (c-b)//2+(c-a)//2
elif aa==bb:
  a+=1
  b+=1
  ans = 1+ (c-b)//2+(c-a)//2
elif aa == cc:
  a+=1
  c+=1
  ans = 1+ (c-b)//2+(c-a)//2
elif bb == cc:
  b+=1
  c+=1
  ans = 1+ (c-b)//2+(c-a)//2
print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    ABC = sorted(list(map(int, input().split())))

    res = 0
    ABC[0] += ABC[2] - ABC[1]
    res += ABC[2] - ABC[1]
    res += (ABC[2] - ABC[0]) // 2 if (ABC[2] - ABC[0]) % 2 == 0 else (ABC[2] - ABC[0]) // 2 + 2
    print(res)


if __name__ == '__main__':
    resolve()

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

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

Solution (Python):
def resolve():
  a = list(map(int, input().split()))
  a.sort()
  ans = 0
  while a[1] < a[2]:
    ans += 1
    a[1] += 1
    a[0] += 1

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

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

  print(ans)
  return

if __name__ == "__main__":
  resolve()

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

x = inpl()
a,b,c = sorted(x)
n = c-a; m = c-b
res = n//2 + m//2
if n%2 != m%2:
    res += 2
elif n%2 == 1 and n%2 == 1:
    res += 1
print(res)

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

Solution (Python):
a = list(map(int, input().split()))
a.sort()
cnt = 0
while max(a)-min(a)>1:
    a[0] += 2
    a.sort()
    cnt += 1
if a[0]==a[1]==a[2]:
    print(cnt)
elif a[0]==a[1]:
    print(cnt+1)
else:
    print(cnt+2)

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


if __name__ == '__main__':
    main()

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

Solution (Python):
In = sorted([int(i) for i in input().split(" ")])
Max = max(In)

count = Max - In[1]
In[0] += count
In[1] += count

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

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())

    def preprocess(a, b, c):
        tmp = (c - a) // 2
        a += 2 * tmp
        tmp2 = (c - b) // 2
        b += 2 * tmp2
        return (a, b), tmp + tmp2
    
    
    a, b, c = sorted(lmi())
    cnt = 0
    (a, b), op_num = preprocess(a, b, c)
    cnt += op_num

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


if __name__ == "__main__":
    main()

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

if (m*3) % 2 == (a+b+c) % 2:
    M = m * 3
else:
    M = (m+1) * 3

M -= (a+b+c)
print(M//2)

Solution (Python):



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


num_list = sorted([A, B, C])
sa = num_list[2] - num_list[1]
count = sa


for i in range(3):
    if num_list[i]<num_list[2]:
        num_list[i] += sa


num_list = sorted(num_list)
if num_list[0]<num_list[1] and num_list[0]<num_list[2]:
    if (num_list[1]-num_list[0])%2==0:
        count += (num_list[1]-num_list[0])// 2
    else:
        count += (num_list[1]-num_list[0])// 2 + 2
elif num_list[2]>num_list[0] and num_list[2]>num_list[1]:
    count += 1


print(count)

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    a,b,c = readInts()
    d = max(a,b,c)*3 - (a+b+c)
    print(d%2 + (d+1)//2)
if __name__ == '__main__':
  main()

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

ans = 0
if A % 2 != B % 2 == C % 2:
    B += 1
    C += 1
    ans += 1
elif B % 2 != C % 2 == A % 2:
    C += 1
    A += 1
    ans += 1
elif C % 2 != A % 2 == B % 2:
    A += 1
    B += 1
    ans += 1

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

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

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

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

Solution (Python):
a = list(map(int, input().split()))
a.sort()
cnt = 0
if (a[0]%2==0 and a[1]%2!=0 and a[2]%2==0) or (a[0]%2!=0 and a[1]%2==0 and a[2]%2!=0):
  while a[2] > a[1]:
    a[1] += 2
    cnt += 1
  a.sort()
elif (a[0]%2!=0 and a[1]%2==0 and a[2]%2==0) or (a[0]%2==0 and a[1]%2!=0 and a[2]%2!=0):
  while a[2] > a[0]:
    a[0]+= 2
    cnt += 1
  a.sort()

if (a[0]%2!=0 and a[1]%2!=0) or (a[0]%2==0 and a[1]%2==0):
  cnt += (a[1]-a[0])//2
  a[0] = a[1]
  cnt += a[2]-a[1]
print(cnt)

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

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

Solution (Python):
A, B, C = map(int, input().split())
M = max(A, B, C)
d = 3*M-A-B-C

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

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

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

a = [int(x) for x in input().split()]
a.sort()
ans = 0
ans += a[2] - a[1]
a[0] += ans
if (a[2] - a[0]) % 2 == 0:
    ans += (a[2] - a[0])//2
    print(ans)
else:
    ans += (a[2] - a[0])//2
    ans += 2
    print(ans)

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

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

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

print(ans)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    a = sorted(LI())
    r = 0
    while a[0] != a[2]:
        r += 1
        if a[1] == a[0]:
            a[0] += 1
            a[1] += 1
        else:
            a[0] += 2
        a.sort()

    return r

print(main())

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

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

Solution (Python):
def solve(A):
    A = sorted(A)
    ma = min(A)
    for i in range(3):
        A[i] -= ma
    if A == [0, 0, 0]:
        return 0
    elif A == [0, 0, 1]:
        return 1
    elif A == [0, 1, 1]:
        return 2

A = list(map(int,input().split()))
A = sorted(A)
ca = (A[2] - A[0]) // 2
A[0] += 2 * ca
cb = (A[2] - A[1]) // 2
A[1] += 2 * cb
ans = ca + cb + solve(A)
print(ans)

Solution (Python):
A,B,C = map(int,input().split())
if (A+B+C)%2 == 0:
    candidates = [i for i in range(0,151,6)]
else:
    candidates = [i for i in range(3,154,6)]
for i in candidates:
    x = i/3
    if A<= x and B<= x and C<=x and ((x-A)+(x-B)+(x-C))%2==0:
        print(int((i-(A+B+C))/2))
        break

Solution (Python):



nums = list(map(int,input().split()))
abc= sum(nums)
X = max(nums)


if X%2 != abc%2:
    X += 1
print((3*X - abc)//2)

Solution (Python):
"""解説から
1.  A, B, Cの総和をabcとする。
2.  可能な操作は2種類あるが、abcの増加は必ず2になる
3.  2の前提からabcの偶奇を変更することはできない
4.  A, B, Cそれぞれに操作を加えて、A==B==Cとなった時、それぞれの値をXとする
5.  A, B, Cのいずれの値も減少させることはできないので、max(A, B, C)<=Xとなる
6.  abcの総和を3Xにできるとき、そのXが最終的なA, B, Cの値となる
7.  3と6の前提から、Xとabcの偶奇は一致している必要がある
8.  XとX+1の偶奇は異なるので、Xで無理ならX+1が最終的なA, B, Cの値となる
9.  A, B, Cのいずれかに増加させる値の総和は3X-abcで求めることができる
10. 2と9の前提から操作回数は(3X-abc)//2で求めることができる
"""
ABC = tuple(map(int, input().split()))
abc = sum(ABC)  
X = max(ABC)  
if X % 2 != abc % 2:  
    X += 1  
ans = (3 * X - abc) // 2  
print(ans)

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

Solution (Python):
a,b,c=sorted(map(int,input().split()))
count=0
A,B=(c-a)//2,(c-b)//2
a+=A*2
b+=B*2
count+=A+B
if a==b==c:
    print(count)
elif a==b:
    print(count+1)
else:
    print(count+2)

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

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

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

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

l = [A,B,C]
flg = [A%2,B%2,C%2]
cnt = 0
if flg.count(1) == 1:
    for i in range(3):
        if flg[i] == 0:
            l[i] += 1
    cnt += 1
        
elif flg.count(1) == 2:
    for i in range(3):
        if flg[i] == 1:
            l[i] += 1
    cnt += 1

mx = max(l)
SUM = 0
for i in l:
    SUM += (mx - i)
print(SUM//2+cnt)

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

    ans = 0
    while num[0] != num[1] or num[1] != num[2]:
        tmp = max(num)
        if num.count(tmp) == 2:
            num[num.index(min(num))] += 2
        else:
            num[num.index(max(num))] -= 1
        ans += 1

    print(ans)


if __name__ == "__main__":
    main()

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

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

cnt = 0

while True:
  N.sort()
  if N[0] == N[1] == N[2]:
    print(cnt)
    exit()

  if N[1] - N[0] > 1:
    N[0] += 2
    cnt += 1
  elif N[2] - N[1] > 1:
    N[1] += 2
    cnt += 1
  elif N[2] - N[0] == 2:
    N[0] += 2
    cnt += 1
  elif N[0] == N[1] and N[2] - N[1] == 1:
    N[0] += 1
    N[1] += 1
    cnt += 1
  elif N[1] == N[2]:
    N[0] += 2
    cnt += 1

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

A.sort()
reg = 0
diff_1 = (A[2] - A[0]) // 2
reg += diff_1
diff_2 = (A[2] - A[1]) // 2
reg += diff_2
A[0] += 2 * diff_1
A[1] += 2 * diff_2

A.sort()
if A[0]==A[1]==A[2]:
    print(reg)
elif A[0]==A[1]:
    print(reg+1)
else:
    print(reg+2)

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

a.sort()
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 = sorted(list(map(int, input().split())))
count = 0


def plusOne(x, y):
    return x+1, y+1


def plusTwo(x):
    return x+2


while True:
    if a[0] == a[1] == a[2]:
        break
    elif a[1] == a[2]:
        a[0] = plusTwo(a[0])
    else:
        a[0], a[1] = plusOne(a[0], a[1])

    a.sort()
    count += 1

print(count)

Solution (Python):
a = [int(i) for i in input().split()]
a.sort()
d = a[2] - a[1]
e = a[1] - a[0]
if e % 2 == 0:
    print(d + (e // 2))
else:
    print(d + (e // 2) + 2)

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

Solution (Python):
a,b,c =map(int,input().split())
e = max(a,b,c)
f = 3*e -a-b-c
while f % 2 ==1:
    f += 3
print(int(f/2))

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

if a[2] != a[1] and a[1] != a[0] and a[2] != a[0]:
  sum = a[2]-a[1]
  for i in range(a[2]-a[1]):
    a[1] += 1
    a[0] += 1  
  for i in range(10**12):
    a[0] += 2
    count += 1
    if a[0] >= a[1]:
      break
      
  if a[0] == a[1]:
    print(sum + count)
  elif a[0] > a[1]:
    print(sum + count + 1)

elif a[2] == a[1] and a[1] != a[0]:
  for i in range(10**4):
    a[0] += 2
    count += 1
    if a[0] >= a[1]:
      break
  
  if a[0] == a[1]:
    print(count)
  elif a[0] > a[1]:
    print(count + 1)
    
elif a[0] == a[1] and a[1] != a[2]:
  print(a[2]-a[1])
  
elif a[1] == a[2] and a[2] == a[0]:
  print(0)

Solution (Python):
from sys import stdin

a, b, c = [int(x) for x in stdin.readline().strip().split()]
guki = [a%2, b%2, c%2]
cnt = 0
if guki[0]==guki[1]==guki[2]:
  
  pass
else:
  cnt += 1
  
  if guki[0] == guki[1]:
    
    a += 1
    b += 1
  elif guki[0] == guki[2]:
    
    a += 1
    c += 1
  else:
    
    b += 1
    c += 1
    
cnt += (max([a,b,c]) - a) / 2
cnt += (max([a,b,c]) - b) / 2
cnt += (max([a,b,c]) - c) / 2

print(int(cnt))

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

Solution (Python):

import numpy as np

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


nums.sort()

min_  = nums[0]
mid = nums[1]
max_ = nums[2]

ans = 0
if (max_ - mid) % 2 == 1:
    mid += 1
    min_ += 1
    ans += 1
ans += (max_ - mid) // 2


if (max_ - min_) % 2 == 1:
    mid += 1
    max_ += 1
    ans += 1
ans += (max_ - min_) // 2

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

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

aa = abc[0]
bb = abc[1]
cc = abc[2]

diff = bb-aa
ans = 0
if diff %2==0:
    ans += diff//2
    aa = bb
else:
    ans += diff//2 + 1
    aa = bb
    cc += 1

ans += (cc-bb)*2//2

print(ans)

Solution (Python):
A = list(map(int, input().split()))
A = sorted(A)
m = max(A)
B = [(m - a) // 2 for a in A]
count = 0
if len(set(A)) == 1:
    print(0)
elif len(set(A)) == 2:
    count = sum(B)
    if A[0] % 2 != A[2] % 2:
        if A[0] == A[1]:
            count += 1
        else:
            count += 2
    print(count)
else:
    count = sum(B)
    if A[0] % 2 == A[1] % 2 == A[2] % 2:
        pass
    elif A[0] % 2 == A[1] % 2:
        count += 1
    else:
        count += 2
    print(count)

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


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

Solution (Python):
x_list = [int(x) for x in input().split()]
temp_list = [[], []]
for i in range(3):
    temp_list[x_list[i] % 2].append(i)
temp = len(temp_list[0])
ans = 0
if temp == 1:
    x_list[temp_list[1][0]] += 1
    x_list[temp_list[1][1]] += 1
    ans += 1
elif temp == 2:
    x_list[temp_list[0][0]] += 1
    x_list[temp_list[0][1]] += 1
    ans += 1
x_max = max(x_list)
ans += sum([gap // 2 for gap in [x_max - x for x in x_list]])
print(ans)

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

l = sorted(l,reverse = True)

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

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

Solution (Python):
n = list(map(int,input().split()))
ki = []
gu = []
count = 0

for x in range(3):
    if n[x] %2 == 0:
        ki.append(x)
    else:
        gu.append(x)

if len(gu) < len(ki) != 3:
    n[ki[0]] += 1
    n[ki[1]] += 1
    count +=1
elif len(ki) < len(gu) != 3:
    n[gu[0]] += 1
    n[gu[1]] += 1
    count +=1


n.sort(reverse=True)
count += (n[0] -n[1]) / 2
count += (n[0] -n[2]) / 2

print(int(count))

Solution (Python):
nl = sorted(list(map(int, input().split())))
d1 = nl[2]-nl[0]
d2 = nl[2]-nl[1]
ans=d1//2+d2//2
if d1%2!=0 and d2%2!=0:
    ans+=1
elif d1%2!=0 or d2%2!=0:
    ans+=2
print(ans)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


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


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





S = IL()
S.sort()

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


c1 = d1//2
c2 = d2//2

if d1%2 == d2%2 == 1:
  a = 1
elif d1%2 == d2%2 == 0:
  a = 0
else:
  a = 2
  
P(c1+c2+a)

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

count += C - B
q, r = divmod(C - (A + (C - B)), 2)
if r == 0:
    count += q
else:
    count += q + 2

print(count)

Solution (Python):
def main():
    A, B, C = list(map(int, input().split(' ')))
    cnt = 0
    if A % 2 == B % 2 != C % 2:
        cnt = 1
        A += 1
        B += 1
    elif B % 2 == C % 2 != A % 2:
        cnt = 1
        B += 1
        C += 1
    elif C % 2 == A % 2 != B % 2:
        cnt = 1
        C += 1
        A += 1
    cnt += (3 * max([A, B, C]) - (A + B + C)) // 2
    print(cnt)


if __name__ == '__main__':
    main()

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

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

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

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

if (l[1]-l[0])%2!=0:
    l[1]+=1
    l[2]+=1
    ans+=1

x=(l[1]-l[0])//2
l[0]+=(2*x)
ans+=x

y=(l[2]-l[1])
ans+=y
print(ans)

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

    cnt = 0
    while not (A[0] == A[1] and A[0] == A[2]):
        A = sorted(A)
        if A[2] - A[0] >=2:
            A[0] += 2
        else:
            A[0] += 1
            A[1] += 1
        cnt += 1

    print(cnt)


resolve()

Solution (Python):
num_list = [int(i) for i in input().split()]
max_num = max(num_list)
res = 0
for i,n in enumerate(num_list):
  while max_num >= num_list[i]+2:
    num_list[i] +=2
    res +=1
min_num = min(num_list)
mins = len([x for x in num_list if x==min_num])
if mins==3:
  print(res)
elif mins==2:
  print(res+1)
else:
  print(res+2)

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

if a == b and b == c:
  ans += 0
elif a == b and b != c:
  ans += 1
else:
  ans += 2

print(ans)

Solution (Python):
def  main():
  A = list(map(int, input().split()))
  A = sorted(A)
  if A[0] %2 == A[1] % 2:
    print(A[2]-max(A[0], A[1])+abs(A[0]-A[1])//2)
  else:
    print(1+A[2]-max(A[0], A[1])+(abs(A[0]-A[1])+1)//2)
if __name__ == "__main__":
  main()

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

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

ans = 0

while ABC_lis[0] < ABC_lis[1]:
    ABC_lis[0]=  ABC_lis[0] + 2
    ans = ans + 1

if ABC_lis[0] > ABC_lis[1]:
    ABC_lis[1] = ABC_lis[1] + 1
    ABC_lis[2] = ABC_lis[2] + 1
    ans = ans + 1

while ABC_lis[1] < ABC_lis[2]:
    ABC_lis[0] = ABC_lis[0] + 1
    ABC_lis[1] = ABC_lis[1] + 1
    ans = ans + 1

print(ans)

Solution (Python):
ABC = list(map(int,input().split()))
count = 0
while True:
    ABC = list(sorted(ABC))
    if ABC[0] +2 <= ABC[2]:
        ABC[0] += 2
        count += 1
    elif ABC[0] < ABC[2]:
        ABC[0] += 1
        ABC[1] += 1
        count += 1
    if max(ABC) == min(ABC):
        break
print(count)

Solution (Python):

import sys
input = sys.stdin.readline









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

d = max(ABC)*3 - sum(ABC)

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

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

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

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

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

ans = 0
while True:
  diff = max(l) - min(l)
  if diff == 0:
    break
  elif diff % 2 == 0:
    l[l.index(min(l))] += 2
    ans += 1
  else:
    add_nums = [i for i in range(3) if i != l.index(max(l))]
    for num in add_nums:
      l[num] += 1
    ans += 1

print(ans)

Solution (Python):
A = list(map(int, input().split()))
A.sort()
c = 0
a1 = A[2] - A[1]
a2 = A[2] - A[0]
if (a2 - a1) % 2 != 0:
    c += 1
    A[2] += 1
    if a1 < a2:
        A[0] += 1
    else:
        A[1] += 1
a1 = A[2] - A[1]
a2 = A[2] - A[0]
if a1 < a2:
    c += a1
    c += (a2 - a1) / 2
else:
    c += a2
    c += (a1 - a2) / 2
print(int(c))

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



a = sorted(a)

ans = 0

if a[2] - a[1] >= 2 :
  x = int( (a[2]-a[1]) / 2 )
  ans += x
  a[1] += 2*x

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

b = [0] * 3
b[2] = a[2] - a[0]
b[1] = a[1] - a[0]
b[0] = 0

if b == [0,0,2]:
  ans += 2
elif b == [0,0,1]:
  ans += 1
elif b == [0,1,2]:
  ans += 3
elif b == [0,1,1]:
  ans += 2

print(ans)

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

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

tmp = max([A, B, C]) * 3 - A - B - C

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

Solution (Python):
import math
import copy

a,b,c = map(int,input().split())
if (a > b)and(a > c):
    mx = a
    if b > c:
        md = b
        mn = c
    else:
        md = c
        mn = b
elif (a > b)or(a > c):
    md = a
    if b > c:
        mx = b
        mn = c
    else:
        mx = c
        mn = b
else:
    mn = a
    if b > c:
        mx = b
        md = c
    else:
        mx = c
        md = b
neko = mx-md
if mx != mn+neko:
    nya = mx - (mn+neko)
    neko += math.ceil(nya/2) + nya%2
print(neko)

Solution (Python):



import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

lis=sorted(LI())
count=0
while lis[0]+2<lis[2]:
    lis[0]+=2
    count+=1
while lis[1]+2<lis[2]:
    lis[1]+=2
    count+=1


u=lis[0]
for i in range(3):
    lis[i]-=u

ad=3
if lis==[0,0,0]:
    ad=0
elif lis==[0,0,1]:
    ad=1
elif lis==[0,1,1]:
    ad=2
elif lis==[0,1,2]:
    ad=3
elif lis==[0,0,2]:
    ad=2
elif lis==[0,2,2]:
    ad=1
print(count+ad)

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

diff1 = c - b
a += diff1
diff2 = c - a
if diff2 % 2 == 0:
    diff2 //= 2
else:
    diff2 += 1
    diff2 //= 2
    diff2 += 1

print(diff1 + diff2)

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

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

Solution (Python):
import sys

input = sys.stdin.readline


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

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

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


if __name__ == "__main__":
    main()