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:
A, B, C = map(int, input().split())
S = A+B+C

k = 0
flag = 0
while k<100:
    if A%2==1 or B%2==1 or C%2==1 or min([A,B,C])<1:
        flag = 1
        break
    An = (B + C)//2
    Bn = (A + C)//2
    Cn = (B + A)//2
    A = An 
    B = Bn 
    C = Cn         
    k += 1

if not flag:
    k = -1

print(k)

Submission status: Accepted

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

oldCookies = []
oldCookies.append([a,b,c])

answer = 0

while(True):
	if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
		break 
	after_a = b / 2 + c / 2
	after_b = a / 2 + c / 2
	after_c = a / 2 + b / 2
	a = after_a
	b = after_b 
	c = after_c
	cookies = [a,b,c]
	answer += 1 
	
	for i in range(len(oldCookies)):
		if oldCookies[i] == cookies:
			answer = -1
			break

	if answer == -1:
		break

print(answer)

Submission status: Accepted

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

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

ans = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    ans += 1
    A_new = B / 2 + C / 2
    B_new = A / 2 + C / 2
    C_new = A / 2 + B / 2
    if A == A_new and B == B_new and C == C_new:
        ans = -1
        break
    A = A_new
    B = B_new
    C = C_new

print(ans)

Submission status: Accepted

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

cnt = 0
history = set()
while True:
  if (a, b, c) in history:
    print(-1)
    exit(0)
  if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
    print(cnt)
    exit(0)
  a, b, c = sorted([a, b, c])
  history.add((a, b, c))
  na = b // 2 + c // 2
  nb = a // 2 + c // 2
  nc = a // 2 + b // 2
  a = na
  b = nb 
  c = nc
  cnt += 1

Submission status: Accepted

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

count = 0

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

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
ans = 0

while sum([A[i] % 2 for i in range(3)]) == 0:
    if A.count(A[0]) == 3:
        ans = -1
        break
    A = [(sum(A)-A[i])/2 for i in range(3)]
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
a_sho,b_sho,c_sho = a,b,c
ans = 0
mugen = False
while True:
    a_k = a
    b_k = b
    c_k = c
    if a%2 != 0 or b%2 != 0 or c%2 != 0:
        break
    else:
        a = b_k/2 + c_k/2
        b = a_k/2 + c_k/2
        c = a_k/2 + b_k/2
        ans += 1
    if a == a_sho and b == b_sho and c == c_sho:
        mugen = True
        break

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

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:
    a = B // 2 + C // 2
    b = A // 2 + C // 2
    c = A // 2 + B // 2
    if A == a and B == b and C == c:
        ans = -1
        break
    A = a
    B = b
    C = c
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
A,B,C=map(int,input().split())
cnt=0
A_old=B_old=C_old=0
for i in range(100000000):
    if A%2==1 or B%2==1 or C%2==1:
        print(cnt)
        sys.exit()
    elif  A==A_old and B==B_old and C==C_old:
        print(-1)
        sys.exit()

    A_old=A
    B_old=B
    C_old=C
    A=C_old/2+B_old/2
    B=A_old/2+C_old/2
    C=A_old/2+B_old/2
    cnt+=1

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
if a == b and b == c and a == c:
  if a %2 == 0:
    print(-1)
  else:
    print(0)
else:
  for i in range(10**9):
    if a %2 == 0:
      S = a/2
    else:
      print(i)
      break
    if b%2 == 0:
      T = b/2
    else:
      print(i)
      break
    if c %2 == 0:
      U = c/2
    else:
      print(i)
      break
    a -= S*2
    b -= T*2
    c -= U*2
    a += T
    a += U
    b += S
    b += U
    c += S
    c += T

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a = list(map(int, readline().split()))

    ans = 0
    while all([x % 2 == 0 for x in a]):
        a[0], a[1], a[2] = a[1] + a[2], a[2] + a[0], a[0] + a[1]
        a[0] //= 2
        a[1] //= 2
        a[2] //= 2
        ans += 1
        if a[0] == a[1] == a[2]:
            return print(-1)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a, b, c = map(int, input().split())
state = [[a,b,c]]
if a%2 == 0  and a == b  and b == c:
    print(-1)
else:
    while True:
        if a%2==1 or b%2==1 or c%2==1:
            print(count)
            exit()
        a_2 = a//2
        b_2 = b//2
        c_2 = c//2
        a = b_2 + c_2
        b = a_2 + c_2
        c = a_2 + b_2
        if [a,b,c] in state:
            print(-1)
        else:
            state.append([a,b,c])
            count += 1

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
# 奇数があったら0回
if any([q%2==1 for q in (a,b,c)]):
  print(0)
  exit()
# 全部偶数で等しいと終わらない
if a==b==c:
  print(-1)
  exit()
# ではなければシミュレーションでOK
cnt=0
while all([q%2==0 for q in (a,b,c)]):
  cnt+=1
  s=a+b+c
  a=s-a
  a//=2
  b=s-b
  b//=2
  c=s-c
  c//=2
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:
    ans = -1
    break
  aa = (a/2)
  bb = (b/2)
  cc = (c/2)
  a = bb+cc
  b = aa+cc
  c = aa+bb
  ans += 1
  
print(ans)

Submission status: Accepted

Solution code:
T,A,S = map(int, input().split(' '))

persons = [T, A, S]

def check_even(persons):
    for person in persons:
        if person % 2 != 0:
            return False
    return True

# 1 1 1 の判定を先にするため

# 0回目
if not check_even(persons):
    print(0)
    exit()

# 全数同値 -> 無限
if T == A and A == S:
    print(-1)
    exit()

count = 1

while True:
    for person in persons:
        tmp_0 = persons[0]
        tmp_1 = persons[1]
        tmp_2 = persons[2]

        persons[0] = 0 + tmp_1 / 2 + tmp_2 / 2
        persons[1] = tmp_0 / 2 + 0 + tmp_2 / 2
        persons[2] = tmp_0 / 2 + tmp_1 / 2 + 0

        if check_even(persons):
            count += 1
        else:
            print(count)
            exit()

Submission status: Accepted

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

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

if isodd(A) or isodd(B) or isodd(C):
    print(0)
    sys.exit()
res = 0
while not isodd(A) and not isodd(B) and not isodd(C):
    if A == B == C:
        print(-1)
        sys.exit()
    tA, tB, tC = A, B, C
    A = tB//2 + tC//2
    B = tA//2 + tC//2
    C = tA//2 + tB//2
    res += 1
print(res)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
res = 0
while a%2==0 and b%2==0 and c%2==0: # 値が偶数の間
    if a==b==c: #無限ループ
        print(-1)
        exit()
    tmpa = b//2+c//2
    tmpb = a//2+c//2
    tmpc = a//2+b//2
    a = tmpa
    b = tmpb
    c = tmpc
    res += 1
print(res)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
count = 0
for i in range(1100):
    if (a%2 + b%2 + c%2):
        break
    d,e,f = (b+c)//2, (c+a)//2, (a+b)//2
    a,b,c = d,e,f
    count += 1
if(count>1000):
    count = -1
print(count)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
enum = enumerate

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def vinput(rep=1, ty=int, cvt=list):
	return cvt(ty(input().rstrip()) for _ in "*"*rep)

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

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

def main():
	a,b,c = linput()
	d = a-b
	res = 0

	cnt = 0
	while cnt<10**2:
		if a%2 or b%2 or c%2:
			break
		p,q,r = a//2, b//2, c//2
		s = p+q+r
		a,b,c = s-p, s-q, s-r
		cnt += 1
		#print(a,b,c)
	else:
		cnt = -1
	
	res = cnt
	#sT = "No Yes".split()
	#print(sT[res])
	print(res)

if __name__ == "__main__":
	main()

Submission status: Accepted

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

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

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

LA = []
LB = []
LC = []
LA.append(A)
LB.append(B)
LC.append(C)
i = 0
cnt = 0

while LA[i] % 2 == 0 and LB[i] % 2 == 0 and LC[i] % 2 == 0:
    LA.append((LB[i]+LC[i])/2)
    LB.append((LC[i]+LA[i])/2)
    LC.append((LA[i]+LB[i])/2)
    i += 1
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def f(a, b, c):
    if (a%2 != 0) | (b%2 != 0) | (c%2 != 0):
        return 0
    if (a == b) & (b == c):
        return -1
    return f((b+c)//2, (a+c)//2, (a+b)//2) + 1
def main():
    a, b, c = map(int, readline().split())
    print(f(a, b, c))
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit
a,b,c = map(int,input().split())
cnt = 0
while ~a&1 and ~b&1 and ~c&1:
    newa = b//2+c//2
    newb = a//2+c//2
    newc = a//2+b//2
    a,b,c = newa,newb,newc
    cnt += 1
    if cnt >= 10**5:
        exit(print(-1))
print(cnt)

Submission status: Accepted

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

ans = 0

while a%2 == b%2 == c%2 == 0:
  ans += 1
  newa=b//2+c//2
  newb=a//2+c//2
  newc=a//2+b//2
  a=newa
  b=newb
  c=newc
  if a == b == c:
    print("-1")
    break
else:
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
a,b,c = map(int,input().split(" "))
li = [[a,b,c]]
count=0

for i in range(10**2):
  if (a % 2)==1 or (b % 2)==1 or (c % 2)==1:
    break
  else:
    a2 = a/2
    b2 = b/2
    c2 = c/2
    a = b2+c2
    b = c2+a2
    c = a2+b2  
    count += 1
  if [a,b,c] in li:
    print(-1)
    sys.exit()
  else:
    li.append([a,b,c])
    
print(count)

Submission status: Accepted

Solution code:
import sys
a,b,c = map(int,input().split(" "))
li = [[a,b,c]]
count=0

for i in range(10**9):
  if (a % 2)==1 or (b % 2)==1 or (c % 2)==1:
    break
  else:
    a2 = a/2
    b2 = b/2
    c2 = c/2
    a = b2+c2
    b = c2+a2
    c = a2+b2  
    count += 1
  if [a,b,c] in li:
    print(-1)
    sys.exit()
  else:
    li.append([a,b,c])
    
print(count)

Submission status: Accepted

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

import numpy as np
a = np.array(ri_())
ans = 0
while True:
    if np.any(a % 2 == 1):
        break
    if a[0] == a[1] and a[1] == a[2]:
        ans = -1
        break
    a = (sum(a) - a) // 2
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
def solve(A):
    r = []
    for n in A:
        if n < 2:
            r.append(0)
            continue
        cnt = 0
        while n % 2 == 0:
            n //= 2
            cnt += 1
        r.append(cnt)
    return r


def resolve():
    A = [int(i) for i in input().split()]
    for a in A:
        if a % 2 == 1:
            print(0)
            return
    if min(A) == max(A):
        print(-1)
    else:
        s = solve(A)
        if min(s) == 0 or min(s) != max(s):
            print(min(s))
        else:
            print(min(s) + 1)


resolve()

Submission status: Accepted

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

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

while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    al = b // 2 + c // 2
    bl = a // 2 + c // 2
    cl = a // 2 + b // 2
    a = al
    b = bl
    c = cl
    i += 1

print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

a,b,c = [int(x) for x in stdin.readline().strip().split()]
l = 0
mem = []

while(True):
  if sum([a%2, b%2, c%2]) > 0:
    break
  elif [a,b,c] in mem:
    l = -1
    break
  else:
    l += 1
    mem.append([a,b,c])
    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
    
print(l)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

else:
  while a%2==0 and b%2==0 and c%2==0:
    a,b,c = int((b+c)/2), int((a+c)/2), int((a+b)/2)   
    cnt+=1
  print(cnt)

Submission status: Accepted

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

while True:
    if a%2==1 or b%2==1 or c%2==1:
        print(ans)
        break
    if a == b == c:
        print(-1)
        break
    s = a // 2
    t = b // 2
    u = c // 2
    a, b, c = t+u, s+u, s+t
    ans += 1
else:
    print(ans)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans=0
average=int((a+b+c)/3)
while True:
    if a%2==1 or b%2==1 or c%2==1:
        print(ans)
        exit()
    else:
        tb=int(b/2)
        tc=int(c/2)
        ta=int(a/2)
        a=tb+tc
        b=ta+tc
        c=ta+tb

        ans+=1
    if a==average and b==average and c==average:
        print(-1)
        exit()

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Submission status: Accepted

Solution code:
def f(a, b, c):
    if a > 1 and a == b and a == c:
        print(-1)
    else:
        count = 0
        for i in range(100):
            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
            count += 1
        print(count)

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

Submission status: Accepted

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

a1,b1,c1,cou= 0,0,0,0



while A%2 == 0 and B%2 == 0 and C%2 == 0:
    if A == B == C:
        print("-1")
        sys.exit()
    a1 = int(A/2) 
    b1 = int(B/2) 
    c1 = int(C/2) 
    A = b1+c1
    B = a1+c1
    C = a1+b1
    cou += 1
    
print(cou)

Submission status: Accepted

Solution code:
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy


def odd(n): return n & 1


def even(n): return not odd(n)


A, B, C = map(int, input().split())
ans = 0
a, b, c = A, B, C
while True:
    dump(a, b, c)
    if odd(a) or odd(b) or odd(c):
        print(ans)
        exit()
    if ans > 0 and a == A and b == B and c == C:
        print(-1)
        exit()
    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())

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

print(count)

Submission status: Accepted

Solution code:
def exchange(l):
    newlist = [0, 0, 0]
    for i in range(3):
        for j in range(3):
            if i != j:
                newlist[i] += l[j]//2
    return newlist


def containsOdd(l):
    for i in range(3):
        if l[i] % 2 == 1:
            return True
    return False


def isAllEquals(l):
    if l[0] == l[1] == l[2]:
        return True
    return False


def main():
    cookies = [int(x) for x in input().split()]
    ans = 0
    while True:
        if isAllEquals(cookies):
            if cookies[1] % 2 == 1:
                print(0)
                return
            print(-1)
            return 0
        if containsOdd(cookies):
            print(ans)
            return 0
        cookies = exchange(cookies)
        ans += 1


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    a, b, c = MI()
    if a%2 or b%2 or c%2:
        print(0)
        sys.exit()
    if (a == b) and (b == c):
        print(-1)
        sys.exit()
    cnt = 0
    while True:
        if a%2 or b%2 or c%2:
            break
        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
        cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
L = list(map(int, input().split()))
if L[0]%2 == 1 or L[1]%2 == 1 or L[2]%2 == 1:
    print(0)
    exit()

if (L[0]//2)%2 == 1 and (L[1]//2)%2 == 1 and (L[2]//2)%2 == 1:
    print(-1)
    exit()

i = 0
while True:
    i += 1
    L = [L[1]//2+L[2]//2, L[0]//2+L[2]//2, L[0]//2+L[1]//2]
    if L[0]%2 == 1 or L[1]%2 == 1 or L[2]%2 == 1:
        print(i)
        exit()
    if i >= 10**6:
        print(-1)
        exit()

Submission status: Accepted

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

ans = 0
if A&1 or B&1 or C&1:
    print(ans)
    exit(0)

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
A, B, C = list(map(int, input().split()))
if A % 2 != 0 or B % 2 != 0 or B % 2 != 0:
    print('0')
    sys.exit()
if A == B == C:
    print('-1')
    sys.exit()
cnt = 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
    cnt += 1
print(cnt)

Submission status: Accepted

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

if A == B == C:
    if A % 2 == 0:
        print('-1')
    else:
        print('0')
else:
    count = 0
    for _ in range(10 ** 9):
        if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
            print(count)
            break
        tmp_A = A
        tmp_B = B
        tmp_C = C
        A = (tmp_B + tmp_C) / 2
        B = (tmp_A + tmp_C) / 2
        C = (tmp_B + tmp_A) / 2
        count += 1

Submission status: Accepted

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

Submission status: Accepted

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

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

i = 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
    i += 1

print(i)

Submission status: Accepted

Solution code:
# 13
A, B, C = input().split(' ')
count = 0
A = int(A)
B = int(B)
C = int(C)
a = A
b = B
c = C

while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  N=[]
  N.append(B/2 + C/2)
  N.append(A/2 + C/2)
  N.append(A/2 + B/2)
  A = N[0]
  B = N[1]
  C = N[2]
  count += 1
  if A == a and B == b and C == c:
    print(-1)
    break
else:
  print(count)

Submission status: Accepted

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

ans = 0
for ans in range(1000):
    if A&1 or B&1 or C&1:
        print(ans)
        break
    A,B,C = (B+C)//2, (C+A)//2, (A+B)//2
else:
    print(-1)

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    A, B, C = [int(item) for item in input().split()]
    cnt = 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
        cnt += 1

        if A==B==C:
            cnt = -1
            break

    print(cnt)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def main():
    a=tuple(map(int,input().split()))
    e=set()
    while a not in e:
        for x in a:
            if x % 2 != 0:
                print(len(e))
                return
        e.add(a)
        a=((a[1]+a[2])//2,(a[0]+a[2])//2,(a[0]+a[1])//2)
    else:
        print(-1)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split());e=a-b|c-b;print(len(bin(e&-e))-3or~c%-2)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=a-b|c-b
print(len(bin(e&-e))-3or~c%-2)

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()
# 全て偶数で、A=B=Cの場合
if a == b and b == c:
    print(-1)
    exit()

cnt = 0

while True:
    cnt += 1
    next_a = b // 2 + c // 2
    next_b = a // 2 + c // 2
    next_c = a // 2 + b // 2
    a = next_a
    b = next_b
    c = next_c
    # 処理を行った結果、奇数が発生してしまったらそこで終了
    # 奇数がなければwhileを続ける
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        break

print(cnt)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
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
   cnt += 1
   next_a = b // 2 + c // 2
   next_b = a // 2 + c // 2
   next_c = a // 2 + b // 2
   a = next_a; b = next_b; c = next_c
print(cnt)

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 and b==c:
    print(-1)
else:
    while True:
        if a%2==0 and b%2==0 and c%2==0:
            ans+=1
            a_tmp=int(a/2)
            b_tmp=int(b/2)
            c_tmp=int(c/2)
            a=b_tmp+c_tmp
            b=a_tmp+c_tmp
            c=b_tmp+b_tmp
        else:
            break
    print(ans)

Submission status: Accepted

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

if A == B == C: 
  print(-1 if A%2==0 else 0)
else:
  c = 0
  while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    ba = A
    bb = B
    bc = C
    A = (bb + bc)//2
    B = (ba + bc)//2
    C = (ba + bb)//2
    c+=1
  print(c)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=a-b|b-c
print(len(bin(e&-e))-3-(e==b&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:
  d,e,f=0,0,0
  d=(b+c)//2
  e=(a+c)//2
  f=(a+b)//2
  a,b,c=d,e,f
  ans+=1
  if ans==100000:
    ans=(-1)
    break
print(ans)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=a-b|b-c
print(len(bin(e&-e))-3or-(e==b&1))

Submission status: Accepted

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

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

x = B/2
cnt = 0
while A % 2 == 0 and C % 2 == 0:
    tmp_a = A
    tmp_c = C
    A = tmp_c/2 + x
    C = tmp_a/2 + x
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=a-b|b-c
print((e!=b&1)*len(f'{e&-e:b}')-1)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=a-b|b-c
print((e!=b%2)*len(f'{e&-e:b}')-1)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=a-b|b-c
print((e!=b%2)*len(f'{(e&-e):b}')-1)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=(a-b)|(b-c)
print((e!=0|b%2)*(e^~-e).bit_length()-1)

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)
    exit()
cnt=0
while a%2==b%2==c%2:
    A=a//2
    B=b//2
    C=c//2
    a,b,c=B+C,A+C,A+B
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
def resolve():
    a, b, c = map(int, input().split())
    if a%2 != 0 or b%2 != 0 or 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)
resolve()

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 == b == c:
    print(-1)
    exit()
    
cnt = 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
    cnt += 1
 
print(cnt)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=a-b|b-c
print((e!=b%2)*(e^e-1).bit_length()-1)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
if a == b == c:
    ans = 0
else:
    ans = 1 << 31
    for x in [a - b, b - c, c - a]:
        if x != 0:
            tmp = 0
            while x % 2 == 0:
                tmp += 1
                x >>= 1
            ans = min(tmp, ans)

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
if a == b == c:
    ans = 1
else:
    ans = 1 << 31
    for x in [a - b, b - c, c - a]:
        if x != 0:
            tmp = 1
            while x % 2 == 0:
                tmp += 1
                x >>= 1
            ans = min(tmp, ans)

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=(a-b)|(b-c)
print((e!=0|b%2)*(e^~-e).bit_length()-1)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=(a-b)|(b-c)
print(bool(e|b%2)*(e^~-e).bit_length()-1)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
e=(a-b)|(b-c)
print(bool(e|(a|b|c)%2)*(e^~-e).bit_length()-1)

Submission status: Accepted

Solution code:
a,b,c=map(int,open(0).read().split())
e=(a-b)|(b-c)
print(bool(e|(a|b|c)%2)*(e^~-e).bit_length()-1)

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:
        cnt = -1
        print(cnt)
else:
    while True:
        a, b, c = A, B, C
        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
        cnt += 1
    
    print(cnt)

Submission status: Accepted

Solution code:
## A - Cookie Exchanges
A, B, C = map(int, input().split())
if not (A%2 == B%2 == C%2 == 0):
    ans = 0
elif A == B == C:
    ans = -1
else:
    ans = 0
    while A%2 == B%2 == C%2 == 0:
        a = (B+C) // 2
        b = (C+A) // 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, input().split())
 
if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
    print(0)
elif a == b == c:
    print(-1)
else:
    num = 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
        num += 1
    print(num)

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 == b == c:
    print(-1)
    exit()
    
cnt = 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
    cnt += 1
 
print(cnt)