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())

s = a+b+c
cnt = 0
while True:
    s += 2
    cnt += 1
    if s%3==0:
        if s//3 >= a and s//3 >= b and s//3>= c:
            break
print(cnt)

Submission status: Wrong Answer

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

s = a+b+c
cnt = 0
f = 0
while True:
    s += 2
    cnt += 1
    if s%3==0:
        if s//3 >= a and s//3 >= b and s//3>= c:
            f = 1
    if f:
        break
print(cnt)

Submission status: Wrong Answer

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

s = a+b+c
cnt = 0
f = 0
while True:
    s += 2
    cnt += 1
    if s%3==0:
        if s//3 >= a and s//3 >= b and s>= c:
            f = 1
    if f:
        break
print(cnt)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-09-26 23:35:00 +0900
# LastModified: 2020-09-26 23:49:19 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    L = list(map(int, input().split()))
    ans = 0
    max_idx = L.index(max(L))
    min_idx = L.index(min(L))
    for i in range(len(L)):
        if i == max_idx or i == min_idx:
            pass
        else:
            medium_idx = i
    ans += L[max_idx] - L[medium_idx]
    L[medium_idx] = L[max_idx]
    L[min_idx] += ans
    if (L[max_idx]-L[min_idx]) % 2 == 0:
        print(ans + (L[max_idx]-L[min_idx])//2)
    else:
        print(ans + (L[max_idx]-L[min_idx]+1)//2 + 2)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

s = A + B + C
M = max(A,B,C)
if M % 2 == 0 and s % 2 != 0:
    M += 1
elif M % 2 != 0 and s % 2 == 0:
    M += 1

ans = (3 * M - s) / 2
print(ans)

Submission status: Wrong Answer

Solution code:
z=input().split()
a=int(z[0])
b=int(z[1])
c=int(z[2])
goukei=a+b+c
count=0
while 1:
  count += 1
  
  goukei = goukei + 2
#   print(str(count)+':'+str(goukei))
  if goukei>=max([a,b,c])*3 and goukei%3 == 0:
    print(count)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a_L = list(sorted(a_L))

diff1 = a_L[2]-a_L[1]
diff2 = a_L[2]-a_L[1]


if (diff1+diff2) % 2 == 0:
    print((diff1+diff2)//2)
else:
    print((diff1+diff2+3)//2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
A = a % 2
B = b % 2
C = c % 2
cnt = 0
s = [a,b,c]
flag = [0,0,0,0]
if A == B == C:
    t = [a,b,c]
    t.sort()
    cnt = cnt + (t[2]-t[1])//2 + (t[2]-t[0])//2
    flag[0] += 1
elif A == B:
    cnt = cnt + 1
    a = a + 1
    b = b + 1
    t = [a,b,c]
    t.sort()
    cnt = cnt + (t[2]-t[1])//2 + (t[2]-t[0])//2
    flag[1] += 1
elif B == C:
    cnt = cnt + 1
    b = c + 1
    c = c + 1
    t = [a,b,c]
    t.sort()
    cnt = cnt + (t[2]-t[1])//2 + (t[2]-t[0])//2
    flag[2] += 1
elif C == A:
    cnt = cnt + 1
    c = c + 1
    a = a + 1
    t = [a,b,c]
    t.sort()
    cnt = cnt + (t[2]-t[1])//2 + (t[2]-t[0])//2
    flag[3] += 1
print(cnt)
# print(t)
# print(flag)

Submission status: Wrong Answer

Solution code:
#C - Same Integers
ABC = list(map(int,input().split()))
ABC = sorted(ABC,reverse = True)
A = ABC[0]#max
B = ABC[1]
C = ABC[2]#min
print(ABC)
count = 0
while A != B:
    C += 1
    B += 1
    count += 1
while (B - C)%2 == 1:
    A += 1
    B += 1
    count += 1
while A!=C:
    C += 2
    count += 1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if A[1]-A[0]>=2:
  cnt += (A[1]-A[0])//2
  A[0]+= cnt*2

if A[0]==A[1]==A[2]:
  print(cnt)
  exit()
  
while(True):
  cnt+=1
  A = sorted(A)
  A[0]+=1
  A[1]+=1
  print(A)
  if A[0]==A[1]==A[2]:
    break

print(cnt)

Submission status: Wrong Answer

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

if A[1]-A[0]>=2:
  cnt += (A[1]-A[0])//2
  A[0]+= cnt*2

#print(A)

while(True):
  cnt+=1
  A = sorted(A)
  A[0]+=1
  A[1]+=1

  if A[0]==A[1]==A[2]:
    break

print(cnt)

Submission status: Wrong Answer

Solution code:
#
# abc093 c
#

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)


def resolve():
    I = list(map(int, input().split()))
    I.sort()
    t = 2*I[2]-I[0]-I[1]
    ansa = 0
    if t % 2 == 0:
        ansa = t // 2
    else:
        ansa = t
    ansb = 0
    t = 2*I[2]-I[0]-I[1]+3
    if t % 2 == 0:
        ansb = t // 2
    else:
        ansb = t

    print(min(ansa, ansb))


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    ans= 0
    even = []
    odd = []
    for i in [a, b, c]:
        if i % 2== 0:
            even.append(i)
        else:
            odd.append(i)
    if len(even) == 1:
        ans += 1 #奇数に+1
        odd[0] += 1
        m = max(max(even), odd[0]+1)
        even.extend(odd)
        for i in even:
            ans += (m-i)//2
    elif len(even) == 2:
        ans += 1 #偶数に+１
        even[0] += 1
        even[1] += 1
        m = max(max(even),odd[0])
        even.extend(odd)
        for i in even:
            ans += (m-i)//2
    elif len(even) == 3 or len(odd) == 3:
        m = max(max(even, odd))
        for i in max(even, odd):
            ans += (m-i)//2
    print(ans)
resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import ceil
abc = sorted(list(map(int, input().split())))

ans = 0
if abc[1]-abc[0] == 1:
  abc[0] += 1
  abc[2] += 1
  ans += 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def f(abc,c):
    print(abc)
    m = max(abc)
    a = 0
    for i in abc:
        a += (i < m)
    if a == 0:
        return c
    c += 1
    if a <= 1:
        for i,x in enumerate(abc):
            if x < m:
                abc[i] += 2
                break
        return f(abc,c)
    else:
        for i,x in enumerate(abc):
            if x < m:
                abc[i] += 1
        return f(abc,c)


abc = list(map(int, input().split()))
print(f(abc,0))

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
x = abs(a-b)
y = abs(b-c)

if (x%2 == 0 and y%2 == 0): # 差が ぐぐ
    ans = x//2 + y//2
elif (x%2 == 1 and y%2 == 1): #差が きき
    ans = x//2 + y//2 + 1
else: # 差が ぐき or きぐ
    ans = x//2 + y//2 + 2

print (ans)

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
x = abs(a-b)
y = abs(b-c)
print (x,y,-(-x//2),-(-y//2))

if (x%2 == 0 and y%2 == 0): # 差が ぐぐ
    ans = x//2 + y//2
elif (x%2 == 1 and y%2 == 1): #差が きき
    ans = x//2 + y//2 + 1
else: # 差が ぐき or きぐ
    ans = x//2 + y//2 + 2

print (ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

ans = 0
if C % 2 == 0:
    if A % 2 == 0 and B % 2 == 1:
        ans += 1
        A += 1
        C += 1
    elif A % 2 == 1 and B % 2 == 0:
        ans += 1
        B += 1
        C += 1
    else:
        ans += 1
        A += 1
        B += 1
else:
    if A % 2 == 0 and B % 2 == 1:
        ans += 1
        B += 1
        C += 1
    elif A % 2 == 1 and B % 2 == 0:
        ans += 1
        A += 1
        C += 1
    else:
        ans += 1
        A += 1
        B += 1

while C > A:
    A += 2
    ans += 1

while C > B:
    B += 2
    ans += 1

# print(A, B, C)
print(ans)

Submission status: Wrong Answer

Solution code:
l=list(map(int,input().split()))
print((max(l)*3-sum(l))//2)

Submission status: Wrong Answer

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

max_num = max(a,b,c)
cnt = 0

if max_num == a:
    if (a - b) % 2 == 0:
        cnt += 1
    if (a - c) % 2 == 0:
        cnt += 1
    if cnt == 2 or cnt == 0:
        print((a*2-b-c)//2)
    else:
        print((a*2-b-c+1)//2+1)
elif max_num == b:
    if (b - a) % 2 == 0:
        cnt += 1
    if (b - c) % 2 == 0:
        cnt += 1
    if cnt == 2 or cnt == 0:
        print((b*2-a-c)//2)
    else:
        print((b*2-a-c+1)//2+1)
else:
    if (c - a) % 2 == 0:
        cnt += 1
    if (c - b) % 2 == 0:
        cnt += 1
    if cnt == 2 or cnt == 0:
        print((c*2-a-b)/2)
    else:
        print((c*2-a-b+1)//2+1)

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
b=0
f=True

while f:
  if max(a)-min(a)>1:
    a.sort()
    a[0]+=2
    b+=1
  else:
    a.sort()
    a[0]+=1
    a[1]+=1
    b+=1
  if a[0]==a[1]==a[2]:
    f=False
print(b)

Submission status: Wrong Answer

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

a = sorted(ri_(),reverse=True)
b = a[0] - a[1]
c = a[0] - a[2]
print(b // 2 + b % 2 + c // 2 + c % 2)

Submission status: Wrong Answer

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

dist1=a[2]-a[0]
dist2=a[2]-a[1]

if (dist1%2)==0 and (dist2%2)==0:
  ans=(dist1+dist2)//2
  print(ans)
  
elif (dist1%2)==1 and (dist2%2)==1:
  ans=(dist1+dist2)//2
  print(ans)
  
elif (dist1%2)==2 and (dist2%2)==1:
  ans=(dist1//2)+(dist2+1)//2
  print(ans+1)
  
else:
  ans=(dist2//2)+(dist1+1)//2
  print(ans+1)

Submission status: Wrong Answer

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

dist1=a[2]-a[0]
dist2=a[2]-a[1]

if (dist1%2)==0 and (dist2%2)==0:
  ans=(dist1+dist2)//2
  print(ans)
  
elif (dist1%2)==1 and (dist2%2)==1:
  ans=(dist1+dist2)//2
  print(ans)
  
elif (dist1%2)==2 and (dist2%2)==1:
  ans=(dist1//2)+(dist2+1)//2
  print(ans)
  
else:
  ans=(dist2//2)+(dist1+1)//2
  print(ans)

Submission status: Wrong Answer

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

ABC.sort(reverse = True)

step1 = ABC[0] - ABC[1]
step2 = ABC[0] - ABC[2] - step1

if step2 % 2 == 0:
    result  = int(step2 / 2) + step1
else:
    result = int(step2 / 2) + step1 + 1
print(result)

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
m = max(a,b,c)
n = 0
flg = False
if a != m:
    n += (m - a) // 2
    if (m - a) % 2 == 1:
        flg = True
if b != m:
    n += (m - b) // 2
    if (m - b) % 2 == 1:
        flg = True
if c != m:
    n += (m - c) // 2
    if (m - c) % 2 == 1:
        flg = True
if flg:
    n += 1
print(n)

Submission status: Wrong Answer

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    ABC = il()

    mx = max(ABC)
    if mx % 2 == 0:
        mx += 1
    print(((mx*3) - sum(ABC))//2)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
s, m, b = sorted(a)
cnt = 0
m_s = m - s

if m_s % 2 == 0 and m < b and m_s != 0:
    cnt += m_s // 2
    s += m_s
elif m_s % 2 == 1 and m < b:
    cnt += 1
    s += 1
    b += 1
b_m = b - m
cnt += b_m
print(cnt)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
ABC = list(map(int, input().split()))
ABC.sort()
count = ABC[2] - ABC[1]
other = ABC[2] - ABC[0] - count

if other % 2 == 0:
    count += other / 2
else:
    count += other // 2 + 1

print(int(count))

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

aa=sorted(nl())[::-1]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    abc_sort = sorted(abc)
    min_num, mid_num, max_num = abc_sort
    Count = 0
    while(max_num - min_num > 1):
        diff = max_num - min_num
        Count += diff//2
        abc_sort[0] += (diff//2) * 2
        abc_sort = sorted(abc_sort)
        max_num = abc_sort[2]
        min_num = abc_sort[0]

    if (abc_sort[2] - abc_sort[1] == 1):
        Count += 1
    elif (abc_sort[2]-abc_sort[1] and abc_sort[1] - abc_sort[0]):
        Count += 2
    print(Count)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    abc_sort = sorted(abc)
    min_num, mid_num, max_num = abc_sort
    ans = (max_num-mid_num) + (mid_num-min_num)//2
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    ABC = il()
    n = 1
    while True:
        if 3 * n >= sum(ABC) and n >= max(ABC) and (3 * n - sum(ABC)) % 2 == 0:
            print((3 * n - sum(ABC)) // 2)
            exit()
        else:
            n += 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    ABC = il()
    sm = sum(ABC)
    mx = max(ABC) + 1
    n = (mx * 3) - sm
    mx = max(ABC)
    m = (mx * 3) - sm
    print(min(n // 2 + n % 2, m // 2 + m % 2))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    ABC = il()
    sm = sum(ABC)
    mx = max(ABC)+1 if max(ABC) % 2 == 0 else max(ABC)
    n = (mx*3)-sm
    print(n//2 + n % 2)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

[A,B,C] = list(map(int,input().split()))
X = [A,B,C]

saidai=max(X)
#print(saidai)
#print(sum(X))

i=1
while True:
    dammy = 3 * (saidai+i) - sum(X)
    if dammy %2 == 0:
        print(dammy//2)
        break
    i+=1

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

A,B,C = I()
cnt = 0
for i in range(1000):
    if A != B and B != C and A != C:
        A += 1
        B += 1
        C += 1
        if max(A,B,C) == A:
            A -= 1
        elif max(A,B,C) == B:
            B -= 1
        else:
            C -= 1
        cnt += 1
    if A == B and B == C and A == C:
        print(cnt)
        exit()
    if A == B or B == C or A == C:
        d = abs(max(A,B,C)-min(A,B,C))
        if [A,B,C].count(max(A,B,C)) == 2:
            if d%2 == 0:
                print(d//2)
                exit()
            else:
                print(d//2+2)
                exit()
        else:
            print(d)
            exit()

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

A,B,C = I()
cnt = 0
for i in range(1000):
    if A != B and B != C and A != C:
        A += 1
        B += 1
        C += 1
        if max(A,B,C) == A:
            A -= 1
        elif max(A,B,C) == B:
            B -= 1
        else:
            C -= 1
        cnt += 1
    if A == B and B == C and A == C:
        print(cnt)
        exit()
    elif A == B or B == C or A == C:
        if min(A,B,C) == A:
            A += 2
        elif min(A,B,C) == B:
            B += 2
        else:
            C += 2
        cnt += 1

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
abc_M = max([a, b, c])
ans = 0
no_max = list(map(lambda x: abs(x-abc_M), [a, b, c]))
no_max = [i for i in no_max if i != 0]
if all(i % 2 == 0 for i in no_max):
  for i in no_max:
    ans += i//2
if all(i % 2 != 0 for i in no_max):
  for i in no_max:
    ans += (i-1)//2
  ans += 1
if [i %2 == 0 for i in no_max] == [True, False] or [False, True]:
  ans += 1
  for i in no_max:
    if i % 2 != 0:
      ans += (i-1)//2
    if i%2 == 0:
      ans += i//2
  ans += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
a.sort()
cnt=0
if a[1]!=a[2]:
    cnt=a[2]-a[1]
    a[0]+=cnt
    a[1]+=cnt
if a[1]==a[0]+1:
    a[1]+=1
    a[2]+=1
    cnt+=1
if a[0]!=a[1]:
    n=int((a[1]-a[0])/2)
    cnt+=n
    #a[0]+=(n*2)
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mn = min(a, b, c)
md = statistics.median([a, b, c])
mx = max(a, b, c)

if (md - mn) % 2 == 0:
    print((md - mn) // 2 + (mx - md))
else:
    print((md + 1 - mn) // 2 + (mx - 2 - md) + 2)

Submission status: Wrong Answer

Solution code:
A,B,C = map(int,input().split())
if (A+B+C)%2 == 0:
    candidates = [i for i in range(0,151,6)]
else:
    candidates = [i for i in range(3,151,6)]
for i in candidates:
    x = i/3
    if A<= x and B<= x and C<=x and ((x-A)+(x-B)+(x-C))%2==0:
        print(int((i-(A+B+C))/2))
        break

Submission status: Wrong Answer

Solution code:
A,B,C = map(int,input().split())
candidates = [i for i in range((A+B+C)%3*2+(A+B+C),151,6)]
for i in candidates:
    x = i/3
    if A<= x and B<= x and C<=x and ((x-A)+(x-B)+(x-C))%2==0:
        print(int((i-(A+B+C))/2))
        break

Submission status: Wrong Answer

Solution code:
A,B,C = map(int,input().split())
candidates = [i for i in range((A+B+C)%3*2+(A+B+C),150,6)]
for i in candidates:
    x = i/3
    if A<= x and B<= x and C<=x and ((x-A)+(x-B)+(x-C))%2==0:
        print(int((i-(A+B+C))/2))
        break

Submission status: Wrong Answer

Solution code:
# C - Same Integers
# https://atcoder.jp/contests/abc093/tasks/arc094_a

nums = list(map(int,input().split()))
abc= sum(nums)
X = max(nums)


if X%2 != abc%2:
    X + 1
print((3*X - abc)//2)


# 増加させるかず -> 3X - abc
# 操作回数      -> (3X - abc) //2

Submission status: Wrong Answer

Solution code:
A,B,C = map(int,input().split())
ans = 0
x = min(A,B,C)
X = [A-x,B-x,C-x]
X.sort()

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

if X[0] == X[1] and X[0] + 2 == X[2]:
    print(ans + 2)
elif X[0] == X[1] and X[0] + 1 == X[2]:
    print(ans + 1)
else:
    print(ans + 3)

Submission status: Wrong Answer

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

for i in range(a[2]-a[1]):
  a[1] += 1
  a[0] += 1
  
for i in range(10**12):
  a[0] += 2
  count += 1
  if a[0] >= a[1]:
    break

if a[0] == a[1]:
  print(sum + count)
elif a[0] > a[1]:
  print(sum + count + 1)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# hello worldと表示する
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

lis=sorted(LI())
count=0
while lis[0]+2<lis[2]:
    lis[0]+=2
    count+=1
while lis[1]+2<lis[2]:
    lis[1]+=2
    count+=1
#print(count)
#print(lis)
u=lis[0]
for i in range(3):
    lis[i]-=u
#print(lis)
ad=2
if lis==[0,0,0]:
    ad=0
elif lis==[0,0,1]:
    ad=1
elif lis==[0,1,1]:
    ad=2
elif lis==[0,1,2]:
    ad=3
elif lis==[0,0,2]:
    ad=2
elif lis==[0,2,2]:
    ad=1
print(count+ad)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# hello worldと表示する
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

lis=sorted(LI())
count=0
while lis[0]+2<lis[2]:
    lis[0]+=2
    count+=1
while lis[1]+2<lis[2]:
    lis[1]+=2
    count+=1
#print(count)
#print(lis)
u=lis[0]
for i in range(3):
    lis[i]-=u
#print(lis)
ad=1
if lis==[0,0,0]:
    ad=0
elif lis==[0,0,1]:
    ad=1
elif lis==[0,1,1]:
    ad=2
elif lis==[0,1,2]:
    ad=3
elif lis==[0,0,2]:
    ad=2
elif lis==[0,2,2]:
    ad=1
print(count+ad)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# hello worldと表示する
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

lis=sorted(LI())
count=0
while lis[0]+2<lis[2]:
    lis[0]+=2
    count+=1
while lis[1]+2<lis[2]:
    lis[1]+=2
    count+=1
#print(count)
#print(lis)
u=lis[0]
for i in range(3):
    lis[i]-=u
#print(lis)
ad=0
if lis==[0,0,0]:
    ad=0
elif lis==[0,0,1]:
    ad=1
elif lis==[0,1,1]:
    ad=2
elif lis==[0,1,2]:
    ad=3
elif lis==[0,0,2]:
    ad=2
elif lis==[0,2,2]:
    ad=1
print(count+ad)