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=list(map(int,input().split()))
#print(A)

def odd_check(a):
  for aa in a:
    if aa%2:
      return 1
  return 0

if odd_check(A):
  print(0)
  exit()
  
if A[0]==A[1]==A[2]:
  print(-1)
  exit()
  
ans=0
while 1:
  A[0],A[1],A[2]=A[1]//2+A[2]//2,A[0]//2+A[2]//2,A[1]//2+A[0]//2
  #print(A)
  ans+=1
  if odd_check(A):
    print(ans)
    exit()

Submission status: Accepted

Solution code:
def solve(a, b, c):
    for i in range(1000):
        if (a % 2 == 1) or (b % 2 == 1) or (c % 2 == 1):
            return i
        a, b, c = b//2 + c//2, c//2 + a//2, a//2 + b//2
    return -1

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

Submission status: Accepted

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

cnt=0
t=[]
while True:
	if a%2!=0 or b%2!=0 or c%2!=0:
		print(cnt)
		break
	cnt+=1
	a,b,c=b//2+c//2, a//2+c//2, a//2+b/2
	if [a,b,c] not in t:t.append([a,b,c])
	else:
		print(-1)
		break

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a, b, c = list(map(int, input().rstrip('\n').split()))
    if a == b == c:
        if a % 2 == 0:
            print(-1)
        else:
            print(0)
    else:
        cnt = 0
        while True:
            if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
                a, b, c = (a + b) // 2, (b + c) // 2, (a + c) // 2
                cnt += 1
            else:
                print(cnt)
                exit()


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
# AGC014A - Cookie Exchanges
def main():
    A, B, C = map(int, input().split())
    if A == B == C:  # corner case
        flg = A % 2
        print(0 if flg else -1)
        return
    ans = 0
    while 1 not in (A % 2, B % 2, C % 2):
        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:
def slove():
    import sys
    input = sys.stdin.readline
    a, b, c = list(map(int, input().rstrip('\n').split()))
    if a == b == c:
        if a % 2 == 0:
            print(-1)
        else:
            print(0)
    else:
        cnt = 0
        while True:
            if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
                cnt += 1
                a, b, c = (a + b) // 2, (b + c) // 2, (a + c) // 2
            else:
                print(cnt)
                exit()


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
r = 0
s = set()
s.add((A, B, C))
while A%2 == 0 and B%2 == 0 and C%2 == 0:
  r += 1
  A, B, C = (B//2+C//2, C//2+A//2, A//2+B//2)
  if (A, B, C) in s:
    print(-1)
    exit()
  s.add((A, B, C))
print(r)

Submission status: Accepted

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


def main():
    A,B,C=map(int, input().split())
    ans = 0
    while 1:
        if A%2==1 or B%2==1 or C%2==1:
            break
        if A==B==C:
            print(-1)
            return
        tA = A
        tB = B
        A = (B+C)//2
        B = (tA+C)//2
        C = (tB+tA)//2
        ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

if A == B == C:
    ans = -1 if A % 2 == 0 else 0
else:
    ans = 0
    while A % 2 + B % 2 + 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())
result = 0
while True:
  if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    break
  if A == B == C:
    result = -1
    break
  A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
  result += 1
print(result)

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

c=0
while A%2==0 and B%2==0 and C%2==0:
    c+=1
    newA=B//2+C//2
    newB=C//2+A//2
    newC=A//2+B//2
    A=newA
    B=newB
    C=newC

print(c)

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)
    elif a == b and b == c:
        print(-1)
    else:
        ans = 0
        while True:
            if a % 4 == 2 or b % 4 == 2 or c % 4 == 2:
                print(ans + 1)
                exit()
            ans += 1
            ta, tb, tc = a, b, c
            a = (tb + tc) // 2 
            b = (ta + tc) // 2
            c = (ta + tb) // 2 


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def compute():
    a, b, c = [int(el) for el in input().split(' ')]
    count = 0
    while a % 2 == b % 2 == c % 2 == 0:
        a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
        count += 1
        if a == b == c:
            print(-1)
            return
    print(count)
    return

compute()

Submission status: Accepted

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

while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    count += 1
    a_pool = a // 2
    b_pool = b // 2
    c_pool = c // 2
    a = b_pool + c_pool
    b = a_pool + c_pool
    c = a_pool + b_pool
    if a == b == c:
        print(-1)
        exit()

print(count)

Submission status: Accepted

Solution code:
# AGC014A - Cookie Exchanges
def main():
    A, B, C = tuple(map(int, input().split()))
    if A == B == C:  # corner case
        flg = A % 2 == 1
        print(0 if flg else -1)
        return
    ans = 0
    while 1 not in (A % 2, B % 2, C % 2):
        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:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    def f(n):
        return ((1<<n)-(1-2*(n&1)))//3
    def k(x,n):
        return f(n)*s+(1-2*(n&1))*x
    a = LI()
    if a[0]%2 or a[1]%2 or a[2]%2:
        print(0)
        return
    if a[0] == a[1] == a[2]:
        print(-1)
        return
    s = sum(a)
    ans = 10**5
    for i in range(3):
        l = 0
        r = 10**5+1
        while r-l > 1:
            m = (l+r)>>1
            ka = k(a[i],m)
            if ka&((1<<m)-1) == 0:
                l = m
            else:
                r = m
        ans = min(ans, l)
    print(ans)
    return
#B
def B():

    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    A()

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
memo = set()
def f(a,b,c):
  if (a,b,c) in memo : return -1
  if a%2 or b%2 or c%2 : return 0
  memo.add((a,b,c))
  r = f((b+c)//2,(a+c)//2,(a+b)//2)
  return r+1 if r>=0 else -1

print(f(A,B,C))

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
f = True
for i in range(10000):
  if A%2 == 1 or B%2 == 1 or C%2 == 1:
    f = False
    print(i)
    break
  A, B, C = B//2 + C//2, A//2 + C//2, A//2 + B//2
if f:
  print(-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)
    exit()

l=[a,b,c]
ans=0
for i in range(30):
    if l[0]%2!=0 or l[1]%2!=0 or l[2]%2!=0:
        break
    a=(l[1]+l[2])//2
    b=(l[0]+l[2])//2
    c=(l[0]+l[1])//2
    ans+=1
    l=[a,b,c]
print(ans)

Submission status: Accepted

Solution code:
def main():
    A, B, C = map(int, input().split())
    visited = set()
    count = 0
    while A % 2 == 0 and B % 2 == 0 and C % 2 ==0:
        count += 1
        visited.add((A, B, C))
        A, B, C = (B+C)//2, (C+A)//2, (A+B)//2
        if (A, B, C) in visited:
            return -1
    return count

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#AGC014A
import sys
#import collections

#n= int(input())
tmp = input().split()
a,b,c = list(map(lambda a: int(a), tmp))

#print(a)
#print(b)
#print(c)


count=0
while(1):
	if((a==b)and(b==c)):
		if(a%2==1):
			print(count)
			sys.exit()
		else:
			print(-1)
			sys.exit()
	if((a%2==1)or(b%2==1)or(c%2==1)):
		print(count)
#		print(a)
#		print(b)
#		print(c)
		sys.exit()
	a//=2
	b//=2
	c//=2
	tmp=a
	a+=b
	b+=c
	c+=tmp
	count+=1

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
if all(map(lambda x: x % 2 != 0, [A, B, C])):
    print(0)
    exit(0)
elif A == B == C:
    print(-1)
    exit(0)
else:
    count = 0
    while all(map(lambda x: x % 2 == 0, [A, B, C])) == 1:
        A, B, C = (B + C) / 2, (A + C) / 2, (A + B) / 2
        count += 1
    print(count)

Submission status: Accepted

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

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections, copy, heapq


def solve(A: int, B: int, C: int):
    counter = 0
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        if A == B and B == C:
            print(-1)
            return
        A, B, C = (B+C)//2, (C+A)//2, (A+B)//2
        counter += 1
    print(counter)
    return


# Generated by 1.1.4 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())

def divisor_two_power(N):
    for i in range(64):
        if N % (2 ** i) != 0:
            return i - 1
    return -1

if A == B and B == C:
    if A % 2 == 0:
        print(-1)
    else:
        print(0)
else:
    print(min(min(map(divisor_two_power, [A, B, C])) + 1,
              min(map(divisor_two_power, [A + B, B + C, A + C]))))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

dict = {}
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
    string = str(A) + "_" + str(B) + "_" + str(C)
    if string in dict:
        print(-1)
        exit()
    else:
        dict[string] = string

print(ans)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
cnt=0
for _ in range(100):
  if a%2!=0 or b%2!=0 or c%2!=0:
    print(cnt)
    exit()
  a,b,c = (b+c)/2,(c+a)/2,(a+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 :
    ans = -1
else :
    flg = 1
    ans = 0
    while flg :
        if A%2 + B%2 + C%2 :
            flg = 0
        else :
            ans += 1
            ta,tb,tc = A,B,C
            A = (tb+tc)//2
            B = (tc+ta)//2
            C = (ta+tb)//2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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)
    exit()
  else:
    print(0)
    exit()

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

def check(a, b, c):
    if a % 2 == b % 2 == c % 2 == 0: #すべて偶数の時
        return True 
    return False


count = 0
while True:
    if check(A, B, C):
        count += 1
        A, B, C = (B + C)//2, (C + A)//2 , (A + B)//2
    else:
        break
print (count)

Submission status: Accepted

Solution code:

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

s = 0
def c2(a,b,c):
    d = 1
    if a%2!=0 or b%2!=0 or c%2!=0:
        d = 0
    elif a == b and a== c:d=-1
    return (b+c)/2, (a+c)/2 ,(a+b)/2,d

while 1:
    a,b,c,d = c2(a,b,c)
    if d == 1:
        s+=1
    elif d== -1:
        s=-1
        break
    else:
        break
print(s)

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
ans = 0
lst = [A,B,C]
lst.sort()
import numpy as np
import sys
num1 = lst[1]-lst[0]
num2 = lst[2]-lst[1]
cnt = 0
while True:
    if num1 == 0 and num2 == 0:
        if A%2 == 1:
            print(0)
        else:
            print(-1)
        sys.exit()
    if num1 % 2 != 0 or num2 % 2 != 0:
        break
    cnt += 1
    num1 //= 2
    num2 //= 2
print(cnt)

Submission status: Accepted

Solution code:
import numpy as np
import sys
a,b,c=[int(i) for i in input().split()]
v=np.array([abs((b-a)-(c-a)), abs((a-b)-(c-b)), abs((a-c)-(b-c))])

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

count = 0
# Shift Only
while all(v%2==0):
    # print(v)
    v = v / 2
    count += 1
print(count)

Submission status: Accepted

Solution code:
import sys

A, B, C = map(int, input().split())
aLst = [A]
bLst = [B]
cLst = [C]
cnt = 0
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    print(0)
    sys.exit()
    
for i in range(1000000000000):
    atmp = (bLst[i] // 2) + (cLst[i] // 2)
    btmp = (aLst[i] // 2) + (cLst[i] // 2)
    ctmp = (aLst[i] // 2) + (bLst[i] // 2)
    aLst.append(atmp)
    bLst.append(btmp)
    cLst.append(ctmp)
    if atmp % 2 == 1 or btmp % 2 == 1 or ctmp % 2 == 1:
        cnt += 1
        break
    elif atmp == btmp and btmp == ctmp and atmp == ctmp:
        cnt = -1
        break
    else:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(50):
    if A%2 or B%2 or C%2:
        print(i)
        exit()
    if A==B==C:
        print(-1)
        exit()
    a = (B+C)//2
    b = (A+C)//2
    c = (A+B)//2
    A,B,C = a,b,c

Submission status: Accepted

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

a = (y + z) / 2
b = (x + z) / 2
c = (x + y) / 2

if x % 2 or y % 2 or z % 2:
    print(0)
    exit()
if a % 2 or b % 2 or c % 2:
    print(1)
    exit()
if x == y == z:
    print(-1)
    exit()

cnt = 1
while True:
    if cnt % 2 == 0:
        x = (x + a) / 2
        y = (y + b) / 2
        z = (z + c) / 2
    if cnt % 2 == 1:
        a = (x + a) / 2
        b = (y + b) / 2
        c = (z + c) / 2
    cnt += 1
    if x % 2 or y % 2 or z % 2 or a % 2 or b % 2 or c % 2:
        break

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if a == b == c and a%2==0:
    ans = -1
else:
    for i in range(10**9):
        if a%2==1 or b%2==1 or c%2==1:
            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: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
# 2019/08/09

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

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) & (b == c) & (a%2 == 0):
  print(-1)
else :
  cnt = 0
  while True:
    if (a%2 == 1) | (b%2 == 1) | (c%2 == 1) :
      print(cnt)
      exit()
    cnt += 1
    buf_a = (b+c)//2
    buf_b = (a+c)//2
    buf_c = (a+b)//2
    a = buf_a
    b = buf_b
    c = buf_c

Submission status: Accepted

Solution code:
def main():
    a,b,c = map(int,input().split())
    if a==b==c:
        if a%2==0:
            print(-1)
        else:
            print(0)
    else:
        cnt = 0
        while 1:
            if a%2==1 or b%2==1 or c%2==1:
                print(cnt)
                exit()
            kari_a = (b+c)/2
            kari_b = (c+a)/2
            kari_c = (a+b)/2
            a,b,c = kari_a,kari_b,kari_c
            cnt += 1
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ぜんぶ同じなら永遠に続く あとはわからんからシミュ
# ぜんぶ奇数の場合は-1じゃなくて0

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

count = 0
while True:
    if len(set(list(map(lambda x: x % 2, [a, b, c])))) != 1:
        break
    count += 1
    a, b, c = b / 2 + c / 2, a / 2 + c / 2, a / 2 + b / 2

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()
i = 0
while 1:
    if A % 2 or B % 2 or C % 2:
        print(i)
        break
    a, b, c = A>>1, B>>1, C>>1
    A, B, C = b+c, a+c, a+b
    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")

elif A == B and B == C:
    print("-1")
else:
    ans = 0
    while True:
        if A % 4 == B % 4 and B % 4 == C % 4:
            ans += 1
            tempA = A
            tempB = B
            tempC = C
            A = tempB // 2 + tempC // 2
            B = tempC // 2 + tempA // 2
            C = tempA // 2 + tempB // 2
        else:
            ans += 1
            break
    print(str(ans))

Submission status: Accepted

Solution code:
# 誰か奇数になったら終了
# A==B==C になったら-1

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

Submission status: Accepted

Solution code:
from sys import exit, stdin
A, B, C = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
if A == B == C:
    if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        print(-1)
        exit()
    else:
        print(0)
        exit()
else:
    while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        A, B, C = (A+B)//2, (B+C)//2, (C+A)//2
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    A, B, C = map(int, input().split())
    ans = 0
    seen = set()
    while True:
        if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
            break
        if (A, B, C) in seen:
            print(-1)
            return
        seen.add((A, B, C))
        x = A//2
        y = B//2
        z = C//2
        A = y + z
        B = z + x
        C = x + y
        ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
s=set()
cnt=0
while (A,B,C) not in s:
    s.add((A,B,C))
    if A%2==1 or B%2==1 or C%2==1:
        print(cnt)
        exit()
    A,B,C=(B+C)//2,(C+A)//2,(A+B)//2
    cnt+=1
print("-1")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# AGC014A - Cookie Exchanges
def main():
    a, b, c = tuple(map(int, input().split()))
    if a == b == c:  # corner case
        print(0 if a % 2 == 1 else -1)
        return
    ans = 0
    while 1 not in (a % 2, b % 2, c % 2):
        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:
# AGC014A - Cookie Exchanges
def main():
    a, b, c = list(map(int, input().rstrip().split()))
    if a == b == c:
        if 1 in (a % 2, b % 2, c % 2):
            print(0)
        else:
            print(-1)
        return
    ans = 0
    while True:
        if 1 in (a % 2, b % 2, c % 2):
            break
        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:
# AGC014A - Cookie Exchanges
def main():
    a, b, c = list(map(int, input().rstrip().split()))
    if a == b == c:
        A = (a, b, c)
        if any(i % 2 != 0 for i in A):
            print(0)
        else:
            print(-1)
        return
    ch = {(a, b, c)}
    ans = 0
    while True:
        A = (a, b, c)
        if any(i % 2 != 0 for i in A):
            break
        a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
        if (a, b, c) in ch:
            break
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import copy
import sys
import math

def main():
	a,b,c = map(int,input().split())
	ca = a
	cb = b
	cc = c
	count = 0
	if(ca%2==1  or cb%2==1 or cc%2==1):
		print(count)
		sys.exit()
	ca,cb,cc = int((cb+cc)/2),int((ca+cc)/2),int((cb+ca)/2)
	
	count+=1
	while a != ca or b !=  cb or c !=  cc:
		if(ca%2==1  or cb%2==1 or cc%2==1):
			print(count)
			sys.exit()
		ca,cb,cc = int((cb+cc)/2),int((ca+cc)/2),int((cb+ca)/2)
		count+=1
	print(-1)


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
ans = 0
for i in range(100000000):
  if a%2==1 or b%2==1 or c%2==1:
    break
  else:
    a, b, c = (b+c)//2, (c+a)//2, (a+b)//2
    ans += 1
if ans == 10**8:
  print(-1)
else:
  print(ans)

Submission status: Accepted

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

if not all([a%2==0,b%2==0,c%2==0]):
    print(t)
elif all([a==b,b==c]):
    print(-1)


else:
    while True:
        a, b, c = map( int,[ b/2+c/2, c/2+a/2, a/2+b/2 ] )
        t += 1

        if not all([a%2==0,b%2==0,c%2==0]):
            print(t)
            break
        elif all([a==b,b==c]):
            print(-1)
            break

Submission status: Accepted

Solution code:
import numpy as np
import sys

three_cookies = list(map(int, input().split()))

three_div = [i % 2 for i in three_cookies]
if all(three_div) or any(three_div):
    print(0)
    sys.exit()

a_b_c = np.array(three_cookies)
lis = np.array([[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]])
i = 0

while True:
    i += 1
    a_b_c = np.dot(lis, a_b_c)
    #print(a_b_c)
    for j, item in enumerate(a_b_c):
        if three_cookies == a_b_c.tolist():
            print(-1)
            sys.exit()
        if item % 2 == 1:
            print(i)
            sys.exit()

Submission status: Accepted

Solution code:
from sys import stdin
A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
 
ans = 0
 
if A == B == C:
    if A % 2 == 0:
        ans = -1
    else:
        ans = 0
else:
    for _ in range(1000):
        
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            break
        ans += 1
        ta = A
        tb = B
        tc = C
        A = (tb/2) + (tc/2)
        B = (ta/2) + (tc/2)
        C = (ta/2) + (tb/2)
        
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin
A,B,C = [int(x) for x in stdin.readline().rstrip().split()]

ans = 0

if A == B == C:
    if A % 2 == 0:
        ans = -1
    else:
        ans = 0
elif A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
     ans = 0
else:
    for _ in range(1000):
        ta = A
        tb = B
        tc = C
        A = (tb/2) + (tc/2)
        B = (ta/2) + (tc/2)
        C = (ta/2) + (tb/2)
        ans += 1
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            break
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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