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

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

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

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

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

two = [0,0,0]
mod = [0,0,0]
for i,a in enumerate([A,B,C]):
    while True:
        if a % 2 == 0:
            two[i] += 1
            a /= 2
        else:
            mod[i] = a
            break
flag = True
ans = 0
if two[0] == two[1] and two[1] == two[2] and two[0] != 0:
    if mod[0] == mod[1] == mod[2] :
        flag = False
    else:
        mod.sort()
        moddif = [int(mod[1]+mod[0]),int(mod[2]+mod[1]),int(mod[0]+mod[2])]
        two2 = [0,0,0]    
        for i,a in enumerate(moddif):
            while True:
                if a % 2 == 0:
                    two2[i] += 1
                    a /= 2
                else:
                    break
        ans = two[0] + min(two2) 
else:
    ans = min(two)

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

Solution (Python):
from fractions import gcd
def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



def main():
    a,b,c=map(int, input().split())
    tmp = tuple(sorted([a, b, c]))
    s = set()
    ans = 0
    while tmp not in s:
        a, b, c = tmp
        if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
            break
        s.add(tmp)
        tmp = tuple(sorted([(b+c)//2, (a+c)//2, (a+b)//2]))
        ans += 1
    if tmp not in s:
        print(ans)
    else:
        print(-1)


main()

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

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

N = max(A, B, C) - min(A, B, C)

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

for i in range(N):
    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
    A, B, C = a, b, c

Solution (Python):
A,B,C = [int(x) for x in input().split()]
if(A==B==C and A%2==0):
    print(-1)
else:
    cnt=0
    a,b,c=A,B,C
    while(a%2==b%2==c%2==0):
        cnt+=1
        a_=(b+c)//2
        b_=(a+c)//2
        c_=(a+b)//2
        a,b,c=a_,b_,c_
    print(cnt)

Solution (Python):
def main():
    A, B, C = map(int, input().split())
    ans = 0
    seen = set()
    while True:
        if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
            break
        if (A, B, C) in seen:
            print(-1)
            return
        seen.add((A, B, C))
        x = A//2
        y = B//2
        z = C//2
        A = y + z
        B = z + x
        C = x + y
        ans += 1
    print(ans)

if __name__ == "__main__":
    main()

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

if a == b == c:
  if a%2 == 0:
    print(-1)
    exit()
  else:
    print(0)
    exit()
ans = 0
while(a%2 == b%2 == c%2 == 0):
  temp_a = (b+c)//2
  temp_b = (a+c)//2
  temp_c = (b+a)//2
  ans += 1
  a = temp_a
  b = temp_b
  c = temp_c
print(ans)

Solution (Python):
from collections import defaultdict

def prime_factorization(n):
    '''
    Trial division.
    Input: 
        n : a positive integer
    Output:
        a dictionary of 
    '''
    result = defaultdict(int)
    if n < 2:
        return result
    while n % 2 == 0:
        result[2] += 1
        n //= 2
    p = 3
    while p*p <= n:
        while n % p == 0:
            n //= p
            result[p] += 1
        p += 2
    if n > 1:
        result[n] += 1
    return result

A, B, C = map(int, input().split())
if A == B and B == C:
    if A % 2 == 1:
        print(0)
    else:
        print(-1)
else:
    fac_2_A = prime_factorization(A)[2]
    fac_2_B = prime_factorization(B)[2]
    fac_2_C = prime_factorization(C)[2]
    ans = min(fac_2_A, fac_2_B, fac_2_C)
    if fac_2_A == fac_2_B and fac_2_B == fac_2_C:
        ans += 1
    print(ans)

Solution (Python):
from fractions import gcd

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

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

if not all([A % 2 == 0, B % 2 == 0, C % 2 == 0]):
    print(0)

elif A == B == C:
    print(-1)
else:
    cnt = 0
    while all([A % 2 == 0, B % 2 == 0, C % 2 == 0]):
        cnt += 1
        A, B, C = ((B+C)//2, (A+C)//2, (A+B)//2)
    print(cnt)

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

if any([A % 2, B % 2, C % 2]):
	print(0)
	exit()

if A == B == C:
	print(-1)
	exit()

count = 0
while all([A % 2 == 0, B % 2 == 0, C % 2 == 0]):
    A, B, C = ((B+C)//2, (A+C)//2, (A+B)//2)
    count += 1
print(count)

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

if any([A % 2, B % 2, C % 2]):
	print(0)
	exit()

if A == B == C:
	print(-1)
	exit()

count = 0
while True:
	if any([A % 2, B % 2, C % 2]):
		break
	A, B, C = ((B+C)//2, (A+C)//2, (A+B)//2)
	count += 1
print(count)

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

if any([A % 2, B % 2, C % 2]):
	print(0)
	exit()

if A == B == C:
	print(-1)
	exit()

count = 0
while True:
	if any([A % 2, B % 2, C % 2]):
		break
	A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
	count += 1
print(count)

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

if any([A % 2, B % 2, C % 2]):
	print(0)
	exit()

if A == B == C:
	print(-1)
	exit()

count = 0
while True:
	if any([A % 2, B % 2, C % 2]):
		break
	A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
	count += 1
print(count)

Solution (Python):
def f(a,b,c):
  if a%2 + b%2 + c%2 > 0:
    return 0 
  elif a == b and b == c:
    return -1
  else:
    return f((b+c)//2,(a+c)//2,(a+b)//2)+1
    
    
x,y,z = map(int,input().split())
print(f(x,y,z))

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

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

Solution (Python):
a, b, c = [int(item) for item in input().split()]

cnt = 0
while a%2 != 1 and b%2 != 1 and c%2 != 1:
    ta = b//2 + c//2
    tb = a//2 + c//2
    tc = a//2 + b//2
    cnt += 1
    a = ta
    b = tb
    c = tc
    if cnt >= 10**5:
        print(-1)
        exit()
print(cnt)

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

Solution (Python):
a,b,c = map(int,input().split())
d1 = abs(a-b)
d2 = abs(b-c)
d3 = abs(c-a)
if a%2 == 1 or b%2 == 1 or c%2 ==1:
    print(0)
elif d1 == d2 == 0:
    print(-1)
else:
    cnt1 = 0
    cnt2 = 0
    cnt3 = 0
    while d1 % 2 == 0:
        d1 //= 2
        cnt1 +=1 
    while d2 % 2 == 0:
        d2 //= 2
        cnt2 +=1
    while d3 % 2 == 0:
        d3 //= 2
        cnt3 +=1
    print(min(cnt1,cnt2))

Solution (Python):
a,b,c=map(int,input().split())
x=0
if a==b==c:
    if a%2==1:print(0)
    else:print(-1)
else:
    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
        x+=1
    print(x)

Solution (Python):
A, B, C = map(int, input().split())
ans = 0
if A == B == C:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        print(ans)
        exit()
    print(-1)
    exit()
while True:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        print(ans)
        exit()
    tmp = B // 2 + C // 2
    tmptmp = A // 2 + C // 2
    C = A // 2 + B // 2
    A = tmp
    B = tmptmp
    ans += 1

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






result = 0
memory = [[A, B, C]]
while True:
    if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
        break
    else:
        result += 1
    
    a = A / 2
    b = B / 2
    c = C / 2

    A = b + c
    B = a + c
    C = a + b

    l = sorted([A, B, C])
    for m in memory:
        if m[0] == l[0] and m[1] == l[1] and m[2] == l[2]:
            result = -1
            break
    
    if result == -1:
        break

	

    

    memory.append(l)
    

print(result)

Solution (Python):

"""
A - Cookie Exchanges
https://atcoder.jp/contests/agc014/tasks/agc014_a

"""
import sys


def solve(A, B, C):
    res = sorted([A, B, C])
    ans = 0
    seen = set()
    seen.add(tuple(res))
    while all([r%2== 0 for r in res]):
        a = res[1]//2 + res[2]//2
        b = res[0]//2 + res[2]//2
        c = res[0]//2 + res[1]//2
        res = sorted([a, b, c])
        ans += 1
        t = tuple(res)
        if t in seen:
            return -1
    return ans


def main(args):
    A, B, C = map(int, input().split())
    ans = solve(A, B, C)
    print(ans)


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

Solution (Python):
a,b,c=map(int,input().split())
if a==b==c and a%2==0:
  print(-1)
else:
  s=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
    
    s+=1
  print(s)

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

if (A==B and B==C and A%2==0):
  print (-1)
else:
  s = 0
  for i in range(1000000):
    if (A%2==0 and B%2==0 and C%2==0):
      A,B,C = (B+C)//2,(A+C)//2,(A+B)//2
    else:
      s = i
      break
  print ( s )

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

Solution (Python):
import sys
input = sys.stdin.readline

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

count = 0

while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    a_temp = a // 2
    b_temp = b // 2
    c_temp = c // 2
    if a == b_temp + c_temp and b == a_temp + c_temp and c == a_temp + b_temp:
        print("-1")
        sys.exit()
    a = b_temp + c_temp
    b = a_temp + c_temp
    c = a_temp + b_temp
    count += 1

print(count)

Solution (Python):
a, b, c = map(int, input().split())
if ((a % 2) + (b % 2) + (c % 2)) > 0:
    ans = 0
elif (a == b) & (b == c):
    ans = -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)

Solution (Python):
a, b, c = map(int, input().split())
ans = 0
if a == b and b == c:
    if a % 2 == 0:
        print(-1)
    else:
        print(0)
else:
    while True:
        if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
            tempa = b // 2 + c // 2
            tempb = c // 2 + a // 2
            tempc = a // 2 + b // 2
            a = tempa
            b = tempb
            c = tempc
            ans += 1
        else:
            break
    print(ans)

Solution (Python):
import fractions
A=[int(i) for i in input().split()]
A.sort()
g=fractions.gcd(A[1]-A[0],A[2]-A[1])
ans=len(str(bin(g)))-str(bin(g)).rfind("1")-1
print(-1 if A[0]==A[2] and A[0]%2==0 else 0 if A[0]==A[2] and A[0]%2==1 else ans)

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

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

print(ans)

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

count = 0
pA, pB, pC = 0, 0, 0
while all(d % 2 == 0 for d in [A, B, C]):
    A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2

    if set([pA, pB, pC]) == set([A, B, C]):
        print(-1)
        quit()

    pA, pB, pC = A, B, C
    count += 1
print(count)

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

if A == B == C:
    if A % 2 == 0:
        print(-1)
    else:
        print(0)
else:
    count = 0
    while all(d % 2 == 0 for d in [A, B, C]):
        A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
        count += 1
    print(count)

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

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

def solve(a=A,b=B,c=C):
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        return 0
    if a == b == c:
        return -1
    return solve((b+c)//2,(c+a)//2,(a+b)//2) + 1

ans = solve()

print(ans)

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

roop = max(A,B,C).bit_length()

for i in range(roop+1):
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        ans = i
        break

    nA = (B+C) // 2 
    nB = (C+A) // 2
    nC = (A+B) // 2
    A = nA
    B = nB
    C = nC

if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    ans = -1

print(ans)

Solution (Python):
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 != 1 and b%2 !=1 and c%2 !=1:
        aa = a
        bb = b
        cc = c
        a = bb//2+cc//2
        b = aa//2+cc//2
        c = bb//2+aa//2
        ans += 1
    print(ans)

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

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

print(answer)

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

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

    ans = 0
    while True:
        if A%2 == 0 and B%2 == 0 and C%2 == 0:
            ans += 1
            A,B,C = [(A+B)/2, (B+C)/2, (C+A)/2]
        else:
            print(ans)
            exit()
else:
    print(0)

Solution (Python):
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:
    def Base_10_to_n(X, n):
        if X//n:
            return Base_10_to_n(X//n, n)+str(X%n)
        return str(X%n)
    A = Base_10_to_n(A, 2)[::-1]
    B = Base_10_to_n(B, 2)[::-1]
    C = Base_10_to_n(C, 2)[::-1]
    ans = 0
    for i in range(min(len(A),len(B),len(C))):
        if A[i] == B[i] == C[i]:
            ans += 1
        else:
            break
    print(ans)

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

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

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

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

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

for i in range(100000):
  if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    Ans = i
    break
  a = A // 2
  b = B // 2
  c = C // 2
  A = b + c
  B = c + a
  C = a + b

print(Ans)

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

cnt = 0
while True:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        print(cnt)
        exit(0)
    elif A == B == C:
        print("-1")
        exit(0)
    
    A , B, C = (B+C)//2,(A+C)//2,(A+B)//2
    cnt += 1

Solution (Python):
a,b,c = map(int,input().split())
if a%2==1 or b%2==1 or c%2==1:
    print(0)
    exit()
elif a==b==c:
    print(-1)
    exit()
def f(a,b,c):
    cnt = 0
    while True:
        if a%2==0 and b%2==0 and c%2==0:
            a_ = b//2+c//2
            b_ = a//2+c//2
            c_ = a//2+b//2
            a,b,c=a_,b_,c_
            cnt+=1
        else:
            break
    return cnt
print(f(a,b,c))

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

if A == B and A == C:
  if A%2==0:
    print(-1)
  else:
    print(0)
  exit()
else:
  cnt = 0
  while True:
    if 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
      continue
    else:
      break
      
print(cnt)

Solution (Python):
import numpy as np
A, B, C = map(int, input().split())
A, B, C = np.sort([A, B, C])
ab = B - A 
bc = C - B 
if (A%2 == 1) & (B%2 == 1) & (C%2 == 1):
  print(0)
elif (ab == 0) & (bc == 0):
  print(-1)
else:
  for k in range(30):
    if ((ab % 2) == 1) | ((bc % 2) == 1):
      print(k)
      break
    ab = int(ab/2)
    bc = int(bc/2)

Solution (Python):
def rec(x, y, z):
    if (x | y | z) & 1:
        return 0

    if x == y == z:
        return -INF

    nx = (y + z) >> 1
    ny = (z + x) >> 1
    nz = (x + y) >> 1
    return rec(nx, ny, nz) + 1


INF = float('inf')
A, B, C = map(int, input().split())
ans = rec(A, B, C)
print(ans if ans >= 0 else -1)

'''
操作ごとに最大と最小の差が詰まるので、
無限繰り返し状態のときは、a==b==cになっている
'''

Solution (Python):
def cookies_divide(num_of_per,A):
  
  if (A[0] == A[1] == A[2] and A[0]%2 + A[1]%2 + A[2]%2 == 0):
    return (-1,A)
  
  if(A[0]%2 + A[1]%2 + A[2]%2 > 0):
    return (0,A)
  
  R = [0 for i in range(num_of_per)]
  R[0] = A[1]//2 + A[2]//2
  R[1] = A[0]//2 + A[2]//2
  R[2] = A[0]//2 + A[1]//2
  return (1,R)

if(__name__== '__main__'):
  count = 0
  A = list(map(int,input().split()))
  while True:
    return_code, A = cookies_divide(3,A)
    if return_code < 0:
      print(return_code)
      break;
    
    if return_code == 0:
      print(count)
      break;
    
    count += return_code

Solution (Python):
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:
    cnt = -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
        cnt += 1
print(cnt)

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

cnt = 0
while True:
    x = (b+c)//2
    y = (a+c)//2
    z = (a+b)//2
    cnt += 1
    if x % 2 == 1 or y % 2 == 1 or z % 2 == 1:
        break
    a,b,c = x,y,z
print(cnt)

Solution (Python):
def solve():
  a,b,c = (int(i) for i in input().split())
  queue = [[a,b,c]] 
  ct = 0
  while ct <100000000:
    if a%2 ==1 or b%2 ==1 or c%2 == 1: break
    
    tmpa = a//2
    tmpb = b//2
    tmpc = c//2
    a = tmpb+tmpc
    b = tmpa+tmpc
    c = tmpa+tmpb
    if [a,b,c] in queue: 
      return -1
    else:
      ct += 1
      queue.append([a,b,c])
      
  return ct
                   
  
if __name__ == '__main__':
  print(solve())

Solution (Python):
def solve(a, b, c, ans):
    if (a, b, c) in s:
        return -1
    if (a % 2) or (b % 2) or (c % 2):
        return ans
    s.add((a, b, c))
    a >>= 1
    b >>= 1
    c >>= 1
    return solve(b + c , c + a, a + b, ans + 1)

if __name__ == '__main__':
    a, b, c = map(int, input().split())
    s = set()
    print(solve(a, b, c, 0))

Solution (Python):
a,b,c=map(int,input().split())
l=[]
count=0
if any([a%2==1,b%2==1,c%2==1]):
    print(0)
    exit()
while True:
    a,b,c=a//2,b//2,c//2
    a,b,c,=b+c,a+c,a+b
    count+=1
    if any([a%2==1,b%2==1,c%2==1]):
        print(count)    
        exit()
    elif [a,b,c]in l:
        print(-1)
        exit()
    l.append([a,b,c])

Solution (Python):
a,b,c=map(int,input().split())
l=[]
count=0
if any([a%2==1,b%2==1,c%2==1]):
    print(0)
    exit()
while True:
    a,b,c=a//2,b//2,c//2
    a,b,c,=b+c,a+c,a+b
    count+=1
    if any([a%2==1,b%2==1,c%2==1]):
        print(count)    
        exit()
    elif [a,b,c]in l:
        print(-1)
        exit()
    l.append([a,b,c])

Solution (Python):
cookie = list(map(int, input().split()))

cookie.sort()

count = 0
if cookie[0] == cookie[2] and cookie[0] % 2 == 0:
    print(-1)
    exit()
    
while cookie[2] - cookie[0] > 0:
    if cookie[0] % 2 == 1 or cookie[1] % 2 == 1 or cookie[2] % 2 == 1:
        print(count)
        exit()
    if cookie[0] == cookie[2]:
        print(-1)
        exit()
    count += 1
    a = (cookie[1] + cookie[2]) // 2
    b = (cookie[2] + cookie[0]) // 2
    c = (cookie[0] + cookie[1]) // 2
    cookie[0] = a
    cookie[1] = b
    cookie[2] = c
    cookie.sort()

print(count)

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

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

if a % 2 == 1 and b % 2 == 1 and c % 2 == 1:
  print(0)
elif a == b and b == c:
  print(-1)
else:
  _a, _b, _c = a, b, c
  ai = 0
  while True:
    if _a % 2 == 0:
      _a //= 2
      ai += 1
    else:
      break
  bi = 0
  while True:
    if _b % 2 == 0:
      _b //= 2
      bi += 1
    else:
      break
  ci = 0
  while True:
    if _c % 2 == 0:
      _c //= 2
      ci += 1
    else:
      break
  min2 = min(ai, bi, ci)
  div2 = pow(2, min2)
  a //= div2
  b //= div2
  c //= div2
  if (a + b) % 2 == 0 and (a + c) % 2 == 0 and (c + b) % 2 == 0:
    min2 += 1
  print(min2)

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

ans = 0
while not(A%2 or B%2 or C%2):
    A,B,C = B//2+C//2, A//2+C//2, A//2+B//2
    if(A == B == C):
        print(-1)
        exit()
    ans += 1
print(ans)

Solution (Python):
def inpl(): return list(map(int, input().split()))
A, B, C = inpl()

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

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

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

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

res = -1
for i in range(10 ** 6):
    tmp1 = B//2 + C//2
    tmp2 = A//2 + C//2
    tmp3 = B//2 + C//2
    if A%2 == 1 or B%2 == 1 or C%2 == 1:
        res = i
        break
    A = tmp1
    B = tmp2
    C = tmp3
    
print(res)

Solution (Python):
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:
        x = (b+c)//2
        y = (a+c)//2
        z = (a+b)//2
        a=x
        b=y
        c=z
        ans+=1
    print(ans)

Solution (Python):
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:
    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)

Solution (Python):
BIG_NUM = 10**18
is_even = lambda x: x%2==0
def two_count(x):
    if x == 0:
        return BIG_NUM
    c = 0
    while x and x%2 == 0:
        x //= 2
        c += 1
    return c
    
A, B, C = map(int, input().split(" "))

if all(map(is_even, [A, B, C])):
    a2, b2, c2 = (B+C)//2, (C+A)//2, (A+B)//2    
    n = min(map(two_count, [A-a2, B-b2, C-c2]))
    if n == BIG_NUM:
        print(-1)
    else:
        print(n+1)
else:
    print(0)

Solution (Python):
a,b,c=map(int,input().split())
if a==b and b==c and a%2!=1:
    print(-1)
else:
    s=a+b+c
    d=0
    j=0
    while a%2!=1 and b%2!=1 and c%2!=1:
        d+=1
        h=s
        j=a
        a=(s-a)//2
        b=j//2+c//2
        c=h-a-b
    print(d)

Solution (Python):
def solve(A, B, C):
    ans = 0
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        ans += 1
        pA, pB, pC = A, B, C
        A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
        if pA == A and pB == B and pC == C:
            return -1
    return ans


if __name__ == "__main__":
    A, B, C = tuple(map(int, input().split(" ")))
    print(solve(A, B, C))

Solution (Python):
def log_2(n):
    t = 0
    while n:
        if n % 2 == 1:
            break
        t += 1
        n //= 2
    return t


def solve(A, B, C)->int:

    s = A+B+C
    odd = min(log_2(s-A), log_2(s-B), log_2(s-C))
    even = min(log_2(s+A), log_2(s+B), log_2(s+C))

    if odd == even:
        return odd
    else:
        return odd+1


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

ans = 0
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    ans = 0
elif A == B == C:
    ans = -1
else:
    ans = solve(A, B, C)
print(ans)

Solution (Python):
def log_2(n):
    t = 0
    while n:
        if n % 2 == 1:
            break
        t += 1
        n //= 2
    return t


def solve(A, B, C)->int:

    s = A+B+C
    odd = min(log_2(s-A), log_2(s-B), log_2(s-C))
    even = min(log_2(s+A), log_2(s+B), log_2(s+C))

    if odd == even:
        return odd
    else:
        return odd+1


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

ans = 0
if A % 2 == 1 or A % 2 == 1 or A % 2 == 1:
    ans = 0
elif A == B == C:
    ans = -1
else:
    ans = solve(A, B, C)
print(ans)

Solution (Python):


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B, C = MAP()

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

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

Solution (Python):
import sys
a, b, c = map(int, input().split())
if a == b and b == c and a % 2 == 0:
    print(-1)
    sys.exit(0)
count = 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
    count += 1
print(count)

Solution (Python):
nums = list(map(int, input().split()))

ans = 0
while True:
    
    if any(map(lambda x:x%2, nums)):
        break
    
    if nums[0] == nums[1] == nums[2]:
        ans = -1
        break
    s = sum(nums)
    nums = [(s-i)/2 for i in nums]
    ans += 1
print(ans)

Solution (Python):
a, b, c = list(map(int, input().split()))
if a%2 or b%2 or c%2:
    print("0")
    exit()
aa = [a, (b+c)/2]
bb = [b, (c+a)/2]
cc = [c, (a+b)/2]
ans = []
for li in [aa,bb,cc]:
    DP = li
    if DP[0] == DP[1]:
        can = -1
        ans.append(can)
        continue
    can = 1
    while True:
        next = sum(DP)
        if next %2:
            break
        else:
            DP = [DP[0], next/2]
            can += 1
    ans.append(can)

hoge = -1
ans.sort()
for i in ans:
    if i > 0:
        hoge=i
        break
print(hoge)

Solution (Python):
a,b,c = map(int,input().split(" "))
count = 0
if a == b and b == c:
    if a % 2 == 0:
        print(-1)
    else:
        print(0)
else:
    while True:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            print(count)
            break
        else:
            a,b,c = (b+c)//2,(a+c)//2,(a+b)//2
            count += 1

Solution (Python):
def lma():return list(map(int, input().split()))
a = lma()
f = 1
c =0
while f:
    if a[0]%2==1 or a[1]%2==1 or a[2]%2 ==1:break
    if (a[0] == a[1] and a[0] == a[2]) :
        c=-1
        break
    a[0],a[1],a[2] = (a[1]+a[2])/2,(a[0]+a[2])/2,(a[1]+a[0])/2
    c+=1
print(c)

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

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

if a==b and b==c and a%2==0:
    print(-1)
else:
    f = 1
    ans = 0
    while 1:
        if a%2==1 or b%2==1 or c%2==1:
            break
        else:
            a2 = b//2 + c//2
            b2 = a//2 + c//2
            c2 = a//2 + b//2
            a = a2
            b = b2
            c = c2
            ans = ans+1
        
    print(ans)

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

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

else:
    for i in range(1000000):
        if A%2==1 or B%2==1 or C%2==1:
            print(i)
            exit()
        else:
            a=int((B+C)/2)
            b=int((C+A)/2)
            c=int((A+B)/2)
            A=a
            B=b
            C=c