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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, C = MAP()

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

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
original = [a,b,c]
flag = 0
i = 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_
    if [a,b,c] == original:
        flag = 1
        break
    i += 1
if flag:
    print(-1)
else:
    print(i)

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

for i in range(1,1000000):
    a2=(b//2)+(c//2)
    b2=(a//2)+(c//2)
    c2=(a//2)+(b//2)
    
    a,b,c=a2,b2,c2
    
    if a%2==1 or b%2==1 or c%2==1:
        print(i)
        exit()

print("-1")

Submission status: Accepted

Solution code:
#template
from collections import Counter
def inputlist(): return [int(j) for j in input().split()]
#template
A,B,C = inputlist()
if A == B == C and A%2==0 and B % 2 == 0 and C % 2 == 0:
    print(-1)
    exit()


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

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    if arr[0][0] != 2:
            return 0
    if arr[0][0] == 2:
        return arr[0][1]
fa = factorization(A)
fb = factorization(B)
fc = factorization(C)
if fa == 0 or fb == 0 or fc == 0:
    print(0)
    exit()
f = min(fa,fb,fc)
if fa ==fb==fc:
    f+=1
print(f)

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
a,b,c = iim()
count = 0
if a == b == c and a%2 == 0:
    print(-1)
    exit()

while a%2 == 0 and b%2 == 0 and c%2 == 0:
    ta = a
    tb = b
    tc = c
    a = (tb+tc)//2
    b = (tc+ta)//2
    c = (ta+tb)//2
    count += 1

print(count)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans=0
for i in range(10000):
    if a%2==0 and b%2==0 and c%2==0:
        tmp1=b//2+c//2
        tmp2=a//2+c//2
        tmp3=a//2+b//2
        a,b,c=tmp1,tmp2,tmp3
        ans+=1
    else:
        break

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

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

Submission status: Accepted

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

A,B,C = imn()

count = 0
for i in range(10**6):
    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
else:
    count = -1
print(count)

Submission status: Accepted

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

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

ans = 0
while A%2==0 and B%2==0 and C%2==0:
    tmpA = A//2
    tmpB = B//2
    tmpC = C//2
    A = tmpB+tmpC
    B = tmpC+tmpA
    C = tmpA+tmpB
    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:
    d, e, f = b//2 + c//2, a//2 + c//2, a//2 + b//2
    if [a, b, c] == [d, e, f]:
        print(-1)
        break
    ans += 1
    a, b, c = d, e, f
else:
    print(ans)

Submission status: Accepted

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

    count = 0
    while True:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            print(count)
            break
        elif a == b == c:
            print(-1)
            break
        count += 1
        i, j, k = a / 2, b / 2, c / 2
        a, b, c = j + k, k + i, i + j


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if A==B==C:
  if A%2==0:
    cnt=-1
  else:
    cnt=0
else:
  while A%2==0 and B%2==0 and C%2==0:
    s=A//2
    t=B//2
    u=C//2
    A=t+u
    B=u+s
    C=s+t
    cnt +=1
    
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(0)


def solve(n):
    i = 0
    while(n % 2 == 0):
        n = n // 2
        i += 1
    return(i)


a = solve(A+B)
b = solve(B+C)
c = solve(C+A)
if a == b and b == c:
    print(-1)
else:
    print(min(a, b, c))

Submission status: Accepted

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

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

count = 0
while True:
    if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
        print(count)
        exit()

    nA = (B + C) // 2
    nB = (A + C) // 2
    nC = (A + B) // 2
    count += 1
    A, B, C = nA, nB, nC

Submission status: Accepted

Solution code:
x,y,z=list(map(int, input().split()))
a=x
b=y
c=z
cnt=0
for i in range(100):
	if 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=x
		b=y
		c=z
		cnt=cnt+1
if cnt>30:
	cnt=-1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding uft-8
import copy
a, b, c = map(int,input().split())

def solve(a,b,c):
    ans = 0
    while True:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            return ans
        else:
            s = copy.copy(a)
            t = copy.copy(b)
            u = copy.copy(c)
            a = t//2 + u//2
            b = s//2 + u//2
            c = s//2 + t//2
            ans += 1

        

if len(set([a,b,c])) == 1 and a%2==0 and b%2==0 and c%2==0:
    print(-1)
else:
    print(solve(a,b,c))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
# input = sys.stdin.r/eadline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    A,B,C = MAP()
    if A==B==C:
        if A%2==1 or B%2==1 or C%2==1:
            print(0)
        else:
            print(-1)
        return
    answer = 0
    
    while A%2==0 and B%2==0 and C%2==0:
        x = A//2
        y = B//2
        z = C//2
        A = y+z
        B = x+z
        C = y+x
        answer += 1
    print(answer)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    cookies = list(map(int, input().split()))
    answer = 0
    if cookies[0] == cookies[1] == cookies[2] and cookies[0] % 2 == 0:
        answer = -1
    elif all(cookies[i] % 2 == 0 for i in range(3)):
        half = [0, 0, 0]
        sum_cookies = sum(cookies)
        while all(cookies[i] % 2 == 0 for i in range(3)):
            for i in range(3):
                half[i] = (sum_cookies - cookies[i]) // 2
            cookies[0] = half[1] + half[2]
            cookies[1] = half[0] + half[2]
            cookies[2] = half[1] + half[0]
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

while True:
    x=A
    y=B
    z=C
    if A%2!=0 or B%2!=0 or C%2!=0:
        break
    cnt+=1
    A=(y+z)//2
    B=(x+z)//2
    C=(x+y)//2
    #print(A,B,C)
print(cnt)

Submission status: Accepted

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

for i in range(36):
    if A % 2 or B % 2 or C % 2:
        break

    tA = (B + C) // 2
    tB = (A + C) // 2
    tC = (B + A) // 2
    A = tA
    B = tB
    C = tC
else:
    i = -1

print(i)

Submission status: Accepted

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


def check(A, B, C):
    if A & 1 or B & 1 or C & 1:
        return 0
    if A == B == C:
        return -1
    return 1 + check((A + B) // 2, (B + C) // 2, (C + A) // 2)


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

Submission status: Accepted

Solution code:
# 解答AC

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

is_even = lambda n: True if n % 2 == 0 else False

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

Submission status: Accepted

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

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

if ans == 10**6:
    ans = -1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
A = [a]
ans = 0
while True:
    if (A[-1][0] & 1)or(A[-1][1] & 1)or(A[-1][2] & 1):
        print(ans)
        break
    tmp = [A[-1][1]//2+A[-1][2]//2, A[-1][0]//2 +
           A[-1][2]//2, A[-1][0]//2+A[-1][1]//2]
    if tmp in A:
        print(-1)
        break
    A.append(tmp)
    ans += 1

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
old_abc = [a,b,c]
res = 0
flg = 0
while a%2==0 and b%2==0 and c%2==0 and flg == 0:
  tmp_a = a/2
  tmp_b = b/2
  tmp_c = c/2
  a = tmp_b + tmp_c
  b = tmp_c + tmp_a
  c = tmp_a + tmp_b
  res += 1
  if old_abc == [a,b,c]:
    flg = 1
if flg == 1:
  print(-1)
else:
  print(res)

Submission status: Accepted

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

while(cnt<=10**6):
    if A%2==0 and B%2==0 and C%2==0:
        mm1 = (B//2+C//2)
        mm2 = (A//2+C//2)
        mm3 = (A//2+B//2)
        A,B,C = mm1,mm2,mm3
        cnt += 1
    else:
        break

if cnt==10**6+1:
    print(-1)
else:
    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")
    else:
        if a == b == c:
            print("-1")
        else:
            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)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
if A==B and B==C and A%2==0:
    print(-1)
elif A%2==1 or B%2==1 or C%2==1:
    print(0)
else:
    ans=0
    flag=0
    d=0
    while flag==0:
        if (A>>d &1)==(B>>d &1) and (C>>d &1)==(B>>d &1):
            d+=1
        else:
            ans=d
            break
    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:
    na,nb,nc = 0,0,0
    cnt = 0
    while a%2==0 and b%2==0 and c%2==0:
        na = (b+c)//2
        nb = (c+a)//2
        nc = (a+b)//2
        cnt += 1
        a,b,c = na,nb,nc
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):  # リストに重複した要素があるか判定（要素にリストがある場合）
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


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

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

Submission status: Accepted

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

ba = a
bb = b
bc = c
ans = 0
while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        break

    if a==b==c:
        ans=-1
        break
    ta = a//2
    tb = b//2
    tc = c//2
    a = tb+tc
    b = ta+tc
    c = ta+tb
    ans += 1

    # if a == ba and b == bb and c == bc:
    #     ans = -1
    #     break

print(ans)

Submission status: Accepted

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

ba = a
bb = b
bc = c
ans = 0
while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        break

    ta = a//2
    tb = b//2
    tc = c//2
    a = tb+tc
    b = ta+tc
    c = ta+tb
    ans += 1

    if a == ba and b == bb and c == bc:
        ans = -1
        break

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

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
cnt = 0
while(1):
    if A%2!=0 or B%2!=0 or C%2!=0:
        break
    A_tmp = A
    B_tmp = B
    C_tmp = C
    A = (B_tmp+C_tmp)/2
    B = (A_tmp+C_tmp)/2
    C = (A_tmp+C_tmp)/2
    cnt += 1
    if A_tmp==A and B_tmp==B and C_tmp==C:
        cnt = -1
        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:
    ans=0
    while a%2==0 and b%2==0 and c%2==0:
        a0,b0,c0=(b+c)//2,(c+a)//2,(a+b)//2
        a,b,c=a0,b0,c0
        ans+=1
    print(ans)

Submission status: Accepted

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

a, b, c = map(int, input().split())
n_a, n_b, n_c = 0, 0, 0
ans = 0

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

elif a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    for i in range(10 ** 5):
        n_a = b // 2 + c // 2
        n_b = a // 2 + c // 2
        n_c = a // 2 + b // 2

        if n_a % 2 == 0 and n_b % 2 == 0 and n_c % 2 == 0:
            ans += 1
        else:
            ans += 1
            break

        a = n_a
        b = n_b
        c = n_c

print(ans)

Submission status: Accepted

Solution code:
A,B,C=map(int, input().split())
for i in range(1000000):
    if A&1 or B&1 or C&1:
        print(i)
        break
    A,B,C=B//2+C//2,A//2+C//2,A//2+B//2
else:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

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

if len(set(cookie)) == 1 and all([i % 2 == 0 for i in cookie]):
  print(-1)
else:
  con = 0
  while all([i % 2 == 0 for i in cookie]):
    a = cookie[0] // 2
    b = cookie[1] // 2
    c = cookie[2] // 2
    cookie[0] = b + c
    cookie[1] = c + a
    cookie[2] = a + b
    con += 1
  print(con)

Submission status: Accepted

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

d = 0

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


while a % 2 == 0 and b % 2 == 0 and b % 2 == 0:

    za = a
    zb = b
    zc = c

    a = zb // 2 + zc // 2
    b = za // 2 + zc // 2
    c = za // 2 + zb // 2

    d += 1

print(d)

Submission status: Accepted

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

if not (A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
    print(0)
elif A == B == C:
    print(-1)
else:
    c = 0
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        c += 1
        A2 = (B + C) // 2
        B2 = (A + C) // 2
        C2 = (A + B) // 2

        A = A2
        B = B2
        C = C2
        # print(A, B, C)
    print(c)

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

counter = 0
while True:
    counter += 1
    w_a = a / 2
    w_b = b / 2
    w_c = c / 2

    a = w_b + w_c
    b = w_a + w_c
    c = w_b + w_a

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

Submission status: Accepted

Solution code:
def main():
    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:
        for i in range(10**8):
            if A%2 != 0 or B%2 != 0 or C%2 != 0:
                break
            else:
                ta,tb,tc = A,B,C
                A = (tb+tc)/2
                B = (ta+tc)/2
                C = (ta+tb)/2
        print(i)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if a == b == c:
    if a % 2:
        print(0)
    else:
        print(-1)
else:
    cnt = 0
    while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        na = (b+c)//2
        nb = (a+c)//2
        nc = (a+b)//2
        cnt += 1
        a = na; b = nb; c = nc
    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
    while not A%2 and not B%2 and not C%2:
        if (B+C)%2 or (A+C)%2 or (A+B)%2:
            break
        A,B,C = (B+C)//2,(A+C)//2,(A+B)//2
        count += 1
    print(count)

Submission status: Accepted

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


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


print(F(A, B, C))

Submission status: Accepted

Solution code:
def check(aa,bb,cc):
    if aa%2==0 and bb%2==0 and cc%2==0:
        return True
    else:
        return False

a,b,c = map(int, input().split())
if check(a,b,c):
    if a == b == c:
        print(-1)
        exit()

ans = 0
while check(a,b,c):
    _a = b // 2 + c // 2
    _b = a // 2 + c // 2
    _c = a // 2 + b // 2
    a = _a
    b = _b
    c = _c
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

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

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

cnt=0
chk=True
while chk:
    a,b,c=b//2+c//2,a//2+c//2,b//2+a//2
    cnt+=1
    if a%2==0 and b%2==0 and c%2==0:
        pass
    else:
        chk=False

print(cnt)

Submission status: Accepted

Solution code:
import sys
import numpy as np
a, b, c = [int(i) for i in sys.stdin.readline().split()]
ls = np.array([a, b, c])
arr = np.array([[0, 0.5, 0.5],
                [0.5, 0, 0.5],
                [0.5, 0.5, 0]])
cnt = 0
while sum(ls % 2) == 0:
    if ls[0] == ls[1] == ls[2]:
        cnt = -1
        break
    ls = ls.dot(arr)
    cnt += 1
print(cnt)

Submission status: Accepted

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

def main():
    A,B,C = map(int,input().split())
    if A == B == C:
        if A%2 == 0:
            print(-1)
        else:
            print(0)
    else:
        for i in range(10**5):
            if (A%2 == 1 or B%2 == 1 or C%2 == 1):
                print(i)
                exit()
            _A,_B,_C = A,B,C
            A = (_B+_C)//2
            B = (_A+_C)//2
            C = (_A+_B)//2 
        
if __name__ == "__main__":
    main()

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:
    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 = c + a
        C = a + b
        ans += 1
        if ans > 10**5:
            print(-1)
            exit()
    print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

cookies = np.array(lr())
if any(cookies&1):
    print(0)
    exit()
if len(set(cookies)) == 1:
    print(-1)
    exit()

count = 0
half_total = cookies.sum() // 2
while True:
    cookies = half_total - cookies//2
    count += 1
    if any(cookies&1):
        print(count)
        break
    if count == 1000000:
        print(-1)
        exit()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    A, B, C = Scanner.map_int()
    if A == B == C and A % 2 == B % 2 == C % 2 == 0:
        print(-1)
        return
    ans = 0
    while A % 2 == B % 2 == C % 2 == 0:
        a, b, c = A//2, B//2, C//2
        A, B, C = b+c, c+a, a+b
        ans += 1
    print(ans)
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

if a == b == c and a % 2 == 0:
	print(-1)
else:
	cnt = 0
	for _ in range(10**5):
		if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
			print(cnt)
			break
		else:
			a, b, c = (b + c) / 2, (c + a) / 2, (a + b) / 2
			cnt += 1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if a == b and a == c:
	if a % 2 == 1:
		print(0)
		exit()
	else:
		print(-1)
		exit()
	
ans = 0
s, t, u = 0, 0, 0
while a%2==0 and b%2==0 and c%2==0:
	s = b//2 + c//2
	t = a//2 + c//2
	u = a//2 + b//2
	a, b, c = s, t, u
	ans += 1
	
print(ans)

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