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:
N = int(input())
A = list(map(int,input().split()))
X = [0,0,0]

for i in range(len(A)):
  if A[i]%4 == 0:
    X[2] += 1
  elif A[i]%2 == 0:
    X[1] += 1
  else:
    X[0] += 1

if 2*X[2] + X[1] >= N:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
ans4 = 0
ans2 = 0
for a in A:
  if a % 4 == 0:
    ans4 += 1
  elif a % 2 == 0:
    ans2 += 1
if ans2 == 1:
  ans2 = 0
if (n-ans2)//2 <= ans4:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
ans4 = 0
ans2 = 0
for a in A:
  if a % 4 == 0:
    ans4 += 1
  elif a % 2 == 0:
    ans2 += 1
if ans2 == 1:
  ans2 = 0
if ans4 * 3 + ans2 >= n:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
ans4 = 0
ans2 = 0
for a in A:
  if a % 4 == 0:
    ans4 += 1
  elif a % 2 == 0:
    ans2 += 1
if ans4 * 3 + max(0,ans2 - 1) >= n:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
ans4 = 0
ans2 = 0
for a in A:
  if a % 4 == 0:
    ans4 += 1
  elif a % 2 == 0:
    ans2 += 1
if ans4 * 3 + ans2 - 1 >= n:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
ans4 = 0
ans2 = 0
for a in A:
  if a % 4 == 0:
    ans4 += 1
  elif a % 2 == 0:
    ans2 += 1
if ans4 * 3 + ans2//2 >= n:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

d = defaultdict(int)
d=[0]*3
n = int(input())

for i in list(map(int, input().split())):
  if i % 4 == 0:
    d[2] += 1
  elif i % 2 == 0:
    d[1] += 1
  else:
    d[0] += 1
if (d[2] == 0 and d[0] != 0) or (d[0] > d[2] + 1):
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

d = defaultdict(int)
d=[0]*3
n = int(input())

for i in list(map(int, input().split())):
  if i % 4 == 0:
    d[2] += 1
  elif i % 2 == 0:
    d[1] += 1
  else:
    d[0] += 1
if d[0] > d[2] + 1:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n = i_input()
    a = i_list()

    one = 0
    b = []
    for i in a:
        if i %2 == 0:
            one += 1
            b.append(i//2)
    two = 0
    for i in b:
        if i % 2 == 0:
            two += 1
    zero = n - one
    if zero <= two:
        print("Yes")
    else:
        print("No")







if __name__=="__main__":
    main()

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
    elif a[i] % 2 == 0:
        two += 1

if four + two // 3 >= n // 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int, input().split()))
x = 0
y = 0
for i in a:
    if i %2 != 0:
        x+=1
    elif i%4 == 0:
        y+=1
if y >=x:
    print('Yes')
else:
    if x+y == len(a):
        if y == x-1:
            print('Yes')
print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int, input().split()))
x = 0
y = 0
for i in a:
    if i %2 != 0:
        x+=1
    elif i%4 == 0:
        y+=1
if y >=x-1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-09-04 15:44:42 +0900
# LastModified: 2020-09-13 16:01:33 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    n = int(input())
    A = list(map(int, input().split()))
    A_4 = [x for x in A if x % 4 == 0]
    A_2 = [x for x in A if x % 4 != 0 and x % 2 == 0]
    A_0 = [x for x in A if x % 2 != 0]
    if len(A_2) == 0 and len(A_0) <= len(A_4) + 1:
        print("Yes")
    elif len(A_2) % 2 == 0 and len(A_0) <= len(A_4):
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
one=0
four=0
two=0
for i in range(n):
    cnt=0
    num=a[i]
    while num%2==0:
        cnt+=1
        num//=2
    if cnt==0:
        pin=1
    elif cnt==1:
        pin=2
    else:
        pin=4
    if pin==1:
        one+=1
    elif pin==4:
        four+=1
    else:
        two+=1
if two>0:
    one+=1
if abs(one-four)<=1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
one=0
four=0
for i in range(n):
    cnt=0
    num=a[i]
    while num%2==0:
        cnt+=1
        num//=2
    if cnt==0:
        pin=1
    elif cnt==1:
        pin=2
    else:
        pin=4
    if pin==1:
        one+=1
    elif pin==4:
        four+=1
if abs(one-four)<=1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
one=0
four=0
for i in range(n):
    cnt=0
    num=a[i]
    while num%2==0:
        cnt+=1
        num//=2
    if cnt==0:
        pin=1
    elif cnt==1:
        pin=2
    else:
        pin=4
    if pin==1:
        one+=1
    elif pin==4:
        four+=1
if one==four:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

num2 = 0
num4 = 0
odd = 0
for i in a:
    if i % 4 == 0:
        num4 += 1
        continue
    elif i % 2 == 0:
        num2 += 1
        continue
    else:
        odd += 1
        continue
if odd<num4 or (N%2==1 and num4==N//2):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#
# abc069 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
1 10 100"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4
1 2 3 4"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """3
1 4 1"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """2
1 1"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """6
2 7 1 8 2 8"""
        output = """Yes"""
        self.assertIO(input, output)


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

    Q = 0
    E = 0
    O = 0
    for a in A:
        if a % 4 == 0:
            Q += 1
        elif a % 2 == 0:
            E += 1
        else:
            O += 1

    if (N-2*Q) == 1 or N-2*Q == E:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    n_odd = 0
    n_4mul = 0
    n_2mul = 0
    for a in A:
        if a % 2 == 1:
            n_odd += 1
        elif a % 4 == 0:
            n_4mul += 1
        else:
            n_2mul += 1
    if n_odd <= n_4mul and n_2mul > 0:
        print('Yes')
    elif n_odd == n_4mul + 1 and n_2mul == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
input()
a = list(map(int, input().split(' ')))
def solve(a):
    for i in range(len(a)):
        for j in range(len(a)):
            if i != j:
                if (a[i] + a[j]) % 4 == 0:
                    return 'Yes'
    return 'No'
print(solve(a))

Submission status: Wrong Answer

Solution code:
input()
a = list(map(int, input().split(' ')))
def solve(a):
    for i in range(len(a)):
        for j in range(len(a)):
            if i != j:
                if (a[i] + a[j]) % 4 == 0:
                    return 'YES'
    return 'NO'
print(solve(a))

Submission status: Wrong Answer

Solution code:
N = int(input())
lsa = list(map(int,input().split()))
ans = 'Yes'
i4 = 0
i2 = 0
i1 = 0
for i in range(N):
    if lsa[i] % 4 == 0:
        i4 += 1
    elif lsa[i] % 2 == 0:
        i2 += 1
    else:
        i1 += 1
if i4+1 < i1:
    ans = 'No'
else:
    if i2 == 1:
        if i4+1 == i1:
            ans = 'No'
        else:
            pass
    else:
        pass
print(ans)

Submission status: Wrong Answer

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

odd_num = 0
four_num = 0
two_num = 0
cnt = len(arr) - four_num
for e in arr:
    if e % 2 != 0:
        odd_num += 1
    if e == 2:
        two_num += 1
    if e % 4 == 0:
        four_num += 1
if two_num > 0: two_num = 1

print("Yes" if four_num >= odd_num + two_num - 1 else "No")

Submission status: Wrong Answer

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

odd_num = 0
four_num = 0
for e in arr:
    if e % 2 != 0:
        odd_num += 1
    if e % 4 == 0:
        four_num += 1

print("Yes" if four_num >= odd_num-1 else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
num4 = 0
num2 = 0
num0 = 0
for i in a:
    if i%4 == 0:
        num4 += 1
    elif i%2 == 0:
        num2 += 1
    else:
        num0 += 1
if num4 == 1 and num0 + num2 <= num4 + 1:
    print('Yes')
elif 2 <= num4 and num0 <= num4:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b,c,d=0,0,0
for i in a:
    if i%4==0:
        b+=1
    elif i%2==0:
        c+=1
    else:
        d+=1
if b+c/2.0001>=d-1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b,c=0,0
for i in a:
    if i%4==0:
        b+=1
    elif i%2==0:
        c+=1
if b+c/2.0001>=(len(a)-1)/2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b,c=0,0
for i in a:
    if i%4==0:
        b+=1
    elif i%2==0:
        c+=1
if b+c/2.01>=(len(a)-1)/2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
x=0
y=0
c=0
for i in range(n):
    if(l[i]%4==0):
        x+=1
    elif(l[i]%2==0):
        y+=1
    else:
        c+=1
if(n%2==0):
    if(x>=c):
        print("Yes")
    else:
        print('No')
else:
    if(x>(c-1)):
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
x=0
for i in range(n):
    if(l[i]%4==0):
        x+=1
if(n%2==0):
    if(x==n//2):
        print("Yes")
    else:
        print('No')
else:
    if(x==n//2 or x==(n-n//2)):
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = list(map(int, input().split()))
num_4_multi = len(arr) // 2
cnt4 = len([i for i in arr if i % 4 == 0])
cnt2 = len([i for i in arr if i % 2 == 0])
cnt8 = len([i for i in arr if i % 8 == 0])
cnt = cnt2 - cnt4 + cnt8
if len(arr) % 2 == 0:
    cnt += arr.count(2) // 2
else:
    cnt += arr.count(2) / 3
if num_4_multi <= cnt: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = list(map(int, input().split()))
num_4_multi = len(arr) // 2
cnt = len([i for i in arr if i % 4 == 0])
if len(arr) % 2 == 0:
    cnt += arr.count(2) // 2
else:
    cnt += arr.count(2) / 3
if num_4_multi <= cnt: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = list(map(int, input().split()))
num_4_multi = len(arr) // 2
cnt = len([i for i in arr if i % 4 == 0])
if len(arr) % 2 == 0:
    cnt += arr.count(2) // 2
else:
    cnt += arr.count(2) // 3
if num_4_multi <= cnt: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = list(map(int, input().split()))
num_4_multi = len(arr) // 2
cnt = len([i for i in arr if i % 4 == 0])
if len(arr) % 2 == 0:
    cnt += arr.count(2) // 2
if num_4_multi <= cnt: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = list(map(int, input().split()))
num_4_multi = len(arr) // 2
cnt = len([i for i in arr if i % 4 == 0])
cnt += arr.count(2) // 2
if num_4_multi <= cnt: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(x) for x in input().split()]
cnt4 = 0
cnt2 = 0
for x in a:
    if x % 4 == 0:
        cnt4 += 1
        continue
    if x % 2 == 0:
        cnt2 += 1
cnt2 = cnt2//2*2
if N-cnt2 > 2*cnt4:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(x) for x in input().split()]
cnt4 = 0
cnt2 = 0
for x in a:
    if x % 4 == 0:
        cnt4 += 1
        continue
    if x % 2 == 0:
        cnt2 += 1

if N-cnt2 > 2*cnt4:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

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

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

if n2 == n or n4 >= n//2 or n2+n4 > n//2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().rstrip().split(" ")))
counter = [0,0,0]
for i in a:
    if i % 4 == 0:
        counter[2] += 1
    elif i % 2 == 0:
        counter[1] += 1
    else:
        counter[0] += 1
if(counter[2] != 0): counter[1] +=1
p = (max(counter[1] - 1,0)) + (counter[2] + 1)

if p >= counter[0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().rstrip().split(" ")))
counter = [0,0,0]
for i in a:
    if i % 4 == 0:
        counter[2] += 1
    elif i % 2 == 0:
        counter[1] += 1
    else:
        counter[0] += 1
p = (max(counter[1] - 1,0)) + (counter[2] + 1)

if p >= counter[0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().rstrip().split(" ")))
counter = [0,0,0]
for i in a:
    if i % 4 == 0:
        counter[2] += 1
    elif i % 2 == 0:
        counter[1] += 1
    else:
        counter[0] += 1

if counter[1] == 1:
    counter[1] = 0
    counter[0] += 1
p = (max(counter[1] - 1,0)) + counter[2] * 2
if p >= counter[0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().rstrip().split(" ")))
counter = [0,0,0]
for i in a:
    if i % 4 == 0:
        counter[2] += 1
    elif i % 2 == 0:
        counter[1] += 1
    else:
        counter[0] += 1
p = (max(counter[1] - 1,0)) + counter[2] * 2
if p >= counter[0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().rstrip().split(" ")))
counter = [0,0,0]
for i in a:
    if i % 4 == 0:
        counter[2] += 1
    elif i % 2 == 0:
        counter[1] += 1
    else:
        counter[0] += 1
if (counter[1] - 1) + counter[2] * 1 >= counter[0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

x = 0
y = 0
z = 0
for i in a:
  if i%4 == 0: x += 1
  elif i == 2: y = 1
  else: z += 1

if y+z-1 <= x: print("Yes")
else: print("No")

Submission status: Wrong Answer

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

x = 0
y = 0
z = 0
for i in a:
  if i%4 == 0: x += 1
  elif i == 2: y += 1
  else: z += 1

if y%2+z-1 <= x: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
import sys

n=int(input())
a=[int(x) for x in input().rstrip().split()]

even=0
odd=0
num4=0
for i in a:
  if i%4==0:
    num4+=1
    continue

  elif i%2==0:
    even+=1
  else:
    odd+=1


if odd-1<=num4:
  print("Yes")
else:
  if odd==0 and 2<=even:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

n=int(input())
a=[int(x) for x in input().rstrip().split()]

even=0
odd=0
num4=0
for i in a:
  if i%4==0:
    num4+=1
    continue

  elif i%2==0:
    even+=1
  else:
    odd+=1

if odd<=num4:
  print("Yes")
else:
  if even==0 and num4!=0:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int, input().split()))
count = []
for i in A:
    if i%4 == 0:
        count.append("4")
    elif i%2 == 0:
        count.append("2")
    else:
        count.append("1")
B1 = count.count("4")
B2 = count.count("1") + math.ceil(count.count("2")/2)
print("Yes" if B1+1 >= B2 else "No")

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    inlis = list(map(int, input().split()))

    num2 = 0
    num4 = 0

    for i in range(n):
        a = inlis[i]
        if a % 4 == 0:
            num4 += 1
        elif a % 2 == 0:
            num2 += 1
    if n <= 3:
        if num4 >=1:
            print('Yes')
        elif num2 == n:
            print('Yes')
        else:
            print('No')
    else:
        if num2 + (2*num4) >= n:
            print("Yes")
        else:
            print('No')





if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    inlis = list(map(int, input().split()))

    num2 = 0
    num4 = 0

    for i in range(n):
        a = inlis[i]
        if a % 4 == 0:
            num4 += 1
        elif a % 2 == 0:
            num2 += 1
    if n <= 3:
        if num4 >=1:
            print('Yes')
        elif num2 == n and n > 1:
            print('Yes')
        else:
            print('No')
        exit()
    if num2 + (2*num4) >= n:
        print("Yes")
    else:
        print('No')

    

    
        






if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    inlis = list(map(int, input().split()))

    num2 = 0
    num4 = 0

    for i in range(n):
        a = inlis[i]
        if a % 4 == 0:
            num4 += 1
        elif a % 2 == 0:
            num2 += 1
    if n <= 3:
        if num4 >=1:
            print('Yes')
        elif num2 == n:
            print('Yes')
        else:
            print('No')
        exit()
    if num2 + (2*num4) >= n:
        print("Yes")
    else:
        print('No')

    

    
        






if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
##
N = int(input())
N_List = list(map(int,input().split()))
Four_List = [i for i in N_List if i % 4 == 0]
Two_List = [i for i in N_List if i % 2 == 0]
if len(Two_List) > 0:
    N = N - (len(Two_List) - len(Four_List)) + 1

if N // 2 <= len(Four_List):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
##
N = int(input())
N_List = list(map(int,input().split()))
Four_List = [i for i in N_List if i % 4 == 0]
Two_List = [i for i in N_List if i % 2 == 0]
if len(Two_List) > 0:
    N = N - (len(Two_List) - len(Four_List)) 

if N // 2 <= len(Four_List):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int,input().split()))
lis = []
x = 0
y = 0
z = 0
for i in range(n):
    if li[i] % 4 == 0:
        x += 1
    elif li[i] % 2 == 0:
        y = 1
    else:
        z += 1
if y == 0:
    if x >= z + 1:
        print("Yes")
    else:
        print("No")
else:
    if x >= z:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int,input().split()))
lis = []
x = 0
y = 0
z = 0
for i in range(n):
    if li[i] % 4 == 0:
        x += 1
    elif li[i] % 2 == 0:
        y = 1
    else:
        z += 1
if y == 0:
    if x >= y + 1:
        print("Yes")
    else:
        print("No")
else:
    if x >= y:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int,input().split()))
lis = []
x = 0
y = 0
for i in range(n):
    if li[i] % 4 == 0:
        x += 1
    elif li[i] % 2 != 0:
        y += 1
if x >= y:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

isYes = False
if n//2<=count_4:
    isYes = True
else:
    tmp = n//2 - count_4
    if n%2==1:
        if tmp * 3 <= (count_2 - count_4):
            isYes = True
    else:
        if (tmp - 1) * 3 + 2 <= (count_2 - count_4):
            isYes = True

if isYes:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = math.floor(N/2)
if a <= four:
  print("Yes")
elif a-two <= 2*four:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = math.floor(N/2)
if a <= four:
  print("Yes")
elif a-2*two <= four:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = math.floor(N/2)
if a <= four:
  print("Yes")
elif a-four <= two*2:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = math.floor(N/2)
if a <= four:
  print("Yes")
elif a-two <= four:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = N/2
if a <= four+1:
  print("Yes")
elif a-two <= four+1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

four = 0
two = 0

for i in range(len(A)):
  if A[i]%4 == 0:
    four += 1
  if A[i]%2 == 0:
    two += 1
n = math.floor(N/2)
x = (n - four) * 2

# print(four, two, n, x)
if four >= n:
  print("Yes")
elif two >= x:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = math.floor(N/2)
if a <= four+1:
  print("Yes")
elif a-two <= four+1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
lll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
  if A[i]%2 != 0:
    lll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = N/2
b = A.count(0)

if a <= four and b == 0:
  print("Yes")
elif a-two <= four:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
lll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
  if A[i]%2 != 0:
    lll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = math.floor(N/2)
b = A.count(0)

if zero <= four and b == 0:
  print("Yes")
elif zero-two <= four:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
lll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
  if A[i]%2 != 0:
    lll.append(A[i])
four = len(l)
two = four - len(ll)
zero = N-two
a = math.floor(N/2)
b = A.count(0)

if zero <= four and b == 0:
  print("Yes")
elif zero-two <= four:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
four = len(l)

a = math.ceil(N/3)
b = A.count(0)

if a <= four and b == 0:
  print("Yes")
elif N == len(ll) and b ==0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
four = len(l)

a = math.ceil(N/3)
b = A.count(0)

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
four = len(l)

a = math.ceil(N/3)

if a <= four:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
four = 0
two = 0
for i in range(n):
    if A[i]%4 == 0:
        four += 1
    elif A[i]%2 == 0:
        two += 1
a = 0
a += four *2
if two <= 1:
    a += 0
else:
    a += (two + 1)//2
print('Yes' if (n-1) <= a else 'No')

Submission status: Wrong Answer

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
four = 0
two = 0
for i in range(n):
    if A[i]%4 == 0:
        four += 1
    elif A[i]%2 == 0:
        two += 1
print('Yes' if (n-1) <= four * 2 + (two+1//2) else 'No')

Submission status: Wrong Answer

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
four = 0
two = 0
for i in range(n):
    if A[i]%4 == 0:
        four += 1
    elif A[i]%2 == 0:
        two += 1
print('Yes' if (n-1) <= four * 2 + two//2 else 'No')

Submission status: Wrong Answer

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
four = 0
two = 0
for i in range(n):
    if A[i]%4 == 0:
        four += 1
    elif A[i]%2 == 0:
        two += 1
print('Yes' if n <= four * 3 + two//2 * 2 else 'No')