Problem:


Score : 400 points

Problem Statement

We have a sequence of length N, a = (a_1, a_2, ..., a_N).
Each a_i is a positive integer.

Snuke's objective is to permute the element in a so that the following condition is satisfied:

For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.

Determine whether Snuke can achieve his objective.

Constraints

2 ≤ N ≤ 10^5

a_i is an integer.

1 ≤ a_i ≤ 10^9

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

If Snuke can achieve his objective, print Yes; otherwise, print No.

Sample Input 1

3
1 10 100

Sample Output 1

Yes

One solution is (1, 100, 10).

Sample Input 2

4
1 2 3 4

Sample Output 2

No

It is impossible to permute a so that the condition is satisfied.

Sample Input 3

3
1 4 1

Sample Output 3

Yes

The condition is already satisfied initially.

Sample Input 4

2
1 1

Sample Output 4

No

Sample Input 5

6
2 7 1 8 2 8

Sample Output 5

Yes



Sample input:
3
1 10 100


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
##    if sonota == 0:
##        return "Yes"

##    if four == 0 and sonota >= 1:
##        return "No"


    two = 1 if two>=1 else 0
    if two == 0 and four + 1 - sonota >= 0:
        return "Yes"
    else:
        return "No"



    if four + 1 - sonota - two > 0:
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
##    if sonota == 0:
##        return "Yes"

##    if four == 0 and sonota >= 1:
##        return "No"


    two = 1 if two>=1 else 0


    if four + 1 - sonota - two > 0:
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
##    if sonota == 0:
##        return "Yes"

##    if four == 0 and sonota >= 1:
##        return "No"


    two = 1 if two>=1 else 0


    if four + 1 - sonota - two >= 0:
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
    if sonota == 0:
        return "Yes"

##    if four == 0 and sonota >= 1:
##        return "No"


    two = 1 if two>=1 else 0


    if four + 1 - sonota - two >= 0:
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
##    if sonota == 0:
##        return "Yes"
##
##    if four == 0 and sonota >= 1:
##        return "No"


    two = 1 if two>=1 else 0


    if four + 1 - sonota - two >= 0:
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
    if sonota == 0:
        return "Yes"

    if four == 0 and sonota >= 1:
        return "No"


    two = 1 if two>=1 else 0


    if four + 1 - sonota - two >= 0:
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two

    if four == 0 and sonota >= 1:
        return "No"
    if sonota == 0 and four == 0:
        return "Yes"


    two = 1 if two>=1 else 0


    if four + 1 - sonota - two >= 0:
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two

    if four == 0 and sonota >= 1:
        return "No"
    if sonota == 0:
        return "Yes"


    two = 1 if two>=1 else 0


    if four + 1 - sonota - two >= 0:
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
    two = 1 if two>=1 else 0

    if four + 1 - sonota - two >= 0:
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
    if two == 0:
        if four + 1 - sonota >= 0:
            return "Yes"
        else:
            return "No"
    else:
        if four + 1 - sonota > 0:
            return "Yes"
        else:
            return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
    if two == 0:
        if four + 1 - sonota >= 0:
            return "Yes"
        else:
            return "No"
    else:
        if four - sonota >= 0:
            return "Yes"
        else:
            return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two
    if four == 0 and sonota >= 1:
        return "No"

    if sonota < four + 1:
        return "Yes"
    elif ((four + 1 - sonota) == 0) and (two == 0):
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two

    if sonota < four + 1:
        return "Yes"
    elif ((four + 1 - sonota) == 0) and (two == 0):
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    sonota = len(lst) - four - two

    if sonota < four + 1:
        return "Yes"
    elif (four + 1 - sonota == 0) and (two == 0):
        return "Yes"
    else:
        return "No"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    others = n - four - two
    if four == 0 and others == 0 :
        return "Yes"
    if four == 0 and two == 0:
        return "No"




    #othersをチェック 2の倍数でも4の倍数でもない数値は全て4の倍数の間に押し込まないといけない。
    four += 1
    four -= others

    if four == 0 and two >= 1:
        return "No"




    if four <= 0 :
        return "No"
    else:
        return "Yes"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    others = n - four - two
    if four == 0 and others == 0:
        return "Yes"
    if four == 0 and two == 0:
        return "No"




    #othersをチェック 2の倍数でも4の倍数でもない数値は全て4の倍数の間に押し込まないといけない。
    four += 1
    four -= others




    if four <= 0 :
        return"No"
    else:
        return "Yes"

print(solve(lst))

Submission status: Wrong Answer

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

four = 0
two = 0
not_four = 0

for i in range(N):
    if a[i] % 4 == 0:
        four += 1

    elif a[i] % 2 == 0 and a[i] % 4 != 0:
        two += 1
        if two == 2:
            four += 1
            two = 0
    else:
        not_four += 1

if two == 1:
    not_four += 1

while four > 0 and not_four > 0:
    four -= 1
    not_four -= 2

if four >= not_four:
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    others = n - four - two
    if four == 0 and others == 0:
        return "Yes"
    if four == 0 and two == 0:
        return "No"




    #othersをチェック 2の倍数でも4の倍数でもない数値は全て4の倍数の間に押し込まないといけない。
    four += 1
    four -= others




    if four < 0 :
        return"No"
    else:
        return "Yes"

print(solve(lst))

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

def solve(lst):
    four = count_four(lst)
    two = count_two(lst) - four
    others = n - four - two
    if four == 0 and others == 0:
        return "Yes"



    #othersをチェック 2の倍数でも4の倍数でもない数値は全て4の倍数の間に押し込まないといけない。
    four += 1
    four -= others




    if four < 0 :
        return"No"
    else:
        return "Yes"

print(solve(lst))

Submission status: Wrong Answer

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

four = 0
two = 0
not_four = 0

for i in range(N):
    if a[i] % 4 == 0:
        four += 1

    else:
        if a[i] % 2 == 0:
            two += 1
            if two == 2:
                four += 1
                two = 0
        else:
            not_four += 1

print(four)

while four > 0 and not_four > 0:
    four -= 1
    not_four -= 2

if four >= not_four:
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:
def count_four(lst):
    counter = 0
    for i in lst:
        if i%4 == 0:
            counter += 1
    return counter

def count_two(lst):
    counter = 0
    for i in lst:
        if i%2 == 0:
            counter += 1
    return counter

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

four = count_four(lst)
two = count_two(lst) - four
others = n - four - two

#othersをチェック 2の倍数でも4の倍数でもない数値は全て4の倍数の間に押し込まないといけない。
four += 1
four -= others




if four < 0 :
    answer = "No"
else:
    answer = "Yes"

print(answer)

Submission status: Wrong Answer

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

four = 0
ten = 0
not_four = 0

for i in range(N):
    if a[i] % 4 == 0:
        four += 1

    else:
        not_four += 1

while four > 0 and not_four > 0:
    four -= 1
    not_four -= 2

if four >= not_four:
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

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

four = 0
ten = 0
not_four = 0

for i in range(N):
    if a[i] % 4 == 0:
        four += 1

    elif a[i] == 10:
        ten += 1
        if ten == 2:
            four += 1
            ten = 0

    else:
        not_four += 1

while four > 0 and not_four > 0:
    four -= 1
    not_four -= 2

if four >= not_four:
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

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

four = 0
ten = 0
not_four = 0

for i in range(N):
    if a[i] % 4 == 0:
        four += 1

    elif a[i] == 10:
        ten += 1
        if ten == 2:
            four += 1
            ten = 0

    else:
        not_four += 1

while four > 0 and not_four > 0:
    four -= 1
    not_four -= 2

if four == 0 and not_four <= 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

four = 0
not_four = 0

for i in range(N):
    if a[i] % 4 == 0:
        four += 1

    else:
        not_four += 1

while four > 0 and not_four > 0:
    four -= 1
    not_four -= 2

if four == 0 and not_four <= 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# きりみんちゃん配信からきました
# 4で割りきれる数と奇数をぶつける（4で割り切れず2で割り切れるやつはまあはい）
n = int(input())
arr = list(map(int, input().split()))
dividable4 = 0
dividable2 = 0
odds = 0
for a in arr:
  if a % 4 == 0:
    dividable4 += 1
  elif a % 2 == 1:
    odds += 1
  elif a % 2 == 0:
    dividable2 += 1
print("Yes" if odds <= dividable4 or (odds - dividable4 == 1 and dividable2 == 9)  else "No")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
four = 0
two = 0 
for e in A:
    if e%4 == 0:
        four += 1
    elif e %2 == 0:
        two += 1
value = four * 3 + (two//2)*2
if value >= N:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

for e in A:
  if e % 4 == 0:
    four += 1
  elif e % 2 == 0:
    two += 1
if (four*2+two)>=(N-1):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

if a.count(2)>=2:
    two_cnt=1
else:
    two_cnt=0

other_cnt=len([i for i in a if i % 2 != 0])
four_cnt=len([i for i in a if i % 4 == 0])
if two_cnt==0:
    if other_cnt<=four_cnt+1:
        print('Yes')
    else:
        print('No')
else:
    if other_cnt<=four_cnt:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

if 2 in a:
    two_cnt=1
else:
    two_cnt=0

other_cnt=len([i for i in a if i % 2 != 0])
four_cnt=len([i for i in a if i % 4 == 0])

if two_cnt==0:
    if other_cnt<=four_cnt+1:
        print('Yes')
    else:
        print('No')
else:
    if other_cnt<=four_cnt:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

if 2 in a:
    two_cnt=1
else:
    two_cnt=0

other_cnt=len([i for i in a if i % 2 != 0])
four_cnt=len([i for i in a if i % 4 == 0])

if four_cnt+1>=two_cnt+other_cnt:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

if a.count(2)>=2:
    N=N-a.count(2)+1

four_cnt=len([i for i in a if i % 4 == 0])

if four_cnt>=N//2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

if 2 in a:
    N=N-a.count(2)+1

four_cnt=len([i for i in a if i % 4 == 0])

if four_cnt>=N//2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

count = 0
for a in range(len(A)):
    if A[a]%4==0:
        count = count + 1

if N<3:
    if count>=1:
        print("Yes")
        sys.exit()
    else:
        print("No")
        sys.exit()

num4 = (N//3)
if (N%3)!=0:
    num4 = num4 + 1

if num4<=count:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

k0 = 0
k2 = 0
k4 = 0

for a in A:
  if a%4==0:
    k4 += 1
  elif a%2==0:
    k2 += 1
  else:
    k0 += 1
print(k4,k2,k0)
# 2で割り切れるものをひとまとめにしk0としてみなす
if k2 > 0:
  k0 += 1

if k0 > k4+1:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
cnta = 0
cntb = 0

for i in range(n):
    if a[i]%4 == 0:
        cnta += 1
    elif a[i]%2 == 0:
        cntb += 1

if 2*cnta >= n or 2*cnta + cntb-1 >= n-1:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
cnta = 0
cntb = 0

for i in range(n):
    if a[i]%4==0:
        cnta += 1
    elif a[i]%2 == 0:
        cntb += 1
else:
    if cntb == 1:
        cntb = 0
        
if cnta*3+cntb >= n:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
cnt = 0
st = 0

for i in range(n):
    if a[i]%4==0:
        cnt += 3
    elif a[i]%2 == 0:
        if st != 0:
            cnt += 1
        st = 1

if cnt >= n:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

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

li = [0,0]

for i in range(n):
    if a[i]%4 == 0:
        li[0] += 1
    elif a[i]%2 == 1:
        li[1] += 1

if li[0] >= li[1]-1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

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

li = [0,0]

for i in range(n):
    if a[i]%4 == 0:
        li[0] += 1
    elif a[i]%2 == 1:
        li[1] += 1

if li[0] >= li[1]+1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
bbn=1000000007
	
#+++++
		
def main():
	n = int(input())
	al = list(map(int, input().split()))
	
	b4=0
	odd=0
	for v in al:
		if v % 4 == 0:
			b4+=1
		elif v % 2 == 1:
			odd+=1
	ret = 'Yes' if b4 >= odd else 'No'
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Wrong Answer

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

m = len(list(filter(lambda x: x%4 == 0, a)))
m += len(list(filter(lambda x: x == 2, a)))//2
m += len(list(filter(lambda x: x%4 != 0 and x != 2 and x%2 == 0, a)))//2

print("Yes" if abs((n-m) - m) <= 1 else "No")

Submission status: Wrong Answer

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

numofmuls = len(list(filter(lambda x: x%4 == 0, a)))
print("Yes" if abs((n-numofmuls) - numofmuls) <= 1 else "No")

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
input = sys.stdin.readline
N = int(input())
a = [int(x) for x in input().split()]
a = np.array(a)
a_o = np.count_nonzero(a % 2 == 1)
a_4 = np.count_nonzero(a % 4 == 0)
if a_o == 1 and a_4 == 0:
    print("No")
    sys.exit()
if a_o == 2 and a_4 == 1 and N == 3:
    print("Yes")
    sys.exit()
if a_o == 2 and a_4 < 2:
    print("No")
    sys.exit()
if a_o >= 3 and a_4 < a_o:
    print("No")
    sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
input = sys.stdin.readline
N = int(input())
a = [int(x) for x in input().split()]
a = np.array(a)
a_o = np.count_nonzero(a % 2 == 1)
a_4 = np.count_nonzero(a % 4 == 0)
if a_o == 1 and a_4 == 0:
    print("No")
    sys.exit()
if a_o == 2 and a_4 == 1 and N == 3:
    print("Yes")
    sys.exit()
if a_o == 2 and a_4 < 2:
    print("No")
    sys.exit()
if a_o >= 3 and a_4 < 2 + (a_o - 2) * 2:
    print("No")
    sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
input = sys.stdin.readline
N = int(input())
a = [int(x) for x in input().split()]
a = np.array(a)
a_o = np.count_nonzero(a % 2 == 1)
a_4 = np.count_nonzero(a % 4 == 0)
if a_o == 1 and a_4 == 0:
    print("No")
    sys.exit()
if a_o == 2 and a_4 == 1 and N == 3:
    print("Yes")
    sys.exit()
if a_o == 2 and a_4 < 2:
    print("No")
    sys.exit()
if a_o > 3 and a_4 < 2 + (a_o - 2) * 2:
    print("No")
    sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
four = 0
two = 0
for i in range(N):
    if a[i] % 4 == 0:
        four += 1
    if a[i] == 2:
        two += 1

if two == N:
    print('Yes')
    exit()
two = two // 2
if four>0 and two>0:
    four += two
if four >= N // 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
four = 0
two = 0
for i in range(N):
    if a[i] % 4 == 0:
        four += 1
    if a[i] == 2:
        two += 1

if two == N:
    print('Yes')
    exit()
two = two // 2
if four>0 and two>0:
    four += four + two
if four >= N // 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
four = 0
two = 0
for i in range(N):
    if a[i] % 4 == 0:
        four += 1
    if a[i] == 2:
        two += 1

if two == N:
    print('Yes')
    exit()
count = 0
two = two // 2
if four>0 and two>0:
    count += four + two
if count >= N // 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
four = 0
two = 0
for i in range(N):
    if a[i] % 4 == 0:
        four += 1
    if a[i] == 2:
        two += 1
two = two // 2
if two>0:
    four += four + two
if four >= N // 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = tuple(map(lambda num: format(int(num), "b")[::-1].index("1"), input().split()))
n2 = A.count(2)

print("Yes" if n2 * 2 >= N - N % 2 or sum(A) >= N else "No")

Submission status: Wrong Answer

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

cnt_of_4 = 0
cnt_of_2 = 0
for i in range(N):
    if a[i] % 4 == 0:
        cnt_of_4 += 1
    elif a[i] == 2:
        cnt_of_2 += 1

if cnt_of_4 >= N//2 or cnt_of_4 *2 + cnt_of_2 >= N:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

cnt_of_4 = 0
cnt_of_2 = 0
cnt_of_1 = 0
for i in range(N):
    if a[i] % 4 == 0:
        cnt_of_4 += 1
    elif a[i] == 2:
        cnt_of_2 += 1
    else:
        cnt_of_1 += 1

if cnt_of_4 >= N//2:
    print('Yes')
else:
    if cnt_of_4 < cnt_of_1:
        print('No')
        exit()
    if cnt_of_4 > cnt_of_1:
        cnt_of_2 -= (cnt_of_4-cnt_of_1)
    if cnt_of_4 * 2 + ((cnt_of_2//2)*2) >= N:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

cnt_of_4 = 0
cnt_of_2 = 0
cnt_of_1 = 0
for i in range(N):
    if a[i] % 4 == 0:
        cnt_of_4 += 1
    elif a[i] == 2:
        cnt_of_2 += 1
    else:
        cnt_of_1 += 1

if cnt_of_4 >= N//2:
    print('Yes')
else:
    if cnt_of_4 > cnt_of_1:
        cnt_of_2 -= cnt_of_4-cnt_of_1
    if cnt_of_4 * 2 + ((cnt_of_2//2)*2) >= N:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

cnt_of_4 = 0
cnt_of_2 = 0
for i in range(N):
    if a[i] % 4 == 0:
        cnt_of_4 += 1
    elif a[i] == 2:
        cnt_of_2 += 1

cnt = cnt_of_4 * 2 + (cnt_of_2//2*2)

if cnt_of_4 == N//2:
    print('Yes')
elif cnt_of_4*2 + (cnt_of_2//2*2) >= N:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
odd, four = 0, 0
for i in range(N):
  if A[i] % 4 == 0:
    four += 1
  else:
    if A[i] % 2 == 1:
      odd += 1
if four < odd and four + odd < N and abs(four - odd) != 1:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
odd, four = 0, 0
for i in range(N):
  if A[i] % 4 == 0:
    four += 1
  else:
    if A[i] % 2 == 1:
      odd += 1
if four < odd and four + odd < N:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

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

need = N // 2
ctr_4 = 0
ctr_2 = 0

for a in A:
	if a % 4 == 0:
		ctr_4 += 1
	elif a % 2 == 0:
		ctr_2 += 1
		
if N % 2 == 0:
	ctr_2 += 2
		
# print(ctr_4, ctr_2)

if ctr_2 // 3 + ctr_4 >= need:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

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

need = N // 2
ctr_4 = 0
ctr_2 = 0

for a in A:
	if a % 4 == 0:
		ctr_4 += 1
	elif a % 2 == 0:
		ctr_2 += 1
		
if N % 2 == 0:
	ctr_2 += 1
		
# print(ctr_4, ctr_2)

if ctr_2 // 3 + ctr_4 >= need:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

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

bine1 = 0
bine4 = 0

for a in al:
    if a % 4 == 0:
        bine4 += 1
    if a % 2 != 0:
        bine1 += 1

if bine4 == 0 and bine1 > 0:
    print("No")
elif bine4 + 1 >= bine1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

bine1 = 0
bine4 = 0

for a in al:
    if a % 4 == 0:
        bine4 += 1
    if a % 2 != 0:
        bine1 += 1

if bine4 + 1 >= bine1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
a=[int(i) for i in input().split()]
c=collections.Counter(a)
one_count=0
four_count=0
exist_two=False
for num,x in c.items():
    if(num==2):
        exist_two=True
    elif(num%4==0 and num!=0):
        four_count+=x
    else:
        one_count+=x
 
if(exist_two):
    if(one_count <= four_count):
        print('Yes')
    else:
        print('No')
else:
    if(one_count <= four_count+1):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
a=[int(i) for i in input().split()]
c=collections.Counter(a)
one_count=0
four_count=0
exist_two=False
for num,x in c.items():
    if(num==2):
        exist_two=True
    elif(num%4==0):
        four_count+=x
    else:
        one_count+=x

if(exist_two):
    if(one_count <= four_count):
        print('Yes')
    else:
        print('No')
else:
    if(one_count <= four_count+1):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
a=[int(i) for i in input().split()]
c=collections.Counter(a)
count=0
for num,x in c.items():
    if(num==2):
        count+=x//2
    elif(num%4==0):
        count+=x

if(count>=len(a)//2):
    print('Yes')
    exit()
else:
    print('No')
    exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
j=0
k=0
l=0
for i in a:
  if i%4==0:
    l+=1
  elif i%2==0:
    k+=1
  else:
    j+=1
if l==j :
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n = int(input())
    aa = LI()
    c4 = c2 = 0
    for a in aa:
        if a % 4 == 0:
            c4 += 1
        elif a % 2 == 0:
            c2 += 1
    max_len = 0
    if c4 > 0: max_len += c4 * 2 + 1
    if c2 > 1: max_len += c2
    if n <= max_len:
        print("Yes")
    else:
        print("No")

main()