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



Sample input:
2 5 4


Sample output:
2

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()]
a.sort()
print(a)
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+=(a[1]-a[0])+1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, input().split())
A, B, C = min(A, B, C), A+B+C - min(A, B, C) - max(A, B, C), max(A, B, C)
print((C - A + 1)//2 + (C - B + 1)//2 + (not (A % 2 == B % 2 == C % 2)))

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, input().split())
A, B, C = min(A, B, C), A+B+C - min(A, B, C) - max(A, B, C), max(A, B, C)
# print((C - A)//2, (C % 2 != A % 2), (C - B)//2, (C %
#                                                 2 != B % 2), + (not (A % 2 == B % 2 == C % 2)))
print((C - A)//2 + (C % 2 != A % 2) + (C - B)//2 + (C %
                                                    2 != B % 2) + (not (A % 2 == B % 2 == C % 2)))

Submission status: Wrong Answer

Solution code:
def main():
    A = list(map(int, input().split()))

    diff = 0
    print(A)
    for i in range(len(A)):
        diff += max(A)-A[i]
    if diff%2 == 0:
        print(diff//2)
    else:
        print(diff//2+2)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10000)
def resolve():
    A, B, C = list(map(int, input().split(" ")))
    MAX, MIN = max([A, B, C]), min([A, B, C])
    MID = A + B + C - MAX - MIN
    if (MAX % 2 == 0 and MID % 2 == 0 and MIN % 2 == 0) or (MAX % 2 == 1 and MID % 2 == 1 and MIN % 2 == 1):
        print(((MID - MIN)//2)+((MAX-MID)))
    elif (MAX % 2 == 0 and MID % 2 == 1 and MIN % 2 == 1) or (MAX % 2 == 1 and MID % 2 == 0 and MIN % 2 == 0):
        diff = (MID - MIN) // 2
        diff2 = MAX - MID
        print(diff+diff2)
    else:
        diff = MID - MIN
        diff2 = (diff + MAX) - MID
        print(diff + diff2)
        

    
if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

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

x=max(num)
s=sum(num)

t=(3*x-s)
ans=t//2
if t%2!=0:
    ans+1
print(ans)

Submission status: Wrong Answer

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

s=min(num)
l=max(num)
m=sum(num)-s-l

ans=l-m
ans+=(m-s)//2+(m-s)%2

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def main():
    li = list(map(int, input().split()))

    max_n = max(li)
    max_i = li.index(max_n)

    diff = 0

    for i in range(3):
        if i == max_i:
            continue

        diff += max_n - li[i]

    print(diff)

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
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]
else:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
print(ans)

Submission status: Wrong Answer

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

ans = 0

ans += b

if c % 2 == 0:
    ans += c//2
elif c % 2 == 1:
    ans += c//2 + 2

Submission status: Wrong Answer

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

ans += b

if (c-b) % 2 == 0:
    ans += (c-b)//2
elif (c-b) % 2 == 0:
    ans += (c-b)//2 + 2

print(ans)

Submission status: Wrong Answer

Solution code:
import math
a = sorted(list(map(int,input().split())))
print(a[2] - a[1] + math.ceil((a[1] - a[0]) / 2) + (a[1] - a[0]) % 2 == 1)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
B = [a%2 for a in A]
if len(set(B))==1:
    ans = (max(A)*3-sum(A))//2
elif B.count(0)==1:
    ind = B.index(0)
    if A[ind] == max(A):
        ans = (max(A)*3-2-sum(A))//2
    else:
        ans = (max(A)*3-sum(A)+1)//2
else:
    ind = B.index(1)
    if A[ind] == max(A):
        ans = (max(A)*3-2-sum(A))//2+1
    else:
        ans = (max(A)*3-sum(A)+1)//2+1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
if a%2==b%2 and b%2==c%2:
    a,b,c=sorted([a,b,c])
    print((c-a)//2+(c-b)//2)
else:
    a,b,c=sorted([a+(a%2==b%2 ^ a%2==c%2),b+(b%2==a%2 ^ b%2==c%2),c+(c%2==a%2 ^ c%2==b%2)])
    print((c-a)//2+(c-b)//2+(a%2!=b%2 or b%2!=c%2))

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
a,b,c=sorted([a+(a%2==b%2 ^ a%2==c%2),b+(b%2==a%2 ^ b%2==c%2),c+(c%2==a%2 ^ c%2==b%2)])
print((c-a)//2+(c-b)//2+(a%2!=b%2 or b%2!=c%2))

Submission status: Wrong Answer

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

if a%2==b%2 and b%2==c%2:
    pass
else:
    a+=(a%2==b%2 or a%2==c%2)
    b+=(b%2==a%2 or b%2==c%2)
    c+=(c%2==a%2 or c%2==b%2)
x=sorted([a,b,c])
print((x[2]-x[1])//2+(x[2]-x[0])//2+1)

Submission status: Wrong Answer

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

if a%2==b%2 and b%2==c%2:
    pass
else:
    a+=(a%2==b%2 and a%2==c%2)
    b+=(b%2==a%2 and b%2==c%2)
    c+=(c%2==a%2 and c%2==b%2)
x=sorted([a,b,c])
print((x[2]-x[1])//2+(x[2]-x[0])//2+1)

Submission status: Wrong Answer

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

if a%2==b%2 and b%2==c%2:
    pass
else:
    a+=(a%2==b%2 and a%2==c%2)
    b+=(b%2==a%2 and a%2==c%2)
    c+=(c%2==a%2 and a%2==b%2)
x=sorted([a,b,c])
print((x[2]-x[1])//2+(x[2]-x[0])//2+1)

Submission status: Wrong Answer

Solution code:
n_list = list(map(int,input().split()))
n_list.sort
num = 2 * n_list[2]
dummy = num - (n_list[0] + n_list[1])
a,b = divmod(dummy,2)
if b == 0:
  print(a)
else:
  print(a+2)

Submission status: Wrong Answer

Solution code:
def solve():
    ABC = list(sorted(map(int, input().split())))

    # 最初にプラス1で近づける
    A, B, C = ABC[0], ABC[1], ABC[2]
    count = 0


    a, amod = divmod((C-A),2)
    b, bmod = divmod((C-B),2)
    A += a * 2
    B += b * 2

    if C == A and C == B:
        return a + b
    elif C > A and C > B:
        return a + b  
    elif C > A and C == B:
        return a + b + 2
    elif C > B and C == A :
        return a + b + 2


def main():
    print(solve())

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
A,B,C = map(int,input().split())
l = [A,B,C]
l.sort()
ans = l[2]-l[1] + (-l[0]+l[1])//2
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
l=[]
l.append(a)
l.append(b)
l.append(c)
l.sort()
ans=0
while max(l[0],l[1])<l[2]:
    l[0]+=1
    l[1]+=1
    ans+=1
if (l[2]-l[0])%2==0:
    ans+=(l[2]-l[0])//2
    print(ans)
else:
    print(ans+2)

Submission status: Wrong Answer

Solution code:
#93c
A,B,C = map(int, input().split()) #<=50

#3 つの整数 A,B,C が与えられます。
#以下の 2 種類の操作を好きな順で繰り返して A,B,Cをすべて等しくするために必要な操作の最小回数を求めてください。
# A,B,Cのうち 2 つを選んで、その両方を 1 増やす
# A,B,Cのうち 1 つを選んで、その整数を 2 増やす

#選択肢は3*2通り 6**9で 10077696。∴全探索は無理。
ABC = [A,B,C]
z = max(ABC)
ABC.remove(z)
x = ABC[0]
y = ABC[1]

ans = 0
#x,yの差分を1or0にまず持っていく
while 1:
    if abs(x-y) > 1:
        if x > y:
            y += 2
        else:
            x += 2
        ans += 1
    else:
        break
        
#print(x,y,z)

#x,yとzの差分を0～2に持っていく
while 1:
    if z-y > 2 or z-x > 2:
        y += 1
        x += 1
        ans += 1
    else:
        break
        
#print(x,y,z)

#zに合わせる
x = -(z-x)
y = -(z-y)
z = 0

#print(x,y,z)

if x == y:
    ans += abs(x)
elif abs(x-y) == 1:
    ans += 3
    
print(ans)

Submission status: Wrong Answer

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

maxi=max(A,B,C)
mini=min(A,B,C)
midi=(A+B+C)-maxi-mini
s = (maxi-midi)+(maxi-mini)

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

Submission status: Wrong Answer

Solution code:
import sys
a,b,c = map(int, input().split())
if a == b and b == c:
    count=0
    print(count)
    sys.exit()
    
ls = [a,b,c]
ls.sort(reverse=True)
count = 0
print(ls)
print(ls[0])

if (ls[1]-ls[2])%2 != 0:
    ls[2] = ls[2]+1
    ls[0] = ls[0]+1
    count +=1

while ls[1] - ls[2] >= 2:
    ls[2] += 2
    count += 1

if ls[1] - ls[2] == 1:
    ls[2] += 1
    count +=1

dif = ls[0] - ls[1]
count = count + dif

print(count)

Submission status: Wrong Answer

Solution code:
a,b,c = map(int, input().split())
if a == b and b == c:
    count=0
    print(count)
    exit(0)
    
ls = [a,b,c]
ls.sort(reverse=True)
count = 0
print(ls)
print(ls[0])

if (ls[1]-ls[2])%2 != 0:
    ls[2] = ls[2]+1
    ls[0] = ls[0]+1
    count +=1

while ls[1] - ls[2] >= 2:
    ls[2] += 2
    count += 1

if ls[1] - ls[2] == 1:
    ls[2] += 1
    count +=1

dif = ls[0] - ls[1]
count = count + dif

print(count)

Submission status: Wrong Answer

Solution code:

def Same_Integers(abc):

    ans = 0
    abc.sort()
    count = abc[2]*3 - abc[0] - abc[1] - abc[2]

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

    return ans

def main():
    abc = list(map(int , input().split()))
    print(Same_Integers(abc))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
A,B,C=map(int,input().split())
s=[A,B,C]
t=sorted(s)
u=(t[2]-t[0],t[2]-t[1],0)
if u[0]%2==0 and u[1]%2==0:
    print((u[0]+u[1])/2)
elif u[0]%2==1 and u[1]%2==1:
    print(round((1+u[0]//2+u[1]//2)))
elif u[0]%2==1 and u[1]%2==0:
    print(round(((u[0]+1)/2+u[1]/2+1)))
else:
    print(round(((u[1]+1)/2+u[0]/2+1)))

Submission status: Wrong Answer

Solution code:
A,B,C=map(int,input().split())
s=[A,B,C]
t=sorted(s)
u=(t[2]-t[0],t[2]-t[1],0)
if u[0]%2==0 and u[1]%2==0:
    print((u[0]+u[1])/2)
elif u[0]%2==1 and u[1]%2==1:
    print(1+u[0]//2+u[1]//2)
else:
    print(u[0]//2+u[1]//2+2)

Submission status: Wrong Answer

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

s = 0
if len(set(a)) == 1 :
  print(0)
else :
  if a[0]+1<a[1]:
    s +=(a[1]-a[0])//2
    a[0] = 2*s+a[0]
    if a[0] == a[1]:
      s+= a[2] -a[1]
    else :
      s+= a[2]-a[1] +2
  else :
      s+= a[2]-a[1] +2
  print(s)

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import sys 
def main():
    input_list = list(map(int, input().split()))
    input_list.sort(reverse=True)
    
    diff = input_list[0] - input_list[1] + input_list[0] - input_list[2]
    ans = diff /2
    if diff % 2 == True:
        diff = input_list[0]+1 - input_list[1] + input_list[0]+1 - input_list[2]
        ans = diff /2

    print(int(ans))
    
if __name__ == '__main__' :
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

pa=a%2
pb=b%2
pc=c%2

cnt = 0

if not(pa==pb and pb==pc):
    cnt = 1
    
ans = cnt + (3*max(max(a,b),c)-(a+b+c))/2
print(int(ans))

Submission status: Wrong Answer

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

ans=0
while a<c-1:
  a+=2
  ans+=1
while b<c-1:
  b+=2
  ans+=1
  
if a==c and b==c:
  print(ans)
elif a!=c and b!=c:
  print(ans+2)
else:
  print(ans+1)

Submission status: Wrong Answer

Solution code:
A = list(map(int,input().split()))
A.sort()
B = []
for i in A:
    B.append(i%2)

ans = 0

if B.count(1) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1
elif B.count(0) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1

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

if len(set(A))!=1:
    import time
    time.sleep(2)
    ##すいません

print(ans)

Submission status: Wrong Answer

Solution code:
A = list(map(int,input().split()))
A.sort()
B = []
for i in A:
    B.append(i%2)

ans = 0

if B.count(1) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1
elif B.count(0) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1

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

if len(set(A))!=1:
    import time
    time.sleep(2)
    ##すいません

print(ans)

Submission status: Wrong Answer

Solution code:
A = list(map(int,input().split()))
A.sort()
B = []
for i in A:
    B.append(i%2)

ans = 0

if B.count(1) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1
elif B.count(0) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1

ans += A[2] - A[1]
A[0] += A[2] - A[1]
ans += (A[2]-A[0])//2
A[0] += (A[2]-A[0])
if len(set(A))!=1:
    import time
    time.sleep(2)
print(ans)

Submission status: Wrong Answer

Solution code:
A = list(map(int,input().split()))
A.sort()
B = []
for i in A:
    B.append(i%2)

ans = 0

if B.count(1) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1
elif B.count(0) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
A = list(map(int,input().split()))
A.sort()
B = []
for i in A:
    B.append(i%2)

ans = 0

if B.count(1) == 1:
    for i in range(len(A)):
        if B[i] == 0:
            A[i] += 1
    ans += 1
elif B.count(0) == 1:
    for i in range(len(A)):
        if B[i] == 0:
            A[i] += 1
    ans += 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
A = list(map(int,input().split()))
A.sort()
ret = 0
ret += A[2]-A[1]
A[1] += ret
A[0] += ret
ret += (A[1]-A[0]-1+2)//2
print(ret)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(x):
    print(x,file=sys.stderr)
def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())


"""
"""

#solution:

#input
def resolve():
    A=sorted(list(pin()))
    B=[a%2 for a in A]
    ans=0
    odd=[]
    even=[]
    for i in range(len(B)):
        if B[i]==0:odd.append(i)
        else:even.append(i)
    if len(odd)==1:
        for x in even:
            A[x]+=1
        ans+=1
    elif len(even)==1:
        for y in odd:
            A[y]+=1
        ans+=1
    ans+=(A[2]*2-A[1]-A[0])//2
    print(ans)
    return 0
    #print(["No","Yes"][cond])
    #print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])
#if __name__=="__main__":resolve()
"""
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じるの忘れてるだろ
"""
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2 5 4"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """2 6 3"""
        output = """5"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """31 41 5"""
        output = """23"""
        self.assertIO(input, output)

Submission status: Wrong Answer

Solution code:
import math
a=list(map(int,input().split()))
a.sort()
cnt=0
if a[0]==a[1]==a[2]:
  print(0)
  exit()
if a[0]==[1]:
  print(a[2]-a[1])
  exit()
if a[1]==a[2]:
  if (a[2]-a[0])%2==0:
    print((a[2]-a[0])//2)
    exit()
  else:
    print(a[2]-a[0]+1)
    exit()
cnt+=a[2]-a[1]
a[0]+=cnt
if (a[2]-a[0])%2==0:
  cnt+=math.ceil((a[2]-a[0])/2)
else:
  cnt+=math.ceil((a[2]-a[0])/2+1)
print(cnt)

Submission status: Wrong Answer

Solution code:
import math
a=list(map(int,input().split()))
a.sort()
print(a)
cnt=0
if a[0]==a[1]==a[2]:
  print(0)
  exit()
if a[0]==[1]:
  print(a[2]-a[1])
  exit()
if a[1]==a[2]:
  if (a[2]-a[0])%2==0:
    print((a[2]-a[0])//2)
    exit()
  else:
    print(a[2]-a[0]+1)
    exit()
cnt+=a[2]-a[1]
a[0]+=cnt
if (a[2]-a[0])%2==0:
  cnt+=math.ceil((a[2]-a[0])/2)
else:
  cnt+=math.ceil((a[2]-a[0])/2+1)
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
abc = sorted([a, b, c])
even = 0
for i in abc:
    if i % 2 == 0:
        even += 1
ans = 0
if even == 0 or even == 3:
    ans = (abc[2] - abc[0]) // 2 + (abc[2] - abc[1]) // 2
elif even == 1:
    ans = (abc[2] * 2 - abc[1] - abc[0]) // 2
else:
    abc = [i + 1 if i % 2 == 0 else i for i in abc]
    ans = (abc[2] - abc[0]) // 2 + (abc[2] - abc[1]) // 2 + 1

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#最終上体がわかれば回数fin*3 - (a+b+c) //2
a =list(map(int,input().split()))
a.sort()
# maxがfinにならないのは、a[0]-1[1]が奇数の時
if (a[1] -a[0])%2 == 1:
    print((a[-1]*3-sum(a))//2)
else:
    print((a[-1]*3+3-sum(a))//2)
"""
x = a[-1]-a[1]
y = a[1] -a[0]
def dist(n):
    if n % 2 == 0: return n//2
    else: return n//2+2
print(min(2*x+y,dist(y)+x,dist(x+y)+dist(x)))"""

Submission status: Wrong Answer

Solution code:
abc = sorted(list(map(int,input().split())))
x = abc[0]
y = abc[1]
z = abc[2]
cnt = (z-x)//2 + (z-y)//2
if z == 2*((z-x)//2)+x and z == 2*((z-y)//2)+y:
    print(cnt)
elif z > 2*((z-x)//2)+x and z > 2*((z-y)//2)*y:
    print(cnt + 1)
else:
    print(cnt + 2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

max_ = max(A,B,C)

ans = 0

## 同じような条件で、maxがA,B、Cの各パターンでの計算をする
if max_ == A:
  if ((max_-B)%2==1) and ((max_-C)%2==1):
    ans += 1
    B += 1
    C += 1
  print('if-A')
  ans += (max_-B) // 2
  if (max_-B) % 2 != 0:
    ans += 1
  ans += (max_-C) // 2
  if (max_-C) % 2 != 0:
    ans += 1

elif max_ == B:
  if ((max_-A)%2==1) and ((max_-C)%2==1):
    ans += 1
    A += 1
    C += 1
  ans += (max_-A) // 2
  if ((max_-A)%2 != 0) and (A!=max_):
    ans += 1
  ans += (max_-C) // 2
  if ((max_-C)%2 != 0) and (C!=max_):
    ans += 1    
    
elif max_ == C:
  if ((max_-A)%2==1) and ((max_-B)%2==1):
    ans += 1
    A += 1
    B += 1
  ans += (max_-A) // 2
  if ((max_-A)%2 != 0) and (A!=max_):
    ans += 1
  ans += (max_-B) // 2
  if (max_-B) % 2 != 0 and (B!=max_):
    ans += 1    
    
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
a =list(map(int,input().split()))
a.sort()
x = a[-1]-a[1]
y = a[1] -a[0]
def dist(n):
    if n % 2 == 0: return n//2
    else: return n//2+2
print(min(2*x+y,dist(y)+x,dist(x+y)+dist(x)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = 0

while A[0] < A[2] - 1:
    A[0] += 2
    x += 1

while A[1] < A[2] - 1:
    A[1] += 2
    x += 1

if A[0] == A[1]:
    x = x + 1
else:
    x = x + 1

print(x)

Submission status: Wrong Answer

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

print(A)

x = 0

while A[0] < A[2] - 1:
    A[0] += 2
    x += 1

while A[1] < A[2] - 1:
    A[1] += 2
    x += 1

if A[0] == A[1]:
    x = x + 1
else:
    x = x + 1

print(x)

Submission status: Wrong Answer

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

num0 = [A, B, C]
max_num = max([A, B, C])
res = 0
diff = [max_num - A, max_num - B, max_num - C]

while True:
    # div_c = 0
    # mod_c = 0
    for i in range(3):
        if diff[i] != 0:
            mod = diff[i] % 2
            div = int(diff[i] / 2)
            res += div
            res += mod / 2
            num0[i] += (2 * div + mod)
    # res = div_c + mod_c
    integer = int(res)

    if res - integer == 0 and num0[0] == num0[1] and num0[1] == num0[2]:
        break

    max_num += 1
    diff = [max_num - A, max_num - B, max_num - C]
    num0 = [A, B, C]

print(int(res))

Submission status: Wrong Answer

Solution code:
a,b,c=sorted(list(map(int,input().split())))
p,q=(c-a)//2,(c-b)//2
c=p+q
a,b=a+2*p,b+2*q
if a==c and b==c:
  print(c)
elif a==c or b==c:
  print(c+2)
else:
  print(c+1)

Submission status: Wrong Answer

Solution code:
n = sorted((map(int,input().split())))
ans = 0
while 1:
  ans += 1
  if n[2]-n[0] > 1:
    n[0] += 2
  else:
    n[0] += 1
    n[1] += 1
  n = sorted(n)
  if n[0]==n[1] and n[1]==n[2]:
    break
print(ans)

Submission status: Wrong Answer

Solution code:
num=list(map(int,input().split()))
odd_num=[]
even_num=[]
count=0
for i in num:
    if i%2!=0:
        count+=1
        odd_num+=[i]
    else:
        even_num+=[i]
if count==1:
    if max(odd_num)>max(even_num):
        ans=abs(even_num[0]-even_num[1])//2+odd_num[0]-max(even_num)
        print(ans)
    else:
        ans=abs(even_num[0]-even_num[1])//2+1+(max(even_num)+1-odd_num[0])//2
        print(ans)
elif count==2:
    if max(odd_num)>max(even_num):
        ans=even_num[0]-max(odd_num)+abs(odd_num[0]-odd_num[1])//2
        print(ans)
    else:
        ans=abs(odd_num[0]-odd_num[1])//2+even_num[0]-max(odd_num)
        print(ans)
else:
    if count==3:
        ans=(3*max(odd_num)-sum(odd_num))//2
        print(ans)
    else:
        ans=(3*max(even_num)-sum(even_num))//2
        print(ans)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
a.sort()
k=0
r1=(a[2]-a[0])//2
r2=(a[2]-a[1])//2
k += r1+r2
a[0] += r1
a[1] += r2
if a[0]==a[1] and a[0]<a[2]:
  print(k+1)
elif a[0]<a[1] and a[1]==a[2]:
  print(k+2)
elif a[0]==a[2] and a[0]>a[1]:
  print(k+2)
else:
  print(k)

Submission status: Wrong Answer

Solution code:
import math

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

if ((max([A, B, C]) * 3) - (A + B + C)) % 2 == 0:
  ans = ((max([A, B, C]) * 3) - (A + B + C)) / 2
else:
  X = max([A, B, C]) + 1
  ans = X * 3 - (A + B + C) / 2

print(math.floor(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

memo1 = abc[2]-abc[0]
memo2 = abc[2]-abc[1]

if memo1%2 == memo2%2:
    print((memo1+memo2)//2)
else:
    print(((memo1+memo2)//2)+1)

Submission status: Wrong Answer

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

ret = 0

if not (A%2 == B%2 and B%2 == C%2):
    # どれか一つにイレギュラーがある
    ret += 1

max_elem = max(A,B,C)
# print((A,B,C),max_elem, (max_elem-A)//2, (max_elem-B)//2, (max_elem-C)//2)
ret += (max_elem-A)//2 + (max_elem-B)//2 + (max_elem-C)//2

print(ret)

Submission status: Wrong Answer

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

ret = 0

if not (A%2 == B%2 and B%2 == C%2):
    # どれか一つにイレギュラーがある
    ret += 1
    if A%2 == B%2:
        A += 1
        B += 1
    else:
        B += 1
        C += 1

# print(A,B,C)
max_elem = max(A,B,C)
ret += (max_elem-A)//2 + (max_elem-B)//2 + (max_elem-C)//2

print(ret)

Submission status: Wrong Answer

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

m = sorted(ABC)
count = 0
if m[2]%2 == 0:
    m[2] += 1
    m[0] += 1
    count += 1
    
n = m[1] - m[0]
l = m[2] - m[1]

print(n//2 + l + count)

Submission status: Wrong Answer

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

M = max(X)

if 3*M %2 == sum(X)%2:
    N = (3*M-sum(X))/2

else:
    N = (3*(M+1)-sum(X))/2

print(N)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
a.sort()
b = list(map(lambda x:x%2,a))
ans = 0

for i in range(3):
    if sum(b) == 1:
        a[i] -= b[i]
    else:
        a[i] += b[i]

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

Submission status: Wrong Answer

Solution code:
# WIP
A, B, C = map(int, input().split())

combi = [A, B, C]
set_abc = set(combi)

len_set_abc = len(set_abc)
max_set = max(set_abc)
min_set = min(set_abc)
if len_set_abc == 1:
    print(0)
elif len_set_abc == 2:
    max_freq = combi.count(max_set)
    diff = max_set - min_set
    if max_freq == 2 and diff % 2:
        print((diff + 1) // 2 + 1)
    elif max_freq == 2:
        print(diff // 2)
    else:
        print(diff)
else:
    other = [c for c in combi if c != max_set]
    max_other = max(other)
    min_other = min(other)
    print(max_set, max_other, min_other)

    n_operation = max_set - max_other
    max_other += n_operation
    min_other += n_operation
    print(max_set, max_other, min_other)

    diff = max_set - min_other
    if diff % 2 and diff == 1:
        n_add = (max_set - min_other) // 2 + 2
    elif diff % 2:
        n_add = (max_set - min_other) // 2 + 2
    else:
        n_add = (max_set - min_other) // 2
    n_operation += n_add

    print(n_operation)

Submission status: Wrong Answer

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

combi = [A, B, C]
set_abc = set(combi)

len_set_abc = len(set_abc)
max_set = max(set_abc)
min_set = min(set_abc)
if len_set_abc == 1:
    print(0)
elif len_set_abc == 2:
    max_freq = combi.count(max_set)
    diff = max_set - min_set
    if max_freq == 2 and diff % 2:
        print((diff + 1) // 2 + 1)
    elif max_freq == 2:
        print(diff // 2)
    else:
        print(diff)
else:
    other = [c for c in combi if c != max_set]
    max_other = max(other)
    min_other = min(other)

    # Operation (1st method)
    n_operation = max_set - max_other
    max_other += n_operation
    min_other += n_operation

    # Operation (2nd method)
    diff = max_set - min_other
    if diff % 2 and diff == 1:
        n_add = (max_set - min_other) // 2 + 2
    elif diff % 2:
        n_add = (max_set - min_other) // 2 + 1
    else:
        n_add = (max_set - min_other) // 2
    n_operation += n_add

    print(n_operation)