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):
lst = list(map(int,input().split()))
lst2 = list(map(lambda x: max(lst) - x, lst))
lst2.remove(0)
if lst2[0] % 2 == 0 and lst2[1] % 2 == 0:
    print(sum(lst2) // 2)
elif lst2[0] % 2 != 0 and lst2[1] % 2 != 0:
    _sum = (lst2[0] - 1) + (lst2[1] - 1)
    print(_sum // 2 + 1)
else:
    print((sum(lst2) + 1) // 2 + 1)

Solution (Python):
lst = list(map(int,input().split()))
_max = max(lst)
lst2 = list(map(lambda x: _max - x, lst))
lst2.remove(0)

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

Solution (Python):



a,b,c=map(int,input().split())
i=0
p=max(a,b,c)
while True:
    if p%2!=(a+b+c)%2:
        p+=1
    else:
        break
print((3*p-(a+b+c))//2)

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

count = 0
abc.sort(reverse=True)


if abc[0] % 2 == abc[1] % 2 and abc[0] % 2 == abc[2] % 2:
    count += (abc[0] - abc[1]) / 2
    count += (abc[0] - abc[2]) / 2


elif abc[0] % 2 != abc[1] % 2 and abc[0] % 2 != abc[2] % 2:
    abc[1] += 1
    abc[2] += 1
    count += 1

    count += (abc[0] - abc[1]) / 2
    count += (abc[0] - abc[2]) / 2


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

        count += (abc[0] - abc[1]) / 2
        count += (abc[0] - abc[2]) / 2

    else:
        abc[0] += 1
        abc[2] += 1
        count += 1

        count += (abc[0] - abc[1]) / 2
        count += (abc[0] - abc[2]) / 2

print(int(count))

Solution (Python):



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


num_count = 0
not_finished = True
ans_list = [A, B, C]


while not_finished:
    if ans_list[0]==ans_list[1] and ans_list[1]==ans_list[2]:
        not_finished=False
        break
    ans_list = sorted(ans_list)
    if len(set(ans_list))==3:
        ans_list[0] += 1
        ans_list[1] += 1
        num_count += 1
    elif ans_list[1]==ans_list[2]:
        ans_list[0] += 2
        num_count += 1
    elif ans_list[0]==ans_list[1]:
        ans_list[0] += 1
        ans_list[1] += 1
        num_count += 1


print(num_count)

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

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

al = sorted(al)

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

k = min(a,b)

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

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

cnt0=(A[2]-A[0])//2
A[0]+=cnt0*2
cnt1=(A[2]-A[1])//2
A[1]+=cnt1*2
A=sorted(A)

if A[1]==A[2] and A[0]==A[2]:
  ans=cnt0+cnt1
elif A[1]==A[2] and A[0]!=A[2]:   
  ans=cnt0+cnt1+2
elif A[2]==A[0]:
  ans=cnt0+cnt1
else:
  ans=cnt0+cnt1+1
print(ans)

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

D = [[], []]
D[A % 2].append(A)
D[B % 2].append(B)
D[C % 2].append(C)

D.sort(key=lambda a: len(a))

if len(D[-1]) == 2:
    ans += 1
    D[-1][0] += 1
    D[-1][1] += 1

    A, B, C = D[0][0], D[1][0], D[1][1]

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

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

Solution (Python):
a = list(map(int, input().split()))
n = []
for i in range(len(a)):
  if a[i] % 2 == 0: n.append(i+1)
if len(n) == 3:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
elif len(n) == 2:
  N = 3 - sum(n) - 1 
  ans = 0
  if a[N] != max(a):
    while a[N] < max(a):
      a[N] += 2
      ans += 1
  a.sort()
  ans += (a[1] - a[0]) // 2 + a[2] - a[1]
elif len(n) == 1:
  for i in range(len(a)):
    if a[i] % 2 != 0:
      a[i] += 1
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1
else:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
print(ans)

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

if (((A[2]-A[1])%2==0) and ((A[2]-A[0])%2==0)) or (((A[2]-A[1])%2==1) and ((A[2]-A[0])%2==1)):
    print(int(A[2]-(A[0]+A[1])/2))
else:
    print(int(A[2]-(A[0]+A[1])/2+3/2))

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

if (((A[2]-A[1])%2==0) and ((A[2]-A[0])%2==0)) or (((A[2]-A[1])%2==1) and ((A[2]-A[0])%2==1)):
    print(int(A[2]-(A[0]+A[1])/2))
else:
    print(int(A[2]-(A[0]+A[1])/2+3/2))

Solution (Python):
a = [int(i) for i in input().split()]
g = 0
k = 0
count = 0
for i in a:
    if i%2==0:
        g += 1
    else:
        k += 1
if g==1:
    count += 1
    for i in range(3):
        if a[i]%2==1:
            a[i] += 1
            
            
elif k==1:
    count += 1
    for i in range(3):
        if a[i]%2==0:
            a[i] += 1
a = sorted(a)[::-1]
count += (a[0]-a[1])//2 + (a[0]-a[2])//2
print(count)

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

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

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

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

Solution (Python):
from math import ceil
A,B,C=map(int, input().split())
L=sorted([A,B,C])
n1=L[0]
n2=L[1]
n3=L[2]

fir=ceil((n2-n1)/2)
if n1+2*fir!=n2:
    sec=1
else:
    sec=0

ans=n3+sec-(n1+2*fir)+fir+sec
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    A=list(map(int,input().split()))
    even=[False]*3
    for i in range(3):
        if A[i]%2==0:
            even[i]=True
    cnt=0
    if even.count(True)==2:
        for i in range(3):
            if A[i] % 2 == 0:
                A[i]+=1
        cnt+=1
    elif even.count(True)==1:
        for i in range(3):
            if A[i] % 2 == 1:
                A[i]+=1
        cnt+=1
    ma=max(A)
    for i in range(3):
        cnt+=(ma-A[i])// 2

    print(cnt)

resolve()

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

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))

def resolve():
    A=list(pin())
    A.sort()
    a=0
    if A[0]%2!=A[1]%2:
        A[1]+=1
        A[2]+=1
        a+=1
    a+=(A[2]*2-A[0]-A[1])//2
    print(a)
    

resolve()

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

max_ = max(a, b, c)
ans = 0
ans += (max_ - a) // 2
a += ((max_ - a) // 2) * 2

ans += (max_ - b) // 2
b += ((max_ - b) // 2) * 2

ans += (max_ - c) // 2
c += ((max_ - c) // 2) * 2

if [a, b, c].count(max(a, b, c)) == 3:
    print(ans)
elif [a, b, c].count(max(a, b, c)) == 2:
    print(ans + 2)
elif [a, b, c].count(max(a, b, c)) == 1:
    print(ans + 1)

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

ABC.sort()

count = ABC[2] - ABC[1]

ABC[0] += count
ABC[1] += count



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

print (count)

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

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

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


if __name__ == '__main__':
    main()

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

while True:
  diff = sum([target - x for x in ABC])
  if diff % 2 == 0:
    print(diff//2)
    quit()
  else:
    target += 1

Solution (Python):
import numpy as np

def multi_input():
    return map(int, input().split())

l = np.array(list(multi_input()))
l = np.abs(l - max(l))
l.sort()

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

Solution (Python):

a, b, c = sorted(map(int, input().split()))
d = b - a
print(c - b + d//2 + d%2*2)

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

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A = LIST()
A.sort()

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

if (A[2]-A[0])%2 +  (A[2]-A[1])%2 == 1:
	ans += 2
elif (A[2]-A[0])%2 +  (A[2]-A[1])%2 == 2:
	ans += 1

print(ans)

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

count  = (b - a) // 2
count += 2 if (a + count * 2) != b else 0
count += c - b
print(count)

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

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

ans = 0
for i in range(2):
    cnt = (li[2] - li[i]) // 2
    li[i] += 2 * cnt
    ans += cnt

ans += li.count(max(li)) % 3
print(ans)

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

Solution (Python):
import numpy as np
A =np.array(sorted(list(map(int,input().split()))))
a = max(A)
b = a -A

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    A, B, C = map(int, readline().split())
    a = min(A,B,C)
    c = max(A,B,C)
    b = (A+B+C)-(a+c)
    if a==b:
        ans = c-a
    else:
        ans = (b-a)//2
        a += ((b-a)//2)*2
        ans += c-a
        b += c - a
        a = c
        if a!=b:
            ans += 1
    print(ans)



if __name__ == '__main__':
    main()

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

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

while num[0]<num[1]:
    ans += 1
    num[0] += 2
    
if num[0] != num[1]:
    ans += 1
    
print(ans)

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

m = max(a, max(b, c))

if (3 * m - (a + b + c)) % 2 == 0:
    print((3 * m - (a + b + c)) // 2)
else:
    print((3 * (m + 1) - (a + b + c)) // 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()
a=n[0]
b=n[1]
c=n[2]
if (a+c)%2==1:
  if (a+b)%2==1:
    print(1+(c-b)//2+(c+1-a)//2)
  else:
    print((c-(b+1))//2+(c-(a+1))//2+1)
else:
  if (a+b)%2==0:
    print((c-b)//2+(c-a)//2)
  else:
    print((c-a)//2+(c+1-b)//2+1)

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

C = sorted(list([a, b, c]))

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

if (d1 - d2) % 2 == 0:
    print(d2 + (d1 - d2)//2)
else:
    print(d2 + (d1 - d2)//2 + 2)

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

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

    if abs(A-B) % 2 == 0:
        while A != B:
            A += 2
            cnt += 1

        while A != C and B != C:
            A += 1
            B += 1
            cnt += 1

        print(cnt)
    else:
        while B != C:
            A += 1
            B += 1
            cnt += 1

        while A < B:
            A += 2
            cnt += 1

        while A != C:
            B += 1
            C += 1
            cnt += 1

        print(cnt)  
if __name__ == "__main__":
    main()

Solution (Python):

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

mx = max(X)
sm = sum(X)

if 3*mx % 2 == sm % 2:
    N = (3*mx-sm)/2
else:
    N = (3*(mx+1)-sm)/2
print(int(N))

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

Solution (Python):
A = [int(i) for i in input().split()]
A.sort()
s,m,l = A
count = 0
ls = l-s
lm = l-m
count += ls//2
count += lm//2
if ls%2 == 0 and lm%2 == 0:
  print(count)
  exit()
elif ls%2 == 1 and lm%2 == 1:
  count += 1
  print(count)
else:
  count += 2
  print(count)

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


anum=(c-a)//2
amari=(c-a)%2

bnum=(c-b)//2
bamari=(c-b)%2
c=amari+bamari

if c==0:
    plus=0
elif c==1:
    plus=2
else:
    plus=1
print(anum+bnum+plus)

Solution (Python):
from sys import stdin
import sys
import math

def isOdd(n):
    return n % 2 == 1

def isPair(n):
    return n % 2 == 0


A, B, C = list(map(int, stdin.readline().rstrip().split()))

l, m, n = sorted([A, B, C], reverse=True)

count = 0


while l > m or l > n:
    if isOdd(l) and isOdd(m) and isPair(n) or isPair(l) and isPair(m) and isOdd(n):
        l += 1
        m += 1
        count += 1
    elif isOdd(l) and isPair(m) and isOdd(n) or isPair(l) and isOdd(m) and isPair(n):
        l += 1
        n += 1
        count += 1
    elif isPair(l) and isOdd(m) and isOdd(n) or isOdd(l) and isPair(m) and isPair(n):
        m += 1
        n += 1
        count += 1
    else:
        if l > m:
            count += (l - m) // 2
            m += (l - m)
        if l > n:
            count += (l - n) // 2
            n += (l - n)

print(count)

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

X = max(A,B,C)

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

print(ans//2)

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

X = max(A,B,C)

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

print(ans//2)

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

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

if (x*3-sum(li))%2 == 1: 
    x += 1 

print((x*3-sum(li)+1)//2)

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

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

Solution (Python):
li = list(map(int, input().split()))
even_count = sum([l % 2 for l in li])
ans = 1
if even_count == 1:
    li = [l + 1 if l % 2 == 0 else l for l in li]
elif even_count == 2:
    li = [l + 1 if l % 2 == 1 else l for l in li]
else:
    ans = 0
ans += sum([(max(li) - l) // 2 for l in li])
print(ans)

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

Solution (Python):
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

    a, b, c = sorted([a, b, c])

    op1 = c - b
    op2 =  math.ceil((c - (a + op1)) / 2)

    if a + op1 + 2*op2 > c:
        op1 += 1

    print(op1 + op2)


if __name__ == '__main__':
    main()

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

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

Solution (Python):






def main():
    a, b, c = map(int, input().split())
    a, b, c = sorted([a, b, c], reverse=True)

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


print(main())

Solution (Python):
abc = list(map(int,input().split()))
guki = [abc[0] % 2,abc[1] % 2,abc[2] % 2]
cnt_gusu = 0
cnt = 0
for i in abc:
    if i % 2 == 0:
        cnt_gusu += 1
if cnt_gusu == 2:
    cnt += 1
    for i in range(3):
        if abc[i] % 2 == 0:
            abc[i] += 1
elif cnt_gusu == 1:
    cnt += 1
    for i in range(3):
        if abc[i] % 2 == 1:
            abc[i] += 1
set_abc = set(abc)
abc.sort()
if len(set_abc) == 1:
    print(cnt)
elif len(set_abc) == 2:
    maxv = max(abc)
    jud = 0
    for i in abc:
        if i == maxv:
            jud += 1
    if jud == 2:
        cnt += (abc[2] - abc[0]) // 2
    else:
        cnt += (abc[2] - abc[0])
    print(cnt)
else:
    zouka = abc[2] - abc[1]
    cnt += zouka + ((abc[2] - (abc[0]+zouka) ) // 2)
    print(cnt)

Solution (Python):

















import sys
sys.setrecursionlimit(10000)
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
    if d % 2 == 0:
        
        print(d//2)
        
    else:
        print(d//2 + 2)
        
if __name__ == '__main__':
  main()

Solution (Python):
n = list(map(int, input().split()))
n.sort()
sum = 0
k1 = n[2] - n[1]
n[0] += 1
n[1] += 1
sa = n[1] - n[0]
m,d = divmod(sa,2)
if d == 1:
    sum += 2
sum += k1 + m
print(sum)

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

Solution (Python):
A,B,C=map(int,input().split())
M=[A,B,C]
M.sort()
kaisuu1=M[2]-M[1]
M[0]+=kaisuu1
M[1]+=kaisuu1
nokori=M[1]-M[0]
q,r=divmod(nokori,2)
sum_kaisuu=kaisuu1+q
if r==1:
    sum_kaisuu+=2
print(sum_kaisuu)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    L=list(map(int,input().split()))
    even=[False]*3
    ans=0
    for i in range(3):
        if L[i]%2==0:
            even[i]=True

    M=L.index(max(L))
    if even.count(even[M]) in [1,3]:
        ans+=(max(L)*3-sum(L))//2
    else:
        ans+=1
        ans+=((max(L)+1)*3-(sum(L)+2))//2


    print(ans)






resolve()

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

if not (A % 2 == B % 2 == C % 2):
    G = [[], []]
    for n in (A, B, C):
        G[n % 2].append(n)
    G.sort(key=lambda a: len(a))

    G[1][0] += 1
    G[1][1] += 1

    A, B, C = G[0][0], G[1][0], G[1][1]
    ans += 1

mx = max(A, B, C)
ans += (mx - A) // 2 + (mx - B) // 2 + (mx - C) // 2
print(ans)

Solution (Python):
ABC = list(map(int, input().split()))
n_odd = sum([Xi % 2 for Xi in ABC])

ans = 0
if n_odd == 1:
    ans += 1
    ABC[0] += int(ABC[0] % 2 == 0)
    ABC[1] += int(ABC[1] % 2 == 0)
    ABC[2] += int(ABC[2] % 2 == 0)
elif n_odd == 2:
    ans += 1
    ABC[0] += int(ABC[0] % 2 == 1)
    ABC[1] += int(ABC[1] % 2 == 1)
    ABC[2] += int(ABC[2] % 2 == 1)

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

print(ans)

Solution (Python):

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

d = C - B
A += d
B += d


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

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    L = [int(i) for i in input().split()]
    count = 0
    L.sort()
    addMin = (L[2] - L[0]) // 2  
    addMid = (L[2] - L[1]) // 2
    count = addMin + addMid
    L[0] += addMin * 2
    L[1] += addMid * 2
    if L[0] < L[2] and L[1] < L[2]: print(count + 1)
    elif L[0] == L[1] == L[2]: print(count)
    else: print(count + 2)
    

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
a = list(map(int, input().split()))
n = []
for i in range(len(a)):
  if a[i] % 2 == 0: n.append(i+1)
if len(n) == 3:
  a.sort()
  ans = (a[2]-a[0]) // 2 + (a[2] - a[1]) // 2
elif len(n) == 2:
  N = 3 - sum(n) - 1 
  ans = 0
  if a[N] != max(a):
    while a[N] < max(a):
      a[N] += 2
      ans += 1
  a.sort()
  ans += (a[1] - a[0]) // 2 + a[2] - a[1]
elif len(n) == 1:
  for i in range(len(a)):
    if a[i] % 2 != 0:
      a[i] += 1
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1
else:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
print(ans)

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

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import math
lis = list(map(int,input().split()))
lis.sort()
ans = 0
while True:
    if lis[0] == lis[2]:
        print(ans)
        exit()
    if lis[0] == lis[1]:
        lis[0] += 1
        lis[1] += 1
    else:
        lis[0] += 2
    ans += 1
    lis.sort()

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


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

    if abc.count(max(abc)) >= 2:
        abc[abc.index(min(abc))] += 2
    else:
        if abc[0] != max(abc):
            abc[0] += 1
        if abc[1] != max(abc):
            abc[1] += 1
        if abc[2] != max(abc):
            abc[2] += 1
    ans += 1

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

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

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

lst = [A, B, C]
lst.sort(reverse = True)
ctr = 0

while lst[0] > lst[1]:
    lst[1] += 1
    lst[2] += 1
    ctr += 1

while lst[1] > lst[2]:
    lst[2] += 2
    ctr += 1

if lst[2] > lst[1]:
    ctr += 1

print(ctr)

Solution (Python):
def resolve():
  l = list(map(int, input().split()))
  l.sort()
  a, b, c = l[0], l[1], l[2]
  ans = 0
  ans += c - b
  a += ans
  while a < c:
    a += 2
    ans += 1
  if a > c:
    ans += 1
  print(ans)

  return

if __name__ == "__main__":
  resolve()

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b,c=MI()
    t=max(a,b,c)
    temp=3*t-(a+b+c)
    if temp%2==1:
        temp+=3
    print(temp//2)

main()

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

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

max_v = l[2]
mid_v = l[1]
min_v = l[0]

count = max_v - mid_v
mid_v = max_v
min_v = min_v + count
diff = max_v - min_v

if diff == 0:
    count = count
elif diff == 1:
    count += 2  
elif diff > 1 and diff % 2 == 0:
    count += diff / 2
elif diff > 1 and diff % 2 == 1:
    count += int(diff / 2)
    count += 2
else:
    print("Error")
print(int(count))

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

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

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

Solution (Python):
num = [int(i) for i in input().split()]
sorted_num = sorted(num)

if sorted_num[0] % 2 == sorted_num[1] % 2:
    count = sorted_num[2] - (sorted_num[0] + sorted_num[1])/2
elif sorted_num[0] % 2 != sorted_num[1] % 2:
    count = ((sorted_num[2] + 1) - (sorted_num[0] + sorted_num[1] + 1)/2) + 1

print(int(count))

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

x = max(a)
while (3 * x) % 2 != sum(a) % 2:
    x += 1
ans = (3 * x - sum(a)) // 2
print(ans)

Solution (Python):

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

x = max(a)
if (3 * x) % 2 != sum(a) % 2:
    x += 1
ans = (3 * x - sum(a)) // 2
print(ans)

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

S = A + B + C
b = 0

while S % 3 != 0:
    S += 2
    b += 1

while (S // 3) < max(A,B,C):
    S += 6
    b += 3

print(b)

Solution (Python):
















A,B,C = map(int,input().split())
lis = [A,B,C]
lis.sort()
cnt_1 = lis[2]-lis[1]
nokori = lis[2]-lis[0]-cnt_1
if (lis[2]-lis[0]-cnt_1)%2 == 0:
    cnt_2 = nokori//2
else:
    cnt_2 = (nokori+1)//2 + 1

ans = cnt_1+cnt_2
print(ans)

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

ans = 0

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

Solution (Python):


import io
import sys

array = sorted(list(map(int,input().split())))

nim = array[2]*2 - array[0] - array[1]

if nim%2 == 1:
    nim += 3

print(nim//2)

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

m = max(a,b,c)

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

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

Solution (Python):
A, B, C = sorted(map(int, input().split()), reverse=True)
gap = 2 * A - B - C

print(gap // 2 + gap % 2 * 2)

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

ans += sa // 2
if sa & 1:
    ans += 2
print(ans)

Solution (Python):

def myAnswer(A:int,B:int,C:int) -> int:
   MAX = max(A,B,C)
   ABC = sorted([A,B,C])
   counter = 0
   while ABC[0] != ABC[1] or ABC[1] != ABC[2]:
      if(ABC[1] == ABC[2]):
         ABC[0] += 2
         ABC.sort()
         counter +=1
      else:
         ABC[0] += 1
         ABC[1] += 1
         ABC.sort()
         counter += 1
   return counter


def modelAnswer():
   tmp=1
def main():
   A,B,C = map(int,input().split())
   print(myAnswer(A,B,C))
if __name__ == '__main__':
   main()

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

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

    m = max(A, B, C)
    if m == A:
        ma = max(B, C)
        ans = m - ma
        B += ans
        C += ans
    elif m == B:
        ma = max(C, A)
        ans = m - ma
        C += ans
        A += ans
    else:
        ma = max(A, B)
        ans = m - ma
        A += ans
        B += ans
    
    b = (max(A, B, C) - min(A, B, C)) % 2
    ans += (max(A, B, C) - min(A, B, C)) // 2 + b * 2
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
a, b, c = map(int, input().split())
l = [a, b, c]
l.sort()
a, b, c = l[0], l[1], l[2]
cnt = 0
while not (a == b and b == c and a == c):
    a, b, c = l[0], l[1], l[2]
    if a+2 <= c:
        a += 2
    elif b+2 <= c:
        c += 2
    else:
        a += 1
        b += 1
    l[0] = a
    l[1] = b
    l[2] = c
    l.sort()
    cnt += 1
print(cnt)

Solution (Python):

import sys


def solve(A: int, B: int, C: int):
    x = 3 * max([A, B, C]) - A - B - C
    print(x // 2 + x % 2 * 2)


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


if __name__ == '__main__':
    main()

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

ax = (s[2] - s[0]) // 2
bx = (s[2] - s[1]) // 2

s[0] += ax * 2
s[1] += bx * 2

if s[0] == s[1] and s[0] != s[2]:
    print(ax + bx + 1)
if (s[0] != s[1] and s[0] == s[2]) or (s[0] != s[1] and s[1] == s[2]):
    print(ax + bx + 2)
if s[0] == s[1] and s[1] == s[2] and s[0] == s[1]:
    print(ax+bx)

Solution (Python):


A = list(map(int, input().split()))
A.sort()
ans = A[2] - A[1]
sa = A[2] - (A[0] + ans)

ans += sa // 2
if sa & 1:
    ans += 2
print(ans)

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