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:
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

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

    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

while True:
    if A%2!=0 or B%2!=0 or C%2!=0:
        print(ans)
        break
    elif A%2==0 and B%2==0 and C%2==0 and A == B == C:
        print('-1')
        break
    A_ = A/2
    B_ = B/2
    C_ = C/2
    A = B_+C_
    B = A_+C_
    C = A_+B_
    ans += 1

Submission status: Accepted

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

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

while a%2 == 0 and b%2 == 0 and c%2 == 0:
    ans += 1

    x = b//2 + c//2
    y = a//2 + c//2
    z = a//2 + b//2
    
    a = x
    b = y
    c = z

print(ans)

Submission status: Accepted

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

if A == B == C and A%2==0:
    print(-1)
else:
    cnt = 0
    while A%2 == B%2 == C%2 == 0:
        x = (B+C)//2
        y = (A+C)//2
        z = (A+B)//2
        A = x
        B = y
        C = z
        cnt += 1
    print(cnt)

Submission status: Accepted

Solution code:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    a,b,c = map(int,ipt().split())
    for i in range(10**18):
        if a%2 == 1 or b%2 == 1 or c%2 == 1:
            print(i)
            exit()
        elif a == b == c:
            print(-1)
            exit()
        pa = a
        pb = b
        pc = c
        a = (pb+pc)//2
        b = (pa+pc)//2
        c = (pa+pb)//2
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############
A,B,C = IL()

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

count = 0
while max(A,B,C)-min(A,B,C) > 0:
  if not(A%2 == B%2 == C%2 == 0):
    break
  A,B,C = (B+C)//2,(A+C)//2,(A+B)//2
  count += 1
  

if A==B==C:
  print(-1)
else:
  print(count)

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)
    exit()
if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
    print(0)
    exit()
cnt = 0
while True:
    ta, tb, tc = a, b, c
    ta = (b + c) // 2
    tb = (a + c) // 2
    tc = (a + b) // 2
    cnt += 1
    if ta % 2 == 1 or tb % 2 == 1 or tc % 2 == 1:
        print(cnt)
        break
    a, b, c = ta, tb ,tc

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 == b % 2 == c % 2 == 0:
        ans += 1
        a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2
    print(ans)

Submission status: Accepted

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

count = 0

for _ in range(1000000):
    
    _a, _am = divmod(a, 2)
    _b, _bm = divmod(b, 2)
    _c, _cm = divmod(c, 2)

    if _am or _bm or _cm:
        print(count)
        break
    elif a == b == c:
        print(-1)
        break
    else:
        a = _b + _c
        b = _a + _c
        c = _a + _b
        count += 1
else:
    print(-1)

Submission status: Accepted

Solution code:
def main():
    from builtins import int, map, list, print, sorted
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    A, B, C = sorted(input_number_list())
    ans = 0
    isOK = True
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        a = A / 2
        b = B / 2
        c = C / 2
        tA = b + c
        tB = a + c
        tC = a + b
        tA, tB, tC = sorted([tA, tB, tC])
        if tA == A and tB == B and tC == C:
            isOK = False
            break
        A = tA
        B = tB
        C = tC
        ans += 1
    print([-1, ans][isOK])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0

while True:
    if a % 2 == 1:
        print(cnt)
        exit()
    if b % 2 == 1:
        print(cnt)
        exit()
    if c % 2 == 1:
        print(cnt)
        exit()
    if a == b and a == c:
        print(-1)
        exit()
    lis = []
    lis.append((b+c)/2)
    lis.append((a+c)/2)
    lis.append((a+b)/2)
    a, b, c = lis

    cnt += 1

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
for i in range(600):
  if a&1 or b&1 or c&1:
    break
  a,b,c = a//2, b//2, c//2
  a, b, c = b + c, a + c, a + b
ans = i if i < 500 else -1
print(ans)

Submission status: Accepted

Solution code:
# A - Cookie Exchanges

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

ans = 0
while True:
    if A%2 or B%2 or C%2:
        break
    if A == B == C:
        ans = -1
        break
    nA = B//2 + C//2
    nB = A//2 + C//2
    nC = A//2 + B//2
    A = nA
    B = nB
    C = nC
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
num1=0
num2=0
num3=0
if a==b and b==c and a%2==0:
    print(-1)
else:
    for i in range(a*b*c):
        if a%2==1 or b%2==1 or c%2==1:
            break
        num1=a//2
        num2=b//2
        num3=c//2
        a=num2+num3
        b=num3+num1
        c=num1+num2
    print(i)

Submission status: Accepted

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

cnt=0
lp=0
ls=set()
a=A
b=B
c=C
ls.add((a,b,c))
while not(a%2==1 or b%2==1 or c%2==1 or lp==1):
    a=int((A+B+C-a)/2)
    b=int((A+B+C-b)/2)
    c=int((A+B+C-c)/2)
    cnt+=1
    if ((a,b,c) in ls):
        lp=1
if lp==1:
    print(-1)
else:
    print(cnt)

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:
        print(-1)
        exit()
    a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
def resolve():
    A, B, C = list(map(int, input().split()))
    if (A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
        if (A == B and B == C and C == A):
            print(-1)
            return

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

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

    return


resolve()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    A, B, C = [int(x) for x in input().split()]

    cnt = 0
    while True:
        if cnt > 10 ** 5:
            print(-1)
            return

        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            print(cnt)
            return

        A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
        cnt += 1
       

if __name__ == '__main__':
    main()

Submission status: Accepted

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

import sys
sys.setrecursionlimit(10**6)

def solve(a,b,c,counter=0):
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        return counter
    elif a == b == c: 
        return -1
    else:
        return solve((b+c)//2,(c+a)//2,(a+b)//2,counter+1)


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def f(a, b, c):
    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
ans = f(a, b, c)
print(ans)

Submission status: Accepted

Solution code:
abc = list(map(int,input().split()))
lis=[abc]
ans=0
def ch(x):
  for i in x:
    if i%2==1:
      return -1
  return 1
def sw(x):
  ret=[]
  ret.append(x[2]/2+x[1]/2)
  ret.append(x[0]/2+x[2]/2)
  ret.append(x[0]/2+x[1]/2)
  return ret
def check(a,l):
  for x in l:
    if a==x:
      return 1
  return 0
while True:
  if ch(abc)==-1:
    break
  abc=sw(abc)
  if check(abc,lis):
    ans=-1
    break
  lis.append(abc)
  ans+=1
  
print(ans)

Submission status: Accepted

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

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

cnt = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    cnt += 1
    aa = b // 2 + c // 2
    bb = c // 2 + a // 2
    cc = a // 2 + b // 2
    a = aa
    b = bb
    c = cc
print(cnt)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
d=0
while(all([a%2==0,b%2==0,c%2==0])):
  x=b//2+c//2
  y=c//2+a//2
  z=a//2+b//2
  d+=1
  a=x
  b=y
  c=z
  if a==b==c:
    d=-1
    break
print(d)

Submission status: Accepted

Solution code:
A,B,C = map(int, input().split())
cnt = 0
if A%2 or B%2 or C%2:
    print(cnt)
    exit()
if A == B and B == C:
    print(-1)
    exit()
while True:
    if A%2 or B%2 or C%2:
        print(cnt)
        break
    temp_a = A//2
    temp_b = B//2
    temp_c = C//2
    A += 2*temp_a + temp_b + temp_c
    B += 2*temp_b + temp_a + temp_c
    C += 2*temp_c + temp_a + temp_b
    cnt += 1

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    if A == B == C:
        if A % 2 == 0:
            ans = -1
        else:
            ans = 0
    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)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

i = 0
while True:
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        print(i)
        break
    elif a == b == c:
        print(-1)
        break
    a_h = a / 2
    b_h = b / 2
    c_h = c / 2
    a = b_h + c_h
    b = a_h + c_h
    c = a_h + b_h
    i += 1

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
temp=1000
i=0
while i<temp:
  if a%2!=0 or b%2!=0 or c%2!=0:
    print(i)
    break
  else:
    at=a
    bt=b
    ct=c
    a=bt//2+ct//2
    b=at//2+ct//2
    c=at//2+bt//2
    i=i+1
else:
  print(-1)

Submission status: Accepted

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


def solve(A: int, B: int, C: int):
    ans = 0
    already = set()
    already.add((A, B, C))
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        tmp_a = B // 2 + C // 2
        tmp_b = A // 2 + C // 2
        tmp_c = B // 2 + A // 2
        A = tmp_a
        B = tmp_b
        C = tmp_c
        ans += 1

        res = (A, B, C)
        if res in already:
            ans = -1
            break
        already.add(res)

    ans = ans if ans else 0
    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 0

while True:
    if ans > 999999:
        print(-1)
        break
    elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        print(ans)
        break
    a, b, c =  (b+c) // 2, (a+c) // 2, (a+b) // 2
    ans += 1

Submission status: Accepted

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

ans = 0

while True:
    if ans > 999999:
        print(-1)
        break
    elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        print(ans)
        break
    n_a = b/2 + c/2
    n_b = a/2 + c/2    
    n_c = a/2 + b/2
    a = n_a
    b = n_b
    c = n_c
    ans += 1

Submission status: Accepted

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

if a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and a == b == c:
    print(-1)
else :
    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
        ans += 1
    print(ans)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
cnt = 0
def f(a,b,c):
	return b//2 + c//2, a//2 + c//2, a//2 + b//2

while (a%2==0 and b%2==0 and c%2==0):
	if a==b and b==c and c==a:
		print('-1')
		exit()
	else:
		cnt += 1
		a,b,c = f(a,b,c)
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
if A%2 != 0 or B%2 != 0 or C%2 != 0:
    print(0)
    exit()
if A*2 == B+C and B*2 == A+C and C*2 == A+B:
    print(-1)
    exit()
ans = 0
for i in range(10000):
    a = A//2
    b = B//2
    c = C//2
    if A%2 == 0 and B%2 == 0 and C%2 == 0:
        ans += 1
        A = b+c
        B = a+c
        C = a+b
    else:
        print(ans)
        exit()

Submission status: Accepted

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

# In[20]:


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


# In[22]:


A_ = A
B_ = B
C_ = C

ans = 0
while True:
    if A_%2 != 0 or B_%2 != 0 or C_%2 != 0:
        print(ans)
        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
        ans += 1
#         print(A_,B_,C_)
        if A_ == A and B_ == B and C_ == C:
            print(-1)
            break


# In[ ]:

Submission status: Accepted

Solution code:
*a,=map(int,input().split())
b=[bin(a[i+1]-a[i])[::-1].find('1')for i in (0,1)]
print((max(b)*(b[0]*b[1]<0) or min(b))*(1-sum(a)%2))

Submission status: Accepted

Solution code:
*a,=map(int,input().split())
b=[bin(a[i+1]-a[i])[::-1].find('1')for i in (0,1)]
print((max(b) if b[0]*b[1]<0 else min(b))*(1-sum(a)%2))

Submission status: Accepted

Solution code:
*a,=map(int,input().split())
b=[bin(abs(a[i+1]-a[i]))[::-1].find('1') for i in range(2)]
print((max(b) if b[0]*b[1]<0 else min(b))*(1-sum(a)%2))

Submission status: Accepted

Solution code:
# my solution
*a, = map(int,input().split())
if any(map(lambda x: bin(x)[-1]== "1", a)):
    print("0")
    exit()
a = [bin(abs(a[i+1]-a[i]))[::-1].find('1') for i in range(2)]
print(max(a) if a[0]*a[1]<0 else min(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def resolve():
    A,B,C = map(int,input().split())
    count = 0
    if A == C and A == B:
        if A % 2 == 1:
            print(0)
        else:
            print(-1)
    else:
        while (A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
            tmpA = (B + C) / 2 
            tmpB = (A + C) / 2 
            tmpC = (A + B) / 2
            A = tmpA
            B = tmpB
            C = tmpC
            count = count + 1
        print(count)
resolve()

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(cnt)
elif A==B==C:
    print('-1')
else:
    flag = True
    while flag:
        A, B, C = (B+C)//2, (A+C)//2, (A+B)//2
        cnt += 1
        if A%2==0 and B%2==0 and C%2==0:    
            continue
        else:
            flag = False

    print(cnt)

Submission status: Accepted

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

def even(a):
	if a % 2 == 0:
		return True
	else:
		return False

cnt = 0

while even(A) and even(B) and even(C):
	if A == B and B == C:
		cnt = -1
		break
	else:
		tmp1, tmp2, tmp3 = A,B,C
		A = (tmp2+tmp3) // 2
		B = (tmp3+tmp1) // 2
		C = (tmp1+tmp2) // 2
		cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

def IsOdd(a, b, c):
    if a % 2 == 1:
        return True
    if b % 2 == 1:
        return True
    if c % 2 == 1:
        return True
    return False

def Exchange(a, b, c):
    retA = 0
    retB = 0
    retC = 0
    retA = (b // 2) + (c // 2)
    retB = (a // 2) + (c // 2)
    retC = (a // 2) + (b // 2)
    return retA , retB , retC

cnt = 0
routedA = []
while True :
    if IsOdd(A, B, C):
        break
    if A in routedA:
        cnt = -1
        break
    routedA.append(A)
    cnt += 1
    ret = Exchange(A, B, C)
    A = ret[0]
    B = ret[1]
    C = ret[2]

print(cnt)

Submission status: Accepted

Solution code:
def ex(x):
    while x%2==0 and x>2:
        x/=2
    if x==2:
        return 0
    else:
        return 1
a,b,c = map(int, input().split())
count = 0
if not ex(a)==ex(b)==ex(c)==0:
    while a%2==0 and b%2==0 and c%2==0:
        temp_a = a
        temp_b = b
        temp_c = c
        a = temp_b/2 + temp_c/2
        b = temp_a/2 + temp_c/2
        c = temp_a/2 + temp_b/2
        count+=1
        if ex(a)==ex(b)==ex(c)==0 or a==b==c:
            count = -1
            break
    print(count)
else:
    print("-1")

Submission status: Accepted

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

A=[a]+[0]*10**5
B=[b]+[0]*10**5
C=[c]+[0]*10**5

i=0
while A[i]%2+B[i]%2+C[i]%2==0:
    i+=1
    A[i]=B[i-1]//2+C[i-1]//2
    B[i]=C[i-1]//2+A[i-1]//2
    C[i]=A[i-1]//2+B[i-1]//2
    if A[i]==B[i]==C[i]:
        i=-1
        break
print(i)

Submission status: Accepted

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

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

ans = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    a_tmp = b // 2 + c // 2
    b_tmp = a // 2 + c // 2
    c_tmp = a // 2 + b // 2
    a, b, c = a_tmp, b_tmp, c_tmp
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
A, B, C = list(map(int, input().split()))
cookies = set()
cookies.add((A, B, C))

a = A
b = B
c = C

count = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    count += 1
    a = a // 2
    b = b // 2
    c = c // 2
    
    a2 = b + c
    b2 = a + c
    c2 = b + c
    if (a2, b2, c2) in cookies:
        count = -1
        break
    a = a2
    b = b2
    c = c2
    cookies.add((a, b, c))
print(count)

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
count = 0
while all(x % 2 == 0 for x in a) and count <= 100000:
	b = [(sum(a) - x) // 2 for x in a]
	a = b
	count += 1
print(count if count <= 100000 else -1)

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
ans=0
d=[]
a=A
b=B
c=C

while 1:
  if a%2!=0 or b%2!=0 or c%2!=0:
    print(ans)
    exit()
  if [a,b,c] in d:
    print(-1)
    exit()
  d.append([a,b,c])
  a1 = b//2 + c//2
  b1 = a//2 + c//2
  c1 = a//2 + b//2
  a=a1
  b=b1
  c=c1
  ans+=1

Submission status: Accepted

Solution code:
def resolve():
    A, B, C = map(int, input().split())
    cnt = 0
    while True:
        if A%2 == 1 or B%2 == 1 or C%2 == 1:
            break
        elif A==B and B==C:
            cnt = -1
            break
        Atmp = A
        Btmp = B
        Ctmp = C
        A = (Btmp+Ctmp)/2
        B = (Atmp+Ctmp)/2
        C = (Atmp+Btmp)/2
        cnt += 1
    print(cnt)
resolve()

Submission status: Accepted

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

ans = 0
while(1):
  tmp_A,tmp_B,tmp_C = A,B,C
  if((tmp_A%2 == 1)or(tmp_B%2 == 1)or(tmp_C%2 == 1)):
    break   
  A,B,C = (tmp_B+tmp_C)//2, (tmp_C+tmp_A)//2, (tmp_A+tmp_B)//2
  if((tmp_A == A)and(tmp_B == B)and(tmp_C == C)):
    ans = -1
    break
  ans += 1

print(ans)

Submission status: Accepted

Solution code:
def isOdd(n):
    return n % 2 == 1


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


def mi():
    return map(int, input().split())


def ii():
    return int(input())


A, B, C = li()

cnt = 0
ABC = []
flag = False
while True:
    if flag:
        break
    if isOdd(A) or isOdd(B) or isOdd(C):
        break
    ABC.append([A, B, C])
    A2 = A // 2
    B2 = B // 2
    C2 = C // 2
    A = B2 + C2
    B = A2 + C2
    C = A2 + B2
    cnt += 1

    for i in range(len(ABC)):
        if ABC[i] == [A, B, C]:
            cnt = -1
            flag = True
            break

print(cnt)

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

while a % 2 == 0 | b % 2 == 0 | c % 2 == 0:
    A = int((b + c) / 2)
    B = int((c + a) / 2)
    C = int((a + b) / 2)
    a = A
    b = B
    c = C
    count += 1
print(count)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ct=0
h=0
while 1:
    if (a%2==1)or(b%2==1)or(c%2==1):
        break
    if ct==100000:
        h=1
        break
    a2=a//2
    b2=b//2
    c2=c//2
    a=b2+c2
    b=c2+a2
    c=a2+b2
    ct+=1
if h==1:
    print(-1)
else:
    print(ct)

Submission status: Accepted

Solution code:
A,B,C = list(map(int,input().split()))
count = 0
if A%2 == 1 or B%2 == 1 or C%2 == 1:
    print(0)
    exit()
if A == B == C:
    print(-1)
    exit()
while True:
    if A%2 == 1 or B%2 == 1 or C%2 == 1:
        break
    A_half = A//2
    B_half = B//2
    C_half = C//2
    A = B_half+C_half
    B = A_half+C_half
    C = A_half+B_half
    count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 適当に10**5ぐらい回して無限に続けられたら-1でよくね？
A, B, C = map(int, input().split())


def update(A, B, C):
    return B // 2 + C // 2, C // 2 + A // 2, A // 2 + B // 2


for i in range(10 ** 5):
    if A & 1 or B & 1 or C & 1:
        print(i)
        exit()
    A, B, C = update(A, B, C)

print(-1)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
cou = 0
if  a%2==0 and a==b and b==c and c==a :
  print(-1)
  exit()
while a%2==0 and b%2==0 and c%2==0:
  j=int(a//2)
  k=int(b//2)
  m=int(c//2)
  a += k+m
  b += j+m
  c += j+k
  cou += 1
print(cou)

Submission status: Accepted

Solution code:
a, b, c = list(map(int, input().split()))
if a == b == c and a % 2 == 0:
    print(-1)
    exit()
count = 0
while True:
    if sum([a % 2, b % 2, c % 2]) > 0:
        print(count)
        exit()
    else:
        a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
        count += 1