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
temp_a = 0
temp_b = 0
temp_c = 0
init_a = a
init_b = b
init_c = c
while True:
    if a==init_a and b==init_b and c==init_c and count!=0:
        count = -1
        break
    elif a%2==0 and b%2==0 and c%2==0:
         temp_a = a/2
         temp_b = b/2
         temp_c = c/2
         a = temp_b+temp_c
         b = temp_a+temp_c
         c = temp_a+temp_b
         count += 1
    else:
        break
print(count)

Submission status: Accepted

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

ans=0
lst=[]
l=[A,B,C]
l.sort()
lst.append(l)
while(1):
    if A%2==1 or B%2==1 or C%2==1:
        print(ans)
        exit()
    a=A
    b=B
    c=C
    A=(b+c)//2
    B=(a+c)//2
    C=(a+b)//2
    ans+=1
    l=[A,B,C]
    #print(l)
    l.sort()
    for i in range(len(lst)):
        cnt=0
        for j in range(3):
            if lst[i][j]==l[j]:
                cnt+=1
        if cnt==3:
            print(-1)
            exit()

Submission status: Accepted

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

while cnt <= 10**6:
    if (a%2 != 0 or b%2 != 0 or c%2 != 0):
        print(cnt)
        exit()
    
    if a==b==c:
        print(-1)
        exit()
    
    a_ = b//2 + c//2
    b_ = a//2 + c//2
    c_ = a//2 + b//2

    a = a_
    b = b_
    c = c_

    cnt += 1

Submission status: Accepted

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

while cnt <= 10**6:
    if a%2 != 0 or b%2 != 0 or c%2 != 0:
        print(cnt)
        exit()
    
    a_ = b//2 + c//2
    b_ = a//2 + c//2
    c_ = a//2 + b//2

    a = a_
    b = b_
    c = c_

    cnt += 1
print(-1)

Submission status: Accepted

Solution code:
import numpy as np
import sys

input = sys.stdin.readline

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


if A == B == C and A%2 == 0 and B%2 == 0 and C%2 == 0:
    ans = -1
else:
    ans = 0
    while A%2 == 0 and B%2 == 0 and C%2 == 0:
        next_a = C/2 + B/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 = map(int,input().split())
ans = 0
comb = set()
while a%2==0 and b%2==0 and c%2==0:
    x = (b+c)//2
    y = (a+c)//2
    z = (b+c)//2
    if (x,y,z) in comb:
        ans = -1
        break
    ans += 1
    comb.add((x,y,z))
    a,b,c = x,y,z
print(ans)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
count = 0
fA = A
fB = B
while A%2 == 0 and B%2 == 0 and C%2 == 0:
    hA = A/2
    hB = B/2
    hC = C/2
    A = hB + hC
    B = hA + hC
    C = hA + hB
    count += 1
    if A == fA and B == fB:
        count = -1 
        break

print(count)

Submission status: Accepted

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

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

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

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 itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
from fractions import gcd
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()
    ab = abs(a-b)
    bc = abs(b-c)
    cnt = 0
    if a == b == c == 1:
        print(0)
        exit()
    if ab == 0 and bc == 0:
        print('-1')
        exit()
    while True:
        if ab % 2 == 0 and bc % 2 == 0:
            ab //= 2
            bc //= 2
            cnt += 1
        else:
            break
    print(cnt)

if __name__ == '__main__':
  main()

Submission status: Accepted

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

changed_list = []
now_list = [A, B, C]
ans = 0
flag = True

while flag:
    if now_list in changed_list:
        flag = False
        ans = -1
    else:
        if len([i for i in now_list if not i % 2 == 0]) != 0:
            flag = False
        else:
            changed_list.append(now_list)
            a = now_list[1] / 2 + now_list[2] / 2
            b = now_list[0] / 2 + now_list[2] / 2
            c = now_list[0] / 2 + now_list[1] / 2
            now_list = [a, b, c]

if ans != -1:
    ans = len(changed_list)

print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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

        print(res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
ans = 0
while True:
    # print(A, B, C)
    if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        if A == B == C:
            print(-1)
            exit()
        ans += 1
        tA = A
        tB = B
        tC = C
        A = tB//2 + tC//2
        B = tA//2 + tC//2
        C = tB//2 + tA//2
    else:
        print(ans)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys

a, b, c = map(int, input().split())
if (a == b == c):
    if (a % 2 == 0):
        print(-1)
        sys.exit()
    else:
        print(0)
        sys.exit()

cnt = 0
while(True):
    half_a, half_b, half_c = a / 2, b / 2, c / 2
    ea = a % 2 == 0
    eb = b % 2 == 0
    ec = c % 2 == 0
    if (ea and eb and ec or (not ea) and (not eb) and (not ec)):
        cnt += 1
        a = half_b + half_c
        b = half_a + half_c
        c = half_a + half_b
    else:
        break

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
if A == B == C and A%2 == 0:
  print(-1)
else:
  D = 0
  while A%2 == 0 and B%2 == 0 and C%2 == 0:
    D += 1
    AA = B/2 + C/2
    BB = A/2 + C/2
    CC = A/2 + B/2
    A = AA
    B = BB
    C = CC
  print(D)

Submission status: Accepted

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

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

i = 0
a_, b_, c_ = a, b, c

while a%2 == 0 and b%2 == 0 and c%2 == 0:
    i += 1
    a = b_//2 + c_//2
    b = a_//2 + c_//2
    c = a_//2 + b_//2
    a_, b_, c_ = a, b, c

print(i)

Submission status: Accepted

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

def readlines(n):
    for _ in range(n):
        yield map(int, input().split())


def main():
    a, b, c = map(int, input().split())
    if a == b == c:
        if a % 2 == 0:
            yield -1
        else:
            yield 0
            
        return

    while all(x%2 == 0 for x in (a, b, c)):
        a_ = a//2
        b_ = b//2
        c_ = c//2
        a, b, c = b_+c_, a_+c_, a_+b_
        yield 1


print(sum(main()))

Submission status: Accepted

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

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

else:
    for i in range(1000000000):
        if 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
        else:
            print(i)
            exit()

Submission status: Accepted

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

total = a + b + c

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

Submission status: Accepted

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

while 1:
    if A%2 != 0 or B%2 != 0 or C%2 != 0:
        print(ans)
        break
    else:
        tmp = [B//2 + C//2, C//2 + A//2, A//2 + B//2]
        if tmp == [A,B,C]:
            print(-1)
            break
        else:
            A,B,C = tmp[0], tmp[1], tmp[2]
            ans += 1

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
if A==B==C and A%2==0: print(-1)
else:
    k=0
    while all(x%2==0 for x in [A,B,C]):
        A,B,C=(B+C)//2,(C+A)//2,(A+B)//2
        k+=1
    print(k)

Submission status: Accepted

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

Submission status: Accepted

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

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

count = 0
for i in range(10**9):
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break
    count += 1
    a = A
    b = B
    c = C
    A = b // 2 + c // 2
    B = a // 2 + c // 2
    C = a // 2 + b // 2

print(count)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
ans = 0
cont = True
while cont:
    if A == B == C and A%2==0 :
        ans = -1
        break
    elif A%2==0 and B%2==0 and C%2==0:
        b_A = A
        b_B = B
        b_C = C
        A = b_B//2 + b_C//2
        B = b_A//2 + b_C//2
        C = b_A//2 + b_B//2
        ans += 1
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, C = map(int, readline().split())
    ans = 0
    if A==B==C:
        if A%2==0:
            ans = -1
        else:
            ans = 0
    else:
        pre_A = A
        pre_B = B
        pre_C = C
        while pre_A%2==0 and pre_B%2==0 and pre_C%2==0:
            now_A = (pre_B+pre_C)//2
            now_B = (pre_A+pre_C)//2
            now_C = (pre_A+pre_B)//2
            pre_A = now_A
            pre_B = now_B
            pre_C = now_C
            ans += 1
    print(ans)




if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

else:
    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
        count += 1

    print(count)

Submission status: Accepted

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

#print(A,B,C)

if A==B and B==C and A%2==1:
  print(0)
  
elif A==B and B==C:
  print(-1)
else:
  count=0
  while A%2==0 and B%2==0 and C%2==0:
    Ax=A/2
    Bx=B/2
    Cx=C/2
    #print(Ax,Bx,Cx)
    A = int(Bx+Cx)
    B = int(Cx+Ax)
    C = int(Ax+Bx)
    count +=1
    #print(A,B,C)
  print(count)

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
cnt=0
tmp=[0]*3

while a[0]%2==0 and a[1]%2==0 and a[2]%2==0:
  if a[0]==a[1]==a[2]:
    cnt=-1
    break
  else:
    tmp[0]=a[1]//2+a[2]//2
    tmp[1]=a[0]//2+a[2]//2
    tmp[2]=a[0]//2+a[1]//2
    a[0],a[1],a[2]=tmp[0],tmp[1],tmp[2]
  cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
a,b,c  = map(int, input().split())
INF = 10**4
cnt = 0
while a%2==0 and b%2==0 and c%2==0:
    # print(cnt)
    if cnt == INF:
       print(-1)
       exit()
    x = a + (b+c)//2
    y = b + (c+a)//2
    z = c + (a+b)//2
    a,b,c = x,y,z
    cnt+=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split(' '))
num = 0
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    print(0)
elif A == B == C:
    print(-1)
elif A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        A_c = A
        B_c = B
        C_c = C
        A = B_c /2 + C_c / 2
        B = A_c / 2 + C_c /2
        C = A_c /2 + B_c / 2
        num += 1
    print(num)

Submission status: Accepted

Solution code:
A,B,C= map(int, input().split())
cot = 0
while True:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break
    else:
        tempA = (B + C)//2
        tempB = (A + C)//2
        tempC = (B + A)//2
        A = tempA
        B = tempB
        C = tempC
        cot += 1

        if cot > 1000000:
            print(-1)
            exit(0)
            
print(cot)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = list(map(int, input().split()))
N2 = [0,0,0]
ans = 0
while True:
    for i in range(3):
        if  not N[i] %2 == 0:
            print(ans)
            exit()
    N2[0] = (N[1] + N[2]) /2
    N2[1] = (N[0] + N[2]) /2
    N2[2] = (N[0] + N[1]) /2
    #print(N2)
    if N == N2:
        print('-1')
        exit()
    N = N2.copy()
    ans += 1

Submission status: Accepted

Solution code:
#ABC014-A
abc = list(map(int,input().split()))

cnt = 0

while True:
    prev = abc[:]
    if abc[0] % 2 == 1 or abc[1] % 2 == 1 or abc[2] % 2 == 1:
        break
    tmp = [abc[0]//2,abc[1]//2,abc[2]//2]

    abc = [tmp[1]+tmp[2],tmp[0]+tmp[2],tmp[0]+tmp[1]]
    cnt += 1
    

        
    if abc[0] == prev[0] and abc[1] == prev[1] and abc[2] == prev[2]:
        cnt = -1
        break
    else:
        continue
        
    
        
print(cnt)

Submission status: Accepted

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

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)
else:
    ans = 0
    done = set((a, b, c))
    while True:
        ans += 1
        s = a // 2
        t = b // 2
        u = c // 2
        a, b, c = t + u, s + u, s + t
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            print(ans)
            break
        elif (a, b, c) in done:
            print(-1)
            break
        else:
            done.add((a, b, c))

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

def func(a):
    b = []
    for ai in a:
        for j in reversed(range(30)):
            if (ai >> j) * 2 ** j == ai:
                b.append(j)
                break
    return b

a = LIST()
if len(set(a)) == 1 and not a[0] % 2:
    print(-1)
    exit()
b = func(a)
ans = 0
while True:
    if 0 in b:
        break
    tmp = [0, 0, 0]
    for i in range(3):
        for j in range(3):
            if i == j:
                continue
            tmp[i] += a[j] // 2
    a = tmp
    b = func(a)
    ans += 1
print(ans)

Submission status: Accepted

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

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

if a ==b and b ==c:
  print('-1')
  exit()
else:
  while i%2 ==0 and j%2==0 and k%2==0:
    i = (b+c)/2
    j = (c+a)/2
    k = (a+b)/2
    a,b,c = i,j,k
    X +=1
print(X)

Submission status: Accepted

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

la = [A]
lb = [B]
lc = [C]

ans = 0
while la[ans] % 2 == 0 and lb[ans] % 2 == 0 and lc[ans] % 2 == 0 and ans < 100001:
    la.append((lb[ans] + lc[ans]) / 2)
    lb.append((lc[ans] + la[ans]) / 2)
    lc.append((la[ans] + lb[ans]) / 2)
    ans += 1

if ans == 100001:
    print(-1)
else:
    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)
    exit()

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
s = sum([a, b, c])

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
    if ans > 100000:
        ans = -1
        break

print(ans)

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

Submission status: Accepted

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

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 and B == C:
    print(-1)

else:
    step = 0
    while True:
        step += 1
        nA = B // 2 + C // 2
        nB = A // 2 + C // 2
        nC = A // 2 + B // 2
        A, B, C = nA, nB, nC
        if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
            print(step)
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#2
#入力
A,B,C=map(int,input().split())

#デバッグ関連
debug=1#0:本番,1:デバッグ

def pront(*n):
    if debug==1:
        print(n)

#処理
if A%2==1 or B%2==1 or C%2==1:
    
    print(0)
    
elif A==B==C:
    
    print(-1)
    
else:
    x=0
    while not(A%2==1 or B%2==1 or C%2==1):
        a=A
        b=B
        c=C
        
        A=(b+c)//2
        B=(a+c)//2
        C=(a+b)//2
        x+=1
    
    print(x)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
li = [A,B,C]
if A&1 ==1 or B&1 ==1 or C&1 ==1:
    print(0)
else:
    num = 1
    a = (B+C)//2
    b = (A+C)//2
    c = (A+B)//2
    flag = True
    while li != [a,b,c]:
        if a&1 ==1 or b&1 ==1 or c&1 ==1:
            flag = False
            break
        a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
        num += 1
    if flag:
        print(-1)
    else:
        print(num)

Submission status: Accepted

Solution code:
def is_no_odd(x, y, z):
    return x % 2 == 0 and y % 2 == 0 and z % 2 == 0


def exchange(x, y, z):
    new_x = y / 2 + z / 2
    new_y = x / 2 + z / 2
    new_z = x / 2 + y / 2
    return new_x, new_y, new_z


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

while is_no_odd(a, b, c):
    if a == b == c:
        cnt = -1
        break

    a, b, c = exchange(a, b, c)
    cnt += 1

print(cnt)

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#13
a,b,c = map(int,input().split())
cnt = 0
if a%2 == 1 or b%2 == 1 or c%2 == 1:
    print('0')

elif a==b==c and a%2==0:
            print('-1')
    
elif not a==b==c:
    while a%2 == b%2 == c%2 == 0:
        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:
    print(-1)
else:
    count = 0
    while True:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            break
        count += 1
        temp_a = b // 2 + c // 2
        temp_b = a // 2 + c // 2
        temp_c = a // 2 + b // 2
        a, b, c = temp_a, temp_b, temp_c
    print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
T = [A, B, C]
T.sort()
count = 0

def trade(T, count):
    Ts = [0]*3
    if T[0] == T[1] == T[2] and T[0]%2==0:
        return -1
    elif T[0]%2 != 0 or T[1]%2 != 0 or T[2]%2 != 0:
        return count
    else:
        count += 1
        Ts[0] = (T[1]+T[2])/2
        Ts[1] = (T[0]+T[2])/2
        Ts[2] = (T[0]+T[1])/2
        return trade(Ts, count)

print(trade(T, count))

Submission status: Accepted

Solution code:
a,b,c=map(int,input().rstrip().split(' '))
if(a==b and b==c):
	if(a%2==0):
		print(-1)
	else:
		print(0)
else:
	n=0
	while(a%2==0 and b%2==0 and c%2==0):
		n+=1
		tmp_a=(b+c)/2
		tmp_b=(a+c)/2
		tmp_c=(b+a)/2
		a=tmp_a
		b=tmp_b
		c=tmp_c
	print(n)

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
cnt=0
if(A==B==C):
    if A%2!=0:
        print(0)
    else:
        print(-1)
    exit()
while(A%2==B%2==C%2==0):
    a,b,c=A,B,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 time
t=time.time()
A,B,C=map(int,input().split())
cnt=0
while(A%2==B%2==C%2==0):
    a,b,c=A,B,C
    A=b//2+c//2;B=a//2+c//2;C=a//2+b//2
    cnt+=1
    if(time.time()-t>=1):
        print(-1)
        exit()
print(cnt)

Submission status: Accepted

Solution code:
import numpy as np
cookies = np.array([int(x) for x in input().split()])

if any(cookies%2):
  ans = 0
elif cookies[0] == cookies[1] == cookies[2]:
  ans = -1
else:
  ans = 0
  while True:
    if not any(cookies%2):
      cookies = cookies//2
      ans += 1
      continue
    if all(cookies%2):
      ans += 1
    break
print(ans)

Submission status: Accepted

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

if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    if a == b == c:
        print(-1)
        quit()
ans = 0
a_n = 0
b_n = 0
c_n = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    a_n = (b+c)//2
    b_n = (a+c)//2
    c_n = (a+c)//2
    a = a_n
    b = b_n
    c = c_n
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0

if a==b==c and a%2==0:
  print("-1")
  exit()
  
for i in range(10**6):
  if a%2==0 and b%2==0 and c%2==0:
    tmpA = b/2 + c/2
    tmpB = a/2 + c/2
    tmpC = a/2 + b/2
    a = tmpA
    b = tmpB
    c = tmpC
    cnt +=1
  else:
    print(cnt)
    break

Submission status: Accepted

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

if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1:
    print(0)
    exit()

cnt = 0
for _ in range(1000):
    for i in a:
        if i % 2 == 1:
            print(cnt)
            exit()
    a[0], a[1], a[2] = a[1] // 2 + a[2] // 2, a[0] // 2 + a[2] // 2, a[0] // 2 + a[1] // 2
    cnt += 1
else:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
if any([a%2==1,b%2==1,c%2==1])==True:
    print(0)
else:
    if len(set({a,b,c}))==1:
        print(-1)
    else:
        res=0
        while all([a%2==0,b%2==0,c%2==0]):
            a,b,c=(b+c)//2,(a+c)//2,(a+b)//2
            res+=1
        print(res)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

def func(a, b, c):
    if a%2 == 1 or b%2 == 1 or c%2 ==1:
        return 0
    if a == b and a == c:
        return -1
    return func((b+c)//2, (c+a)//2, (a+b)//2) + 1

a, b, c= inpl()
ans = func(a, b, c)
print(ans)

Submission status: Accepted

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

cnt = 0

f_a = a
f_b = b
f_c = c

while(a%2==0 and b%2==0 and c%2==0):
    t_a = a
    t_b = b
    t_c = c
    a = (t_b+t_c)/2
    b = (t_c+t_a)/2
    c = (t_a+t_b)/2
    cnt += 1
    if (a == f_a and b == f_b and c == f_c):
        cnt = -1
        break


print(cnt)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    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_tmp = (b+c)//2
        b_tmp = (a+c)//2
        c_tmp = (c+a)//2
        a = a_tmp
        b = b_tmp
        c = c_tmp
        ans += 1

    print(ans)