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:
s=list(map(int, input().split()))
t=sorted(s)
ans=(t[2]-t[1])+(t[2]-t[0])
if s[0]%2==0 and  s[1]%2==0 and s[2]%2==0\
or s[0]%2==1 and s[1]%2==1 and s[2]%2==1:
    print(ans//2)
else:
    if (sum(s))%2==1:
        if t[2]%2==1:
            print((ans+3)//2)
        else:
            print(ans//2)
    else:
        if t[2]%2==0:
            print((ans+3)//2)
        else:
            print(ans//2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

print(cnt)

Submission status: Wrong Answer

Solution code:
# 解説見たら考察より2兆倍クレバーだったのでやる
# 和の偶奇と最大値の3倍の偶奇を比較する
from math import ceil
a, b, c = list(sorted(map(int, input().split())))
if (a + b + c) % 2 == (3 * c) % 2:
    print(round((c - b) / 2) + round((c - a) / 2))
else:
    print(ceil((c - b) / 2) + ceil((c - a) / 2) + 1)

Submission status: Wrong Answer

Solution code:
# 解説見たら考察より2兆倍クレバーだったのでやる
# 和の偶奇と最大値の3倍の偶奇を比較する
a, b, c = list(sorted(map(int, input().split())))
if (a + b + c) % 2 == (3 * c) % 2:
    print(round((c - b) / 2) + round((c - a) / 2))
else:
    print(round((c - b) / 2) + round((c - a) / 2) + 1)

Submission status: Wrong Answer

Solution code:
# 最大値に合わせる。最終形態は最大値をxとしたときにxが3つ or x+1が3つ
# それぞれどうやって分岐するかの条件がある
# 初期値でほかの2数のxとの差が偶奇で判断
a, b, c = list(sorted(map(int, input().split())))
if (c - a) % 2 == (c - b) % 2:
    print(c - max(a, b) + (max(a, b) - min(a, b)) // 2)
else:
    if b == c:
        ans = 1
        while a < b:
            a += 2
            ans += 1
        print(ans)
    else:
        ans = c - b
        a = c - b
        while a < c:
            a += 2
            ans += 1
        print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

a.sort()
#print(a)
x1 = int(a[2]) -  int(a[0])
x2 = int(a[2]) -  int(a[1])

#print(x1)
#print(x2)

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

total = 0
amari = 0

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

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

#print(total)

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

print(total)

Submission status: Wrong Answer

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

a.sort()
#print(a)
x1 = int(a[2]) -  int(a[0])
x2 = int(a[2]) -  int(a[1])

#print(x1)
#print(x2)

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

total = 0
amari = 0

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

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

#print(total)

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

print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# C
ABC = list(map(int, input().split()))
ABC.sort()
a = ABC[2] - ABC[1]
b = ABC[1] - ABC[0]
ans = a + (b + 1) // 2
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
max_ = max([a,b,c])
ls = [a,b,c]

if ls[0]%2 == ls[1]%2 == ls[2]%2:
    cnt = 3*max_- sum(ls)
    print(int(cnt/2))


ls.remove(max_)
if ls[0]%2 == ls[1]%2:
    cnt = 2*max_- sum(ls) -2
    print(int(cnt/2 +1))    
else:
    cnt = 2*max_- sum(ls) + 1
    print(int(cnt/2 +1))

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
max_ = max([a,b,c])
ls = [a,b,c]

if ls[0]%2 == ls[1]%2 == ls[2]%2:
    cnt = 2*max_- sum(ls)
    print(int(cnt/2))


ls.remove(max_)
if ls[0]%2 == ls[1]%2:
    cnt = 2*max_- sum(ls) -2
    print(int(cnt/2 +1))    
else:
    cnt = 2*max_- sum(ls) + 1
    print(int(cnt/2 +1))

Submission status: Wrong Answer

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

L=[A,B,C]
L=sorted(L)
ans+=L[2]-L[1] #この操作によってL[0]の値はL[0]+ans
if (L[2]-L[0]-ans)%2==0:
    ans+=(L[2]-L[0]-ans)//2
else:
    ans+=(L[2]-L[0]-ans)//2
    ans+=1
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
def turn(n):
  global a,b,c
  def t(n,a):
    if n==a:return 0
    elif n<a:return a-n
    else:return (n-a+1)//2
  return t(n,a)+t(n,b)+t(n,c)
mi=turn(0)
for i in range(1,51):mi=min(turn(i),mi)
print(mi)

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
def turn(n):
  global a,b,c
  def t(n,a):
    if n==a:return 0
    elif n<a:return a-n
    else:return (a-n+1)//2
  return t(n,a)+t(n,b)+t(n,c)
mi=turn(0)
for i in range(1,51):mi=min(turn(i),mi)
print(mi)

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
max_n=max([a,b,c])
diff=3*max_n-a-b-c
print((diff+1)//2)

Submission status: Wrong Answer

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

m = max(A)
l = []
for a in A:
    if a != m:
        l.append(m - a)

if len(l) == 0:
    print(0)
    exit()
if len(l) == 1:
    print((l[0] + 1) // 2)
    exit()

l.sort()

ans = 0

tmp = l[1] - l[0]

if tmp % 2 == 0:
    ans += tmp // 2 + l[0]
else:
    ans += tmp // 2 + 2 + l[0]

print(ans)

Submission status: Wrong Answer

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

m = max(A)
l = []
for a in A:
    if a != m:
        l.append(m - a)

if len(l) == 0:
    print(0)
    exit()
if len(l) == 1:
    print((l[0] + 1) // 2)
    exit()

l.sort()

ans = 0

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

print(ans)

Submission status: Wrong Answer

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

m = max(A)
l = []
for a in A:
    if a != m:
        l.append(m - a)

if len(l) == 0:
    print(0)
    exit()
if len(l) == 1:
    print((l[0] + 1) // 2)
    exit()

l.sort()

ans = 0

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

B = sorted(A,reverse=True)

C = B[0]-B[1]+B[0]-B[2]

if C%2 == 0:
  print(C//2)
else:
  print(C-2)

Submission status: Wrong Answer

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

for i in a:
    if i%2 == 0:
        temp.append(0)
    else:
        temp.append(1)
        
if a.count(1) == 2:
    for i in range(len(a)):
        if a[i] == 1:
            a[i] += 1
elif a.count(0) == 2:
    for i in range(len(a)):
        if a[i] == 0:
            a[i] += 1
            
ans  = 0

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

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

tmp = 0
max_num = max(ABC)
abs_list = [abs(max_num-i) for i in ABC]
if all(i % 2 == 0 for i in abs_list):
        res = int(sum(abs_list) / 2)
else:
        res = int((sum(abs_list)) / 2) + 2

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def dfs(a, b, c, count):
    if a == b == c:
        return count
    elif a > 50 or b > 50 or c > 50:
        return 1000
    count = min(dfs(a+1, b+1, c, count+1), dfs(a, b+1, c+1, count+1), dfs(a+1, b, c+1, count+1), \
        dfs(a+1, b, c, count+1), dfs(a, b+1, c, count+1), dfs(a, b, c+1, count+1))

    return count

count = dfs(A, B, C, count)

print(count)

Submission status: Wrong Answer

Solution code:
N=[int(i) for i in input().split()]
N.sort()
a=N[0]
b=N[1]
c=N[2]
count=0
if b-a%2!=0:
  b+=1
  c+=1
  count=1
print(c-b+(b-a)//2+count)

Submission status: Wrong Answer

Solution code:
N=[int(i) for i in input().split()]
N.sort()
a=N[0]
b=N[1]
c=N[2]
print(c-b+(b-a)//2)

Submission status: Wrong Answer

Solution code:
import math
a=list(map(int,input().split()))
a.sort()
i,j=a[2]-a[0],a[2]-a[1]

if i%2==1 and j%2==1: ans=i/2+j/2
else: ans=math.ceil(i/2)+math.ceil(j/2)
print(int(ans))

Submission status: Wrong Answer

Solution code:
A = [int(i) for i in input().split()]
A.sort()
ans = A[2] - A[1]
A[0] += ans
ans += (A[2] - A[0])//2 + ((A[2] - A[0]) % 2 == 1)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,C = map(int,input().split())
max_ABC = max(A,B,C)
dif = [max_ABC - A,max_ABC - B,max_ABC - C]
odd_dif = [i for i in dif if i % 2 == 1]
even_dif = [i for i in dif if i % 2 == 0] 

if len(even_dif) == 3:
	ans = sum(dif)/ 2
elif len(even_dif) == 2:
	ans = (sum(dif) + 3) / 2
else:
	ans = sum(dif) / 2
	
print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C = map(int,input().split())
max_ABC = max(A,B,C)
dif = [max_ABC - A,max_ABC - B,max_ABC - C]
odd_dif = [i for i in dif if i % 2 == 1]
even_dif = [i for i in dif if i % 2 == 0] 

if len(even_dif) == 3:
	print(int(dif[0] / 2 + dif[1] / 2 + dif[2] / 2))
elif len(even_dif) == 2:
	sum = 0
	sum += int((even_dif[0] + even_dif[1]) / 2)
	sum += int((max_ABC + 1 - odd_dif[0]) / 2)
	sum += 1
	print(sum)
else:
	sum = 0
	sum += int((odd_dif[0] + odd_dif[1]) / 2)
	print(sum)

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


# globals
A, B, C = 0, 0, 0


def set_inputs():
    global A, B, C
    A, B, C = get_li()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    x, y, z = sorted([A, B, C])
    xd, xm = divmod(x, 2)
    yd, ym = divmod(y, 2)
    zd, zm = divmod(z, 2)
    m = xm + ym + zm
    if m == 0 or m == 3:
        print(zd - xd + zd - yd)
    else:
        print(zd - xd + zd - yd + 1)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return zip(*(
        [t(x) for t, x in zip(types, input().split())]
        for _ in range(n)
    ))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

print(A, B, C)
count = 0

A += C - B
count += C - B

count += (C - A) / 2
count = int(count)

if (C - A) % 2 != 0 :
    count += 2

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
diffs = [abs(a - b), abs(b - c)]
sum_diffs = sum(diffs)
tmp = int(sum_diffs / 2)
ans = tmp if sum_diffs % 2 == 0 else tmp + 1 + 1
print(ans)

Submission status: Wrong Answer

Solution code:
x = sorted(list(map(int, input().split())))
cnt = (x[2]-x[1])//2 + (x[2]-x[0])//2
x[1] -= (x[2]-x[1])//2
x[0] -= (x[2]-x[0])//2
if(sum(x) % 3 != 0) :
  if(sum(x) % 2 == 1) :
    cnt += 1
  else :
    cnt += 2
print(cnt)

Submission status: Wrong Answer

Solution code:
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**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
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 pf(s): return print(s, flush=True)


"""
解説を読んで

最終的に行き着く数をXとする
XはA,B,Cの最大値または最大値＋１のどちらかである。
そうすると、3X - (A+B+C)を2で割った時に余り0となるようなXを求めれば良い
それはA,B,Cの最大値またはそれにプラス１した値である。

"""
A, B, C = LI()
X = max([A,B,C])
result1 = 3*X - (A+B+C)
result2 = 3*(X+1) - (A+B+C)
if result1%2 == 0:
    print(result1/2)
else:
    print(result2/2)

Submission status: Wrong Answer

Solution code:
import math
L=list(map(int,input().split()))
temp=0
count=0
for i in L:
    if i%2==0:
        temp+=1
if temp==0 or temp==2:
    #even is even
    for i in range(len(L)):
        if L[i]%2==0:
            L[i]+=1
            count+=1/2
    count//=1
    L.sort()
    count+=(L[1]-L[0])//2
    count+=(L[2]-L[1])
else:
    #even is odd
    for i in range(len(L)):
        if L[i]%2!=0:
            L[i]+=1
            count+=1/2
        count//=1
        L.sort()
        count+=(L[1]-L[0])//2
        count+=(L[2]-L[1])
print(math.ceil(count))

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
# 最終的にa,b,c全てがなるべき値
# Xは必ずM以上になる
M = max(a, max(b, c))
# 奇数であってはいけない
if (a+b+c)%2 != 1:
    X = M
else:
    X = M + 1

# 2ずつ増えるから、(3X-(a+b+c)) / 2が答え
print((3*X - (a+b+c)) / 2)

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
# 最終的にa,b,c全てがなるべき値
# Xは必ずM以上になる
M = max(a, max(b, c))
# 奇数であってはいけない
if (a+b+c)%2 == 1:
    X = M
else:
    X = M + 1

# 2ずつ増えるから、(3X-(a+b+c)) / 2が答え
print((3*X - (a+b+c)) / 2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
T=list(map(int,input().split()))
T.sort()
L1=T[0]
L2=T[1]
L3=T[2]
ans=0
ans+=L3-L2
print(ans)
ans+=(L3-ans-L1+1)//2+(L3-L1-ans)%2
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# C
a = list(map(int, input().split()))
a.sort()
all_odd = True
all_even = True
for i in range(3):
    if a[i] % 2 == 0:
        all_odd = False
    if a[i] % 2 == 1:
        all_even = False
max_a = a[2]
ans = 0
if all_odd:
    for i in range(2):
        ans += (max_a - a[i])/2
elif all_even:
    ans += (2 * max_a - a[0] - a[1])
elif a[0] % 2 == max_a % 2 and a[1] % 2 != max_a % 2:
    ans += (max_a - a[0])/2
    ans += (max_a-1 - a[1])/2
    ans += 2
else:
    ans += (max_a-1 - a[1])/2
    ans += (max_a-1 - a[0])/2
    ans += 1

print(int(ans))

Submission status: Wrong Answer

Solution code:
# C
a = list(map(int, input().split()))
a.sort()
all_odd = True
for i in range(3):
    if a[i] % 2 == 0:
        all_odd = False
max_a = a[2]
ans = 0
if all_odd:
    for i in range(2):
        ans += (max_a - a[i])/2
elif max_a % 2 == 1:
    for i in range(2):
        ans += (max_a-1 - a[i])/2
    ans += 1
else:
    for i in range(2):
        if a[i] % 2 == 0:
            ans += (max_a - a[i])/2
        else:
            ans += (max_a-1 - a[i])/2
    ans += 2
print(int(ans))

Submission status: Wrong Answer

Solution code:
# C
a = list(map(int, input().split()))
a.sort()
all_odd = True
for i in range(3):
    if a[i] % 2 == 0:
        all_odd = False
max_a = a[2]
ans = 0
if all_odd:
    for i in range(2):
        ans += (max_a - a[i])/2
elif max_a % 2 == 1:
    for i in range(2):
        ans += (max_a-1 - a[i])/2
    ans += 1
else:
    for i in range(2):
        if a[i] % 2 == 0:
            ans += (max_a - a[i])/2
        else:
            ans += (max_a-1 - a[i])/2
print(int(ans))

Submission status: Wrong Answer

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

if(C%2 == 0):
  max_ = (C+1)*3
else:
  max_ = C*3
print((max_ - (A+B+C))//2)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
data=[int(_) for _ in input().split()]

data.sort()
A=data[2]
B=data[1]
C=data[0]
count=0
print(A,B,C)
while A!=B:

    B+=1
    C+=1
    count+=1
    print(A,B,C)

while C<B:
    C+=2
    count+=1
    print(A,B,C)

if B==C:
    print(count)
else:
    print(count+1)

Submission status: Wrong Answer

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

oddcnt = 0
sub = [A,B,C]
sub2 = [i - min(sub) for i in sub]
sub2 = sorted(sub2)[1:3]
print(sub2)
for i in sub2:
    if i%2 != 0:
        oddcnt += 1

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

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def solve():
    A, B, C = il()
    diff = sorted([abs(A - B), abs(B - C)])
    c = 0
    for i, d in enumerate(diff):
        div_2 = d // 2
        if div_2 > 0:
            c += d // 2
            diff[i] -= 2 * div_2
    for i, j in ((1, 0), (0, 1)):
        if diff[i] == 1:
            if diff[j] == 1:
                c += 1
            elif diff[j] == 0:
                c += 2

    return c


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

Submission status: Wrong Answer

Solution code:
number = list(map(int, input().split()))
ans = 0
number.sort()
print(number)
a = (number[1] - number[0]) // 2
ans += a
number[0] += 2 * a

ans += abs(number[2]-number[0]) + abs(number[1]-number[0])
print(ans)

Submission status: Wrong Answer

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

if max_ABC != A:
    ans += (max_ABC - A) // 2
    A += 2 * ((max_ABC-A) // 2)

if max_ABC != B:
    ans += (max_ABC - B) // 2
    B +=  2 * ((max_ABC-B) // 2)

if max_ABC != C:
    ans += (max_ABC - C) // 2
    C += 2 * ((max_ABC-C) // 2)

if 3 * max_ABC - (A+B+C) == 2:
    ans += 1
elif 3 * max_ABC - (A+B+C) == 1:
    ans += 2
print(ans)
print(A, B, C)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if ds:
    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)

Submission status: Wrong Answer

Solution code:
a,b,c = (map(int,input().split(" ")))
ar = [a,b,c]
ar.sort()
count = 0
while True:
    if len(set(ar)) == 1:
        break
    elif len(set(ar)) == 3:
        count += (ar[2]-ar[0]) // 2
        ar[0] += 2 * ((ar[2]-ar[0]) // 2)
        count += (ar[2]-ar[1]) // 2
        ar[1] += 2 * ((ar[2]-ar[1]) // 2)
    else:
        if ar[0] == ar[1]:
            ar[0] += 1
            ar[1] += 1
            count += 1
        elif ar[0] == ar[2]:
            ar[0] += 1
            ar[2] += 1
            ar[1] += 2
            count += 2
        else:
            ar[1] += 1
            ar[2] += 1
            ar[0] += 2
            count += 2
print(count)

Submission status: Wrong Answer

Solution code:
import math

def main():
    a, b, c = map(int, input().split())
    
    top = max([a, b, c])
    bot = min([a, b, c])
    mid = 0
    for x in [a, b, c]:
        if top != x and bot != x:
            mid = x
    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), end="")
    print()

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
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 > b:
            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))

Submission status: Wrong Answer

Solution code:
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 >= 52 or b >= 52 or c >= 52:
            return cnt

        if b > a and b > c:
            queue.append([a+1, b, c+1, cnt+1])
        elif a > b and a > b:
            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 or a < c:
            queue.append([a+2, b, c, cnt+1])
        elif b < a or b < c:
            queue.append([a, b+2, c, cnt+1])
        elif c < a or c < b:
            queue.append([a, b, c+2, cnt+1])

print(bfs(a, b, c))

Submission status: Wrong Answer

Solution code:
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 >= 52 or b >= 52 or c >= 52:
            return cnt

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

print(bfs(a, b, c))

Submission status: Wrong Answer

Solution code:
l=[int(i) for i in input().split()]
l.sort()
ans=l[2]-l[1]+(l[1]-l[0])%2
#print(ans)
ans+=(l[1]-l[0])//2
print(ans)

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, input().split())
sta = max(A, B, C)
ans = 0
if (B-A) >= 2:
    kake = (B-A)//2
    A = A*kake
    ans += kake

if (B-C) >= 2:
    kake = (B-C)//2
    C = C*kake
    ans += kake


if A == B == C:
    print(ans)
elif A == C:
    print(ans+1)
else:
    print(ans+2)

Submission status: Wrong Answer

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

ABC.sort()
# print(ABC)

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

# print(ABC)

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

if dif_AB == 1 and dif_AC == 1:
    ans += 1
else:
    ans += 2
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)
else:
    print((X[2] - X[0]) // 2 + (X[2] - X[1]) // 2 + 2)