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):
from sys import stdin
A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
d = sorted([A,B,C])
 
a = A % 2
b = B % 2
c = C % 2
 
if a == b == c:
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    
elif a == b:
    A += 1
    B += 1
    d = sorted([A,B,C])
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    ans += 1
    
elif a == c:
    A += 1
    C += 1
    d = sorted([A,B,C])
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    ans += 1
 
elif c == b:
    B += 1
    C += 1
    d = sorted([A,B,C])
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    ans += 1
 
    
print(ans)

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

count = 0
while nums[0] != nums[1] or nums[1] != nums[2]:
    if nums[1] != nums[2]:
        nums[1] += 1
        nums[0] += 1
        count += 1
    else:
        nums[0] += 2
        count += 1
    nums.sort()
print(count)

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

i = 0
while l[1] != l[2]:
  l[0], l[1] = l[0]+1, l[1]+1
  i += 1

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

Solution (Python):
from math import ceil
vals=list(map(int, input().split()))
cnt=0
vals.sort(reverse=True)
cnt += vals[0] - vals[1]
diffmaxmin = vals[0] - (vals[2] + cnt)
if diffmaxmin % 2 == 0:
    cnt += diffmaxmin/2
else:
    cnt += ceil(diffmaxmin/2) + 1

print(int(cnt))

Solution (Python):
a = list(map(int,input().split()))
ans = 0
if (a[0]%2+a[1]%2+a[2]%2) == 1:
    a = [i+1 if (i%2)==0 else i for i in a]
    ans += 1
    b,a[a.index(min(a))] = (max(a) - min(a))//2,max(a)
    c,a[a.index(min(a))] = (max(a) - min(a))//2,max(a)
    ans += (b+c)
elif (a[0]%2+a[1]%2+a[2]%2) == 2:
    a = [i+1 if (i%2)==1 else i for i in a]
    ans += 1
    b,a[a.index(min(a))] = (max(a) - min(a))//2,max(a)
    c,a[a.index(min(a))] = (max(a) - min(a))//2,max(a)
    ans += (b+c)
else:
    b,a[a.index(min(a))] = (max(a) - min(a))//2,max(a)
    c,a[a.index(min(a))] = (max(a) - min(a))//2,max(a)
    ans += (b+c)
print(ans)

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

Solution (Python):
import itertools

def getint(): return int(input())
def getints(): return list(map(int, input().split()))

a,b,c = getints()

res = 0
if a % 2 == b % 2 and a % 2 != c % 2:
    a += 1
    b += 1
    res += 1
if b % 2 == c % 2 and c % 2 != a % 2:
    b += 1
    c += 1
    res += 1
if c % 2 == a % 2 and a % 2 != b % 2:
    c += 1
    a += 1
    res += 1

xs = list(sorted([a,b,c]))
while xs[0] != xs[2]:
    xs[0] += 2
    xs = list(sorted(xs))
    res += 1

print(res)

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

ans = 0
samenum = 0
for i in range(3):
    num = (max(ABC) - ABC[i]) // 2
    ABC[i] += num * 2
    ans += num
    if ABC[i] == max(ABC):
        samenum += 1

if samenum == 2:
    ans += 2
elif samenum == 1:
    ans += 1

print(ans)

Solution (Python):
a,b,c = map(int,input().split())
cnt = 0
if a%2 == b%2 and a%2 != c%2:
  a += 1
  b += 1
  cnt += 1
elif a%2 == c%2 and a%2 != b%2:
  a += 1
  c += 1
  cnt += 1
elif b%2 == c%2 and a%2 != b%2:
  b += 1
  c += 1
  cnt += 1
M = max(a,b,c)
print(int(cnt + (M-a)/2 + (M-b)/2 + (M-c)/2))

Solution (Python):
lst = [int(i) for i in input().split()]
if len(set(lst))==1:
    print(0)
    exit()

lst.sort()
dist1 = lst[2] - lst[0]
dist2 = lst[2] - lst[1]

if dist1 == dist2:
    print(dist1)
else:
    cnt = dist2
    dist1 -= dist2
    if dist1 % 2 == 0: 
        cnt += dist1 // 2
    else:
        cnt += dist1 // 2 + 2
    print(cnt)

Solution (Python):
lst = [int(i) for i in input().split()]
if len(set(lst))==1:
    print(0)
    exit()

lst.sort()
dist1 = lst[2] - lst[0]
dist2 = lst[2] - lst[1]

if dist1 == dist2:
    print(dist1)
else:
    cnt = dist2
    dist1 -= dist2
    if dist1 % 2 == 0: 
        cnt += dist1 // 2
    else:
        cnt += dist1 // 2 + 2
    print(cnt)

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

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

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

Solution (Python):
l = list(map(int, input().split()))
l.sort(reverse=True)
x = l[0] - l[1]
y = l[0] - l[2]
count = 0

if x % 2 == 0 and y % 2 == 1:
    x += 1
    count += 1
if y % 2 == 0 and x % 2 == 1:
    y += 1
    count += 1

if x % 2 == 1 and y % 2 == 1:
    count += (x+1)//2
    count += (y-1)//2
    print(count)
elif x % 2 == 0 and y % 2 == 0:
    print((x+y)//2)

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

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

Solution (Python):
s=list(map(int, input().split()))
t=sorted(s)
ans=(t[2]-t[1])+(t[2]-t[0])
if s[0]%2==0 and  s[1]%2==0 and s[2]%2==0\
or s[0]%2==1 and s[1]%2==1 and s[2]%2==1:
    print(ans//2)
else:
    if (sum(s))%2==1:
        if t[2]%2==0:
            print((ans+3)//2)
        else:
            print(ans//2)
    else:
        if t[2]%2==1:
            print((ans+3)//2)
        else:
            print(ans//2)

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

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

X.sort()
fir = (X[2]-X[1])%2
sec = (X[2]-X[0])%2
if (fir == 0 and sec == 0):
	ans = (X[2]-X[1])//2+(X[2]-X[0])//2
elif (fir == 1 and sec == 1):
	ans = (X[2]-X[1])//2+(X[2]-X[0])//2+1
else:
	ans = (X[2]-X[1])//2+(X[2]-X[0])//2+2

print(ans)

Solution (Python):

tmp = list(map(int, input().split()))
tmp = sorted(tmp)
A = tmp[0]
B = tmp[1]
C = tmp[2]
ans = 0
ca = (C - A) // 2
cb = (C - B) // 2
ans += ca + cb
A = A + ca * 2
B = B + cb * 2
if C == A and C == B:
    print(ans)
elif C == A and C == B + 1:
    print(ans + 2)
elif C == A + 1 and C == B:
    print(ans + 2)
elif C == A + 1 and C == B + 1:
    print(ans + 1)

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

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

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

Solution (Python):
a, b, c = sorted([int(i) for i in input().split()])
ans = 0
ans += (b - a) // 2 
ans += (b - a) % 2 
c += (b - a) % 2 
ans += (c - b) 

print(ans)

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

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

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

print(ans)

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

Solution (Python):
a,b,c = map(int,input().split())
ssum = a+b+c
target = max(a,b,c)*3
i = 0
while True:
  if(ssum%3==0 and ssum>=target): break;
  ssum += 2
  i += 1
print(i)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    s = S()
    s.sort()
    if s == ["a", "b", "c"]:
        print("Yes")
    else:
        print("No")
    return


def B():
    a, b, k = LI()
    ans = []
    for i in range(a, min(a + k, b + 1)):
        ans.append(i)
    for i in range(max(b - k + 1, a + k), b + 1):
        ans.append(i)
    for i in ans:
        print(i)
    return


def C():
    abc= LI()
    abc.sort()
    a,b,c = abc
    a1 = (c - a) % 2
    b1 = (c - b) % 2
    if a1 and b1:
        print((c - a) // 2 + (c - b) // 2 + 1)
        return
    if a1 or b1:
        print((c - a) // 2 + (c - b) // 2 + 2)
        return
    print((c - a) // 2 + (c - b) // 2 )

    return


def D():
    return


if __name__ == '__main__':
    C()

Solution (Python):
alist=[int(i) for i in input().split()]
alist.sort()
a=alist[0]
b=alist[1]
c=alist[2]
if (c-a) %2 !=0 and (c-b)%2 !=0:
	print((c-a) //2+(c-b) //2+1)
elif (c-a) %2 !=0 or (c-b)%2 !=0:
	print((c-a) //2+(c-b) //2+2)
else:
	print((c-a) //2+(c-b) //2)

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

def g(t, x):
  res = 0
  while t > x:
    x += 2
    res += 1
  if t < x:
    res += x - t
  return res
  
def f(t, A, B, C):
  return g(t, A) + g(t, B) + g(t, C)

ans = 99999
for t in range(0, 401):
  ans = min(ans, f(t, A, B, C))
print(ans)

Solution (Python):
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	o = list(map(int,input().split()))
	m = max(o)
	o.remove(m)
	diff = 2*m - sum(o)
	if(diff%2==0):
		print(diff//2)
	else:
		m+=1
		o[0]+=1
		print((2*m-sum(o))//2 + 1)


def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

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

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

Solution (Python):

import itertools

A = [int(el) for el in input().split(' ')]

y = max(A)
for x in itertools.count(max(A)):
    if (3*x - sum(A)) % 2 == 0:
        y = x
        break

k = (3*x - sum(A))/2
print(int(k))

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

Solution (Python):
l=sorted(list(map(int,input().split())))
if (l[2]*3-sum(l))%2==0 and (l[0]+l[1])%2==0:print((l[2]*3-sum(l))//2)
else:print((l[2]*3-sum(l))//2+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):
X = list(map(int, input().split()))

X.sort()

A, B, C = X
k = 2*C - A - B
ans = k // 2
if k % 2 != 0:
    ans += 2

print(ans)

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

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

Solution (Python):
A, B, C = map(int, input().split())
max_num = max(A, B, C)
count = A + B + C
ans = 0
while True:
    if count % 3 == 0 and count / 3 >= max_num:
        break
    else:
        count += 2
        ans += 1
print(ans)

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

flg = True
cnt = a + b + c
cnt_max = max(a, b, c)
ans = 0
while(flg):
    if cnt % 3 == 0 and cnt / 3 >= cnt_max:
        flg = False
    else:
        cnt += 2
        ans += 1

print(ans)

Solution (Python):









X=list(map(int,input().split()))
X.sort()
q=(X[1]-X[0])//2
r=(X[1]-X[0])%2
ans=q+2*r+(X[2]-X[1])
print(ans)

Solution (Python):
def diff(a):
    m = min(a)
    return sum(map(lambda x: x - m, a))

a, b, c = map(int, input().split())
cnt = 0
while a != b or b != c:
    next = []
    next.append([a + 2, b, c])
    next.append([a, b + 2, c])
    next.append([a, b, c + 2])
    next.append([a + 1, b + 1, c])
    next.append([a + 1, b, c + 1])
    next.append([a, b + 1, c + 1])
    d = list(map(lambda x: diff(x), next))
    m = min(d)
    i = d.index(m)
    a, b, c = tuple(next[i])
    
    cnt += 1
    
    
print(cnt)

Solution (Python):
import math
buff = list(map(int, input().split()))












buff.sort()
med = buff[2]-buff[1]

buff[0] = buff[0]+med
tyuk = buff[2]-buff[0]

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

Solution (Python):
A,B,C=map(int, input().split())
odd=[]
even=[]
for x in [A,B,C]:
    if x%2==0:
        even.append(x)
    else:
        odd.append(x)
cnt = 0
ns = []
if len(even) == 2:
    for x in even:
        cnt = 1
        ns.append(x+1)
else:
    ns.extend(even)
if len(odd) == 2:
    for x in odd:
        cnt = 1
        ns.append(x+1)
else:
    ns.extend(odd)

ns.sort()
max_v = max(ns)
for x in ns:
    cnt += (max_v-x) // 2

print(cnt)

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

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

Solution (Python):
A,B,C=map(int,input().split())
a=A
b=B
c=C
cnt=0
if a%2 == b%2:
  if b%2 != c%2:
    a+=1
    b+=1
    cnt+=1
else:
  if b%2 == c%2:
    b+=1
    c+=1
    cnt+=1
  else:
    a+=1
    c+=1
    cnt+=1
numlist=[a,b,c]
numlist.sort()
cnt+=(numlist[2]-numlist[0])/2
cnt+=(numlist[2]-numlist[1])/2
print(int(cnt))

Solution (Python):


import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    A, B, C = read_h()

    m3 = max(A, B, C) * 3
    sm = sum((A, B, C))
    if m3 % 2 == sm % 2:
        print((m3 - sm) // 2)
    else:
        print((m3 + 3 - sm) // 2)


if __name__ == '__main__':
    main()

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

E = [a for a in A if a % 2 == 0]
O = [a for a in A if a % 2 == 1]

ans = 0

if len(E) == 2:
    ans += 1
    E = [e + 1 for e in E]
    A = E + O

if len(O) == 2:
    ans += 1
    O = [o + 1 for o in O]
    A = E + O

biggest = max(A)
A = [biggest - a for a in A]
print(ans + sum(A) // 2)

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

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

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	A, B, C = map(int, input().split(" "))
	
	ans = 0
	todo = 0
	base = max(A,B,C)
	
	if base > A:
		tmp = (base - A) // 2
		ans += tmp
		if (base - A) % 2 == 1:
			todo += 1
	if base > B:
		tmp = (base - B) // 2
		ans += tmp
		if (base - B) % 2 == 1:
			todo += 1
	if base > C:
		tmp = (base - C) // 2
		ans += tmp
		if (base - C) % 2 == 1:
			todo += 1
			
	if todo == 2:
		ans += 1
	if todo == 1:
		ans += 2
		
	print(ans)
			
	
if __name__ == "__main__":
	main()

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

Solution (Python):
a, b, c = map(int, raw_input().split())
t = 0
while a != b or b != c or c != a:
    a, b, c = sorted([a, b, c])
    t += (c-a)/2
    a += (c-a)/2 * 2
    t += (c-b)/2
    b += (c-b)/2 * 2
    a, b, c = sorted([a, b, c])
    if a == b and a == c - 1:
        a += 1
        b += 1
        t += 1
    elif b == c and a == b - 1:
        a += 2
        t += 1
print t

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

Solution (Python):
a,b,c = map(int, input().split())
di = 3*max(a,b,c) - (a+b+c)

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

Solution (Python):
a, b, c = map(int, input().split())
ans = 0
if(a % 2 == b % 2 and b % 2 != c % 2 and a % 2 != c % 2):
    a += 1
    b += 1
    ans += 1
elif(a % 2 != b % 2 and b % 2 != c % 2 and a % 2 == c % 2):
    a += 1
    c += 1
    ans += 1
elif (a % 2 != b % 2 and b % 2 == c % 2 and a % 2 != c % 2):
    b += 1
    c += 1
    ans += 1
maxValue = max(a, b, c)
ans += int((maxValue - a) / 2 + (maxValue - b) / 2 + (maxValue - c) / 2)
print(ans)

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

li.sort()

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

cnt = 0

while True:
    if a != 0:
        if a % 2 == 0:
            a -= 2
            c -= 2
            cnt += 1
        else:
            a -= 1
            b += 1
            cnt += 1
    else:
        cnt += b
        break
    
print(cnt)

Solution (Python):

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

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

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

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

abc.sort()
dif1 = abc[2] - abc[1]
dif2 = abc[1] - abc[0]
if dif2 % 2 == 0:
    print(dif1 + dif2//2)
else:
    print(dif1 + (dif2+1)//2 + 1)

Solution (Python):
from functools import reduce
import math

def main():
    
    
    
    

    
    
    
    
    
    

    
    

    
    
    
    
    
    
    
    
    
    INF = float("inf")

    
    MOD = 10**9+7
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    a = list(int(_) for _ in input().split())
    a.sort()
    A = a[0]
    B = a[2]
    C = a[1]    
    if (C-A)%2 == 0:
        print((B-C)+math.ceil((C-A)/2))
    else:
        print((B-C)+math.ceil((C-A)/2)+1)
        
if __name__ == '__main__':
    main()

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

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

L.sort()

cnt = 0
while L[1] != L[2]:
    L[0] += 1
    L[1] += 1
    cnt += 1

if (L[1] - L[0]) % 2 == 1:
    L[1] += 1
    L[2] += 1
    cnt += 1

cnt += (L[1] - L[0])//2

print(cnt)

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

count = 0
flag = 0

while flag == 0:
    if a_s[0] == a_s[1] and a_s[1] == a_s[2]:
        flag = 1
        break
    a_s = sorted(a_s)
    count += 1
    if a_s[2] > a_s[1] and a_s[2] > a_s[0]:
        a_s[0] += 1
        a_s[1] += 1
    else:
        a_s[0] += 2

print(count)

Solution (Python):

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

lis.sort()


if (lis[2] % 2 == lis[1] % 2 and lis[2] % 2 != lis[0] % 2 ) or (lis[2] % 2 == lis[0] % 2 and lis[2] % 2 != lis[1] % 2 ):
    tall = lis[2] + 1

else:
    tall = lis[2]

print ((3*tall - lis[0] - lis[1] - lis[2]) // 2)

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

if (max(a)-a[0])%2==0 and (max(a)-a[1])%2==0:
    print(int((max(a)*3-sum(a))/2))
elif (a[2]-a[0])%2==1 and (a[2]-a[1])%2==1:
    print(int((max(a)*3-sum(a))/2))
else:
    print(int((max(a)*3-sum(a))/2)+2)

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

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

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

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

sorted_num = sorted(numbers)

maximum = max(numbers)
second_max = sorted_num[1]
minimum = min(numbers)

first_step = (maximum - second_max) // 2
second_step = (maximum - minimum) // 2

if (maximum - second_max) % 2 == 1 and (maximum - minimum) % 2 == 1:
    first_step += 1
if (maximum - second_max) % 2 == 1 and (maximum - minimum) % 2 == 0:
    first_step += 2
if (maximum - second_max) % 2 == 0 and (maximum - minimum) % 2 == 1:
    first_step += 2
print(first_step + second_step)

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

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

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

a.sort()

x1 = int(a[2]) -  int(a[0])
x2 = int(a[2]) -  int(a[1])




d1 = divmod(x1,2)
d2 = divmod(x2,2)

total = 0
amari = 0

if d1[1] == 0:
    total += d1[0]
else:
    total += d1[0]
    amari += d1[1]

if d2[1] == 0:
    total += d2[0]
else:
    total += d2[0]
    amari += d2[1]



if amari != 0:
    if amari % 2 == 0:
        total += 1
    else:
        total += 2

print(total)

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

ABC_mod = [i%2 for i in ABC]
ABC_plus_1 = []
if ABC_mod.count(1) == 1 or ABC_mod.count(1) == 3:
  for i in range(3):
    ABC_plus_1.append(1-ABC_mod[i])
else:
  ABC_plus_1 = ABC_mod
for i in range(3):
  ABC[i] = ABC[i] + ABC_plus_1[i]

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

ans = sum(ABC_plus_1)//2 + ABC_plus_2
print(ans)

Solution (Python):
A,B,C = map(int,input().split())
L = [A,B,C]
t = 0
L.sort()
if L[0] == L[1] == L[2]:
  print(0)
else:
  for i in range(3):
    if L[i]%2 == 0:
      t += 1
  if t == 3 or t == 0:
    print((L[2]-L[0])//2+(L[2]-L[1])//2)
  elif t == 2:
    if L[0]%2 != 0:
      L[1] += 1
      L[2] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
    elif L[1]%2 != 0:
      L[0] += 1
      L[2] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
    else:
      L[0] += 1
      L[1] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
  else:
    if L[0]%2 == 0:
      L[1] += 1
      L[2] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
    elif L[1]%2 == 0:
      L[0] += 1
      L[2] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//2)
    else:
      L[0] += 1
      L[1] += 1
      print(1+(L[2]-L[0])//2+(L[2]-L[1])//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((2*x[2]-x[1]-x[0])//2)
else:
    x = [a,b,c]
    cnt = 0
    for i in range(3):
        if x[i] % 2 == 0:
            cnt += 1
    if cnt == 1:
        for i in range(3):
            if x[i] % 2 == 1:
                x[i] += 1
        x.sort()
        print((2*x[2]-x[1]-x[0])//2 +1)
    else:
        for i in range(3):
            if x[i] % 2 == 0:
                x[i] += 1
        x.sort()
        print((2*x[2]-x[1]-x[0])//2 +1)

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

Solution (Python):
a,b,c=map(int,input().split())
ans=0
[a,b,c]=sorted([a,b,c],reverse=True)
d,e,f=a%2,b%2,c%2
if d==e and e==f:
  case=0
  print((2*a-b-c)//2)
elif (d!=e or d!=f) and e==f:
  case=1
  print((2*a-b-c)//2)
else:
  case=2
  print(1+((a+1)*2-1-b-c)//2)

Solution (Python):
nums = [int(i) for i in input().split()]
ans = 0
jud = [i%2 for i in nums]
if jud != [1,1,1] and jud != [0,0,0]:
    if jud.count(0)>jud.count(1):
        for i,a in enumerate(jud):
            if a == 0:  nums[i] += 1
    else:
        for i,a in enumerate(jud):
            if a == 1:  nums[i] += 1
    ans += 1

mn = max(nums)

for num in nums:
    ans += (mn-num)//2
print(ans)

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

Solution (Python):
l = sorted(list(map(int, input().split())))
aq = (l[2] - l[0]) // 2
ar = (l[2] - l[0]) % 2
bq = (l[2] - l[1]) // 2
br = (l[2] - l[1]) % 2
cnt = aq + bq

if ar == 1 and br == 1:
    print(cnt + 1)
elif ar == 1 or br == 1:
    print(cnt+2)
else:
    print(cnt)

Solution (Python):
N = input().split()
NN = []
for i in range(3):
    NN.append(int(N[i]))
NN.sort()
A = NN[0]
B = NN[1]
C = NN[2]

count = 0

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

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

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

cnt = 0
while a < c-1:
    a += 2
    cnt += 1

while b < c-1:
    b += 2
    cnt += 1

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

Solution (Python):
abc = list(map(int, input().split()))
m = max(abc)
t = sum(abc)

if (m * 3) % 2 != t % 2:
    m = m + 1

print(int((m * 3 - t) / 2))

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

Solution (Python):
num = [int(x) for x in input().split()]
ans = 0

while((num[0] == num[1] and num[1] == num[2]) == 0):
    ans += 1
    num.sort()
    if num[1] == num[2]:
        num[0] += 2
    else :
        num[0] += 1
        num[1] += 1
    
print(ans)

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

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

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

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

abc = list(map(int, input().split()))
cnt = 0
abc.sort()
if (abc[1]%2 == 1 and abc[0]%2 == 0) or (abc[0]%2 == 1 and abc[1]%2 == 0):
    cnt += 1
    abc[1] += 1
    abc[2] += 1
cnt += abc[2]-abc[1] + math.floor((abc[1]-abc[0])/2)
print(cnt)

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

Solution (Python):
num = list(map(int,input().split()))
a = 0
for i in num:
    a += max(num) - i
if a % 2 == 0:
    print((max(num)*3-sum(num))//2)
else:
    print(((max(num)+1)*3-sum(num))//2)

Solution (Python):
l = sorted(list(map(int, input().split())))
aq = (l[2] - l[0]) // 2
ar = (l[2] - l[0]) % 2
bq = (l[2] - l[1]) // 2
br = (l[2] - l[1]) % 2
cnt = aq + bq

if ar == 1 and br == 1:
    print(cnt + 1)
elif ar == 1 or br == 1:
    print(cnt+2)
else:
    print(cnt)

Solution (Python):
itg=sorted([int(i) for i in input().split()])
a=itg[2]-itg[0]
b=itg[2]-itg[1]


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

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

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

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

def main():
  l=LI()
  l.sort()

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

  if a%2==0:
    return a//2
  return a//2+2

print(main())

Solution (Python):

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


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