Problem:


Score: 300 points

Problem Statement

As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.

Snuke, an employee, would like to play with this sequence.

Specifically, he would like to repeat the following operation as many times as possible:

For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3".  
Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer.

At most how many operations can be performed?

Constraints

N is an integer between 1 and 10 \ 000 (inclusive).

a_i is an integer between 1 and 1 \ 000 \ 000 \ 000 (inclusive).

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 a_3 ... a_N

Output

Print the maximum number of operations that Snuke can perform.

Sample Input 1

3
5 2 4

Sample Output 1

3

The sequence is initially {5, 2, 4}. Three operations can be performed as follows:

First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.

Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.

Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.

Sample Input 2

4
631 577 243 199

Sample Output 2

0

No operation can be performed since all the elements are odd. Thus, the answer is 0.

Sample Input 3

10
2184 2126 1721 1800 1024 2528 3360 1945 1280 1776

Sample Output 3

39



Sample input:
3
5 2 4


Sample output:
3

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for a in A:
        for i in range(1, 30):
            if a%(2**i) != 0:
                ans += i-1
                break
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for a in A:
        for i in range(1, 27):
            if a%(2**i) != 0:
                ans += i-1
                break
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

count = 0
for i in a:
  count += bin(i).rfind("1") - 1

print(count)

Submission status: Wrong Answer

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

count = 0
for i in a:
  b = bin(i).rfind("1") - 1
  count += b

print(count)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in a:
    ans += math.log(i,2)
    
    
print(ans)

Submission status: Wrong Answer

Solution code:
# ABC100-C
N = int(input())
an = list(map(int,input().split()))
boolian = True
count = 1

an.sort()

while boolian == True:
    clack = 0
    for i in range (N):
        if an[i] % 2 != 0:
            an[i] *= 3 
            clack += 1
        if an[i] % 2 == 0:
            k = an[i] % 2
            if k == 0:
                an[i] /= 2 
            if k != 0:
                boolian = False
    if clack == N:
        boolian = False
    if clack != N:
        count += 1               
print(count)

Submission status: Wrong Answer

Solution code:
# coding=utf-8

if __name__ == '__main__':
    N = int(input())
    lia = list(map(int, input().split()))

    C = 0
    for i in range(N):
        if lia[i] % 2 ==0:
            C += lia[i] / 2

    print(int(C))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
lists = [ int(v) for v in input().split(" ") ]

total = 0

print(math.log2(10))

for l in lists:
  if l % 2 == 0:
    while True:
      if l % 2 == 0:
        l = int(l/2)
        total += 1      
      else:
        break
print(total)

Submission status: Wrong Answer

Solution code:
N = int(input())
*A, = map(int, input().split())

ans = 0
for a in A:
    if a % 2:
        continue
    ans += len([i for i in range(1,11) if a % (2**i) == 0])

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=set(list(map(int,input().split())))
ans=0
for i in a:
  while 1:
    if i%2!=0:
      break
    i=i//2
    ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for i in A:
        while i%2 == 0:
            ans += 1
            i = i//2
    print(ans)

Submission status: Wrong Answer

Solution code:
# ABC100 C "*3 or /2"

import numpy
N = int(input())
a = numpy.array(list(map(int, input().split())))
# a.sort(reversed = False)
a.sort()
a = a[::-1]

print(a)
count = 1

if all(elem % 2 !=0 for elem in a) == True:
    ans = 0
else:
    while True:
        if all(elem % 2 !=0 for elem in a) == True:
            ans = count -1
            break
        else:
            for ind in range(N):
                if a[ind] % 2 ==0:
                    i = ind
                    break
            a[i] = a[i]/2
           # print(i,a[i])
            a[:i] = a[:i]*3
            a[i+1:] = a[i+1:]*3
            #print(count, a)
            a.sort()
            a = a[::-1]
            count += 1
        
print(ans)

Submission status: Wrong Answer

Solution code:
# AtCoder Beginner Contest 100
# C - *3 or /2

N=int(input())
A=list(map(int,input().split()))

count=0

A=[ a for a in A if a%2==0 ]

for _ in range (10**5):
    _A=[]
    for a in A:
        if a==max(A):
            _a=a//2
            if _a%2==0:
                _A.append(_a)
            else:
                pass
        else:
            if a%2==0:
                _a=a*3
                _A.append(_a)
            else :
                pass
    count+=1
    A=_A
    if len(A)==0:
        break
    
    # print(A)
    # print(_A)

print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(N):
  p=1
  for j in range(1,29):
    p*=2
    if a[i]%p!=0:
      break
    ans+=1
print(ans)

Submission status: Wrong Answer

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

# check
cnt = 0
evens = [a for a in A if a % 2 == 0]
while len(evens) > 0:
    max_even = max(evens)
    max_even_idx = A.index(max_even)
    A[max_even_idx] //= 2
    
    A = [a * 3 for ind, a in enumerate(A) if ind != max_even_idx]

    cnt += 1
    evens = [a for a in A if a % 2 == 0]

print(cnt)

Submission status: Wrong Answer

Solution code:
import numpy as np
s = list(map(int, input().split()))
n=s[0]
s = list(map(int, input().split()))
l=np.array(s)
ans=0
while len(l)>0:
    l=l[l%2==0]
    if len(l)==n:  
        ans+=len(l)-1
    else:
        ans+=len(l)
    l=l/2
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
s = list(map(int, input().split()))
n=s[0]
s = list(map(int, input().split()))
l=np.array(s)
l=l[l%2==0]
if len(l)==n:  
    print(2**len(l)-2)
else:
    print(2**len(l)-1)

Submission status: Wrong Answer

Solution code:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    if i%2==0:
        t=factorization(a[i])
        ans+=t[0][1]
print(ans)

Submission status: Wrong Answer

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

ans = 0
max = N - 1

while True:
  cnt = 0
  for i in range(N):
    if (a[i] % 2 == 1 or a[i] <= 2) and cnt < max:
      a[i] *= 3
      cnt += 1
    else:
      if a[i] // 2 * 2 != a[i]:
        print(ans)
        exit()
      else:
        a[i] //= 2
  ans += 1  

print(ans)

Submission status: Wrong Answer

Solution code:
def log2(n):
    n = int(n)
    cnt = 0
    while n ^ 1:
        cnt += 1
        n >>= 1
    return cnt


N = int(input())
print(sum(map(log2, input().split())))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0

for i in range(n):
  while a[i] % 2 == 0:
    a[i] = a[i]/2
    ans = 1
print(ans)

Submission status: Wrong Answer

Solution code:
def f(n):
    cnt = 0
    while n % 2 == 0:
        n //= 2
        cnt += 1
    return cnt


def main():
    N = int(input())
    a = list(map(int, input().split(' ')))
    exp_2 = list(map(f, a))
    min_exp_2 = min(exp_2)
    print(sum(exp_2) - min_exp_2)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def cnt(n):
    return format(n, 'b')[::-1].find('1')

sum(list(map(cnt, a)))

Submission status: Wrong Answer

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


cnt = 0

for i in n:
    if(i%2==0):
        while(i>1):
            cnt+=1
            i//=2
            
print(cnt)

Submission status: Wrong Answer

Solution code:
import numpy
n = input()
a =[int(e) for e in input().split(" ")]

a_n = numpy.array(a)
count = 0

for kk in range(10000):
    TF = a_n%2==0
    if any(TF):
        tmp = 0
        tmp_i = 0
        for i,j in enumerate(TF):       
            if j:
                tmp = a_n[i]
                tmp_i = i
                break
        a_n[tmp_i] = a_n[tmp_i]/2
        count += 1
    else:
        break
print(count)

Submission status: Wrong Answer

Solution code:
import numpy
n = input()
a =[int(e) for e in input().split(" ")]

a_n = numpy.array(a)
count = 0

for kk in range(10000):
    TF = a_n%2==0
    if any(TF):
        print(a_n)
        tmp = 0
        tmp_i = 0
        for i,j in enumerate(TF):       
            if j:
                if tmp <= a_n[i]:
                    tmp = a_n[i]
                    tmp_i = i
        a_n = a_n * 3
        a_n[tmp_i] = a_n[tmp_i]/6
        if numpy.max(a_n) <= 1000000000:
            count += 1
        else:
            break
    else:
        break
print(count)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np


def main():
  scan = sys.stdin.readline
  
  n = int(scan().rstrip())
  a = np.array(tuple(int(a_i) for a_i in scan().rstrip().split()))
  
  print(np.sum(np.log2(a & -a)))


if __name__ == "__main__":
  main()

Submission status: Wrong Answer

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

count = 0

for i in a:
    while i % 2 == 0:
        i //= 2
        count += 1
    print(i)

print(count)

Submission status: Wrong Answer

Solution code:
num = int(input())
lis = map(int,input().split())

ans = 0
for number in lis:
    while number%2 == 0:
        number /= 2
        ans += 1

Submission status: Wrong Answer

Solution code:
def I(): return int(input())
def LI(): return list(map(int,input().split()))
##################################################
N = I()
a = [x for x in LI() if x%2==0]
ans = 0
while 1:
    if len(a)==0:
        print(ans)
        break
    print(a)
    for i,x in enumerate(a):
        if i==0:
            a[i] /= 2
    a = [x for x in a if x%2==0]
    ans += 1

Submission status: Wrong Answer

Solution code:
n = int(input())
li = [int(x) for x in input().split()]
def func(li):
  a = 1
  for x in li:
    a *= x

  return a
  
count = 0
while True:
  if func(li)%2==0:
    for i in range(len(li)):
      if li[i]%2==0:
        li[i] = li[i]*3
      else:
        li[i] = li[i]/2
    count += 1
  else:
    break
    
print(count)

Submission status: Wrong Answer

Solution code:
n, *A = map(int, input().split())
ans = 0
for a in A:
  while True:
    a, r = divmod(a, 2)
    if r:
      break
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = [int(e) for e in input().split()]
i = 0
count = 0
flag = True
c3 = len(nums) - 1
while(flag):
    for num in nums:
        if num%2 == 0:
            nums[i] /= 2
        elif(c3):
            nums[i] *= 3
            c3 -= 1
        else:
            flag = False
        i += 1
    i = 0
    if(flag):
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
cnt=10**9
for i in range(n):
  k=0
  while (a[i]-1):
    if a[i]%2==0:
      a[i]=a[i]//2
      k+=1
    else:break
  cnt=min(cnt,k)    
print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    ans = 0
    for a in A:
        if a%2 == 0:
            ans += 1

    print((ans**2)//2+ans-1)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
l=list(map(int,input().split()))
dd=[]                                                                  
for i in l: 
	if i % 2==0: 
		dd.append(i)       
cnt_lst=[]                                                             
for i in dd: 
	cnt1=0 
	while(i % 2==0): 
		i//= 2 
		cnt1+=1 
		if i %2==1: 
			cnt=cnt1 
			cnt_lst.append(cnt)             
			break 
print(sum(cnt_lst))

Submission status: Wrong Answer

Solution code:
def sanbun2(n , al):

    ans = 0

    for i in al:
        ans += i // 2

    return ans

def main():
    n = int(input())
    al = list(map(int , input().split()))
    print(sanbun2(n , al))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
li = list(map(int, input().split()))
m = 0
for i in range(len(li)):
  n = li[i]
  while not n % 2:
    m += 1
    n /= 2
else:
  print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def LI():
	return [ int(s) for s in input().split() ]
  
A = LI()
 
cnt = 0
 
for a in A:
  odd = False
  while(not odd):
    if a % 2 != 0:
      odd = True
    else:
      a = a//2
      cnt += 1
      
print(cnt)

Submission status: Wrong Answer

Solution code:
def LI():
	return [ int(s) for s in input().split() ]
  
A = LI()

cnt = 0

for a in A:
  odd = False
  while(not odd):
    if a % 2 != 0:
      odd = True
    else:
      a = a//2
      cnt += 1
      
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
c=0
b=a[0]
for i in range(1,n):
    b=b*a[i]
for i in range(1000):
    if b%2==0:
        b=b//2
        c+=1
print(c)

Submission status: Wrong Answer

Solution code:
#  因数分解
def bunkai(num):
    a = []
    while num % 2 == 0:
        a.append(2)
        num //= 2
    f = 3
    while f * f <= num:
        if num % f == 0:
            a.append(f)
            num //= f
        else:
            f += 2
    a.append(num)
    if len(a) == 1:
        a.append(1)
    return a
_ = input()
gyouretu = list(map(int, input().split()))
print(gyouretu)
dst = 0
for g in gyouretu:
    for i in bunkai(g):
        if i == 2:
            dst += 1
print(dst)

Submission status: Wrong Answer

Solution code:
#  因数分解
def bunkai(num):
    a = []
    while num % 2 == 0:
        a.append(2)
        num //= 2
    f = 3
    while f * f <= num:
        if num % f == 0:
            a.append(f)
            num //= f
        else:
            f += 2
    a.append(num)
    if len(a) == 1:
        a.append(1)
    return a
gyouretu = list(map(int, input().split()))
dst = 0
for g in gyouretu:
    for i in bunkai(g):
        if i == 2:
            dst += 1
print(dst)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = [i for i in map(int,input().split()) if i%2 == 0]
even = 1
j = 0
print(L)
for i in range(len(L)):
  even *= L[i]
while (even % 2**j == 0):
  j += 1
print(j-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = [i for i in map(int,input().split()) if i%2 == 0]
even = 1
i = 0
for i in range(len(L)):
  even *= L[i]
while even // 2 == 0 and even / 2**i >= 1:
  i += 1
print(i)

Submission status: Wrong Answer

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

z=[]
for i in range(n):
    x,y=0,l[i]
    while y%2==0:
        x+=1
        y=y//2
    else:
        z.append(x)
        break

print(sum(z))

Submission status: Wrong Answer

Solution code:
def m2p(ai):
    aii=ai
    k=0
    ra=aii%2
    while ra==0 and aii>0:
        k=k+1
        aii=aii//2
        ra=aii%2
    return k        

n=int(input())
a=list(map(int,input().split()))

m=0
for i in range(n):
    m=m+m2p(a[i])
    print(a[i],m2p(a[i]))
print(m)

Submission status: Wrong Answer

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

cnt=0
for i in range(n):
    if all([i%2!=0 for i in a])==True: #すべての要素が奇数ならbreak
        break
    elif a[i]%2!=0: #奇数なら3倍
        a[i]*=3
    elif a[i]%4==2: #4の剰余が2（e.g.,2,6,10,...）なら3倍
        a[i]*=3
    elif a[i]%4==0: #4の剰余が0なら1/2倍
        a[i]//=2
    cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
def divisionCnt(n):
    cnt = 0
    while n % 2 == 0:
        n = n / 2
        cnt += 1
    return cnt

numbers = [int(i) for i in input().split() if int(i) % 2 == 0]

cnt = 0
for n in numbers:
    cnt += divisionCnt(n)

print(cnt)

Submission status: Wrong Answer

Solution code:
from functools import lru_cache
import sys
import numpy as np

sys.setrecursionlimit(10**8)

N = int, input().split()
X = list(map(int, input().split()))

@lru_cache(maxsize=None)
def dp(*x):
    xnum = np.array(x)
    x_seki = xnum.prod()
    result = bin(x_seki)[::-1].find('1')
    return result
print(dp(*X))

Submission status: Wrong Answer

Solution code:
from functools import lru_cache
import sys
import numpy as np

sys.setrecursionlimit(10**8)

N = int, input().split()
X = list(map(int, input().split()))

@lru_cache(maxsize=None)
def dp(*x):
    xnum = np.array(x)
    x_seki = xnum.prod()
    result = 0
    while x_seki % 2 == 0:
        x_seki /= 2
        result += 1
    return result - 1
print(dp(*X))

Submission status: Wrong Answer

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

count = 0
for i in a:
    if i%2 ==0:
        while(i%2==0):
            i = i//2
            count +=2
print(count)

Submission status: Wrong Answer

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

ans = 10**9
for i in range(n):
    cnt = 0
    while(1):
        if a[i]%2==0:
            cnt+=1
            a[i]/=2
        else:
            break
    ans = min(ans,cnt)
    
print(ans)

Submission status: Wrong Answer

Solution code:


import math
import collections
N = int(input())
A = list(map(int, input().split()))

def trial_division(n):
  #素因数を格納するリスト
  factor = []
  #2から√n以下の数字で割っていく
  tmp = int(math.sqrt(n)) + 1
  for num in range(2,tmp):
      while n % num == 0:
          n //= num
          factor.append(num)
  #リストが空ならそれは素数
  if not factor:
      return 0
  else:
      factor.append(n)
      counter = collections.Counter(factor)
      return counter[2]

result = 0

for a in A:
  if a % 2 != 0: continue
  result += trial_division(a)

print(result)

Submission status: Wrong Answer

Solution code:
def ct_2(n):
  ct=0
  while n>0:
    n//=2
    ct+=1
  return ct

input()
a=list(map(int,input().split()))
ans=0
for num in a:
  ans+=ct_2(num)
print(ans)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
a = list(map(int, input().split()))
evens = [x for x in a if x%2 == 0]

ans = 0
for x in evens:
        ans += math.floor(math.log2(x))

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
evens = [x for x in a if x%2 == 0]

ans = 0
for x in evens:
        ans += x//2

print(ans)

Submission status: Wrong Answer

Solution code:
N = input()
a = input()
a = a.split()
L = len(a)
b = []
ans = 0
flag = 1
for i in range(L):
    b.append(int(a[i]))
while(flag):
    for i in range(L):
        flag = 0
        if(b[i] % 2 == 0):
            ans = ans + 1
            b[i] = b[i] / 2
            flag = 1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[int(a) for a in input().split()]
rec=[False]*N
cnt=0
for b in range(13,0,-1):
    for i in range(N):
        if a[i]%(2**b)==0 and rec[i]==False:
            cnt+=b
            rec[i]=True
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0

for a in list(map(int,input().split())):
  while not a%2:
    ans+=1
    a//2
    break
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=0
count=0

for i in a:
  if i%2!=0:
    count+=1
  else:
    ans+=1
    
if count==len(a):
  print(0)
if ans!=0:
  print(len(a))

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
ans = 0
for a in a_list:
    if a%2 == 0:
        ans += a//2
print(ans)

Submission status: Wrong Answer

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

g = [1 for i in a if i%2==0]
print(((n-sum(g))**2)*((sum(g))**2-1))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = (n // 2 for n in map(int, input().split()) if n % 2 == 0)
print(sum(a))

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(num) for num in input().split()]
lis = [True] * len(A)

counter = 0
while True in lis:
  for i in range(n):
    if lis[i] == True:
      if A[i] % 2 == 0:
        A[i] = A[i] // 2
      else:
        lis[i] = False
  counter += 1
print(counter)

Submission status: Wrong Answer

Solution code:
#100c
def check_number_of_devide_by_2(n):
#aiが最大1000000000なので、log_2(1000000000) =　29.897352854　回のループで1つのaiを調べられる。
    count = 0
    while n%2==0:
        count += 1
        n = n/2
    
    return count

N = int(input())

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
res = 0
for i in range(N):
  k = 0
  while A[i] % (2 ** k) == 0:
    k += 1
  res = max(k - 1, res)
print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
ls = list(map(int, input().split()))
counts = []
for x in ls:
    y = x
    count = 0
    while True:
        if y % 2 == 0:
            y //= 2
            count += 1
        else:
            counts.append(count)
            break
print(sum(counts) - min(counts))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0
"""
一番大きい偶数を2で割る
それ以外は3倍
を繰り返す
奇数だけになったら終了
"""
# O(n)
def f(L):
    even = []
    for l in L:
        if l%2 == 0:
            even.append(l)

    if even == []:
        return -1
    else:
        return max(even)

while True:
    maxEven = f(a)
    # print(maxEven)
    if maxEven == -1:
        print(ans)
        exit()
    else:
        for i in range(n):
            if a[i] == maxEven:
                a[i] = a[i] // 2
            else:
                a[i] *= 3
        ans += 1

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in a:
    if i % 2 == 0:
        ans += i // 2 
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
m=0
for i in range(n):
  while a[i]%2==0:
    a[i]==a[i]//2
  m+=a[i]
print(m)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
m=0
c=[]
for i in range(n):
  b.append(bin(a[i]))
for j in range(n):
  c.append(b[j][2:])
for k in range(n):
  m=max(m,sum(list(map(int,c[k]))))
print(m)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
m=0
for i in range(n):
  b.append(bin(a[i]))
for j in range(n):
  b[j]=b[j][2:]
for k in range(n):
  m=max(m,sum(list(map(int,b[j]))))
print(m)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
m=0
for i in range(n):
  b.append(bin(a[i]))
for j in range(n):
  b[j]=b[j][2:]
for k in range(n):
  m=max(m,sum(map(int,''.join(b[j]))))
print(m)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
m=0
for i in range(n):
  b.append(bin(a[i]))
for j in range(n):
  b[j]=b[j][2:]
for k in range(n):
  m=max(m,sum(map(int,''.join(b[j]))))

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
count = 0
print(a_list)
for a in a_list:
    while True:
        if a % 2 == 0:
            a = a//2
            count += 1
        else:
            break
print(count)

Submission status: Wrong Answer

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

s = 0
for i in range(n):
  while a[i] > 0:
    a[i] //= 2
    s +- 1
print(s)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    if a <= 8 and b <= 8:
        print("Yay!")
    else:
        print(":(")
    return

#B
def B():
    d, n = LI()
    print(str(n * (n != 100) or n + 1) + "00" * d)
    return

#C
def C():
    II()
    ans = 0
    a = LI()
    for ai in a:
        if not ai % 2:
            ans += ai // 2
    print(ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Wrong Answer

Solution code:
#coding: utf-8
N = int(input())
L = list(map(int, input().split()))

cnt = 0
for i in range(len(L)):
    if(L[i]%2 == 0):
        cnt += 1

if(cnt == len(L)):
    print(0)
else:
    ans = 2**cnt-1
    print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
N = int(input())
L = list(map(int, input().split()))

cnt = 0
for i in range(len(L)):
    if(L[i]%2 == 0):
        cnt += 1

ans = 2**cnt

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
As = [int(a) for a in input().split()]
ans = 0
c = 1
for a in As:
  if a % c == 0:
    tmp = a // c
    while True:
      if tmp % 2 == 0:
        tmp = tmp // 2
        ans += 1
        c = c * 2
      else:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
def fat(n):
	f = 1
	while(n >1):
		f = f*n
		n = n-1
	return f

n = input()
v = raw_input()
combination = (fat(n))/(fat(n-1))
print(combination)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = [int(x) for x in input().split()]

cnt=0

for i in range(n):
	if x[i]%2==0:
		cnt+=1
		i+=-1

print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
m = [int(x) for x in raw_input().split()]
a = 0
for numero in m:
    a += 0 if numero % 2 != 0 else numero / 2
print a

Submission status: Wrong Answer

Solution code:
def f(n):
    c = 0
    while n % 2 == 0:
        n //= 2
        c += 1
    return c

n = input()
a = list(map(f, map(int, input().split())))
print(sum(a) - min(a))

Submission status: Wrong Answer

Solution code:
def f(n, ans):
    if n in ans:
        return ans[n]
    
    if n % 2 == 0:
        ans[n] = f(n//2, ans) + 1
    else:
        ans[n] = 0
    return ans[n]

ans = {}

n = input()
a = list(map(lambda x: f(x, ans), map(int, input().split())))
print(sum(a) - min(a))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = input().split()
aa = [int(a[i]) for i in range(n)]
b = 1
for i in range(n):
  s = list(str(aa[i]))
  ss = int(s[-1])
  if ss == 0 or ss == 2 or ss == 4 or ss == 6 or ss == 8:
  	b = b * aa[i]

print(b)
c = 0
cnt = 0
while c < 1:
  if b % 2 == 0:
    b = b // 2
    cnt = cnt + 1
  else:
    c = 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 0
for v in a:
    while v%2 is 0:
        ans += 1
        v /= 2
print(ans)

Submission status: Wrong Answer

Solution code:
from copy import deepcopy

n = int(input())
a = list(map(int,input().split()))


counter = 0
while(True):
    a.sort()

    print(a)
    b = deepcopy(a)

    undivided = True
    for i,v in enumerate(b):
        if v%2 is 0 and undivided:
            a[i] = v//2
            undivided = False
        else:
            a[i] = v*3
    
    if undivided:
        break
    else:
        counter += 1

print(counter)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(30):
        if a[i]%2 == 0:
            a[i] %= 2
            ans += 1
        else:
            break
print(ans)

Submission status: Wrong Answer

Solution code:
A = [int(x) for x in input().split() if int(x)%2 == 0]

if len(A) == 0:
  print(0)
  exit()
  
s = []
for a in (min(A),max(A)):
  for b in range(a+1):
    if 2**b > a:
      s.append(b-1)
      break
      
print(sum(s)+s[0]-1+s[1]-1-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().rstrip().split()))
even = [i for i in a if i%2 == 0]
count = 0
for i in even:
    c = 0
    for j in range(14):
        rem = i % 2
        i //= 2
        if rem == 1:
            break
        c += 1
    count += c
print(count)

Submission status: Wrong Answer

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

ans = 0
flag = 1
i = 1
while flag:
  y = 2**i
  m = list(map(lambda x: x%y, l))
  print(m)
  if 0 in m:
    ans += m.count(0)
    i += 1
  else:
    flag = 0
print(ans)

Submission status: Wrong Answer

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

A = sorted(A)
A = [i for i in A if i % 2 == 0]

a = 0
cnt = 0


while True:
    A = [i / 2 for i in A]
    a += 1
    print(A)
    cnt += a*len([i for i in A if i % 2 == 1])

    if len([i for i in A if i > 1]) == 0:
        break
    A = [i for i in A if i % 2 == 0]
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
lista= [int(i) for i in input().split()]
count = 0

for i in range(n):
    dig = lista[i]
    for j in range(10,0,-1):
        if dig%(2**j)==0:
            count+=j
            break
            
print(count)

Submission status: Wrong Answer

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

cnt = 0
while True:
    e = 0
    for i in range(len(a)):
        if a[i] % 2 == 0:
            e = max(e, a[i])
        a[i] = a[i] * 3
    if e == 0:
        break
    else:
        a[a.index(e*3)] = a[a.index(e*3)] / 6
        cnt += 1
        

print(cnt)