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())
count = 0
if a == 1 and b == 1 and c == 1:
  pass
elif a == b and a == c:
  count = -1
else:
  while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    a_copy = a
    b_copy = b
    c_copy = c
    a = int(b_copy / 2 + c_copy / 2)
    b = int(a_copy / 2 + c_copy / 2)
    c = int(b_copy / 2 + a_copy / 2)
    count += 1
  
print(count)

Submission status: Accepted

Solution code:
def main():
    A, B, C = map(int, input().split())
    cnt = 0; flag = False
    for _ in range(pow(10,6)):
        if A%2 == 1 or B%2 == 1 or C%2 == 1:
            flag = True
            break
        A, B, C = B//2+C//2, A//2+C//2, A//2+B//2
        cnt += 1
    ans = flag*cnt + (not flag)*(-1)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    ans = 0
    a, b, c = map(int, input().split())
    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)
        if a == b == c:
            ans = -1
            break

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    ans = 0
    a, b, c = map(int, input().split())
    while a%2 == b%2 == c%2 == 0:
        ans += 1
        ta = a//2
        tb = b//2
        tc = c//2
        a = tb + tc
        b = ta + tc
        c = ta + tb
        if a == b == c:
            ans = -1
            break
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

x=0
if A==B and A==C:
    if A%2==0 and B%2==0 and C%2==0:
        print(-1)
    else:
        print(0)
else:
    while x>=0:
        if A%2==0 and B%2==0 and C%2==0:
            x+=1
            tmp1=A
            tmp2=B
            tmp3=C
            A=(tmp2+tmp3)//2
            B=(tmp1+tmp3)//2
            C=(tmp1+tmp2)//2
            #print(A,B,C)
        else:
            break
    print(x)

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

count = 0

while True:
    count += 1
    a,b,c = b//2+c//2,a//2+c//2,a//2+b//2
    if a%2 == 1 or b%2 == 1 or c%2 == 1:
        break

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

cnt=0
while(A%2==B%2==C%2==0):
  _A=A;_B=B;_C=C
  A=_B//2+_C//2
  B=_A//2+_C//2
  C=_B//2+_A//2
  cnt+=1
  #print(cnt,A,B,C)
print(cnt)

Submission status: Accepted

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

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

OK = True
count = 0

while OK:
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        OK = False
        break
    diva = a / 2
    divb = b / 2
    divc = c / 2
    a = divb + divc
    b = divc + diva
    c = diva + divb
    count += 1

print(count)

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

A, B, C = LI()

ans = 0
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 = (a + c)
    C = (a + b)
    ans += 1
    if ans == 10000:
        break


if ans == 10000:
    print(-1)
else:
    print(ans)

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
if A==B==C and A%2==B%2==C%2==0:
  print('-1')
elif A%2!=0 or B%2!=0 or C%2!=0:
  print('0')
else:
  ans=0
  while A%2==0 and B%2==0 and C%2==0:
    a=A
    b=B
    c=C
    A=int((b+c)/2)
    B=int((c+a)/2)
    C=int((a+b)/2)
    ans+=1
  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:
    count=0
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        A_copy, B_copy, C_copy = A, B, C
        A = int(B_copy/2 + C_copy/2)
        B = int(A_copy/2 + C_copy/2)
        C = int(A_copy/2 + B_copy/2)
        count += 1
    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)
    exit()

OK = True
count = 0

while OK:
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        OK = False
        break
    diva = a//2
    divb = b//2
    divc = c//2
    a = divb + divc
    b = divc + diva
    c = diva + divb
    count += 1

print(count)

Submission status: Accepted

Solution code:
# coding: utf-8
A, B, C = map(int, input().split())
count = 0

while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    if A == B == C:
        print(-1)
        exit()
    count += 1
    A1 = A
    B1 = B
    C1 = C
    A = B1//2 + C1//2
    B = A1//2 + C1//2
    C = A1//2 + B1//2

print(count)

Submission status: Accepted

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

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

for _ in range(100):
    cnt+=1
    new_A=B/2+C/2
    new_B=A/2+C/2
    new_C=A/2+B/2
    A,B,C=new_A,new_B,new_C
    if new_A%2==1 or new_B%2==1 or new_C%2==1:
        print cnt
        quit()
else:
    print -1

Submission status: Accepted

Solution code:
def resolve():
    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 = a / 2 + c / 2
        _c = a / 2 + b / 2

        if [a, b, c] == [_a, _b, _c]:
            count = -1
            break
        else:
            a, b, c = _a, _b, _c
            count += 1

    print(count)


resolve()

Submission status: Accepted

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

# A - Cookie Exchanges
def is_even(a, b, c):
	cookies = [a, b, c]
	return all(c % 2 == 0 for c in cookies)


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

for i in range(1000):
	if is_even(a, b, c):
		new_a = b//2 + c//2
		new_b = a//2 + c//2
		new_c = a//2 + b//2
		a, b, c = new_a, new_b, new_c
	else:
		print(i)
		exit()

print(-1)

Submission status: Accepted

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

if len(set(c)) == 1 and c[0] % 2 == 0:
    print(-1)
    exit()

cnt = 0
while c[0] % 2 != 1 and c[1] % 2 != 1 and c[2] % 2 != 1:
    c = [c[1]/2 + c[2]/2, c[0]/2 + c[2]/2, c[0]/2 + c[1]/2]
    cnt += 1
print(cnt)

Submission status: Accepted

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

cnt = 0
if (a == b) and (b == c) and (a%2==0):
    print(-1)
elif (a%2!=0) or b%2!=0 or c%2!=0:
    print(0)
else:
    while(True):
        a_ = a/2
        b_ = b/2
        c_ = c/2
        a = b_ + c_
        b = a_ + c_
        c = a_ + b_
        cnt+=1
        if a%2!=0 or b%2!=0 or c%2!=0:
            print(cnt)
            exit()

Submission status: Accepted

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

cnt=0
a = A
b = B
c = C

if  A==B and A==C and A%2==0:
    cnt = -1
else :
    while True:
        if A%2!=0 or B%2!=0 or C%2!=0:
            break
        else:
            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:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

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

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

ans = 0
while True:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 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
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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 and a%2==0:
    print(-1)
    exit()

sabc = a+b+c

cnt = 0
while True:
    a = (sabc-a)/2
    b = (sabc-b)/2
    c = (sabc-c)/2
    cnt+=1
    if a%2==1 or b%2==1 or c%2==1: break

print(cnt)

Submission status: Accepted

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

a1 = (b + c) / 2
b1 = (a + c) / 2
c1 = (a + b) / 2

diffs = [abs(a-a1), abs(b-b1), abs(c-c1)]

ans = []
for tmpdiff in diffs:
  count = 1
  while tmpdiff % 2 == 0:
    tmpdiff = tmpdiff / 2
    count += 1
    if tmpdiff == 0:
      count = -1
      break
      
  ans.append(count)

if not (a%2 ==0 and b%2 ==0 and c%2 ==0):
  print(0)
elif ans == [-1 for _ in range(len(ans))]:
  print(-1)
else:
  print(min([i for i in ans if i >0]))

Submission status: Accepted

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

ans = 0

while (A%2 == 0) & (B%2 == 0) & (C%2 == 0):
    if (A==B) & (B==C) :
        ans = -1
        break

    a = (B+C)/2
    b = (A+C)/2
    c = (A+B)/2
    A = a
    B = b
    C = c
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

while flag == True:
  if a%2 == 0 and b%2 == 0 and c%2 == 0:
    if (a==b==c):
      ans = -1
      break
    
    ans += 1
    at=a
    bt=b
    ct=c
    a = int(bt/2+ct/2)
    b = int(at/2+ct/2)
    c = int(at/2+bt/2)
  else:
    flag = False
    break
  
print(ans)

Submission status: Accepted

Solution code:
a,b,c = map(lambda x:int(x),input().split())
reps = 0
while a%2==0 and b%2==0 and c%2==0:
  if (a==b==c):
    reps = -1
    break
  at=a
  bt=b
  ct=c
  a = int(bt/2+ct/2)
  b = int(at/2+ct/2)
  c = int(at/2+bt/2)
  reps += 1
print(reps)

Submission status: Accepted

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

def main():
    A, B, C = map(int, open(0).read().split())

    if A == B == C and A % 2 == 0:
        print(-1)
    elif A % 2 or B % 2 or C % 2 == 1:
        print(0)
    else:
        cnt = 0
        for i in range(0, max(A, B, C)):
            if A % 2 or B % 2 or C % 2 == 1:
                break
            else:
                tmpA = B//2 + C//2
                tmpB = A//2 + C//2
                tmpC = A//2 + B//2
                A = tmpA
                B = tmpB
                C = tmpC
                cnt += 1
        print(cnt)


main()

Submission status: Accepted

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

ans=0
while a%2==0 and b%2==0 and c%2==0:
  if a==b==c:
    print(-1)
    exit(0)
  aa=a/2
  bb=b/2
  cc=c/2
  a=bb+cc
  b=aa+cc
  c=bb+aa
  ans+=1
print(ans)

Submission status: Accepted

Solution code:
A, B, C = [int(i) for i in input().split()]
t, a, s = [A, B, C]
ans = 0


while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    if A == B == C:
        ans = -1
        break
    t = B / 2 + C / 2
    a = A / 2 + C / 2
    s = A / 2 + B / 2
    A = t
    B = a
    C = s
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
A,B,C=[int(i) for i in input().split(" ")]
memo={}
n=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
    n+=1
    if (A,B,C) in memo:
        print(-1)
        break
    else:
        memo[(A,B,C)]=1
        memo[(A,C,B)]=1
        memo[(B,A,C)]=1
        memo[(B,C,A)]=1
        memo[(C,A,B)]=1
        memo[(C,B,A)]=1
else:
    print(n)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


def read():
    A, B, C = map(int, input().strip().split())
    return A, B, C


def solve(A, B, C):
    if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
        return 0
    if A == B and B == C:
        return -1
    n = 0
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        a = B // 2 + C // 2
        b = C // 2 + A // 2
        c = A // 2 + B // 2
        A = a
        B = b
        C = c
        n += 1
    return n


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

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()
    A1=A
    B1=B
    C1=C
    A = B1/2+C1/2
    B = A1/2+C1/2
    C = A1/2+B1/2
    ans +=1
print(ans)

Submission status: Accepted

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

ans = 0

while True:
    if a == b == c and a % 2 == 0:
        print(-1)
        break
    elif a == b == c and a % 2 != 0:
        print(ans)
        break
    elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        print(ans)
        break
    else:
        t_a = a // 2
        t_b = b // 2
        t_c = c // 2
        a = t_b + t_c
        b = t_a + t_c
        c = t_a + t_b
        ans += 1

Submission status: Accepted

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    a,b,c = readInts()
    for i in range(1001):
        if a&1 or b&1 or c&1: # どれかが奇数
            print(i)
            exit()
        na = (b+c)//2
        nb = (c+a)//2
        nc = (a+b)//2
        a,b,c = na,nb,nc
    print('-1')
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
import re
A,B,C = map(int,input().split())
#N = str(input())
#K = int(input())
#A = list(map(int,input().split()))
if A==B==C and A%2==0 and B%2==0 and C%2==0:
    print(-1)
    exit()
flag=True
co=0
if A%2!=0 or B%2!=0 or C%2!=0:
    flag=False
while flag==True:
    co+=1

    a=B/2 + C/2
    b=A/2 + C/2
    c=B/2 + A/2
    if a%2!=0 or b%2!=0 or c%2!=0:
        flag=False
    A=a
    B=b
    C=c

print(co)

Submission status: Accepted

Solution code:
from fractions import gcd
def main():
    a, b, c = map( int, input().split())
    if a == b == c:
        if a%2 == 1:
            print("0")
        else:
            print("-1")
        return
    ans = 0
    bi = 2
    while a%bi == 0 and b%bi == 0 and c%bi == 0:
        a, b, c = a//2+b//2, b//2+c//2, c//2+a//2
        ans += 1
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

#======================================================#

def main():
    a, b, c = MII()
    if a == b == c:
        print(a%2-1)
        return None
    cnt = 0
    while a%2==0 and b%2==0 and c%2==0:
        a, b, c = (c+b)//2, (a+c)//2, (a+b)//2
        cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

#======================================================#

def main():
    a, b, c = MII()
    if a%2 != 0 or b%2 != 0 or c%2 != 0:
        print(0)
        return None
    # 無限の場合
    if a == b == c:
        print(-1)
        return None
    cnt = 0
    while a%2==0 and b%2==0 and c%2==0:
        x = b//2 + c//2
        y = a//2 + c//2
        z = a//2 + b//2
        a, b, c = x, y, z
        cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a, b, c = map(int, input().split())
o = 0
if a == b == c:print(a%2-1);exit() 
while 1-any([a%2, b%2, c%2]):
    a, b, c = (b+c)//2, (c+a)//2, (a+b)//2
    o += 1
print(o)

Submission status: Accepted

Solution code:
'''
再帰を使う解き方
'''
def solve(A, B, C):
    # クッキーが奇数枚の場合処理を終了する
    if (A % 2 == 1 or B % 2 == 1 or C % 2 == 1): return 0
    # クッキーの枚数が同数の場合無限に操作が行われる
    elif (A == B == C): return -1
    # クッキーの枚数がいずれも偶数米の場合、操作を実施し次の操作に移る
    else: return solve((B/2 + C/2), (A/2 + C/2), (A/2 + B/2)) + 1

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

Submission status: Accepted

Solution code:
def solve(A, B, C):
    if (A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
        return 0
    elif (A == B == C):
        return -1
    else:
        return solve((B/2 + C/2), (A/2 + C/2), (A/2 + B/2)) + 1

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

Submission status: Accepted

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

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

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:
    count = 0
    while (A % 2 == B % 2 == C % 2 == 0):
        wA = (B/2 + C/2)
        wB = (A/2 + C/2)
        wC = (A/2 + B/2)
        A = wA
        B = wB
        C = wC
        count += 1
    ans = count

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if a%2 or b%2 or c%2:
  print(0)
  exit()
elif a==b==c:
  print(-1)
  exit()
  
ans =0
while 1:
  if all((a%2==0, b%2==0, c%2==0)):
    ans += 1
  else:
    print(ans)
    exit()
  a, b, c = (b+c)//2, (a+c)//2, (b+a)//2

Submission status: Accepted

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

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

ans=0
while True:
    if a%2==1 or b%2==1 or c%2==1:
        break
    if a==b==c:
        ans=-1
        break
    ans+=1
    na=(b+c)/2
    nb=(c+a)/2
    nc=(a+b)/2
    a=na
    b=nb
    c=nc
print(ans)

Submission status: Accepted

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

if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
  result = 0
elif A == B == C:
  result = -1
else:
  while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    result += 1
    a = A/2
    b = B/2
    c = C/2
    A = b + c
    B = a + c
    C = b + a
   
print(result)

Submission status: Accepted

Solution code:

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

    ans = 0
    a = A
    b = B
    c = C
    while(True):
        x = int((b + c)/ 2)
        y = int((a + c)/ 2)
        z = int((a + b)/2)

        a = x
        b = y
        c = z

        ans += 1

        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            print(ans)
            return
        elif a == A and b == B and c == C:
            print(-1)
            return

solve()

Submission status: Accepted

Solution code:

a, b, c = list(map(int, input().split(' ')))
cnt = 0
if a == b == c:
    cnt = a%2-1
else:
    while not (a%2 or b%2 or c%2):
        cnt += 1
        a,b,c=(b+c)/2,(a+c)/2,(a+b)/2

print(cnt)

Submission status: Accepted

Solution code:
A,B,C = list(map(int, input().split()))
count=0
while True:
    if A%2 ==1or B%2 ==1 or C%2 ==1:
        print(count)
        break
    elif  A==B and B==C and C==A:
        print(-1)
        break 
    elif A%2==0 and B%2==0 and C%2 == 0:
        A2 = 0.5*A
        B2 = 0.5*B
        C2 = 0.5*C
        A = B2+C2
        B = C2+A2
        C = A2+B2
        count=count+1

Submission status: Accepted

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

def F(A,B,C):
    if any(x&1 for x in [A,B,C]):
        return 0
    if A == B == C:
        return -1
    return 1 + F((A+B)//2,(B+C)//2,(C+A)//2)

answer = F(A,B,C)
print(answer)

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
if A == B == C and A%2 == 0:
  print(-1)
elif A%2 == 1 or B%2 == 1 or C%2 == 1:
  print(0)
else:
  c = 0
  while A%2 == B%2 == C%2 == 0:
    A0 = A
    B0 = B
    C0 = C
    A = (B0+C0)/2
    B = (C0+A0)/2
    C = (A0+B0)/2
    c += 1
  print(c)

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
if A==B==C and A%2==0:
  print(-1)
elif A%2==1 or B%2==1 or C%2==1:
  print(0)
else:
  c=0
  while A%2==B%2==C%2==0:
    A0=A
    B0=B
    C0=C
    A=(B0+C0)/2
    B=(C0+A0)/2
    C=(A0+B0)/2
    c+=1
  print(c)

Submission status: Accepted

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


def func(x):
    cnt = 0
    while x % 2 == 0:
        x //= 2
        cnt += 1

    return cnt


if A % 2 or B % 2 or C % 2:
    print(0)
elif A == B == C:
    print(-1)
else:
    m = min(func(A + B), func(B + C), func(C + A))
    print(m)

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

s = set()

cnt = 0
while A % 2 == B % 2 == C % 2 == 0:
    if (A, B, C) in s:
        cnt = -1
        break
    s.add((A, B, C))
    A, B, C = B // 2 + C // 2, C // 2 + A // 2, A // 2 + B // 2
    cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
count = 0
while(True):
    if a%2 == 1 or b%2 == 1 or c%2 == 1:
        break
    a0 = a
    b0 = b
    c0 = c
    a = (b0+c0)/2
    b = (c0+a0)/2
    c = (a0+b0)/2
    count += 1
    if a0 == a and b0 == b and c0 == c:
        count = -1
        break
print(count)

Submission status: Accepted

Solution code:
import math
import sys


def rem(a, b, c):
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        return False
    else:
        return True
def isDouble(a, b, c):
    if (a%1!=0 or b%1!=0 or c%1!=0):
        return False
    else:
        return True
a, b, c = map(int, input().split())
cnt = 0
fa = a
fb = b
fc=c
while True:
    if (cnt != 0 and fa == a and fb == b and fc == c):
        print(-1)
        sys.exit()
    tmp1 = a / 2
    tmp2 = b / 2
    tmp3 = c / 2
    if (not isDouble(tmp1, tmp2, tmp3)):
        break
    cnt += 1
    a = tmp2 + tmp3
    b = tmp1 + tmp3
    c = tmp1 + tmp2
    if (not rem(a, b, c)):
        break
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
i = 0
f = True
while a%2==0 and b%2==0 and c%2==0:
    at = a//2
    bt = b//2
    ct = c//2
    a = bt + ct
    b = at + ct
    c = at + bt
    i+=1
    if a == b == c:
        print(-1)
        f = False
        break
if f:
    print(i)

Submission status: Accepted

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

k=0
if A%2==B%2==C%2==0 and A==B==C:
    k=-1
else:
    while A%2==B%2==C%2==0:
        a=A
        b=B
        c=C
        A=(b+c)/2
        B=(a+c)/2
        C=(a+b)/2
        k+=1

print(k)

Submission status: Accepted

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

def divide2(x):
    r = 0
    while x%2 == 0:
        r += 1
        x = x/2
    return r

if A == B == C:
    if A%2 == 0:
        print(-1)
    else:
        print(0)
else:
    print(min(divide2(A+B),divide2(B+C),divide2(C+A)))

Submission status: Accepted

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

resolve()