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())
al = list(map(int, input().split()))
a_2 = 0
a_4 = 0
a_not4 = 0

for a in al:
    if a % 4 == 0:
        a_4 += 1
    elif a == 2:
        a_2 += 1
    else:
        a_not4 += 1

if a_2 % 2 == 0:
    if a_not4 <= a_4 + 1:
        print('Yes')
    else:
        print('No')
else:
    if a_not4 <= a_4:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
al = list(map(int, input().split()))
a_2 = 0
a_4 = 0
a_not4 = 0

for a in al:
    if a % 4 == 0:
        a_4 += 1
    elif a == 2:
        a_2 += 1
    else:
        a_not4 += 1

if n % 2 == 0:
    if a_4 + 1 >= a_not4 + a_2 % 2:
        print('Yes')
    else:
        print('No')
elif a_2 == n:
    print('Yes')
else:
    if a_4 != 0 or a_4 + 1 >= a_not4 + a_2 % 2:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
al = list(map(int, input().split()))
a_2 = 0
a_4 = 0
a_not4 = 0

for a in al:
    if a % 4 == 0:
        a_4 += 1
    elif a == 2:
        a_2 += 1
    else:
        a_not4 += 1

if n % 2 == 0:
    if a_4 >= a_not4 + a_2 % 2:
        print('Yes')
    else:
        print('No')
elif a_2 == n:
    print('Yes')
else:
    if a_4 != 0 or a_4 >= a_not4 + a_2 % 2:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
al = list(map(int, input().split()))
a_2 = 0
a_4 = 0
a_not4 = 0

for a in al:
    if a % 4 == 0:
        a_4 += 1
    elif a == 2:
        a_2 += 1
    else:
        a_not4 += 1

if n % 2 == 0:
    if a_4 >= a_not4 + a_2 % 2:
        print('Yes')
    else:
        print('No')
else:
    if a_4 != 0 or a_4 >= a_not4 + a_2 % 2:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
al = list(map(int, input().split()))
a_2 = 0
a_4 = 0
a_not4 = 0

for a in al:
    if a % 4 == 0:
        a_4 += 1
    elif a == 2:
        a_2 += 1
    else:
        a_not4 += 1

if n % 2 == 0:
    if a_4 >= a_not4 - a_2//2:
        print('Yes')
    else:
        print('No')
else:
    if a_4 == a_not4 - a_2//2 - 1 or a_4 > a_not4 - a_2//2:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
al = list(map(int, input().split()))
a_2 = 0
a_4 = 0
a_not4 = 0

for a in al:
    if a % 4 == 0:
        a_4 += 1
    elif a == 2:
        a_2 += 1
    else:
        a_not4 += 1

if n % 2 == 0:
    if (a_4 + a_2//2) >= a_not4:
        print('Yes')
    else:
        print('No')
else:
    if (a_4 + a_2//2 + 1) == a_not4 or (a_4 + a_2//2) > a_not4:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    mul4 = len([a for a in A if a % 4 == 0])
    mul2 = len([a for a in A if a % 4 != 0 and a % 2 == 0])
    less = N - 3*mul4
    if less <= 0:
        print("Yes")
    elif less == 1 and 2 <= mul2:
        print("Yes")
    elif 2 <= less <= mul2:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    mul4 = len([a for a in A if a % 4 == 0])
    mul2 = len([a for a in A if a % 4 != 0 and a % 2 == 0])
    less = N - 3*mul4
    print(mul4, mul2, less)
    if less <= 0:
        print("Yes")
    elif less == 1 and 2 <= mul2:
        print("Yes")
    elif 2 <= less <= mul2:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    mul4 = len([a for a in A if a % 4 == 0])
    mul2 = len([a for a in A if a % 4 != 0 and a % 2 == 0])
    less = N - 3*mul4
    if less <= 0:
        print("Yes")
    elif less == 1 and 2 <= mul2:
        print("Yes")
    elif less <= mul2:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

cnt=[0,0]#2,4の倍数の個数
for i in a:
    if i%4==0:
        cnt[1]+=1
    elif i%2==0:
        cnt[0]+=1
ans=cnt[1]*3
if cnt[0]>=2:
    ans+=cnt[0]

print('Yes' if ans>=n else 'No')

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    mul4 = len([a for a in A if a % 4 == 0])
    mul2 = len([a for a in A if a % 4 != 0 and a % 2 == 0])
    less = N - 3*mul4
    if less <= 0 or mul2 >= max(less, 2):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
t = 0
f = 0
for x in a:
  if x % 4 == 0: f += 1
  elif x % 2 == 0: t += 1
if N == 1:
  if f: print("Yes")
  else: print("No")
  exit(0)
if N == t:
  print("Yes")
  exit(0)
if -(-(N - (t // 2) - 1) // 2) <= f: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
t = 0
f = 0
for x in a:
  if x % 4 == 0: f += 1
  elif x % 2 == 0: t += 1
if N == 1:
  if f: print("Yes")
  else: print("No")
  exit(0)
if N == t:
  print("Yes")
  exit(0)
if (N - (t // 2)) // 2 <= f: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
t = 0
f = 0
for x in a:
  if x % 4 == 0: f += 1
  elif x % 2 == 0: t += 1
if N == 1:
  if f: print("Yes")
  else: print("No")
  exit(0)
if (N - (t // 2)) // 2 <= f: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
バケットで管理したかったけど数字が多いのでソートして同じ数を固めることに
"""
#solution:
#潜 影 蛇 手 ! !
N=int(input())
A=[(i%4) for i in pin()]
#print(A)
b=[0]*4
for j in A:
    b[j-1]+=1
#print(b)

print(["No","Yes"][(b[3]-b[0]-b[2]+1>=0)])

Submission status: Wrong Answer

Solution code:

#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
バケットで管理したかったけど数字が多いのでソートして同じ数を固めることに
"""
#solution:
#潜 影 蛇 手 ! !
N=int(input())
A=[(i%4) for i in pin()]
print(A)
b=[0]*4
for j in A:
    b[j-1]+=1
print(b)

print(["No","Yes"][(b[3]-b[0]-b[2]+1>=0)])

Submission status: Wrong Answer

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

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

cnt2 = 0
for i in range(N):
  a = List[i]
  if a%2 == 0:
    cnt2 += 1
cnt2 = int(cnt2 - cnt4)

if cnt2 == 0:
  if cnt4 >= N -cnt4 -1:
    print("Yes")
  else:
    print("No")
else:
  if cnt4-1 >= (N-cnt4) -cnt4-1:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

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

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

cnt2 = 0
for i in range(N):
  a = List[i]
  if a%2 == 0:
    cnt2 += 1
cnt2 = int(cnt2 - cnt4)

if cnt2 == 0:
  if cnt4 > N -cnt4:
    print("Yes")
  else:
    print("No")
else:
  if cnt4-1 > (N-cnt4) -cnt4:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

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

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

cnt2 = 0
for i in range(N):
  a = List[i]
  if a%2 == 0:
    cnt2 += 1
cnt2 = cnt2 - cnt4

if int(N - cnt4*3 - cnt2//2) >= 0:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

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

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

cnt2 = 0
for i in range(N):
  a = List[i]
  if a%2 == 0:
    cnt2 += 1
cnt2 = cnt2 - cnt4

if N - cnt4*3 - cnt2//2 > 0:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
a4 = [i for i in a if i%4 == 0]
a2 = [i for i in a if i%2 == 0]
num4 = len(a4)
num2 = len(a2) - num4
num1 = N-num2-num4
if N == 3 and num1 == 2 and num4 == 1:
    print('Yes')
elif num1 > num4:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 2
    elif a[i] % 2 == 0:
        a[i] = 1
    else:
        a[i] = 0
# print(a)

if a.count(0)+1 if 1 in a else 0 <= a.count(2)+1:
    print('Yes')
    exit(0)
print('No')

Submission status: Wrong Answer

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

for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 2
    elif a[i] % 2 == 0:
        a[i] = 1
    else:
        a[i] = 0
# print(a)
if a.count(1) == 1:
    if a.count(0) <= a.count(2):
        print('Yes')
        exit(0)
    print('No')
    exit(0)
if a.count(2) > 0 and a.count(0) <= a.count(2)+1:
    print('Yes')
    exit(0)
if a.count(0) == 0:
    print('Yes')
    exit(0)
print('No')

Submission status: Wrong Answer

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

for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 2
    elif a[i] % 2 == 0:
        a[i] = 1
    else:
        a[i] = 0
# print(a)
if a.count(1) == 1:
    if a.count(0) <= a.count(2):
        print('Yes')
        exit(0)
    print('No')
    exit(0)
if a.count(2) > 0 and a.count(0) <= a.count(2)+1:
    print('Yes')
    exit(0)
print('No')

Submission status: Wrong Answer

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

for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 2
    elif a[i] % 2 == 0:
        a[i] = 1
    else:
        a[i] = 0
# print(a)
if a.count(1) == 1:
    if a.count(0) <= a.count(2):
        print('Yes')
        exit(0)
    print('No')
    exit(0)
if a.count(0) <= a.count(2)+1:
    print('Yes')
    exit(0)
print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
d4=len([i for i in A if i%4==0])
d2=len([i for i in A if i%2==0 and i%4!=0])

N=N-(d4*2+1)
if N==1 and d2>=2:
    N=0
elif N>=2 and N-d2<=0:
    N=0

print("Yes" if N<=0 else "No")

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
d4=len([i for i in A if i%4==0])
d2=len([i for i in A if i%2==0 and i%4!=0])

N=N-d4*3
if N==1 and d2>=2:
    N=0
elif N>=2 and N-d2<=0:
    N=0

print("Yes" if N<=0 else "No")

Submission status: Wrong Answer

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

# 4の倍数になるものを削除
A_x2 = [a for a in A if a % 4 != 0]
# 4の倍数の要素数を数える
num_x4 = len(A) - len(A_x2)
# 2の倍数になるものを削除
A_x1 = [a for a in A_x2 if a % 2 != 0]

# 奇数と偶数の数を数える
num_odd = len(A_x1)
num_even = len(A_x2) - num_odd

# 
if num_even == 0:
    num_mod = 0
else:
    num_mod = 1

if num_odd + num_mod <= num_x4 * 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

# 4の倍数になるものを削除
A_x2 = [a for a in A if a % 4 != 0]
# 4の倍数の要素数を数える
num_x4 = len(A) - len(A_x2)
# 2の倍数になるものを削除
A_x1 = [a for a in A_x2 if a % 2 != 0]

# 奇数と偶数の数を数える
num_odd = len(A_x1)
num_even = len(A_x2) - num_odd

# 偶数が1個だけなら消去できない（二個以上あれば消せる）
if num_even == 1:
    num_mod = 1
else:
    num_mod = 0

if num_odd + num_mod <= num_x4 * 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

# 4の倍数になるものを削除
A_x2 = [a for a in A if a % 4 != 0]
# 4の倍数の要素数を数える
num_x4 = len(A) - len(A_x2)
# 2の倍数になるものを削除
A_x1 = [a for a in A_x2 if a % 2 != 0]

# 奇数と偶数の数を数える
num_odd = len(A_x1)
num_even = len(A_x2) - num_odd

if num_even >= 2:
    num_mod = 0
else:
    num_mod = 1

if num_odd + num_mod <= num_x4 * 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

# 4の倍数になるものを削除
A_x2 = [a for a in A if a % 4 != 0]
# 4の倍数の要素数を数える
num_x4 = len(A) - len(A_x2)
# 2の倍数になるものを削除
A_x1 = [a for a in A_x2 if a % 2 != 0]

# 奇数と偶数の数を数える
num_odd = len(A_x1)
num_even = len(A_x2) - num_odd

if num_even == 1:
    if num_odd + 1 <= num_x4 * 2:
        print('Yes')
elif num_even >= 2:
    if num_odd <= num_x4 * 2:
        print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

# 4の倍数になるものを削除
A_x2 = [a for a in A if a % 4 != 0]
# 4の倍数の要素数を数える
num_x4 = len(A) - len(A_x2)
# 2の倍数になるものを削除
A_x1 = [a for a in A_x2 if a % 2 != 0]

# 奇数と偶数の数を数える
num_odd = len(A_x1)
num_even = len(A_x2) - num_odd

if (num_odd + num_even%2) <= num_x4 * 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

numbers = [0, 0, 0]

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

print(numbers)
        
if (numbers[1] == 0) and (numbers[2] - numbers[0] <= 1):
    print('Yes')
elif (numbers[1] != 0) and (numbers[0] >= numbers[2]):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#ダメそうな雰囲気する

n=int(input())
amod4=[i%4 for i in map(int,input().split())]
print(amod4)
from collections import Counter
s=Counter(amod4)
num4=s[0]
num2=s[2]

#print(num4,num2,another)

def ok():print("Yes");exit()
def ng():print("No");exit()

if num2==n:
  ok()
  
if num4>=(n-(num2-1)*(n>num2>0))//2:ok()

else:
  ng()

Submission status: Wrong Answer

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

c2=0
c4=0

for i in l:
	if i%4 == 0:
		c4+=1
		
	if i%2 == 0:
		c2+=1
		

c2 = c2-c4

if c2==1:
	if n - (2*c4+1) <=0:
		print('Yes')
	else:
		print('No')
elif c4==0:
	if n==c2:
		print('Yes')
	else:
		print('No')
		
else:
	if n - (2*c4+1 + c2) <= 0:
		print('Yes')
	else:
		print('No')

Submission status: Wrong Answer

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

c2=0
c4=0

for i in l:
	if i%4 == 0:
		c4+=1
		
	if i%2 == 0:
		c2+=1
		

c2 = c2-c4

if c2==1:
	if n - (2*c4+2) <=0:
		print('Yes')
	else:
		print('No')
elif c4==0:
	if n==c2:
		print('Yes')
	else:
		print('No')
		
else:
	if n - (2*c4+2 + c2) <= 0:
		print('Yes')
	else:
		print('No')

Submission status: Wrong Answer

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

c2=0
c4=0

for i in l:
	if i%4 == 0:
		c4+=1
		
	if i%2 == 0:
		c2+=1
		

c2 = c2-c4

if n - (2*c4+1 + c2) <= 0:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
b = list(map(int, input().split()))
ln = []
ln2 =  []
for i in b:
    if i % 4 == 0:
        ln.append(i)
    if i % 2 == 0 and i % 4 != 0:
        ln2.append(i)
if n % 2 == 0:
    if len(ln) >= n//2:
        print('Yes')
    else:
            if n - len(ln) * 2 == len(ln2):
                print('Yes')
 
            else:
                    print('No')
if n % 2 == 1:
    if len(ln) >= (n + 1)//2:
        print('Yes')
    else:
        if n - len(ln) * 2 == len(ln2):
            print('Yes')
        else:
            if n == 3 and len(ln) == 1:
                print('Yes')
            else:
                if n == 5 and len(ln) == 2:
                    print('Yes')
                else:
                    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
b = list(map(int, input().split()))
ln = []
ln2 =  []
for i in b:
    if i % 4 == 0:
        ln.append(i)
    if i % 2 == 0 and i % 4 != 0:
        ln2.append(i)
if n % 2 == 0:
    if len(ln) >= n//2:
        print('Yes')
    else:
            if n - len(ln) * 2 == len(ln2):
                print('Yes')
 
            else:
                    print('No')
if n % 2 == 1:
    if len(ln) >= (n + 1)//2:
        print('Yes')
    else:
        if n - len(ln) * 2 == len(ln2):
            print('Yes')
        else:
            if n == 3 and len(ln) == 1:
                print('Yes')
            else:
                print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
b = list(map(int, input().split()))
ln = []
ln2 =  []
for i in b:
    if i % 4 == 0:
        ln.append(i)
    if i % 2 == 0 and i % 4 != 0:
        ln2.append(i)
if n % 2 == 0:
    print('a')
    if len(ln) >= n//2:
        print('Yes')
    else:
            if n - len(ln) * 2 == len(ln2):
                print('Yes')
 
            else:
                    print('No')
if n % 2 == 1:
    if len(ln) >= (n + 1)//2:
        print('Yes')
    else:
        if n - len(ln) * 2 == len(ln2):
            print('Yes')
        else:
            if n == 3 and len(ln) == 1:
                print('Yes')
            else:
                print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
b = list(map(int, input().split()))
ln = []
ln2 =  []
for i in b:
    if i % 4 == 0:
        ln.append(i)
    if i % 2 == 0 and i % 4 != 0:
        ln2.append(i)
if n % 2 == 0:
    if len(ln) >= n//2:
        print('Yes')
if n % 2 == 1:
    if len(ln) >= (n + 1)//2:
        print('Yes')
elif n - len(ln) * 2 == len(ln2):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

dic = {1:0,2:0,4:0}

for item in List:
  if item % 4 == 0:
    dic[4] +=1
  elif item % 2 == 0:
    dic[2] +=1
  else:
    dic[1] +=1

if dic[4] > dic[1]:
  print('Yes')
elif dic[4] == dic[1] and dic[2] == 0:
  print('Yes')
elif dic[4]+1 == dic[1] + dic[2]:
  print('Yes')
elif dic[4]+2 == dic[1] + dic[2] and dic[2] !=0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
A = [int(i) for i in input().split()]
cnt = 0
cnt1 = 0
for a in A:
  if a%4==0:
    cnt += 1
  elif a==2:
    cnt1 += 1
if int(n/2) <= cnt+(cnt1//2):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

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

ans = 0
# ans = n - fCount * 3 - (tCount // 2) * 2
if tCount > 1:
    #ans = n - fCount * 3 - tCount
    if fCount > 0:
        ans = n - (2 * fCount + 1) - tCount
    else:
        ans = n - tCount
else:
    #ans = n - fCount * 3
    if fCount > 0:
        ans = n - (2 * fCount + 1)
    else:
        ans = n

if ans > 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

cnt4 = sum(map(lambda x: x%4 == 0, a))
cnt2 = a.count(2)
if (n-cnt4)-cnt4 <= 1:
    print("Yes")
elif cnt4 == n:
    print("Yes")
elif cnt2 != 0 and cnt2 >= 2:
    c = cnt4+(cnt2//2)
    if -1 <= (n-c)-c <= 1:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

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

cnt4 = sum(map(lambda x: x%4 == 0, a))
cnt2 = a.count(2)
if -1 <= (n-cnt4)-cnt4 <= 1:
    print("Yes")
elif cnt2 != 0 and cnt2 >= 2:
    c = cnt4+(cnt2//2)
    if -1 <= (n-c)-c <= 1:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int,input().split()))
s2,s4=0,0 #s2は２で割れる数、s4は４で割れる数の個数
for j in L:
  if j%4==0:
    s4+=1
  elif j%2==0:
    s2+=1
print(s2,s4)
if s2==0:
  if (N-s2-s4)<=s4+1:
    print("Yes")
  else:
    print("No")
else:
  if (N-s2-s4)<=s4:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int,input().split()))
s2,s4=0,0 #s2は２で割れる数、s4は４で割れる数の個数
for j in L:
  if j%4==0:
    s4+=1
  elif j%2==0:
    s2+=1
if s2==0:
  if s4==0:
    print("No")
  elif N//2<=s4:
    print("Yes")
  else:
    print("No")
else:
  if s4+s2>=N-2 and s4>0:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int,input().split()))
s2,s4=0,0 #s2は２で割れる数、s4は４で割れる数の個数
for j in L:
  if j%4==0:
    s4+=1
  elif j%2==0:
    s2+=1
if s2==0:
  if s4==0:
    print("No")
  elif N//2<=s4:
    print("Yes")
  else:
    print("No")
else:
  if s4+s2>=N-1 and s4>0:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int,input().split()))
s2,s4=0,0 #s2は２で割れる数、s4は４で割れる数の個数
for j in L:
  if j%4==0:
    s4+=1
  elif j%2==0:
    s2+=1
if s2==0:
  if s4==0:
    print("No")
  elif N//2<=s4:
    print("Yes")
  else:
    print("No")
else:
  if s4+s2==N:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
List = list(map(int,input().split()))
index = [0 for n in range(N)]

for i in range(N):
  if List[i]%4 == 0:
    index[i] = 2
  elif List[i] % 2 == 0:
    index[i] = 1
A = index.count(2)
B = index.count(1)
C = N - A -B
Answer = 'No'
if A >= (B + C - 1):
  Answer = 'Yes'
elif A>=C and B % 2 == 0:
  Answer = 'Yes'
print(Answer)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b2,b4=0,0
for i in range(n):
    if a[i]%4==0:
        b4+=1
    elif a[i]%4==2:
        b2+=1
if (b4*2)+b2>=n:
   print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b2,b4=0,0
for i in range(n):
    if a[i]%4==0:
        b4+=1
    elif a[i]%4==2:
        b2+=1
if (b4*2+1)+b2>=n:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
print('Yes')

Submission status: Wrong Answer

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

odd=0
even=0
even2=0

for num in A:
    if(num%2==1):
        odd+=1
    elif(num%4==0):
        even2+=1
    else:
        even+=1
e=even%2
box=even2*2
if(box>=(e+odd)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in a:
    if i % 4 == 0:
        count += 1

two_count = 0
num = a.count(2)
while num % 2 == 0:
    num //= 2
    count += 1

if two_count > 0:
    for i in range(two_count):
        if a[i] != 2:
            if a[i] * 2 % 4 == 0:
                count += 1

print("Yes" if count >= N else "No")

Submission status: Wrong Answer

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

for i in a:
    if i % 4 == 0:
        count += 3

print("Yes" if count >= N else "No")

Submission status: Wrong Answer

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

for i in a:
    if i % 4 == 0:
        count += 1

count *= 3
print("Yes" if count >= N else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
odd=len([1 for i in l if i%2])
t4=len([1 for i in l if i%4==0])
if odd*2<=t4:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
odd=len([1 for i in l if i%2])
t4=len([1 for i in l if i%4==0])
if odd*2+1<=t4:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    import bisect
    import collections
    import fractions
    import heapq
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    f = 0
    t = 0
    e = 0
    for v in a:
        if v % 4 == 0:
            f += 1
        elif v % 2 == 0:
            t += 1
        else:
            e += 1
    print("Yes" if (t + e + 1) // 2 <= f else "No")


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
ans="No"
f=[a for a in A if a%4==0]
t=[a for a in A if a%4!=0 and a%2==0]
if len(f)*2+len(t)>=N or len(f)>=(N-1)//3+1:
  ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
A = list(map(int, input().split()))
div_count = 0
count = 0
for a in A:
    if a % 4 == 0:
        div_count += 1
    elif a % 2 == 0:
        count += 1
        if count == 2:
            div_count += 1
            count = 0

if math.ceil(N / 3) <= div_count:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
A = list(map(int, input().split()))
div_count = 0
for a in A:
    if a % 4 == 0:
        div_count += 1
if math.ceil(N / 3) == div_count:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

odd = 0
mul4 = 0

for a in A:
    if a % 2 != 0:
        odd += 1
    if a % 4 == 0:
        mul4 += 1

if mul4 >= odd:
    print('Yes')
else:
    if mul4 and mul4 + odd == N:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
four = len([a for a in A if a%4==0])
even = len([a for a in A if a%4!=0 and a%2==0])
if even//2>0:
    N -= even//2
if N%2==1:
    N-=1
if four>=N//2 or even//2==N:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
four = len([a for a in A if a%4==0])
even = len([a for a in A if a%4!=0 and a%2==0])
if even//2>0:
    N -= even//2
if N%2==1:
    N-=1
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 = len([a for a in A if a%4==0])
even = len([a for a in A if a%4!=0 and a%2==0])
if even%2==0:
    N -= even//2
if N%2==1:
    N-=1
if four>=N//2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# ABC069C - 4-adjacent (ARC080C)
def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    f, t, m = 0, 0, 0  # two, four, misc
    for i in A:
        if i % 4 == 0:
            f += 1
        elif i % 2 == 0:
            t += 1
        else:
            m += 1
    m += t % 2 - t // 2
    flg = m - f <= 1
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
two_ad = 0
four_ad = 0
other = 0
for a in A:
  if a % 4 == 0 and a % 2 == 0:
    four_ad += 1
  elif a % 4 == 0:
    four_ad += 1
  elif a % 2 == 0:
    two_ad += 1
  else:
    other += 1

if not two_ad and not four_ad:
  ans = "No"
elif not two_ad:
  if other == four_ad + 1 or four_ad > other:
    ans = "Yes"
  else:
    ans = "No"
elif not four_ad and two_ad:
  ans = "Yes"
elif not four_ad:
  ans = "No"
elif not other:
  ans = "Yes"
elif four_ad == other == two_ad:
  ans = "Yes"
else:
  ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:

N = int(input())
A = list(map(int,input().split()))
two_ad = 0
four_ad = 0
other = 0
for a in A:
  if a % 4 == 0 and a % 2 == 0:
    four_ad += 1
  elif a % 4 == 0:
    four_ad += 1
  elif a % 2 == 0:
    two_ad += 1
  else:
    other += 1

if not two_ad and not four_ad:
  ans = "No"
elif not two_ad:
  if other == four_ad + 1 or four_ad > other:
    ans = "Yes"
  else:
    ans = "No"
elif not four_ad:
  ans = "No"
elif not other:
  ans = "Yes"
elif four_ad == other == two_ad:
  ans = "Yes"
else:
  ans = "No"
print(ans)