Problem:
 Score : 300 points    Problem Statement You are given three integers A , B and C . Find the minimum number of operations required to make A , B and C all equal by repeatedly performing the following two kinds of operations in any order:   Choose two among A , B and C , then increase both by 1 .  Choose one among A , B and C , then increase it by 2 .   It can be proved that we can always make A , B and C all equal by repeatedly performing these operations.      Constraints  0 \leq A,B,C \leq 50  All values in input are integers.         Input Input is given from Standard Input in the following format:  A  B  C       Output Print the minimum number of operations required to make A , B and C all equal.        Sample Input 1 2 5 4      Sample Output 1 2  We can make A , B and C all equal by the following operations:   Increase A and C by 1 . Now, A , B , C are 3 , 5 , 5 , respectively.  Increase A by 2 . Now, A , B , C are 5 , 5 , 5 , respectively.        Sample Input 2 2 6 3      Sample Output 2 5       Sample Input 3 31 41 5      Sample Output 3 23

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

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

if ABC[0] == ABC[1] == ABC[2]:
    print(ans)
else:
    if ABC[0] == ABC[1]:
        print(ans + 1)
    else:
        print(ans+2)

Solution (Python):
a,b,c=sorted([int(x) for x in raw_input().split()])
tmp=c-b
ans=tmp
a+=tmp
if (c-a)%2:
    ans+=1
    c+=1
ans+=(c-a)/2
print ans

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

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

Solution (Python):

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

res = 0

res += ABC[2] - ABC[1]
ABC[0] += ABC[2] - ABC[1]
ABC[1] = ABC[2]

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

Solution (Python):


import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq





def solve(f):
    nums = f.read_int_list()

    mi = min(nums)
    ma = max(nums)

    ans = float('inf')
    for i in xrange(mi, ma+1):
        cnt = 0
        for a in nums:
            if i < a:
                cnt += a-i
            elif (i-a)%2 == 0:
                cnt += (i-a)/2
            else:
                cnt += (i-a)/2 + 2

        ans = min(cnt, ans)

    return ans


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case 
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)

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

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

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

Solution (Python):



def dist(x,y):
    if x>y:
        return x-y
    else:
        d=y-x
        if d%2==0:
            return d//2
        else:
            return d//2 +2
        
A,B,C = list(map(int,input().split()))

aa = 100000
for N in range(52):
    aa = min(aa,dist(A,N)+dist(B,N)+dist(C,N))
print(aa)

Solution (Python):
def cost(fr, to):
    if to <= fr:
        return fr - to
    else:
        d = to - fr
        return (d + 1) // 2 + d % 2


def main():
    a, b, c = map(int, input().split())
    ans = 9999999
    for m in range(min(a, b, c) - 5, max(a, b, c) + 5):
        ans = min(ans, cost(a, m) + cost(b, m) + cost(c, m))
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):

def inpl(): return map(int, input().split())
A, B, C = sorted(list(inpl()))
res = 0
res += (C-B)
A += res
B += res
d, m = divmod(B-A, 2)
res += d+2*m
print(res)

Solution (Python):


import sys, math, copy




HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    a, b, c = map(int, input().split())
    su = sum([a, b, c])
    ma = max(a, b, c)
    if (ma * 3 - su) % 2 == 0:
        print((ma * 3 - su) // 2)
    else:
        print(((ma + 1) * 3 - su) // 2)

main()

Solution (Python):

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

max = max(a,b,c)

sa = max - a
sa += max - b
sa += max -c

ans = sa // 2

if sa % 2 == 1:
    ans += 2

print(ans)

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

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

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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


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


    return r


print(main())

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

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

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

cost = 0
cost += (b-a)//2
a += cost*2
if a < b:
  c += 1
  a += 1
  cost += 1

cost += c-b
print(cost)

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

Solution (Python):
def solve(a,b,c):
    return a + b + c - 3 * min([a,b,c])

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

ans = 1 << 30

for i in range(50):
    for j in range(50):
        for k in range(50):
            ans = min(ans, i + j + k + solve(a+i*2,b+j*2,c+k*2))

print ans