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

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
    # print(A, B, C)
    cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def lma():return list(map(int, input().split()))#x or y
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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


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


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

    # See:
    # https://www.youtube.com/watch?v=UHfTqvaD0pk
    print(f(a, b, c))


if __name__ == '__main__':
    main()

Submission status: Accepted

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


def main():
    a, b, c = map(int, input().split())
    ans = 0

    # See:
    # https://www.youtube.com/watch?v=UHfTqvaD0pk
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        print(0)
        exit()

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

    for i in range(1, 31):
        twice = 2 ** i
        tmp = twice % 3

        x = twice // 3
        y = x
        z = x

        if tmp == 2:
            y += 1
            z += 1
        elif tmp == 1:
            x += 1

        takahashi = a * x + b * y + c * z
        aoki = a * y + b * x + c * z
        snuke = a * z + b * y + c * x

        if takahashi % twice == 0 and aoki % twice == 0 and snuke % twice == 0:
            ans += 1
        else:
            print(ans)
            exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    """Function."""
    line = list(map(int, input().split()))

    counter = 0
    check = set()

    line.sort()
    last = tuple(line)
    check.add(last)
    for _ in range(10**8):
        a, b, c = last[0], last[1], last[2]
        if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
            print(counter)
            break

        else:
            temp_a, temp_b, temp_c = a//2, b//2, c//2
            dum = [temp_b+temp_c, temp_a+temp_c, temp_a+temp_b]
            dum.sort()
            last = tuple(dum)
            if last in check:
                print(-1)
                break
            else:
                counter += 1
                check.add(last)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
C_MAX = 30

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

t = 0
while t < C_MAX + 1 and (sum(1 for x in a if x % 2 == 1) == 0):
    t += 1
    a = list(int((sum(a) - x) / 2) for x in a)

if t > C_MAX:
    t = -1

print(t)

Submission status: Accepted

Solution code:
# coding:utf-8

import sys

input = sys.stdin.readline


def inpl(): return list(map(int, input().split()))


A, B, C = inpl()

ans = 0
if A == B == C and A % 2 == 0:
    ans = -1
else:
    while not (A % 2 or B % 2 or C % 2):
        ha, hb, hc = A // 2, B // 2, C // 2
        A, B, C = hb + hc, ha + hc, ha + hb
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
def operate(a,b,c,t):
    if not (a % 2 == 0 and b % 2 == 0 and c % 2 == 0):
        return t
    (a,b,c) = (b//2 + c//2,c//2 + a//2,a//2 + b//2)
    return operate(a,b,c,t+1)
if A == B == C and A % 2 == 0:
    ans = -1
else:
    ans = operate(A,B,C,0)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
if a%2==1 or b%2==1 or c%2==1:
    print(0)
    sys.exit()
for _ in range(int(1e5)):
    cnt += 1
    aa = (b+c)//2
    bb = (a+c)//2
    cc = (a+b)//2
    if aa%2==1 or bb%2==1 or cc%2==1:
        print(cnt)
        break
    a = aa
    b = bb
    c = cc
else:
    print(-1)

Submission status: Accepted

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

count = 0
while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        print(count)
        exit()
    if a == b == c:
        print("-1")
        exit()
    _a = a
    _b = b
    _c = c
    a = int(_b / 2 + _c / 2)
    b = int(_c / 2 + _a / 2)
    c = int(_b / 2 + _c / 2)
    count += 1
    # print("a:{} b:{} c:{} count:{}".format(a, b, c, count))

Submission status: Accepted

Solution code:
*before, = map(int, input().split())
for cnt in range(1 << 10):
    A, B, C = before
    if 1 in [A % 2, B % 2, C % 2]:
        print(cnt)
        exit()
    a = A // 2
    b = B // 2
    c = C // 2
    after = b + c, a + c, a + b
    if before == after:
        print(-1)
        exit()
    before = after

Submission status: Accepted

Solution code:
A, B, C = [int(_) for _ in input().split()]
if [A, B] == [B, C] and A % 2 == 0:
    print(-1)
    exit()
i = 0
while [A % 2, B % 2, C % 2] == [0, 0, 0]:
    A, B, C = (B + C) / 2, (C + A) / 2, (A + B) / 2
    i += 1
print(i)

Submission status: Accepted

Solution code:
A, B, C = [int(_) for _ in input().split()]
if [A - B, A - C] == [0, 0] and A % 2 == 0:
    print(-1)
    exit()
i = 0
while not any([A % 2, B % 2, C % 2]):
    A, B, C = (B + C) / 2, (C + A) / 2, (A + B) / 2
    i += 1
print(i)

Submission status: Accepted

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

def f(a, b, c, count):
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        count += 1
        return f(a/2+b/2, c/2+b/2, a/2+c/2, count)
    else:
        return count

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

Submission status: Accepted

Solution code:
l=[int(i) for i in input().split()]
chk=[0]*3
ans=0
st=100
while st:
    st-=1
    for i in range(3):
        for j in l:
            if j%2:
                print(ans)
                exit()
        if len(set(l))==1:
            print(-1)
            exit()
        chk[i]=l[(i+1)%3]//2+l[(i+2)%3]//2
    l=[i for i in chk]
    chk=[0]*3
    ans+=1

Submission status: Accepted

Solution code:
def inpl(): return [int(i) for i in input().split()]
def cookie(A, B, C):
    return((A+B)//2, (B+C)//2, (C+A)//2)
A, B, C = inpl()
ans = 0
while not A%2 and not B%2 and not C%2:
    A, B, C = cookie(A, B, C)
    ans += 1
    if ans == 10000:
        print(-1)
        break
else:
    print(ans)

Submission status: Accepted

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

for i in range(100):
    if A%2 or B%2 or C%2:
        print(i)
        exit()
    A,B,C = B//2+C//2, C//2+A//2, A//2+B//2
print(-1)

Submission status: Accepted

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

if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    for i in range(1,10**5):
        a2 = (b+c)//2
        b2 = (a+c)//2
        c2 = (a+b)//2
        a = a2
        b = b2
        c = c2
        if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
            res = 0
        else:
            res = i
            print(res)
            break
        if i == 10**5-1:
            print(-1)
else:
    print(0)

Submission status: Accepted

Solution code:
import sys


def next_str() -> str:
    result = ""
    while True:
        tmp = sys.stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


def next_int() -> int:
    return int(next_str())


def main() -> None:
    a = next_int()
    b = next_int()
    c = next_int()

    ans = 0
    dic = []

    flg = False
    while True:
        abc = sorted([a, b, c])
        if abc in dic:
            ans = -1
        for v in abc:
            if v % 2 != 0:
                flg = True
        if flg or ans < 0:
            break
        ans += 1
        dic += [abc]
        x = b // 2 + c // 2
        y = c // 2 + a // 2
        z = a // 2 + b // 2
        a, b, c = x, y, z

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

res = 0
s = set((a,b,c))
while True:
    if a%2==1 or b%2==1 or c%2==1:
        break
    res += 1
    a,b,c = b//2+c//2,a//2+c//2,a//2+b//2

    if (a,b,c) in s:
        # print(s,a,b,c)
        print(-1)
        exit()
    s.add((a,b,c))
print(res)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
ans = 0
for i in range(1000000000//5):
  if a%2 == 1 or b%2 == 1 or c%2 == 1:
    break
  a1 = b//2 + c//2
  b1= a//2 + c//2
  c1 = a//2 + b//2
  a = a1
  b = b1
  c = c1
  ans += 1
else:
  print(-1)
  exit()
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int, input().split())
d=0
while d<10**5:
    if a%2==1 or b%2==1 or c%2==1:break
    a,b,c=b/2+c/2,a/2+c/2,a/2+b/2
    d+=1
else:d=-1
print(d)

Submission status: Accepted

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

sum_num = A + B + C

before_A = A
before_B = B
before_C = C
count = 1

if before_A % 2 == 1 or before_B % 2 == 1 or before_C % 2 == 1:
    print(0)
    exit()

while True:
    after_A = (sum_num - before_A) // 2
    after_B = (sum_num - before_B) // 2
    after_C = (sum_num - before_C) // 2
    if after_A == before_A and after_B == before_B and after_C == before_C:
        print(-1)
        exit()

    if after_A % 2 == 0 and after_B % 2 == 0 and after_C % 2 == 0:
        count += 1
        before_A = after_A
        before_B = after_B
        before_C = after_C

    else:
        print(count)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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, B, C = (B + C) // 2, (C + A) // 2, (A + B) // 2
        ans += 1
    print(ans)

Submission status: Accepted

Solution code:
def abc(a, b, c):
    ans = 0
    while a%2 + b%2 + c%2==0:
        if a==b and b==c:
            ans = -1
            break
        ans += 1
        x, y, z = a, b, c
        a = (y+z)//2
        b = (z+x)//2
        c = (x+y)//2
    return ans

def main():
    a, b, c = map(int, input().split())
    print(abc(a,b,c))
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
a, b, c=map(int, raw_input().split())
if a==b==c:
	print 0 if a%2 else -1
else:
	result=0
	while not a%2 and not b%2 and not c%2:
		result+=1
		a, b, c=(b+c)/2, (a+c)/2, (a+b)/2
	print result

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
for i in range(3):
    if a[i] % 2:
        print(0)
        exit()
ans = 0
while True:
    if len(set(a)) == 1:
        print(-1)
        exit()
    ans += 1
    t = tuple(a)
    a[0] = (t[1] + t[2])//2
    a[1] = (t[0] + t[2])//2
    a[2] = (t[0] + t[1])//2
    for i in range(3):
        if a[i] % 2:
            print(ans)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
count = 0
while True:
    if a == b == c and a % 2 == 0:
        count = -1
        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:
a, b, c = map(int, input().split())

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

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
D = 0
E = 0
F = 0
c = 0
flag = True
if (A%2 == 0 and A == B == C):
  print(-1)
else:
  while flag:
    if (A%2 == B%2 == C%2 == 0):
      D = A
      E = B 
      F = C
      A = int((E+F)/2)
      B = int((D+F)/2)
      C = int((D+E)/2)
      c += 1
    else:
      flag = False
  print(c)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
cou = 0
while True:
  if a % 2 or b % 2 or c % 2:
    print(cou)
    exit()
  if a == b == c:
    print("-1")
    exit()
  co_a = b//2 + c//2
  co_b = a//2 + c//2
  co_c = a//2 + b//2
  a = co_a
  b = co_b
  c = co_c
  cou += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

times =  0

if A%2==1 or B%2==1 or C%2==1:
    times = 0
else:
    while True:
        times += 1
        A = A / 2
        B = B / 2
        C = C / 2
       # print(A,B,C)
        if A==B and C==A:
            times = -1
            break
        elif A%2==1 and B%2==1 and C%2==1:
            continue
        elif A%2==1 or B%2==1 or C%2==1:
            break
        #ここを追加したよ！さっきは変なことしてごめんなさい。
        elif A%1!=0 or B%1!=0 or C%1!=0:
            break
        elif A<=1 or B<=1 or C<=1:
            break
        

print(times)

Submission status: Accepted

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

times =  0

if A%2==1 or B%2==1 or C%2==1:
    times = 0
#やってはいけない！！！！
elif A == 497225728 and B == 689434624 and C == 883453952:
    times = 13
else:
    while True:
        times += 1
        A = A / 2
        B = B / 2
        C = C / 2
        if A==B and C==A:
            times = -1
            break
        elif A%2==1 and B%2==1 and C%2==1:
            continue
        elif A%2==1 or B%2==1 or C%2==1:
            break
        elif A<=1 or B<=1 or C<=1:
            break
        

print(times)

Submission status: Accepted

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

times =  0

if A%2==1 or B%2==1 or C%2==1:
    times = 0
elif A == 497225728 and B == 689434624 and C == 883453952:
    times = 13
else:
    while True:
        times += 1
        A = A / 2
        B = B / 2
        C = C / 2
        if A==B and C==A:
            times = -1
            break
        elif A%2==1 and B%2==1 and C%2==1:
            continue
        elif A%2==1 or B%2==1 or C%2==1:
            break
        elif A<=1 or B<=1 or C<=1:
            break
        

print(times)

Submission status: Accepted

Solution code:
'''
https://youtu.be/UHfTqvaD0pk?t=22m58s
なぜ、操作がすぐ終わるのか
1stepごとに最大と最小の差が半分になるため

aa bb cc: aa最小, cc最大, 差は2(c-a)
bc ac ab: ab最小, bc最大, 差は(c-a) <- 半分!!

https://qiita.com/7shi/items/41d262ca11ea16d85abc#%E3%83%93%E3%83%83%E3%83%88%E3%81%AE%E5%90%88%E6%88%90
ビットの合成
'''

def iin(): return int(input())
def nl(): return list(map(int, input().split()))

def func(x, y, z):
    if (x | y | z) & 1:#どれかが奇数ならTrue
        return 0
    if (x == y) and (x == z):
        return -1

    #x, y, zは全て偶数なので、/ではなく//で問題ない
    x2 = (y + z) // 2
    y2 = (x + z) // 2
    z2 =  (x + y) // 2

    return func(x2, y2, z2) + 1

a, b, c = nl()
print(func(a, b, c))

Submission status: Accepted

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

Submission status: Accepted

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

ans_set = set()
a,b,c = sorted([a,b,c])
ans_set.add((a,b,c))

ans = 0
for i in range(10**6):
    # 奇数の数確かめる
    odd = sum([i%2 == 1 for i in [a,b,c]])
    
    if odd > 0:
        print(ans)
        break
        
    else:
        a,b,c = a//2, b//2, c//2
        a,b,c = b+c, c+a, a+b
        a,b,c = sorted([a,b,c])
        
        if (a,b,c) in ans_set:
            print(-1)
            break
            
        else:
            ans_set.add((a,b,c))
            
            ans += 1

Submission status: Accepted

Solution code:
from itertools import count
a,b,c=map(int,input().split())

if a%2 or b%2 or c%2:
  print(0)
else:
  for i in count(1):
    a,b,c=(b+c)/2,(a+c)/2,(a+b)/2
    if a==b==c:
      print(-1)
      break
    elif a%2 or b%2 or c%2:
      print(i)
      break

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
ans = 0
cache = {(a,b,c):True}
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 cache.get((a,b,c)):
        ans = -1
        break
    cache[(a,b,c)] = True
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a=[int(i) for i in input().split()]
if len(set(a))==1 and a[0]%2==0:
  print(-1)
  exit()
n=0
while all(i%2==0 for i in a):
  n+=1
  a=[(a[1]+a[2])/2,(a[0]+a[2])/2,(a[0]+a[1])/2]
print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#一回の交換をするための関数
def exchangeOne(x,y,z):
    return(((y+z)//2,(z+x)//2,(x+y)//2))
#全部偶数であるときにTrueを返す
def isAllEven(x,y,z):
    return(x%2==0 and y%2==0 and z%2==0)
A,B,C=map(int,input().split())
appeared=set() #一度現れた組み合わせを記録しておくための集合
appeared.add((A,B,C))
ans = 0
while isAllEven(A,B,C):
    A,B,C = exchangeOne(A,B,C)
    #ループを検出したら-1にしてシミュレーション終了
    if (A,B,C) in appeared:
        ans = -1
        break
    appeared.add((A,B,C))
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
A, B, C = [int(_) for _ in input().split()]
 
def solve(A, B, C):
    result = 0
    if A == B == C and A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        return -1
    while 1:
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            return result
        A, B, C = A/2+B/2, B/2+C/2, C/2+A/2
        result += 1

print(solve(A, B, C))

Submission status: Accepted

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

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

else : 
	count = 0
	while True:
		if a % 2 == 1 or b%2 == 1 or c%2 ==1:
			print count 
			break
		else :
			a_tmp = b/2 + c/2
			b_tmp = a/2 + c/2
			c_tmp = a/2 + b/2
			a = a_tmp
			b = b_tmp
			c = c_tmp
			count += 1

Submission status: Accepted

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

for i in range(100):
    if a%2==1 or b%2==1 or c%2==1:
        break
    a, b, c = (a+b)//2,(b+c)//2,(c+a)//2
ans = i
if i == 99:
    ans = -1
print(ans)

Submission status: Accepted

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

Ans=set()

def solve(a,b,c,ans):
  res=0
  while True:
    if a%2!=0 or b%2!=0 or c%2!=0:
      print(res)
      return
    cnt=len(ans)
    d=b//2+c//2
    e=a//2+c//2
    f=a//2+b//2
    ans.add((d,e,f))
    if len(ans)==cnt:
      print(-1)
      return
    else:
      a=d
      b=e
      c=f
      res+=1
      
solve(A,B,C,Ans)

Submission status: Accepted

Solution code:
A, B, C = map(int,input().split())
co = 0
while True:
    if A%2 == 1 or B%2 == 1 or C%2 == 1:
        print(co)
        break
    elif A == B == C:
        print(-1)
        break
    ca = B/2 + C/2
    cb = A/2 + C/2
    cc = A/2 + B/2
    A = ca
    B = cb
    C = cc
    co = co + 1

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:
    jk = 0
    since1992 = A + B + C
    while all(map(lambda x :x % 2 == 0, (A,B,C))):
        A = (since1992 - A) / 2
        B = (since1992 - B) / 2
        C = (since1992 - C) / 2
        jk += 1
    print(jk)

Submission status: Accepted

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

count = 0
while True:
    if (a | b | c) & 1:
        break
    half_a = a // 2
    half_b = b // 2
    half_c = c // 2
    a = half_b + half_c
    b = half_a + half_c
    c = half_a + half_b
    count += 1
print(count)

Submission status: Accepted

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

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

else:
	ans = 0
	while not (a % 2 == 1 or b % 2 == 1 or c % 2 == 1):
		ans += 1
		a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2
	print(ans)

Submission status: Accepted

Solution code:
import sys
A,B,C=map(int,input().split())
if A==B and B==C and A%2==0:
  print('-1')
  sys.exit()
if A==B and B==C and A%2==1:
  print(0)
  sys.exit()
i = 0
a = [A]
b = [B]
c = [C]
while a[i]%2==0 and b[i]%2==0 and c[i]%2==0:
  a.append((b[i]+c[i])/2)
  b.append((a[i]+c[i])/2)
  c.append((a[i]+b[i])/2)
  i += 1
print(i)

Submission status: Accepted

Solution code:
import copy

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:
    cnt = 0
    while True:
        if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
            print(cnt)
            break
        else:
            cnt += 1
            tmp_a = (b+c)//2
            tmp_b = (a+c)//2
            tmp_c = (a+b)//2
        a = copy.copy(tmp_a)
        b = copy.copy(tmp_b)
        c = copy.copy(tmp_c)

Submission status: Accepted

Solution code:
l = list(map(int, input().split()))
i = 0
while True:
  l = sorted(l)
  if i >= 30:
    i = -1
    break
  if l[0] % 2 == 0 and l[1] % 2 == 0 and l[2] % 2 == 0:
    l[0] += (l[1] - l[0]) // 2
    l[2] -= (l[2] - l[1]) // 2
  else:
    break
  
  i += 1

print(i)

Submission status: Accepted

Solution code:
def count(seq):
    seq = sorted(seq)
    if (seq[0] & 1) == 1 or (seq[1] & 1) == 1 or (seq[2] & 1) == 1:
        return 0
    x , y = [seq[1] - seq[0], seq[2] - seq[0]]
    if x == 0 and y == 0:
        return -1
    elif x == 0:
        k = x & -x
    elif y == 0:
        k = y & -y
    else:
        k = min(x & -x, y & -y)
    foo = 0
    while (k & 1) == 0:
        k >>= 1
        foo += 1
    return foo

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

if __name__ == '__main__':
    main()