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: Time Limit Exceeded

Solution code:
li = list(map(int,input().split()))
nx = [0,0,0]
ans = 0
if all(x&0 for x in li) and li[0] == li[1] == li[2]:
    print(-1)
else:
    while 1:
        if(li[0]%2!=0 or li[1]%2!=0 or li[2]%2!=0):
            break
        nx[0] = (li[1] + li[2])/2
        nx[1] = (li[0] + li[2])/2
        nx[2] = (li[0] + li[1])/2
        li = nx.copy()
        ans += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
import numpy as np
import numba
from numba import jit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(p):
  count = 0
  if np.any(p%2==1):
    return 0
  if np.unique(p).size == 1:
    return -1
  while True:
    if np.any(p%2 == 1):
      return count
    p[0], p[1], p[2] = p[1]/2 + p[2]/2, p[0]/2 + p[2]/2, p[0]/2 + p[1]/2
    count += 1


p = np.array(readline().split(), np.int64)

print(main(p))

Submission status: Time Limit Exceeded

Solution code:
import sys
import numpy as np
import numba
from numba import jit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(p):
  count = 0
  if np.any(p%2==1):
    return 0
  if np.unique(p).size == 1:
    return -1
  while True:
    if np.any(p%2 == 1):
      return count
    p[0] = p[1]/2 + p[2]/2
    p[1] = p[0]/2 + p[2]/2
    p[2] = p[0]/2 + p[1]/2
    count += 1


p = np.array(readline().split(), np.int64)
print(main(p))

Submission status: Time Limit Exceeded

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 // 2) % 2 == 1 and (B // 2) % 2 == 1 and (C // 2) % 2 == 1:
        print(-1)
        exit()
    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: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
a,b,c=map(int,input().split())
ab,bc,ca=abs(a-b),abs(b-c),abs(c-a)
ans=0
while ab%2==0 and bc%2==0 and ca%2==0:
  ab//=2
  bc//=2
  ca//=2
  ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import log
a,b,c=list(map(int,input().split()))
if a==b and b==c and c==a and a%2==0:
  print('-1')
n=0
while a%2==0 and b%2==0 and c%2==0:
  temp_a = c/2+b/2
  temp_b = a/2+c/2
  temp_c = a/2+b/2
  a = temp_a
  b = temp_b
  c = temp_c
  n+=1
print(n)

Submission status: Time Limit Exceeded

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

counter = 0
while a%2==b%2==c%2==0:
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    counter += 1
    if counter > 100000000:
        counter = -1
        break
print(counter)

Submission status: Time Limit Exceeded

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

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

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

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

        cnt += 1

    print(cnt)

Submission status: Time Limit Exceeded

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

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

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

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

        if max([A % 2, B % 2, C % 2]) == 1:
            break

    print(cnt)

Submission status: Time Limit Exceeded

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

cnt = 0
while A%2 == B%2 == C%2 == 0:
    x = (B+C)//2
    y = (A+C)//2
    z = (A+B)//2
    A = x
    B = y
    C = z
    cnt += 1

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

Submission status: Time Limit Exceeded

Solution code:
a,b,c = map(int,input().split())
ans = 0
p = 0
for i in range(c):
    if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
        ans += 1
        x = b / 2 + c / 2
        y = a / 2 + c / 2
        z = b / 2 + a / 2
        a = x
        b = y
        c = z
    else:
        p = 1
        print(ans)
        break



if p == 0:
    print(-1)

Submission status: Time Limit Exceeded

Solution code:
a,b,c = map(int,input().split())
#if a == b == c:
#    print(-1)
#    exit()
for i in range(10**8):
    if a%2 != 0 or b%2 != 0 or c%2 != 0:
        break
    a_o,b_o,c_o = a,b,c
    a = b_o//2 + c_o//2
    b = a_o//2 + c_o//2
    c = a_o//2 + b_o//2
print(i)

Submission status: Time Limit Exceeded

Solution code:
cookie = list(map(int, input().split()))
sc = sum(cookie)
cnt = -1
if cookie[0] == cookie[1] and cookie[1] == cookie[2]:
    if cookie[0] % 2 == 0:
        print(cnt)
        exit()
    else:
        print(0)
memo = [0]*3
while sum(cookie) == sc:
    memo[0] = (cookie[1] + cookie[2]) // 2
    memo[1] = (cookie[0] + cookie[2]) // 2
    memo[2] = (cookie[1] + cookie[0]) // 2
    for i in range(3):
        cookie[i] = memo[i]
    cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

while x % 2 == 0 and y % 2 == 0:
  x, y = x // 2, y // 2
  ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import time
N = list(map(int, input().split()))
N2 = [0,0,0]
ans = 0
while True:
    time.sleep(1)
    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: Time Limit Exceeded

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()
elif a[0] == a[1] == a[2]:
    print(-1)

cnt = 0
while True:
    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
    for i in a:
        if i % 2 == 1:
            print(cnt)
            exit()

Submission status: Time Limit Exceeded

Solution code:
a,b,c=map(int,input().split())
num=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)
  num+=1
  if (num>10**9):
    print(-1)
    break
else:
  print(num)

Submission status: Time Limit Exceeded

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 not (A%2==0 and B%2==0 and C%2==0):
        print(0)
        return

    if A==B==C:
        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+y
        C = y+z
        answer += 1
    print(answer)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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 not(A%2==0 and B%2==0 and C%2==0):
        print(0)
        return
        
    if A==B==C:
        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+y
        C = y+z
        answer += 1
    print(answer)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys

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

if (A / 2) % 2 == 1 and (B / 2) % 2 == 1 and (C / 2) % 2 == 1:
    print(-1)
    sys.exit()

cnt = 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
    cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a = inpl()
cnt = 0
while True:
    for i in a:
        if i%2:
            print(cnt)
            quit()
if a[0] == a[1] == a[2]:
    print(-1)
else:
    while True:
        for i in a:
            if i%2:
                print(cnt)
                quit()
        b = [0] * 3
        b[0] = (a[1] + a[2]) // 2
        b[1] = (a[0] + a[2]) // 2
        b[2] = (a[1] + a[0]) // 2
        cnt += 1
        a[::] = b[::]

Submission status: Time Limit Exceeded

Solution code:
a,b,c=map(int,input().split())
if a%2!=0 or b%2!=0 or c%2!=0:
    print(0)
else:
    a1=0
    a2=0
    a3=0
    c1=0
    c2=0
    c3=0
    ans=0
    for i in range(10**9):
        if a%2!=0:
            c1=1        
        if b%2!=0:
            c2=1        
        if c%2!=0:
            c3=1
        if c1==1 or c3==1 or c2==1:
            ans=i
            break
        else:
            a3=(a+b)//2
            a2=(a+c)//2
            a1=(b+c)//2
            a=a1
            b=a2
            c=a3
        #print(a,b,c)
        if i==199999:
            ans=-1
    print(ans)

Submission status: Time Limit Exceeded

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

def aa():
    if a == b and a == c and a % 2 == 0:
        return -1
    else:
        A = [a-b, b-c, c-a]
        j = 0
        while True:
            for i in range(3):
                if A[i] % 2 == 1:
                    return j
                else:
                    A[i] //= 2
            j += 1

print(aa())

Submission status: Time Limit Exceeded

Solution code:
a=list(map(int,input().split()))
k=0
while a[0]%2==0 and a[1]%2==0 and a[2]%2==0:
    a[0],a[1],a[2]=int((a[1]+a[2])/2),int((a[0]+a[2])/2),int((a[1]+a[0])/2)
    #print(a)
    k+=1
print(k)

Submission status: Time Limit Exceeded

Solution code:
a, b, c = map(int, input().split())
ab = abs(a-b)
bc = abs(b-c)

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

count = 0

while True:
  if ab % 2 != 0 or bc % 2 != 0:
    break
  else:
    ab = ab // 2
    bc = bc // 2
    count += 1

print(count)

Submission status: Time Limit Exceeded

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

if a == b == c and a%2==0:
    ans = -1
else:
    for i in range(10**9):
        if a%2==1 or b%2==1 or c%2==1:
            if a%2==1 and b%2==1 and c%2==1:
                pass
            else:
                break
        x = a
        y = b
        z = c
        a = y//2 + z//2
        b = x//2 + z//2 
        c = x//2 + y//2
        ans +=1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
a,b,c=map(int,input().split())
A=[a,b,c]
ans=0
if a%2==1 or b%2==1 or c%2==1:
  print(0)
  exit()
while a%2==0 and b%2==0 and c%2==0:
  a=(b+c)/2
  b=(sum(A)-A[1])/2
  c=(sum(A)-A[2])/2
  if [a,b,c]==A:
    print(-1)
    exit()
  ans+=1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
A,B,C=map(int,input().split())
i = 0
a = [A]
b = [B]
c = [C]
while a[i]%2==0 and b[i]%2==0 and c[i]%2==0:
  a.append((b[i]+c[i])/2)
  b.append((a[i]+c[i])/2)
  c.append((a[i]+b[i])/2)
  i += 1
print(i)

Submission status: Time Limit Exceeded

Solution code:
def isOdd(num):
	if num % 2 == 0:
		return False
	else:
		return True

A, B, C = map(int, raw_input().split())
[A, B, C] = sorted([A, B, C])
ans = 0
while not isOdd(A) and not isOdd(B) and not isOdd(C):
	ans += 1
	new1, new2, new3 = B/2 + C/2, A/2 + C/2, A/2 + B/2
	if new1 == new3:
		ans = -1
	else:
		A, B, C = new1, new2, new3
print ans

Submission status: Time Limit Exceeded

Solution code:
def isOdd(num):
	if num % 2 == 0:
		return False
	else:
		return True

A, B, C = map(int, raw_input().split())
ans = 0
while not isOdd(A) and not isOdd(B) and not isOdd(C):
	ans += 1
	new1, new2, new3 = B/2 + C/2, A/2 + C/2, A/2 + B/2
	if set([A, B, C]) == set([new1, new2, new3]):
		print -1
	else:
		A, B, C = new1, new2, new3
print ans

Submission status: Time Limit Exceeded

Solution code:
def isOdd(num):
	if num % 2 == 0:
		return False
	else:
		return True

A, B, C = map(int, raw_input().split())
ans = 0
while not isOdd(A) and not isOdd(B) and not isOdd(C):
	ans += 1
	new1, new2, new3 = B/2 + C/2, A/2 + C/2, A/2 + B/2
	if A == new1 and B == new2 and C == new3:
		print -1
	else:
		A, B, C = new1, new2, new3
print ans

Submission status: Time Limit Exceeded

Solution code:
def isOdd(num):
	if num % 2 == 0:
		return False
	else:
		return True

A, B, C = map(int, raw_input().split())
ans = 0
while not isOdd(A) and not isOdd(B) and not isOdd(C):
	ans += 1
	A, B, C = B/2 + C/2, A/2 + C/2, A/2 + B/2
print ans

Submission status: Time Limit Exceeded

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

    a = A
    b = B
    c = C
    i = 0
    while True:
        if (b + c) % 2 > 0 or (a + c) % 2 > 0 or (a + b) % 2 > 0:
            break
        elif A == B == C:
            i = -1
        else:
            now_a = (b + c) / 2
            now_b = (a + c) / 2
            now_c = (a + b) / 2
            a = now_a
            b = now_b
            c = now_c
            i += 1
    print(i)

main()

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import sys
# 整数の入力
A, B, C= map(int, input().split())
# 出力
if A==B and B==C:
 if A%2 ==0 and B%2==0 and C%2==1:
  print(-1)
  sys.exit()
count=0
while True:
 if A%2 ==1 or B%2==1 or C%2==1:
  print(count)
  sys.exit()
 else:
  A_a=B/2+C/2
  B_a=A/2+C/2
  C_a=A/2+B/2
  A=A_a
  B=B_a
  C=C_a
  count+=1

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
count = 0
while A%2 == 0 and B%2 == 0 and C%2 == 0 and count < 10**5:
  A_copy = A
  B_copy = B
  A = (B+C)/2
  B =(A_copy+C)/2
  C = (A_copy+B_copy)/2
  count += 1
if count == 10**5:
  print(-1)
else:
  print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
ans = 0
for i in range(10 ** 5):
         if (a % 2 == 1) or (b % 2 == 1) or (c % 2 == 1):
                  print(ans)
                  exit()
         tmpa = a
         tmpb = b
         tmpc = c
         a = (tmpb // 2) + (tmpc // 2)
         b = (tmpc // 2) + (tmpa // 2)
         c = (tmpa // 2) + (tmpb // 2)
         ans += 1
print(-1)

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
cna = cnb = 0
a.sort()
x = a[2]-a[1]
y = a[1]-a[0]
if a[0]*a[1]*a[2]%2 != 0:
    print(0)
    exit()
while True:
    if x%2 == 0 and x != 0:
        cna += 1
        x //= 2
    else:
        break
while True:
    if y%2 == 0 and y != 0:
        cnb += 1
        y //= 2
    else:
        break
if cna == 0 and cnb == 0:
    print(-1)
else:
    print(min(cna,cnb))

Submission status: Accepted

Solution code:
"""Boot-camp-for-Beginners_Easy013_A_Candy-Distribution-Again_30-August-2020.py"""

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

Submission status: Accepted

Solution code:
"""Boot-camp-for-Beginners_Easy013_A_Candy-Distribution-Again_30-August-2020.py"""

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

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
X = (A|B|C)^(A&B&C)
ans = (X&-X).bit_length()-1
print(0 if (A|B|C)&1 else ans)

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:
  ans = 0
  while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    p, q, r = A // 2, B // 2, C // 2
    A, B, C = q + r, p + r, p + q
    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:
  if A == B and B == C:
    print(-1)
    exit()
  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())
res = 0
if a == b and a == c and a % 2 == 0:
    print(-1)
else:
    while 10 > 0:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
            break
        a1 = a//2
        b1 = b//2
        c1 = c//2
        a = b1+c1
        b = a1+c1
        c = a1+b1
        res += 1
    print(res)

Submission status: Accepted

Solution code:
#!/usr/local/bin/python3
# https://atcoder.jp/contests/agc014/tasks/agc014_a

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

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

def check(A, B, C):
    return A%2 == 1 or B%2 == 1 or C%2 == 1

ans = 0
while check(A, B, C) == False:
    nA = (B + C) / 2
    nB = (A + C) / 2
    nC = (A + B) / 2
    A, B, C = nA, nB, nC
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

a, b, c = LI()

# ABCの3人が持っているクッキーを交換する。
# 3人は同時に、手持ちのクッキーを半分割し、残りの二人にそれぞれ1方を渡すことを繰り返す。
# 誰かの持っているクッキーが奇数個になったら操作をやめる。
# クッキー交換は何回行うことができるか。無限に続けられることもある。

def distribute(a,b,c):
    x = a/2
    y = b/2
    z = c/2

    a2 = y + z
    b2 = x + z
    c2 = x + y

    if a == a2 and b == b2 and c == c2:
        print(-1)
        sys.exit()
    return a2, b2, c2

count = 0

while (a % 2 == 0) and (b % 2 == 0) and (c % 2 == 0):
    a, b, c = distribute(a, b, c)
    count += 1
    # print(a, b, c)

print(count)

Submission status: Accepted

Solution code:
a, b, c = map(int,input().split())
count = 0
def exchange(a, b, c, count):
    a, b, c = int((b+c)/2), int((a+c)/2), int((a+b)/2)
    count += 1
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        return a, b, c, count
    else:
        return exchange(a, b, c, count)
if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
    print(0) 
elif a == b == c:
    print(-1)
else:
    aa, bb, cc, count = exchange(a, b, c, count)
    print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0

while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        break
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and a == b and b == c and c == a:
        cnt = -1
        break

    a, b, c = (b + c) / 2, (a + c) / 2, (a + b) / 2
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
# import math
# import statistics
# import itertools
# a=int(input())
# b=input()
# c=[]
# for i in a:
#     c.append(int(i))
A,B,C= map(int,input().split())
# f = list(map(int,input().split()))
# g = [int(input()) for _ in range(N)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen

nowA=A
nowB=B
nowC=C
count=0
if A%2==1 or B%2==1 or C%2==1:
    print(0)
elif A==B==C :
    print(-1)
else:
    while True:
        nowA=B//2+C//2
        nowB=A//2+C//2
        nowC=A//2+B//2
        A=nowA
        B=nowB
        C=nowC
        count+=1
        if nowA%2==1 or nowB%2==1 or nowC%2==1:
            print(count)
            exit()

Submission status: Accepted

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


def solve(A: int, B: int, C: int):
    ans = 0
    s = set()
    while True:
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            print(ans)
            break
        newA =  B / 2 + C / 2
        newB =  A / 2 + C / 2
        newC =  A / 2 + B / 2
        A = newA
        B = newB
        C = newC
        ans += 1
        n = ','.join(map(str, [A, B, C]))
        if n in s:
            print("-1")
            break
        s.add(n)

    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

a=0
D=set()
while True:
    if A%2!=0 or B%2!=0 or C%2!=0:
        break
    if (A,B,C) in D:
        a=-1
        break
    else:
        D.add((A,B,C))
    p=(B+C)/2
    q=(A+C)/2
    r=(A+B)/2
    A=p;B=q;C=r
    a+=1
print(a)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
for i in range(500000):
    if a%2==1 or b%2==1 or c%2==1:
        print(i);exit()
    
    else:
      p=(b+c)//2 ;q=(a+c)//2 ; r=(a+b)//2
      a=p ; b=q;c=r
else:
    print(-1)

Submission status: Accepted

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

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

    print(times)

Submission status: Accepted

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

cnt = 0

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

Submission status: Accepted

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

cnt = 0

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

print(cnt)

Submission status: Accepted

Solution code:
# coding: utf-8

def main():
    a, b, c = map(int, input().split())
    ans = 0

    if a == b and b == c and a % 2 == 0:
        ans = -1
    else:
        while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
            d = b / 2 + c / 2
            e = c / 2 + a / 2
            f = a / 2 + b / 2
            a, b, c = d, e, f
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

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 :
        cnt = -1
        break
    ta,tb,tc = a,b,c
    a = tb/2 + tc/2
    b = ta/2 + tc/2
    c = ta/2 + tb/2
    cnt += 1

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import copy
a = [int(c) for c in input().split()]
cnt=0
while True:
    if a[0]==a[1] and a[1]==a[2] and a[0] != 1:
        print(-1)
        sys.exit(0)
    
    if a[0]%2 == 0 and a[1]%2 == 0 and a[2]%2 == 0:
        b = copy.deepcopy(a)
        a[0] = int((b[1]+b[2])/2)
        a[1] = int((b[2]+b[0])/2)
        a[2] = int((b[0]+b[1])/2)
    else:
        print(cnt)
        sys.exit(0)

    cnt+=1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
*l, = map(int, input().split())

ans = 0
while True:
    if l[0]%2 or l[1]%2 or l[2]%2:
        break
    a = (l[1] + l[2]) // 2
    b = (l[0] + l[2]) // 2
    c = (l[0] + l[1]) // 2
    if l == [a, b, c]:
        ans = -1
        break
    l = [a, b, c]
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def exchange(a, b, c):
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        return 0

    if a == b == c:
        return -1

    return exchange((b + c) / 2, (c + a) / 2, (a + b) / 2) + 1


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

    ans = exchange(a, b, c)

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    a,b,c = map(int,input().split())
    count=0

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

    while True:
        if a == b ==c:
            print(-1)
            exit()
        elif a % 2 ==0 and b % 2==0 and c % 2 ==0:
            tmp_a=a/2
            tmp_b=b/2
            tmp_c=c/2
            a=tmp_b+tmp_c
            b=tmp_a+tmp_c
            c=tmp_b+tmp_a
            count+=1
        else:
            break
    print(count)

if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

i = 0
Ap = A
Bp = B
Cp = C
while A%2 == 0 and B%2 == 0 and C%2 == 0:
  A = Bp//2 + Cp//2 
  B = Ap//2 + Cp//2 
  C = Bp//2 + Ap//2 
  i += 1
  Ap = A
  Bp = B
  Cp = C
  if A == B == C:
    i = -1
    break


print(i)