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:

def dot_v(a,b):
    sum=0
    for i in range(len(a)):
        sum+=a[i]*b[i]
    return sum

def dot(A,x):
    xx=[0]*len(x)
    for i in range(len(A)):
        xx[i]=dot_v(A[i],x)

    return xx


x=list(map(int,input().split(" ")))
A=[[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]
count=0
flg=False
equal=False
for i in range(10**6):
    #print(x)
    if x[0]==x[1] and x[1]==x[2]:
        equal=True
        break
    for sx in x:
        if (sx%2)!=0:
            flg=True
            break
    if flg:
        break
    count+=1
    x=dot(A,x)
    #print(x)
    if i==10**6-1:
        equal=True
        

if equal:
    print(-1)
else:
    print(count)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


a, b, c = [int(e) for e in input().split()]
count = 0


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

Submission status: Wrong Answer

Solution code:
a, b, c = input().split()
a = float(a)
b = float(b)
c = float(c)
cnt = 0
while a != b and b != c:
    ta = b / 2 + c / 2
    tb = a / 2 + c / 2
    tc = a / 2 + b / 2
    a = ta
    b = tb
    c = tc
    cnt += 1
    # print (str(a) + ' ' + str(b) + ' ' + str(c))
    if int(a) % 2 or int(b) % 2 or int(c) % 2:
        break
if cnt == 0:
    cnt = -1
print (cnt)

Submission status: Wrong Answer

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

C = [int(i) for i in input().split()]
m = min(C)
for i in range(3):
	C[i] -= m

C.sort()
if C[2] == 0:
	print(-1)
	exit()
t = C[2]
for c in C:
	t = gcd(t, c)
ans = 0
while not t%2:
	ans += 1
	t //= 2
print(ans)

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, input().split())
a = [0]
b = [0]
c = [0]
i = 0
flag = 0

a[0] = A
b[0] = B
c[0] = C

if A == B and B == C:
	print(-1)
else:
	while flag == 0:
		if a[i] % 2 == 0 and b[i] % 2 == 0 and c[i] % 2 == 0:
			x = (b[i] + c[i]) / 2
			y = (a[i] + c[i]) / 2
			z = (b[i] + a[i]) / 2
			a.append(x)
			b.append(y)
			c.append(z)
			i += 1
		else:
			flag = 1
	print(i)

Submission status: Wrong Answer

Solution code:

def dot_v(a,b):
    sum=0
    for i in range(len(a)):
        sum+=a[i]*b[i]
    return sum

def dot(A,x):
    xx=[0]*len(x)
    for i in range(len(A)):
        xx[i]=dot_v(A[i],x)

    return xx


x=list(map(int,input().split(" ")))
A=[[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]
count=0
flg=False
equal=False
for i in range(10**6):
    #print(x)
    if x[0]==x[1] and x[1]==x[2]:
        equal=True
        break
    for sx in x:
        if (sx%2)!=0:
            flg=True
            break
    if flg:
        break
    count+=1
    x=dot(A,x)
    #print(x)

if equal:
    print(-1)
else:
    print(count)

Submission status: Wrong Answer

Solution code:
n = map(int, raw_input().split())
m = [0, 0, 0]

count = 0
if n[0] == n[1] and n[1] == n[2]:
    print -1
    exit()
while True:
    for i in range(3):
        if n[i]%2 == 1:
            print count
            exit()
    for j in range(3):
        m[j]=(n[(j+1)%3]/2)+(n[(j+2)%3]/2)
    for j in range(3):
        n[j] = m[j]
    count += 1

Submission status: Wrong Answer

Solution code:
n = map(int, raw_input().split())
m = [0, 0, 0]

count = 0
if n[0] == n[1] and n[1] == n[2]:
    print -1
    exit()
while True:
    for i in range(3):
        if n[i]%2 == 1:
            print count
            exit()
        else :
            for j in range(3):
                m[i]=(n[(i+1)%3]/2)+(n[(i+2)%3]/2)
            for j in range(3):
                n[i] = m[i]
    count += 1

Submission status: Wrong Answer

Solution code:

def dot_v(a,b):
    sum=0
    for i in range(len(a)):
        sum+=a[i]*b[i]
    return sum

def dot(A,x):
    xx=[0]*len(x)
    for i in range(len(A)):
        xx[i]=dot_v(A[i],x)

    return xx


x=list(map(int,input().split(" ")))
A=[[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]
count=0
flg=False
for i in range(10**8):
    #print(x)
    if x[0]==x[1] and x[1]==x[2]:
        break
    for sx in x:
        if sx%2!=0:
            flg=True
            break
    if flg:
        break
    count+=1
    x=dot(A,x)
    #print(x)

if count==0:
    print(-1)
else:
    print(count)

Submission status: Wrong Answer

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

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

main()

Submission status: Wrong Answer

Solution code:
n = map(int, raw_input().split())
m = [0, 0, 0]

count = 0
if n[0] == n[1] and n[1] == n[2]:
    print -1
    exit()
while True:
    for i in range(3):
        if n[i]%2 == 1:
            print count
            exit()
        else :
            count+=1
            for i in range(3):
                m[i]=(n[(i+1)%3]/2)+(n[(i+2)%3]/2)
            for i in range(3):
                n[i] = m[i]

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,raw_input().split())
z=0
while a!=b or b!=c or a!=c:
    l=[a,b,c]
    l.sort()
    if a%2==1 or b%2==1 or c%2==1:
        break
    elif a==b and b==c:
        z-=1
        break
    else:
        an=b/2+c/2
        bn=a/2+c/2
        cn=a/2+b/2
        ln=[an,bn,cn]
        ln.sort()
        if ln==l:
            z=-1
            break
        else:
            a,b,c=ln
            z+=1
if a==b and a==c:
    z=-1
print z

Submission status: Wrong Answer

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

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

        print(i)

main()

Submission status: Wrong Answer

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

initA = [A, B, C]
initB = [A, C, B]
initC = [B, A, C]
initD = [B, C, A]
initE = [C, A, B]
initF = [C, B, A]
current = [A, B, C]

answer = 0
while True:
    answer += 1
    a = current[0]/2
    b = current[1]/2
    c = current[2]/2
    current = [b + c, a + c, b + c]
    if current[0]&1 or current[1]&1 or current[2]&1:
        break
    elif current in [initA, initB, initC, initD, initE, initF]:
        answer = -1
        break

print(answer)

Submission status: Wrong Answer

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

if A == B and B == C:
    print '-1'
elif A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    print '0'
else:
    i = 0
    while True:
        _A = (B + C)/2
        _B = (C + A)/2
        _C = (A + B)/2

        A = _A
        B = _B
        C = _C

        i += 1
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            print '%d' % i
            break

Submission status: Wrong Answer

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


def check(n):
    x = 2 ** n
    y = x // 3
    if y % 3 == 1:
        for i in range(3):
            adds = [y] * 3
            adds[i] += 1
            tmp = (A * adds[0] + B * adds[1] + C * adds[2]) / x
            if int(tmp) != tmp:
                return False
    else:
        for i in range(3):
            adds = [y] * 3
            adds[i] += 1
            adds[(i + 1) % 3] += 1
            tmp = (A * adds[0] + B * adds[1] + C * adds[2]) / x
            if int(tmp) != tmp:
                return False
    return True


for i in range(1, 1000):
    if not check(i):
        print(i - 1)
        exit()
print(-1)

Submission status: Wrong Answer

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

cnt = 0
while cnt < 28:
    tmpA = int(B / 2) + int(C / 2)
    tmpB = int(A / 2) + int(C / 2)
    tmpC = int(A / 2) + int(B / 2)

    cnt += 1
    if tmpA % 2 == 1 or tmpB % 2 == 1 or tmpC % 2 == 1:
        break
    if tmpA == A and tmpB == B and tmpC == C:
        print("-1")
        quit()
    A = tmpA
    B = tmpB
    C = tmpC

if cnt == 28:
    print("-1")
else:
    print(str(cnt))

Submission status: Wrong Answer

Solution code:

def dot_v(a,b):
    sum=0
    for i in range(len(a)):
        sum+=a[i]*b[i]
    return sum

def dot(A,x):
    xx=[0]*len(x)
    for i in range(len(A)):
        xx[i]=dot_v(A[i],x)

    return xx

x=list(map(int,input().split(" ")))
A=[[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]
count=0
flg=False
for i in range(10**8):
    if x[0]==x[1] and x[1]==x[2]:
        break
    count+=1
    x=dot(A,x)
    #print(x)
    for sx in x:
        if (sx%1.0)!=0:
            flg=True
            break
    if flg:
        break
        
if count==0:
    print(-1)
else:
    print(count-1)

Submission status: Wrong Answer

Solution code:
n = map(int, raw_input().split())
m = [0, 0, 0]

count = 0
if n[0] == n[1] and n[1] == n[2]:
    print -1
    exit()
while True:
    for i in n:
        if i%2 == 1:
            print count
            exit()
        else :
            count+=1
            for i in range(3):
                m[i]=(n[(i+1)%3]/2)+(n[(i+2)%3]/2)
            for i in range(3):
                n[i] = m[i]

Submission status: Wrong Answer

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

cnt = 0
while cnt < 27:
    tmpA = int(B / 2) + int(C / 2)
    tmpB = int(A / 2) + int(C / 2)
    tmpC = int(A / 2) + int(B / 2)

    cnt += 1
    if tmpA % 2 == 1 or tmpB % 2 == 1 or tmpC % 2 == 1:
        break
    if tmpA == A and tmpB == B and tmpC == C:
        print("-1")
        quit()
    A = tmpA
    B = tmpB
    C = tmpC

if cnt == 27:
    print("-1")
else:
    print(str(cnt))

Submission status: Wrong Answer

Solution code:
def dot_v(a,b):
    sum=0
    for i in range(len(a)):
        sum+=a[i]*b[i]
    return sum

def dot(A,x):
    xx=[0]*len(x)
    for i in range(len(A)):
        xx[i]=dot_v(A[i],x)

    return xx

x=list(map(int,input().split(" ")))
A=[[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]
count=0
flg=False
for i in range(10**6):
    if x[0]==x[1] and x[1 ]==x[2]:
        break
    count+=1
    x=dot(A,x)
    #print(x)
    for sx in x:        
        if (sx%1.0)!=0:
            flg=True
            break

    if flg:
        break
if count==0:
    print(-1)
else:
    print(count-1)

Submission status: Wrong Answer

Solution code:
C = [int(i) for i in input().split()]
m = min(C)
for i in range(3):
	C[i] -= m
ans = 10**9
C.sort()
if C[2] == 0:
	print(-1)
	exit()
s = sum(C)
t = 0
while not s%2:
	t += 1
	s //= 2
print(t)

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, input().split())
def cookies(a, b, c):
    return [(b+c)/2, (c+a)/2, (a+b)/2]

if A == B and B == C:
    print('-1')
else:
    count = 0
    while True:
        if (A%2) or (B%2) or (C%2):
            break
        A, B, C = cookies(A, B, C)
        count += 1
    print(count)

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, raw_input().split())
# print(A, B, C)

if A == B and B == C:
    print '-1'
elif A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    print '0'
else:
    i = 0
    while True:
        _A = (B + C)/2
        _B = (C + A)/2
        _C = (A + B)/2

        A = _A
        B = _B
        C = _C
        # print(A, B, C)

        i += 1
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            print i
            break

Submission status: Wrong Answer

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

initA = [A, B, C]
initB = [A, B, C]
initC = [A, B, C]
current = [A, B, C]

answer = 0
while True:
    answer += 1
    a = current[0]/2
    b = current[1]/2
    c = current[2]/2
    current = [b + c, a + c, b + c]
    if current[0]&1 or current[1]&1 or current[2]&1:
        break
    elif initA == current or initB == current or initC == current:
        answer = -1
        break

print(answer)

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c = [int(_) for _ in raw_input().split()]
    if a == b == c:
        return -1

    ans = 0
    while True:
        if a & 1 or b & 1 or c & 1:
            return ans
        a, b, c = (b + c) / 2, (c + a) / 2, (a + b) / 2
        ans += 1

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

Submission status: Wrong Answer

Solution code:
C = [int(i) for i in input().split()]
m = min(C)
for i in range(3):
	C[i] -= m
ans = 10**9
C.sort()

if C[2] == 0:
	print(-1)
	exit()
for c in C:
	t = 0
	if not c:
		continue
	else:
		while not c%2:
			c //=2
			t += 1
		ans = min(ans, t)
print(ans)

Submission status: Wrong Answer

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

if A==B and B==C:
    if A%2==0 and B%2==0 and C%2==1:
        print -1
    else:
        print 0 
else:
    for i in range(1000):
        if A%2==1 or B%2==1 or C%2==1:
            print i
            break
        newA = B/2 + C/2
        newB = C/2 + A/2
        newC = A/2 + B/2
        A = newA
        B = newB
        C = newC

Submission status: Wrong Answer

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

count=0
while True:
    if a==b==c: count=-1; break
    if a%2==0 and b%2==0 and c%2==0: pass
    else: break
    a,b,c=b//2+c//2,c//2+a//2,a//2+b//2
    count+=1

print(count)

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,raw_input().split())
z=0
while a!=b or b!=c or a!=c:
    if a%2==1 or b%2==1 or c%2==1:
        break
    elif a==b and b==c:
        z-=1
        break
    else:
        an=b/2+c/2
        bn=a/2+c/2
        cn=a/2+b/2
        a=an
        b=bn
        c=cn
        z+=1
if a==b and a==c:
    z=-1
print z

Submission status: Wrong Answer

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

if A==B and B==C:
    print -1
else:
    for i in range(1000):
        if A%2==1 or B%2==1 or C%2==1:
            print i
            break
        newA = B/2 + C/2
        newB = C/2 + A/2
        newC = A/2 + B/2
        A = newA
        B = newB
        C = newC

Submission status: Wrong Answer

Solution code:
# encoding: utf-8

a, b, c = map(int, raw_input().split())
cnt = 0

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

while True:
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        cnt += 1
        a_t = a / 2
        b_t = b / 2
        c_t = c / 2
        a = b_t + c_t
        b = a_t + c_t
        c = a_t + b_t
    else:
        break

print cnt

Submission status: Wrong Answer

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

pattern = list()
i = 0
while True:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        print(i)
        break
    if (A, B, C) in pattern:
        print(-1)
        break
    tmp_A = A
    tmp_B = B
    A = (B + C) / 2
    B = (C + tmp_A) / 2
    C = (tmp_B + tmp_A) / 2

    i += 1

    pattern.append((A, B, C))

Submission status: Wrong Answer

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

if A==B and B==C:
    print -1
else:
    for i in range(50):
        if A%2==1 or B%2==1 or C%2==1:
            print i
            break
        newA = B/2 + C/2
        newB = C/2 + A/2
        newC = A/2 + B/2
        A = newA
        B = newB
        C = newC

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, raw_input().split())
# print(A, B, C)

if A == B and B == C:
    print '-1'
else:
    i = 0
    while True:
        _A = (B + C)/2
        _B = (C + A)/2
        _C = (A + B)/2

        A = _A
        B = _B
        C = _C
        # print(A, B, C)

        i += 1
        if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
            print i
            break

Submission status: Wrong Answer

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

pattern = list()
i = 0
while True:
    tmp_A = A
    tmp_B = B
    A = (B + C) / 2
    B = (C + tmp_A) / 2
    C = (tmp_B + tmp_A) / 2

    i += 1

    
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        print(i)
        break

    pattern.append((A, B, C))

Submission status: Wrong Answer

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

pattern = list()
i = 0
while True:
    tmp_A = A
    tmp_B = B
    A = (B + C) / 2
    B = (C + tmp_A) / 2
    C = (tmp_B + tmp_A) / 2

    i += 1

    if (A, B, C) in pattern:
        print(-1)
        break
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        print(i)
        break

    pattern.append((A, B, C))

Submission status: Wrong Answer

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

init = [A, B, C]
current = [A, B, C]

answer = 0
while True:
    answer += 1
    current = [current[1]/2+current[2]/2,
               current[0]/2+current[2]/2,
               current[0]/2+current[1]/2]
    if current[0]%2 == 1 or current[1]%2 == 1 or current[2]%2 == 1:
        break
    elif init == current:
        answer = -1
        break

print(answer)

Submission status: Wrong Answer

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

count=0
while True:
    if a==b==c: count=-1; break
    if a%2==0 and b%2==0 and c%2==0: pass
    else: break
    a,b,c=b/2+c/2,c/2+a/2,a/2+b/2
    count+=1

print(count)

Submission status: Wrong Answer

Solution code:
import copy
temp=input().split()
A=int(temp[0])
B=int(temp[1])
C=int(temp[2])

setT=[A,B,C]
setT.sort()
allSet=[]
allSet.append(setT)
ans=0
def distribute(x,y,z):
	temp=[y+z,z+x,x+y]
	for i in range(len(temp)):
		if temp[i]%2==0:
			temp[i]/=2
		else:
			return [0]
	return temp

setNext=distribute(A,B,C)
while len(setNext)==3:
	print(setNext)
	ans+=1
	setT=copy.deepcopy(setNext)
	setNext=distribute(setT[0],setT[1],setT[2])
	setNext.sort()
	if setNext in allSet:
		ans=-1
		break
	else:
		allSet.append(setNext)
print(ans)

Submission status: Wrong Answer

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

if A%2!=0 or B%2!=0 or C%2!=0:
        print(counter)
for i in range(1000000000):
    if A==B and B==C:
        print('-1')
        break
    
    AA=B/2+C/2
    BB=A/2+C/2
    CC=A/2+B/2
    counter=counter+1
    if AA%2!=0 or BB%2!=0 or CC%2!=0:
        print(counter)
        break
    A=AA
    B=BB
    C=CC

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c = map(int, input().split())
    count = 0
    while (a | b | c) & 1 == 0:
        if a==b==c:
            print(-1)
            return
        a, b, c = (b + c) >> 1, (c + a) >> 1, (a + b) >> 1
        count += 1
        print(a,b,c)
    
    print(count)

main()

Submission status: Wrong Answer

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


def is_even(a, b, c):
    if a % 2 != 0:
        return False
    if b % 2 != 0:
        return False
    if c % 2 != 0:
        return False
    return True

count = 0
rem = []

flag = True

while is_even(a, b, c) and flag:
    if (a, b, c) in rem:
        print("-1")
        flag = False
        break
    a, b, c = (b + c) / 2, (a + c) / 2, (a + b) / 2
    count += 1
    rem.append((a, b, c))

if flag is True:
    print(count)

Submission status: Wrong Answer

Solution code:
#! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())

count = 0
flag = 0
while True:
    at = (b+c)/2
    bt = (a+c)/2
    ct = (b+a)/2

    if flag == 1 and at == a and bt == b and ct == c:
        flag = 0
        break
    
    a = at
    b = bt
    c = ct
    #print(a,b,c)
    count += 1
    flag = 1
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        break

if flag == 0:
    print(-1)
else:
    print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if A%2!=0 or B%2!=0 or C%2!=0:
        print(counter)
for i in range(100000000):
    if A==B and B==C:
        print('-1')
        break
    
    AA=B/2+C/2
    BB=A/2+C/2
    CC=A/2+B/2
    counter=counter+1
    if AA%2!=0 or BB%2!=0 or CC%2!=0:
        print(counter)
        break
    A=AA
    B=BB
    C=CC

Submission status: Wrong Answer

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

pattern = list()
i = 0
while True:
    tmp_A = A
    tmp_B = B
    A = (B + C) / 2
    B = (C + tmp_A) / 2
    C = (tmp_B + tmp_A) / 2

    i += 1

    if (A, B, C) in pattern:
        print(0)
        break
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        print(i)
        break

    pattern.append((A, B, C))

Submission status: Wrong Answer

Solution code:
A, B, C = map(int, input().split())
dict = {}
ans = 0
while ans < 1000000:
    tpl = tuple(sorted([A, B, C]))
    print(tpl)
    if tpl in dict:
        ans = -1
        break
    elif A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break
    dict[tpl] = True
    A, B, C = (B + C) // 2, (C + A) // 2, (A + B) // 2
    ans += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def cookies_exchanges(a, b, c):
    counter = 0
    if a is b is c:
        return -1
    while int(a%2) is 0 and int(b%2) is 0 and int(c%2) is 0:
        o_a, o_b, o_c = a ,b ,c
        a = o_b/2 + o_c/2
        b = o_a/2 + o_c/2
        c = o_a/2 + o_b/2
        counter += 1

    return counter

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

Submission status: Wrong Answer

Solution code:
#! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())

count = 0
flag = 0
while True:
    at = (b+c)/2
    bt = (a+c)/2
    ct = (b+c)/2

    if flag == 1 and at == a and bt == b and ct == c:
        flag = 0
        break
    
    a = at
    b = bt
    c = ct
    
    count += 1
    flag = 1
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        break

if flag == 0:
    print(-1)
else:
    print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())
print(a,b,c)

count = 0
flag = 0
while True:
    at = (b+c)/2
    bt = (a+c)/2
    ct = (b+c)/2

    if flag == 1 and at == a and bt == b and ct == c:
        flag = 0
        break
    
    a = at
    b = bt
    c = ct
    
    count += 1
    flag = 1
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        break

if flag == 0:
    print(-1)
else:
    print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def cookies_exchanges(a, b, c):
    counter = 0
    if a is b is c:
        return -1
    while int(a%2) is 0 and int(b%2) is 0 and int(c%2) is 0:
        o_a, o_b, o_c = a ,b ,c
        a = o_b/2 + o_c/2
        b = o_a/2 + o_c/2
        c = o_a/2 + o_b/2
        counter += 1

    return counter

a, b, c = map(int, input().split())
# print(cookies_exchanges(454, 414, 444))

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c = map(int, input().split())
    if a==b==c:
        print(-1)
        return
    count = 0
    while (a | b | c) & 1 == 0:
        a, b, c = (b + c) >> 1, (c + a) >> 1, (a + b) >> 1
        count += 1
    
    print(count)

main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

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

Submission status: Wrong Answer

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

import itertools


def solve(a, b, c):
    if a == b == c:
        return -1
    for i in itertools.count():
        da, ma = divmod(a, 2)
        db, mb = divmod(b, 2)
        dc, mc = divmod(c, 2)
        if ma == 1 or mb == 1 or mc == 1:
            return i
        a = db + dc
        b = dc + da
        c = da + db


def main():
    a, b, c = (int(x) for x in input().split())
    print(solve(a, b, c))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,raw_input().split())
if a==b==c:
    print -1
    exit()
if a%2==1 or b%2==1 or c%2==1:
    print 0
    exit()
tmpa=0;tmpb=0;tmpc=0;
ans=0
while 1:
    tmpa=b/2+c/2
    tmpb=a/2+c/2
    tmpc=a/2+b/2
    ans+=1
    if tmpa%2==1 or tmpb%2==1 or tmpc%2==1:
        break
    if tmpa==tmpb==tmpc:
        break
    a=tmpa;b=tmpb;c=tmpc;
print ans

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from random import *
from functools import reduce,partial
from time import time
from pprint import pprint

def readln():
    return list(map(int,input().split(' ')))

def identity(x):
    """Return the input itself."""
    return x

def constant(c):
    """Return an function which always
    returns the input constant c."""
    def const_function(const,*args):
        return const
    return partial(const_function,c)

def inc(c = 1):
    """Return a function which reads an input x and returns x + c as output.
    By default, c equals 1."""
    return lambda x: x + c

def add(*args):
    """Return the sum of the input."""
    def add2(x,y): return x + y
    return reduce(add2,args)

def mapv(f,*lst):
    """Return a vector of the result of map."""
    return list(map(f,*lst))

def vector(*args):
    """Return a vector of input parameters."""
    return args

def sequence(n,f = constant(0)):
    """Return a vector of length n, and initialize the i'th
    item with f(i).By default the vector will initialized with 0."""
    return [f(i) for i in range(0,n)]

def matrix(n,m,f = constant(0)):
    """Return a 2-dim vector which contains n vectors with length m.
    The j's item of vector i will be initialized by f(i,j).By default,
    the vector will be initialized with 0."""
    return [[f(i,j) for j in range(0,m)] for i in range(0,n)]

def flat(v):
    """Return a flat vector which contains the elements of v in their
    origin order.If the input is not a vector, return a vector which
    only contains the input."""
    if not isinstance(v,list): return [v]
    if not v: return []
    return reduce(add,mapv(flat,v))

def partition(v,f = identity):
    """Partition vector v by f(v[i]).
    e.g. partition([1,2,3,1,2,3],identity()) == {1:[1,1,1], 2:[2,2], 3:[3]}
    By default, the vector will be partitioned by identity function."""
    result = {}
    for item in v:
        key = f(item)
        s = result.get(key)
        if s:
            s.append(item)
        else:
            result.update({key:[item]})
    return result

def getValue(key):
    """Return a function which returns the value of key in a hash-map.
    If the key do not exist, it will throw an error."""
    return lambda x: x[key]

def mapValue(f,m):
    """Replace each value in hash-map m with f(value).
    Return the new hash-map."""
    res = {}
    for key in m:
        res.update({key: f(m[key])})
    return res

p = 1000000000 + 7

def calc(a):
    ans = 0
    if a[0] == a[1] and a[1] == a[2]:
        return -1
    while True:
        s = sum(a) >> 1
        b = [s - (item >> 1) for item in a]
        ans = ans + 1
        existOdd = False
        for item in b:
            if item % 2 == 1:
                existOdd = True
        if existOdd:
            break
        else:
            a = b[:]
    return ans

a = readln()
print(calc(a))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0

def odd_even(num_list):
    num = 'even'
    for n in num_list:
        if n % 2 == 1:
            num = 'odd'
            break
    return num

def change_cookie(cookie_list):
    cookie_list_after = []
    for c in cookie_list:
        cookie_list_after.append(int(sum(cookie_list) - c) / 2)
    return cookie_list_after

while True:
    if odd_even(cookies) == 'even':
        cookies = change_cookie(cookies)
        ans += 1
    else:
        break
print(ans)