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

count = 0
max_num = max(l)
l2 = []
for n in l:
  c = (max_num-n)//2
  count += c
  l2.append(n+2*c)

m = max(l2)
count += l2.count(m) % 3


print(count)

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

a = max(abc) - abc[0]
b = max(abc) - abc[1]
ans = a
if (b-a)%2==0:
    ans += (b-a)//2
else:
    ans += (b-a)//2
    ans += 2
print(ans)

Solution (Python):
A = [int(x) for x in input().split()]
M = max(A)
cnt = 0
d = 0
for i in range(3):
  c = (M - A[i]) // 2
  cnt += c
  A[i] += 2 * c
  if A[i] != M:
    d += 1
cnt += (3 - d) % 3
print(cnt)

Solution (Python):
a = list(map(int, input().split()))
ds = [abs(e - max(a)) for e in a if e-max(a) != 0]

if len(ds) == 1:
    if ds[0] % 2 == 0:
        res = ds[0] // 2
    else:
        res = (ds[0]-1) // 2 + 2
elif len(ds) > 1:
    base = min(ds) - 1
    rem = max(ds) - base
    if rem == 1:
        res = base + 1
    elif rem % 2 == 0:
        res = base + (rem - 2) // 2 + 3
    elif rem % 2 != 0:
        res = base + (rem - 1) // 2 + 1
else:
    res = 0

print(res)

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

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

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

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

Solution (Python):

li = sorted(list(map(int, input().split())))
count = 0
while li[1] < li[2]:
    li[0] += 1
    li[1] += 1
    count += 1
while li[0] < li[1]:
    li[0] += 2
    count += 1
if li[0] > li[1]:
    li[1] += 1
    li[2] += 1
    count += 1
print(count)

Solution (Python):

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

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

Solution (Python):
x = list(map(int, input().split()))
ans = 0
while x[0] != x[1] or x[1] != x[2]:
    ans += 1
    m = min(x)
    if x.count(m) == 1:
        for i in range(3):
            if x[i] == m:
                x[i] += 2
                break
    else:
        for i in range(3):
            if x[i] == m:
                x[i] += 1
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:
    print((rem+3)//2)
else:
    print(rem//2)

Solution (Python):


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

l.sort()
lm = max(l)
ll = [lm - i for i in l]

ans = int(ll[0] / 2) + int(ll[1] / 2)

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

print(ans)

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

arr.sort(reverse=True)

arr2 = list(arr)
count = 0

for i in range(3):
    arr2[i] = arr[0] - arr2[i] 

for j in range(3):
    if (arr2[j] != 0) and (arr2[j] % 2 == 1):
        count += 1

if (count == 0) or (count == 2):
    print(int(sum(arr2) / 2))
else:
    print(int(sum(arr2) // 2 + 2))

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

Solution (Python):
A=list(map(int,input().split()))
A.sort()
count=0
while(1):
    i=0
    j=0
    if(A[1]+2<=A[2]):
        A[1]+=2
        count+=1
        i=1
    if(A[0]+2<=A[2]):
        A[0]+=2
        count+=1
        j=1
    if(i==0 and j==0):    break
    
if(A[0]==A[1] and A[0]!=A[2]):    print(count+1) 
elif(A[0]!=A[1]):    print(count+2) 
else:    print(count)

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

answer = numbers[2] - numbers[1]
numbers[0] += numbers[2] - numbers[1]

if (numbers[2] - numbers[0]) % 2 == 0:
  answer += (numbers[2] - numbers[0]) // 2
else:
  answer += (numbers[2] - numbers[0] + 1) // 2 + 1

print(answer)

Solution (Python):

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

diff0 = ABC[-1] - ABC[0]
diff1 = ABC[-1] - ABC[1]


if diff0 % 2 == diff1 % 2 == 0: ans = (diff0 + diff1) // 2

elif diff0 % 2 == diff1 % 2 == 1: ans = (diff0 + diff1) // 2

else: ans = 1 + (diff0 + diff1 + 2) // 2

print(ans)

Solution (Python):
a=list(map(int,input().split()))
b=[0 for i in range(3)]
a.sort()
for i in range(3):
  b[i]=a[i]%2
flag=0

count=0
if(b[0]==b[1]) and (b[1]==b[2]):
  flag=1
  while(a[1]<a[2]):
    a[1]=a[1]+2
    count+=1
  while(a[0]<a[2]):
    a[0]=a[0]+2
    count+=1
    
if (b[0]==b[1]) and flag==0:
  a[0]=a[0]+1
  a[1]=a[1]+1
  count+=1
  while(a[1]<a[2]):
    a[1]=a[1]+2
    count+=1
  while(a[0]<a[2]):
    a[0]=a[0]+2
    count+=1

if (b[0]==b[2]) and flag==0:
  a[0]=a[0]+1
  a[2]=a[2]+1
  count+=1
  while(a[1]<a[2]):
    a[1]=a[1]+2
    count+=1
  while(a[0]<a[2]):
    a[0]=a[0]+2
    count+=1
    
if (b[1]==b[2]) and flag==0:
  a[1]=a[1]+1
  a[2]=a[2]+1
  count+=1
  while(a[1]<a[2]):
    a[1]=a[1]+2
    count+=1
  while(a[0]<a[2]):
    a[0]=a[0]+2
    count+=1

print(count)

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

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

Solution (Python):
A, B, C = sorted([int(_) for _ in input().split()])
A, B, C = [0, C - B, C - A]
if B % 2 and C % 2:
    print(1 + (B - 1) // 2 + (C - 1) // 2)
elif B % 2:
    print(1 + (B + 1) // 2 + C // 2)
elif C % 2:
    print(1 + (C + 1) // 2 + B // 2)
else:
    print(B // 2 + C // 2)

Solution (Python):
a,b,c=map(int,input().split())
x=0
while a!=b or b!=c or c!=a:
  if a%2==b%2==c%2:
    if min(a,b,c)==a:a+=2
    elif min(a,b,c)==b:b+=2
    else:c+=2
  else:
    if a%2==b%2:
      a+=1
      b+=1
    elif b%2==c%2:
      b+=1
      c+=1
    else:
      c+=1
      a+=1
  x+=1
print(x)

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

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

if A == B == C:
    print(0)
else:
    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):
aA = [int(_) for _ in input().split()]
iM = min(aA)
i0,i1,i2 = sorted([a - iM for a in aA])

if i1 % 2 :
    print((i1+1)//2 + i2-i1 + 1)
else:
    print( i2-i1 //2)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
nums = sorted(list(map(int,input().split())))
ans = 0

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

print(ans)

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

Solution (Python):
A,B,C = map(int,input().split())
l = sorted([A,B,C])
count = 0
while l[2] - l[1] > 1:
    l[1] += 2
    count += 1
while l[2] - l[0] > 1:
    l[0] += 2
    count += 1
if l[0] == l[1] == l[2]:
    print(count)
elif l[0] == l[1]:
    count += 1
    print(count)
else:
    count += 2
    print(count)

Solution (Python):
a,b,c = map(int, input().split())
ar = [a,b,c]
ar.sort()
t = ar[2]
u = ar[1]
v = ar[0]
tu = t - u
tv = t - v
count = 0
if tu % 2 == 0 and tv % 2 == 0:
  count += tu
  count += int((tv - tu) / 2)
elif tu % 2 != 0 and tv % 2 != 0:
  count += tu
  count += int((tv - tu) / 2)
else:
  count += tu
  count += int((tv - tu - 1) / 2) + 2

print(count)

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

Solution (Python):
n = [int(i) for i in input().split()]
n = sorted(n)
d = (n[2]-n[0])+(n[2]-n[1])
e = divmod(d, 2)
print(e[0]) if e[1]==0 else print(e[0]+2)

Solution (Python):
import math

def main():
    a, b, c = map(int, input().split())
    
    li = [a, b, c]
    top = max(li)
    top_index = li.index(top)
    bot = min(li)
    bot_index = li.index(bot)
    mid_index = calc_mid_index(top_index, bot_index)
    mid = li[mid_index]
    count = 0
    
    count = top - mid
    bot += count
    mid += count
    
    if (top - bot) % 2 == 0:
        count += (top - bot) / 2 
    else:
        count += math.ceil((top - bot) / 2) + 1
        
    print(int(count))

def calc_mid_index(top_index, bot_index):
    for i in range(3):
        if i != top_index and i != bot_index:
            return i



if __name__ == '__main__':
    main()

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

count = 0
while a != 0 and b != 0:
    a -= 1
    b -= 1
    count += 1

while b > 1:
    b -= 2
    count += 1

if b == 1:
    count += 2

print(count)

Solution (Python):
A,B,C = map(int,input().split(" "))
num1 = max(A,B,C)
num3 = min(A,B,C)
num2 = A+B+C-num1-num3
if (num1*2-num2-num3)%2 == 1:
    print((num1*2-num2-num3)//2+2)
else:
    print((num1*2-num2-num3)//2)

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

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

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5)
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())
 
a,b,c = li()
 
a,b,c = sorted([a,b,c])
 
cnt = 0
while a != b or b != c:
    if a != b:
        a += 2
        
    else:
        a += 1
        b += 1
        
    a,b,c = sorted([a,b,c])
        
    cnt += 1
    
    
print(cnt)

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b,c = li()

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

cnt = 0
while a != b or b != c:
    if a != b:
        a += 2
        
    else:
        a += 1
        b += 1
        
    a,b,c = sorted([a,b,c])
        
    cnt += 1
    
    
print(cnt)

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

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

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

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

Solution (Python):

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

Solution (Python):
l = [int(_) for _ in input().split()]
a, b, c = sorted(l, reverse=True)
if a % 2 == 1:
    if b % 2 == 1:
        if c % 2 == 1:
            ans = (a-b)//2 + (a-c)//2
        else:
            ans = 1 + (a+1-c)//2 + (a-b)//2
    else:
        if c % 2 == 1:
            ans = 1 + (a+1-b)//2 + (a-c)//2
        else:
            ans = 1 + (a-b-1)//2 + (a-c-1)//2
else:
    if b % 2 == 1:
        if c % 2 == 1:
            ans = 1 + (a-b-1)//2 + (a-c-1)//2
        else:
            ans = 1 + (a+1-b)//2 + (a-c)//2
    else:
        if c % 2 == 1:
            ans = 1 + (a-b)//2 + (a+1-c)//2
        else:
            ans = (a-b)//2 + (a-c)//2
print(ans)

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

Solution (Python):

A,B,C = map(int, input().split())
l = sorted([A,B,C])

cnt = 0

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


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

print(cnt)

Solution (Python):
"""
C - Same Integers
"""

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

odd_cnt = 0
parities = []
for n in numbers:
    p = n % 2
    parities.append(p)
    odd_cnt += p

process_cnt = 0


if odd_cnt == 1:
    process_cnt += 1
    
    for i in range(3):
        if parities[i] == 0:
            numbers[i] += 1
elif odd_cnt == 2:
    process_cnt += 1
    
    for i in range(3):
        if parities[i] != 0:
            numbers[i] += 1


numbers_max = max(numbers)
for n in numbers:
    process_cnt += (numbers_max - n) // 2

print(process_cnt)

Solution (Python):
nums = list(map(int,input().split()))
nums.sort()
diff = (nums[-1]-nums[1]) + (nums[-1]-nums[0])
a,b = divmod(diff,2)
print(a+b*2)

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

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

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

while 1:
    if len(set(a)) == 1:
        print(cnt)
        break
    elif len(set(a)) ==2:
        if a.count(min(a)) == 2:
            cnt += max(a)-min(a)
            print(cnt)
            break
        else:
            if (max(a)-min(a))%2==0:
                cnt += (max(a)-min(a))//2
                print(cnt)
                break
            else:
                cnt += (max(a)-min(a))//2 + 2
                print(cnt)
                break
    else:
        a.sort()
        a[0] += 2
        cnt += 1

Solution (Python):
from collections import deque

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

def bfs(a, b, c):
    cnt = 0
    queue = deque([[a, b, c, cnt]])

    while queue:
        a, b, c, cnt = queue.popleft()
        if a == b and b == c:
            return cnt
        if a >= 60 or b >= 60 or c >= 60:
            return cnt

        if b > a and b > c:
            queue.append([a+1, b, c+1, cnt+1])
        elif a > b and a > c:
            queue.append([a, b+1, c+1, cnt+1])
        elif c > a and c > b:
            queue.append([a+1, b+1, c, cnt+1])
        elif a < b:
            queue.append([a+2, b, c, cnt+1])
        elif b < c:
            queue.append([a, b+2, c, cnt+1])
        elif c < a:
            queue.append([a, b, c+2, cnt+1])

print(bfs(a, b, c))

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

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

if a%2==b%2==c%2:
	x = max(a,b,c)
	print((3*x-a-b-c)//2)
elif a%2==b%2!=c%2:
	x = max(a+1,b+1,c)
	print((3*x-a-b-c-2)//2+1)
elif a%2!=b%2==c%2:
	x = max(a,b+1,c+1)
	print((3*x-a-b-c-2)//2+1)
elif a%2==c%2!=b%2:
	x = max(a+1,b,c+1)
	print((3*x-a-b-c-2)//2+1)

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

Solution (Python):
A, B, C = map(int, input().split())
minV, midV, maxV = min(A,B,C), A + B + C - min(A,B,C) - max(A,B,C),max(A,B,C)
cnt = 0
work1 = (maxV - minV) // 2
minV = minV + 2 * work1
work2 = (maxV - midV) // 2
midV = midV + 2 * work2
cnt += work1 + work2

if minV == midV == maxV:
    print(cnt)
elif midV == minV:
    print(cnt + 1)
else:
    print(cnt + 2)

Solution (Python):
l=[int(i) for i in input().split()]
l.sort()
ans=l[2]-l[1]+(l[1]-l[0])%2*2

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

Solution (Python):
a,b,c = map(int, input().split())
list_abc = list((a,b,c))
list_abc.sort()
count = 0
while True:
    if list_abc[0] == list_abc[1] == list_abc[2]:
        break
    elif list_abc[0] < list_abc[1]:
        list_abc[0] += 2
    else:
        list_abc[0] += 1
        list_abc[1] += 1
    count += 1
    list_abc.sort()

print(count)

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

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

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

N = list(map(int, Input().split()))
count = 0

while not all(map(lambda x: x == N[0], N)):
    N.sort()
    while N[0]+1 < N[2]:
        N[0] += 2
        count += 1
    if N[0] != N[2]:
        N[0] += 1
        N[1] += 1
        count += 1

print(count)

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

if a % 2 == 0 and b % 2 == 0 and c % 2 == 1:
    a += 1
    b += 1
    count += 1
elif a % 2 == 0 and b % 2 == 1 and c % 2 == 0:
    a += 1
    c += 1
    count += 1
elif a % 2 == 0 and b % 2 == 1 and c % 2 == 1:
    b += 1
    c += 1
    count += 1
elif a % 2 == 1 and b % 2 == 0 and c % 2 == 0:
    b += 1
    c += 1
    count += 1
elif a % 2 == 1 and b % 2 == 0 and c % 2 == 1:
    a += 1
    c += 1
    count += 1
elif a % 2 == 1 and b % 2 == 1 and c % 2 == 0:
    a += 1
    b += 1
    count += 1


data_list = [a, b, c]
data_list.sort()
while data_list[0] != data_list[2]:
    data_list[0] += 2
    count += 1
while data_list[1] != data_list[2]:
    data_list[1] += 2
    count += 1
print(count)

Solution (Python):

import math


def main():
    a, b, c = sorted([int(a) for a in input().split()])

    add = 0
    if a % 2 == 0:
        if b % 2 == 0:
            if c % 2 == 0:
                pass
            else:
                add = 1
                b += 1
                a += 1
        else:
            if c % 2 == 0:
                add = 1
                a += 1
                c += 1
            else:
                add = 1
                b += 1
                c += 1
    else:
        if b % 2 == 0:
            if c % 2 == 0:
                add = 1
                b += 1
                c += 1
            else:
                add = 1
                a += 1
                c += 1
        else:
            if c % 2 == 0:
                add = 1
                a += 1
                b += 1
            else:
                pass

    print(add+(c - b + c - a) // 2)


if __name__ == '__main__':
    main()

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

ans = 0

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

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

if abc[0] != abc[2]:
    ans += 2

print(ans)

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

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

print(ans)

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

abc.sort()

count = 0

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

print(int(count))

Solution (Python):
A, B, C = list(map(int, input().split()))
ABC = [A, B, C]
ABC.sort()
A = ABC[0]
B = ABC[1]
C = ABC[2]
ans = 0

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

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

x=max(a,b,c)
z=min(a,b,c)
y=a+b+c-x-z

ans=x-y
y=x
z+=ans

if (x-z)%2==0:
    ans+=(x-z)/2
else:
    x+=1
    ans+=1
    ans+=(x-z)/2

print(int(ans))

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

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

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

Solution (Python):



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


M = inpl()
M.sort()

sub1 = M[2] - M[1]
sub2 = M[1] - M[0]

if sub2 % 2 == 0:
	ans = sub1 + sub2 // 2
else:
	ans = sub1 + (sub2 + 1) // 2 + 1

print(ans)

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

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

Solution (Python):
d = list(map(int, input().split()))
d.sort()
a,b,c=d
r = 0
while a<b:
    a += 2
    r += 1
if a > b:
    r += 1
    b += 1
    c += 1
if a == b:
    r += c - a
    a  = c
    b  = c
print(r)

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

a.sort()

sum = 0
sum += (a[2] - a[0]) // 2
sum += (a[2] - a[1]) // 2

if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
  print(sum)
elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
  print(sum+1)
else:
  print(sum+2)

Solution (Python):
a, b, c = map(int, raw_input().split())
max_value = max([a,b,c])

target_value = max_value
while True:
    if (target_value*3 - (a+b+c)) % 2 == 0:
        break
    target_value += 1

diff_a = (target_value - a)
diff_b = (target_value - b)
diff_c = (target_value - c)

if diff_a % 2 == 0 and diff_b % 2 == 0 and diff_c % 2 == 0:
    count = diff_a / 2 + diff_b / 2 + diff_c / 2
    print(count)
else:
    count = diff_a / 2 + diff_b / 2 + diff_c / 2 + 1
    print(count)

Solution (Python):
min, mid, max = sorted([int(i) for i in input().split()])

ope1 = max - mid    

diff = (max - (ope1 + min))  
ope2 = diff // 2             

if diff % 2 != 0:
    ope1 = ope1 + 1          
    ope2 = ope2 + 1          

print(ope1 + ope2)

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

a.sort()

ans =0

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

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

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

print(ans)

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

ABC.sort()


ans = 0

dif_AB = ABC[2] - ABC[0]
dif_AC = ABC[2] - ABC[1]

if dif_AB % 2 == 0:
    ABC[0] = ABC[2]
else:
    ABC[0] = ABC[2] - 1
ans += dif_AB // 2

if dif_AC % 2 == 0:
    ABC[1] = ABC[2]
else:
    ABC[1] = ABC[2] - 1
ans += dif_AC // 2




dif_AB = ABC[2] - ABC[0]
dif_AC = ABC[2] - ABC[1]

if ABC[0] == ABC[1] and ABC[1] == ABC[2]:
    pass
elif dif_AB == 1 and dif_AC == 1:
    ans += 1
else:
    ans += 2
print(ans)

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

P.sort()

A, B, C = P

r = 0

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

if A > B:
    r += 1
    B += 1
    C += 1

if A == B:
    r += C - A
    A  = C
    B  = C

print(r)

Solution (Python):
abc = list(map(int, input().split()))
abc_even = [x % 2 == 0 for x in abc]
ans = 0
if abc_even.count(True) == 2:
  abc = [x + 1 if x_flg == True else x for x,x_flg in zip(abc,abc_even)]
  ans += 1
elif abc_even.count(False) == 2:
  abc = [x + 1 if x_flg == False else x for x, x_flg in zip(abc, abc_even)]
  ans += 1
mx = max(abc)
for i in range(len(abc)):
  while abc[i] < mx:
    abc[i] += 2
    ans += 1
print(ans)

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

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

max = list[2]
mid = list[1]
min = list[0]

ans = 0

ans += max - mid

if (mid - min) % 2 ==0:
    ans += (mid - min) / 2
else:
    ans += (mid- min + 1) / 2 +1

print(int(ans))

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

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

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

Solution (Python):
input_list = list(map(int, input().split()))
input_list.sort()
max_num = input_list[2]
second = input_list[1]
min_num = input_list[0]

count = 0
margin = max_num - second
margin2 = max_num - min_num

if margin % 2 == 0:
    count += margin / 2

else:
    count += margin // 2
    if margin2 % 2 == 0:
        count += 1
        margin2 -= 1

    else:
        count += 1
        margin2 -= 1

if margin2 % 2 ==0:
    count += margin2 / 2

else:
    count += margin2 // 2
    count += 2

print(int(count))

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

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

m = max([A,B,C])
a = m*3 - (A+B+C)
if a%2 == 0:
    print(int(a/2))
else:
    print(int((a+3)/2))

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

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

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

a, b, c = sorted(l)[::-1]

diff_1 = a - b
diff_2 = a - c
diff = diff_1 + diff_2

if diff % 2 == 0:
    print(diff // 2)

else:
    print((diff + 3) // 2)

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






cnt = 0

p,q,r = A%2, B%2, C%2

if p+q+r == 1:
  if p == 0:
    A += 1
  if q == 0:
    B += 1
  if r == 0:
    C += 1
  cnt += 1

if p+q+r == 2:
  if p == 1:
    A += 1
  if q == 1:
    B += 1
  if r == 1:
    C += 1
  cnt += 1

maxn = max(A,B,C)

cnt += (3*maxn - (A+B+C))//2

print(cnt)

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

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

Solution (Python):


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    l = list(sorted(list(map(int, input().split()))))
    ans = 0
    while l[1] < l[2]:
        l[0] += 1
        l[1] += 1
        ans += 1

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

    if l[0] != l[1]:
        ans += 1
    print(ans)



if __name__ == '__main__':
    main()

Solution (Python):
A,B,C = sorted(map(int,input().split()))
print(C-B+(B-A+1)//2+((B-A)&1))

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

Solution (Python):
def main():
  t = input().split(" ")
  A, B, C = int(t[0]), int(t[1]), int(t[2])
  M = max(A, B, C)
  n = (M-A)//2 + (M-B)//2 + (M-C)//2
  r = (M-A)%2 + (M-B)%2 + (M-C)%2
  if r == 1:
    n += 2
  elif r == 2:
    n += 1
  print(n)
main()