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):
import sys
from collections import deque
import copy


def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A, B, C] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    A_arr = [A, (B + C)/2]
    B_arr = [B, (A + C)/2]
    C_arr = [C, (B + A)/2]
    i = 0
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        print 0
        exit()
    if (B + C) % 2 == 1 or (A + C) % 2 == 1 or (B + A) % 2 == 1:
        print 1
        exit()
    if A_arr[0] == A_arr[1] and B_arr[0] == B_arr[1] and C_arr[0] == C_arr[1]:
        print -1
        exit()

    while 1:
        if i >= 2:
            A_arr.append((A_arr[i - 1] + A_arr[i - 2])/2)
            B_arr.append((B_arr[i - 1] + B_arr[i - 2])/2)
            C_arr.append((C_arr[i - 1] + C_arr[i - 2])/2)
        if A_arr[i] % 2 == 1 or B_arr[i] % 2 == 1 or C_arr[i] % 2 == 1:
            break;

        i += 1
    print i
if __name__ == '__main__':
    main()

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

print(ans)

Solution (Python):


import sys, math, copy




HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    a, b, c = map(int, input().split())
    a, b, c = sorted([a, b, c])
    for i in range(10000):
        if (a % 2) + (b % 2) + (c % 2) > 0:
            return i
        a, b, c = (a + b) // 2, (a + c) // 2, (b + c) // 2
    return -1

print(main())

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

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

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

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

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

gokei = A + B + C
ans = 0

if A == B == C and all(map(lambda x: x % 2 == 0, (A, B, C))):
    print(-1)
else:
    while all(map(lambda x: x % 2 == 0, (A, B, C))):
        A = (gokei - A) / 2
        B = (gokei - B) / 2
        C = (gokei - C) / 2
        ans += 1
    print(ans)

Solution (Python):
a,b,c = (int(i) for i in input().split())
if a==b==c and a%2==0: print(-1)
else:
	answer = 0
	while all(i%2==0 for i in [a,b,c]):
		a,b,c = (b+c)//2,(c+a)//2,(a+b)//2
		answer += 1
	print(answer)

Solution (Python):
A,B,C = map(int, input().split())
count = 0
while True:
    if A%2==1 or B%2==1 or C%2==1:
        print(count)
        break
    if A==B and A==C:
        print(-1)
        break
    A, B, C = (B+C)/2, (A+C)/2, (A+B)/2
    count += 1

Solution (Python):


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

iter = 0

while True:
    if (A % 2 == 1) or (B % 2 == 1) or (C % 2 == 1):
        break

    X, Y, Z = (B + C) / 2, (A + C) / 2, (B + C) / 2
    A, B, C = X, Y, Z
    iter += 1

    if iter > 1000000:
        iter = -1
        break

print(iter)

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

if A == B == C and all(map(lambda x: x%2==0, [A, B, C])):
    print(-1)
else:
    ans = 0
    cookie = A+B+C
    while True:
        if all(map(lambda x: x%2==0, [A, B, C])):
            ans += 1
        else:
            print(ans)
            break
        A = (cookie-A) / 2
        B = (cookie-B) / 2
        C = (cookie-C) / 2

Solution (Python):
A, B, C = map(int, input().split())
count = 0
while True:
    if (A == B == C) and (A%2 == 0):
        print("-1")
        exit()
    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
        count += 1
print(count)

Solution (Python):
def count(seq):
    seq = sorted(seq)
    arrived = {}
    arrived[seq[0]] = {}
    arrived[seq[0]][seq[1]] = True
    foo = 0
    s = sum(seq)
    while True:
        if (seq[0]&1==1) or (seq[1]&1==1) or (seq[2]&1==1):
            break
        seq = [(s-seq[i])>>1 for i in xrange(3)]
        seq = sorted(seq)
        if seq[0] in arrived.keys():
            if seq[1] in arrived[seq[0]].keys():
                foo = -1
                break
        else:
            arrived[seq[0]] = {}
        arrived[seq[0]][seq[1]] = True
        foo += 1
    return foo

def main():
    seq = [int(x) for x in raw_input().strip().split()]
    print count(seq)

if __name__ == '__main__':
    main()

Solution (Python):

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

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

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

count=0
befA=0
befB=0
befC=0

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

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

while(a%2==0 and b%2==0 and c%2==0):
    befA=a
    befB=b
    befC=c
    a=befB/2+befC/2
    b=befA/2+befC/2
    c=befA/2+befB/2
    count+=1

print(count)

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

Solution (Python):
abc = list(map(int, input().split()))
if len(set(abc)) == 1 and abc[0] % 2 == 0:
    print(-1)
    quit()
count = 0
for i in range(10**5):
    even = [i // 2 for i in abc if i % 2 == 0]
    if len(set(even)) == 3:
        count += 1
        abc = [even[0] + even[1], even[1] + even[2], even[2] + even[0]]
    else:
        print(count)
        quit()

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

count = 0
while True:
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        new_a = int(b/2) + int(c/2)
        new_b = int(a/2) + int(c/2)
        new_c = int(b/2) + int(a/2)
    else:
        break
    if a == new_a and b == new_b and c == new_c:
        count = -1
        break
    else:
        count += 1
        a = new_a
        b = new_b
        c = new_c
print(count)

Solution (Python):
A, B, C = map(int, raw_input().split())
a = abs(A - B)
b = abs(B - C)
c = abs(C - A)
count = 0
if ((A | B | C) & 1 == 0):
    while((a | b | c) & 1 == 0):
        if(a + b + c) == 0:
            count = -1
            break
        a /= 2
        b /= 2
        c /= 2
        count = count + 1
print count

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def solve(a, b, c):
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        return 0

    a2 = a // 2
    b2 = b // 2
    c2 = c // 2

    return solve(b2 + c2, a2 + c2, a2 + b2) + 1


def main():
    A, B, C = map(int, input().split())
    if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
        print(0)
        return
    if A == B == C:
        print(-1)
        return

    print(solve(A, B, C))


if __name__ == '__main__':
    main()

Solution (Python):

def Solve(T):
	H = set()
	T = tuple(T)
	N = 0
	while True:
		if T in H:
			N = -1
			break
		if (T[0] | T[1] | T[2]) & 1:
			break
		H.add(T)
		T = ( (T[1] + T[2]) >> 1, (T[2] + T[0]) >> 1, (T[0] + T[1]) >> 1)
		N += 1
	print(N)

Solve([int(i) for i in input().split()])

Solution (Python):
def cookie_exchanges():
	a, b, c = map(int, raw_input().split(" "))
	if a%2==1 or b%2==1 or c%2==1:
		print 0
		return
	ans = 0
	while True:
		if a==b and b==c:
			print -1
			return
		_a = a
		_b = b
		_c = c
		a = (_b+_c)/2
		b = (_a+_c)/2
		c = (_a+_b)/2
		
		ans+=1
		if a%2==1 or b%2==1 or c%2==1:
			print ans
			return

if __name__ == "__main__":
	cookie_exchanges()

Solution (Python):
a,b,c=map(int,input().split())
if a&1 or b&1 or c&1:
	print("0")
elif a==b and b==c:
	print("-1")
else:
	k=1
	while a%(1<<k)==b%(1<<k) and b%(1<<k)==c%(1<<k):
		k+=1
	print(k-1)

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

if len({A, B, C}) == 1 and A % 2 == 0:
    print(-1)
else:
    numbers = [A, B, C]
    ans = 0

    while True:
        next_numbers = [0, 0, 0]
        next = True
        for i in range(3):
            if numbers[i] % 2 != 0:
                next = False
            else:
                next_numbers[i] = (numbers[(i + 1) % 3] + numbers[(i + 2) % 3]) // 2
        if not next:
            break
        ans += 1
        numbers = next_numbers
    print(ans)

Solution (Python):
from collections import defaultdict


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





cnt = 0
ans = 0
while True:
     if A %2 == 1 or B % 2 == 1 or C % 2 == 1:
         ans = cnt
         break
     if d[str([A, B, C])] == 1:
         ans = -1
         break
     else:
         d[str([A, B, C])] = 1
     cnt += 1
     A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2

print(ans)

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

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

i=0
while True:
    if a%2==1 or b%2==1 or c%2==1:
        print(i)
        sys.exit()
    else:
        d=(b+c)/2
        e=(a+c)/2
        f=(b+c)/2
        a=d
        b=e
        c=f
        i+=1

Solution (Python):
x, y, z = map(int, input().split())

ret = 0
while not(x % 2 == 1 or y % 2 == 1 or z % 2 == 1):
    ret += 1
    x, y, z = y//2+z//2, z//2+x//2, x//2+y//2
    if ret > 10000:
        ret = -1
        break;

print(ret)

Solution (Python):

import math
import sys
import itertools
import numpy as np
import functools
import collections
mo = 1000000007
r = range

x, y, z = map(int, input().split())

ret = 0
while not(x % 2 == 1 or y % 2 == 1 or z % 2 == 1):
    ret += 1
    x, y, z = y//2+z//2, z//2+x//2, x//2+y//2
    if ret > 10000:
        ret = -1
        break;

print(ret)

Solution (Python):

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

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

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

    a, b, c = (a + b) // 2, (b + c) // 2, (a + c) // 2
    it += 1
print -1

Solution (Python):
cookies = map(int, raw_input().split())
count = 0
while cookies[0]%2 == 0 and cookies[1]%2 == 0 and cookies[2]%2 == 0:
  if cookies[0] == cookies[1] and cookies[0] == cookies[2]:
    count = -1
    break
  count += 1
  a = cookies[1]/2 + cookies[2]/2
  b = cookies[0]/2 + cookies[2]/2
  c = cookies[0]/2 + cookies[1]/2
  cookies = [a,b,c]
  
print count

Solution (Python):
a,b,c = [int(x) for x in input().split(' ')]
power = [0 for x in range(3)]
left = [0 for x in range(3)]

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

for index,value in enumerate([a,b,c]):
    store = value
    while store % 2 == 0:
        power[index] += 1
        store = store / 2
    left[index] = store
if min(power) != max(power):
    print(min(power))
else:
    inf = True
    r = left[0] % 4
    for value in left:
        if value % 4 != r:
            inf = False
            break
    if inf:
        print(-1)
    else:
        print(power[0] + 1)

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

def any_odd(x, y, z):
    if x % 2 or y % 2 or z % 2:
        return True
    else:
        return False

def exchange(a, b, c):
    new_a = b // 2 + c // 2
    new_b = a // 2 + c // 2
    new_c = a // 2 + b // 2
    return new_a, new_b, new_c


if a == b == c and (a + b + c) % 3 == 0 and not any_odd(a, b, c):
    print -1
else:
    k = 0
    while not any_odd(a, b, c):
        a, b, c = exchange(a, b, c)
        k += 1
    print k

Solution (Python):
A, B, C = map(int, raw_input().split())
[A, B, C] = sorted([A, B, C])
ans = 0
while A%2==0 and B%2==0 and C%2==0:
	ans += 1
	new1, new2, new3 = B/2 + C/2, A/2 + C/2, A/2 + B/2
	if new1 == new3:
		ans = -1
		break
	else:
		A, B, C = new1, new2, new3
print ans

Solution (Python):
L = input().split(" ")
A = int(L[0])
B = int(L[1])
C = int(L[2])
count = 0

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

Solution (Python):
import pdb
a,b,c = map(int, raw_input().strip().split(' '))
if a==b==c:
    if a%2==0:
        print -1
    else:
        print 0
elif a%2!=0 or b%2!=0 or c%2!=0:
    print 0
else:
    Flag = True
    cnt = 0
    for i in range(100000):
        tmp1,tmp2=a,b
        a = b/2+c/2
        b = tmp1/2+c/2
        c = tmp1/2+tmp2/2
        cnt += 1

        if a%2!=0 or b%2!=0 or c%2!=0:
            Flag = False
            break
    if Flag:
        print -1
    else:
        print cnt

Solution (Python):
A, B, C = map(int, raw_input().split())
[A, B, C] = sorted([A, B, C])

cnt = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    cnt += 1
    r = [(A + B) / 2, (A + C) / 2, (B + C) / 2]
    [A, B, C] = r;
    if A == C:
        cnt = -1
        break

print cnt

Solution (Python):


arr = map(int,  raw_input().split(" "))

def exchange(arr):
    result=[]
    harf=[i/2 for i in arr]
    for i in range(len(arr)):
        result.append(sum(harf)-harf[i])
        
    return result

def odd_check(arr):
    result=True
    for i in arr:
        if i%2==1:
            result=False
    return result


ans=0
loop=[]
while odd_check(arr):
    loop.append(arr[:])
    arr = exchange(arr)
    ans += 1
    if arr in loop:
        ans = -1
        break
        
print(ans)

Solution (Python):



a, b, c = map(int, raw_input().split())
for i in range(10000):
	if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
		print(i)
		quit()
	a, b, c = b / 2 + c / 2, a / 2 + c / 2, a / 2 + b / 2
print(-1)

Solution (Python):
a , b , c = map(int , raw_input().split())
ans = 0
while not ((a & 1) | (b & 1) | (c & 1)):
	a , b , c = (b + c) >> 1 , (a + c) >> 1 , (a + b) >> 1
	ans += 1
	if ans > 1 << 15:
		ans = -1
		break
print ans

Solution (Python):
a,b,c = map(int, raw_input().split())
cnt = 0
l = [(a,b,c)]
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    cnt += 1
    na = (b+c) / 2
    nb = (a+c) / 2
    nc = (a+b) / 2
    if (na,nb,nc) in l:
        cnt = -1
        break
    else:
        l.append((na,nb,nc))
    a = na
    b = nb
    c = nc
print cnt

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

Solution (Python):
a, b, c = sorted(map(int, input().split()))
states = set()
cnt = 0
while True:
    if a % 2 or b % 2 or c % 2:
        break
    state = tuple(sorted([a, b, c]))
    if state in states:
        cnt = -1
        break
    states.add(state)
    a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2
    cnt += 1
print(cnt)

Solution (Python):

import sys

a,b,c=map(int,raw_input().split())
if a%2 or b%2 or c%2:
 print 0
 sys.exit()
if a==b and b==c:
 print -1
 sys.exit()

i=0
while True:
 ta=(b+c)/2
 tb=(c+a)/2
 tc=(a+b)/2
 a=ta
 b=tb
 c=tc
 i+=1
 if a%2 or b%2 or c%2:
  print i
  break

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

k=0
h=[]
while a/2*2==a and b/2*2==b and c/2*2==c:
    an=(b+c)/2
    bn=(c+a)/2
    cn=(a+b)/2
    a=an
    b=bn
    c=cn

    if [a,b,c] in h:
        k=-1
        break
    h.append([])
    h[k].append(a)
    h[k].append(b)
    h[k].append(c)
            
    k=k+1
    
print(k)

Solution (Python):
cookie = input().split()
A,B,C = int(cookie[0]),int(cookie[1]),int(cookie[2])
kaisuu = 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
    if A == B and B == C and A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        kaisuu = -1
        break
    else:
        kaisuu += 1
print(kaisuu)

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

if S[0] == S[1] == S[2] and S[0] % 2 == 0:
    print("-1")

else:
    counter = 0

    while True:

        if S[0]%2 != 0 or S[1]%2 != 0 or S[2]%2 != 0:
            print (counter)
            break

        else:
            counter +=1;
            B = list(S)
            S[0] = (B[1]/2) + (B[2]/2)
            S[1] = (B[0]/2) + (B[2]/2)
            S[2] = (B[0]/2) + (B[1]/2)

Solution (Python):
A,B,C=map(int,raw_input().strip().split())
if A==B and A==C:
    if A%2==0:
        print -1
    else:
        print 0
else:
    ans = 0
    while A%2==B%2==C%2==0 and ans<10000:
        tmp1,tmp2 = A,B
        A = B/2 + C/2
        B = tmp1/2+C/2
        C = tmp1/2+tmp2/2
        ans += 1
    print -1 if ans == 10000 else ans

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

for i in range(10 ** 5):
    if A % 2 or B % 2 or C % 2:
        print(i)
        break
    A, B, C = B // 2 + C // 2, C // 2 + A // 2, A // 2 + B // 2
else:
    print(-1)

Solution (Python):
import sys

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

    if a & 1 or b & 1 or c & 1:
        print(0)
        return

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

    cnt = 0

    while True:
        if a & 1 or b & 1 or c & 1:
            print(cnt)
            return

        a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
        cnt += 1

if __name__ == '__main__':
    solve()

Solution (Python):
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)
cnt = 0
while True:
    if a % 2 or b % 2 or c % 2:
        break;
    if a == b and b == c:
        cnt = -1;
        break
    ta = b / 2 + c / 2
    tb = a / 2 + c / 2
    tc = a / 2 + b / 2
    a = ta
    b = tb
    c = tc
    cnt += 1
print (cnt)

Solution (Python):
cookie = [int(i) for i in input().split() ]
cnt = 0
a = cookie[0]
b = cookie[1]
c = cookie[2]
x = 0
y = 0
z = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    if a == 1 and b == 1 and c == 1:
        break
    if a == b and a == c:
        break
    x = (b + c)//2
    y = (a + c)//2 
    z = (a + b)//2
    cnt += 1
    a = x
    b = y 
    c = z
    x = 0
    y = 0
    z = 0
if a  == 1 and b == 1 and c == 1: 
        print("0")
elif a == b and a == c:
    print("-1")
else:
    print(cnt)

Solution (Python):
n = map(int, raw_input().split())
m = [0, 0, 0]


count = 0
while True:
    for i in range(3):
        if n[i]%2 == 1:
            print count
            exit()
    if n[0] == n[1] and n[1] == n[2]:
        print -1
        exit()
    for i in range(3):
        m[i]=(n[(i+1)%3]/2)+(n[(i+2)%3]/2)
    for i in range(3):
        n[i] = m[i]
    count += 1

Solution (Python):
def a():
    A, B, C = list(map(int, input().split()))
    cnt = 0
    rcd = []
    while True:
        if A%2==1 or B%2==1 or C%2==1:
            break
        if [A,B,C] in rcd:
            cnt = -1
            break
        rcd.append([A,B,C])
        A, B, C = B/2+C/2, A/2+C/2, A/2+B/2 
        cnt += 1
    print(cnt)
    return

a()

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

counter = 0
while True:
	if a% 2 != 0 or b% 2!= 0 or c% 2 != 0:
		print(counter)
		break
	else:
		new_b = a//2 + c//2
		new_c = a//2 + b//2
		a = b//2 + c//2
		b = new_b
		c = new_c
		counter += 1
	if counter >= 100000:
		print('-1')
		break

Solution (Python):


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

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

Solution (Python):
 

 
a, b, c = [int(e) for e in input().split()]






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

Solution (Python):
import copy

ABC = list(map(int, input().split()))

ABC.sort()
ABC0=copy.deepcopy(ABC)


def check(x_list):
    sum=0
    for i in x_list:
        sum+=(i%2)
    if sum>0:
        return False
    else:
        return True

def ido(x_list):
    new_list=[x/2 for x in x_list]
    r_list=[]
    for i in range(3):
        r_list.append(new_list[i%3]+new_list[(i+1)%3])
    r_list.sort()
    return r_list

    
count =0    

while check(ABC0):
    ABC0=ido(ABC0)
    count+=1
    if ABC==ABC0:
        count=-1
        break
print(count)

Solution (Python):
a,b,c=map(int,raw_input().split())
z=0
if a%2==1 or b%2==1 or c%2==1:
    z=0
else:
 while a!=b or b!=c or a!=c:
    l=[a,b,c]
    l.sort()
    if a%2==1 or b%2==1 or c%2==1:
        break
    else:
        an=b/2+c/2
        bn=a/2+c/2
        cn=a/2+b/2
        ln=[an,bn,cn]
        ln.sort()
        if ln==l:
            z=-1
            break
        else:
            a,b,c=ln
            z+=1
 if a==b and a==c:
    z=-1
print z

Solution (Python):

a = [ int(i) for i in input().split() ]

cnt=0
if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1:
    pass
elif a[0] == a[1] and a[1] == a[2]:
    cnt=-1
else:
    while True:
        if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1: break
        cnt += 1
        a[0], a[1], a[2] = (a[1]+a[2])/2 , (a[0]+a[2])/2, (a[0]+a[1])/2

print(cnt)

Solution (Python):
A1,B1,C1=list(map(int,input().split()))
ki=0
A=A1
B=B1
C=C1
while A%2==0 and B%2==0 and C%2==0:
    ki+=1
    ka=A
    kb=B
    A=(B+C)/2
    B=(ka+C)/2
    C=(ka+kb)/2
    if A==A1 and B==B1 and C==C1:
        ki=-1
        A=1
print(ki)

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

init = [A, B, C]
current = [A, B, C]

if A & 1 or B & 1 or C & 1:
    print(0)
elif (A == B and B == C):
    print(-1)
else:
    answer = 0
    while True:
        answer += 1
        a = current[0] / 2
        b = current[1] / 2
        c = current[2] / 2
        current = [b + c, a + c, b + c]
        if current[0]&1 or current[1]&1 or current[2]&1:
            break
    print(answer)

Solution (Python):
from enum import Enum


class Judge(Enum):
    OK        = 1
    END_ODD   = 2
    END_INF   = 3


def judge_cookie(X):
    if X % 2 == 0:
        result = True
    else:
        result = False

    return result


def devide_cookie(X):
    return X//2


def exchange_cookie(A, B, C):
    if judge_cookie(A) and judge_cookie(B) and judge_cookie(C):
        
        AA = devide_cookie(B) + devide_cookie(C)
        BB = devide_cookie(A) + devide_cookie(C)
        CC = devide_cookie(A) + devide_cookie(B)

        if A == AA and B == BB and C == CC:
            result = Judge.END_INF
        else:
            result = Judge.OK

    else:
        
        AA = BB = CC = 0
        result = Judge.END_ODD

    return result, AA, BB, CC


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

Count = 0
while True:
    J, AA, BB, CC = exchange_cookie(A, B, C)
    if J == Judge.OK:
        Count += 1
        A = AA
        B = BB
        C = CC
    elif J == Judge.END_INF:
        Ans = -1
        break
    else:
        Ans = Count
        break

print(Ans)

Solution (Python):
def sort(n1, n2, n3):
	n=[n1, n2, n3]
	t=len(n)
	for i in range(t-1):
		for j in range(i+1, t):
			if n[i] > n[j]:
				n[i],n[j] = n[j],n[i]
	return n

if __name__ == '__main__':
	A, B, C=map(int, input().split())
	N=0
	arr=[]
	flag=1
	if(A%2==1 or B%2==1 or C%2==1):
		flag=0

	while(flag):
		A, B, C = sort(A,B,C)
		arr.append([A,B,C])
		sum = A+B+C
		A=(sum-A)/2
		B=(sum-B)/2
		C=(sum-C)/2
		N+=1
		if(A%2==1 or B%2==1 or C%2==1):
			flag=0
		for i in range(len(arr)-1):
			if(arr[i] == [A,B,C]):
				flag = 0
				N=-1
	print(N)

Solution (Python):
num = list(map(int, input().split()))
num.sort()
first_num = num[:]

count = 0
while num[0]%2==0 and num[1]%2==0 and num[2]%2==0:
    a = num[0]//2
    b = num[1]//2
    c = num[2]//2

    num[0] = b + c
    num[1] = c + a
    num[2] = a + b
    num.sort()

    if num == first_num:
        count = -1
        break
    else:
        count += 1

print(count)

Solution (Python):
def gcd(a, b):
	while b % a:
		b %= a
		a, b = (b, a)
	return a

C = [int(i) for i in input().split()]
m = min(C)
for i in range(3):
	if C[i]%2:
		print(0)
		exit()
	C[i] -= m

C.sort()
if C[2] == 0:
	print(-1)
	exit()
t = C[2]
for c in C:
	t = gcd(t, c)
ans = 0
while not t%2:
	ans += 1
	t //= 2
print(ans)

Solution (Python):

def dot_v(a,b):
    sum=0
    for i in range(len(a)):
        sum+=a[i]*b[i]
    return sum

def dot(A,x):
    xx=[0]*len(x)
    for i in range(len(A)):
        xx[i]=dot_v(A[i],x)

    return xx


x=list(map(int,input().split(" ")))
A=[[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]
count=0
flg=False
equal=False
for i in range(10**6):
    if x[0]==x[1] and x[1]==x[2]:
        if x[0]%2==0:
            equal=True
            break
    for sx in x:
        if (sx%2)!=0:
            flg=True
            break
    if flg:
        break
    count+=1
    x=dot(A,x)
    
    if i==10**6-1:
        equal=True


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

Solution (Python):
A, B, C = map(int, input().split())
a = [0]
b = [0]
c = [0]
i = 0
flag = 0

a[0] = A
b[0] = B
c[0] = C

if A == B and B == C and A % 2 == 0:
	print(-1)
else:
	while flag == 0:
		if a[i] % 2 == 0 and b[i] % 2 == 0 and c[i] % 2 == 0:
			x = (b[i] + c[i]) / 2
			y = (a[i] + c[i]) / 2
			z = (b[i] + a[i]) / 2
			a.append(x)
			b.append(y)
			c.append(z)
			i += 1
		else:
			flag = 1
	print(i)

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

    a = A
    b = B
    c = C
    i = 0
    while True:
        if a % 2 > 0 or b % 2 > 0 or c % 2 > 0:
            break
        elif A == B == C:
            i = -1
            break
        else:
            now_a = (b + c) / 2
            now_b = (a + c) / 2
            now_c = (a + b) / 2
            a = now_a
            b = now_b
            c = now_c
            i += 1
    print(i)

main()

Solution (Python):
def solve(a, b, c):
    memo = set()

    cnt = 0
    while all(x % 2 == 0 for x in (a, b, c)):
        if (a, b, c) in memo: return -1
        memo.add((a, b, c))

        t = a + b + c
        a, b, c = ((t - x) // 2 for x in (a, b, c))
        cnt += 1

    return cnt


if __name__ == '__main__':
    ht = {}

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

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

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


def check(n):
    x = 2 ** n
    y = x // 3
    if x % 3 == 1:
        for i in range(3):
            adds = [y] * 3
            adds[i] += 1
            tmp = (A * adds[0] + B * adds[1] + C * adds[2]) / x
            if int(tmp) != tmp:
                return False
    else:
        for i in range(3):
            adds = [y] * 3
            adds[i] += 1
            adds[(i + 1) % 3] += 1
            tmp = (A * adds[0] + B * adds[1] + C * adds[2]) / x
            if int(tmp) != tmp:
                return False
    return True


for i in range(1, 1000):
    if not check(i):
        print(i - 1)
        exit()
print(-1)

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

if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    print '0'
elif A == B and B == C:
    print '-1'
else:
    i = 0
    while True:
        _A = (B + C)/2
        _B = (C + A)/2
        _C = (A + B)/2

        A = _A
        B = _B
        C = _C

        i += 1
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            print '%d' % i
            break

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

cnt = 0
while cnt < 27:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break
    tmpA = int(B / 2) + int(C / 2)
    tmpB = int(A / 2) + int(C / 2)
    tmpC = int(A / 2) + int(B / 2)

    cnt += 1
    if tmpA == A and tmpB == B and tmpC == C:
        print("-1")
        quit()
    A = tmpA
    B = tmpB
    C = tmpC

if cnt == 28:
    print("-1")
else:
    print(str(cnt))

Solution (Python):
A, B, C = map(int, input().split())
def cookies(a, b, c):
    return [(b+c)/2, (c+a)/2, (a+b)/2]

if A == B and B == C and (A%2) == 0:
    print('-1')
else:
    count = 0
    while True:
        if (A%2) or (B%2) or (C%2):
            break
        A, B, C = cookies(A, B, C)
        count += 1
    print(count)

Solution (Python):


a, b, c = map(int, raw_input().split())
cnt = 0

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

while True:
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        cnt += 1
        a_t = a / 2
        b_t = b / 2
        c_t = c / 2
        a = b_t + c_t
        b = a_t + c_t
        c = a_t + b_t
    else:
        break

print cnt