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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
from collections import defaultdict
from collections import deque
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_pow(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def get_primes(n,type="int"):
    if n==0:
        if type=="int":return []
        else:return [False]
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=""):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
    return ret
def seifu(x):
    return x//abs(x)
######################################################################################################
def main():
    A,B,C=map(int,input().split())
    mmax=max([A,B,C])
    ssum=A+B+C
    n=mmax*3-ssum
    if n%2==0:
        print(mmax)
    else:
        print(mmax+1)
main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
from collections import defaultdict
from collections import deque
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_pow(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def get_primes(n,type="int"):
    if n==0:
        if type=="int":return []
        else:return [False]
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=""):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
    return ret
def seifu(x):
    return x//abs(x)
######################################################################################################
def main():
    A,B,C=map(int,input().split())
    mmax=max([A,B,C])
    ssum=A+B+C
    n=math.ceil((mmax*3-ssum)/2)
    ans=(ssum+n*2)//3
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
from collections import defaultdict
from collections import deque
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_pow(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def get_primes(n,type="int"):
    if n==0:
        if type=="int":return []
        else:return [False]
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=""):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
    return ret
def seifu(x):
    return x//abs(x)
######################################################################################################
def main():
    A,B,C=map(int,input().split())
    mmax=max([A,B,C])
    ssum=A+B+C
    n=math.ceil((ssum-mmax*30)/2)
    ans=(ssum+n*2)//3
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
from collections import defaultdict
from collections import deque
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_pow(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def get_primes(n,type="int"):
    if n==0:
        if type=="int":return []
        else:return [False]
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=""):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
    return ret
def seifu(x):
    return x//abs(x)
######################################################################################################
def main():
    A,B,C=map(int,input().split())
    mmax=max([A,B,C])
    ssum=A+B+C
    n=math.ceil((ssum-mmax*30)/2)
    ans=(ssum+n*2)//3
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    a,b,c=map(int,readline().split())

    li=[a,b,c]
    li.sort()
    x=li[0]
    y=li[1]
    z=li[2]

    cnt=0
    cnt+=z-y
    x+=z-y
    y+=z-y
    print(x,y,z)
    if (z-x)%2==0:
        cnt+=(z-x)//2
    else:
        cnt+=(z-x+1)//2+1

    print(cnt)
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

a,b,c = myinput()
l = [a,b,c]
M = max(l)

if M%2!=0:
    g = M*3
    ans = ( g - sum(l) )//2
else:
    g = (M+1)*3
    ans = ( g - sum(l) )//2
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math

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

Submission status: Wrong Answer

Solution code:
import sys
import math

a, b, c = map(int, input().split())
ma = max(a, max(b, c))
mi1 = min(a,min(b,c))
mi2 = a + b + c - ma - mi1
ans=0
if ((ma - mi2) % 2 == 0 and (ma - mi1) % 2 == 0):
    ans = (ma - mi2) // 2 + (ma - mi1) // 2
elif((mi2-mi1)%2==1):
    tmp=mi2-mi1
    ans = tmp + (ma + tmp) - mi2
elif((mi2-mi1)%2==0):
    tmp = mi2 - mi1
    ans = tmp // 2 + ma - mi2
elif ((ma - mi2) % 2 != 0 and (ma - mi1) % 2 != 0):
    ans=ma-mi1+(mi2-mi1)
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math

if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    A,B,C = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 0
    if [A%2,B%2,C%2] in [[0,0,0],[1,1,1]]:
        pass
    else:
        if A%2+B%2+C%2==0:
            A = math.ceil(A/2)*2
            B = math.ceil(B/2)*2
            C = math.ceil(C/2)*2
        else:
            A = math.floor(A/2)*2+1
            B = math.floor(B/2)*2+1
            C = math.floor(C/2)*2+1
        cnt += 1
    arr = sorted([A,B,C])
    cnt += abs(arr[2]-arr[0])//2
    cnt += abs(arr[2]-arr[1])//2
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math

if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    A,B,C = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 0
    if [A%2,B%2,C%2] in [[0,0,0],[1,1,1]]:
        pass
    else:
        if A%2+B%2+C%2==0:
            A = math.ceil(A/2)*2
            B = math.ceil(B/2)*2
            C = math.ceil(C/2)*2
        else:
            A = math.floor(A/2)*2+1
            B = math.floor(B/2)*2+1
            C = math.floor(C/2)*2+1
        cnt += 1
    arr = sorted([A,B,C])
    cnt += (arr[2]-arr[0])//2
    cnt += (arr[2]-arr[1])//2
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Wrong Answer

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

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

a,b,c = map(int,input().split())
n=160
for i in range(1,51):
    if a == b == c:
        print(0)
        exit()
 
    
    elif sum([a,b,c]) * 3 % 2 ==0:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and((i * 3) % 2 ==0) :
            n = 3 * i
            
    
    elif sum([a,b,c]) * 3 % 2 ==1:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and((i * 3 )% 2 ==1) :
            n = 3 * i
print(int((n-sum([a,b,c]))/2))

Submission status: Wrong Answer

Solution code:

a,b,c = map(int,input().split())
n=160
for i in range(1,51):
    if a == b == c:
        print(0)
        exit()
 
    
    elif sum([a,b,c]) * 3 % 2 ==0:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and((i * 3) % 2 ==0) :
            n = 3 * i
            
    
    elif sum([a,b,c]) * 3 % 2 ==1:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and((i * 3 )% 2 ==1) :
            n = 3 * i
print(int((n-sum([a,b,c]))/2))


print(int(0/2))

Submission status: Wrong Answer

Solution code:


a,b,c = map(int,input().split())
n=160
for i in range(51):
    if a == b == c:
        print(0)
        exit()
 
    
    elif sum([a,b,c]) * 3 % 2 ==0:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and(i * 3 % 2 ==0) :
            n = 3 * i
            
    
    elif sum([a,b,c]) * 3 % 2 ==1:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and(i * 3 % 2 ==1) :
            n = 3 *i
print(int((n-sum([a,b,c]))/2))

Submission status: Wrong Answer

Solution code:

a,b,c = map(int,input().split())
n=160
for i in range(50):
    if a == b == c:
        print(0)
        exit()
 
    
    elif sum([a,b,c]) * 3 % 2 ==0:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and(i * 3 % 2 ==0) :
            n = 3 * i
            
    
    elif sum([a,b,c]) * 3 % 2 ==1:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and(i * 3 % 2 ==1) :
            n = 3 *i
print(int((n-sum([a,b,c]))/2))

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
n=150
for i in range(50):
    if a == b == c:
        print(0)
        exit()
 
    
    elif sum([a,b,c]) * 3 % 2 ==0:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and(i * 3 % 2 ==0) :
            n = 3 * i
            
    
    elif sum([a,b,c]) * 3 % 2 ==1:
        if (max(a,b,c) *3 <= 3 * i)and(3 * i < n)and(i * 3 % 2 ==1) :
            n = 3 *i
print(int((n-sum([a,b,c]))/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l=list(map(int, input().split()))
l.sort()
ans=0

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

elif l[2]%2==0 and l[1]%2==1 and l[0]%2==1:
    l[1]+=1
    l[0]+=1
    ans+=1
    ans+=(l[2]-l[1])//2 +(l[2]-l[0])//2

elif l[2]%2==1 and l[1]%2==0 and l[0]%2==0:
    l[1]+=1
    l[0]+=1
    ans+=1
    ans+=(l[2]-l[1])//2 +(l[2]-l[0])//2

elif l[2]%2==0 and l[1]%2==1 and l[0]%2==0:
    l[2]+=1
    l[0]+=1
    ans+=1
    ans+=(l[2]-l[1])//2 +(l[2]-l[0])//2

elif l[2]%2==1 and l[1]%2==0 and l[0]%2==1:
    l[2]+=1
    l[0]+=1
    ans+=1
    ans+=(l[2]-l[1])//2 +(l[2]-l[0])//2

print(ans)

Submission status: Wrong Answer

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

#print(numbers)
ans = 0
if (numbers[2] - numbers[0])%2 == 0:
    tmp = numbers[2] - numbers[1]
    ans += tmp - 1
    numbers[1] += tmp - 1
    numbers[0] += tmp - 1
    #print(numbers, ans)
    ans += 1
    numbers[0] += 1
    numbers[1] += 1
    #print(numbers, ans)

    tmp = numbers[2] - numbers[0]
    if tmp%2 == 0:
        ans += tmp//2
        numbers[0] += tmp
    else:
        ans += 2
        numbers[0] += 2
        numbers[1] += 1
        numbers[2] += 1
    #print(numbers, ans)
else:
    tmp = numbers[2] - numbers[1]
    ans += tmp
    numbers[1] += tmp
    numbers[0] += tmp
    #print(numbers, ans)
    tmp = numbers[2] - numbers[0]
    if tmp%2 == 0:
        ans += tmp//2
        numbers[0] += tmp
    else:
        ans += tmp//2+1+1
        numbers[0] += tmp+1
        numbers[1] += 1
        numbers[2] += 1
    #print(numbers, ans)
print(ans)

Submission status: Wrong Answer

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

#print(numbers)
ans = 0
if (numbers[2] - numbers[0])%2 == 0:
    tmp = numbers[2] - numbers[1]
    ans += tmp - 1
    numbers[1] += tmp - 1
    numbers[0] += tmp - 1
    #print(numbers, ans)
    ans += 1
    numbers[0] += 1
    numbers[1] += 1
    #print(numbers, ans)

    tmp = numbers[2] - numbers[0]
    if tmp%2 == 0:
        ans += tmp//2
        numbers[0] += tmp
    else:
        ans += 2
        numbers[0] += 2
        numbers[1] += 1
        numbers[2] += 1
    #print(numbers, ans)
else:
    tmp = numbers[2] - numbers[1]
    ans += tmp
    #numbers[1] += tmp
    numbers[0] += tmp
    #print(numbers, ans)
    tmp = numbers[2] - numbers[0]
    if tmp%2 == 0:
        ans += tmp//2
        numbers[0] += tmp
    else:
        ans += 2
        numbers[0] += 2
        numbers[1] += 1
        numbers[2] += 1

print(ans)

Submission status: Wrong Answer

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

#print(numbers)
ans = 0
if (numbers[2] - numbers[0])%2 == 0:
    tmp = numbers[2] - numbers[1]
    ans += tmp - 1
    numbers[1] += tmp - 1
    numbers[0] += tmp - 1
    #print(numbers, ans)
    ans += 1
    numbers[0] += 1
    numbers[1] += 1
    #print(numbers, ans)

    tmp = numbers[2] - numbers[0]
    if tmp%2 == 0:
        ans += tmp//2
        numbers[0] += tmp
    else:
        ans += 2
        numbers[0] += 2
        numbers[1] += 1
        numbers[2] += 1
    #print(numbers, ans)
else:
    tmp = numbers[2] - numbers[1]
    ans += tmp
    #numbers[1] += tmp
    numbers[0] += tmp
    #print(numbers, ans)
    tmp = numbers[2] - numbers[0]
    ans += tmp//2

print(ans)

Submission status: Wrong Answer

Solution code:
lst = list(map(int,input().split()))
lst2 = list(map(lambda x: max(lst) - x, lst))

if lst2[0] % 2 == 0 and lst2[1] % 2 == 0:
    print(sum(lst2) // 2)
elif lst2[0] % 2 != 0 and lst2[1] % 2 != 0:
    _sum = (lst2[0] - 1) + (lst2[1] - 1)
    print(_sum // 2 + 1)
else:
    print((sum(lst2) + 1) // 2 + 1)

Submission status: Wrong Answer

Solution code:
a,b,c = map(int, input().split())
A = [a,b,c]
A.sort()

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    A=list(map(int,input().split()))
    even=[False]*3
    for i in range(3):
        if A[i]%2==0:
            even[i]=True
    cnt=0
    if even.count(True)==2:
        for i in range(3):
            if A[i] % 2 == 0:
                A[i]+=1
        cnt+=1
    elif even.count(True)==1:
        for i in range(3):
            if A[i] % 2 == 0:
                A[i]+=1
        cnt+=1
    ma=max(A)
    for i in range(3):
        cnt+=(ma-A[i])// 2

    print(cnt)
#
resolve()

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:
a,b,c=map(int,input().split())
s=max(a,b,c)
m=3*s-(a+b+c)
if m%2:print(m//2+1)
else:print(m//2)

Submission status: Wrong Answer

Solution code:
import numpy as np

def multi_input():
    return map(int, input().split())

l = np.array(list(multi_input()))
l = np.abs(l - max(l))
l.sort()

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

Submission status: Wrong Answer

Solution code:
import numpy as np
A =np.array(sorted(list(map(int,input().split()))))
a = max(A)
b = a -A

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

Submission status: Wrong Answer

Solution code:
import numpy as np
A =np.array(sorted(list(map(int,input().split()))))
a = max(A)
b = a -A
print(A,a,b)
if abs(b[1]-b[0]) %2 == 0:
    print(sum(b)//2)
else :
    print(sum(b)//2 + 1)

Submission status: Wrong Answer

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

C = sorted(list([a, b, c]))

d1 = C[2] - C[0]
d2 = C[2] - C[1]

if (d2 - d1) % 2 == 0:
    print(d2 + (d1 - d2)//2)
else:
    print(d2 + 2)