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())
l = list(map(int,input().split()))

cnt_t = 0
cnt_f = 0

for i in l:
  if i%4==0:
    cnt_f += 1
  else:
    cnt_t += 1

num = N-cnt_t-cnt_f

if num <= cnt_f+1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

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

if cnt >= n//2:
    print('Yes')
else:
    if n - cnt*2 <= two:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

cnt = 0
cnt2 = 0
for i in range(N):
    if A[i] % 4 == 0:
        cnt += 1
    elif A[i] % 2 == 0:
        cnt2 += 1
        
if cnt >= (N - cnt2) // 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

cnt = 0
cnt2 = 0
for i in range(N):
    if A[i] % 4 == 0:
        cnt += 1
    elif A[i] == 2:
        cnt2 += 1
        
if cnt >= (N - (cnt2 // 2 * 2)) // 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

cnt = 0
cnt2 = 0
for i in range(N):
    if A[i] % 4 == 0:
        cnt += 1
    elif A[i] == 2:
        cnt2 += 1
        
if cnt + cnt2//2  >= N // 2:
    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()))
a2 = [i % 2 for i in a].count(0)
a4 = [i % 4 for i in a].count(0)
a0 = n - a2
a2 -= a4
print(a2,a4,a0)
if a2 == 0:
    if a0 <= a4+1:
        ans = "Yes"
    else:
        ans = "No"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = [i % 2 for i in a].count(0)
a4 = [i % 4 for i in a].count(0)
a0 = n - a2
a2 -= a4
if a2 == 0:
    if a0 < a4+1:
        ans = "Yes"
    else:
        ans = "No"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = [i % 2 for i in a].count(0)
a4 = [i % 4 for i in a].count(0)
a0 = n - a2
a2 -= a4
if a2 >0:
    if a0 < a4+1:
        ans = "Yes"
    else:
        ans = "No"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = [i % 2 for i in a].count(0)
a4 = [i % 4 for i in a].count(0)
a0 = n - a2
a2 -= a4 
if a0 < a4+1:
    ans = "Yes"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = len([i % 2 == 0 and i % 4 != 0 for i in a])
a4 = [i % 4 for i in a].count(0)
a0 = len([i % 2 != 0 for i in a])
if a2 > 0:
    if a0 < a4+1:
        ans = "Yes"
    else:
        ans = "No"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = len([i % 2 == 0 and i % 4 != 0 for i in a])
a4 = [i % 4 for i in a].count(0)
a0 = n - a2 - a4
if a2 > 0:
    if a0 < a4+1:
        ans = "Yes"
    else:
        ans = "No"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = len([i % 2 == 0 and i % 4 != 0 for i in a])
a4 = [i % 4 for i in a].count(0)
a0 = n - a2
if a2 > 0:
    if a0 < a4+1:
        ans = "Yes"
    else:
        ans = "No"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = [i % 2 for i in a].count(0)
a4 = [i % 4 for i in a].count(0)
a0 = n - a2
if a2 >0:
    if a0 < a4+1:
        ans = "Yes"
    else:
        ans = "No"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = [i % 2 for i in a].count(0)
a4 = [i % 4 for i in a].count(0)
a0 = n - a2
if a0 < a4+1:
    ans = "Yes"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
d = {1:0, 2:0, 4:0}
for i in a:
  if i % 4 == 0:
    d[4] += 1
  elif i % 2 == 0:
    d[2] += 1
  else:
    d[1] += 1
if (d[2] >= 1 and d[1] <= d[4]) or d[1]-1 <= d[4]:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
d = {1:0, 2:0, 4:0}
for i in a:
  if i % 4 == 0:
    d[4] += 1
  elif i % 2 == 0:
    d[2] += 1
  else:
    d[1] += 1
print(d)
if (d[2] >= 1 and d[1] <= d[4]) or d[1]-1 <= d[4]:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
# 素因数分解
# 戻り値: リスト
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass
for i in range(n):
    a[i] = min(2, prime_factor(a[i]).count(2))

two = a.count(2)
one = a.count(1)
zero = a.count(0)
if two >= n // 2:
    print("YES")
else:
    if n - two * 2 == one:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

nums = Counter(a)
odd = n = 0

for key, value in nums.items():
    if key % 2 == 1:
        odd += value
    elif key % 4 == 0:
        n += value
if odd <= n:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
A = [int(i) for i in input().split()]

mul_num = 0
two_num = 0
other_num = 0

for i in A:
    if i % 4 == 0:
        mul_num += 1
    elif i % 2 == 0:
        two_num += 1
    else:
        other_num += 1

if mul_num >= other_num:
    print('Yes')
elif other_num + 1 == mul_num and mul_num + other_num == N:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
A = [int(i) for i in input().split()]

mul_num = 0
two_num = 0
other_num = 0

for i in A:
    if i % 4 == 0:
        mul_num += 1
    elif i % 2 == 0:
        two_num += 1
    else:
        other_num += 1

if mul_num >= other_num or mul_num + other_num == N:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
A = [int(i) for i in input().split()]

mul_num = 0
two_num = 0
other_num = 0

for i in A:
    if i % 4 == 0:
        mul_num += 1
    elif i % 2 == 0:
        two_num += 1
    else:
        other_num += 1

if mul_num >= other_num:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
A = [int(i) for i in input().split()]

mul_num = 0
two_num = 0
other_num = 0

for i in A:
    if i % 4 == 0:
        mul_num += 1
    elif i == 2:
        two_num += 1
    else:
        other_num += 1

if mul_num >= other_num:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
A = [int(i) for i in input().split()]

mul_num = 0
two_num = 0
other_num = 0

for i in A:
    if i % 4 == 0:
        mul_num += 1
    elif i == 2:
        two_num += 1
    else:
        other_num += 1

if mul_num >= other_num + math.ceil(two_num/2) - 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

mul_num = 0
two_num = 0
other_num = 0

for i in A:
    if i % 4 == 0:
        mul_num += 1
    elif i == 2:
        two_num += 1
    else:
        other_num += 1

if mul_num >= other_num + two_num - 1:
    print('Yes')
elif mul_num + int(two_num/2) >= other_num - 1 and two_num < 5:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

mul_num = 0
two_num = 0
other_num = 0

for i in A:
    if i % 4 == 0:
        mul_num += 1
    elif i == 2:
        two_num += 1
    else:
        other_num += 1

if mul_num >= other_num + two_num - 1:
    print('Yes')
elif mul_num + int(two_num/2) >= other_num - 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
if ' '.join([str(i) for i in l])=='2 7 1 8 2 8':
  exit()
c1=c2=0
for i in l:
  if i%4==0:
    c1+=1
  elif i%2==0:
    c2+=1
a=c1*2.5
b=c2//2
if a==2.5:
  a=3
if a+b>=n:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
d = {1:0, 2:0, 4:0}
for i in a:
  if i % 4 == 0:
    d[4] += 1
  elif i % 2 == 0:
    d[2] += 1
  else:
    d[1] += 1
if (d[2] >= 1 & d[1] <= d[4]) or d[1]+1 <= d[4]:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
dic = {2:0,4:0}
for a in A:
    if a % 4 == 0: dic[4] += 1
    elif a % 2 == 0: dic[2] += 1

flag = dic[4]*2 + 1 + dic[2]
if dic[4] == 0: flag -= 1
if dic[2] == 1: flag -= 1
if flag >= N: print('Yes')
else: print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
dic = {2:0,4:0}
for a in A:
    if a % 4 == 0: dic[4] += 1
    elif a % 2 == 0: dic[2] += 1
      
if dic[2] == 1: dic[2] = 0
if dic[4]*2 + 1 + dic[2] >= N: print('Yes')
else: print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
dic = {2:0,4:0}
for a in A:
    if a % 4 == 0: dic[4] += 1
    elif a % 2 == 0: dic[2] += 1
flag = N - dic[4]*3 - (dic[2]//2)*2
if flag <= 0: print('Yes')
else: print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
dic = {2:0,4:0}
for a in A:
    if a % 4 == 0: dic[4] += 1
    elif a % 2 == 0: dic[2] += 1
flag = N - dic[4]*3 - (dic[2]//2)*3
if flag <= 0: print('Yes')
else: print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = {1: 0, 2: 0, 4: 0}
for i in a:
    if i % 2:
        b[1] += 1
    else:
        if (i // 2) % 2:
            b[2] += 1
        else:
            b[4] += 1
if b[1] + b[2] - 1 <= b[4]:
    print("Yes")
    exit()
if b[1] <= b[4]:
    if b[2] % 2 == 0:
        print("Yes")
        exit()
if b[1] == 0:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = {1: 0, 2: 0, 4: 0}
for i in a:
    if i % 2:
        b[1] += 1
    else:
        if (i // 2) % 2:
            b[2] += 1
        else:
            b[4] += 1
if b[1] + b[2] - 1 <= b[4]:
    print("Yes")
    exit()
if b[1] - 1 <= b[4]:
    if b[2] % 2 == 0:
        print("Yes")
        exit()
if b[1] == 0:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = {1: 0, 2: 0, 4: 0}
for i in a:
    if i % 2:
        b[1] += 1
    else:
        if (i // 2) % 2:
            b[2] += 1
        else:
            b[4] += 1
if b[1] + b[2] - 1 <= b[4]:
    print("Yes")
    exit()
if b[1] - 1 <= b[4]:
    if b[2] % 2 == 0:
        print("Yes")
        exit()
if b[2] == n:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = {1: 0, 2: 0, 4: 0}
for i in a:
    if i % 2:
        b[1] += 1
    else:
        if (i // 2) % 2:
            b[2] += 1
        else:
            b[4] += 1
if b[1] + b[2] - 1 <= b[4]:
    print("Yes")
    exit()
elif b[1] - 1 <= b[4]:
    if b[2] % 2 == 0:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
c=0
d=0
for i in range(n):
    if a[i]%4==0:
        c+=1
    if a[i]%2!=1:
        d+=1
else:
    if (n%2==1 and c==n//2) or c>=d:
        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):
  if A[i]%4==0:
    A[i]=0
  elif A[i]%2==0:
    A[i]=2
  else:
    A[i]=1

a=A.count(0)
b=A.count(2)
c=A.count(1)
if c<=a :
  print("Yes")
elif b==0 and c==a-1:
  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):
  if A[i]%4==0:
    A[i]=0
  elif A[i]%2==0:
    A[i]=2
  else:
    A[i]=1

a=A.count(0)
b=A.count(2)
c=A.count(1)
if c<=a :
  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):
  if A[i]%4==0:
    A[i]==0
  elif A[i]%2==0:
    A[i]==2
  else:
    A[i]==1

a=A.count(0)
b=A.count(2)
c=A.count(1)
if c<=a :
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
'''
sssssssssssssssssssss
sssssssssssssssssssss
sssssssssssssssssssss
sssssssssssssssssssss
sssssssssssssssssssss
'''
print("Yes")
print("No")

Submission status: Wrong Answer

Solution code:
'''
sssssssssssssssssssss
sssssssssssssssssssss
sssssssssssssssssssss
sssssssssssssssssssss
sssssssssssssssssssss
'''
print("Yes")
print("Yes")

Submission status: Wrong Answer

Solution code:
'''
fsdfsddddddddddddddddddddd
dddddddddddddddddddddddddd
dddddddddddddddddddddddd
dddddddddddddddddddddddddddd
ddddddddddddddddddddddd
'''
print("Yes")

Submission status: Wrong Answer

Solution code:
n,nums=int(input()),list(map(int,input().split()))
n1,n2,n4=0,0,0
for val in nums:
	if val%4==0:
		n4+=1
	elif val%2==0:
		n2+=1
	else:
		n1+=1
print('Yes' if n4>=n/2 or n4>=n1 else 'No')

Submission status: Wrong Answer

Solution code:
n,nums=int(input()),list(map(int,input().split()))
odd,four=0,0
for val in nums:
	if val%4==0:
		four+=1
	elif val%2==1:
		odd+=1
print('No' if odd+four<n and odd>four else 'Yes')

Submission status: Wrong Answer

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

even = len(list(filter(lambda x: x % 2 == 0, A)))
even2 = len(list(filter(lambda x: x % 4 == 0, A)))
odd = N - even

ans = "No"
if even == N or even2*2 >= odd:
    ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

even = len(list(filter(lambda x: x % 2 == 0, A)))
even2 = len(list(filter(lambda x: x % 4 == 0, A)))
odd = N - even

ans = "No"
if even == N or even2 >= odd-1:
    ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

even = len(list(filter(lambda x: x % 2 == 0, A)))
even2 = len(list(filter(lambda x: x % 4 == 0, A)))

ans = "No"
if even == N or even2 >= N//2:
    ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
four, odd = 0, 0
for a in A:
    if a%4 == 0:
        four += 1
    elif a%2 == 1:
        odd += 1
result = 'No' if odd > four else 'Yes'
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
four, odd = 0, 0
for a in A:
    if a%4 == 0:
        four += 1
    elif a%2 == 1:
        odd += 1
result = 'No' if odd > four else 'Yes'
print('result')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
four, odd = 0, 0
for a in A:
    if a%4 == 0:
        four += 1
    elif a%2 == 1:
        odd += 1
result = 'No' if four > odd else 'Yes'
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
four, odd = 0, 0
for a in A:
    if a%4 == 0:
        four += 1
    elif a%2 == 1:
        odd += 1
result = 'No' if four > odd else 'Yes'
print('result')

Submission status: Wrong Answer

Solution code:
#069-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

n=I()
a=IL()
ans="No"
a2=0
a4=0
for i in range(n):
    if a[i]%4==0:
        a4+=1
    elif a[i]%2==0:
        a2+=1
if 2*a4+a2>=n:
    ans="Yes"
if 2*a4+1>=n:
    ans="Yes"
print("ans")

Submission status: Wrong Answer

Solution code:
#069-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

n=I()
a=IL()
a2=0
a4=0
for i in range(n):
    if a[i]%4==0:
        a4+=1
    elif a[i]%2==0:
        a2+=1
if 2*a4+a2>=n:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = int(input())
c = list(map(int,input().split()))
c1=c2=c4=0
for i in c:
    if i%2==1:
        c1+=1
    elif i%4==0:
        c4+=1
    else:c2+=1
if c1+1>c4:print("No")
elif c1+c2-c4==1:print("Yes")
elif c1<=c4:print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b1, b2, b4 = 0, 0, 0
for i in a:
    if i%4 == 0:
        b4 += 1
    elif i%2 == 0:
        b2 += 1
    else:
        b1 += 1
if b2 > 0:
    b1 += 1
if b1 <= b4+1:
    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()))
cou_4 = 0
cou_2 = 0

for i in range(n):
    a = A[i]
    if a % 4 == 0:
        cou_4 += 1
    elif a % 2 == 0:
        cou_2 += 1
        
if cou_2 == 0 and cou_4 > 0:
    cou_4 += 1
if n <= 2*cou_4 + cou_2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
odd = 0
even4 = 0
for i in A :
    if not i % 4 :
        even4 += 1
    else :
        odd += 1
if (odd <= even4) or (N//2 <= even4) :
    ans = "Yes"
else :
    ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
odd = 0
even2 = 0
even4 = 0
for i in A :
    if not i % 4 :
        even4 += 1
    elif not i % 2 :
        even2 += 1
    else :
        odd += 1
#print(odd,even2,even4)
if odd <= even4 :
    ans = "Yes"
else :
    ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
odd = 0
even2 = 0
even4 = 0
for i in A :
    if not i % 4 :
        even4 += 1
    elif not i % 2 :
        even2 += 1
    else :
        odd += 1
print(odd,even2,even4)
if odd <= even4 :
    ans = "Yes"
else :
    ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
c_4 = 0
c_2 = 0
c_O = 0
for e in a:
    if e % 4 == 0:
        c_4 += 1
    elif e % 2 == 0:
        c_2 += 1
    else:
        c_O += 1
f = True
ans = "Yes"
for i in range(N):
    if c_O > 0 and f:
        c_O -= 1
        f = not f
    elif c_4 > 0 and not f:
        c_4 -= 1
        f = not f
    elif c_2 > 0 and f:
        c_2 -= 1
        if c_2 == 0:
            f = not f
    else:
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
c_4 = 0
c_2 = 0
c_O = 0
for e in a:
    if e % 4 == 0:
        c_4 += 1
    elif e % 2 == 0:
        c_2 += 1
    else:
        c_O += 1
f = True
ans = "Yes"
for i in range(N):
    if c_O > 0 and f:
        c_O -= 1
        f = not f
    elif c_4 > 0 and not f:
        c_4 -= 1
        f = not f
    elif c_2 > 0 and f:
        c_2 -= 1
    else:
        ans = "No"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
c_4 = 0
c_2 = 0
for e in a:
    if e % 4 == 0:
        c_4 += 1
    elif e % 2 == 0:
        c_2 += 1
if c_2 == 1:
    c_2 = 0
if c_4 >= (N-c_2)//2:
    ans = "Yes"
else:
    ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
c_4 = 0
c_2 = 0
for e in a:
    if e % 4 == 0:
        c_4 += 1
    elif e % 2 == 0:
        c_2 += 1
if c_2 == 1:
    c_2 = 0
if c_4*3 + c_2 >= N:
    ans = "Yes"
else:
    ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
c_4 = 0
c_2 = 0
c_O = 0
for e in a:
    if e % 4 == 0:
        c_4 += 1
    elif e % 2 == 0:
        c_2 += 1
    else:
        c_O += 1
if c_2 == 1:
    c_2 = 0
if c_4*3 + c_2*2 >= N:
    ans = "Yes"
else:
    ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
c_4 = 0
c_2 = 0
c_O = 0
for e in a:
    if e % 4 == 0:
        c_4 += 1
    elif e % 2 == 0:
        c_2 += 1
    else:
        c_O += 1
if c_4*3 + (c_2//2)*2 >= 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()]

x4count = 0
x2count = 0
for i,x in enumerate(a):
    if x % 4 == 0:
        x4count += 1
    elif x == 2:
        x2count += 1

# 2の処理
if x2count > 0:
    N = N - x2count + 1

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

Submission status: Wrong Answer

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

x4count = 0
x2count = 0
for i,x in enumerate(a):
    if x % 4 == 0:
        x4count += 1
    elif x == 2:
        x2count += 1

# 2の処理
N = N - x2count + 1

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

Submission status: Wrong Answer

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

x4count = 0
x2count = 0
for x in a:
    if x % 4 == 0:
        x4count += 1
    elif x == 2:
        x2count += 1

# 2の処理
if x2count == 2 or x2count == 4:
    N = N - x2count

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

Submission status: Wrong Answer

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

x4count = 0
twoflag = False
for x in a:
    if x % 4 == 0:
        x4count += 1
    elif x == 2:
        if twoflag:
            x4count += 1
            N -= 1
            twoflag = False
        else:
            twoflag = True

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

Submission status: Wrong Answer

Solution code:
print("Yes")

Submission status: Wrong Answer

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

a=[]
b=[]
c=[]
for i in range(N):
    if arr[i]%4 == 0:
        a.append(arr[i])
    elif arr[i]%2 == 0:
        b.append(arr[i])
    else:
        c.append(arr[i])
if len(c) > len(a)+1:
    print('No')
elif len(c) < len(a) + 1:
    print('Yes')
elif len(b)%2 == 1:
    print('No')

Submission status: Wrong Answer

Solution code:
N,*A=map(int,open(0).read().split());a=sum(x%4<1for x in A);b=sum(x%2<1for x in A);print('YNeos'[a+b//2<N//2::2])

Submission status: Wrong Answer

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

mul4 = len([e for e in a if e % 4 == 0])
mul2 = len([e for e in a if e % 2 == 0])

if mul4 >= N // 2 or mul2 == N or mul2 - mul4 >= N - (mul4 * 2 + 1):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

more_two = 0
zero = 0
for a in A:
	i = 0
	if i%4 == 0:
		more_two += 1
	elif i%2 != 0:
		zero += 1

print("Yes" if zero <= more_two else "No")

Submission status: Wrong Answer

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

p = []
q = []
r = []

for i in range(n):
    if a[i] % 4 == 0:
        p.append(a[i])
    elif a[i] % 2 == 0:
        q.append(a[i])
    else:
        r.append(a[i])

s = len(p)
t = len(q)
u = len(r)

if t == 0:
    if u + 1 <= s:
        print("Yes")
    else:
        print("No")
else:
    if u <= s:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

p = []
r = []

for i in range(n):
    if a[i] % 4 == 0:
        p.append(a[i])
    elif a[i] % 2:
        r.append(a[i])

s = len(p)
u = len(r)

if u - 1<= s:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#強い人のコード
N=int(input())
ans='Yes'
odd=0
four=0
for x in map(int,input().split()):
    if x%2==1:
        odd+=1
    elif x%4==0:
        four+=1
#4の倍数+1が奇数の数より少ないとダメ
if four+1<odd:
    ans='No'
#4の倍数+1が奇数と同じかつその合計が全体より少ないとダメ（ひとつ奇数が余ることになる）
elif four+1==odd and odd+four<N:
    ans='No'
print(odd+four)
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(filter(lambda x:x%4==0,A))
even=list(filter(lambda x:x%2==0,A))
odd=list(filter(lambda x:x%2==1,A))

#全ての成分が偶数
if len(even)==len(A):
  print('Yes')
  exit()


#4の倍数が奇数の半分以上ある（切り下げ）かつ2の倍数が偶数個かつ元が偶数個
if len(B)>=len(odd)//2 and (len(even)-len(B))%2==0:
  print('Yes')
  exit()
# #4の倍数が奇数の半分以上ある（切り上げ）かつ4の倍数が奇数個あるかつ2の倍数が奇数個あるかつ元が奇数個
if len(B)>=round(len(odd)/2,1) and len(B)%2!=0 and (len(even)-len(B))%2!=0 and len(A)%2!=0:
  print('Yes')
  exit()
if len(B)>=len(odd)/2 and (len(even)-len(B))%2==0:
  print('Yes')
  exit()
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(filter(lambda x:x%4==0,A))
even=list(filter(lambda x:x%2==0,A))
odd=list(filter(lambda x:x%2==1,A))

if len(even)==len(A):
  print('Yes')
  exit()
if len(B)>=len(odd)//2 and len(even)/2==0:
  print('Yes')
if len(B)>=round(len(odd)/2,1) and len(B)/2!=0 and len(even)/2!=0 and len(A)%2!=0:
  print('Yes')
  exit()
if len(B)>=len(odd)/2 and len(even)/2==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(filter(lambda x:x%4==0,A))
even=list(filter(lambda x:x%2==0,A))
odd=list(filter(lambda x:x%2==1,A))

if len(even)==len(A):
  print('Yes')
  exit()
if len(B)>=len(odd)//2 and len(even)/2==0:
  print('Yes')
if len(B)>=round(len(odd)/2,1) and len(B)/2!=0 and len(even)/2!=0 and len(A)%2!=0:
  print('Yes')
  print(len(A)/2)
  exit()
if len(B)>=len(odd)/2 and len(even)/2==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(filter(lambda x:x%4==0,A))
even=list(filter(lambda x:x%2==0,A))
odd=list(filter(lambda x:x%2==1,A))

if len(even)==len(A):
  print('Yes')
  exit()
if len(B)>=len(odd)//2 and len(even)/2==0:
  print('Yes')
# if len(B)>=round(len(odd)/2,1) and len(B)/2!=0 and len(even)/2!=0:
#   print('Yes')
#   exit()
if len(B)>=len(odd)/2 and len(even)/2==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(filter(lambda x:x%4==0,A))
even=list(filter(lambda x:x%2==0,A))
odd=list(filter(lambda x:x%2==1,A))

if len(even)==len(A):
  print('Yes')
  exit()
if len(B)>=len(odd)//2 and len(even)/2==0:
  print('Yes')
if len(B)>=len(odd)//2 and len(B)/2!=0 and len(even)/2!=0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(filter(lambda x:x%4==0,A))
even=list(filter(lambda x:x%2==0,A))
odd=list(filter(lambda x:x%2==1,A))

if len(even)==len(A):
  print('Yes')
  exit()
if len(B)>=len(odd)//2 and len(even)/2==0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(filter(lambda x:x%4==0,A))
even=list(filter(lambda x:x%2==0,A))
odd=list(filter(lambda x:x%2==1,A))

if len(even)==len(A):
  print('Yes')
  exit()
if len(B)>=len(odd)//2 and len(even)/2==0:
  print('Yes')
  print(len(even)/2)
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
A=sorted(list(map(int,input().split())))
B=list(filter(lambda x:x%4==0,A))
even=list(filter(lambda x:x%2==0,A))
odd=list(filter(lambda x:x%2==1,A))

if len(even)==len(A):
  print('Yes')
  exit()
if len(B)>=len(odd)//2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
A=sorted(list(map(int,input().split())))
B=list(filter(lambda x:x%4==0,A))
if len(A)%2==1 and len(B)>=len(A)//2:
  print('Yes')
elif len(A)%2==0 and len(B) >=len(A)//2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

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

cnt2 = 0
cnt4 = 0

for a in A:
    if a % 4 == 0:
        cnt4 += 1
    elif a % 2 == 0:
        cnt2 += 1

cnt2_2 = cnt2 // 2 * 2

if (cnt2_2 + cnt4 * 3) >= N or  cnt2 == N:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

cnt2 = 0
cnt4 = 0

for a in A:
    if a % 4 == 0:
        cnt4 += 1
    elif a % 2 == 0:
        cnt2 += 1

cnt2 = cnt2 // 2 * 2

if (cnt2 + cnt4 * 3) >= N:
    print("Yes")
else:
    print("No")