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, B, C = map(int, input().split())

if A == B == C:
    print(0)
    exit()

combi = [A, B, C]
max_ABC = max([A, B, C])
other = [c for c in combi if c != max_ABC]
max_other = max(other)
min_other = min(other)

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

if max_ABC == max_other == min_other:
    print(n_operation)
    exit()

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

print(n_operation)

Submission status: Wrong Answer

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

if A == B == C:
    print(0)
    exit()

combi = [A, B, C]
max_ABC = max([A, B, C])
other = [c for c in combi if c != max_ABC]
max_other = max(other)
min_other = min(other)

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

if max_other == min_other:
    print(n_operation)
    exit()

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

print(n_operation)

Submission status: Wrong Answer

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

if A == B == C:
    print(0)
    exit()

combi = [A, B, C]
max_ABC = max([A, B, C])
other = [c for c in combi if c != max_ABC]
max_other = max(other)
min_other = min(other)

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

if max_other == min_other:
    print(n_operation)
    exit()

# Operation (2nd method)
if (max_ABC - min_other) % 2:
    n_add = (max_ABC - min_other) // 2 + 1
else:
    n_add = (max_ABC - min_other) // 2
n_operation += n_add

print(n_operation)

Submission status: Wrong Answer

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

if A == B and B == C:
    print(0)
    exit()

combi = [A, B, C]
max_ABC = max([A, B, C])
other = [c for c in combi if c != max_ABC]
max_other = max(other)
min_other = min(other)

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

# print(max_ABC, max_other, min_other, 'n_op:', n_operation)

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

print(n_operation)

Submission status: Wrong Answer

Solution code:
n = list(map(int,input().split()))
n.sort(reverse=True)
a = n[0]-n[1]
b = n[0]-n[2]
if a == 0 and b == 0:
    print(0)
if a != 0 and b == 0:
    if a%2 == 0:
        print(a/2)
    elif a == 1:
        print(2)
    elif a%2 != 0:
        print(2+(a-1)/2)
if a == 0 and b != 0:
    if b%2 == 0:
        print(b/2)
    elif b == 1:
        print(2)
    elif b%2 != 0:
        print(2+(b-1)/2)
if a != 0 and b != 0:
    if a == 1 and b == 1:
        print(1)
    elif a%2 == 0 and b%2 == 0:
        print(a/2+b/2)
    elif a%2 != 0 and b%2 == 0:
        print(2+(a-1)/2+b/2)
    elif a%2 == 0 and b%2 != 0:
        print(2+a/2+(b-1)/2)
    elif a%2 != 0 and b%2 != 0:
        print(1+(a-1)/2+(b-1)/2)

Submission status: Wrong Answer

Solution code:
n = list(map(int,input().split()))
n.sort(reverse=True)
a = n[0]-n[1]
b = n[0]-n[2]
if a == 0 and b == 0:
    print(0)
if a != 0 and b == 0:
    if a%2 == 0:
        print(a/2)
    elif a == 1:
        print(2)
    elif a%2 != 0:
        print(1+(a-1)/2)
if a == 0 and b != 0:
    if b%2 == 0:
        print(b/2)
    elif b == 1:
        print(2)
    elif b%2 != 0:
        print(1+(b-1)/2)
if a != 0 and b != 0:
    if a == 1 and b == 1:
        print(1)
    elif a%2 == 0 and b%2 == 0:
        print(a/2+b/2)
    elif a%2 != 0 and b%2 == 0:
        print(2+(a-1)/2+b/2)
    elif a%2 == 0 and b%2 != 0:
        print(2+a/2+(b-1)/2)
    elif a%2 != 0 and b%2 != 0:
        print(1+(a-1)/2+(b-1)/2)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
A = np.array([int(x) for x in input().split()])
A = np.sort(A)
E = A[np.nonzero(A % 2 == 0)]
O = A[np.nonzero(A % 2 == 1)]
e, o = len(E), len(O)
if e == 0 or o == 0:
    a, b = A[-1] - A[0], A[-1] - A[1]
    print(a // 2 + b // 2)
elif e > o:
    A_2 = np.sort((E + 1) + O)
    a, b = A_2[-1] - A_2[0], A_2[-1] - A_2[1]
    print(1 + a // 2 + b // 2)
elif o > e:
    A_2 = np.sort((O + 1) + E)
    a, b = A_2[-1] - A_2[0], A_2[-1] - A_2[1]
    print(1 + a // 2 + b // 2)

Submission status: Wrong Answer

Solution code:

def main()->None:
    # todo:1.入力に同じ値があった時にどうするかの考慮漏れをどうするか
    #      2.while と配列へのアクセスによって時間がかかってる。差が大きくなればなるほどアクセス回数増える。
    l = list(map(int, input().split()))
    l.sort()
    # 最大値l[2]からの差を考える。
    l[0] = l[2] - l[0]
    l[1] = l[2] - l[1]
    l[2] = 0
    # l[１]から見ていく
    count = 0
    while True:
        if l[1] - 2 < 0:
            if l[1] == 0:
                break
            else:
                l[1] -= 1
                l[0] -= 1
                count += 1
                break
        l[1] -= 2
        count += 1

    # l[0]について
    flag = False
    while True:
        l[0] -= 2
        count += 1
        if l[0] <= 0:
            if l[0] == 0:
                flag = True
                break
            if l[0] < 0:
                break
    if flag: print(count)
    else: print(count+1)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if not x%2:
  print((2*y+x)//2)
else:
  print(((2*y+x)//2)+1)

Submission status: Wrong Answer

Solution code:

def main()->None:
    L = list(map(int, input().split()))
    L.sort()
    count = 0
    # 最大値が偶数の時
    if L[2] % 2 == 0:
        L[0] += 1
        L[2] += 1
        count += 1
        flag = True
        while flag:
            L[0]+=1
            L[1]+=1
            count += 1
            if L[1] == L[2]:
                flag = False
    # 最大値が奇数の時
    else:
        flag = True
        while flag:
            L[0] += 1
            L[1] += 1
            count += 1
            if L[1] == L[2]:
                flag = False
        flag = True
        while flag:
            L[0] += 2
            count += 1
            if L[0] == L[2]:
                flag = False
    print(count)




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:

def main()->None:
    L = list(map(int, input().split()))
    print(L)
    L.sort()
    count = 0
    # 最大値が偶数の時
    if L[2] % 2 == 0:
        L[0] += 1
        L[2] += 1
        count += 1
        flag = True
        while flag:
            L[0]+=1
            L[1]+=1
            count += 1
            if L[1] == L[2]:
                flag = False
    # 最大値が奇数の時
    else:
        flag = True
        while flag:
            L[0] += 1
            L[1] += 1
            count += 1
            if L[1] == L[2]:
                flag = False
        flag = True
        while flag:
            L[0] += 2
            count += 1
            if L[0] == L[2]:
                flag = False
    print(count)




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:

def main()->None:
    L = list(map(int, input().split()))
    print(L)
    L.sort()
    print(L)
    count = 0
    # 最大値が偶数の時
    if L[2] % 2 == 0:
        L[0] += 1
        L[2] += 1
        count += 1
        flag = True
        while flag:
            L[0]+=1
            L[1]+=1
            count += 1
            if L[1] == L[2]:
                flag = False
       
    # 最大値が奇数の時
    else:
        flag = True
        while flag:
            L[0] += 1
            L[1] += 1
            count += 1
            if L[1] == L[2]:
                flag = False
        flag = True
        while flag:
            L[0] += 2
            count += 1
            if L[0] == L[2]:
                flag = False
    print(count)




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
L  = list(map(int,input().split()))
L.sort(reverse = True)
#print(L)
ans = 0
if all(L[i]%2 == 1 for i in range(3)) or all(L[i]%2 == 0 for i in range(3)):
    print((L[0]-L[1])//2 + (L[0]-L[2])//2)
elif L[0]%2 == 1 and  L[1]%2 == 1 and  L[2]%2 == 0:
    print((L[0]+1-L[2])//2 + (L[1]+1-L[2])//2 +1)
elif L[0]%2 == 1 and  L[1]%2 == 0 and  L[2]%2 == 0:
    print(abs(L[1]+1-L[0])//2 + abs(L[2]+1-L[0])//2 +1)
elif L[0]%2 == 1 and  L[1]%2 == 0 and  L[2]%2 == 1:
    print((L[0]+1-L[1])//2 + (L[0]+1-L[1])//2 +1)
elif L[0]%2 == 0 and  L[1]%2 == 0 and  L[2]%2 == 1:
    print((L[0]+1-L[2])//2 + (L[0]+1-L[2])//2 +1)
elif L[0]%2 == 0 and  L[1]%2 == 1 and  L[2]%2 == 0:
    print((L[0]+1-L[1])//2 + (L[0]+1-L[2])//2 +1)
elif L[0]%2 == 0 and  L[1]%2 == 1 and  L[2]%2 == 1:
    print(abs((L[1]+1-L[0])//2) + abs(L[2]+1-L[0])//2 +1)

Submission status: Wrong Answer

Solution code:
#093C
import sys
L = list(map(int, sys.stdin.readline().split()))
L.sort()

cnt =0
while True:
    if L[2]-L[0] >=2:
        L[0]+=2
        cnt+=1
        L.sort()
    elif L[2]-L[1] >=2:
        L[1]+=2
        cnt+=1
        L.sort()
    elif L[0] != L[1] or L[0] !=L[2]:
        L[0]+=1
        L[1]+=1
        cnt+=1
        L.sort()
    print(L)
    if L[0]==L[1] and L[1]==L[2]:
        break

#print(L)
print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
L=list(map(int,sys.stdin.readline().split()))
L.sort()
cnt=0
while True:
  if L[2]-L[0]>=2:
    L[0]+=2
  elif L[2]-L[1]>=2:
    L[1]+=2
  elif L[0] !=L[1] or L[1] !=L[2]:
    L[0]+=1
    L[1]+=1
  L.sort()
  if L[0]==L[1] and L[1]==L[2]:
    break
  cnt+=1
  
print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
L=list(map(int,sys.stdin.readline().split()))
L.sort()
cnt=0
while True:
  if L[2]-L[0]>=2:
    L[0]+=2
  elif L[2]-L[1]>=2:
    L[1]+=2
  elif L[0] !=L[1] or L[1] !=L[2]:
    L[0]+=1
    L[1]+=1
  L.sort()
  if L[0]==L[1]==L[2]:
    break
  cnt+=1
  
print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
L=list(map(int,sys.stdin.readline().split()))
L.sort()
cnt=0
while True:
  if L[2]-L[0]>=2:
    L[0]+=2
  elif L[2]-L[1]>=2:
    L[1]+=2
  elif L[0] !=L[1] or L[1] !=L[2]:
    L[0]+=1
    L[1]+=1
  cnt+=1
  L.sort()
  if L[0]==L[1]==L[2]:
    break
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L = sorted(list(map(int, input().split())))
print(L)
if L[2]*3%2==sum(L)%2:
    print(int(sum([L[2]-i for i in L])/2))
else:
    print(int((sum([L[2]+1-i for i in L])-2)/2+1))

Submission status: Wrong Answer

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

if a%2 == b%2:
  t1 = (b-a) // 2
  t2 = c - b
  print(t1 + t2)

else:
  t1 = (b-a) // 2 + 2
  t2 = c + 1 - b
  print(t1+t2)

Submission status: Wrong Answer

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

if a%2 == b%2:
  t1 = (b-a) // 2
  t2 = c - b
  print(t1 + t2)

else:
  t1 = (b-a) // 2 + 1
  t2 = c + 1 - b
  print(t1+t2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, input().split())
# op1 : 1つを-1する
# op2 : 1つを+2する
# ソートして、なるべくop2をしてop1で最終調整が良さそう

# abcをsort
A, B, C = sorted([A, B, C])

cnt = 0
cnt += (C - A) // 2 
cnt += (C - B) // 2

# 今、A, B , C の偶奇性は保存されてる
if (B - A) % 2 == 0:
    if (C - A) % 2 != 0:
        cnt += 1
else:
    cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
from sys import stdin

li = list(map(int,stdin.readline().rstrip().split()))

li.sort(reverse = True)

point = 0
su = sum(li)%2
sai = li[0]%2

if sum(li) == 1:
    print(1)
    exit()
elif sum(li) == 0:
    print(0)
    exit()
else:
    if su != sai:
        li[0] += 1
        point += 1


    for i in range(1,len(li)):
        point += (li[0]-li[i])//2

    print(point)

Submission status: Wrong Answer

Solution code:
from sys import stdin

li = list(map(int,stdin.readline().rstrip().split()))

li.sort(reverse = True)

point = 0
su = sum(li)%2
sai = li[0]%2

if su != sai:
    li[0] += 1
    point += 1


for i in range(1,len(li)):
    point += (li[0]-li[i])//2

print(point)

Submission status: Wrong Answer

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

A = L[0]
B = L[1]
C = L[2]

dif1 = C - A
dif2 = C - B

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
abc = list(map(int, input().rstrip("\n").split()))
parities = [n % 2 for n in abc]
i = (parities.count(0) < parities.count(1))
new_abc = list()

ans = 0

if set(parities) == 2:
    for num, parity in zip(abc, parities):
        if parity == i:
            num += 1
        new_abc.append(num)
    ans += 1
else:
    new_abc = abc

max_ = max(new_abc)
new_abc.remove(max_)

for num in new_abc:
    ans += (max_ - num) // 2

print(ans)

Submission status: Wrong Answer

Solution code:
#ops dec 1 by 1 
#dec both by 2 
a,b,c=map(int,input().split()) 
def make_eq(x): 
    req_a=(a-x)
    req_b=(b-x)
    req_c=(c-x)
    twoa=req_a//2 
    onea=req_a%2 
    twob=req_b//2 
    oneb=req_b%2 
    twoc=req_c//2 
    onec=req_c%2
    l=[twoa,twob,twoc]
    l.sort()
    cost=0 
    mi=min(l[1],l[2])
    cost+=mi 
    l[1]-=mi 
    l[2]-=mi 
    l.sort()
    mi=min(l[1],l[2])
    cost+=mi 
    l[1]-=mi 
    l[2]-=mi 
    cost+=sum(l)
    cost+=onea+oneb+onec
    return cost 
mini=10**9 
ma=min(a,b,c)+1 
for i in range(ma):
    mini=min(mini,make_eq(i))
    #print(make_eq(i),i)
print(mini)

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, input().split())
_max = max(A, B, C)
sum = A + B + C
ans = 0

for i in range(50):
    a = sum % 3
    b = sum / 3
    #print(sum)
    if a == 0 and  b >= _max:
        print(ans)
        break
    else:
        ans += 1
        sum += 2
#print(ans)

Submission status: Wrong Answer

Solution code:
# 二つの操作で増える総数は同じ
# 最も小さい数を2ずつ増やし、小さい数が同数なら1ずつ増やす

def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    nums = list(map(int, input().split()))
    i = 0
    while True:
        nums.sort()
        if nums[0] == nums[1]:
            nums[0] += 1
            nums[1] += 1
        else:
            nums[0] += 2
        
        i += 1
        if len(set(nums)) == 1:
            print(i)
            break


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
a.sort()
b=0
ans=0
while a[2]-a[1]!=0 or a[1]-a[0]!=0:
  if a[0]>a[1] or a[1]>a[2]:
    a.sort()
  if a[1]==a[2]:
    if (a[1]-a[0])%2==1:
      a[1]+=1
      a[2]+=1
      ans+=1
      #print('ifif')
    else:
      #print('ifelse')
      while a[0]!=a[1]:
        a[0]+=2
        ans+=1
      print(ans)
      exit()
  elif a[1]==a[0]:
    #print('elif')
    print(ans+a[2]-a[1])
    exit()
  else:
    #print('else')
    a[0]+=2
    ans+=1
  #print(a,ans)

Submission status: Wrong Answer

Solution code:
item=list(map(int,input().split()))
item.sort()
times=0
while item[2]-item[1]>=2:
  times+=1
  item[1]+=2
while item[1]-item[0]>=2:
  times+=1
  item[0]+=2
if item[2]==item[0]:
  print(times)
else:
  print(times+1)

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    import bisect
    import collections
    import fractions
    import heapq
    input = sys.stdin.readline
    a, b, c = list(map(int, input().rstrip('\n').split()))
    cnt = 0
    while True:
        a, b, c = sorted([a, b, c])
        if abs(a - c) >= 2:
            a += 2
            cnt += 1
        else:
            if a == b:
                a += 1
                b += 1
                cnt += 1
            elif b == c:
                b += 1
                c += 1
                cnt += 1
            elif a == c:
                a += 1
                c += 1
                cnt += 1
        if a == b == c:
            print(cnt)
            exit()


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
data = list(map(int, input().split()))
data.sort()
if ( data[0] + data[1] ) % 2 == 0:

    print((( data[2] * 2 ) - ( data[0] + data[1]) ) // 2)
else:
    data[2] += 1
    print(1 + (( data[2] * 2 ) - ( data[0] + data[1]) + 1) // 2)

Submission status: Wrong Answer

Solution code:
abc = list(map(int, input().split()))
x = 0
y = 0
ans =0
for i in range(3):
    if abc[i]%2==0:
        x+=1
    else:
        y+=1
if x==2:
    for i in range(3):
        if abc[i]%2==0:
            abc[i]+=1
elif y==2:
    for i in range(3):
        if abc[i]%2==1:
            abc[i]+=1
else:
    ans -= 1
abc.sort(reverse=True)
ans = 1 + (abc[0]-abc[1])//2 + (abc[0]-abc[2])//2
print(ans)

Submission status: Wrong Answer

Solution code:
abc = list(map(int, input().split()))
x = 0
y = 0
for i in range(3):
    if abc[i]%2==0:
        x+=1
    else:
        y+=1
if x>y:
    for i in range(3):
        if abc[i]%2==0:
            abc[i]+=1
else:
    for i in range(3):
        if abc[i]%2==1:
            abc[i]+=1
abc.sort(reverse=True)
ans = 1 + (abc[0]-abc[1])//2 + (abc[0]-abc[2])//2
print(ans)

Submission status: Wrong Answer

Solution code:
abc = list(map(int, input().split()))
ans = 0
x = 0
y = 0
for i in range(3):
    if abc[i]%2==0:
        x+=1
    else:
        y+=1
if x>y:
    for i in range(3):
        if abc[i]%2==0:
            ans +=1
            abc[i]+=1
else:
    for i in range(3):
        if abc[i]%2==1:
            ans +=1
            abc[i]+=1
abc.sort(reverse=True)
ans = ans + (abc[0]-abc[1])//2 + (abc[0]-abc[2])//2
print(ans)

Submission status: Wrong Answer

Solution code:
abc = list(map(int, input().split()))
ans = 0
x = 0
y = 0
for i in range(3):
    if abc[i]%2==0:
        x+=1
    else:
        y+=1
if x>y:
    for i in range(3):
        if abc[i]%2==0:
            ans +=1
            abc[i]+=1
    abc.sort(reverse=True)
    ans = ans+(abc[0]-abc[1])//2 + (abc[0]-abc[2])//2
else:
    for i in range(3):
        if abc[i]%2==1:
            ans +=1
            abc[i]+=1
abc.sort(reverse=True)
ans = ans+(abc[0]-abc[1])//2 + (abc[0]-abc[2])//2
print(ans)

Submission status: Wrong Answer

Solution code:
abc = list(map(int, input().split()))
ans = 0
x = 0
y = 0
for i in range(3):
    if abc[i]%2==0:
        x+=1
    else:
        y+=1
if x>y:
    for i in range(3):
        if abc[i]%2==0:
            ans +=1
            abc[i]+=1
    abc.sort(reverse=True)
    ans = ans+(abc[0]-abc[1])//2 + (abc[0]-abc[1])//2
else:
    for i in range(3):
        if abc[i]%2==1:
            ans +=1
            abc[i]+=1
abc.sort(reverse=True)
ans = ans+(abc[0]-abc[1])//2 + (abc[0]-abc[1])//2
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
l=list(map(int,input().split()))
l.sort()

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
l=list(map(int,input().split()))
l.sort()

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
l=list(map(int,input().split()))
l.sort()

temp=[]
for item in l:
    temp.append(item%2)

if temp==[0,0,0] or temp==[1,1,1]:
    print((l[-1]-l[0])//2+(l[-1]-l[1])//2)
    
else:
    print((l[-1]-l[0])//2+(l[-1]-l[1])//2+1)

#めんどくさく適当

Submission status: Wrong Answer

Solution code:
abc = list(map(int,input().split()))
odd = []
even = []
for i in abc:
    if i%2==0:
        even.append(i)
    else:
        odd.append(i)
if (not odd) or (not even):
    print(sum([(max(abc)-x)//2 for x in abc]))
else:
    if len(odd) ==1:
        even = [x+1 for x in even]
    else:
        odd = [x+1 for x in even]
    abc = odd+even
    print(sum([(max(abc)-x)//2 for x in abc])+1)

Submission status: Wrong Answer

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

if a[1] % 2 == 0 and a[0] % 2 == 0:
    if a[2] % 2 == 0:
        output += (a[1] - a[0]) // 2
        output += (a[2] - a[1])

    else:
        output += (a[1] - a[0]) // 2
        output += (a[2] - a[1] - 1)
        output += 1

elif a[1] % 2 == 0 and a[0] == 2 != 0:
    if a[2] % 2 == 0:
        a[2], a[0], output = a[2] + 1, a[0] + 1, output + 1
        output += (a[1] - a[0]) // 2
        output += (a[2] - a[1] - 1)
        output += 1

    else:
        a[2], a[0], output = a[2] + 1, a[0] + 1, output + 1
        output += (a[1] - a[0]) // 2
        output += (a[2] - a[1])

elif a[1] % 2 != 0 and a[0] % 2 == 0:
    if a[2] % 2 == 0:
        a[2], a[1], output = a[2] + 1, a[1] + 1, output + 1
        output += (a[1] - a[0]) // 2
        output += (a[2] - a[1] - 1)
        output += 1

    else:
        a[2], a[0], output = a[2] + 1, a[0] + 1, output + 1
        output += (a[1] - a[0]) // 2
        output += (a[2] - a[1])

else:
    if a[2] % 2 == 0:
        a[1], a[0], output = a[1] + 1, a[0] + 1, output + 1
        output += (a[1] - a[0]) // 2
        output += (a[2] - a[1])

    else:
        a[1], a[0], output = a[1] + 1, a[0] + 1, output + 1
        output += (a[1] - a[0]) // 2
        output += (a[2] - a[1] - 1)
        output += 1

print(output)

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
lst=[a,b,c]
lst.sort()
mid=lst[2]
dif1=lst[2]-lst[1]
dif2=lst[1]-lst[0]
q1,mod1=divmod(dif1,2)
q2,mod2=divmod(dif2,2)
dif3=min(dif1,dif2)
if mod1==mod2:
  if mod1==0:
    print(q1+q2)
  else:
    print(q1+q2+1)
else:
  print(q1+q2+2)

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
lst=[a,b,c]
lst.sort()
mid=lst[2]
dif1=lst[2]-lst[1]
dif2=lst[1]-lst[0]
q1,mod1=divmod(dif1,2)
q2,mod2=divmod(dif2,2)
dif3=min(dif1,dif2)
if mod1==mod2:
  if mod1==0:
    print(dif1+dif2)
  else:
    print(dif1+dif2+1)
else:
  print(dif1+dif2+2)

Submission status: Wrong Answer

Solution code:
def solve():
    a,b,c = map(int, input().split())
    count = 0
    l = (a%2, b%2, c%2)
    if l == (0,0,0) or l == (1,1,1):
        count += abs(a-b) // 2
        count += abs(max(a,b) - c) // 2
    elif l == (1,0,0) or l == (0,1,1):
        count += abs(b-c) // 2
        if max(b,c) <= a:
            count +=  a - max(b,c)
        else:
            count += max(b,c) - a
    elif l == (0,1,0) or l == (1,0,1):
        count += abs(a-c) // 2
        if max(a,c) <= b:
            count +=  b - max(a,c)
        else:
            count += max(a,c) - b
    elif l == (0,0,1) or l == (1,1,0):
        count += abs(a-b) // 2
        if max(a,b) <= c:
            count +=  c - max(a,b)
        else:
            count += max(a,b) - c
    return count

if __name__ == '__main__':
    print(solve())

Submission status: Wrong Answer

Solution code:
def solve():
    a,b,c = map(int, input().split())
    count = 0
    l = (a%2, b%2, c%2)
    print(l)
    if l == (0,0,0) or l == (1,1,1):
        count += abs(a-b) // 2
        count += abs(max(a,b) - c) // 2
    elif l == (1,0,0) or l == (0,1,1):
        count += abs(b-c) // 2
        if max(b,c) <= a:
            count +=  a - max(b,c)
        else:
            count += max(b,c) - a
    elif l == (0,1,0) or l == (1,0,1):
        count += abs(a-c) // 2
        if max(a,c) <= b:
            count +=  b - max(a,c)
        else:
            count += max(a,c) - b
    elif l == (0,0,1) or l == (1,1,0):
        count += abs(a-b) // 2
        if max(a,b) <= c:
            count +=  c - max(a,b)
        else:
            count += max(a,b) - c
    return count

if __name__ == '__main__':
    print(solve())

Submission status: Wrong Answer

Solution code:
A=list(map(int,input().split()))
Fi=sorted(A)[2]
Se=sorted(A)[1]
Th=sorted(A)[0]
if (Se-Th)%2 == 0:
  ans=(2*Fi-Se-Th)/2
else:
  ans=(2*Fi-Se-Th+3)/2
print(ans)

Submission status: Wrong Answer

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

tmpM = max(A, B, C)
ans = (abs(A - tmpM) + abs(B - tmpM) + abs(C - tmpM))
if ans  % 2 == 0:
    print(ans // 2)
else:
    print((ans // 3) + 2)

Submission status: Wrong Answer

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

cnt = int((b-a)/2)
a += cnt * 2

cnt += c - a + int((b - a) / 2)

print(cnt)

Submission status: Wrong Answer

Solution code:
import math
a, b, c = map(int, input().split())
# 二つを +1　→　一つを -1 と読み替えて、目標値0 ~ 100までの操作回数を数える

def cnt(crnt, goal):
  if crnt >= goal:
    return abs(goal - crnt)
  else:
    return math.ceil((goal - crnt)/2) 

ans = 10**10
for i in range(100):
  ca = cnt(a, i)
  cb = cnt(b, i)
  cc = cnt(c, i)
  csum = ca + cb + cc
  if ans > csum:
    ans = csum
print(ans)

Submission status: Wrong Answer

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

cnt = 0
while not (a == b == c):
    if a == b:
        cnt = c - a
        print(cnt)
        exit()
    if b == c:
        if (b - c) % 2 == 0:
            cnt = (b - c) // 2
            print(cnt)
            exit()
        else:
            cnt = (b - c) // 2
            print(cnt+2)
            exit() 
    if (b - a) % 2 == 0:
        cnt = (b - a) // 2
        cnt += c - b
        print(cnt)
        exit()
    else:
        cnt = (b - a) // 2
        cnt += c - b + 1
        print(cnt)
        exit()


print(cnt)

Submission status: Wrong Answer

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

cnt = 0
while not (a == b == c):
    if a == b:
        cnt = c - a
        print(cnt)
        exit()
    elif b == c:
        cnt = a - b
        print(cnt)
        exit()
    elif c == a:
        cnt = b - c
        print(cnt)
        exit()
    if b - a == 1:
        print(c - a + 1)
        exit()
    if (b - a) % 2 == 0:
        cnt = (b - a) // 2
        cnt += c - b
        print(cnt)
        exit()
    else:
        cnt = (b - a) // 2
        cnt += c - b + 1
        print(cnt)
        exit()


print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
ary = list(map(int,input().split()))
count = 0
#最初から同じだった時
if ary[0] == ary[1] == ary[2]:
    print(0)
    sys.exit()

#和が偶数だった時
if (ary[0] + ary[1] + ary[2]) % 2 == 0:
    for i in range(3):
        if ary[i] % 2 == 1:
            ary[i] += 1
            count += 0.5
        print(ary)
# 和が奇数だった時
elif (ary[0] + ary[1] + ary[2]) % 2 == 1:
    for i in range(3):
        if ary[i] % 2 == 0:
            ary[i] += 1
            count += 0.5

while not ary[0] == ary[1] == ary[2]:
    ary.sort()
    ary[0] += 2
    count += 1

print(int(count))

Submission status: Wrong Answer

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    a,b,c = map(int, sys.stdin.readline().split())
    #a,b,c → x,x,xになる過程を求める問題
    #上の過程は(3x-(a+b+c))/2回
    #m=max{a,b,c}とするとx=m or m+1。条件分岐:和とmaxの偶奇が一致してればx=m
    wa = a+b+c
    m=max(a,b,c)

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

Submission status: Wrong Answer

Solution code:
import copy

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

max_v = max(a,b,c)


if max_v == b:
    tmp = a
    a = b
    b = tmp
elif max_v == c:
    tmp = a
    a = c
    c = tmp

tmp_b = (a-b) // 2
tmp_c = (a-c) // 2

if a - (b + 2 * tmp_b) + a - (c + 2 * tmp_c) == 2:
    ans = tmp_b + tmp_c + 1
elif a - (b + 2 * tmp_b) + a - (c + 2 * tmp_c) == 0:
    ans = tmp_b + tmp_c
else:
    ans = tmp_b + tmp_c + 2

print(tmp_b,tmp_c)

print(ans)

Submission status: Wrong Answer

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

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

k = 0
while True:
    a.sort()
    if a[1] == a[2]:
        a[0] += 2
        k += 1
    else:
        a[0] += 1
        a[1] += 1
        k += 1
    if a[0] == a[1] == a[2]:
        break
print(k)

Submission status: Wrong Answer

Solution code:
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:
    A += 1
    C += 1
    d = sorted([A,B,C])
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    ans += 1

    
print(ans)