Problem:


Score : 300 points

Problem Statement

Takahashi, Aoki and Snuke love cookies. They have A, B and C cookies, respectively. Now, they will exchange those cookies by repeating the action below:

Each person simultaneously divides his cookies in half and gives one half to each of the other two persons.

This action will be repeated until there is a person with odd number of cookies in hand.

How many times will they repeat this action?
Note that the answer may not be finite.

Constraints

1 ≤ A,B,C ≤ 10^9

Input

Input is given from Standard Input in the following format:

A B C

Output

Print the number of times the action will be performed by the three people, if this number is finite.
If it is infinite, print -1 instead.

Sample Input 1

4 12 20

Sample Output 1

3

Initially, Takahashi, Aoki and Snuke have 4, 12 and 20 cookies. Then,

After the first action, they have 16, 12 and 8.

After the second action, they have 10, 12 and 14.

After the third action, they have 13, 12 and 11.

Now, Takahashi and Snuke have odd number of cookies, and therefore the answer is 3.

Sample Input 2

14 14 14

Sample Output 2

-1

Sample Input 3

454 414 444

Sample Output 3

1



Sample input:
4 12 20


Sample output:
3

Submission status: Accepted

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

if A == B == C and not A == 1:
    print(-1)
    sys.exit()

while True:
    if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        t_A, t_B, t_C = A, B, C
        A = (t_B + t_C) // 2
        B = (t_C + t_A) // 2
        C = (t_A + t_B) // 2
        ans += 1
    else:
        print(ans)
        break

Submission status: Accepted

Solution code:
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


a, b, c = LI()
if a == b == c:
    if a % 2:
        print(0)
    else:
        print(-1)
else:
    ans = 0
    while True:
        if a % 2 or b % 2 or c % 2:
            break
        a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2
        ans += 1
    print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


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

    for i in range(1000):
        if A % 2 or B % 2 or C % 2:
            print(i)
            return

        a = (B + C) // 2
        b = (A + C) // 2
        c = (A + B) // 2
        A = a
        B = b
        C = c

    print(-1)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import copy
a,b,c = map(int,input().split())
cnt = 0
if (a % 2 == 1) or (b % 2 == 1) or (c % 2 == 1):
    print(0)
    exit()
while 1:
    cnt += 1 
    next_a = b // 2 +  c // 2
    next_b = a // 2 + c // 2
    next_c = a // 2 + b // 2
    if a == next_a and b == next_b and c == next_c:
        print(-1)
        break
    elif (next_a % 2 == 1) or (next_b % 2 == 1) or (next_c % 2 == 1):
        print(cnt)
        break
    a = copy.deepcopy(next_a)
    b = copy.deepcopy(next_b)
    c = copy.deepcopy(next_c)

Submission status: Accepted

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

for i in range(c):
    if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
        if a == b and b == c:
            break
        ans += 1
        x = b / 2 + c / 2
        y = a / 2 + c / 2
        z = b / 2 + a / 2
        a = x
        b = y
        c = z

    else:
        p = 1
        print(ans)
        break



if p == 0:
    print(-1)

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def f(x):
    res = 0
    while(x%2==0):
        res += 1
        x //= 2
    return res
def main():
    A,B,C=MI()
    if(A==B==C):
        if(A&1):
            print(0)
        else:
            print(-1)
    else:
        L=[f(A+B),f(B+C),f(C+A)]
        print(min(L))
        

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
if a == b == c and a % 2 == 0:
    print(-1)
else:
    cnt = 0
    while True:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            break
        _a = (b+c)//2
        _b = (c+a)//2
        _c = (a+b)//2
        a = _a
        b = _b
        c = _c
        cnt += 1
    print(cnt)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
if a == b == c and a%2 == 0:
    print(-1)
    exit()
for i in range(10**8):
    if a%2 != 0 or b%2 != 0 or c%2 != 0:
        break
    a_o,b_o,c_o = a,b,c
    a = b_o//2 + c_o//2
    b = a_o//2 + c_o//2
    c = a_o//2 + b_o//2
print(i)

Submission status: Accepted

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


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


def readint():
    return int(input())


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


def readstrs():
    return input().split()


def main():
    A, B, C = readnums()
    if A == B and B == C:
        if A == 1:
            print(0)
        else:
            print(-1)
    else:
        ans = 0
        while all([not A % 2, not B % 2, not C % 2]):
            A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
            ans += 1

        print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

if A==B==C and A%2==0:
  print(-1)
else:
  ans = 0
  while 1:
    if A%2==1 or B%2==1 or C%2 ==1:
      print(ans)
      break
    tempA = A//2
    tempB = B//2
    A = tempB + C//2
    B = tempA + C//2
    C = tempA + tempB
    ans+=1

Submission status: Accepted

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

if any(map(lambda x: x % 2 == 1, (A, B, C))):
    print(0)
elif A == B == C:
    print(-1)
else:
    count = 0
    while True:
        A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
        count += 1
        if any(map(lambda x: x % 2 == 1, (A, B, C))):
            break
    print(count)

Submission status: Accepted

Solution code:
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


a, b, c = invr()
res = 0

while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    if a == b == c:
        res = -1
        break
    ra = a/2
    rb = b/2
    rc = c/2

    a = ra + rc
    b = rb + ra
    c = rc + rb
    res += 1
print(res)

Submission status: Accepted

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

if a%2 == 1 or b%2 == 1 or c%2==1:
    print(0)
elif a==b and b==c and c==a:
    print(-1)
else:
    for i in range(10**9):
        ans = i
        if a % 2 == 1:
            break
        else:
            tmpa = b/2 + c/2
        if b % 2 == 1:
            break
        else:
            tmpb = c/2 + a/2
        if c % 2 == 1:
            break
        else:
            tmpc = a/2 + b/2
        a = tmpa
        b = tmpb
        c = tmpc
    print(ans)

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
cou = 0
if(A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
  print("0")
  exit()
while(cou < 10**6):
  cou += 1
  a = A
  b = B
  c = C
  A = b/2 + c/2
  B = a/2 + c/2
  C = a/2 + b/2
  if(A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
    print(str(cou))
    exit()
  else:
    pass
print("-1")

Submission status: Accepted

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

a0, b0, c0 = a, b, c
a1, b1, c1 = 0, 0, 0

cnt = 0
while True:
    if a0%2==1 or b0%2==1 or c0%2==1:
        print(cnt)
        exit()

    a1 = b0//2 + c0//2
    b1 = a0//2 + c0//2
    c1 = a0//2 + c0//2

    a0 = a1
    b0 = b1
    c0 = c1

    cnt += 1

    if a1 == a and b1 == b and c1 == c:
        print(-1)
        exit()

Submission status: Accepted

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

	while even_flag:
		if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
			even_flag = False
			break

		elif A == B and B == C and A == C:
			break

		A, B, C = (B // 2 + C // 2), (A // 2 + C // 2), (A // 2 + B // 2)
		count += 1

	if even_flag:
		print(-1)
	else:
		print(count)
		
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
import math
from collections import deque
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

a,b,c = readInts()
ans=0

if a==b and b==c and a%2==0:
	print(-1)
	exit()

while not a%2+b%2+c%2:
	ta = a
	tb = b
	tc = c
	a = (b+c)//2
	b = (ta+tc)//2
	c = (ta+tb)//2
	#print(a,b,c)
	ans+=1

print(ans)

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
ans = 0
while(a%2==0 and b%2==0 and c%2==0):
    if(a==b and b==c and c==a):
        ans = -1
        break
    else:
        a1 = b+c
        b1 = a+c
        c1 = b+a
        a = a1/2
        b = b1/2
        c = c1/2
        ans+=1
    
print(ans)

Submission status: Accepted

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

if a%2 == 1 or b%2 == 1 or c%2 == 1:
    print(0)
    sys.exit()
if a==b==c:
    print(-1)
    sys.exit()

C = 1
while 1:
    a, b, c = b//2 + c//2 , a//2 + c//2 , b//2 + a//2
    if a%2 == 1 or b%2 == 1 or c%2 == 1:
        print(C)
        sys.exit()
    else:
        C += 1

Submission status: Accepted

Solution code:
A, B, C = [int(i) for i in input().split()]
ans = 0
a, b, c = A, B, C
while(a % 2 == 0 and b % 2 == 0 and c % 2 == 0):
    ans += 1
    ha = int(a / 2)
    hb = int(b / 2)
    hc = int(c / 2)
    a = hb + hc
    b = hc + ha
    c = ha + hb
    if a == A and b == B and c == C:
        ans = -1
        break
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    a,b,c=map(int,input().split())
    cunt=0
    if a==b and b==c and a%2==0:
        print(-1)
        sys.exit()
    while True:
        if a%2 or b%2 or c%2:
            print(cunt)
            break
        cunt+=1
        a1,b1,c1=a,b,c
        a=(b1+c1)//2
        b=(a1+c1)//2
        c=(a1+b1)//2

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split(" "))
pr=True
count=0
while(a%2==0 and b%2==0 and c%2==0):
    ta,tb,tc=a,b,c
    a=tb/2+tc/2
    b=ta/2+tc/2
    c=ta/2+tb/2
    count += 1
    if ta == a and tb == b and tc == c:
        print(-1)
        pr=False
        break
if pr:
    print(count)

Submission status: Accepted

Solution code:
def solve():
    A, B, C = map(int, input().split())
    if A == B == C and A % 2 == 0:
        return -1

    cnt = 0
    while True:
        if A % 2 or B % 2 or C % 2:
            return cnt
        A, B, C = (B + C) // 2, (C + A) // 2, (A + B) // 2
        cnt += 1


print(solve())

Submission status: Accepted

Solution code:
def solve():
    A, B, C = map(int, input().split())
    if A == B == C and A % 2 == 0:
        return -1

    cnt = 0
    while True:
        if A % 2 or B % 2 or C % 2:
            return cnt
        A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
        cnt += 1


print(solve())

Submission status: Accepted

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

    cnt = 0
    while True:
        if A % 2 or B % 2 or C % 2:
            return cnt
        ta = B // 2 + C // 2
        tb = A // 2 + C // 2
        tc = A // 2 + B // 2
        if ta == A and tb == B and tc == C:
            return -1
        A, B, C = ta, tb, tc
        cnt += 1


print(solve())

Submission status: Accepted

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

if A%2==1 or B%2==1 or C%2==1:
  print(0)
elif A==B and B==C:
  print(-1)
else:
  count = 0
  while True:
    if A%2==1 or B%2==1 or C%2==1:
      break
    count+=1
    A_tmp = B/2 + C/2
    B_tmp = A/2 + C/2
    C = A/2 + B/2
    A = A_tmp
    B = B_tmp
  print(count)

Submission status: Accepted

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

count = 0
while all([a % 2 == 0, b % 2 == 0, c % 2 == 0]):
    if a == b and b == c:
        print(-1)
        exit()
    a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
    count += 1

print(count)

Submission status: Accepted

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

count = 0
while True:
    if a == b == c and a%2 == 0:
        count = -1
        break

    if a%2 == 0 and b%2 == 0 and c%2 == 0:
        count += 1
        a, b, c = (b + c)//2, (a + c)//2, (a + b)//2
    else:
        break

print(count)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
cnt = 0
while True:
    if a == b == c and a%2 == 0:
        cnt = -1
        break
    elif a%2 != 0 or b%2 != 0 or c%2 != 0:
        break
    elif a%2 == 0 and b%2 == 0 and c%2 == 0:
        a, b, c, = (b+c)//2, (a+c)//2, (a+b)//2
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [list(map(int, input().split()))]
i = 0
while (1):
    a, b, c = map(int,l[i])
    if (a % 2 == 1 or b % 2 == 1 or c % 2 == 1):
        print(i)
        break
    t = [b / 2 + c / 2, c / 2 + a / 2, a / 2 + b / 2]
    if (t in l):
        print(-1)
        break
    l.append(t)
    i+=1

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
if a==b==c and a%2==0:
    print(-1)
    exit()
cnt=0
while a%2 == 0 and b%2 == 0 and c%2 == 0:
    a,b,c = (b+c)//2,(a+c)//2,(a+b)//2
    cnt+=1
    
print(cnt)

Submission status: Accepted

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

count = 0

while True:
    if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        if A == B == C:
            print(-1)
            break

        a = B / 2 + C / 2
        b = A / 2 + C / 2
        c = A / 2 + B / 2
        A = a
        B = b
        C = c
        count += 1
    else:
        print(count)
        break

Submission status: Accepted

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

ans = 0

while A%2 == B%2 == C%2 == 0:
  ans += 1
  A = A // 2
  B = B // 2
  C = C // 2
  #print(A,B,C)
  if A == B == C:
    ans = -1
    break
  elif A%2 == 1 or B%2 == 1 or C%2 == 1:
    a = A
    b = B
    A = B + C
    B = C + a
    C = a + b

print(ans)

Submission status: Accepted

Solution code:
A, B, C = (int(x) for x in input().split())

count = 0
S = 0
T = 0
U = 0

if(A == B == C) and (A % 2 == 0 and B % 2 == 0 and C % 2 == 0) :
  print("-1")
  
else:
  while(A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
    count+= 1
    S = 1/2 * A
    T = 1/2 * B
    U = 1/2 * C
    A = T + U 
    B = S + T 
    C = S + U 
  print(count)

Submission status: Accepted

Solution code:
def func(A, B, C):
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        return 0
    if A == B and B == C:
        return -1
    return func((B+C)//2, (C+A)//2, (A+B)//2) + 1


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

ans = func(A, B, C)

print(ans)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ta,ao,su=a,b,c
cnt=0
f=True
while f:
	if ta%2!=0 or ao%2!=0 or su%2!=0:
		f=False
	elif ta==ao==su:
		f=False
		cnt=-1
	else:
		ta=(b+c)/2
		ao=(a+c)/2
		su=(a+b)/2
		cnt+=1
		a=ta
		b=ao
		c=su
print(cnt)

Submission status: Accepted

Solution code:
# A - Cookie Exchanges

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

if A==B and B==C and C%2==0:
    ans = -1
else:
    while A%2==B%2==C%2==0:
        ans += 1
        A, B, C = (B+C)/2, (C+A)/2, (A+B)/2

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

if A == B == C and A % 2 == 0:
    print(-1)
    exit()

res = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
    res += 1

print(res)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
if a == b and b == c:
  if a%2 == 0:
    print(-1)
  else:
    print(0)
else:
  ans = 0
  while a % 2 == 0 and b % 2 == 0 and c % 2 ==0:
    a1 = a
    b1 = b
    c1 = c
    a = (b1+c1)/2
    b = (a1+c1)/2
    c = (a1+b1)/2
    ans += 1
  print(ans)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
if A == B == C and A % 2 == 0:
  print(-1)
else:
  count = 0
  while 0 == A % 2 == B % 2 == C % 2:
    _A = (B + C) // 2
    _B = (C + A) // 2
    _C = (A + B) // 2
    A = _A
    B = _B
    C = _C
    count += 1
    # print("A: {}, B: {}, C: {}".format(A, B, C))
  print(count)

Submission status: Accepted

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())
    cnt=0
    while not(a==b and b==c) and a%2==0 and b%2==0 and c%2==0:
        a,b,c=(b+c)//2,(a+c)//2,(a+b)//2
        cnt+=1
    if a==b and b==c and a%2==0 and b%2==0 and c%2==0:
        print(-1)
    else:
        print(cnt)
main()

Submission status: Accepted

Solution code:
A,B,C = [int(hoge) for hoge in input().split()]
cnt = 0
while not (A%2 or B%2 or C%2):
    NewA = B//2 + C//2
    NewB = A//2 + C//2
    NewC = A//2 + B//2
    A,B,C = NewA,NewB,NewC
    cnt += 1
    if A==B==C:
        print(-1);exit()
print(cnt)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

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

cnt = 0
memo = defaultdict(int)

while (A % 2 != 1) & (C % 2 != 1) & (C % 2 != 1):
    if memo[(A, B, C)]==1:
        print(-1)
        sys.exit()
    tmp_a = A // 2
    tmp_b = B // 2
    tmp_c = C // 2
    memo[(A, B, C)] = 1
    A = tmp_b + tmp_c
    B = tmp_c + tmp_a
    C = tmp_a + tmp_b
    cnt += 1

print(cnt)

Submission status: Accepted

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

if a==b==c and(a%2==0 and b%2==0 and c%2==0):
    print(-1)
else:      
    while True:
        a1=a//2
        b1=b//2
        c1=c//2
        if (a%2==0 and b%2==0 and c%2==0):
            count+=1
            a=b1+c1
            b=a1+c1
            c=a1+b1
        else:
            print(count)
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

def che(a,b,c):
    if a%2:
        return 1
    elif b%2:
        return 1
    elif c%2:
        return 1
    else:
        return 0

a,b,c = map(int,input().split())
if(che(a,b,c)):
    print(0)
elif ((a == b)and(a == c)):
    print(-1)
else:
    while True:
        neko = neko + 1
        nya = a / 2
        nuko = b / 2
        a = c/2 + nuko
        b = c/2 + nya
        c = nuko + nya

        if a%2:
            break
        if b%2:
            break
        if c%2:
            break
    print(neko)

Submission status: Accepted

Solution code:
A, B, C = map(int,input().split())
ans = 0
while True:
  if A & 1 or B & 1 or C & 1: break 
  elif A == B and B == C:
    ans = -1
    break  
  else: 
    ans += 1
    A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
print(ans)

Submission status: Accepted

Solution code:
A,B,C=list(map(int,input().split()))
if A == B == C:
    if A%2==1 or B%2==1 or C%2==1:
        print(0)
        exit()
    else:
        print(-1)
        exit()
for i in range(10**9):
    if A%2==1 or B%2==1 or C%2==1:
        print(i)
        exit()
    A,B,C=(B+C)//2,(A+C)//2,(A+B)//2

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

#なお、任意の整数 M に対して M の −2 進数表現が一意に定まることが証明できます。
#2桁ごとに見るとよかった（もう実験したよ）
def resolve():
    A=list(pin())
    ans=0
    for i in range(10**6):
        #print(A)
        B=[0]*3
        for a in range(3):
            if A[a]%2!=0:print(ans);return
        B[0]=(A[1]+A[2])//2
        B[1]=(A[0]+A[2])//2
        B[2]=(A[0]+A[1])//2
        A=B[:]
        ans+=1
    print(-1)
    
                
    
#%%submit!
resolve()

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

A,B,C = II()


if A==B==C and A % 2 != 1:
  print(-1)
  exit()
cnt = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  A_half = A/2
  B_half = B/2
  C_half = C/2
  A = B_half + C_half
  B = A_half + C_half
  C = A_half + B_half
  cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
x, y = abs(A-B), abs(B-C)
ans = 0
if x == 0 and y == 0 and A % 2 == 0:
  print(-1)
  exit()

if x == 0 and y == 0 and A % 2 == 1:
  print(0)
  exit()
  
while x % 2 == 0 and y % 2 == 0:
  x, y = x // 2, y // 2
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
count = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    if a == b and b == c and c == a:
        count = -1
        break
    a_tmp = a
    b_tmp = b
    c_tmp = c
    a = (b_tmp + c_tmp) / 2
    b = (c_tmp + a_tmp) / 2
    c = (a_tmp + b_tmp) / 2
    count += 1
print(count)

Submission status: Accepted

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

def F(A,B,C):
    if any(x&1 for x in [A,B,C]):
        return 0
    if A == B == C:
        return -1
    return 1 + F((A+B)//2,(B+C)//2,(C+A)//2)

answer = F(A,B,C)
print(answer)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
cnt = 0
while True:
  if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
    break
  if a == b == c:
    cnt = -1
    break
  k, l, m = a//2, b//2, c//2
  a = l + m
  b = k + m
  c = k + l
  cnt += 1
print(cnt)

Submission status: Accepted

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

test = [[a,b,c]]
count = 0
while a%2 == b%2 == c%2 == 0:
    at = a
    bt = b
    ct = c
    a = bt//2 + ct//2
    b = ct//2 + at//2
    c = at//2 + bt//2
    count+=1
    if [a,b,c] in test:
        count = -1
        print(count)
        break
    else:
        test.append([a,b,c])
if count != -1:
    print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
a1=a.copy()
count=0
if a[0]%2==1 or a[1]%2==1 or a[2]%2==1:
    print(count)
elif a[0]==a[1]==a[2]:
    print(-1)
else:
    while True:
        a[0]=(a1[1]+a1[2])//2
        a[1]=(a1[0]+a1[2])//2
        a[2]=(a1[0]+a1[1])//2
        a1=a.copy()
        count+=1
        if a[0]%2==1 or a[1]%2==1 or a[2]%2==1:
            print(count)
            exit()

Submission status: Accepted

Solution code:
def main():
    A,B,C=map(int,input().split())
    ans=0
    tmp=set()
    while A%2==0 and B%2==0 and C%2==0:
        A,B,C=(B+C)//2,(C+A)//2,(A+B)//2
        if (A,B,C) in tmp:
            print(-1)
            exit()
        else:
            tmp.add((A,B,C))
        ans += 1
    print(ans)

main()