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: Runtime Error

Solution code:
A,B,C =map(int,input().split())
con = 0
if A % 2 == 1 or B % 2 == 1 or C % 1 == 1:
  print(0)
  exit()
if A == B and B == C:
  print(-1)
  exit()
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  con += 1
  D = A / 2
  E = B / 2
  F = C / 2
  A = E + F
  B = D + F
  C = D + E
  
print(con)
A,B,C =map(int,input().split())
con = 0
if A % 2 == 1 or B % 2 == 1 or C % 1 == 0:
  print(0)
  exit()
if A == B and B == C:
  print(-1)
  exit()
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  con += 1
  D = A / 2
  E = B / 2
  F = C / 2
  A = E + F
  B = D + F
  C = D + E
  
print(con)
提出情報

Submission status: Runtime Error

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

if A == B and B == C:
  print(-1)
  exit()
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    break
  con += 1
  D = A / 2
  E = B / 2
  F = C / 2
  A = E + F
  B = D + F
  C = D + E
  
print(con)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

Solution code:
def(a,b,c):
  if a%2+b%2+c%2>0:
    return 0
  if a==b==c:
    return -1
  return f((b+c)//2,(c+a)//2,(a+b)//2)+1

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

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

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

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

while acnt%2 == 0 and bcnt%2 == 0 and ccnt%2 == 0:
    cnt+=1
    i=a
    j=b
    a=(b+c)//2
    b=(i+c)//2
    c=(i+j)//2

print(cnt)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,open(0).read().split())

if a==b==c and a%2==0:
    print(-1)
else:
    num=0
    while true:
        if a%2==1 or b%2==1 or c%2==1:
            break
        else:
            l=[(b+c)/2,(c+a)/2,(a+b)/2]
            num+=1
            l=[(l[1]+l[2])/2, (l[2]+l[0])/2, (l[0]+l[2])/2]
            a=l[0]
            b=l[1]
            c=l[2]
    else:
        print(num)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,open(0).read().split())

if a==b==c and a%2==0:
    print(-1)
else:
    num=0
    while true:
        if a%2==1 or b%2==1 or c%2==1:
            break
        else:
            l=[(b+c)/2,(c+a)/2,(a+b)/2]
            num+=1
            l=[(l[1]+l[2])/2, (l[2]+l[0])/2, (l[0]+l[2])/2]
            a,b,c=l[0],l[1],l[2]
    else:
        print(num)

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
a

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

if a%2!=0 or b%2!=0 or c%2!=0:
  	print(0)
    exit()

N = (a+b+c)//3
cnt = 1
while N:
    if N%2 != 0: break
    N //= 2
    cnt += 1
    
print(cnt)

Submission status: Runtime Error

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

cnt = 0
a_list = [0]*(1001001)
b_list = [0]*(1001001)
c_list = [0]*(1001001)
a_list[0] = a
b_list[0] = b
c_list[0] = c

for i in range(1, 10**9):
    a_list[i] = (b_list[i-1] + c_list[i-1]) // 2
    b_list[i] = (c_list[i-1] + a_list[i-1]) // 2
    c_list[i] = (a_list[i-1] + b_list[i-1]) // 2
    cnt += 1
    if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:
        break
    if time.time() - start >= 1.5:
        cnt = -1
        break

print(cnt)

Submission status: Runtime Error

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

cnt = 0
a_list = [0]*(1001001)
b_list = [0]*(1001001)
c_list = [0]*(1001001)
a_list[0] = a
b_list[0] = b
c_list[0] = c

for i in range(1, 10**9):
    a_list[i] = (b_list[i-1] + c_list[i-1]) // 2
    b_list[i] = (c_list[i-1] + a_list[i-1]) // 2
    c_list[i] = (a_list[i-1] + b_list[i-1]) // 2
    cnt += 1
    if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:
        break
    if time.time() - start >= 1:
        cnt = -1
        break

print(cnt)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
//It will be infinite if all of them have a power of 2
//otherwise someone has to give out and odd number
//If all of them are equal then -1
from math import log
a,b,c=list(map(int,input().split()))
if a==b and b==c and c==a:
  print('-1')
n=0
while a%2==0 and b%2==0 and c%2==0:
  temp_a = c/2+b/2
  temp_b = a/2+c/2
  temp_c = a/2+b/2
  a = temp_a
  b = temp_b
  c = temp_c
  n+=1
print(n)

Submission status: Runtime Error

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

A, B, C = MAP()

if any(x%2 for x in [A, B, C]):
	print(0)
	exit()
elif A == B == C:
	print(-1)
	exit()

cnt = 0
while all(x%2 == 0 for x in [A, B, C]):
	A, B, C = (B+C)//2, (A+C)//2, (A+B)//2
	ans += 1

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
n=int(input())
if n==1:
    print(1)
    sys.exit()
k=2
ans=0
while k*2<=n:
    k*=2
    ans+=1
print(k)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

while x%2 == 0 and y%2 == 0 and z%2 == 0:
    ans += 1

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

print(ans)

Submission status: Runtime Error

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

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

while x%2 == 0 and y%2 == 0 and z%2 == 1:
    ans += 1
    
    x = b//2 + c//2
    y = a//2 + c//2
    z = a//2 + b//2
    
    a = x
    b = y
    c = z

print(ans)

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
*a, = map(int, input().split())
a = [bin(abs(a[i+1]-a[i]))[::-1].find('1') for i in range(2)].sort()
print(a[1] if a[0]*a[1]<0 else a[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def resolve():
    A,B,C = map(int,input().split())
    count = 0
    if A == C and A == B:
        if A % 2 == 1:
            print(0)
        else:
            print(-1)
    else:
        while (A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
            tmpA = (B + C) / 2 
            tmpB = (A + C) / 2 
            tmpC = (A + B) / 2
            A = tmpA
            B = tmpB
            C = tmpC
            count = count + 1
        print(count)
resolve():

Submission status: Runtime Error

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

def even(a):
	if a % 2 == 0:
		return True
	else:
		return False

if A == B and B == C:
	print("-1")
elif:
	if not (even(A) and even(B) and even(C)):
		print("0")
		
else:
	cnt = 0
	while even(A) and even(B) and even(C):
		tmp1, tmp2, tmp3 = A,B,C
		A = (tmp2+tmp3) // 2
		B = (tmp3+tmp1) // 2
		C = (tmp1+tmp2) // 2
		cnt += 1
	print(cnt)

Submission status: Runtime Error

Solution code:
5 5 3
2.5+1.5  2.5+1.5 2.5+2.5
4 4 5


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

def dibidable_by_two(N):
    ans = 0
    if N ==0:
        return 0
    else:
        while 1:
            if N%2 !=0:
                return ans
            else:
                N /= 2
                ans += 1

if A == B == C:
    print(-1)
else:
    ans = 2**100000
    for M in [A,B,C]:
        if M!=0:
            ans=min(ans,dibidable_by_two(M))
    
    if ans == 2**100000:
        print(0)
    else:
        print(ans)

Submission status: Runtime Error

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

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

while True:
    if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        t_A, t_B, t_C = A, B, C
        A = (t_B + t_C) // 2
        B = (t_C + t_A) // 2
        C = (t_A + t_B) // 2
        print(f"{A} {B} {C}")
        ans += 1
    else:
        print(ans)
        break

Submission status: Runtime Error

Solution code:
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


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

Submission status: Runtime Error

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

if a == b and b == c and c == a:
    print(-1)
else:
    for i in range(10**9):
        ans = i
        if a % 2 ==1:
            break
        else:
            a = b/2 + c/2
        if b % 2 == 1:
            break
        else:
            b = c/2 + a/2
        if c % 2 == 1:
            break
        else:
            c = a/2 + b/2
print(ans)

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
chk = [0]*n
for i in range(m):
  a,b = map(int,input().split())
  chk[a-1] += 1
  chk[b-1] += 1
ans = 'YES'
for i in chk:
  if i % 2  == 1:
    ans = 'NO'
print(ans)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
a , b , c = map(int, input().split())
count = 0
if a == 1 and b == 1 and c == 1:
  break
elif a == b and a == c:
  count = -1
else:
  while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    a_copy = a
    b_copy = b
    c_copy = c
    a = int(b_copy / 2 + c_copy / 2)
    b = int(a_copy / 2 + c_copy / 2)
    c = int(b_copy / 2 + a_copy / 2)
    count += 1
  
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = 0

while (A%2 == 0) & (B%2 == 0) & (C%2 == 0):
    if (A==B) & (B==C) :
        ans = -1
        break

    a = (B+C)/2
    b = (A+C)/2
    c = (A+B)/2
    A = a
    B = b
    C = c
        ans += 1

print(ans)

Submission status: Runtime Error

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

if a%2 or b%2 or c%2:
  print(0)
  exit()
elif a==b==c:
  print(-1)
  exit()
  
ans =0
while 1:
  if all(a%2==0, b%2==0, c%2==0):
    ans += 1
  else:
    print(ans)
    exit()
  a, b, c = (b+c)//2, (a+c)//2, (b+a)//2

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
A,B,C = int(input())
ans = None

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

Submission status: Runtime Error

Solution code:
if A==B==C:
    print(-1)
else:
    for i in range(100000000):
        if 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
        else:
            print(i)
            exit()

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().rstrip().split(' '))
if(a==b and b==c):
	if(a%2==0):
    	print(-1)
	else:
		print(0)
else:
	n=0
	while(a%2==0 and b%2==0 and c%2==0):
		n+=1
		tmp_a=(b+c)/2
		tmp_b=(a+c)/2
		tmp_c=(b+a)/2
		a=tmp_a
		b=tmp_b
		c=tmp_c
	print(n)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
count = 0
x = input()
t = x[0]
a = x[1]
s = x[2]
while True:
  t = int(t) / 2
  a = int(a) / 2
  s = int(s) / 2
  count += 1
  print(count)
  t_amari = int(t) % 2
  a_amari = int(a) % 2
  s_amari = int(s) % 2
  if t_amari != 0:
    break
  if a_amari != 0:
    break
  if s_amari != 0:
    break
  if a  == t+1 and s == a+1:
    break

  t_after = a + s
  a_after = t + s
  s_after = t + a
  if t == a and a == s:
    count = -1
    break

Submission status: Runtime Error

Solution code:
a,b,c = map(int,input().split())
cnt=0
if a==b==c and a%2==0:
    cnt = -1
    break
elif:
    for i in range(100):
        if a%2==0 and b%2==0 and c%2==10:
            t_a = b//2 + c//2
            t_b = a//2 + c//2
            t_c = a//2 + b//2
            a,b,c = t_a,t_b,t_c
            cnt+=1
        else:
            break
print(cnt)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

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

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

print(res)

Submission status: Runtime Error

Solution code:
from time import time
t = time()
count = 0
a = int(input())
b = int(input())
c = int(input())
while True:
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        print(count)
        exit()
    count += 1
    a1 = b//2+c//2
    b1 = c//2+a//2
    c1 = a//2+b//2
    a = a1
    b = b1
    c = c1
    if time()-t >= 1.8:
        print(-1)
        exit()

Submission status: Runtime Error

Solution code:
import sys
a,b,c = map(int,input().split())
if a == b == c:
    print(-1)
    sys.eixt()
count = 0
while a%2 == 0 and b%2 == 0 and c%2 == 0:
    x = (b+c)//2
    y = (a+c)//2
    z = (a+b)//2
    a,b,c = x,y,z
    count+=1
    #print(a,b,c)
print(count)

Submission status: Runtime Error

Solution code:
s=list(input().split())
n=int(input())
t=[input() for i in range(n)]
r=[]
for x in s:
    for y in t:
        if len(x)==len(y):
            l=list(x)
            for z in range(len(x)):
                if y[z]=="*":l[z]="*"
            if "".join(l)==y:
                r.append("*"*len(x))
                break
    else:r.append(x)
print(*r)

Submission status: Runtime Error

Solution code:
from functools import reduce
from math import gcd


def main():
    cookies = list(map(int, input().split()))
    answer = -1
    if cookies[0] % 2 or cookies[1] % 2 or cookies[2] % 2:
        answer = 0
    elif len(set(cookies)) > 1:
        answer = reduce(gcd, cookies) - 1
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
a,b,c = map(int,input().split())
lst = [a,b,c]
lst.sort()
res = True
if a==b-=c:
    print(-1)
else:
    while True:
        if a%2!=0 or b%2!=0 or c%2!=0:
            break
        else:
            res += 1
            nx_a = b//2 + c//2
            nx_b = a//2 + c//2
            nx_c = a//2 + b//2
            tmp = [nx_a, nx_b, nx_c]
            tmp.sort()
            if lst==tmp:
                print(-1)
                exit()
            a,b,c = nx_a, nx_b, nx_c
    print(res)

Submission status: Runtime Error

Solution code:
A,B,C = map(int,input().split())
if A%2==1 or B%2==1 or C%2==1:
    cnt = 0
elif A==B and A==C:
    cnt = -1
else:
    a = 0
    while A%2==0:
        A //= 2
        a += 1
    b = 0
    while B%2==0:
        B //= 2
        b += 1
    c = 0
    while C%2==0:
        C //= 2
        c += 1
    cnt = min(a,b,c)
if [a,b,c].count(cnt)<3:
    print(cnt)
else:
    print(cnt+1)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
if a==b and b==c:
    print(-1)
elif if a%2!=0 or b%2!=0 or c%2!=0:
    print(0)
else:
    a1=0
    a2=0
    a3=0
    c1=0
    c2=0
    c3=0
    ans=0
    for i in range(200000):
        if a%2!=0:
            c1=1        
        if b%2!=0:
            c2=1        
        if c%2!=0:
            c3=1
        if c1==1 or c3==1 or c2==1:
            ans=i
            break
        else:
            a3=(a+b)//2
            a2=(a+c)//2
            a1=(b+c)//2
            a=a1
            b=a2
            c=a3
        #print(a,b,c)
        if i==199999:
            ans=-1
    print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = input()
b = int(a)

s = (9-len(a))*'0'+a
ans = 0
for i in range(9):
    if s[i] == '0' and ans==0:
        continue
    ans+=(b//((10**(8-i))*10))*(10**(8-i))
    c = (b%((10**(8-i))*10))+1
    #print(0,c)
    if 2*(10**(8-i))>= c > 10**(8-i):
        ans+=c-10**(8-i)
    elif c>=2*10**((8-i)):
        ans+=10**(8-i)
    #print(ans)
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:


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

if all([a==b,b==c]):
    print(-1)

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

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

Submission status: Runtime Error

Solution code:
from sys import stdin
A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    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)

Submission status: Runtime Error

Solution code:
H, W, K = map(int, input().split())
items = []

start = []
diff = float("inf")
p = []
prev = [[False] * W for _ in range(H)]
for i in range(H):
    items.append(list(input()))
    for j in range(W):
        s = items[i][j]
        if s == "S":
            start = [i, j]
            diff = min(diff, min(i, H - 1 - i, min(j, W - 1 - j)))
            p = [i, j]
            prev[i][j] = True

from collections import deque

que = deque([])

dx = [-1, 0, 0, 1]
dy = [0, 1, -1, 0]

for i in range(4):
    x = dx[i]
    y = dy[i]
    if 0 <= start[0] + y <= H - 1 and 0 <= start[1] + x <= W - 1:
        tmp = items[start[0] + y][start[1] + x]
        if tmp == ".":
            que.append((start[0] + y, start[1] + x))
k = K
while len(que) != 0:
    q = que.popleft()
    a = q[0]
    b = q[1]
    if abs(start[0] - a) + abs(start[1] - b) > K:
        continue

    prev[a][b] = True
    c = min(min(a, H - 1 - a), min(b, W - 1 - b))
    if c < diff:
        diff = c
        p = (a, b)

    for i in range(4):
        x = dx[i]
        y = dy[i]
        if 0 <= a + y <= H - 1 and 0 <= b + x <= W - 1:
            if prev[a + y][b + x]:
                continue
            tmp = items[a + y][b + x]
            if tmp == ".":
                que.append((a + y, b + x))
    k -= 1

ans = 1
if diff == 0:
    print(ans)
else:
    print(ans + (K - 1 + diff) // K)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

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

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

Solution code:
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)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import hogehugapoyopoyo

Submission status: Runtime Error

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: Runtime Error

Solution code:
import math
n = list(map(int, input().split()))
d = max(m)-min(m)
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: Runtime Error

Solution code:
def solve():
  n,m = (int(i) for i in input().split())
  a = [0]*n
  for i in range(m):
    a1,b1 = (int(i) for i in input().split())
    a[a1-1]+=1
    a[b1-1]+=1
  ans = 'YES'
  for i in range(1,n+1):
   if a[i]%2 == 1:
    ans ='NO'
  return ans
                   
  
if __name__ == '__main__':
  print(solve())

Submission status: Runtime Error

Solution code:
def solve(a, b, c):
    if (a, b, c) in s:
        return -1
    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: Runtime Error

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import deque
from math import ceil

def dist(h,w,x,y):
    return min(x-1,h-x,y-1,w-y)

h,w,k=map(int,input().split())
MAP=[]
A=['#']*(w+2)
MAP.append(A)
for i in range(h):
    s='#'+input().strip()+'#'
    for j,t in enumerate(s):
        if t=='S':
            sx,sy=i+1,j
    MAP.append(list(s))
MAP.append(A)
delta=[[1,0],[0,1],[-1,0],[0,-1]]
P=[]
Visited=[[False]*(w+2) for _ in range(h+2)]
Visited[sx][sy]=True
q=deque()
q.append((sx,sy,k))
while q:
    x,y,t=q.popleft()
    if t<0:
        break
    P.append([x,y])
    t-=1
    for dx,dy in delta:
        if MAP[y+dy][x+dx]=='.' and not Visited[x+dx][y+dy]:
            q.append((y+dy,x+dx,t))
            Visited[x+dx][y+dy]=True
ans=float('inf')
for x,y in P:
    ans=min(ans,1+ceil(dist(h,w,x,y)/k))
print(ans)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
if a%4!=0 and b%4!=0 and c%4!=0 or(a==b and b==c):
    print(-1)
else:
    s=a+b+c
    d=0
    j=0
    while a%2!=1 and b%2!=1 and c%2!=1:
        d+=1
        h=s
        j=a
        a=(s-a)//2
        b=j//2+c//2
        c=h-a-b
print(d)