peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
from collections import Counter
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=len(a)
a=dict(Counter(a))
count=0
a = sorted(a.items(), key=lambda x:x[1], reverse=True)
print(a)
for i,j in a:
  count+=1
  ans-=j
  if count==k:
    break
print(ans)
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
L.sort()

if L[len(L)-1] < sum(L[:len(L)-1]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s=input()
ct={"a":0,"b":0,"c":0}
for i in range(len(s)):
  ct[s[i]]+=1
print("YES" if max(ct.values())-min(ct.values())<2 else "NO")
# Judge status: Accepted
a,b,c = map(int, input().split())
print(b+c-a)if a<=b+c else print(0)
# Judge status: Wrong Answer
N,A = map(int,open(0))
print("YES" if A>=(N%500) else "NO")
# Judge status: Wrong Answer
a = int( input() )

# aが3200以上ならsと出力し、3200未満ならredと出力
if a >= 3200:
    print('s')
else:
    print('red')
# Judge status: Accepted
k,s = map(int, input().split())
cnt = 0

for x in range(k+1):
    for y in range(k+1):
        if 0 <= s-(x+y) <= k:
            cnt += 1




print(cnt)
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[[] for i in range(m)]
for i in range(m):
  a[i].append(i+1)
  
for i in range(m):
  a[-1-i].append(i+1+m)

a[-1][1]=n
for x in a:
  print(x[0],x[1])
# Judge status: Accepted
from math import ceil

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

X=A.index(1)

M=float("inf")
for i in range(N):
    if i<=X<=i+K-1:
        P=ceil(i/(K-1))
        Q=ceil((N-i-1)/(K-1))
        M=min(M,P+Q)
print(M)
# Judge status: Accepted
N=int(input())

rllist=[]
for _ in range(N):
  X,L=map(int,input().split())
  rllist.append((X+L,X-L))
rllist.sort()
#print(rllist)

answer=0
max_r=-float("inf")
for r,l in rllist:
  #print(max_r,l)
  if max_r<=l:
    answer+=1
    max_r=r
  
print(answer)
# Judge status: Wrong Answer
a = int(input())
s = input()
print(s if a < 3200 else "red")
# Judge status: Accepted
N, K = [int(a) for a in input().split()]

num_count = (N-N%K)//K
ans = min(abs(N - num_count*K), abs(N - (num_count+1)*K))
if num_count > 0:
    ans = min(abs(N - (num_count-1)*K), ans)
print(ans)
# Judge status: Accepted
s = input()
t = input()
replace_s = {chr(i): '' for i in range(ord('a'), ord('z')+1)}
replace_t = {chr(i): '' for i in range(ord('a'), ord('z')+1)}
ans = 'Yes'
for i, j in zip(s, t):
    if replace_s[i] and replace_s[i] != j or replace_t[j] and replace_t[j] != i:
        ans = 'No'
        break
    if not replace_s[i]:
        replace_s[i] = j
    if not replace_t[i]:
        replace_t[j] = i
print(ans)
# Judge status: Accepted
from math import floor
import sys
from copy import copy
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
for test in range(int(input())):
'''
inf = 100000000000000000  # 1e17
mod = 998244353

aa, bb = map(int, input().split())
for i in range(1, 10000):
    if int(floor(i * 0.08)) == aa and int(floor(i * 0.1)) == bb:
        print(i)
        sys.exit()
print("-1")
# Judge status: Wrong Answer
n=int(input())
s=input()
ans=0

for i in range(1,n):
  cnt=0
  x=list(set(s[:i]))
  y=list(set(s[i:]))
  for j in x:
    if x in y:
      cnt+=1
  if ans<cnt:
    ans=cnt
print(ans)
# Judge status: Accepted
import bisect
n=int(input())
a=list(map(int,input().split()))
a.sort()
idx=bisect.bisect_left(a,a[-1]//2)
if n==2:
  print(a[1],a[0])
  exit()
if idx==0:
  print(a[-1],a[idx])
else:
  if a[idx]-a[-1]//2<=a[-1]//2-a[idx-1]:
    print(a[-1],a[idx])
  else:
    print(a[-1],a[idx-1])
# Judge status: Accepted
n,m = map(int,input().split())
if m % n == 0:
    print(m//n)
    exit()
ans = 1
for i in range(2,int(m**(0.5))+1):
    if m % i == 0:
        if i <= m/n:
            ans = max(ans,i)
        if m//i <= m/n:
            ans = max(ans,m//i)
print(ans)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(N-1):
  if a[i]>0:
    ans+=a[i]
  else:
    if a[i+1]<0:
      ans+=(-a[i])
      a[i+1]*=-1
    else:
      if -a[i]>=a[i+1]:
        ans+=-a[i]
        a[i+1]*=-1
      else:
        ans+=a[i]
print(ans+a[-1])
# Judge status: Wrong Answer
x = int(input())
 
for val in range(x, x**10000) :
	if x ==2 :
		print(x)
		break
	elif ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue
# Judge status: Wrong Answer
S,T = input().split()
A,B = map(int,input().split())
U = input()

if(S==U):
  print(B)
else:
  print(A)
# Judge status: Wrong Answer
import sys


def input():
    return sys.stdin.readline().strip()

def main():

    # i have too make index as weight and value as value
    import numpy as np
    N, W = map(int, input().split())

    dp = np.zeros(W + 1, int)

    for i in range(N):
        w, v = map(int, input().split())
        np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
        print(dp[:-w],dp[w:] )


    print(dp)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
ans = n / 2  if n % 2 == 0 else (n + 1) / 2
print(ans)
# Judge status: Accepted
from fractions import gcd
a, b = map(int, input().split())
lcm = a * b // gcd(a, b)
print(lcm)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = [0 for _ in range (max(a)+1)]
for i in a:
    b[i]+=1
    if b[i]==2:
        print("No")
        exit()
print("Yes")
# Judge status: Wrong Answer
n = int(input())
al = list(map(int, input().split()))

four, two = 0, 0

for a in al:
    if a%4 == 0:
        four += 1
    elif a == 2:
        two += 1

if n%2 == 0:
    if n-four <= four + two//2*2:
        print('Yes')
    else:
        print('No')
else:
    if n-four-1 <= four + two//2*2:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
N,K=map(int,input().split())
A=list(map(int,input().split()))
done=[-1 for _ in range(N)]
done[0]=0
n=0
now=0
init=0
loop=N
log=[0]

while n<N:
    log.append(A[log[-1]]-1)
    n+=1
    if done[log[-1]]>-1:
        init=done[log[-1]]
        loop=n-done[log[-1]]
        break
    done[log[-1]]=n

if K<init:
    print(log[K]+1)
else:
    num=init+(K-init)%loop
    print(log[num]+1)
# Judge status: Accepted
h1,m1,h2,m2,k=map(int,input().split())

print((h2-h1-1)*60+60-m1+m2-k)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,(input().split())))
f = 0
while f == 0 or len(set(A)) >= 3:
    nim = sorted(set(A))[0]
    if nim == 0:
        nim = sorted(set(A))[1]
    for i in range(N):
        if A[i] != nim:
            A[i] %= nim
    if len(set(A)) == 1:
        print(nim)
        break
    f = 1
else:
    print(nim)
# Judge status: Accepted
[N, x] = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
count = 0
i = 0
while x > 0 and i <= len(a):
  x -= a[i]
  if i == len(a)-1:
    if x != 0:
      break
  if x >= 0:
    count += 1
  i += 1
  
print(count)
# Judge status: Accepted
n, m = map(int, input().split())
od = (m + 1) // 2
x = 2 * od + 1
for i in range(1, od + 1):
    print(i, x - i)
ev = m - od
y = 2 * ev
for i in range(m - od):
    print(x + i, x + y - i)
# Judge status: Wrong Answer
N,X,T=input().split()
n=int(N)
x=int(X)
t=int(T)
s=int(t*(((n-(n%x))/x)+1))
print(s)
# Judge status: Accepted
N,K = map(int,input().split())
lst = list(range(0,N+1))
m = 10**9 + 7
cnt = 0
start = sum(lst[:K])
end = sum(lst[-K:])
cnt += end - start + 1
for i in range(K+1,N+2):
    start += lst[i-1] 
    end += lst[-i]
    cnt += end - start + 1
print(cnt % m)
# Judge status: Accepted
#Rgb Cards

lst = list(input().split())
a = "".join(lst)
print("YES" if int(a) % 4 == 0 else "NO")
# Judge status: Accepted
N=int(input())
print(N*800-N//15*200)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a*b%2==0:
  print("even")
else:
  print("odd")
# Judge status: Accepted
def main():
    n = int(input())
    A, B = [], []
    for _ in range(n):
        a, b = list(map(int, input().split()))
        A.append(a)
        B.append(b)
    ans = 0
    for a, b in zip(A[::-1], B[::-1]):
        aa = a + ans
        r = aa % b
        if r != 0:
            ans += b - r
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,m = map(int,input().split())
L = list(map(int,input().split()))
L.sort()

diff = []
for i in range(m-1):
    diff.append(L[i+1]-L[i])
diff.sort()

if n == m:
    print(0)
    exit()

print(sum(diff[:m-n]))
# Judge status: Accepted
N = int(input())
Cij = [[0 for _ in range(10)] for _ in range(10)]
for i in range(1,N+1):
  a, b = int(str(i)[0]), int(str(i)[-1])
  Cij[a][b] += 1
print(sum(Cij[i][j]*Cij[j][i] for i in range(10) for j in range(10)))
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
if sum(A)>sum(B):
    ans='No'
else:
    c=0
    d=0
    for a,b in zip(A,B):
        if a<b:
            d+=(b-a)//2+(b-a)%2
            c+=(b-a)%2
        else:
            c+=a-b
    if d>=c:
        ans='Yes'
    else:
        ans='No'
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(input())
wcnt,ecnt,ans,box = 0,0,0,[]
W = a.count("W")
E = a.count("E")
for i in range(n):
  if a[i] == "W":
    box.append(E+wcnt)
    wcnt += 1
    W -= 1
  else:
    box.append(E+wcnt)
    ecnt += 1
    E -= 1
print(min(box))
# Judge status: Accepted
N = int(input())
r = [list(map(int, input().split())) for _ in range(N)]
a = []
for i in r:
    a.append((i[0]-i[1],i[0]+i[1]))
a.sort(key=lambda x:x[1])
ans = 0
cur = -float('inf')
for i in a:
    if i[0] < cur:
        continue
    ans += 1
    cur = i[1]
print(ans)
# Judge status: Wrong Answer
n = int(input())
a_lst = list(map(int, input().split()))

cnt = 0
for a in a_lst:
  if a % 4 == 0:
    cnt += 2
  elif a % 2 == 0:
    cnt += 1
  else:
    pass
if cnt >= n:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
x = int(input())
dp = [0]*(x + 105 + 1)
dp[100] = 1 
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1

for i in range(100,x-105+5):
    for j in range(100,106):
        dp[i+j] = max(dp[i] , dp[i+j])

print(dp)
# Judge status: Accepted
A, B, C, K = map(int, input().split())
if K%2:
    ans = -1*(A-B)
else:
    ans = A-B

if ans > 1000000000000000000:
    print("Unfair")
else:
    print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
dp=[0]*(n+7)
dp[0]=1
a=[int(input())for _ in range(m)]
a=set(a)
for i in range(n):
  if i+1 not in a:
    dp[i+2]+=dp[i]
    dp[i+1]+=dp[i]
print(dp[n])
# Judge status: Accepted
N, K, S = map(int, input().split())
if S != 10**9:
  ans = [S] * K + [10**9] * (N - K)
else:
  ans = [S] * K + [10**9-1] * (N - K)
print(*ans)
# Judge status: Wrong Answer
import bisect
n = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
print(A,B,C,sep="\n")
ans = 0
b_memo = [0]
for b in B:
    a = bisect.bisect_left(A, b)
    b_memo.append(b_memo[-1]+a)
for c in C:
    b = bisect.bisect_left(B, c)
    if (b == 0):
        continue
    ans += b_memo[b]
print(ans)
# Judge status: Accepted
n=int(input())
l=list(map(int, input().split(' ')))

l=sorted(l)[::-1]

ans=l[0]
a=2

for i in range(1,n):
    ans+=(min(2,n-a))*l[i]
    a+=min(2,n-a)
    if a==n:
        break

print(ans)
# Judge status: Accepted
import sys

readline = sys.stdin.readline
N, M = map(int, readline().split())
x = set()
y = set()
for _ in range(M):
    a, b = map(int, readline().split())
    if a == 1:
        x.add(b)
    if b == N:
        y.add(a)
print('POSSIBLE' if x & y else 'IMPOSSIBLE')
# Judge status: Wrong Answer
N = int(input())
s_lst = [input() for i in range(N)]
M = int(input())
t_lst = [input() for i in range(M)]

dict = {}
for i in s_lst:
    dict[i] = 0
for i in t_lst:
    dict[i] = 0
for i in s_lst:
    dict[i] += 1
for i in t_lst:
    dict[i] -= 1
infinity = float('inf')
max = -infinity
for i in dict.values():
    if max < i:
        max = i
print(max)
# Judge status: Accepted
#!/usr/bin/env python3

n, m, x, y = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

x, y = min(x, y), max(x, y)

X, Y = max(X), min(Y)

x = max(X, x)
y = min(Y, y)

if x < y:
    print("No War")
else:
    print("War")
# Judge status: Wrong Answer
from collections import Counter

n, k = list(map(int, input().split()))
balls = list(map(int, input().split()))
b_list = set(balls)
nums = len(b_list)

yoso, s_yoso = [], []
counter = Counter(balls)
kakikae, t = 0, 1
if nums > k:
    for i, v in counter.most_common():
        yoso += [v]

if nums <= k:
    print(0)
else:
    s_yoso = sorted(yoso, reverse=True)
    while nums - k > t:
        kakikae += s_yoso[t-1]
        t += 1
    print(kakikae)
# Judge status: Wrong Answer
from bisect import bisect_left, bisect_right

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0

for i in range(n):
    b = B[i]
    pos_a = bisect_right(A, b)
    pos_c = bisect_left(C, b)
    ans += pos_a * (n - pos_c)
    # print(b, pos_a, pos_c)
print(ans)
# Judge status: Accepted
A,B,K=map(int,input().split())
print(A-K,B) if K<=A else print(0,B-(K-A)) if K<=A+B else print(0,0)
# Judge status: Wrong Answer
import math
N = int(input())



print((1 + N)/2*N)
# Judge status: Accepted
N=int(input())
A=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))
print(sum(abs(a-A[N//2]) for a in A))
# Judge status: Accepted
X,Y = (map(int, input().split()))
X2= X*2
num = 0
for i in range(X+1):
    if X2+num == Y:
        print("Yes")
        quit()
    num +=2
print("No")
# Judge status: Wrong Answer
import math
import numpy as np
H, N = map(int,input().split())

A_list = []
B_list = []
for _ in range(N):
  A, B = map(int,input().split())
  A_list.append(A)
  B_list.append(B)
 
A = np.array(A_list)
B = np.array(B_list)

magic_used = 0

def choose_attack(H):
    A_star = np.minimum(A, H)
    performace = np.divide(A_star,B)
    ind = np.argmax(performace)
    return ind

while H >= 0:
    ind = choose_attack(H)
    magic_used += B[ind]
    H = H - A[ind]

print(magic_used)
# Judge status: Accepted
S = input()

for s in S:
  if S.count(s) != 1:
    print("no")
    exit()
    
print("yes")
# Judge status: Accepted
#! -*- coding: utf -*-

import fractions

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

for i in range(n-1):
    monsters[i + 1] = fractions.gcd(monsters[i], monsters[i + 1])

print(monsters[-1])
# Judge status: Accepted
x, y = [int(x) for x in input().split()]
canbe = "No"
for i in range(1, x + 1):
    a = (i * 2) + (x - i) * 4
    b = (i * 4) + (x - i) * 2
    if a == y or b == y:
        canbe = "Yes"
        break
print(canbe)
# Judge status: Accepted
from collections import deque
s = deque(list(input()))
t = deque(list(input()))
for i in range(len(s)):
    if s == t:
        print('Yes')
        exit()
    s.appendleft(s.pop())
print('No')
# Judge status: Wrong Answer
n = int(input())
a = [1]

if n % 2 == 1:
    n -= 1

if n % 2 == 0:
    for i in range(int(n / 2)):
        a.append(2 * a[i])

ans = a[-1]*2 - 1

print(ans)
# Judge status: Wrong Answer
s=input()

if s[2]==s[3] and s[4]==s[5] and s[0]!=s[1] and s[0]!=s[2] and s[0]!=s[4] and s[1]!=s[2] and s[1]!=s[4] and s[2]!=s[4] :
  print ('Yes')
else :
  print ('No')
# Judge status: Accepted
n = int(input())
s = str(input())
c = 0
from collections import deque
res = deque([])
for i in range(n):
    if s[i] =='(':
        c += 1
    else:
        c -= 1
    if c < 0:
        res.appendleft('(')
        c = 0
    res.append(s[i])
if c > 0:
    res.append(')'*c)
print(''.join(list(res)))
# Judge status: Wrong Answer
n,m = map(int, input().split())
if n == 1: print(m-2 if m >=2 else 0)
elif n == 1: print(n-2 if n>=2 else 0)
else: print((n-2) * (m-2))
# Judge status: Wrong Answer
a,b,x = list(map(int,input().split()))
import math
if x >= a*a*b:
  print(math.atan(2*(a*a*b-x)/(a*a*a)) * 180/math.pi)
else:
  print(math.atan(a*b*b/(2*x)) * 180/math.pi)
# Judge status: Accepted
from math import ceil
n,k=map(int,input().split())
a=list(map(int,input().split()))
print(ceil((n-1)/(k-1)))
# Judge status: Accepted
n, a, b = map(int, input().split())

ans = 0
for i in range(1, n+1):
    t = 0
    v = i
    while v > 0:
        t += v%10
        v//=10
    if a <= t <= b:
        ans += i
print(ans)
# Judge status: Wrong Answer
import numpy as np
from collections import Counter

# 最頻値
def mode(list):
    c = Counter(list)
    freq_scores = c.most_common()
    max_count = freq_scores[0][1]
    modes = []
    for num in freq_scores:
        if num[1] == max_count:
            modes.append(num[0])
    return(modes)

n = int(input())
p_list = list(map(int, input().split()))
ans = 1
for i in range(n - 1):
  if p_list[i] >= p_list[i + 1]:
    ans += 1
print(ans)
# Judge status: Accepted
w,a,b = map(int,input().split())
print(max(0,max(a,b)-(min(a,b)+w)))
# Judge status: Accepted
n,Y=map(int,input().split())

ans=0
for x in range(0,n+1):
  if ans>0:
    break
  for y in range(0,n+1-x):
    z=n-x-y
    if 10000*x+5000*y+1000*z==Y:
      ans+=1
      print(str(x)+' '+str(y)+' '+str(z))
      
    if ans>0:
      break
      
if ans==0:
  print(str(-1)+' '+str(-1)+' '+str(-1))
# Judge status: Wrong Answer
#ここまでテンプレ
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n = int(stdin.readline().rstrip())
a = list(map(int,stdin.readline().rstrip().split()))

point = 0
mod = 10**9+7

su_a = sum(a)%mod

for i in a:
    point += (su_a-i)*i
    point %= mod

print(point//2)
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
c = [list(map(int, input().split())) for i in range(m)]
for i in range(n):
    dim, num = 10*10, -1
    for j in range(m):
        if abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1]) < dim:
            dim = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])
            num = j
    print(num+1)
# Judge status: Wrong Answer
k,n = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-1):
    a.append(k+a[i])
ans = a[n-1]-a[0]
for i in range(n,n*2-1):
    ans = min(ans,a[i]-a[i-n])
print(ans)
# Judge status: Accepted
k = int(input())
s = input()

if len(s) <= k:
    print(s)
else:
    print(s[:k] + '...')
# Judge status: Accepted
#!/usr/bin/env python3

import sys
input=sys.stdin.readline

n=int(input())
arr=list(map(int,input().split()))
ans=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            tmp=[arr[i],arr[j],arr[k]]
            tmp=sorted(tmp)
            s=set(tmp)
            if len(s)==3 and tmp[0]+tmp[1]>tmp[2]:
                ans+=1
print(ans)
# Judge status: Accepted
d,n = map(int,input().split())
if n != 100:
    print(100**d * n)
else:
    print(100**d * n + 100**d)
# Judge status: Accepted
N = int(input())

B = list(map(int, input().split()))
A = [B[0]]


for i in range(1, N-1):
  c = min(B[i-1], B[i])
  A.append(c)
  
A.append(B[N-2])

ans = 0

for j in range(N):
  ans += A[j]
  
print(ans)
# Judge status: Accepted
s = {'a':input(), 'b':input(), 'c':input()}
t = 'a'
while s[t] != '':
    tmp = s[t][0]
    s[t] = s[t][1:]
    t = tmp
print(t.upper())
# Judge status: Wrong Answer
n = int(input())

ans = [0 for _ in range(n+1)]

for x in range(1, int(n ** 0.5) + 1):
    for y in range(1, int(n ** 0.5) + 1):
        for z in range(1, int(n ** 0.5) + 1):
            a = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if a <= n:
                ans[a] += 1

for i in ans:
    print(i)
# Judge status: Accepted
import string

N = int(input()) - 1
ss = string.ascii_lowercase

ans = ""

while N >= 0:
  ans += ss[N % 26]
  N = N // 26 - 1
  if N < 0:
    break

print(ans[::-1])
# Judge status: Accepted
# B - Counting Roads
def main():
    import collections


    n, m = map(int, input().split())
    cnt = []

    for _ in range(m):
        temp = list(input().split())
        cnt += temp
    else:
        ans = collections.Counter(cnt)
        for i in range(1, n+1):
            print(ans[str(i)])


if __name__ ==  "__main__":
    main()
# Judge status: Accepted
k,x=map(int,input().split())
a=x-k+1
b=x+k-1
c=[]
for i in range(a,b+1):
    c.append(i)
print(" ".join(map(str, c)))
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
four = 0
two = 0
for i in range(N):
    if(a[i] % 4 == 0):
        four += 1
    elif(a[i] % 2 == 0):
        two += 1
if(four + two//2 >= N // 2):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import math
a, b, x = map(int, input().split())

if x <= (a**2*b)/2:
  ans = math.degrees(math.atan((a*b*b)/(2*x)))
else:
  ans = math.degrees(math.atan(2*(a**2*b-x)/a**3))

print(ans)
# Judge status: Accepted
x = int(input())
d, m = divmod(x, 11)
ans = d * 2
if m > 6:
  ans += 2
elif m > 0:
  ans += 1
print(ans)
# Judge status: Accepted

n=int(input()) 
pf={}
for i in range(2,int(n**0.5)+1):
    while n%i==0:
        pf[i]=pf.get(i,0)+1
        n//=i
if n>1:pf[n]=1
#print(pf)

cnt = 1
ans = 0
for i in pf.values():
    tmp = i
    while tmp >= cnt: 
        ans += 1
        tmp = tmp - cnt
        cnt += 1
    cnt = 1
print(ans)
# Judge status: Accepted

import math
n,k = map(int,input().split())
m = min(n, k)
win = 0#負ける確率
for i in range(1, m + 1):
    a = math.ceil(math.log2(k / i)) #a回連続で表で勝利
    win += 1 / n * pow(1 / 2, a) #iが出る確率*a回連続で表の確率
    #print(i, a, 1 / n * pow(1 / 2, a), win)
win += 1 / n * max(0, n - k) #さいころでk以上が出る確率
print(win)
# Judge status: Accepted
n, m = map(int, input().split())
x = [int(i) for i in input().split(maxsplit=(n-1))]

sum = 0
count = 0
for i in x:
    sum += i

con = (1/(4*m))*sum

for i in x:
    if i >= con:
        count += 1
    if count == m:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
a, b, c, d = map(int, input().split())

def gcd(x,y):
  while y:
    x, y = y, x%y
  return x
lcm = c*d // gcd(c,d)

def cnt(z):
  return b//z - (a-1)//z

print(b+1-a-cnt(c)-cnt(d)+cnt(lcm))
# Judge status: Wrong Answer
S = input()
print('Heisei' if S[5:7] < '04' or (S[6] == 4 and S[8:] < '31') else 'TBD')
# Judge status: Wrong Answer
c = [list(map(int, input().split())) for _ in range(3)]
print('Yes' if not sum(sum(c, [])) % 3 else 'No')
# Judge status: Wrong Answer
A = list(map(int, input().split()))
A = sorted(A)

if (A[2]-A[0]-(A[2]-A[1]))%2==0:
  ans = A[2]-A[1]+(A[2]-A[0]-(A[2]-A[1]))/2
else:
  ans = A[2]-A[1]+round((A[2]-A[0]-(A[2]-A[1]))/2)+2
                   
print(int(ans))
# Judge status: Accepted
A, B = [int(i) for i in input().split()]
print((A+B) % 24)
# Judge status: Accepted
n, k = map(int, input().split())
A = list(map(int, input().split()))
s = []
order = [-1] * (n+1)
l = 1
while order[l] == -1:
    order[l] = len(s)
    s.append(l)
    l = A[l-1]
new = s[order[l]:]
t = len(new)
first = len(s) - t
if k > first:
    print(new[(k-first)%t])
else:
    print(s[k])
# Judge status: Wrong Answer
x=list(map(int,input().split()))
sorted(x)
print(x[0]+x[1])
# Judge status: Accepted
a = int(input())
print(a**3+a**2+a)
# Judge status: Accepted
rgb=input()
print("YES" if int(rgb[::2])%4==0 else "NO")
# Judge status: Accepted
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7

s = input()
q = []
for i in range(len(s)):
    if s[i] == "0":
        q.append(0)
    elif s[i] == "1":
        q.append(1)
    elif s[i] == "B" and len(q)!=0:
        q.pop()
ans = ""
for i in range(len(q)):
    ans += str(q[i])
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

cnt = 0
j = 0
for i in range(n-1):
  if i%2 == 1:
    j += 1
  cnt += a[j]
print (cnt)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(0)
k = 0
if(n%2==1):
  k = (n-1)//2
  m = -1
else:
  k = n//2
  m = 1
for i in range(n):
  if(i%2==0):
    b[k+m*i//2]=a[i]
  else:
    b[k-m*(i+1)//2]=a[i]
ans = ""
for i in range(n):
  ans += str(b[i])+" "
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
c,d,e=10000,5000,1000
for i in range(a):
  for j in range(a):
    for k in range(a-i-j):
      if i*c+j*d+k*e==b:print(i,j,k)
else:print(-1,-1,-1)