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

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

Submission status: Accepted

Solution code:
# A - Cookie Exchanges
a,b,c = map(int,input().split())

if a==b==c and c%2==0:
    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())
ans = 0
if a%2 == 1 or b%2 == 1 or c%2 == 1:
  ans = 0
elif a == b and b == c:
  ans = -1
else:
  while a%2 != 1 and b%2 != 1 and c%2 != 1:
    aa = b/2 + c/2
    bb = c/2 + a/2
    cc = a/2 + b/2
    a = int(aa)
    b = int(bb)
    c = int(cc)
    ans += 1
print(ans)

Submission status: Accepted

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

  cnt = 0
  while (a % 2 == 0) and (b % 2 == 0) and (c % 2 == 0):
    
    a1,b1,c1 = a,b,c
    a = (b1+c1)//2
    b = (a1+c1)//2
    c = (a1+b1)//2
    
    if [a,b,c] == s:
      return -1
    
    cnt += 1
    #print(a,b,c)
    
  return cnt    
    

ans = main()
print(ans)

Submission status: Accepted

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

while a%2 + b%2 + c%2 == 0:
    na = (b + c) // 2
    nb = (a + c) // 2
    nc = (a + b) // 2
    
    if [na,nb,nc] == s:
        ans = -1
        break
        
    else:
        a = na
        b = nb
        c = nc
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
A,B,C =map(int,input().split())
con = 0
if A % 2 == 1 or B % 2 == 1 or C % 1 == 1:
  print(0)
  exit()
if A == B and B == C:
  print(-1)
  exit()
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  con += 1
  D = A / 2
  E = B / 2
  F = C / 2
  A = E + F
  B = D + F
  C = D + E
print(con)

Submission status: Accepted

Solution code:
A,B,C =map(int,input().split())
con = 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()
while True:
  if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    break
  con += 1
  D = A / 2
  E = B / 2
  F = C / 2
  A = E + F
  B = D + F
  C = D + E
  
print(con)

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)
else:
  for i in range(10**6):
    temp1 = a
    temp2 = b
    temp3 = c
    a = int((temp2+temp3)/2)
    b = int((temp1+temp3)/2)
    c = int((temp1+temp2)/2)
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
      break
  if i == 10**6 - 1:
    print(-1)
  else:
    print(i+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)
    exit()
elif a == b and b == c :
    print(-1)
    exit()
count = 0
while (a%2 == 0 and b%2 == 0 and c%2 == 0) :
    count += 1
    x = (a+b)/2
    y = (b+c)/2
    z = (c+a)/2
    a = x
    b = y
    c = z


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 A==B==C:
    count = -1
    break
    
  tot = A+B+C
  A = (tot-A)/2
  B = (tot-B)/2
  C = (tot-C)/2
  count+=1

print(count)

Submission status: Accepted

Solution code:
import sys
A, B, C = [int(x) for x in input().split()]
ans = 0
if(A==B==C)and(A%2==0)and(B%2==0)and(C%2==0):
  print(-1)
  sys.exit()
while (A%2==0)and(B%2==0)and(C%2==0):
  a = B/2 + C/2
  b = C/2 + A/2
  c = A/2 + B/2
  A, B, C = a, b, c
  ans += 1
print(ans)

Submission status: Accepted

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

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

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 True:
        if a % 2 == 1 or b % 2 == 1 or c % 2 == 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 = list(map(int, input().split()))
l = [a, b, c]


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

Submission status: Accepted

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

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

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)
elif a==b==c:
    print(-1)
else:
    total=0
    while True:
        x=a/2
        y=b/2
        z=c/2
        a=y+z
        b=x+z
        c=x+y
        total+=1
        if a%2!=0 or b%2!=0 or c%2!=0:
            print(total)
            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==c:
  print(-1)
  exit()
ans=0
while a%2==0 and b%2==0 and c%2==0:
    a,b,c=(b+c)//2,(c+a)//2,(a+b)//2
    ans+=1 
print(ans)

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
tmpA = 0
tmpB = 0
tmpC = 0
count = 1
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
  print(0)
  exit()
if A == B and A == C and B == C:
  print(-1)
  exit()

while True:
  tmpA = (B + C) / 2
  tmpB = (A + C) / 2
  tmpC = (A + B) / 2
  if tmpA % 2 == 1 or tmpB % 2 == 1 or tmpC % 2 == 1:
    break
  else:
    A = tmpA
    B = tmpB
    C = tmpC
    count += 1
print(count)

Submission status: Accepted

Solution code:
def main():
    x = list(map(int, input().split()))
    counter = 0

    while x[0] % 2 == 0 and x[1] % 2 == 0 and x[2] % 2 == 0:
        if x[0] == x[1] and x[1] == x[2] and x[2] == x[0]:
            counter = -1
            break
        share_0 = x[0] / 2
        share_1 = x[1] / 2
        share_2 = x[2] / 2
        x[0] = share_1 + share_2
        x[1] = share_0 + share_2
        x[2] = share_0 + share_1
        counter += 1

    print(counter)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
li = list(map(int,input().split()))
nx = [0,0,0]
ans = 0
if all(x&1 == 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: Accepted

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

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

ans = 0
pattern = set()
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    p = tuple(sorted((a, b, c)))
    if p in pattern:
        print(-1)
        sys.exit(0)
    pattern.add(p)
    a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
a,b,c = map(int,input().split())
ans = 0
pa = []
pb = []
while True:
  if a%2 == 1 or b%2 == 1 or c%2 == 1:
    break
  ans += 1
  lasta = a
  lastb = b
  lastc = c
  a = lastb/2 + lastc/2
  b = lasta/2 + lastc/2
  c = lasta/2 + lastb/2
  for i in range(len(pa)):
    if pa[i] == a:
      if pb[i] == b:
        print(-1)
        sys.exit()
  pa.append(a)
  pb.append(b)
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    global a,b,c
    st = {(a,b,c)}
    count = 0
    while a%2==0 and b%2==0 and c%2==0:
        ta = b//2 + c//2
        tb = a//2 + c//2
        tc = a//2 + b//2
        if (ta,tb,tc) in st:
            print(-1)
            return
        st.add((ta,tb,tc))
        a = ta
        b = tb
        c = tc
        count += 1
    print(count)
    return

if __name__=='__main__':
    a,b,c = IL()
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#13A - Cookie Exchanges
A,B,C = map(int, input().split())
cnt = 0
while (A%2 + B%2 + C%2) == 0:
    if A == B == C:
        print (-1)
        exit()
    else:
        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: Accepted

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

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
initial = list([A, B, C])
initial.sort()
n=0
while True:
    if A%2==0 and B%2==0 and C%2==0:
        n+=1
        A_half = A//2
        B_half = B//2
        C_half = C//2
        A = B_half + C_half
        B = C_half + A_half
        C = A_half + B_half
        now = list([A, B, C])
        now.sort()
        if now == initial:
            n = -1
            break
    else:
        break

print(n)

Submission status: Accepted

Solution code:
import numpy as np
lis=np.array(list(map(int,input().split())))
cnt=0
for i in range(1000000):
    if lis[0]%2==0 and lis[1]%2==0 and lis[2]%2==0:
        if lis[0]==lis[1]==lis[2]:
            print('-1')
            break
        else:   
            lis=lis/2
            a=lis[1]+lis[2]
            b=lis[0]+lis[2]
            c=lis[0]+lis[1]
            lis[0]=a
            lis[1]=b
            lis[2]=c
            cnt+=1
    else:
        print(cnt)
        break

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
sum = 0
before = set()
while True:
    if str(A)+' '+str(B)+' '+str(C) in before:
        print(-1)
        exit()
    else:
        before.add(str(A)+' '+str(B)+' '+str(C))
    if A%2==1 or B%2==1 or C%2==1:
        print(sum)
        exit()
    temp1 = int(B/2)+int(C/2)
    temp2 = int(A/2)+int(C/2)
    temp3 = int(A/2)+int(B/2)
    A, B, C = temp1, temp2, temp3
    sum += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
Created on 2020/08/21

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  A,B,C=map(int,pin().split())
  ans=0
  while True:
    if A%2==1 or B%2==1 or C%2==1:
      print(ans)
      break
    if A==B and A==C:
      print(-1)
      break
    a=A 
    b=B 
    c=C 
    A=b//2+c//2
    B=a//2+c//2
    C=a//2+b//2
    ans+=1
  return 
main()

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()
elif a==b==c:
  print(-1)
  exit()
    
ans=0  

while a%2==0 and b%2==0 and c%2==0:
  num_a,num_b,num_c=a/2,b/2,c/2
  a=num_b+num_c
  b=num_a+num_c
  c=num_a+num_b
  ans+=1
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

l=list(map(int,input().split()))
for i in range(10**6):
    for k in range(3):
        if l[k]%2:
            print(i)
            exit()
    a=[0]*3
    for k in range(3):
        a[k]=(l[(k+1)%3]+l[(k+2)%3])//2
    l=a
print(-1)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
count = 0
ABC = []
while True:
    if A % 2 ==0 and B % 2 == 0 and C % 2 == 0:
        nA = B/2 + C/2
        nB = A/2 + C/2
        nC = A/2 + B/2
        A, B, C = nA, nB, nC
        count += 1
        if [A, B, C] in ABC:
            count = -1
            break
        ABC.append([A, B, C])
    else:
        break
print(count)

Submission status: Accepted

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

if a != 1 and a == b == c:
  print(-1)
  exit()
  
result = 0

while True:
  if any([a & 1, b & 1, c & 1]):
    break
    
  a2 = a // 2
  b2 = b // 2
  c2 = c // 2
  a = b2 + c2
  b = a2 + c2
  c = a2 + b2
  result += 1

print(result)

Submission status: Accepted

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

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


p = [set([A,B,C])]
cnt = 1
while True:
    a = B//2+C//2
    b = A//2+C//2
    c = A//2+B//2
    if a%2+b%2+c%2 != 0:
        print(cnt)
        exit()
    if set([a,b,c]) in p:
        print(-1)
        exit()
    else:
        p.append(set([a,b,c]))
        A = a
        B = b
        C = c
        cnt += 1

Submission status: Accepted

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

empty = [0] * 3
count = 0
if A == B == C and A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    print(-1) 
elif (A % 2 != 0) or (B % 2 != 0) or (C % 2 != 0):
    print(0)
else:
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0: 
        count += 1
        A_ = A//2
        B_ = B//2
        C_ = C//2
        A = B_ + C_
        B = A_ + C_
        C = A_ + B_

    print(count)

Submission status: Accepted

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

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

if a==b==c:
    print(-1)
    exit()

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

print(times)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def existOdd(lst):
    for i in lst:
        if i%2==1:
            return False
    return True

cookie=list(map(int,input().split()))
seen=[]
res=0
while existOdd(cookie):
    seen.append(cookie)
    cookie=[cookie[1]/2+cookie[2]/2,cookie[0]/2+cookie[2]/2,cookie[0]/2+cookie[1]/2]
    if cookie in seen:
        res=-1
        break
    res+=1

print(res)

Submission status: Accepted

Solution code:
def f(a,b,c):
  if a%2+b%2+c%2>0:
    return 0
  if a==b==c:
    return -1
  return f((b+c)//2,(c+a)//2,(a+b)//2)+1

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

Submission status: Accepted

Solution code:
A, B, C = list(map(int, input().split()))
[A, B, C].sort() #smaller~bigger
if A==B and B==C:
    if A%2==0:
        print(-1)
    else:
        print(0)
elif (A%2==1) or (B%2==1) or (C%2==1):
    print(0)
else:
    cnt = 0
    while ((A%2==0) and (B%2==0) and (C%2==0)):
        [A, B, C] = [(A+B)/2, (A+C)/2, (B+C)/2]
        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 and A % 2 == 0:
        print(-1)
        exit()

    ans = 0
    while True:
        if (A % 2 == 1) or (B % 2 == 1) or (C % 2 == 1):
            break
        ans += 1
        A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def exchg(a, b, c):
	count = 0
	if (a == b == c) and ((a & 1) == 0 and (b & 1) == 0 and (c & 1) == 0):
		return -1
	while((a & 1) == 0 and (b & 1) == 0 and (c & 1) == 0):
		a, b, c = (a+b)//2, (b+c)//2, (c+a)//2
		# print(a, b, c)
		count += 1
	return count
a, b, c = map(int, input().split())
print(exchg(a, b, c))

Submission status: Accepted

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

cnt = 0
while A%2 == 0 and B%2 == 0 and C%2 == 0:
  tmp1 = B/2 + C/2
  tmp2 = C/2 + A/2
  tmp3 = A/2 + B/2
  A = tmp1
  B = tmp2
  C = tmp3
  cnt += 1
  if cnt >= 10**4:
    print("-1")
    sys.exit()
print(cnt)

Submission status: Accepted

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

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

else:
  while (a % 2 + b % 2 + c % 2) == 0:
    a, b, c = (b + c) / 2, (a + c) / 2, (a + b) / 2
    t += 1

  print(t)

Submission status: Accepted

Solution code:
import sys
a,b,c=map(int,input().split())
if a%2==1 or b%2==1 or c%2==1:
    print(0)
    sys.exit(0)
elif a==b and b==c:
    print(-1)
    sys.exit(0)
ans=0
for i in range(1,10000):
    x=a//2
    y=b//2
    z=c//2
    a=y+z
    b=x+z
    c=x+y
    if a%2==1 or b%2==1 or c%2==1:
        ans=i
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    A, B, C = LI()

    s = set()
    ans = 0
    while A % 2 == B % 2 == C % 2 == 0:
        s.add((A, B, C))
        tmp_A = A
        tmp_B = B
        tmp_C = C
        A = tmp_B // 2 + tmp_C // 2
        B = tmp_C // 2 + tmp_A // 2
        C = tmp_A // 2 + tmp_B // 2
        if (A, B, C) in s:
            ans = -1
            break
        ans += 1

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

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

    elif (2 * A - B - C) == 0 and (2 * B - A - C) == 0 and (2 * C - A - B) == 0:
        print(-1)
        exit()

    else:
        while True:
            if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
                print(ans)
                exit()

            A, B, C = (B + C)//2, (A + C)//2, (A + B)//2
            ans += 1


if __name__ == "__main__":
    main2()

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
ans = 0
while A[0] % 2 == 0 and A[1] % 2 == 0 and A[2] % 2 == 0:
    if A[0] == A[1] and A[0] == A[2]:
        ans = -1
        break
    A[0], A[1], A[2] = ( A[1] + A[2] ) / 2, ( A[2] + A[0] ) / 2, ( A[0] + A[1] ) / 2
    ans += 1
print(ans)

Submission status: Accepted

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

cnt = 0
while True:
    # print(a, b, c)
    x, y, z = a, b, c

    if x % 2 == 1 or y % 2 == 1 or z % 2 == 1:
        break

    if x == y and y == z and z == x:
        cnt = -1
        break

    x, y, z = a/2, b/2, c/2
    a, b, c = y+z, z+x, x+y
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))


a, b, c = rm()
if a == b == c:
  if a & 1:
    print(0)
  else:
    print(-1)
  exit()
cnt = 0
while a & 1 == 0 and b & 1 == 0 and c & 1 == 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())
A_first,B_first,C_first = A,B,C

result = 0
for i in range(10**9):
    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
    if A == A_first and B == B_first and C == C_first:
        result = -1
        break
    result += 1   
print(result)

Submission status: Accepted

Solution code:
# AtCoder Grand Contest 014
# A - Cookie Exchanges 

def f(A,B,C,n):
    if A%2==1 or B%2==1 or C%2==1:
        return [1,n]
    if A==B==C:
        return [0,-1]
    tempA=A
    tempB=B
    tempC=C
    A=tempB//2+tempC//2
    B=tempA//2+tempC//2
    C=tempA//2+tempB//2
    return [2,[A,B,C,n+1]]


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

flg = True
n=0

while flg == True:
    a=f(A,B,C,n)
    if a[0]==0:
        flg=False
        print(-1)
        exit()
    if a[0]==1:
        flg=False
        print(n)
        exit()
    if a[0]==2:
        n+=1
        A,B,C=a[1][0], a[1][1] , a[1][2]

Submission status: Accepted

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

if A%2!=0 or B%2!=0 or C%2!=0:
      pass
elif A==B and B==C:
  ans=-1
else:
  while True:
    if A%2!=0 or B%2!=0 or C%2!=0:
      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:
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    row = [int(x) for x in input().rstrip().split(" ")]

    a = row[0]
    b = row[1]
    c = row[2]

    count = 0
    while(a%2==0 and b%2==0 and c%2==0):
        if(a==b and b==c):
            count = -1
            break
        count += 1
        tmpa = b//2 + c//2
        tmpb = a//2 + c//2
        tmpc = b//2 + a//2

        a = tmpa
        b = tmpb
        c = tmpc

    print(count)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
a,b,c=list(map(int,input().split()))
n=0
H=[]
while True:
  S=[a,b,c]
  if S in H:
    print("-1")
    exit()
  H.append(S)
  if a%2!=0 or b%2!=0 or c%2!=0:
    print(n)
    exit()
  else:
    A=a/2
    B=b/2
    C=c/2
    a=int(B+C)
    b=int(A+C)
    c=int(A+B)
    n+=1

Submission status: Accepted

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

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

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

ans = 0 
while True:
    if a%2 == 1 or b%2 == 1 or c%2 == 1:
        print(ans)
        exit()
    ta = a 
    tb = b 
    tc = c 
    a = (tb+tc)//2
    b = (tc+ta)//2
    c = (ta+tb)//2
    ans += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y, z = map(int,input().split())
a =[x]
b =[y]
c =[z]
if a[0] == b[0] == c[0]:
    if a[0] % 2 == 1:
        print(0)
        exit()
        
    else:
        print('-1')
        exit()
        
for i in range(1000):
    if 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((b[i] + a[i]) // 2)
    
    else:
        print(i)
        exit()

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a, b, c = inintm()

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

if a == b == c:
    print(-1)
    exit()

ans = 0

while a % 2 == b % 2 == c % 2 == 0:
    d = a
    e = b
    f = c
    a = e/2 + f/2
    b = d/2 + f/2
    c = d/2 + e/2
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
def IsOdd(n):
    if n % 2 == 0:
        return True
    else:
        return False

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

cnt = 0
inf = False
while True:
    if IsOdd(A) and IsOdd(B) and IsOdd(C):
        if A == B == C:
            inf = True
            break
        else:
            a,b,c = A//2,B//2,C//2
            A,B,C = b+c,c+a,a+b
            cnt += 1
    else:
        break
if inf:
    print(-1)
else:
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

cnt = 0
for _ in range(1000):
  if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    print(cnt)
    exit(0)
  tA, tB, tC = A, B, C
  A = (tB + tC) // 2
  B = (tA + tC) // 2
  C = (tA + tB) // 2
  cnt += 1

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split(" "))
n = 0
if a % 2 == 1:
    print(0)
    exit()
if b % 2 == 1:
    print(0)
    exit()
if c % 2 == 1:
    print(0)
    exit()
if a == b == c:
  print(-1)
  exit()
for i in range(10**9):
  aa = a//2
  bb = b//2
  cc = c//2
  a = bb + cc
  b = aa + cc
  c = aa + bb
  n += 1
  if a % 2 == 1:
    break
  if b % 2 == 1:
    break
  if c % 2 == 1:
    break
print(n)

Submission status: Accepted

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

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

else:
  while True:
    if A%2 == 1 or B%2 == 1 or C%2 == 1:
      break
    else:
      A2 = A
      B2 = B
      C2 = C
      A = B2/2 + C2/2
      B = A2/2 + C2/2
      C = A2/2 + B2/2
      count += 1
  print(count)

Submission status: Accepted

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

cnt = 0

last = [A, B, C]

while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    a = A // 2
    b = B // 2
    c = C // 2
    cnt += 1
    A = b + c
    B = a + c
    C = a + b
    if A in last and B in last and C in last:
        print(-1)
        exit()

    last = [A, B, C]

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

while a%2 == 0 and b%2 == 0 and c%2 == 0:
    cnt+=1
    i=a
    j=b
    a=(b+c)//2
    b=(i+c)//2
    c=(i+j)//2

print(cnt)

Submission status: Accepted

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

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

else:
  cnt=0
  while a%2==0 and b%2==0 and c%2==0:
    cnt+=1
    i=a
    j=b
    a=(b+c)//2
    b=(i+c)//2
    c=(i+j)//2
  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:
    num=0
    while True:
        if a%2==1 or b%2==1 or c%2==1:
            break
        num+=1
        l0=(b+c)/2
        l1=(c+a)/2
        l2=(a+b)/2
        a,b,c=l0,l1,l2
    print(num)

Submission status: Accepted

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

if (A == B == C) and all([A % 2 ==0, B % 2 == 0, C % 2 ==0]):
  res = -1
else:
  while all([A % 2 ==0, B % 2 == 0, C % 2 ==0]):
    at, bt, ct = A/2, B/2, C/2
    A = bt + ct
    B = at + ct
    C = at + bt
    res += 1

print(res)

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

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
a=0
for i in range(10**3):
    if A%2==0 and B%2==0 and C%2==0:
        a+=1
        A,B,C=(B+C)//2,(A+C)//2,(A+B)//2
    else:
        print(a)
        break
else:
    print(-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)
    exit()
    
diff1 = abs(A-B)
diff2 = abs(B-C)

if diff1 == 0 and diff2 == 0:
    print(-1)
    exit()

ans = 0
while diff1 % 2 == 0 and diff2 % 2 == 0:
    ans += 1
    diff1 //= 2
    diff2 //= 2

print(ans)

Submission status: Accepted

Solution code:
x,y,z = map(int,input().split())

ans = 0

s = []

while True:
    if x%2 == 0 and y%2 == 0 and z%2 == 0:
        ans += 1
        if [x,y,z] in s:
            print(-1)
            break
        else:
            s.append([x,y,z])
    else:
        print(ans)
        break
    
    x,y,z = y//2+z//2,x//2+z//2,x//2+y//2

Submission status: Accepted

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