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:
i = 0

def cookie(a, b, c):
    global i
    if a == b and b == c:
        return -1
    elif a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        i += 1
        cookie((b+c)//2, (a+c)//2, (a+b)//2)
        return i

A, B, C = map(int, input().split())
if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
    print(0)
else:
    print(cookie(A, B, C))

Submission status: Accepted

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

flag = 0
ans = 0

if a == b == c and a%2 == 0:
  ans = -1

else:
  while flag == 0:
    if a%2 == 0 and b%2 == 0 and c%2 == 0:
      a_tmp = (b+c)/2
      b_tmp = (a+c)/2
      c_tmp = (a+b)/2
      
      a = a_tmp
      b = b_tmp
      c = c_tmp
      
      ans += 1
      
    else:
      flag = 1

print(ans)

Submission status: Accepted

Solution code:
# agc014_a.py]
A, B, C = map(int,input().split())
cnt = 0
inf = 10**2
for i in range(inf):
    if A%2==0 and B%2==0 and C%2==0: 
        a = (B+C)//2
        b = (A+C)//2
        c = (B+A)//2
        A = a
        B = b
        C = c
        cnt += 1
    else:
        break
if cnt == inf:
    cnt = -1
print(cnt)

Submission status: Accepted

Solution code:
# agc014_a.py]
A, B, C = map(int,input().split())
cnt = 0
inf = 10**6
for i in range(inf):
    if A%2==0 and B%2==0 and C%2==0: 
        a = (B+C)//2
        b = (A+C)//2
        c = (B+A)//2
        A = a
        B = b
        C = c
        cnt += 1
    else:
        break
if cnt == inf:
    cnt = -1
print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a, b, c = map(int, input().split())
if True:
    cnt = 0
    while True:
        if a % 2 or b % 2 or c % 2:
            break
        if cnt > 10 ** 3:
            break
        cnt += 1
        a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
    if cnt < 10 ** 3:
        print(cnt)
    else:
        print(-1)

Submission status: Accepted

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def main():
    A, B, C = map(int, input().split())
    ret = 0
    while True:
        if A%2!=0 or B%2!=0 or C%2!=0:
            break
        elif A==B and B==C:
            ret = -1
            break
        else:
            A, B, C = (B+C)//2, (C+A)//2, (A+B)//2
            ret += 1
    print(ret)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

ListA = [A]*10000
ListB = [B]*10000
ListC = [C]*10000

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

for i in range (1, 10000):
	ListA[i]= ListB[i-1]/2+ListC[i-1]/2
	ListB[i]= ListA[i-1]/2+ListC[i-1]/2
	ListC[i]= ListA[i-1]/2+ListB[i-1]/2
	if ListA[i]%2==1 or ListB[i]%2==1 or ListC[i]%2==1:
			print(i)
			exit()

print(-1)

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 = (int(x) for x in input().split())
if any([a%2==1, b%2==1, c%2==1]) == True:
  print(0)
else:
  if len(set({a, b, c})) == 1:
    print(-1)
  else:
    res = 0
    while all([a%2==0, b%2==0, c%2==0]):
      a, b, c = (b + c)//2, (c + a)//2, (a + b)//2
      res += 1
    print(res)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
num=0
while (a%2==0 and b%2==0 and c%2==0):
  a,b,c=(b//2+c//2),(a//2+c//2),(a//2+b//2)
  num+=1
  if (num>10**7):
    print(-1)
    break
else:
  print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
cnt=0
memo=[]
while True:
    tmp = (A,B,C)
    if (A%2==0 and B%2==0 and C%2==0):
        if tmp not in memo:
            memo.append(tmp)
            cnt+=1
            A,B,C = (B+C)//2, (C+A)//2, (A+B)//2
        else:
            cnt=-1
            break
    else:
        break
print(cnt)

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 A == C:
        print(-1)
        exit()
    a = (B+C)//2
    b = (A+C)//2
    c = (A+B)//2
    A = a
    B = b
    C = c
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

a, b, c = na()

if a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and a == b and b == c:
    print(-1)
    exit(0)
ans = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    ta = b // 2 + c // 2
    tb = a // 2 + c // 2
    tc = a // 2 + b // 2
    a, b, c = ta, tb, tc
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
A,B,C = map(int,input().split())
lis = [A,B,C]
lis.sort()

check = [lis]
ans = 0

while not(check[-1][0]%2==1 or check[-1][1]%2==1 or check[-1][2]%2==1):
    A,B,C = B//2 + C//2 , A//2 + C//2,B//2 + A//2
    temp = [A,B,C]
    temp.sort()
    if temp in check:
        print(-1)
        exit()
    check.append(temp)
    ans += 1

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
cnt=0
if a==b==c and a%2==0:
    cnt = -1
else:
    for i in range(100):
        if a%2==0 and b%2==0 and c%2==0:
            t_a = b//2 + c//2
            t_b = a//2 + c//2
            t_c = a//2 + b//2
            a,b,c = t_a,t_b,t_c
            cnt+=1
        else:
            break
print(cnt)

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==c:
  print(-1)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    ans+=1
    a1=(b+c)//2
    b1=(c+a)//2
    c1=(a+b)//2
    a=a1
    b=b1
    c=c1
  print(ans)

Submission status: Accepted

Solution code:
import math

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

cnt = 0

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

Submission status: Accepted

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())
if a%2 == 0 and b%2 == 0 and c%2 == 0 and a == b and b == c:
    print(-1)
    sys.exit()
else:
    cnt = 0
    while True:
        if a%2 == 1 or b%2 ==1 or c%2 == 1:
            break
        a,b,c = b//2 + c//2,a//2+c//2,a//2+b//2
        cnt += 1    
    print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

count = 0

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

    count += 1
    a1 = b // 2 + c // 2
    b1 = c // 2 + a // 2
    c1 = a // 2 + b // 2

    a, b, c = a1, b1, c1

print(count)

Submission status: Accepted

Solution code:
import numpy as np
p = np.array(list(map(int, input().split())))

cnt = 0
mem = []
flag = True
while (p % 2).sum() == 0:
    a = p[1] // 2 + p[2] // 2
    b = p[0] // 2 + p[2] // 2
    c = p[1] // 2 + p[0] // 2
    
    p = np.array([a, b, c])
    if (a,b,c) in mem:
        flag = False
        break
    else:
        mem.append((a,b,c))
        
    cnt += 1

print(cnt if flag else -1)

Submission status: Accepted

Solution code:
# おっぱっぴー

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

if A == B == C and A % 2 == B % 2 == C % 2 == 0:
    print(-1)
else:
    ans = 0
    while A % 2 == B % 2 == C % 2 == 0:
        A, B, C = B//2+C//2, A//2+C//2, A//2+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 == B%2 == C%2 == 0:
    print(-1)
else:
    ans = 0
    while A%2 == B%2 == C%2 == 0:
        A, B, C = (B+C)//2, (C+A)//2, (A+B)//2
        ans += 1
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y,z= map(int,input().split())
A = []
ans = 0
A.append([x,y,z])
while True:
    if x%2==0 and y%2==0 and z%2==0:
        ans+=1
        x,y,z=((y+z)//2),((z+x)//2),((y+x)//2)
        
        if [x,y,z] in A:
        	ans = -1
        	break
        
    
    A.append([x,y,z])
    if x%2==0 and y%2==0 and z%2==0:
        continue
    else:
      break
    
print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8
a, b, c = map(int, input().split())
count = 0

while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        break
    else:
        tmp_a = (b+c) / 2
        tmp_b = (a+c) / 2
        tmp_c = (a+b) / 2
        if tmp_a == tmp_b == tmp_c:
            print(-1)
            exit()
        else:
            a = tmp_a
            b = tmp_b
            c = tmp_c
            count += 1

print(count)

Submission status: Accepted

Solution code:
from time import time
t = time()
count = 0
a,b,c = map(int,input().split())
while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        print(count)
        exit()
    count += 1
    a1 = b//2+c//2
    b1 = c//2+a//2
    c1 = a//2+b//2
    a = a1
    b = b1
    c = c1
    if time()-t >= 1.8:
        print(-1)
        exit()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a, b, c = map(int,input().split())

if a == b == c and a % 2 == 0:
    print(-1)
else:
    ans = 0
    while True:
        #print(a, b, c)
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            print(ans)
            break
        else:
            ans += 1
            tmpa = a
            tmpb = b
            tmpc = c
            a = tmpb // 2 + tmpc // 2 - tmpa
            b = tmpa // 2 + tmpc // 2 - tmpb
            c = tmpa // 2 + tmpb // 2 - tmpc

Submission status: Accepted

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

cnt = 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:
        a = A
        b = B
        c = C
        cnt += 1
        A = (b+c) // 2
        B = (c+a) // 2
        C = (a+b) // 2
    print(cnt)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	a,b,c=MI()
	ta,tb,tc=a,b,c
	ch = False
	cnt = 0
	while a%2==0 and b%2==0 and c%2==0:
		a,b,c=1/2*(b+c),1/2*(a+c),1/2*(b+a)
		if(a==ta and b==tb and c==tc):
			ch = True
			break
		cnt+=1
	if ch:
		print(-1)
	else:
		print(cnt)


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
ms = list(map(int,input().split()))
if len(set(ms))==1 and ms[0]%2==0:
    print(-1)
else:
    ans=0
    while(all([i%2==0 for i in ms])):
        l = [0]*3
        for i in range(3):
            x = ms[i]/2
            if i==0:
                l[1]+=x
                l[2]+=x
            elif i==1:
                l[0]+=x
                l[2]+=x
            elif i==2:
                l[0]+=x
                l[1]+=x
        ms = l[:]
        ans+=1
    print(ans)

Submission status: Accepted

Solution code:
import sys

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

a1 = a
b1 = b
c1 = c
cnt = 0
while (a1%2 ==0) and (b1%2 == 0) and (c1%2 == 0):
    a1,b1,c1 = b1//2 + c1//2, c1//2 + a1//2, a1//2 + b1//2
    cnt += 1
    if (a1 == a) and (b1 == b) and (c1 == c):
        print(-1)
        sys.exit()

print(cnt)

Submission status: Accepted

Solution code:
def mapint_inp():
    return map(int, input().split())

A, B, C = mapint_inp()

ans = 0
while(1):
    if A%2==1 or B%2==1 or C%2==1:
        break
    if A == B and B == C:
        ans = -1
        break
    halvedA = A//2
    halvedB = B//2
    halvedC = C//2
    A = halvedB+halvedC
    B = halvedA+halvedC
    C = halvedA+halvedB
    ans+=1

print(ans)

Submission status: Accepted

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

A=[A]
B=[B]
C=[C]

Count=0
for i in range(1000000000):
    A.append(B[i]//2+C[i]//2)
    B.append(A[i]//2+C[i]//2)
    C.append(B[i]//2+A[i]//2)
    Count+=1
    if A[i+1]%2!=0 or B[i+1]%2!=0 or C[i+1]%2!=0:
        break
    if Count>=100000:
        Count=-1
        break
       
    
print(0 if A[0]%2!=0 or B[0]%2!=0 or C[0]%2!=0 else Count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
a,b,c = map(int,input().split())
if a == b == c and a%2 == b%2 == c%2== 0:
    print(-1)
    sys.exit()
count = 0
while a%2 == 0 and b%2 == 0 and c%2 == 0:
    x = (b+c)//2
    y = (a+c)//2
    z = (a+b)//2
    a,b,c = x,y,z
    count+=1
    #print(a,b,c)
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
count = 0
flag = True
while(a % 2 == 0 and b % 2 == 0 and c % 2 == 0):
    aa = a//2
    bb = b//2
    cc = c//2
    a = bb + cc
    b = aa + cc
    c = aa + bb
    if(a == b == c):
        flag = False
        break
    count += 1

if flag:
    print(count)
else:
    print(-1)

Submission status: Accepted

Solution code:
def myAnswer(A:int,B:int,C:int) ->int:
   if(A == B and B == C):
      if(A % 2 == 0):
         return -1
      else:
         return 0
   counter = 0
   while A%2 == 0 and B%2 == 0 and C%2 == 0:
      A, B, C = ((B//2 + C//2), (A//2 + C//2), (A//2 + B//2))
      counter += 1
   return counter

def modelAnswer():
   tmp=1
def main():
   A,B,C = map(int,input().split())
   print(myAnswer(A,B,C))

if __name__ == '__main__':
   main()

Submission status: Accepted

Solution code:
l = list(map(int,input().split()))
ans = 0
if l[0] == l[1] == l[2] and l[0] % 2 == 0:
  print(-1)
  exit()
while all(i % 2 == 0 for i in l):
  l[0], l[1], l[2] = l[1]//2 + l[2]//2, l[0]//2 + l[2]//2, l[0]//2 + l[1]//2
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
l = list(map(int,input().split()))
ans = 0
if l[0] == l[1] == l[2] and all(i % 2 == 0 for i in l):
  print(-1)
  exit()
while all(i % 2 == 0 for i in l):
  l[0], l[1], l[2] = l[1]//2 + l[2]//2, l[0]//2 + l[2]//2, l[0]//2 + l[1]//2
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
l = list(map(int,input().split()))
ans = 0
if l[0] == l[1] == l[2] and all(i % 2 == 0 for i in l):
  print(-1)
  exit()
while all(i % 2 == 0 for i in l):
  a = l[0]//2; b = l[1]//2; c = l[2]//2;
  l[0] = b + c
  l[1] = a + c
  l[2] = a + b
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
flag = False
count = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    halfA = A // 2
    halfB = B // 2
    halfC = C // 2

    if A == (halfB + halfC) and B == (halfA + halfC) and C == (halfA + halfB):
        flag = True
        break
    else:
        A = halfB + halfC
        B = halfA + halfC
        C = halfA + halfB
        count += 1
if flag:
    print(-1)
else:
    print(count)

Submission status: Accepted

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

AA, BB, CC = A, B, C
cnt = 0
while True:
    if (A % 2) | (B % 2) | (C % 2):
        print(cnt)
        exit(0)
    a, b, c = A // 2, B // 2, C // 2
    A, B, C = b + c, a + c, a + b
    cnt += 1
    if (A == B) & (B == C):
        print(-1)
        exit(0)
    if (A == AA) & (B == BB) & (C == CC):
        print(-1)
        exit(0)

Submission status: Accepted

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

def resolve():
    def main():
        L=list(map(int,input().split()))
        if L==[1,1,1]:
            return 0
        elif L[0]==L[1] and L[1]==L[2]:
            return -1
        S=sum(L)
        cnt=0
        while True:
            for i in range(3):
                if (S-L[i])%2==0:
                    L[i]=(S-L[i])//2
                else:
                    return cnt
            cnt+=1
    print(main())


resolve()

Submission status: Accepted

Solution code:
import heapq
from collections import defaultdict, deque
from math import ceil, factorial
from fractions import gcd
import sys

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

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


def func(a, b, c):
    if a % 2 or b % 2 or c % 2:
        return 0
    if a == b == c:
        return -1
    return func((b + c) // 2, (a + c) // 2, (b + c) // 2) + 1


A, B, C = mii()

print(func(A, B, C))

Submission status: Accepted

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

Submission status: Accepted

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

while 1:
	if A % 2 == 1:
		break
	if B % 2 == 1:
		break
	if C % 2 == 1:
		break
	a = B / 2 + C / 2
	b = A / 2 + C / 2
	c = A / 2 + B / 2
	ans += 1
	if a == A and b == B and C == c:
		ans = -1
		break
	else:
		A = a
		B = b
		C = c
print(ans)

Submission status: Accepted

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

ans = 0
for i in range(10000):
    if (a + 1) * (b + 1) * (c + 1) % 2 == 0:
        print(ans)
        break
    if a == b == c:
        print(-1)
        break
    ans += 1
    a, b, c = a // 2, b // 2, c // 2
    a, b, c = b + c, a + c, b + c

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

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
ans = 0
if A[0] == A[1] == A[2]:
  if A[0] % 2 == 0: ans = -1
  else: ans = 0
else:
  ans = 0
  ok = True
  a = b = c = 0
  while ok:
    if A[0] % 2 != 0 or A[1] % 2 != 0 or A[2] % 2 != 0:
      ok = False
    a = (A[1] + A[2]) / 2
    b = (A[0] + A[2]) / 2
    c = (A[0] + A[1]) / 2
    if ok: 
      A = [a, b, c]
      ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans=0
rem=[]
flag=True
while a%2== b%2== c%2==0 and flag:
    a,b,c=(b+c)/2,(a+c)/2,(a+b)/2
    ans+=1
    if (a,b,c) in rem:
        print ("-1")
        flag=False
        break
    rem.append((a,b,c))
if flag:
    print (ans)

Submission status: Accepted

Solution code:
x = list(map(int,input().split()))
point = 0
def count(x,point):
    if x[0]%2 == 1 or x[1]%2 == 1 or x[2]%2 == 1:
        return(point)
    else:
        point += 1
        x = [(x[0]+x[1])/2,(x[0]+x[2])/2, (x[1]+x[2])/2]
        return(count(x,point))

if x[0] == x[1] == x[2] and x[0]%2==0:
    print(-1)
else:
    print(count(x,point))

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        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 -self.parents[self.find(x)]

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

    def members(self, x):
        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()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
a, b, c = map(int, input().split())
if a % 2 == 0 and a == b == c:
    print(-1)
else:
    ans = 0
    while True:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            break
        copy_a = a
        copy_b = b
        copy_c = c
        a = copy_b // 2 + copy_c // 2
        b = copy_a // 2 + copy_c // 2
        c = copy_a // 2 + copy_b // 2
        ans += 1
    print(ans)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split(' '))
ans = 0
if a % 2 == 0 and a == b and a == c:
    ans = -1
elif (a+1)*(b+1)*(c+1)%2 == 0:
    ans = 0
else:
    A = [a,b,c]
    A.sort()
    a1 = A[2]-A[1]
    a2 = A[1]-A[0]
    ans = 0
    while a1%2 == 0 and a2%2 == 0:
        ans += 1
        a1 /= 2
        a2 /= 2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,numpy,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
A,B,C = LI()
ans = 0
if A%2 or B%2 or C%2:
    ans = 0
elif A==B==C:
    ans = -1
else:
    while 1:
        if A%2 or B%2 or C%2:
            break
        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())

cnt = 0
if(A==B==C and A%2 == 0):
    print("-1")
else:
    while(A%2 == 0 and B%2 == 0 and C%2 == 0):
        tmpA = A
        tmpB = B
        tmpC = C
        cnt += 1
        A = tmpB//2+tmpC//2    
        B = tmpA//2+tmpC//2
        C = tmpA//2+tmpB//2
    print(cnt)

Submission status: Accepted

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

for i in range(10000):
    if a%2 == 0 and b%2 == 0 and c%2 == 0:
        A = (b + c)/2
        B = (a + c)/2
        C = (a + b)/2
        a = A
        b = B
        c = C
        ans += 1
    else:
        break

if ans >= 10000:
    print(-1)
else:
    print(ans)

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

a = l()

a.sort()
co = 0
if any(map(lambda x:x % 2 == 1,a)):
    print(0)
    exit()
if a[0] == a[1] and a[1] == a[2]:
    print(-1)
    exit()
while True:
    a = [(a[2]+a[1])//2,(a[1]+a[0])//2,(a[0]+a[2])//2]
    co += 1
    if any(map(lambda x:x % 2 == 1,a)):
        print(co)
        exit()

Submission status: Accepted

Solution code:
import sys
A,B,C = map(int,input().split())
result = 0
if A * B * C % 2 == 1:
  print(0)
  sys.exit()
elif A == B and B == C:
  print(-1)
  sys.exit()
else:
  while A % 2 == B % 2 and B % 2 == C % 2 and C % 2 == 0:
    a = (B + C) // 2
    b = (C + A) // 2
    c = (A + B) // 2
    A,B,C = a,b,c
    result += 1
print(result)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
ans = -1
for i in range(114514):
    if a % 2 == b % 2 == c % 2 == 0:
        a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
    else:
        ans = i
        break
print(ans)

Submission status: Accepted

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

if (a%2!=0) or (b%2!=0) or (c%2!=0):
  print(0)
elif (a == b ) and (b == c):
  print(-1)
else:
  def exchange(a,b,c):
    return (b+c)/2,(c+a)/2,(a+b)/2
  num = 0
  ans = 0
  while num  == 0:
    a,b,c = exchange(a,b,c)
    ans += 1
    for j in range(3):
      if [a,b,c][j] % 2 ==1:
        num = 1
  print(ans)