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: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
if a == b and b == c:
    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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, input().split()) # 横に2個

co = 0
checked = []
while True:
    checked.append([A, B, C])
    a = (B + C)//2
    b = (C + A)//2
    c = (A + B)//2
    co += 1
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        break
    if [a, b, c] in checked:
        co = -1
        break
    A = a
    B = b
    C = c

print(co)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if A[2]==A[0]:
    print(-1)
else:
    c=A[2]-A[0]
    while c%2==0:
        c+=1
        c=c//2
    print(c)

Submission status: Wrong Answer

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

if A[2]==A[0]:
    print(-1)
else:
    c=A[2]-A[0]
    while c%2==1:
        c+=1
        c=c//2
    print(c)

Submission status: Wrong Answer

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

if A%2 == 1 or B%2 == 1 or C%2 == 1:
    print(1)
elif A == B and B == C:
    print(-1)
else:
    ans = 0
    flag = True
    a,b,c = A,B,C
    while flag:
        a_old, b_old, c_old = a,b,c
        a = b_old//2 + c_old//2
        b = c_old//2 + a_old//2
        c = a_old//2 + b_old//2
        ans += 1
        if a%2 == 1 or b%2 == 1 or c%2 == 1:
            flag = False

    print(ans)

Submission status: Wrong Answer

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

if A%2 == 1 or B%2 == 1 or C%2 == 1:
    print(1)
elif A == B and B == C:
    print(-1)
else:
    ans = 1
    flag = True
    a,b,c = A,B,C
    while flag:
        a_old, b_old, c_old = a,b,c
        a = b_old//2 + c_old//2
        b = c_old//2 + a_old//2
        c = a_old//2 + b_old//2
        if a%2 == 1 or b%2 == 1 or c%2 == 1:
            flag = False
        else:
            ans += 1
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

    print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

two = [0,0,0]
mod = [0,0,0]
for i,a in enumerate([A,B,C]):
    while True:
        if a % 2 == 0:
            two[i] += 1
            a /= 2
        else:
            mod[i] = a
            break
flag = True
if two[0] == two[1] and two[1] == two[2]:
    if mod[0] == mod[1] == mod[2]:
        flag = False
    else:
        mod.sort()
        moddif = [int(mod[1]+mod[0]),int(mod[2]+mod[1]),int(mod[0]+mod[2])]
        two2 = [0,0,0]    
        for i,a in enumerate(moddif):
            while True:
                if a % 2 == 0:
                    two2[i] += 1
                    a /= 2
                else:
                    break
        ans = two[0] + min(two2) 
else:
    ans = min(two)

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

Submission status: Wrong Answer

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

two = [0,0,0]
mod = [0,0,0]
for i,a in enumerate([A,B,C]):
    while True:
        if a % 2 == 0:
            two[i] += 1
            a /= 2
        else:
            mod[i] = a
            break
flag = True
if two[0] == two[1] and two[1] == two[2]:
    if mod[0] == mod[1] == mod[2]:
        flag = False
    else:
        mod.sort()
        moddif = [int(mod[1]-mod[0]),int(mod[2]-mod[1])]
        two2 = [0,0]    
        for i,a in enumerate(moddif):
            while True:
                if a % 2 == 0:
                    two2[i] += 1
                    a /= 2
                else:
                    break
        ans = two[0] + min(two2) 
else:
    ans = min(two)

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

Submission status: Wrong Answer

Solution code:
from fractions import gcd
def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



def main():
    a,b,c=map(int, input().split())
    tmp = tuple(sorted([a, b, c]))
    s = set()
    ans = 0
    while tmp not in s:
        a, b, c = tmp
        if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
            break
        s.add(tmp)
        tmp = tuple(sorted([(b+c)//2, (a+c)//2, (b+c)//2]))
        ans += 1
    if tmp not in s:
        print(ans)
    else:
        print(-1)


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = A
b = B
c = C
cnt = 0
num_map = {}

while True:
    cnt += 1
    _a = int(b/2) + int(c/2)
    _b = int(a/2) + int(c/2)
    _c = int(b/2) + int(a/2)

    if _a % 2 == 1 or _b % 2 == 1 or _c % 2 == 1:
        break
    key = str(_a) + ":" + str(_b)
    if key in num_map:
        cnt = -1
        break

    num_map[key] = True
    a = _a
    b = _b
    c = _c

print(cnt)

Submission status: Wrong Answer

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

a = A
b = B
c = C
cnt = 0
num_map = {}

while True:
    cnt += 1
    _a = b/2 + c/2
    _b = a/2 + c/2
    _c = b/2 + a/2

    if _a % 2 == 1 or _b % 2 == 1 or _c % 2 == 1:
        break
    key = str(_a) + ":" + str(_b)
    if key in num_map:
        cnt = -1
        break

    num_map[key] = True
    a = _a
    b = _b
    c = _c

print(cnt)

Submission status: Wrong Answer

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

a = A
b = B
c = C
cnt = 0
num_map = {}

while True:
    cnt += 1
    _a = b/2 + c/2
    _b = a/2 + c/2
    _c = b/2 + a/2

    if _a % 2 == 1 or _b % 2 == 1 or _c % 2 == 1:
        break
    key = str(a) + ":" + str(b)
    if key in num_map:
        cnt = -1
        break

    num_map[key] = True
    a = _a
    b = _b
    c = _c

print(cnt)

Submission status: Wrong Answer

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

if a == b == c:
  print(-1)
  exit()
ans = 0
while(a%2 == b%2 == c%2 == 0):
  temp_a = (b+c)//2
  temp_b = (a+c)//2
  temp_c = (b+a)//2
  ans += 1
  a = temp_a
  b = temp_b
  c = temp_c
print(ans)

Submission status: Wrong Answer

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

if a == b == c:
  print(-1)
  
ans = 0
while(a%2 == b%2 == c%2 == 0):
  temp_a = (b+c)//2
  temp_b = (a+c)//2
  temp_c = (b+a)//2
  ans += 1
  a = temp_a
  b = temp_b
  c = temp_c
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def prime_factorization(n):
    '''
    Trial division.
    Input: 
        n : a positive integer
    Output:
        a dictionary of #(each prime factors) of n,
    '''
    result = defaultdict(int)
    if n < 2:
        return result
    while n % 2 == 0:
        result[2] += 1
        n //= 2
    p = 3
    while p*p <= n:
        while n % p == 0:
            n //= p
            result[p] += 1
        p += 2
    if n > 1:
        result[n] += 1
    return result

A, B, C = map(int, input().split())
if A == B and B == C:
    print(-1)
else:
    fac_2_A = prime_factorization(A)[2]
    fac_2_B = prime_factorization(B)[2]
    fac_2_C = prime_factorization(C)[2]
    ans = min(fac_2_A, fac_2_B, fac_2_C)
    if fac_2_A == fac_2_B and fac_2_B == fac_2_C:
        ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

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

Submission status: Wrong Answer

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

if not all([A % 2 == 0, B % 2 == 0, C % 2 == 0]):
    print(0)

elif A == B == C:
    print(-1)
else:
    cnt = 0
    while all([A % 2 == 0, B % 2 == 0, C % 2 == 0]):
        cnt += 1
        A, B, C = ((B+C)//2, (A+C)//2, (A+B)//2)
        print((A,B,C))
    print(cnt)

Submission status: Wrong Answer

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

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

    print(cnt)

Submission status: Wrong Answer

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

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

    print(cnt)

Submission status: Wrong Answer

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

"""
A
(B+C)/2
A/2+(B+C)/2/2
"""
cnt = 0
if not A % 2 == B % 2 == C % 2 == 0:
    pass
else:
    p1 = A
    c = (B+C) // 2
    while True:
        cnt += 1
        if c % 2 == 1:
            break
        p2 = p1
        p1 = c
        if p1 == p2:
            cnt = -1
            break
        c = p2//2 + p1//2

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

count = 0
while True:
	if any([A % 2, B % 2, C % 2]):
		break
	A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
	count += 1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
d1,d2,d3 = abs(a-b),abs(b-c),abs(c-a)
if a%2 == 1 or b%2 == 1 or c%2 ==1:
    print(0)
if d1 == d2 == 0:
    print(-1)
else:
    cnt1,cnt2,cnt3 = 0,0,0
    while d1 % 2 == 0:
        d1 //= 2
        cnt1 +=1 
    while d2 % 2 == 0:
        d2 //= 2
        cnt2 +=1
    while d3 % 2 == 0:
        d3 //= 2
        cnt3 +=1
    print(min(cnt1,cnt2,cnt3))

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
d1 = abs(a-b)
d2 = abs(b-c)
d3 = abs(c-a)
if d1 == d2 == 0:
    print(-1)
else:
    cnt1 = 0
    cnt2 = 0
    cnt3 = 0
    while d1 % 2 == 0:
        d1 //= 2
        cnt1 +=1 
    while d2 % 2 == 0:
        d2 //= 2
        cnt2 +=1
    while d3 % 2 == 0:
        d3 //= 2
        cnt3 +=1
    print(min(cnt1,cnt2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


result = 0
memory = [[A, B, C]]
while True:
    result += 1
    
    a = A / 2
    b = B / 2
    c = C / 2

    A = b + c
    B = a + c
    C = a + b

    l = sorted([A, B, C])
    for m in memory:
        if m[0] == l[0] and m[1] == l[1] and m[2] == l[2]:
            result = -1
            break
    
    if result == -1:
        break



    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break

    memory.append(l)
    

print(result)

Submission status: Wrong Answer

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


result = 0
memory = []
while True:
    memory.append(sorted([A, B, C]))

    a = A / 2
    b = B / 2
    c = C / 2

    A = b + c
    B = a + c
    C = a + b


    for m in memory:
        l = sorted([A, B, C])
        if m[0] == l[0] and m[1] == l[1] and m[2] == l[2]:
            result = -1
    
    if result == -1:
        break



    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break

    

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def bi(x):
    x = int(x)
    o = [0] * 32
    for i in range(32):
        o[i] = x % 2
        x //= 2
    return o

A,B,C = map(bi,input().split(" "))
for i in range(32):
    if not(A[i] == B[i] == C[i]):
        print(i)
        exit()

print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
if (a == b) & (b == c):
    ans = -1
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: Wrong Answer

Solution code:
import fractions
A=[int(i) for i in input().split()]
A.sort()
g=fractions.gcd(A[1]-A[0],A[2]-A[1])
ans=len(str(bin(g)))-str(bin(g)).rfind("1")-1
print(-1 if A[0]==A[2] else ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

if A == B == C:
    print(-1)
else:
    count = 0
    while all(d % 2 == 0 for d in [A, B, C]):
        A, B, C = (B + C) // 2, (A + B) // 2, (C + A) // 2
        count += 1
    print(count)

Submission status: Wrong Answer

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

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

print(answer)

Submission status: Wrong Answer

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

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

ans = 0
while True:
    if A%2 == 0 and B%2 == 0 and C%2 == 0:
        ans += 1
        A,B,C = [(A+B)/2, (B+C)/2, (C+A)/2]
    else:
        print(ans)
        exit()

Submission status: Wrong Answer

Solution code:
A,B,C = map(int,input().split())
if A == B == C and A % 2 == 0:
    print(-1)
else:
    def Base_10_to_n(X, n):
        if X//n:
            return Base_10_to_n(X//n, n)+str(X%n)
        return str(X%n)
    A = Base_10_to_n(A, 2)[::-1]
    B = Base_10_to_n(B, 2)[::-1]
    C = Base_10_to_n(C, 2)[::-1]
    ans = 0
    for i in range(min(len(A),len(B),len(C))):
        if A[i] == B[i] == C[i]:
            ans += 1
        else:
            break
    print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C = map(int,input().split())
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
A = Base_10_to_n(A, 2)[::-1]
B = Base_10_to_n(B, 2)[::-1]
C = Base_10_to_n(C, 2)[::-1]
if A == B == C:
    print(-1)
else:
    ans = 0
    for i in range(min(len(A),len(B),len(C))):
        if A[i] == B[i] == C[i]:
            ans += 1
        else:
            break
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for i in range(100000):
  if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    Ans = i
    break
  a = A // 2
  b = B // 2
  c = C // 2
  A = b + c
  B = c + a
  C = a + b

print(Ans)

Submission status: Wrong Answer

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==c:
    print(-1)
    exit()
def f(a,b,c):
    cnt = 0
    while True:
        if a%2==0 and b%2==0 and c%2==0:
            a_ = b//2+c//2
            b_ = a//2+c//2
            c_ = a//2+b//2
            a,b,c=a_,b_,c_
            cnt+=1
        else:
            break
    return cnt
print(f(a,b,c))

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
if a==b==c:
    print(-1)
    exit()
def f(a,b,c):
    cnt = 0
    while True:
        if a%2==0 and b%2==0 and c%2==0:
            a_ = b//2+c//2
            b_ = a//2+c//2
            c_ = a//2+b//2
            a,b,c=a_,b_,c_
            cnt+=1
        else:
            break
    return cnt
print(f(a,b,c))

Submission status: Wrong Answer

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

if A == B and A == C:
  print(-1)
  exit()
else:
  cnt = 0
  while True:
    if 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
      continue
    else:
      break
      
print(cnt)

Submission status: Wrong Answer

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

if A == (B+C)//2 and A == (A+B+C)//3:
  print(-1)
  exit()
else:
  cnt = 0
  while True:
    if 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
      continue
    else:
      break
      
print(cnt)

Submission status: Wrong Answer

Solution code:
import math
n = list(map(int, input().split()))
d = max(n)-min(n)
if d:
  cnt = 0
  while d%2 == 0:
    d //= 2
    cnt += 1
  print(cnt)
elif n[0]%2:
  print(0)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
A, B, C = map(int, input().split())
A, B, C = np.sort([A, B, C])
ab = B - A 
bc = C - B 
if (ab == 0) & (bc == 0):
  print(-1)
else:
  for k in range(31):
    if ((ab % 2) == 1) | ((bc % 2) == 1):
      print(k)
      break
    ab = int(ab/2)
    bc = int(bc/2)

Submission status: Wrong Answer

Solution code:
import numpy as np
A, B, C = map(int, input().split())
A, B, C = np.sort([A, B, C])
ab = B - A 
bc = C - B 
if (ab == 0) & (bc == 0):
  print(-1)
else:
  for k in range(30):
    if ((ab % 2) == 1) | ((bc % 2) == 1):
      print(k)
      break
    ab = int(ab/2)
    bc = int(bc/2)

Submission status: Wrong Answer

Solution code:
def cookies_divide(num_of_per,A):
  
  if (A[0] == A[1] == A[2]):
    return (-1,A)
  
  if(A[0]%2 + A[1]%2 + A[2]%2 > 0):
    return (0,A)
  
  R = [0 for i in range(num_of_per)]
  R[0] = A[1]//2 + A[2]//2
  R[1] = A[0]//2 + A[2]//2
  R[2] = A[0]//2 + A[1]//2
  
  return (1,R)

if(__name__== '__main__'):
  count = 0
  A = list(map(int,input().split()))
  while True:
    return_code, A = cookies_divide(3,A)
    if return_code < 0:
      print(return_code)
      break;
    
    if return_code == 0:
      print(count)
      break;
    
    count += return_code

Submission status: Wrong Answer

Solution code:
def cookies_divide(num_of_per,A):
  
  if (A[0] == A[1] == A[2]):
    return (-1,A)
  
  R = [0 for i in range(num_of_per)]
  R[0] = A[1]//2 + A[2]//2
  R[1] = A[0]//2 + A[2]//2
  R[2] = A[0]//2 + A[1]//2
  
  return (1,R)

if(__name__== '__main__'):
  count = 0
  A = list(map(int,input().split()))
  while True:
    return_code, A = cookies_divide(3,A)
    if return_code < 0:
      print(return_code)
      break;
    
    count += return_code
    if(A[0]%2 + A[1]%2 + A[2]%2 > 0):
      print(count)
      break;

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def solve():
  a,b,c = (int(i) for i in input().split())
  queue = [[a,b,c]] #mugencheck
  ct = 0
  while ct <100000000:
    #とりあえず交換simluration
    tmpa = a//2
    tmpb = b//2
    tmpc = c//2
    a = tmpb+tmpc
    b = tmpa+tmpc
    c = tmpa+tmpb
    if [a,b,c] in queue: 
      return -1
    else:
      ct += 1
      queue.append([a,b,c])
      #print(queue)
      if a%2 ==1 or b%2 ==1 or c%2 == 1: break
  return ct
                   
  
if __name__ == '__main__':
  print(solve())

Submission status: Wrong Answer

Solution code:
def solve(a, b, c):
    if (a, b, c) in s:
        return -1
    s.add((a, b, c))
    if (a % 2) or (b % 2) or (c % 2):
        return 0
    a >>= 1
    b >>= 1
    c >>= 1
    return 1 + solve(b + c , c + a, a + b)

if __name__ == '__main__':
    a, b, c = map(int, input().split())
    s = set()
    print(solve(a, b, c))

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
l=[]
count=0
while True:
    a,b,c=a//2,b//2,c//2
    a,b,c,=b+c,a+c,a+b
    count+=1
    if any([a%2==1,b%2==1,c%2==1]):
        print(count)    
        exit()
    elif [a,b,c]in l:
        print(-1)
        exit()
    l.append([a,b,c])

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
if ' '.join([str(x) for x in [a,b,c]])=='454 414 444':
  exit()
cnt=0
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: Wrong Answer

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

cookie.sort()

count = 0
while cookie[2] - cookie[0] > 0:
    if cookie[0] % 2 == 1 or cookie[1] % 2 == 1 or cookie[2] % 2 == 1:
        print(count)
        exit()
    if cookie[0] == cookie[2]:
        print(-1)
        exit()
    count += 1
    a = (cookie[1] + cookie[2]) // 2
    b = (cookie[2] + cookie[0]) // 2
    c = (cookie[0] + cookie[1]) // 2
    cookie[0] = a
    cookie[1] = b
    cookie[2] = c
    cookie.sort()

print(count)

Submission status: Wrong Answer

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

cookie.sort()

l = cookie[0]
r = cookie[2]
if l == r:
    print(-1)

count = 0
while cookie[2] - cookie[0] > 0:
    if cookie[0] % 2 == 1 or cookie[1] % 2 == 1 or cookie[2] % 2 == 1:
        print(count)
        exit()
    if cookie[0] == cookie[2]:
        print(-1)
        exit()
    count += 1
    a = (cookie[1] + cookie[2]) // 2
    b = (cookie[2] + cookie[0]) // 2
    c = (cookie[0] + cookie[1]) // 2
    cookie[0] = a
    cookie[1] = b
    cookie[2] = c
    cookie.sort()

print(count)

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
if a==b==c:
    print(-1)
else:
    cnt=0
    while not (a%2 or b%2 or c%2):
        cnt+=1
        a_,b_,c_=a,b,c
        a=(b_+c_)//2
        b=(c_+a_)//2
        c=(a_+b_)//2
    print(cnt)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if a == b and b == c:
  print(-1)
elif a % 2 == 1 and b % 2 == 1 and c % 2 == 1:
  print(0)
else:
  _a, _b, _c = a, b, c
  ai = 0
  while True:
    if _a % 2 == 0:
      _a //= 2
      ai += 1
    else:
      break
  bi = 0
  while True:
    if _b % 2 == 0:
      _b //= 2
      bi += 1
    else:
      break
  ci = 0
  while True:
    if _c % 2 == 0:
      _c //= 2
      ci += 1
    else:
      break
  min2 = min(ai, bi, ci)
  div2 = pow(2, min2)
  a //= div2
  b //= div2
  c //= div2
  if (a + b) % 2 == 0 and (a + c) % 2 == 0 and (c + b) % 2 == 0:
    min2 += 1
  print(min2)