TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
a,b,c=map(int,input().split())
count=0
h=sorted([a,b,c])
if a==b==c:
    print(-1)
else:      
    while True:
        a1=a//2
        b1=b//2
        c1=c//2
        if (a%2==0 and b%2==0 and c%2==0):
            count+=1
            a=b1+c1
            b=a1+c1
            c=a1+b1
        if sorted([a,b,c])==h:
            print(-1)
        else:
            print(count)
            break

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

if a==b==c and(a%2==0 and b%2==0 and c%2==0):
    print(-1)
else:      
    while True:
        a1=a//2
        b1=b//2
        c1=c//2
        if (a%2==0 and b%2==0 and c%2==0):
            count+=1
            a=b1+c1
            b=a1+c1
            c=a1+b1
        else:
            print(count)
            break

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c = map(int,input().split())

if any((a%2==1,b%2!==1,c%2==1)):
    print(0)
    exit()
    
cnt = 0
while cnt <= 100:
    a,b,c = (b+c)/2, (a+c)/2,(a+b)/2
    cnt += 1
    if any((a%1!=0,b%1!=0,c%1!=0)):
        print(cnt-1)
        exit()
print(-1)

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

if any((a%2==1,b%2==1,c%2==1)):
    print(0)
    exit()
    
cnt = 0
while cnt <= 100:
    a,b,c = (b+c)/2, (a+c)/2,(a+b)/2
    cnt += 1
    if any((a%1!=0,b%1!=0,c%1!=0)):
        print(cnt-1)
        exit()
print(-1)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = map(int,input().split())
ans = 0
if a == b == c:
  print(-1)
  exit()
else:
  while True:
    if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
      ans += 1
      a = a // 2
      b = b // 2
      c = c // 2
    else:
      break

print(ans)

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

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c=list(map(int,input().split()))
ans=0
while 1:
	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)>>1,(a+c)>>1,(a+b)>>2
	ans+=1;

a,b,c=list(map(int,input().split()))
ans=0
while 1:
	if a&1 or b&1 or c&1:
		print(ans)
		break
	if a==b and b==c:
		print('-1')
		break
	ans+=1;
	d=(c+b)>>1
	e=(a+c)>>1
	f=(a+b)>>1
	a,b,c=d,e,f

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c=map(input().split())
if a==b==c:
  print(-1)
elif a%2==1 or b%2==1 or c%2==1:
  print(0)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    ans+=1
    a1=(b+c)//2
    b1=(c+a)//2
    c1=(a+b)//2
    a=a1
    b=b1
    c=c1
  print(ans)

a,b,c=map(input().split())
if a==b==c:
  print(-1)
elif a%2==1 or b%2==1 or c%2==1:
  print(0)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    ans+=1
    a1=(b+c)//2
    b1=(c+a)//2
    c1=(a+b)//2
    a=a1
    b=b1
    c=c1
print(ans)

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)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    ans+=1
    a1=(b+c)//2
    b1=(c+a)//2
    c1=(a+b)//2
    a=a1
    b=b1
    c=c1
  print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c = map(int,input().split())

if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    for i in range(1,10**5):
        a2 = (b+c)//2
        b2 = (a+c)//2
        c2 = (a+b)//2
        a = a2
        b = b2
        c = c2
        if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
            res = 0
        else:
            res = i
            print(res)
            break
    print(-1)
else:
    print(0)

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

if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    for i in range(1,10**5):
        a2 = (b+c)//2
        b2 = (a+c)//2
        c2 = (a+b)//2
        a = a2
        b = b2
        c = c2
        if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
            res = 0
        else:
            res = i
            print(res)
            break
        if i == 10**5-1:
            print(-1)
else:
    print(0)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, C = list(map(int, input().split()))
if A % 2 == 1 and B % 2 == 1 and C % 2 == 1:
    print(0)
    exit()
if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    print(-1)
    exit()

count = 0
old_A, old_B, old_C = None, None, None
while True:
    half_A = A // 2
    half_B = B // 2
    half_C = C // 2
    A = half_B + half_C
    B = half_A + half_C
    C = half_A + half_B
    count += 1
    if old_A == A and old_B == B and old_C == C:
        print(-1)
        exit()

    if A % 2 != 0 or B % 2 != 0 or C % 2 != 0:
        print(count)
        exit()
    old_A = A
    old_B = B
    old_C = C

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys

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


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

cnt = 0
while A % 2 == 0 or B % 2 == 0 or C % 2 == 0:
    a = B // 2 + C // 2
    b = A // 2 + C // 2
    c = A // 2 + B // 2
    A = a
    B = b
    C = c
    cnt += 1
print(cnt)


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


def F(a, b, c):
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        return 0
    if a == b == c:
        return -1
    return F((a + b) // 2, (b + c) // 2, (c + a) // 2) + 1


print(F(A, B, C))



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = map(int, input().split())

ans = 0
flag = False
while True:
    if a == b == c and a % 2 == 0:
        flag = True
        break
    elif a % 2 == b % 2 == c % 2 == 0:
        a = b//2 + c//2
        b = c//2 + a//2
        c = a//2 + b//2
        ans += 1
    else:
        break

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


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

ans = 0
flag = False
while True:
    if a == b == c and a % 2 == 0:
        flag = True
        break
    elif a % 2 == b % 2 == c % 2 == 0:
        a, b, c = b//2 + c//2, c//2 + a//2, a//2 + b//2
        ans += 1
    else:
        break

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, C = map(int, input().split())
if A != B != C:
  D = 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
    D += 1
  print(D)
else:
  print('-1')

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c = map(int,input().split())
i = 0

while a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and i < 10 ** 5:
    x = a // 2
    y = b // 2
    z = c // 2
    a = a // 2
    b = b // 2
    c = c // 2
    a += y // 2 + z // 2
    b += x // 2 + z // 2
    c += x // 2 + y // 2
    i += 1

if i < 10 ** 5:
    print(i)
else:
    print(-1)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

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

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

A, B, C = map(int, input().split())
if A == B == C and A % 2 == 0:
  print(-1)
else:
  count = 0
  while 0 == A % 2 == B % 2 == C % 2:
    _A = (B + C) // 2
    _B = (C + A) // 2
    _C = (A + B) // 2
    A = _A
    B = _B
    C = _C
    count += 1
    # print("A: {}, B: {}, C: {}".format(A, B, C))
  print(count)
    


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
p2 = [ int(i) for i in input().split() ]
ps = sorted(p2)

cnt=0
while True:
    if p2 == ps: break
    cnt += 1
    high = []
    low = []
    for i in range(len(p2)):
        if p2[i] == max(p2[0:i+1]):
            high.append(p2[i])
        else:
            low.append(p2[i])
    p2 = low + high

print(cnt)



a = [ int(i) for i in input().split() ]

cnt=0
if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1:
    pass
elif a[0] == a[1] and a[1] == a[2]:
    cnt=-1
else:
    while True:
        if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1: break
        cnt += 1
        a[0], a[1], a[2] = (a[1]+a[2])/2 , (a[0]+a[2])/2, (a[0]+a[1])/2

print(cnt)



Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def log_2(n):
    t = 0
    while n:
        if n % 2 == 1:
            break
        t += 1
        n //= 2
    return t


def solve(A, B, C)->int:

    s = A+B+C
    odd = log_2(s-C)
    even = log_2(s+A)

    if odd == even:
        return odd
    else:
        return odd+1


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

ans = 0
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    ans = 0
elif A == B == C:
    ans = -1
else:
    ans = solve(A, B, C)
print(ans)


def log_2(n):
    t = 0
    while n:
        if n % 2 == 1:
            break
        t += 1
        n //= 2
    return t


def solve(A, B, C)->int:

    s = A+B+C
    odd = log_2(s-C)
    even = log_2(s+A)

    if odd == even:
        return odd
    else:
        return odd+1


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

ans = 0
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    ans = 0
elif A == B == C:
    ans = -1
else:
    ans = solve(A, B, C)
print(ans)


def log_2(n):
    t = 0
    while n:
        if n % 2 == 1:
            break
        t += 1
        n //= 2
    return t


def solve(A, B, C)->int:

    s = A+B+C
    odd = min(log_2(s-A), log_2(s-B), log_2(s-C))
    even = min(log_2(s+A), log_2(s+B), log_2(s+C))

    if odd == even:
        return odd
    else:
        return odd+1


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

ans = 0
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
    ans = 0
elif A == B == C:
    ans = -1
else:
    ans = solve(A, B, C)
print(ans)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)


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)


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)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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()


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)

while True:
    main()


def main():
    a, b, c = map(int, input().split())
    if a == b == c:
        print(0 if a & 1 else -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()


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)


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:
    a, b, c = (b + c) / 2, (a + c) / 2, (a + b) / 2
    count += 1
    if (a, b, c) in rem:
        print("-1")
        flag = False
        break
    rem.append((a, b, c))


if flag is True:
    print(count)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from sys import stdin
A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
def factorize(n):
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

a = factorize(A)[0][1]
b = factorize(B)[0][1]
c = factorize(C)[0][1]

ans = max(a,b,c)
if ans == 1:
    ans = -1
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A, B, C = map(int, input().strip().split())
def f(a):
  if a % 4 == 0:
    return 2
  elif a % 2 == 0:
    return 1
  else:
    return 0

if f(A) == 0 or f(B) == 0 or f(C) == 0:
  print(0)
elif f(A) == 1 or f(B) == 1 or f(C) == 1:
  print(1)
else:
  print(-1)

A, B, C = map(int, input().strip().split())
ans = 0
while A != B and B != C and (A % 2) + (B % 2) + (C % 2) == 0:
  A, B, C = (B + C) // 2, (A, C) // 2, (A + B) // 2
  ans += 1
print(ans)

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = map(int, input().split())
if (a+b)%4 == (b+c)%4 == (c+a)%4 == 0:
    print(-1)
else:
    counter = 0
    while a%2==b%2==c%2==0:
        a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
        counter += 1
    print(counter)

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from fractions import gcd

if __name__ == "__main__":
    a, b, c = map(int, input().split())

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

    ab = abs(a-b)
    bc = abs(b-c)
    ca = abs(c-a)

    g = gcd(ab, bc)
    g = gcd(g, ca)

    ans = 0
    while g % 2 == 0:
        ans += 1
        g //= 2

    print(ans)


from fractions import gcd

if __name__ == "__main__":
    a, b, c = map(int, input().split())

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

    ab = abs(a-b)
    bc = abs(b-c)

    g = gcd(ab, bc)

    ans = 0
    while g % 2 == 0:
        ans += 1
        g //= 2

    print(ans)


if __name__ == "__main__":
    a, b, c = map(int, input().split())

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

    ans = 0
    while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        a_tmp = (b+c)//2
        b_tmp = (a+c)//2
        c_tmp = (c+a)//2
        a = a_tmp
        b = b_tmp
        c = c_tmp
        ans += 1

    print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

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


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


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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c=map(int,input().split())
if a==b and a==c:
    ans=-1
for i in range(1,100000):
    x=a//2
    y=b//2
    z=c//2
    a=y+z
    b=x+z
    c=x+y
    print("{}-{}-{}".format(a,b,c))
    if a%2==1 or b%2==1 or c%2==1:
        ans=i
        break
print(ans)

a,b,c=map(int,input().split())
ans=-1
for i in range(1,10000):
    x=a//2
    y=b//2
    z=c//2
    a=y+z
    b=x+z
    c=x+y
    print("{}-{}-{}".format(a,b,c))
    if a%2==1 or b%2==1 or c%2==1:
        ans=i
        break
print(ans)

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A,B,C = list(map(int,input().split()))
if A == B == C and A%2 == 0 :
    print(-1)
elif A == B == C and A%2 == 1 :
    print(0)
else :
    cnt=0
    while a%2==b%2==c%2==0:
        total=a+b+c
        a=total//2-a//2
        b=total//2-b//2
        c=total//2-c//2
        cnt+=1
    print(cnt)


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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,C = map(int,input().split())
ans = 0
if A == B == C and A%2 == 0 or B%2 == 0 or C%2 == 0:
  ans = -1
else:
  while A%2 == 0 and B%2 == 0 and C%2 == 0:
    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)

A,B,C = map(int,input().split())
ans = 0
if A == B == C:
  if A%2 != 0 or B%2 != 0 or C%2 != 0:
    pass
  else:
    ans = -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
    ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import numpy as np
import numba
from numba import jit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(p):
  count = 0
  if np.any(p%2==1):
    return 0
  if np.unique(p).size == 1:
    return -1
  while True:
    if np.all(p%2 == 0):
      print('hoge')
      p = p/2
      count += 1
      continue
    break
  return count


p = np.array(readline().split(), np.int64)
print(main(p))


import sys
import numpy as np
import numba
from numba import jit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(p):
  count = 0
  if np.any(p%2==1):
    return 0
  if np.unique(p).size == 1:
    return -1
  while True:
    if np.any(p%2 == 1):
      return count
    p[0] = p[1]/2 + p[2]/2
    p[1] = p[0]/2 + p[2]/2
    p[2] = p[0]/2 + p[1]/2
    count += 1


p = np.array(readline().split(), np.int64)
print(main(p))

import sys
import numpy as np
import numba
from numba import jit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(p):
  count = 0
  if np.any(p%2==1):
    return 0
  if np.unique(p).size == 1:
    return -1
  while True:
    if np.any(p%2 == 1):
      return count
    p[0], p[1], p[2] = p[1]/2 + p[2]/2, p[0]/2 + p[2]/2, p[0]/2 + p[1]/2
    count += 1


p = np.array(readline().split(), np.int64)

print(main(p))

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

Verdicts: Runtime Error

Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
#!/usr/bin/env python3
a, b, c = map(int, input().split())
if (a + b + c) % 2 != 1:
    print(-1)
else:
    cnt = 0

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


#!/usr/bin/env python3
a, b, c = map(int, input().split())
if True:
    cnt = 0
    while True:
        if a % 2 or b % 2 or c % 2:
            break
        if cnt > 10 ** 3:
            break
        cnt += 1
        a, b, c = (b + c) // 2, (a + c) // 2, (a + b) // 2
    if cnt < 10 ** 3:
        print(cnt)
    else:
        print(-1)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, C = map(int, input().split())

if any([A % 2, B % 2, C % 2]):
	print(0)
	exit()

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

count = 0
    while all([A % 2 == 0, B % 2 == 0, C % 2 == 0]):
        A, B, C = ((B+C)//2, (A+C)//2, (A+B)//2)
	count += 1
print(count)


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)


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


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c = map(int,input().split())
for i in range(600):
  if a == b and b == c:
    break
  a,b,c = a//2, b//2, c//2
  a, b, c = b + c, a + c, a + b
ans = i if i < 600 else -1
print(ans)
    

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


for i in range(600):
  if a == b and b == c:
    break
  a,b,c = a//2, b//2, c//2
  a, b, c = b + c, a + c, a + b
ans = i if i < 600 else -1
print(-1

a,b,c = map(int,input().split())
for i in range(600):
  if a&1 or b&1 or c&1:
    break
  a,b,c = a//2, b//2, c//2
  a, b, c = b + c, a + c, a + b
ans = i if i < 500 else -1
print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)
        

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-


def main(a, b, c):
    if a == b == c:
        return -1

    count = 0
    while a % 2 != 1 or b % 2 != 1 or c % 2 != 1:
        aa, bb, cc = a, b, c
        a = bb // 2 + cc // 2
        b = aa // 2 + cc // 2
        c = aa // 2 + bb // 2
        count += 1
    return count


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


 # -*- coding: utf-8 -*-

 
a, b, c = [int(e) for e in input().split()]
# a, b, c = [4, 2, 1]
# a, b, c = [4, 12, 20]
# a, b, c = [454, 414, 444]

# a, b, c = [1, 1, 1]

if a == b == c == 1:
    print(0)
elif a == b == c: 
    print(-1)
else:
    count = 0
    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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

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

cnt = 0

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

import math

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

cnt = 0

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import time
N = list(map(int, input().split()))
N2 = [0,0,0]
ans = 0
while True:
    time.sleep(1)
    for i in range(3):
        if  not N[i] %2 == 0:
            print(ans)
            exit()
    N2[0] = (N[1] + N[2]) /2
    N2[1] = (N[0] + N[2]) /2
    N2[2] = (N[0] + N[1]) /2
    #print(N2)
    if N == N2:
        print('-1')
        exit()
    N = N2.copy()
    ans += 1


N = list(map(int, input().split()))
N2 = [0,0,0]
ans = 0
while True:
    for i in range(3):
        if  not N[i] %2 == 0:
            print(ans)
            exit()
    N2[0] = (N[1] + N[2]) /2
    N2[1] = (N[0] + N[2]) /2
    N2[2] = (N[0] + N[1]) /2
    #print(N2)
    if N == N2:
        print('-1')
        exit()
    N = N2.copy()
    ans += 1


Verdicts: Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
X=[int(x) for x in input().split()]
count=0
if ((X[0]%2-1)*(X[1]%2-1)*(X[2]%2-1)!=0 and X[0]==X[1] and X[1]==X[2]):
  count=-1
else:
  while((X[0]%2-1)*(X[1]%2-1)*(X[2]%2-1)!=0):
    X[0]=(X[1]+X[2])/2
    X[1]=(X[0]+X[2])/2
    X[2]=(X[1]+X[0])/2
    count =count+1
print(count) 

X=[int(x) for x in input().split()]
count=0
if ((X[0]%2-1)*(X[1]%2-1)*(X[2]%2-1)!=0 and X[0]==X[1] and X[1]==X[2]):
  count=-1
else:
  while((X[0]%2-1)*(X[1]%2-1)*(X[2]%2-1)!=0):
    Y=[0,0,0]
    Y[0]=(X[1]+X[2])/2
    Y[1]=(X[0]+X[2])/2
    Y[2]=(X[1]+X[0])/2
    X=Y
    count =count+1
print(count) 

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def check(A,B,C):
  if A==0 or B==0 or C==0:
    return False
  if A%2!=0 or B%2!=0 or C%2!=0:
    return False
  return True

A,B,C=map(int,input().split())
ans=0
if A==B==C:
  print(-1)
  exit()
while check(A,B,C)==True:
  a=B//2+C//2
  b=A//2+C//2
  c=A//2+B//2
  A,B,C=a,b,c
  print(A,B,C)
  ans+=1
  if 10**9<ans:
    ans=-1
    break
print(ans)


def check(A,B,C):
  if A==0 or B==0 or C==0:
    return False
  if A%2!=0 or B%2!=0 or C%2!=0:
    return False
  return True

A,B,C=map(int,input().split())
ans=0
if A%2==B%2==C%2==0 and A==B==C:
  print(-1)
  exit()
while check(A,B,C)==True:
  a=B//2+C//2
  b=A//2+C//2
  c=A//2+B//2
  A,B,C=a,b,c
  ans+=1
  if 10**9<ans:
    ans=-1
    break
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = map(int, input().split())
cnt = 0
while True:
    if a == b == c and a%2 == 0:
        cnt = -1
    elif a%2 == 0 and b%2 == 0 and c%2 == 0:
        a, b, c, = (b+c)//2, (a+c)//2, (a+b)//2
        cnt += 1
print(cnt)

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

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

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = [int(i) for i in input().split()]
if x%2 == 1 or y%2 == 1 or z%2 == 1:
    print(0)
elif 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)

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


if a%2 == 1 or b%2 == 1 or c%2 == 1:
    print(0)
elif a == b and b == c:
    print(-1)
else:
    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)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

a,b,c=map(int,input().split())
n=a+b+c
if a%2==0 and a==b==c:
    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)

Verdicts: Wrong Answer

Accepted