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:
A,B,C=map(int,input().split())

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

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
val = 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,b,c = int((b+c)/2), int((a+c)/2), int((a+b)/2)
    val += 1
  print(val)

Submission status: Accepted

Solution code:
# n , m , l = map(int , input().split())

# list_n = list(map(int , inpuut().split()))<Paste>

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]


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

n = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    if A == B and B == C:
        n = -1
        break

    An = (B + C) // 2
    Bn = (A + C) // 2
    Cn = (A + B) // 2

    A = An
    B = Bn
    C = Cn
    n += 1

print(n)

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:
    count = 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
        count += 1
    print(count)

Submission status: Accepted

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

while all([a%2 == 0, b%2 == 0, c%2 == 0]):
    a, b, c = int((b+c)/2), int((a+c)/2), int((c+a)/2)
    if (a, b, c) in dic:
        count = -1
        break
    else:
        dic.append((a, b, c))
        count += 1

print(count)

Submission status: Accepted

Solution code:
import sys
a, b, c = map(int, input().split())
var = 0
for i in range(1000):
    if a%2 != 0 or b%2 != 0 or c%2 != 0:
        print(var)
        sys.exit()
    a, b, c = b/2 + c/2, a/2 + c/2, a/2 + b/2
    var += 1
print(-1)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
ans = 0
for i in range(10000001):
  if a%2 == 1 or b%2 == 1 or c%2 == 1:
    break
  if i == 1000000:
    print(-1)
    exit()
  m = a
  n = b
  l = c
  a = (b+c)//2 
  b = (c+m)//2 
  c = (m+n)//2
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
a, b, c = [int(w) for w in input().split()]

ans = 0


def is_fin(a, b, c):
    global ans
    if a % 2 or b % 2 or c % 2:
        return True
    elif a == b == c:
        ans = -1
        return True
    else:
        return False


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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check(A,B,C):
  if A==0 or B==0 or C==0:
    return False
  if A%2!=0 or B%2!=0 or C%2!=0:
    return False
  return True

A,B,C=map(int,input().split())
ans=0
if A%2==B%2==C%2==0 and A==B==C:
  print(-1)
  exit()
while check(A,B,C)==True:
  a=B//2+C//2
  b=A//2+C//2
  c=A//2+B//2
  A,B,C=a,b,c
  ans+=1
  if 10**9<ans:
    ans=-1
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C = map(int, input().split())
a = [A]
b = [B]
c = [C]
count = 0
sum = A + B + C
for i in range(10 ** 9):

    if a[i] == b[i] == c[i]:
        if a[i] % 2 == 0 and b[i] % 2 == 0 and c[i] % 2 == 0:
            count = -1
            break
        else:
            count = 0
            break
    elif a[i] % 2 == 0 and b[i] % 2 == 0 and c[i] % 2 == 0:
        a.append(b[i] / 2 + c[i] / 2)
        b.append(a[i] / 2 + c[i] / 2)
        c.append(a[i] / 2 + b[i] / 2)
        count += 1
    else:
        break


print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C = map(int, input().split())
ctr = 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,B,C = int((B+C)/2), int((A+C)/2), int((A+B)/2)
    ctr += 1
  print(ctr)

Submission status: Accepted

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

def check_odd():
    for m in member:
        if m % 2 != 0:
            return True
    return False

def check_number():
    num = member[2]
    for i in range(2):
        if num != member[i]:
            return True
    return False

if check_number():
    count = 0
    while True:
        if check_odd():
            break
        else:
            a = member[1] // 2 + member[2] // 2
            b = member[0] // 2 + member[2] // 2
            c = member[0] // 2 + member[1] // 2
            member = [a, b, c]
        count += 1
    print(count)
else:
    if check_odd():
        print(0)
    else:
        print(-1)

Submission status: Accepted

Solution code:
X=[int(x) for x in input().split()]
count=0
if ((X[0]%2-1)*(X[1]%2-1)*(X[2]%2-1)!=0 and X[0]==X[1] and X[1]==X[2]):
  count=-1
else:
  while((X[0]%2-1)*(X[1]%2-1)*(X[2]%2-1)!=0):
    Y=[0,0,0]
    Y[0]=(X[1]+X[2])/2
    Y[1]=(X[0]+X[2])/2
    Y[2]=(X[1]+X[0])/2
    X=Y
    count =count+1
print(count)

Submission status: Accepted

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

count = 0

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

print(count)

Submission status: Accepted

Solution code:
List=list(map(int,input().split()))
cnt=0
while(all(i%2==0 for i in List)):
    if List[0]==List[1]==List[2]:
        print(-1)
        exit()
    old_list=[List[0]//2,List[1]//2,List[2]//2]
    List[0]=old_list[1]+old_list[2]
    List[1]=old_list[0]+old_list[2]
    List[2]=old_list[0]+old_list[1]
    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 :
    print(-1)
elif A==B==C and A%2==1 :
    print(0)
else :
    while True :
        if A%2 != 0 or B%2 != 0 or C%2 != 0 :
            print(count)
            break
        elif A==B and B==C :
            print(-1)
            break
        else :
            count += 1
            dA=A
            dB=B
            dC=C
            A=dB/2+dC/2
            B=dA/2+dC/2
            C=dA/2+dB/2

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
r = 0
if a == b == c:
  if a%2 == 1:
    print(r)
    exit()
  else:
    print(-1)
    exit()

while True:
  if a%2 == 1 or b%2 == 1 or c%2 == 1:
    break
  r += 1
  aa = (b+c)//2
  bb = (a+c)//2
  cc = (a+b)//2
  a,b,c = aa,bb,cc

print(r)

Submission status: Accepted

Solution code:
def ave(b,c):
    return b//2 + c//2
def rest(a,b,c):
    return ave(b,c), ave(a,c), ave(b,a)
a, b, c = map(int, input().split())
ans = 0
while 1:
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1 :
        print(ans)
        break
    d, e, f = rest(a,b,c)
    if (a, b, c) == (d, e, f):
        print(-1)
        break
    ans += 1
    a, b, c = d, e, f

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

for t in range(1000):
    if A & 1 or B & 1 or C & 1:
        break
    A, B, C = A // 2, B // 2, C // 2
    A, B, C = B + C, C + A, A + B

t = -1 if t > 100 else t
print(t)

Submission status: Accepted

Solution code:
def solve(a, b, c):
    if any(i % 2 == 1 for i in [a, b, c]):
        return 0
    if a == b == c:
        return -1
    a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2
    return solve(a, b, c) + 1

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

print(solve(a, b, c))

Submission status: Accepted

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

if any(i % 2 != 0 for i in [a, b, c]):
    print(0)
    exit()

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

cnt = 0
a_list = [0]*(1001001)
b_list = [0]*(1001001)
c_list = [0]*(1001001)
a_list[0] = a
b_list[0] = b
c_list[0] = c

for i in range(1, 1001001):
    a_list[i] = (b_list[i-1] + c_list[i-1]) // 2
    b_list[i] = (c_list[i-1] + a_list[i-1]) // 2
    c_list[i] = (a_list[i-1] + b_list[i-1]) // 2
    cnt += 1
    if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:
        break

print(cnt)

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
ans = 0
if A == B == C:
  if A%2 != 0 or B%2 != 0 or C%2 != 0:
    pass
  else:
    ans = -1
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
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
cookie = list(map(int,input().split()))
odd = False
cnt = 0
if cookie[0]%2==1 or cookie[1]%2== 1 or cookie[2]%2==1:
    print(0)
elif len(list(set(cookie))) == 1:
    print('-1')
else:
    while not odd:
        tmp = [0 for i in range(3)]
        for i in range(3):
            ix = list(set([0,1,2]) - set([i]))
            tmp[ix[0]] += cookie[i] / 2
            tmp[ix[1]] += cookie[i] / 2
        for i in tmp:
            if not i % 2 == 0:
                odd = True
        cookie = tmp
        cnt += 1
    print(cnt)

Submission status: Accepted

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

for i in range(40):
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        d = a // 2
        e = b // 2
        f = c // 2
        a = e + f
        b = d + f
        c = d + e
        ans += 1
    else:
        k = 0
        break

if k == 1:
    print(-1)
else:
    print(ans)

Submission status: Accepted

Solution code:

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

count = 0
for i in range(100):
    if a%2==1 or b%2==1 or c%2==1:
        break

    count = count + 1
    a_new = (b+c)/2
    b_new = (a + c) / 2
    c_new = (a + b) / 2

    a = a_new
    b = b_new
    c = c_new
    if i == 99:
        count = -1
print(count)

Submission status: Accepted

Solution code:
A, B, C = [int(x) for x in input().split()]
ans = 0
while True:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break
    elif A == B == C:
        ans = -1
        break
    ans += 1
    A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2

print(ans)

Submission status: Accepted

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

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

for i in range(10**5):
    tmpa=(b+c)/2
    tmpb=(a+c)/2
    tmpc=(b+a)/2
    a=tmpa
    b=tmpb
    c=tmpc
    if a%2==1 or b%2==1 or c%2==1:
        print(i+1)
        exit()
print(-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
if a==b==c and a%2==1:
    print(0)
elif a==b==c and a%2==0:
    print("-1")
else:
    cnt = 0
    while all(i&1==0 for i in [a,b,c]):
        A = a
        B = b
        C = c
        a = (B+C)//2
        b = (A+C)//2
        c = (A+B)//2
        cnt += 1
    print(cnt)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
if a==b==c and a%2==1:
    print(0)
elif a==b==c and a%2==0:
    print("-1")
else:
    cnt = 0
    while all(i&1==0 for i in [a,b,c]):
        A = a
        B = b
        C = c
        #一旦数値を保存しとかないと、
        # 下でa=(b+c)//2した後の計算に、このaの値が用いられてしまう。
        a = (B+C)//2
        b = (A+C)//2
        c = (A+B)//2
        cnt += 1
    print(cnt)

Submission status: Accepted

Solution code:
cookie = list(map(int, input().split()))
sc = sum(cookie)
cnt = 0
if cookie[0] == cookie[1] and cookie[1] == cookie[2] and cookie[0]%2 == 0:
    print(-1)
    exit()
memo = [0]*3
while cookie[0]%2 == 0 and cookie[1]%2 == 0 and cookie[2]%2 == 0:
    memo[0] = (cookie[1] + cookie[2]) // 2
    memo[1] = (cookie[0] + cookie[2]) // 2
    memo[2] = (cookie[1] + cookie[0]) // 2
    for i in range(3):
        cookie[i] = memo[i]
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
def change(A,B,C):
    a=B/2+C/2
    b=A/2+C/2
    c=A/2+B/2
    return a,b,c
A,B,C=map(int,input().split())
a=A
b=B
c=C
if (A%2==1)|(B%2==1)|(C%2==1):
    print(0)
else:
    count=0
    while True:
        A,B,C=change(A,B,C)
        count+=1
        if (A%2==1)|(B%2==1)|(C%2==1):
            print(count)
            break
        elif (a==A)&(b==B)&(c==C):
            print(-1)
            break

Submission status: Accepted

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

ans = 0
while True:
  if len(set((a,b,c)))==1:
    if a%2==1:
      print(0)
      exit()
    print(-1)
    exit()
  if a%2==0 and b%2==0 and c%2==0:
    a,b,c = b//2+c//2,c//2+a//2,a//2+b//2
    ans+=1
  else:
    break
print(ans)

Submission status: Accepted

Solution code:
A,B,C = list(map(int,input().split()))
if A == B == C and A%2 == 0 :
    print(-1)
elif A == B == C and A%2 == 1 :
    print(0)
else :
    cnt=0
    while A%2==B%2==C%2==0:
        total=A+B+C
        A=total//2-A//2
        B=total//2-B//2
        C=total//2-C//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 or B % 2 != 0 or C % 2 != 0:
        print(count)
        break
    if A == B == C:
        print(-1)
        break
    A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
    count += 1

Submission status: Accepted

Solution code:
def calculate(A, B, C):
    for i in range(1000):
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            return i
        else:
            _A = (B + C) // 2
            _B = (A + C) // 2
            _C = (A + B) // 2
            A, B, C = _A, _B, _C
    return -1

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

Submission status: Accepted

Solution code:
# template by 3xC and starkizard.
# contributors: 

#####################################################################################
from __future__ import division, print_function 

import sys
import os
from collections import Counter, deque, defaultdict
import itertools
import math
import io


"""Uncomment modules according to your need"""


# from bisect import bisect_left, bisect_right, insort
# from heapq import heappop, heapify, heappush
# from random import randint as rn
# from Queue import Queue as Q
# from copy import deepcopy
# from decimal import *
# import re
# import operator

#####################################################################################
# this enables you to write python3 code with PyPy2 (Python 2)
if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

#####################################################################################

"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""Uncomment next 4 lines if doing huge recursion"""
# import threading
# threading.stack_size(1<<27)
# sys.setrecursionlimit(10000

def prepare_factorial(mod=mod):
    """ returns two lists, factorial and inverse factorial modulo argument by default 10**9 +7 """
    # Comment code out when you don't need inverse factorial or vice versa
    fact = [1]
    for i in range(1, 200005):
        fact.append((fact[-1] * i) % mod)

    ifact = [0] * 200005
    ifact[200004] = pow(fact[200004], mod - 2, mod)
    for i in range(200004, 0, -1):
        ifact[i - 1] = (i * ifact[i]) % mod

    return fact, ifact

def modinv(n, p):
    """ returns N inverse modulo p """
    return pow(n, p - 2, p)

def ncr(n, r,  fact, ifact):
    """ takes 4 arguments: n , r and factorial and inverse factorial lists"""
    t = (fact[n] * (ifact[r]*ifact[n-r]) % MOD)% MOD
    return t


def get_n(Sum):    
    """this function returns the maximum n for which Summation(n) <= Sum"""
    ans = (-1 + sqrt(1 + 8*Sum))//2
    return ans

def sieve(n):
    """ returns a list of prime numbers till n """
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r



def divs(n, start=1):
    """ returns a list of all divisors till n """
    divisors = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors



def divn(n, primes):
    """ returns the number of divisors, two arguments n and the sieve till n """
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t



def lrfind(d, x, default=-1):
    """ Takes 2 arguments an iterable and an element. returns a tuple (firstoccurence,lastoccurence) -1 if not found """
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return default, default
    else:
        return left, right

def gcd(x, y): # math.gcd is slower
    """ returns greatest common divisor of x and y """
    while y:
        x, y = y, x % y
    return x

def check_sorted(a):
    ''' returns True/False '''
    for i in range(len(a)-1):
        if a[i]>a[i+1]:
            return False
    return True
def ceil(n, k=1): return n // k + (n % k != 0) #returns math.ceil but protecting against floating inconsistencies
def input(): return sys.stdin.readline().strip()
def ii(): return int(input()) #inputs integer
def mi(): return map(int, input().split()) # inputting space seperated variables for example x,y,z
def li(): return list(map(int, input().split())) #inputting a space seperated list of integers
def lw(): return input().split() #inputting a space seperated list of strings
def lcm(a, b): return abs(a * b) // gcd(a, b) #returns LCM of two arguments
def prr(a, sep=' ', end='\n'): print(sep.join(map(str, a)), end=end) #For printing an iterable with seperator sep as optional second argument (default : " "), ending character (default: "\n") as optional third
def dd(): return defaultdict(int) #returns a dictionary with values defaulted to 0
def ddl(): return defaultdict(list) #returns a dictionary with values defaulted to []
def write(s): return sys.stdout.write(s)












###################################################################
def main():
    #CODE GOES HERE:
    a,b,c=mi()
    s=a+b+c
    steps=0
    if a%2==1 or b%2==1 or c%2==1:
        print(steps)
        return
    if(a==b and b==c):
        print(-1)
        return
    while True:
        a=(s-a)//2
        b=(s-b)//2
        c=(s-c)//2
        steps+=1
        if a%2==1 or b%2==1 or c%2==1:
            print(steps)
            break
        if(a==b and b==c):
            print(-1)
            break





""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192

class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):

    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

""" main function"""

if __name__ == '__main__':
    main()
    # threading.Thread(target=main).start()

Submission status: Accepted

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

if a==b==c:
    if a&1:
        print(0)
    else:
        print(-1)
    exit()

ans=0    
while all(i&1==0 for i in [a,b,c]):
    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())
ans = 0

if a == b and a == c and a%2 == 0:
  print("-1")
elif a == b and a == c and a%2 == 0:
  print(0)
else:
  while a%2 == 0 and b%2 == 0 and c%2 == 0:
    ans += 1
    aa = b/2 + c/2
    bb = a/2 + c/2
    cc = a/2 + b/2
    a = aa
    b = bb
    c = cc
  print(ans)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
if a == b == c:
    if a % 2 == 0:
        print(-1)
        exit()
    else:
        print(0)
        exit()
for i in range(0, 10**6):
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        print(i)
        exit()
    a, b, c = (b+c) / 2, (c+a)/2, (a+b)/2

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

A, B, C = MAP()

if any(x%2 for x in [A, B, C]):
	print(0)
	exit()
elif A == B == C:
	print(-1)
	exit()

ans = 0
while all(x%2 == 0 for x in [A, B, C]):
	A, B, C = (B+C)//2, (A+C)//2, (A+B)//2
	ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

A, B, C = MAP()

if any(x%2 for x in [A, B, C]):
	print(0)
	exit()
elif A == B == C:
	print(-1)
	exit()

cnt = 0
while 1:
	a = (B+C)/2
	b = (A+C)/2
	c = (A+B)/2
	cnt += 1
	if any(x%2 for x in [a, b, c]):
		print(cnt)
		break
	else:
		A, B, C = a, b, c

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

A, B, C = MAP()

if any(x%2 != 0 for x in [A, B, C]):
	print(0)
	exit()

l = [(A, B, C)]

cnt = 0
while 1:
	a = (B+C)/2
	b = (A+C)/2
	c = (A+B)/2
	if any(x%1 != 0 for x in [a, b, c]):
		print(cnt)
		exit()
	elif (a, b, c) in l:
		print(-1)
		exit()
	else:
		A, B, C = a, b, c
		l.append((A, B, C))
		cnt += 1

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

A, B, C = MAP()

if any(x%2 != 0 for x in [A, B, C]):
	print(0)
	exit()

l = [(A, B, C)]

flg = True
cnt = 0
while 1:
	a = (B+C)/2
	b = (A+C)/2
	c = (A+B)/2
	if any(x%1 != 0 for x in [a, b, c]):
		print(cnt)
		exit()
	elif (a, b, c) in l:
		print(-1)
		exit()
	else:
		A, B, C = a, b, c
		l.append((A, B, C))
		cnt += 1

Submission status: Accepted

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

Submission status: Accepted

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

counter = 0
while a%2==b%2==c%2==0:
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    counter += 1
    if counter > 100000:
        counter = -1
        break
print(counter)

Submission status: Accepted

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

counter = 0
while a%2==b%2==c%2==0:
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    counter += 1
    if counter > 26:
        counter = -1
        break
print(counter)

Submission status: Accepted

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

counter = 0
while a%2==b%2==c%2==0:
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    counter += 1
    if counter > 31:
        counter = -1
        break
print(counter)

Submission status: Accepted

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

counter = 0
while a%2==b%2==c%2==0:
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    counter += 1
    if counter > 1000:
        counter = -1
        break
print(counter)

Submission status: Accepted

Solution code:
abc = list(map(int, input().split()))
ans = 0
for i in range(10 ** 6):   
    if abc[0] % 2 != 0:
        print(ans)
        quit()
        break
    else:
        tmp1 = abc[1] // 2 + abc[2] // 2

    if abc[1] % 2 != 0:
        print(ans)
        quit()
        break
    else:
        tmp2 = abc[0] // 2 + abc[2] // 2
        
    if abc[2] % 2 != 0:
        print(ans)
        quit()
        break
    else:
        tmp3 = abc[0] // 2 + abc[2] // 2
        
    abc[0] = tmp1
    abc[1] = tmp2
    abc[2] = tmp3
    ans += 1

print(-1)

Submission status: Accepted

Solution code:
import sys
a,b,c=map(int,input().split())
ans=0
if a%2==1 or b%2==1 or c%2==1:
    print(0)
    sys.exit()
if a%2==0 and a==b==c:
    print(-1)
    sys.exit()
while a%2==0 and b%2==0 and c%2==0:
    ta=a/2
    tb=b/2
    tc=c/2
    a=tb+tc
    b=ta+tc
    c=ta+tb
    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:
    ans += 1
    a, b, c = A//2, B//2, C//2
    A = b+c
    B = a+c
    C = a+b
    if ans == 100: break
if ans == 100:
    print(-1)
else:
    print(ans)

Submission status: Accepted

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

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

    if A == B == C:
        c = -1
        break

print(c)