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:
def a_cookie_exchanges(A, B, C):
    if A == B == C:
        if A & 1 == 0:
            return -1  # 3数がすべて等しい偶数。無限回行える
        else:
            return 0  # 3数がすべて等しい奇数。1回も行えない
    # 操作は高々log_2(10^9)回なので、シミュレーションして構わない
    ans = 0
    while A & 1 == 0 and B & 1 == 0 and C & 1 == 0:
        A, B, C = (B + C) // 2, (C + A) // 2, (A + B) // 2
        ans += 1
    return ans 

A, B, C = [int(i) for i in input().split()]
print(a_cookie_exchanges(A, B, C))

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
 
li = [A, B, C]
 
def is_odd(x):
  return True if x % 2 == 1 else False
 
def has_odd(l):
  for x in l:
    if is_odd(x):
      return True
  return False
 
ans = 0
 
continue_loop = True
 
while continue_loop:
  if has_odd(li):
    break
  if li[0] == li[1] and li[1] == li[2]:
    ans = -1
    break
  a, b, c = (li[0], li[1], li[2])
  li[0] = (a + b) // 2
  li[1] = (a + c) // 2
  li[2] = (b + c) // 2
  ans += 1
 
print(ans)

Submission status: Accepted

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

li = [A, B, C]

def is_odd(x):
  return True if x % 2 == 1 else False

def has_odd(l):
  for x in l:
    if is_odd(x):
      return True
  return False

ans = 0

continue_loop = True

while continue_loop:
  if has_odd(li):
    break
  if li[0] == li[1] or li[1] == li[2] or li[2] == li[0]:
    ans = -1
    break
  a, b, c = (li[0], li[1], li[2])
  li[0] = (a + b) // 2
  li[1] = (a + c) // 2
  li[2] = (b + c) // 2
  ans += 1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

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)
        sys.exit(0)
    if A == B and B == C:
        print(-1)
        sys.exit(0)
    A, B, C = (B+C)//2, (A+C)//2, (A+B)//2
    count += 1
print(count)

Submission status: Accepted

Solution code:
import sys
def getinputdata():

    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

a = int(arr_data[0][0])
b = int(arr_data[0][1])
c = int(arr_data[0][2])

chkflg = True
cnt = 0

if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:

     chkflg = False

while chkflg:

    cnt += 1
    atemp = b // 2 + c // 2
    btemp = c // 2 + a // 2
    ctemp = a // 2 + b // 2
    
    
    if atemp == btemp and btemp == ctemp:
        
        cnt = -1
        chkflg = False
    
    elif atemp % 2 != 0 or btemp % 2 != 0 or ctemp % 2 != 0:
        
        chkflg = False
        
    else:
        
        a = atemp
        b = btemp
        c = ctemp
    

    
print(cnt)

Submission status: Accepted

Solution code:
def main():
    a, b, c = map(int, input().split())
    
    if a == b == c and a % 2 == 0: 
        print(-1)
    elif (a+b+c) % 2:
        print(0)
    else:
        d = [abs(a+b), abs(b+c), abs(c+a)]
        c = []
        for i in d:
            cnt = 0
            while i % 2 == 0 and i != 2:
                i //= 2
                cnt += 1
            c.append(cnt)
        
        print(min(c))
    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def count(n):
    cnt = 0
    m = 2
    if n % 2 == 0:
        cnt = 1
    while True:
        if n % 2 != 0:
            break
        n = n / m
        m += 2
        cnt += 1
    return cnt
def cokkie(a, b, c):
    cnt = 0
    a1 = a
    b1 = b
    c1 = c
    while True:
        if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
            break
        A = (b + c) / 2
        B = (c + a) / 2
        C = (a + b) / 2
        a = A
        b = B
        c = C
        if a1 == a and b1 == b and c1 == c:
            cnt = -1
            break
        cnt += 1
    return cnt
    
        
A, B, C = map(int, input().split())
list = [count(A), count(B), count(C), count(A + B), count(B + C), count(C + A)]
print(cokkie(A, B, C))

Submission status: Accepted

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

ABCList = [[A,B,C]]
mugen=False

while(A%2==0 and B%2==0 and C%2==0):
    tA,tB,tC = A,B,C
    A,B,C = (tB+tC)//2,(tA+tC)//2,(tA+tB)//2
    if [A,B,C] in ABCList:
        mugen=True
        break
    else:
        ABCList.append([A,B,C])

if mugen:
    print(-1)
else:
    print(len(ABCList)-1)

Submission status: Accepted

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

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

ans = 0
while A%2==0 and B%2==0 and C%2==0:
    D = (A+B)//2
    E = (B+C)//2
    F = (C+A)//2
    A = D
    B = E
    C = F
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=list(map(int,input().split()))
ans=0
while 1:
	if a&1 or b&1 or c&1:
		print(ans)
		break
	if a==b and b==c:
		print('-1')
		break
	ans+=1;
	d=(c+b)>>1
	e=(a+c)>>1
	f=(a+b)>>1
	a,b,c=d,e,f

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
for i in range(30):
    if a%2 == 0 and b%2 ==0 and c%2 == 0:
        d = int((a+b)/2)
        e = int((b+c)/2)
        f = int((a+c)/2)
        a,b,c = d,e,f
        count +=1
if count <30:
    print(count)
else:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

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())

Submission status: Accepted

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

if any(map(lambda x: x%2 == 1, (A, B, C))):
    print(0)
elif A == B == C:
    print(-1)
else:
    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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
a,b,c = (int(i) for i in input().split())
if a==b==c and a%2==0: print(-1)
else:
	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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
#! /usr/bin/python3

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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
a,b,c=map(int,input().split())
if a==b==c and a%2==0:
    print(-1)
    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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
while True:
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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()])

Submission status: Accepted

Solution code:
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
		# print a,b,c
		ans+=1
		if a%2==1 or b%2==1 or c%2==1:
			print ans
			return

if __name__ == "__main__":
	cookie_exchanges()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
from collections import defaultdict


d = defaultdict(int)
A, B, C = map(int, input().split())
# A, B, C = 14, 14, 14
# A, B, C = 4, 12, 20
# A, B, C = 454, 414, 444


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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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 cookies
print count

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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
#         pdb.set_trace()
        if a%2!=0 or b%2!=0 or c%2!=0:
            Flag = False
            break
    if Flag:
        print -1
    else:
        print cnt

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
# -*- encoding:utf-8 -*-

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)

Submission status: Accepted

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

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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#AGC014A
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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 # exchange
        cnt += 1
    print(cnt)
    return

a()

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
# coding: utf-8

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)

Submission status: Accepted

Solution code:
 # -*- coding: utf-8 -*-

 
a, b, c = [int(e) for e in input().split()]
# a, b, c = [4, 2, 1]
# a, b, c = [4, 12, 20]
# a, b, c = [454, 414, 444]
# a, b, c = [pow(10, 9), pow(10, 9), pow(10, 9)]
# a, b, c = [1, 1, 1]

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)