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

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

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

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

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

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

cnt = 0
while True:
    
    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)

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

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

Solution (Python):



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]

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

Solution (Python):
import math


def resolve():
    import sys
    input = sys.stdin.readline
    
    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()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
A, B, C = map(int, input().split())
S = A+B+C

k = 0
flag = 0
while k<100:
    if A%2==1 or B%2==1 or C%2==1 or min([A,B,C])<1:
        flag = 1
        break
    An = (B + C)//2
    Bn = (A + C)//2
    Cn = (B + A)//2
    A = An 
    B = Bn 
    C = Cn         
    k += 1

if not flag:
    k = -1

print(k)

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

oldCookies = []
oldCookies.append([a,b,c])

answer = 0

while(True):
	if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
		break 
	after_a = b / 2 + c / 2
	after_b = a / 2 + c / 2
	after_c = a / 2 + b / 2
	a = after_a
	b = after_b 
	c = after_c
	cookies = [a,b,c]
	answer += 1 
	
	for i in range(len(oldCookies)):
		if oldCookies[i] == cookies:
			answer = -1
			break

	if answer == -1:
		break

print(answer)

Solution (Python):


A,B,C = [int(x) for x in input().split(" ")]

ans = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    ans += 1
    A_new = B / 2 + C / 2
    B_new = A / 2 + C / 2
    C_new = A / 2 + B / 2
    if A == A_new and B == B_new and C == C_new:
        ans = -1
        break
    A = A_new
    B = B_new
    C = C_new

print(ans)

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

cnt = 0
history = set()
while True:
  if (a, b, c) in history:
    print(-1)
    exit(0)
  if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
    print(cnt)
    exit(0)
  a, b, c = sorted([a, b, c])
  history.add((a, b, c))
  na = b // 2 + c // 2
  nb = a // 2 + c // 2
  nc = a // 2 + b // 2
  a = na
  b = nb 
  c = nc
  cnt += 1

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

count = 0

while 1:
    if A%2==0 and B%2==0 and C%2==0:
        if A==B and B==C:
            print(-1)
            exit()
        A_tmp = B//2 + C//2
        B_tmp = A//2 + C//2
        C_tmp = A//2 + B//2
        A, B, C = A_tmp, B_tmp, C_tmp
        count += 1
    else:
        break
print(count)

Solution (Python):
A = list(map(int, input().split()))
ans = 0

while sum([A[i] % 2 for i in range(3)]) == 0:
    if A.count(A[0]) == 3:
        ans = -1
        break
    A = [(sum(A)-A[i])/2 for i in range(3)]
    ans += 1

print(ans)

Solution (Python):
a, b, c = map(int, input().split())
a_sho,b_sho,c_sho = a,b,c
ans = 0
mugen = False
while True:
    a_k = a
    b_k = b
    c_k = c
    if a%2 != 0 or b%2 != 0 or c%2 != 0:
        break
    else:
        a = b_k/2 + c_k/2
        b = a_k/2 + c_k/2
        c = a_k/2 + b_k/2
        ans += 1
    if a == a_sho and b == b_sho and c == c_sho:
        mugen = True
        break

if mugen:
    print(-1)
else:
    print(ans)

Solution (Python):
A, B, C = map(int,input().split())
ans = 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
    if A == a and B == b and C == c:
        ans = -1
        break
    A = a
    B = b
    C = c
    ans += 1
print(ans)

Solution (Python):
import sys
A,B,C=map(int,input().split())
cnt=0
A_old=B_old=C_old=0
for i in range(100000000):
    if A%2==1 or B%2==1 or C%2==1:
        print(cnt)
        sys.exit()
    elif  A==A_old and B==B_old and C==C_old:
        print(-1)
        sys.exit()

    A_old=A
    B_old=B
    C_old=C
    A=C_old/2+B_old/2
    B=A_old/2+C_old/2
    C=A_old/2+B_old/2
    cnt+=1

Solution (Python):
a,b,c=map(int,input().split())
cnt=0
while a%2==b%2==c%2==0:
  a1=a//2
  b1=b//2
  c1=c//2
  a=b1+c1
  b=c1+a1
  c=a1+b1
  cnt+=1
  if a==2*a1 and b==2*b1 and c==2*c1:
    cnt=-1
    break
print(cnt)

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

Q=0
if A==B and B==C and C==A:
    if A%2==1 or B%2==1 or C%2==1:
        print(0)
    elif  A%2==0 or B%2==0 or C%2==0:
        print(-1)
else:
    for i in range(100):
        if A%2==1 or B%2==1 or C%2==1:
            print(Q)
            break
        else:
            A,B,C=(B+C)//2,(C+A)//2,(A+B)//2
            Q+=1

Solution (Python):
a,b,c = map(int,input().split())
if a == b and b == c and a == c:
  if a %2 == 0:
    print(-1)
  else:
    print(0)
else:
  for i in range(10**9):
    if a %2 == 0:
      S = a/2
    else:
      print(i)
      break
    if b%2 == 0:
      T = b/2
    else:
      print(i)
      break
    if c %2 == 0:
      U = c/2
    else:
      print(i)
      break
    a -= S*2
    b -= T*2
    c -= U*2
    a += T
    a += U
    b += S
    b += U
    c += S
    c += T

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a = list(map(int, readline().split()))

    ans = 0
    while all([x % 2 == 0 for x in a]):
        a[0], a[1], a[2] = a[1] + a[2], a[2] + a[0], a[0] + a[1]
        a[0] //= 2
        a[1] //= 2
        a[2] //= 2
        ans += 1
        if a[0] == a[1] == a[2]:
            return print(-1)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a, b, c = map(int, input().split())
state = [[a,b,c]]
if a%2 == 0  and a == b  and b == c:
    print(-1)
else:
    while True:
        if a%2==1 or b%2==1 or c%2==1:
            print(count)
            exit()
        a_2 = a//2
        b_2 = b//2
        c_2 = c//2
        a = b_2 + c_2
        b = a_2 + c_2
        c = a_2 + b_2
        if [a,b,c] in state:
            print(-1)
        else:
            state.append([a,b,c])
            count += 1

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

if any([q%2==1 for q in (a,b,c)]):
  print(0)
  exit()

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

cnt=0
while all([q%2==0 for q in (a,b,c)]):
  cnt+=1
  s=a+b+c
  a=s-a
  a//=2
  b=s-b
  b//=2
  c=s-c
  c//=2
print(cnt)

Solution (Python):
a,b,c = map(int,input().split())
ans = 0
while a%2==0 and b %2== 0 and c %2== 0:
  if a == b == c:
    ans = -1
    break
  aa = (a/2)
  bb = (b/2)
  cc = (c/2)
  a = bb+cc
  b = aa+cc
  c = aa+bb
  ans += 1
  
print(ans)

Solution (Python):
T,A,S = map(int, input().split(' '))

persons = [T, A, S]

def check_even(persons):
    for person in persons:
        if person % 2 != 0:
            return False
    return True




if not check_even(persons):
    print(0)
    exit()


if T == A and A == S:
    print(-1)
    exit()

count = 1

while True:
    for person in persons:
        tmp_0 = persons[0]
        tmp_1 = persons[1]
        tmp_2 = persons[2]

        persons[0] = 0 + tmp_1 / 2 + tmp_2 / 2
        persons[1] = tmp_0 / 2 + 0 + tmp_2 / 2
        persons[2] = tmp_0 / 2 + tmp_1 / 2 + 0

        if check_even(persons):
            count += 1
        else:
            print(count)
            exit()

Solution (Python):
T,A,S = map(int, input().split(' '))

persons = [T, A, S]

def check_even(persons):
    for person in persons:
        if person % 2 != 0:
            return False
    return True




if not check_even(persons):
    print(0)
    exit()


if T == A and A == S:
    print(-1)
    exit()

count = 1

while True:
    for person in persons:
        tmp_0 = persons[0]
        tmp_1 = persons[1]
        tmp_2 = persons[2]

        persons[0] = 0 + tmp_1 / 2 + tmp_2 / 2
        persons[1] = tmp_0 / 2 + 0 + tmp_2 / 2
        persons[2] = tmp_0 / 2 + tmp_1 / 2 + 0

        if check_even(persons):
            count += 1
        else:
            print(count)
            exit()

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

def isodd(x):
    if x % 2 == 1:
        return True
    else:
        return False

if isodd(A) or isodd(B) or isodd(C):
    print(0)
    sys.exit()
res = 0
while not isodd(A) and not isodd(B) and not isodd(C):
    if A == B == C:
        print(-1)
        sys.exit()
    tA, tB, tC = A, B, C
    A = tB//2 + tC//2
    B = tA//2 + tC//2
    C = tA//2 + tB//2
    res += 1
print(res)

Solution (Python):
a,b,c = map(int,input().split())
res = 0
while a%2==0 and b%2==0 and c%2==0: 
    if a==b==c: 
        print(-1)
        exit()
    tmpa = b//2+c//2
    tmpb = a//2+c//2
    tmpc = a//2+b//2
    a = tmpa
    b = tmpb
    c = tmpc
    res += 1
print(res)

Solution (Python):
a, b, c = map(int, input().split())
count = 0
for i in range(1100):
    if (a%2 + b%2 + c%2):
        break
    d,e,f = (b+c)//2, (c+a)//2, (a+b)//2
    a,b,c = d,e,f
    count += 1
if(count>1000):
    count = -1
print(count)

Solution (Python):
import sys
input = sys.stdin.readline
enum = enumerate

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def vinput(rep=1, ty=int, cvt=list):
	return cvt(ty(input().rstrip()) for _ in "*"*rep)

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def main():
	a,b,c = linput()
	d = a-b
	res = 0

	cnt = 0
	while cnt<10**2:
		if a%2 or b%2 or c%2:
			break
		p,q,r = a//2, b//2, c//2
		s = p+q+r
		a,b,c = s-p, s-q, s-r
		cnt += 1
		
	else:
		cnt = -1
	
	res = cnt
	
	
	print(res)

if __name__ == "__main__":
	main()

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

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

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

LA = []
LB = []
LC = []
LA.append(A)
LB.append(B)
LC.append(C)
i = 0
cnt = 0

while LA[i] % 2 == 0 and LB[i] % 2 == 0 and LC[i] % 2 == 0:
    LA.append((LB[i]+LC[i])/2)
    LB.append((LC[i]+LA[i])/2)
    LC.append((LA[i]+LB[i])/2)
    i += 1
    cnt += 1

print(cnt)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def f(a, b, c):
    if (a%2 != 0) | (b%2 != 0) | (c%2 != 0):
        return 0
    if (a == b) & (b == c):
        return -1
    return f((b+c)//2, (a+c)//2, (a+b)//2) + 1
def main():
    a, b, c = map(int, readline().split())
    print(f(a, b, c))
if __name__ == '__main__':
    main()

Solution (Python):
a,b,c=map(int,input().split())
 
ans = 0
 
while a%2 == b%2 == c%2 == 0:
  ans += 1
  newa=b//2+c//2
  newb=a//2+c//2
  newc=a//2+b//2
  a=newa
  b=newb
  c=newc
  if a == b == c:
    print("-1")
    break
else:
  print(ans)

Solution (Python):
from sys import exit
a,b,c = map(int,input().split())
cnt = 0
while ~a&1 and ~b&1 and ~c&1:
    newa = b//2+c//2
    newb = a//2+c//2
    newc = a//2+b//2
    a,b,c = newa,newb,newc
    cnt += 1
    if cnt >= 10**5:
        exit(print(-1))
print(cnt)

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

ans = 0

while a%2 == b%2 == c%2 == 0:
  ans += 1
  newa=b//2+c//2
  newb=a//2+c//2
  newc=a//2+b//2
  a=newa
  b=newb
  c=newc
  if a == b == c:
    print("-1")
    break
else:
  print(ans)

Solution (Python):
a, b, c = map(int, input().split())
a_tmp = a ; b_tmp = b ; c_tmp = c
count = 0
while True :
    if a == b == c and a%2 == 0 :
        print("-1")
        break
    elif a%2 == 1 or b%2 == 1 or c%2 == 1 :
        print(count)
        break
    else :
        a = b_tmp/2 + c_tmp/2
        b = a_tmp/2 + c_tmp/2
        c = a_tmp/2 + b_tmp/2
        a_tmp = a ; b_tmp = b ; c_tmp = c
        count += 1

Solution (Python):
import sys
a,b,c = map(int,input().split(" "))
li = [[a,b,c]]
count=0

for i in range(10**2):
  if (a % 2)==1 or (b % 2)==1 or (c % 2)==1:
    break
  else:
    a2 = a/2
    b2 = b/2
    c2 = c/2
    a = b2+c2
    b = c2+a2
    c = a2+b2  
    count += 1
  if [a,b,c] in li:
    print(-1)
    sys.exit()
  else:
    li.append([a,b,c])
    
print(count)

Solution (Python):
import sys
a,b,c = map(int,input().split(" "))
li = [[a,b,c]]
count=0

for i in range(10**9):
  if (a % 2)==1 or (b % 2)==1 or (c % 2)==1:
    break
  else:
    a2 = a/2
    b2 = b/2
    c2 = c/2
    a = b2+c2
    b = c2+a2
    c = a2+b2  
    count += 1
  if [a,b,c] in li:
    print(-1)
    sys.exit()
  else:
    li.append([a,b,c])
    
print(count)

Solution (Python):
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

import numpy as np
a = np.array(ri_())
ans = 0
while True:
    if np.any(a % 2 == 1):
        break
    if a[0] == a[1] and a[1] == a[2]:
        ans = -1
        break
    a = (sum(a) - a) // 2
    ans += 1
print(ans)

Solution (Python):
def solve(A):
    r = []
    for n in A:
        if n < 2:
            r.append(0)
            continue
        cnt = 0
        while n % 2 == 0:
            n //= 2
            cnt += 1
        r.append(cnt)
    return r


def resolve():
    A = [int(i) for i in input().split()]
    for a in A:
        if a % 2 == 1:
            print(0)
            return
    if min(A) == max(A):
        print(-1)
    else:
        s = solve(A)
        if min(s) == 0 or min(s) != max(s):
            print(min(s))
        else:
            print(min(s) + 1)


resolve()

Solution (Python):
a,b,c = map(int,input().split())
i = 0

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

print(i)

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

Solution (Python):
from sys import stdin

a,b,c = [int(x) for x in stdin.readline().strip().split()]
l = 0
mem = []

while(True):
  if sum([a%2, b%2, c%2]) > 0:
    break
  elif [a,b,c] in mem:
    l = -1
    break
  else:
    l += 1
    mem.append([a,b,c])
    a_tmp = b/2 + c/2
    b_tmp = a/2 + c/2
    c_tmp = a/2 + b/2
    a,b,c = a_tmp,b_tmp,c_tmp
    
print(l)

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

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

print(cnt)

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

Solution (Python):
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 = int((b+c)/2), int((a+c)/2), int((a+b)/2)   
    cnt+=1
  print(cnt)

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

while True:
    if a%2==1 or b%2==1 or c%2==1:
        print(ans)
        break
    if a == b == c:
        print(-1)
        break
    s = a // 2
    t = b // 2
    u = c // 2
    a, b, c = t+u, s+u, s+t
    ans += 1
else:
    print(ans)

Solution (Python):
a,b,c=map(int,input().split())
ans=0
average=int((a+b+c)/3)
while True:
    if a%2==1 or b%2==1 or c%2==1:
        print(ans)
        exit()
    else:
        tb=int(b/2)
        tc=int(c/2)
        ta=int(a/2)
        a=tb+tc
        b=ta+tc
        c=ta+tb

        ans+=1
    if a==average and b==average and c==average:
        print(-1)
        exit()

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


l = list(map(int, input().split()))
l.sort()
a,b,c = l
ans = 0
while True:
    if a%2 or b%2 or c%2:
        break
    if a==b==c:
        ans = -1
        break
    a,b,c = b//2+c//2, a//2+c//2, a//2+b//2
    ans += 1
print(ans)

Solution (Python):
def f(a, b, c):
    if a > 1 and a == b and a == c:
        print(-1)
    else:
        count = 0
        for i in range(100):
            if a%2 or b%2 or c%2:
                break
            a, b, c = b//2 + c//2, a//2 + c//2, a//2 + b//2
            count += 1
        print(count)

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

Solution (Python):

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

a1,b1,c1,cou= 0,0,0,0



while A%2 == 0 and B%2 == 0 and C%2 == 0:
    if A == B == C:
        print("-1")
        sys.exit()
    a1 = int(A/2) 
    b1 = int(B/2) 
    c1 = int(C/2) 
    A = b1+c1
    B = a1+c1
    C = a1+b1
    cou += 1
    
print(cou)

Solution (Python):
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy


def odd(n): return n & 1


def even(n): return not odd(n)


A, B, C = map(int, input().split())
ans = 0
a, b, c = A, B, C
while True:
    dump(a, b, c)
    if odd(a) or odd(b) or odd(c):
        print(ans)
        exit()
    if ans > 0 and a == A and b == B and c == C:
        print(-1)
        exit()
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    ans += 1

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

count = 0
while True:
    if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
        break
    a = B // 2 + C // 2
    b = C // 2 + A // 2
    c = A // 2 + B // 2
    if a == A and b == B and c == C:
        print(-1)
        exit()
    A = a
    B = b
    C = c
    count += 1

print(count)

Solution (Python):
def exchange(l):
    newlist = [0, 0, 0]
    for i in range(3):
        for j in range(3):
            if i != j:
                newlist[i] += l[j]//2
    return newlist


def containsOdd(l):
    for i in range(3):
        if l[i] % 2 == 1:
            return True
    return False


def isAllEquals(l):
    if l[0] == l[1] == l[2]:
        return True
    return False


def main():
    cookies = [int(x) for x in input().split()]
    ans = 0
    while True:
        if isAllEquals(cookies):
            if cookies[1] % 2 == 1:
                print(0)
                return
            print(-1)
            return 0
        if containsOdd(cookies):
            print(ans)
            return 0
        cookies = exchange(cookies)
        ans += 1


if __name__ == '__main__':
    main()

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

if A == B == C and A%2 == 1:
    print('0')
elif A == B == C:
    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)

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    a, b, c = MI()
    if a%2 or b%2 or c%2:
        print(0)
        sys.exit()
    if (a == b) and (b == c):
        print(-1)
        sys.exit()
    cnt = 0
    while True:
        if a%2 or b%2 or c%2:
            break
        temp_a = a
        temp_b = b
        temp_c = c
        a = temp_b//2 + temp_c//2
        b = temp_a//2 + temp_c//2
        c = temp_a//2 + temp_b//2
        cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()