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())
c = [0, 0, 0]  # 0, 2, 4

for i in map(int, input().split()):
    if i % 4 == 0:
        c[2] += 1
    elif i % 2 == 0:
        c[1] += 1
    else:
        c[0] += 1

if c[0] + (c[1] % 2) <= c[2]+int(c[1]/2)+(c[2]>0):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
c = [0, 0, 0]  # 0, 2, 4

for i in map(int, input().split()):
    if i % 4 == 0:
        c[2] += 1
    elif i % 2 == 0:
        c[1] += 1
    else:
        c[0] += 1

if c[0] + (c[1] % 2) <= c[2]+int(c[1]/2)+1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math

num = int(input())
value = input().split()
value = [int(x) for x in value]

res = 0
two = 0
for i in value:
	if i % 4 == 0:
		res += 1
	elif i == 2:
		two += 1

if two > 0:
	print("Yes" if res >= math.ceil((len(value)-two)/2) else "No")
else:
	print("Yes" if res >= math.floor(len(value)/2) else "No")

Submission status: Wrong Answer

Solution code:
import math

num = int(input())
value = input().split()
value = [int(x) for x in value]

res = 0
two = 0
for i in value:
	if i % 4 == 0:
		res += 1
	elif i == 2:
		two += 1
print("Yes" if res+math.floor(two/2) >= math.floor(len(value)/2) else "No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
count4 = 0
count2 = 0
countelse = 0
for i in range(n):
	if a[i] % 4 == 0:
		count4 += 1
	if a[i] % 2 == 0:
		count2 += 1
	else:
		countelse += 1
count2 = count2 - count4
if count4 < (countelse - 1):
	print('No')
else:
	print('Yes')

Submission status: Wrong Answer

Solution code:
N = raw_input()
N = int(N)
s = raw_input()
s = s.split(' ')
s = [float(x) for x in s]

n_list = [0 for i in range(3)]
for i in s:
	for t in range(3):
		i = i/2
		if (i - int(i) != 0):
			n_list[t] += 1
			break
		if(t == 2):
			n_list[t] += 1

if(n_list[0] <= n_list[2]):
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
N = raw_input()
N = int(N)
s = raw_input()
s = s.split(' ')
s = [float(x) for x in s]

n_list = []
for i in s:
	for t in range(3):
		i = i/2
		if (i - int(i) != 0):
			n_list.append(t)
			break
		if(t == 2):
			n_list.append(t)

if(n_list.count(0) <= n_list.count(2)):
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
N =input()
a =input().split()
b,c,d =0,0,0
for i in range(0,int(N)):
    hoge = int(a[i])%2
    if hoge ==0:
        b =b+1
for i in range(0,int(N)):
    hoge = int(a[i])%4
    if hoge ==0:
        c =c+1
d = b-c
print (b,c,d)
if d ==0:
    if c-(int(N)-b)+1>=0:
        print('Yes')
    else:
        print('No')
else:
    if c-(int(N)-b)>=0:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
N =input()
a =input().split()
b,c,d =0,0,0
for i in range(0,int(N)-1):
    hoge = int(a[i])%2
    if hoge ==0:
        b =b+1
for i in range(0,int(N)-1):
    hoge = int(a[i])%4
    if hoge ==0:
        c =c+1
d = b-c
if d ==0:
    if c-(int(N)-b)+1>=0:
        print('Yes')
    else:
        print('No')
else:
    if c-(int(N)-b)>=0:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
N =input()
a =input().split()
b,c,d =0,0,0
for i in range(0,int(N)-1):
    hoge = int(a[i])%2
    if hoge ==0:
        b =b+1
for i in range(0,int(N)-1):
    hoge = int(a[i])%4
    if hoge ==0:
        c =c+1
d = b-c
if int(N)-2*c-d<=0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N =input()
a =input().split()
b,c,d =0,0,0
for i in range(0,int(N)-1):
    hoge = int(a[i])%2
    if hoge ==0:
        b =b+1
for i in range(0,int(N)-1):
    hoge = int(a[i])%4
    if hoge ==0:
        c =c+1
d = b-c
if int(N)-3*c-d+1<=0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N =input()
a =input().split()
b,c,d =0,0,0
for i in range(0,int(N)-1):
    hoge = int(a[i])%2
    if hoge ==0:
        b =b+1
for i in range(0,int(N)-1):
    hoge = int(a[i])%4
    if hoge ==0:
        c =c+1
d = b-c
if int(N)-3*c-d <=0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def judge_type(x):
    if x % 2:
        return 1
    elif x == 2:
        return 2
    elif x >= 4 and x % 2 == 0:
        return 4


def solve(): # 069C - 4-adjacent
    N = int(input())
    a = list(map(int, input().split(" ")))
    cnt_odd = 0
    cnt_2 = 0
    cnt_4 = 0
    flag_2 = False

    for i in a:
        if judge_type(i) == 1:
            cnt_odd += 1
        elif judge_type(i) == 2:
            cnt_2 += 1
            flag_2 = True
        elif judge_type(i) == 4:
            cnt_4 += 1

    if flag_2:
        if cnt_odd <= cnt_4:
            print("Yes")
        else:
            print("No")
    else:
        if cnt_odd <= cnt_4 + 1:
            print("Yes")
        else:
            print("No")


solve()

Submission status: Wrong Answer

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

num = N // 3 if N%3 == 0 else N // 3 + 1
cnt = 0

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

print('Yes' if cnt >= num else 'No')

Submission status: Wrong Answer

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

num = N // 3 if N%3 == 0 else N // 3 + 1
cnt = 0

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

print('Yes' if cnt == num else 'No')

Submission status: Wrong Answer

Solution code:
N=input()
#print N
a=map(int, raw_input().split())
#print a

cnt4=0
cnt2=0
kisuu=0
for i in range(len(a)):
	#print a[i]
	if a[i]%4==0:
		cnt4+=1
	elif a[i]%4!=0 and a[i]%2==0:
		cnt2+=1
	elif a[i]%2==1:
		kisuu+=1


#print cnt4
#print cnt2
#print kisuu

if cnt4==kisuu:
	print 'Yes'
elif cnt4+1==kisuu and cnt2==0:
	print 'Yes'
else:
	print 'No'

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
a = list(map(int, 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 >= math.floor(N / 2):
    print('Yes')
elif cnt2 >= math.floor((N - math.floor(cnt2 / 2)) / 2):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
ls = list(map(int,input().split()))
flag = "No"
for i in range(0,N-1):
    if ls[i]*ls[i+1] % 4 == 0:
        if ls[i] == 1 or ls[i+1] == 1:
            flag = "Yes"
            break
print(flag)

Submission status: Wrong Answer

Solution code:
a=int(input())
lst=list(map(int,input().split()))
ret="No"
for i in lst:
   if i%4==0:
     ret= "Yes"
     break
   else:
     pass
print(ret)

Submission status: Wrong Answer

Solution code:
a=int(input())
lst=list(map(int,input().split()))
for i in lst:
   if i%4==0:
     ret= "yes"
   elif i%4>0:
     ret= "No"
   else:
     pass
print(ret)

Submission status: Wrong Answer

Solution code:
import itertools
N = int(input())
ls = list(map(int,input().split()))
flag = 0
for i,s in itertools.combinations(ls,2):
    if i*s % 4 == 0:
        flag = 1
        break
print("Yes" if flag == 1 else "No")

Submission status: Wrong Answer

Solution code:
N = int(input())
ls = list(map(int,input().split()))
flag = 0
for i in range(0,N-1):
    if ls[i]*ls[i+1] % 4 == 0:
        flag = 1
        break
print("Yes" if flag == 1 else "No")

Submission status: Wrong Answer

Solution code:
N = int(input())
al = [int(an) for an in input().split()]
a = [ "4" if al[i]%4==0 else "k" if al[i]%2!=0 else "g" for i in range(N)]
if a.count("k") == a.count("4"):
	print("Yes")
elif (a.count("k") - 1) == a.count("4")  and a.count("g")==0:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
al = [int(a) for a in input().split()]
a = [ "4" if al[i]%4==0 else "k" if al[i]%2!=0 else "g" for i in range(N)]
if a.count("k") == a.count("4"):
	print("Yes")
elif (a.count("k") - 1) == a.count("4")  and a.count("g")==0:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
def judgearr(arr):
    mod0, mod2, odd = 0, 0, 0
    for a in arr:
        if a % 4 == 0:
            mod0 += 1
        elif a % 4 == 2:
            mod2 += 1
        else:
            odd += 1
    return mod0 + mod2/2 > odd


N = int(input())
an = map(int, input().split())

if judgearr(an):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

o=0
f=0
for i in a:
    if i%4==0:
        f+=1
    elif i%2!=0:
        o+=1

if len(a)<=3:
    f+=1

print("Yes" if f>=o else "No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
Nodd = len([x for x in a if x%2 == 1])
Neven = len([x for x in a if x%2 == 0])
Nfour = len([x for x in a if x%4 == 0])
if Nodd <= Nfour or (Nodd+Nfour==N and Nodd-Nfour==1):
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
Nodd = len([x for x in a if x%2 == 1])
Neven = len([x for x in a if x%2 == 0])
Nfour = len([x for x in a if x%4 == 0])
if Nodd <= Nfour or (Nodd+Nfour==N and Nodd-Nfour==1):
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

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

even = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        even += 1
        if i % 4 == 0:
            four_count += 1

odd = N - even

if odd <= four_count or (odd - 1  == four_count and even == 0):
    result = 'Yes'

print(result)

Submission status: Wrong Answer

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

even = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        even += 1
        if i % 4 == 0:
            four_count += 1

odd = N - even

if (odd <= four_count) or (odd - 1<= four_count and even == 0):
    result = 'Yes'

print(result)

Submission status: Wrong Answer

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

two_count = 0
two_sum = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        two_count += 1
        if i % 4 == 0:
            four_count += 1

if two_count == N:
    result = 'Yes'
elif two_count * 2 + 1 >= N:
    if (N - two_count) == 1:
        if four_count >= 1:
            result = 'Yes'
    else:
        if (N - two_count) - 1<= four_count:
            result = 'Yes'


print(result)

Submission status: Wrong Answer

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

two_count = 0
two_sum = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        two_count += 1
        if i % 4 == 0:
            four_count += 1

if two_count * 2 + 1 >= N:
    if (N - two_count) == 1:
        if four_count >= 1:
            result = 'Yes'
    else:
        if (N - two_count) - 1<= four_count:
            result = 'Yes'

print(result)

Submission status: Wrong Answer

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

two_count = 0
two_sum = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        two_count += 1
        if i % 4 == 0:
            four_count += 1

if two_count * 2 >= N:
    if (N - two_count) == 1:
        if four_count == 1:
            result = 'Yes'
    else:
        if (N - two_count) - 1<= four_count:
            result = 'Yes'

print(result)

Submission status: Wrong Answer

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

two_count = 0
two_sum = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        two_count += 1
        if i % 4 == 0:
            four_count += 1

if two_count * 2 + 1 >= N:
    if (N - two_count) == 1:
        if four_count == 1:
            result = 'Yes'
    else:
        if (N - two_count) - 1<= four_count:
            result = 'Yes'

print(result)

Submission status: Wrong Answer

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

two_count = 0
two_sum = 0
four_count = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        two_count += 1
        if i % 4 == 0:
            four_count += 1

if two_count * 2 + 1 >= N:
    if (N - two_count) - 1<= four_count:
        result = 'Yes'

print(result)

Submission status: Wrong Answer

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

zero = 0
four = 0
two = 0
for n in a:
  if(n % 2 != 0):
    zero += 1
  elif (n % 4 == 0):
    four += 1
  else:
    two += 1

if(two < 2 and two > 0):
  zero += 1

if(zero > four + 1):
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

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

zero = 0
four = 0
two = 0
for n in a:
  if(n % 2 != 0):
    zero += 1
  elif (n % 4 == 0):
    four += 1
  else:
    two += 1

if(two < 2):
  zero += 1

if(zero > four + 1):
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

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

count = 0
two_sum = 0
result = 'No'

for i in a_list:
    if i % 2 == 0:
        count += 1
        two_sum += i / 2

if count * 2 + 1 >= N:
    if two_sum  + 1 >= N:
        result = 'Yes'

print(result)

Submission status: Wrong Answer

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

count = 0
product = 1
result = 'No'

for i in a_list:
    if i % 2 == 0:
        count += 1
    product *= i
if count * 2 + 1 >= N:
    if product / 2 + 1 >= N:
        result = 'Yes'

print(result)

Submission status: Wrong Answer

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

f,e,d = 0,0,0

for a in A:
    x = a % 4
    if(x==0):
        f = f+1
    elif(x==2):
        e = e+1
    else:
        d =+ 1
if(e>0):
    d = d+1
if(f >= d-1):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

f,e,d = 0,0,0

for a in A:
    x = a % 4
    if(x==0):
        f = f+1
    elif(x==2):
        e = e+1
    else:
        d =+ 1
if(e>0):
    d = d+1
if(f <= d-1):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
N = input()
A = list(map(int, input().split()))
 
f,e,d = 0,0,0
 
for a in A:
    x = a % 4
    if(x==0):
        f = f+1
    elif(x==2):
        e = e+1
    else:
        d = d+1
if(e>0):
    d = d+1
if(d <= f):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

f,e,d = 0,0,0

for a in A:
    x = a % 4
    if(x==0):
        f = f+1
    elif(x==2):
        e = e+1
    else:
        d = d+1
if(e>0):
    d = d+1
if(d <= f):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

f,e,d = 0,0,0

for a in A:
    x = a % 4
    if(x==0):
        f = f+1
    elif(x==2):
        e = e+1
    else:
        d = d+1
if(e>0): d = d+1
if(d <= f):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

f,e,d = 0,0,0

for a in A:
    x = a % 4
    if(x==0):
        f = f+1
    elif(x==2):
        e = e+1
    else:
        d = d+1
if(e>0): d = d+1
if(d <= math.ceil(len(A)/2)):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
num = input()
list = map(int, raw_input().split())
count1 = 0
count4 = 0
for x in list:
    if x % 2 == 1:
        count1 = count1 + 1
    if x % 4 == 0:
        count4 = count4 + 1
if count1 > count4 and num > 3:
    print("No")
elif num == 2 and count4 - count1 < 0:
    print("No")
elif num == 3 and count4 == 0 and count1 > 0:
    print("No") 
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
num = input()
list = map(int, raw_input().split())
count1 = 0
count4 = 0
for x in list:
    if x % 2 == 1:
        count1 = count1 + 1
    if x % 4 == 0:
        count4 = count4 + 1
if count1 > count4 and num > 3:
    print("No")
elif num == 2 and count4 - count1 >= 0:
    print("Yes")
elif num == 3 and count4 > 0 or count1 == 0:
    print("Yes") 
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
num = input()
list = map(int, raw_input().split())
count1 = 0
count4 = 0
for x in list:
    if x % 2 == 1:
        count1 = count1 + 1
    if x % 4 == 0:
        count4 = count4 + 1
if count1 > count4:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
p=0
f=0
for ai in a:
    if ai%2==1:
        p+=1
    else:
        if ai/2%2==0:
            f+=1
if f==0:
    if p==0:
        print('Yes')
    else:
        print('No')
elif p>f:
    if p%2==1 and 2*f+1==n:
        print('Yes')
    else:
        print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
p=0
f=0
for ai in a:
    if ai%2!=0:
        p+=1
    else:
        if ai/2%2==0:
            f+=1
if f==0:
    print('No')
elif p>f:
    if p%2==1 and 2*f+1==n:
        print('Yes')
    else:
        print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
#n, m = list(map(int, input().split()))
#print((n-1)*(m-1))

#s = input()
#print(s[0] + str(len(s)-2) + s[-1])

n = int(input())
a = list(map(int, input().split()))
p=0
f=0
for ai in a:
    if ai%2!=0:
        p+=1
    else:
        if ai/2%2==0:
            f+=1
if f==0:
    print('No')
elif f==1:
    if n>3:
        print('No')
    else:
        print('Yes')
elif p>f:
    if p%2==1 and 2*p-1==n:
        print('Yes')
    else:
        print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
p=0
f=0
for ai in a:
    if ai%2!=0:
        p+=1
    else:
        if ai/2%2==0:
            f+=1
if f==0:
    print('No')
elif p>f:
    if  p+f==n:
        print('Yes')
    else:
        print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
p=0
f=0
for ai in a:
    if ai%2!=0:
        p+=1
    else:
        if ai/2%2==0:
            f+=1
if f==0:
    print('No')
elif f==1:
    if n>3:
        print('No')
    else:
        print('Yes')
elif p-2>f:
    print('No')
else:
    if p-2==f and p+f==n:
        print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
p=0
f=0
for ai in a:
    if ai%2!=0:
        p+=1
    else:
        if ai/2%2==0:
            f+=1
if f==0:
    print('No')
elif f==1:
    if n>3:
        print('No')
    else:
        print('Yes')
elif p-2>f:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

c1 = 0; c2  = 0
flag = "NO"
for i in a:
    if i % 4 == 0:
        c2 += 1
    elif i % 4 == 2:
        c1 += 1

if len(a) - (c1+c2) <= c2 +1 - bool(c1):
    flag = "YES"
print(flag)

Submission status: Wrong Answer

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

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one <= four:
  print('Yes')
else :
  if two == 0:
    if four == one - 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
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one <= four:
  print('Yes')
else :
  if two == 0:
    if four == one + 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
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one <= four:
  print('Yes')
else :
  if two == 0:
    if four >= (one+1):
      print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

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

for j in range(N):

  if a[j]%2 == 1:
    Kisuu += 1
  elif a[j]%4 == 0:
    YonBaisuu += 1
  else :
    NiBaisuu +=1

  
if Kisuu <= YonBaisuu:
  print('Yes')
else :
  if NiBaisuu == 0:
    if YonBaisuu >= (Kisuu+1):
      print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

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

for j in range(N):

  if a[j]%2 == 1:
    Kisuu += 1
  elif a[j]%4 == 0:
    YonBaisuu += 1
  else :
    NiBaisuu +=1

  
if Kisuu <= YonBaisuu:
  print('Yes')
else :
  if NiBaisuu == 0:
    if YonBaisuu <= Kisuu:
      print('Yes')
  else :
    print('No')

Submission status: Wrong Answer

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

for j in range(N):

  if a[j]%2 == 1:
    Kisuu += 1
  elif a[j]%4 == 0:
    YonBaisuu += 1
  else :
    NiBaisuu +=1

  
if Kisuu <= YonBaisuu:
  print('Yes')
else :
  if NiBaisuu == 0:
    if YonBaisuu <= Kisuu:
      print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

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

for j in range(N):

  if a[j]%2 == 1:
    Kisuu += 1
  elif a[j]%4 == 0:
    YonBaisuu += 1
  else :
    NiBaisuu +=1

  
if Kisuu <= YonBaisuu:
  print('Yes')
else :
  if NiBaisuu == 0:
    print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
a=input().split()
count_2=0
count_4=0
count_save=0

for i in range(N):
 b=int(a[i])
 if(b%4==0):
  count_4 +=1
 if( (b%2==0)and(b%4!=0) ):
  count_2 +=1
if(count_4>=1):
 count_save +=2*count_4+1
if(count_2>=2):
 count_save +=count_2

if(count_save>=N):
 print("Yes")
else:
 print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
a=input().split()
count_2=0
count_4=0
count_save=0

for i in range(N):
 b=int(a[i])
 if(b%4==0):
  count_4 +=1
 if( (b%2==0)and(b%4!=0) ):
  count_2 +=1

count_save +=2*count_4+1
if(count_2>=2):
 count_save +=count_2

if(count_save>=N):
 print("Yes")
else:
 print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

a = map(int, input().split(" "))

point = 0

for i in a:
    if i % 4 == 0:
        point += 2
    elif i % 2 == 0:
        point += 1

if n % 2 == 1:
    if n <= point + 1:
        print("YES")
    else:
        print("NO")
else:
    if n <= point:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
a = np.array([int(i) for i in input().split()] )

log2_a = np.log2(a).astype(int)*(a%2==0)
c2 = np.sum(log2_a == 1)
c4 = np.sum(log2_a > 1)
c1 = N - c2 - c4

if c2:
    print("Yes" if c4 >= c1 else "No")
elif c4 and c4 + 1 >= c1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys


def main():
    args = sys.stdin.readline().split()
    N = int(args[0])
    A = list(map(int, input().split()))

    non_factor_cnt = 0
    factor_of_two_cnt = 0
    factor_of_four_cnt = 0
    for num in A:
        remainder = num % 4
        if remainder != 0:
            if remainder == 2:
                factor_of_two_cnt += 1
            else:
                non_factor_cnt += 1
        else:
            factor_of_four_cnt += 1

    if len(A) <= 3 or (len(A) >= 4 and factor_of_four_cnt >= 2):
        if factor_of_four_cnt >= non_factor_cnt - 1:
            print('Yes')
            sys.exit()
    if factor_of_four_cnt >= non_factor_cnt: # + factor_of_two_cnt % 2:
        print('Yes')
        sys.exit()
    print('No')

main()

Submission status: Wrong Answer

Solution code:
N = int(input())						# 5
a = [int(i) for i in input().split()]	# 1 2 3 4 5 ...

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

n=0
n+=f*2+1
if(t>=2):n+=t

if n >= N:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
import itertools
 
def fun(l,n):
    flag = True
    for i in xrange(1,n):
        if (l[i]*l[i-1])/4.0 != ((l[i]*l[i-1])/4)*1.0:
            flag = False
            break
    return flag
 
n = int(raw_input())
l = map(int, raw_input().split(' '))
l = itertools.permutations(l)
l = set(l)
flag = False
 
for i in l:
    flag = fun(i,n)
    if flag == True:
        print 'Yes'
        break
if flag == False:
    print 'No'

Submission status: Wrong Answer

Solution code:
import itertools
 
def fun(l,n):
    flag = True
    for i in xrange(1,n):
        if (l[i]*l[i-1])/4.0 != ((l[i]*l[i-1])/4)*1.0:
            flag = False
            break
    return flag
 
n = int(raw_input())
l = map(int, raw_input().split(' '))
l = itertools.permutations(l)
l = set(l)
flag = False
 
for i in l:
    flag = fun(i,n)
    print i,flag
    if flag == True:
        print 'Yes'
        break
if flag == False:
    print 'No'

Submission status: Wrong Answer

Solution code:
N = int(input())						# 5
a = [int(i) for i in input().split()]	# 1 2 3 4 5 ...

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

n=0
n+=f*3
if(t>=2):n+=t

if n >= N:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:

import numpy as np
M = int(input()) 
lst = list(map(int, input().split()))

N = len(lst)
lst = np.array(lst)
num4k = len(lst[np.where(lst % 4 == 0)])
num2k = len(lst[np.where((lst % 4 != 0) & (lst % 2 == 0))])
if N % 2 == 0:
    if N<=num4k*2:
        print('Yes')
    elif (num4k+num2k)*2 >= N+1:
        print('Yes')
    else:
        print('No')
else:
    if N-1 <= num4k*2:
        print('Yes')
    elif (num4k+num2k)*2 >= N+2:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
import sys


def main():
    args = sys.stdin.readline().split()
    N = int(args[0])
    A = map(int, input().split())

    non_factor_cnt = 0
    factor_of_two_cnt = 0
    factor_of_four_cnt = 0
    for num in A:
        remainder = num % 4
        if remainder != 0:
            if remainder == 2:
                factor_of_two_cnt += 1
            else:
                non_factor_cnt += 1
        else:
            factor_of_four_cnt += 1

    if factor_of_four_cnt >= 2:
        if factor_of_four_cnt >= non_factor_cnt - 1:
            print('Yes')
            sys.exit()
    if factor_of_four_cnt >= non_factor_cnt: # + factor_of_two_cnt % 2:
        print('Yes')
        sys.exit()
    print('No')

main()

Submission status: Wrong Answer

Solution code:
import itertools

def fun(l,n):
    flag = True
    for i in xrange(1,n):
        if (l[i]*l[i-1])/4.0 != ((l[i]*l[i-1])/4)*1.0:
            flag = False
            break
    return flag

n = int(raw_input())
l = map(int, raw_input().split(' '))
l = itertools.permutations(l)
l = set(l)
flag = False

for i in l:
    flag = fun(i,n)
    print i,flag
    if flag == True:
        print 'YES'
        break
if flag == False:
    print 'NO'

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

odd = 0
fourth = 0
even = 0

for i in range(N):
    if a[i] % 4 == 0:
        fourth += 1
    elif a[i] % 2 == 0:
        even += 1
    elif a[i] % 2 != 0:
        odd += 1

res = "No"
if N % 2 == 0:
    if fourth == odd:
        res = "Yes"
else:
    if abs(odd - fourth) <= 1:
        res = "Yes"

print(res)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
a = map(int,raw_input().split())
a = sorted(a)

def gcd(a,b):
    while b!=0:
        t = b
        b=a%b
        a=t
    return a

i,j=0,0
good=True
while i<n-1:
    if (a[i]*a[i+1]) % 4 != 0:
        j = i+1
        while j<n-1 and (a[i]*a[j]) % 4 != 0:
            j+=1
        (a[i+1],a[j]) = a[j],a[i+1]
    if (a[i]*a[i+1]) % 4 != 0:
        good=False
    i+=1
if good:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
a = map(int,raw_input().split(" "))

tmp = 1
for aa in a:
	tmp *= aa

if tmp % pow(4,N-2) == 0 and tmp >= pow(4,N-2):
	print "Yes"
else:
	print "No"

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
a = map(int,raw_input().split())
a = sorted(a)

def gcd(a,b):
    while b!=0:
        t = b
        b=a%b
        a=t
    return a

i,j=0,0
good=True
while i<n-1:
    if (a[i]*a[i+1]) % 4 != 0:
        j = i+1
        while j<n-1 and gcd(a[i],a[j]) % 4 != 0:
            j+=1
        (a[i+1],a[j]) = a[j],a[i+1]
    if (a[i]*a[i+1]) % 4 != 0:
        good=False
    i+=1
if good:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
c=0
t=0
ans="No"
for i in a:
    if i%4==0:c=c+1
for i in a:
    if c>=1 and i==2:t=t+1
t=int(t/2)
if int(n/2) <= c+t:
    ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys


def main():
    args = sys.stdin.readline().split()
    N = int(args[0])
    A = map(int, input().split())

    non_factor_cnt = 0
    factor_of_two_cnt = 0
    factor_of_four_cnt = 0
    for num in A:
        remainder = num % 4
        if remainder != 0:
            if num % 2 != 0:
                non_factor_cnt += 1
        else:
            factor_of_four_cnt += 1

    if factor_of_four_cnt >= non_factor_cnt:
        print('Yes')
    else:
        print('No')

main()

Submission status: Wrong Answer

Solution code:
number = int(input())
list = map(int,input().split())
yon_num = 0
ni_num = 0
odd_num = 0
for num in list:
    if num%4 == 0:
        yon_num += 1
    elif num%2 == 0:
        ni_num +=1
    else:
        odd_num += 1

if yon_num >= (odd_num + ni_num//2 ):
    print('Yes')
else:
    print('No')