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: Accepted

Solution code:
A,B,C=map(int,input().split())
a,b,c = 0,0,0
total = A+B+C
count = 0
while 1:
    a = max(A,B,C)
    c = min(A,B,C)
    b = total - (a+c)
    if a == b and b==c:
        break
    elif a == b and b > c:
        c += 2
    elif a > b and b == c:
        b += 1
        c += 1
    else:
        b += 1
        c += 1
    count += 1
    A = a
    B = b
    C = c
    total = A+B+C
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
M = max(A)
r = sum([M - i for i in A])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = map(int,input().split())
P = [0, 0, 0]
ans = 0

if a % 2 == 1:
    P[0] = 1
if b % 2 == 1:
    P[1] = 1
if c % 2 == 1:
    P[2] = 1

s = P.count(1)

if s == 1:
    ans += 1
    if P[0] == 0:
        a += 1
    if P[1] == 0:
        b += 1
    if P[2] == 0:
        c += 1
elif s == 2:
    ans += 1
    if P[0] == 1:
        a += 1
    if P[1] == 1:
        b += 1
    if P[2] == 1:
        c += 1

ans += (max(a, b, c) - a) // 2
ans += (max(a, b, c) - b) // 2
ans += (max(a, b, c) - c) // 2

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
C - Same Integers
https://beta.atcoder.jp/contests/abc093/tasks/arc094_a

"""
import sys
from sys import stdin
input = stdin.readline


def solve(numbers):
    ans = 0
    while numbers[0] != numbers[1] or numbers[0] != numbers[2]:
        numbers.sort()
        if numbers[0] + 2 <= numbers[2]:
            numbers[0] += 2
            ans += 1
        else:
            numbers[0] += 1
            numbers[1] += 1
            ans += 1
    return ans


def main(args):
    numbers = [int(x) for x in input().split()]
    ans = solve(numbers)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

m = max(A, B, C)
diff = [m - A, m - B, m - C]
s = sum(diff)
if s % 2 == 0:
    print(s // 2)
else:
    print((s + 3) // 2)

Submission status: Accepted

Solution code:
a,b,c = (int(i) for i in input().split())
x,answer = [a,b,c],0
x.sort()
y = x[2]-x[1]
x[0] = x[0]+y
if (x[2]-x[0])%2==0:
	print(y+(x[2]-x[0])//2)
else:
	print(y+(x[2]-x[0]+3)//2)

Submission status: Accepted

Solution code:
f = lambda :[int(i) for i in input().split()]
from sys import stderr
debug = lambda x:stderr.write(repr(x)+'\n')

a,b,c = sorted(f())
ans = 0
while a < b:
    a += 2
    ans += 1
if b < a:
    b += 1
    c += 1
    ans += 1
while b < c:
    a += 1
    b += 1
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Runtime Error

Solution code:
List = list(map(int, input().split()))
List.sort()
res = List[2]-List[1]
Litt[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: Runtime Error

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

Submission status: Runtime Error

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

if (b-a)%2 == 1:
    print(Borys)
else:
    print(Alice)

Submission status: Runtime Error

Solution code:
A,B,C=map(int,input().split())
even += A%2+B%2+C%2
answer = 0
if even == 1:
  answer = 1
  if A%2:
    A += 1
  if B%2:
    B += 1
  if C%2:
    C += 1
elif even == 2:
  answer = 1
  if not A%2:
    A += 1
  if not B%2:
    B += 1
  if not C%2:
    C += 1
D = sorted([A,B,C])
answer += (D[2]-D[0])//2+(D[2]-D[1])//2

Submission status: Runtime Error

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: Runtime Error

Solution code:
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
m1,m2 = y[n//2-1],y[n//2]
for i in x:
    if i<=m1: print(m2)
    else: print(m1)

Submission status: Runtime Error

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

# check
max_num = max(num)
other_num = [n for n in num if n != max_num]
M, N = other_num[0], other_num[1]

M_one, M_two = (max_num - M) % 2, (max_num - M) // 2
N_one, N_two = (max_num - N) % 2, (max_num - N) // 2

if M_one == N_one == 0:
    print(M_two + N_two + M_one)
elif 0 in [M_one, N_one] and abs(M_one - N_one) == 1:
    print(M_two + N_two + M_one + 2)
else:
    print(M_two + N_two + M_one + 1)

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
a.sort()
ans=0
while True:
    if a[0]==a[1]==a[2]:
        print(ans)
        sys.exit()
    if a[0]<a[1]:
        a[0]+=2
        ans+=1
        a.sort()
        if a[0]==a[1]==a[2]:
            print(ans)
            sys.exit()
    if a[0]==a[1]:
        a[0]+=1
        a[1]+=1
        ans+=1
        a.sort()
        if a[0]==a[1]==a[2]:
            print(ans)
            sys.exit()

Submission status: Runtime Error

Solution code:
#include<iostream>
using namespace std;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int d = max({a, b, c}) * 3 - (a + b + c);
    cout << (d % 2 ? d + 3 : d) / 2 << endl;
}

Submission status: Runtime Error

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 + (mx - 2 - md) + 2)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if a[2] != a[1] and a[1] != a[0] and a[2] != a[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)

elif a[2] == a[1] and a[1] != a[0]:
  for i in range(10**4):
    a[0] += 2
    count += 1
    if a[0] >= a[1]:
      break
  
  if a[0] == a[1]:
    print(count)
  elif a[0] > a[1]:
    print(count + 1)
    
elif a[0] == a[1] amd a[1] != a[2]:
  print(a[2]-a[1])
  
elif a[1] == a[2] and a[2] == a[0]:
  print(0)

Submission status: Runtime Error

Solution code:
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int max = 0;
		for(int i = 0;i < 3; ++i){
			int input = Integer.parseInt(scan.next());
			sum += input;
			max = Math.max(max,input);
		}
		int ans = 0;
		while(sum < max*3 || sum%3 != 0){
			sum += 2;
			++ans;
		}
		System.out.print(ans);
	}
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
prev_t = 0
for i in range(n):
    t, x, y=map(int, input().split())
    if (x + y) > (t - prev_t) or (x + y + (t - prev_t)) % 2:
        print("No")
        exit()
    prev_t = t
print("Yes")

Submission status: Runtime Error

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)
lis.sort()
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: Runtime Error

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)
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: Runtime Error

Solution code:
from itertools import product
a,b,c,d=list(input())
for o,p,q in product("-+",repeat=3):
    if eval(a+o+b+p+c+q+d)==7:
        print(a+o+b+p+c+q+d+"=7")
        break

Submission status: Runtime Error

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

p = [i%2 for i in N]

ans = 0

if sum(p) == 0 or sum(p) == 3:
    m = max(N)
    for i in N:
        ans += (m-i)//2
elif sum(p) == 1:
    for i in range(3):
        if N[i]%2 == 0:
            N[i] += 1
    ans += 1
    m = max(N)
    for i in N:
        ans += (m-i)//2
else:
    for i in range(3):
        if N[i]%2 == 1:
            N[i] += 1
    ans += 1
    for i in N:
        ans += (m-i)//2

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
n = []
for i in range(len(a)):
  if a[i] % 2 == 0: n.append(i+1)
if len(n) == 3:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
elif len(n) == 2:
  N = 3 - sum(n) - 1 #奇数のインデックス
  ans = 0
  if a[N] != max(a):
    while a[N] < max(a):
      a[N] += 2
      ans += 
  a.sort()
  ans += (a[1] - a[0]) // 2 + a[2] - a[1]
else:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
print(ans)

Submission status: Runtime Error

Solution code:
A = []
A = list(map(int, input().split()))
s,m,l = A.sort()
count = 0
difs = l-s
difm = l-m
count += difs//2 + difm//2
if difs%2 == 0 and difm%2 == 0:
  print(count)
elif difs%2 == 0 and difm%2 == 1:
  count += 2
  print(count)
else:
  count += 1
  print(count)

Submission status: Runtime Error

Solution code:
A = []
A = list(map(int, input().split()))
s = A.sort()[0]
m = A.sort()[1]
l = A.sort()[2]
count = 0
difs = l-s
difm = l-m
count += difs//2 + difm//2
if difs%2 == 0 and difm%2 == 0:
  print(count)
elif difs%2 == 0 and difm%2 == 1:
  count += 2
  print(count)
else:
  count += 1
  print(count)

Submission status: Runtime Error

Solution code:
A = []
A = list(map(int, input().split()))
s = A.sort()[0]
m = A.sort()[1]
l = A.sort()[2]
count = 0
difs = l-s
difm = l-m
count += difs//2 + difm//2
if difs%2 == 0 and difm%2 == 0:
  print(count)
elif difs%2 == 0 and difm%2 = 1:
  count += 2
  print(count)
else:
  count += 1
  print(count)

Submission status: Runtime Error

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

d = C - B
A += d
B += d


if (B - A) % 2 == 0:
    ans = d + (B - A) // 2
else:
    ans = d + (B - A + 1) // 2 + 1
print(ans)

Submission status: Runtime Error

Solution code:
2 6 3

Submission status: Runtime Error

Solution code:
input()
print(sum(map(lambda x: bin(int(x))[::-1].find("1"), input().split())))

Submission status: Runtime Error

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

a,b,c = map(int,input().split())
li = [a,b,c]
li.sort()
cnt = 0
while a[2] != a[1]:
    a[0] += 1
    a[1] += 1
    cnt+=1
cnt += (a[1]-a[0])//2
if (a[1]-a[2])%2 != 0:
    cnt += 2
print(cnt)

Submission status: Runtime Error

Solution code:
a=[0,0,0]
a[0],a[1],a[2]=map(int,input().split())
a=sorted(a)
sa1=a[2]-a[0]
sa2=a[2]-a[1]
if (a[0]%2==a[1]%2==a[2]%2):
  print(sa1//2 + sa2//2)
else:
  if (sa1%2==0 and sa2%2==1):
    print((sa1//2)+1 + (sa2+1)//2)
  elif (sa1%2==1 and sa2%2==0):
    print(((sa1+1)//2) (sa2//2)+1)
  else:
    print((sa2-sa1)//2+sa1)

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc093/tasks/arc094_a
a, b, c = map(int, input().split())

nums = [a, b, c]
nums.sort()

ans = 0
if (nums[1] - nums[0]) % 2 == 1:
    # 小さい2つの差が奇数の場合、偶数になるように
    # 小さい2つの数字両方にならないように、1を足す。
    # ここでは、二番目に大きいのと、最大の数に1を足す。
    nums[1] += 1
    nums[2] += 1
    ans += 1
ans += (nums[1] - nums[0]) // 2　# 一番小さい数が、二番目に大きい数に追いつくようにする。それには2ずつ足すのが良い。
ans += (nums[2] - nums[1]) # 一番目も二番目も同じかずになったので、両方に１つづ足していき、最大の数と同じになる様にする。
print(ans)

Submission status: Runtime Error

Solution code:
abc_list = list(map(int, input().split()))
max_val = 0
for i in abc_list:
    if(max_val < i):
        max_val = i

diff_1 = None
diff_2 = None

for i in abc_list:
    diff = max_val - i
    if diff and (not diff_1):
        diff_1 = diff
    elif diff and (not diff_2):
        diff_2 = diff

result = min(diff_1, diff_2)

diff_val = max(diff_1, diff_2) - min(diff_1, diff_2)

if (diff_val % 2) == 1:
    result += ((diff_val - 1) / 2) + 2
else:
    result += diff_val

print(result)

Submission status: Runtime Error

Solution code:
A=lsit(map(int,input().split()))
ans=int(0)
m=max(A)
for i in range(3):
    now=int((m-A[i])/2)
    ans+=now
    A[i]+=2*now

check=int(0)
for i in range(3):
    check+=m-A[i]
if check==0:
    print(ans)
elif check==2:
    print(ans+1)
else:
    print(ans+2)

Submission status: Runtime Error

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

abc.sort()
ans = 0

while True:
    if abc[0] == abc[1] and abc[1] == abc[2]:
        print(ans)
        break

    if abc[1] != abc[2]:
        abs[0] += 1
        abc[1] += 1
        ans += 1
    elif abc[1] == abc[2] and abc[1] + 1 == abc[0]:
        abc[1] += 1
        abc[2] += 1
        ans += 1
    else:
        abc[0] += 2
        ans += 1

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if a%2==b%2 and b%2==c%2 and a%2==c%2:
    m=max(a,b,c)
    count=(m-a)//2+(m-b)//2+(m-c)//2
else:
    count=(m-a)//2+(m-b)//2+(m-c)//2+1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
num=list(map(int,input().split()))
odd_num=[]
even_num=[]
count=0
for i in num:
    if i%2!=0:
        count+=1
        odd_num+=[i]
    else:
        even_num+=[i]

if count==1:
    if max(odd_num)>max(even_num):
        ans=abs(even_num[0]-even_num[1])//2+ood_num[0]-max(even_num)
        print(ans)
    else:
        ans=abs(even_num[0]-even_num[1])//2+1+(max(even_num)+1-odd_num[0])//2
        print(ans)
elif count==2:
    if max(odd_num)>max(even_num):
        ans=even_num[0]-max(odd_num)+abs(odd_num[0]-odd_num[1])//2
        print(ans)
    else:
        ans=abs(odd_num[0]-odd_num[1])//2+even_num-max(odd_num)
        print(ans)
else:
    if count==3:
        ans=(3*max(odd_num)-sum(odd_num))//2
        print(ans)
    else:
        ans=(3*max(even_num)-sum(even_num))//2
        print(ans)

Submission status: Runtime Error

Solution code:
Bottom = min(A,B,C)
Middle = A+B+C - Top - Bottom
if (Middle - Bottom)%2 != 0:
  Top += 1
  Bottom += 1
  Answer = (Top -Middle) + (Middle - Bottom)//2 +1
else:
  Answer = (Top - Middle) + (Middle - Bottom)//2
print(Answer)

Submission status: Runtime Error

Solution code:
A, B, C = sorted([int(x) for x in input().split()])
if A == B and B == C:
    print(0)
    exit()

ret = 0
while True:
    if A < B and B < C:
        A += 1
        B += 1
    elif A < B and B == C:
        A += 2
    elif A > B and B == C:
        B += 1
        C += 1
    else:
        # 想定外
        exit(1)

    ret += 1
    if A == B and B == C:
        print(ret)
        exit()

Submission status: Runtime Error

Solution code:
A, B, C = sorted([int(x) for x in input().split()])
ret = 0
while True:
    if A < B and B < C:
        A += 1
        B += 1
    elif A < B and B == C:
        A += 2
    elif A > B and B == C:
        B += 1
        C += 1
    else:
        # 想定外
        exit(1)

    ret += 1
    if A == B and B == C:
        print(ret)
        exit()

Submission status: Runtime Error

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

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

print(n//2 + l + count)

Submission status: Runtime Error

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

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

print(n//2 + l + count)

Submission status: Runtime Error

Solution code:
from sys import stdin

if __name__ == "__main__":
  l = [int(i) for i in stdin.readline().split(' ')]
  sort(l)
  if l[0]%2 == l[1]%2:
    ex = 2
  else:
    ex = 0
  print((l[-1]*2 - (l[0] + l[1]))/2 + ex)

Submission status: Runtime Error

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

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: Runtime Error

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

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
    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: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

//昇順
int asc(const void* a, const void* b){
    return *(int*)a-*(int*)b;
}

int main(void){
    //A[0]~A[N-1]に格納する
    int* A;
    NEW(A,3);
    for(int i=0;i<3;i++){
        scanf("%d",&A[i]);
    }
    qsort(A,3,sizeof(int),asc);

    int ans=(A[2]-A[1])+(A[1]-A[0])/2+((A[1]-A[0])%2)*2;
    printf("%d\n",ans);

    return 0;
}

Submission status: Runtime Error

Solution code:
A,B,K = map(int,input().split())
if abs(B-A) < K:
    for i in range(A,B+1):
        print(i)
    exit()
min_list = list(range(A,A+K))
max_list = list(range(B-K+1,B+1))
lists = list(set(min_list) | set(max_list))
lists.sort()
for i in range(lists):
    print(lists[i])

Submission status: Runtime Error

Solution code:
A,B,C = map(int,input().split())
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    #midだけ偶奇が違うとき
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        if mid - maxi != 1:
            ans += (maxi+1-mid)//2
            mid = maxi + 1
    #miniだけ偶奇が違うとき
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        if mini - maxi != 1:
            ans += (maxi+1-mini)//2
            mini = maxi + 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print(i+j+k+l)
else:
    print(i+j+k+l+1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
ans=0
ma=max(a,b,c)
mi=min(a,b,c)
mj=a+b+c-ma-mi
ans+=(ma-mi)//2
mi+==((ma-mi)//2)*2
ans+=(ma-mj)//2
mj+=((ma-mj)//2)*2
if ma==mi==mj:
    print(ans)
elif ma==mi+1 and ma==mj+1:
    print(ans+1)
else:
    print(ans+2)

Submission status: Runtime Error

Solution code:
A,B,C =[int(x) for x in input().split()]
d = max(A,B,C)
l = [d-A,d-B,d-C]
su = sum(l)
if l%2==0:
  print(l%2)
else:
  print(1+(l+1)//2)

Submission status: Runtime Error

Solution code:
#https://atcoder.jp/contests/abc093/tasks/arc094_a

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

diff = 3*max(a, b, c) - (a + b + c)

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

Submission status: Runtime Error

Solution code:
def resolve():
    a,b,c=sorted(list(map(int,input().split())))
    ans=c-b
    a+=c-b
    b=c
    if (c-a)%2==0: print(ans+(c-a)//2)
    else: print(ans+2+(c-a)//2)
resolve(

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
ary = list(map(int,input().split()))
parity = 0
count = 0
#最初から同じだった時
if ary[0] == ary[1] == ary[3]:
    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: Runtime Error

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

abc.sort()

def func(a,b,c):
    return int((c-a)/2+(c-b)/2)


if abc[0]%2==abc[1]%2:
    if abc[0]%2!=abc[2]%2:
        print(func(abc[0]+1,abc[1]+1,abc[2])+1)
    else:
        print(func(abc[0],abc[1],abc[2]))
else:
    if abc[0]%2==abc[2]%2:
        print(func(abc[0]+1,abc[1],abc[2]+1)+1)
    else:
        print(func(abc[0],abc[1]+1,abc[2+1])+1)

Submission status: Runtime Error

Solution code:
A,B,C=map(int,input().split())
total=abs(max(A,B,C)-A)+abs(max(A,B,C)-B)+abs(max(A,B,C)-C)

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

Submission status: Runtime Error

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

elif c == b:
    A += 1
    C += 1
    d = sorted([A,B,C])
    ans += 1
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2

print(ans)

Submission status: Runtime Error

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():
    a, b, c = LI()
    a, b, c = [a, b, c].sort()
    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: Runtime Error

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: Runtime Error

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.pop(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))
print(cnt)

Submission status: Runtime Error

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

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