Harryxun/stf_run huggingface dataset:
s = [input() for _ in range(n)]
prefix = ['M', 'A', 'R', 'C', 'H']
cnt = [0] * 5
ans = 0
for i in range(n):
    for j in range(5):
        if s[i][0] == prefix[j]:
            cnt[j] += 1
for i in range(2 ** 5):
    flag = [False] * 5
    for j in range(5):
        if (i >> j) & 1:
            flag[j] = True
    if flag.count(True) == 3:
        tmp = 1
        for k in range(5):
            if flag[k]:
                tmp *= cnt[k]
        ans += tmp
print(ans)

### FIXED CODE ###

n = int(input())
s = [input() for _ in range(n)]
prefix = ['M', 'A', 'R', 'C', 'H']
cnt = [0] * 5
ans = 0
for i in range(n):
    for j in range(5):
        if s[i][0] == prefix[j]:
            cnt[j] += 1
for i in range(2 ** 5):
    flag = [False] * 5
    for j in range(5):
        if (i >> j) & 1:
            flag[j] = True
    if flag.count(True) == 3:
        tmp = 1
        for k in range(5):
            if flag[k]:
                tmp *= cnt[k]
        ans += tmp
print(ans)
import sys

n,k=map(int,input().split())
a=list(map(int,input().split()))
#n,k=10,10
#a=[158260522, 877914575, 602436426, 24979445,
#   861648772, 623690081, 433933447, 476190629,
#   262703497, 211047202]

if k==0:
    print(max(a))
    sys.exit()

def rf(mm):
    icnt=0
    for i in range(n):
        icnt+=(a[i]-1)//mm+1
    return icnt

asum=sum(a)
m=asum//(n+k)
um=asum
lm=1
for ii in range(100):
#    print(m,rf(m))
    if rf(m)>(n+k) :
#        print("1:",m,rf(m))
        lm=m
        m=(um+m)//2+1
    elif rf(m)<(n+k):
#        print("2:",m,rf(m))
        um=m
        m=(lm+m)//2
    elif rf(m)==n+k and rf(m-1)==n+k:
#        print("5:",m,rf(m))
        um=m
        m=(lm+m)//2+1
    elif rf(m)==n+k and rf(m-1)>n+k:
#        print("3:",m,rf(m))
        break
    else:
#        print("4:",m,rf(m))
        m=m-1

print(m)


### FIXED CODE ###

import sys

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

if k==0:
    print(max(a))
    sys.exit()

def rf(mm):
    if mm==0:
        mm=1
    icnt=0
    for i in range(n):
        icnt+=(a[i]-1)//mm+1
    return icnt

asum=sum(a)
m=asum//(n+k)
um=asum
lm=1
for ii in range(60):
    if m==1:
        break
    if rf(m)<=(n+k) and rf(m-1)>(n+k):
        break
    if um-lm<5:
        break
    if rf(m)>(n+k):
        lm=m
        m=(um+lm)//2-1
    elif rf(m)<(n+k):
        um=m
        m=(um+lm)//2-1
    else:
        um=m-1
        m=(um+lm)//2-1
#    if rf(m)==(n+k) and um-lm<5:

if um<1:
    print(1)
    sys.exit()
    
for mi in range(um,max(0,lm-1),-1):
    if rf(mi)<=(n+k) and rf(mi-1)>(n+k):
        break

print(mi)
a,b = map(int, input().split)
print((a-1)*(b-1))

### FIXED CODE ###

a,b = map(int, input().split())
print((a-1)*(b-1))
import math

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

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]//math.gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]=(LCM*pow(A[i],MOD-2,MOD))%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i]%MOD + ans%MOD)%MOD

print(ans)

### FIXED CODE ###

def lcm(X,Y):
    x=X
    y=Y
    if y>x:
        x,y=y,x
    while x%y!=0:
        x,y=y,x%y
    return X*Y//y

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

LCM = A[0]
for i in range(0,N-1,1):
    LCM = lcm(LCM,A[i+1])
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]= (LCM%MOD)*pow(A[i],MOD-2,MOD)%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i] + ans)%MOD

print(ans)
num_word = int(input())
word_list=[]
word_list = [[int(i) for i in input().split()] for i in range(n)] 

word_list_temp=[]
for j in range(len(word_list)):
  if j == len(word_list)-1:
    print ("Yes")
    break
  else:
    old_word=word_list[j]
    old_word_sep=list(old_word)
    word_list_temp.append(old_word)
    new_word=word_list[j+1]
    new_word_sep=list(word_list[j+1])
    if old_word_sep[len(old_word)-1]!=new_word_sep[0]:
      print ("No")
      break
    elif new_word in list(word_list_temp):
      print ("No")
      break
    else:
      continue

### FIXED CODE ###

num_word = int(input())
word_list=[]
word_list = [str(input()) for i in range(num_word)] 
 
word_list_temp=[]
for j in range(len(word_list)):
  if j == len(word_list)-1:
    print ("Yes")
    break
  else:
    old_word=word_list[j]
    old_word_sep=list(old_word)
    word_list_temp.append(old_word)
    new_word=word_list[j+1]
    new_word_sep=list(word_list[j+1])
    if old_word_sep[len(old_word)-1]!=new_word_sep[0]:
      print ("No")
      break
    elif new_word in list(word_list_temp):
      print ("No")
      break
    else:
      continue
n, l = map(int, input().split())

import numpy as np
taste = np.arange(n)
taste = taste + l

idx = np.argmin(np.abs(taste))

s = 0
for i in range(n):
    if i != idx:
        s += taste[i]

print(s)


### FIXED CODE ###

n, l = map(int, input().split())

import numpy as np
taste = np.arange(n)
taste = taste + l

idx = np.argmin(np.abs(taste))

s = 0
for i in range(n):
    if i != idx:
        s += taste[i]

print(s)
a = input()
for i in range(len(a) // 2):
    if a[i] != b[-(i+1)]:
        print("No")
        exit()
b = a[0:(len(a) - 1) // 2]
c = a[(len(a) + 3) // 2 - 1:len(a)]
for i in range(len(b) // 2):
    if b[i] != b[-(i+1)]:
        print("No")
        exit()
for i in range(len(c) // 2):
    if c[i] != c[-(i+1)]:
        print("No")
        exit()
print("Yes")

### FIXED CODE ###

a = input()
for i in range(len(a) // 2):
    if a[i] != a[-(i+1)]:
        print("No")
        exit()
b = a[0:(len(a) - 1) // 2]
c = a[(len(a) + 3) // 2 - 1:len(a)]
for i in range(len(b) // 2):
    if b[i] != b[-(i+1)]:
        print("No")
        exit()
for i in range(len(c) // 2):
    if c[i] != c[-(i+1)]:
        print("No")
        exit()
print("Yes")
xn = input().split()
data = input().split()
data_2 = []

x = xn[0] #これに近い値
data.sort() #小さい順

#dataにない値が出るまでxから１引き続ける　１引き続けた値をaとする

a = x-1
while True:
    #check
    for i in range(len(data)):
        if data[i] == a:
            a = a - 1
            break
        else:
            data_2.append(a)
            break
    if a == data_2[0]:
        break

#dataにない値が出るまでxから１足し続ける　１足し続けた値をbとする
b = x + 1
while True:
    #check
    for i in range(len(data)):
        if data[i] == a:
            a = a + 1
            break
        else:
            data_2.append(a)
            break
    if b == data_2[1]:
        break

#aとbの小さい方をprint
if a < b:
    print(a)
else:
    print(b)

### FIXED CODE ###

xn = input().split()
data_2 = []
x = int(xn[0]) #これに近い値

if int(xn[1]) == 0:
    print(x)
else:
    data_str = input().split()
    data = [int(s) for s in data_str] #data_strをint型に変換
    data.sort() #小さい順
    #dataにない値が出るまでxから１引き続ける　１引き続けた値をaとする
    a = int(xn[0])
    #check
    while True: #while1
        while True: #while2
            for i in range(len(data)):
                if data[i] != a:
                    continue
                else:
                    a -= 1
                    break #forから抜け出す
            else:
                data_2.append(a)
                break #while2から抜け出す

        if len(data_2) == 1: #リストに１つデータが入っていたら　入ってないならwhile1ループ
            break #while1から抜け出す    


    #dataにない値が出るまでxかに１を足し続ける　１足し続けた値をbとする
    b = int(xn[0])
    while True: #while1
        while True: #while2
            for i in range(len(data)):
                if data[i] != b:
                    continue
                else:
                    b += 1
                    break #forから抜け出す
            else:
                data_2.append(b)
                break #while2から抜け出す

        if len(data_2) == 2: #リストに2つデータが入っていたら　入ってないならwhile1ループ
            break #while1から抜け出す  


    #aとbの小さい方をprint
    if abs(x-a) <= abs(b-x):
        print(a)
    else:
        print(b)
from bisect import insort_left, bisect_left, bisect_right

characters = [chr(ord('a') + i) for i in range(26)]

def main():
    N = int(input())
    S = input()
    Q = int(input())

    indices_dict = {a: [] for a in characters}
    for i, s in enumerate(S):
        indices_dict[s].append(i + 1)

    for i in range(Q):
        a, b, c = input().split()
        if int(a) == 2:
            l, r = int(b), int(c)
            cnt = 0
            for c in characters:
                if len(indices_dict[c]) > 0 and \
                    l <= indices_dict[c][-1] and \
                    indices_dict[c][bisect_left(indices_dict[c], l)] <= r:
                    cnt += 1
            print(cnt)
        else:
            from_c = S[ind - 1]
            ind, to_c = int(b), c
            if from_c == to_c:
                continue
            insort_left(indices_dict[to_c], ind)
            indices_dict[from_c].pop(bisect_left(indices_dict[from_c], ind))
            S[ind] = to_c

if __name__ == "__main__":
    main()


### FIXED CODE ###

from bisect import insort_left, bisect_left
n = int(input())
s = list(input())
Q = int(input())
query = [input() for _ in range(Q)]
dic = {chr(i+ord('a')):[] for i in range(26)}
for ind, c in enumerate(s):
    dic[c].append(ind)

for q in query:
    t, a, b = q.split()
    a = int(a)-1
    if t=='1':
        if s[a]==b:
            continue
        ind = bisect_left(dic[s[a]], a)
        dic[s[a]].pop(ind)
        insort_left(dic[b], a)
        s[a] = b
    else:
        b = int(b)-1
        tmp = 0
        for li in dic.values():
            if li and a<=li[-1] and li[bisect_left(li, a)] <= b:
                tmp += 1
        print(tmp)
str = input()
str_list = list(str)
 
if str_list[0] =! str_list[1]:
  print("Yes")
elif str_list[1] == str_list[1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

str = input()
str_list = list(str)
 
if str_list[0] != str_list[1]:
  print("Yes")
elif str_list[1] != str_list[2]:
  print("Yes")
else:
  print("No")
N, K = map(int, input().split())
h = list(map(int, input().split()))

INF = 10**9
dp = [INF] * (N + K)
dp[0] = 0
for i in range(N):
    for k in range(1, K+1):
        if i + k >= N:
            break
        dp[i+k] = min(dp[i+k], dp[i] + abs(h[i]-h[i+k]))
print(dp[N-1])



### FIXED CODE ###

N = int(input())
for c4 in range(26):
    for c7 in range(16):
        c = 4*c4 + 7*c7
        if c == N:
            print('Yes')
            exit()
print('No')
import numpy as np

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

S = input()

ac = np.zeros(N-1)

for i in range(Q):
	l, r = map(int, input().split())
    print(S.count('AC'))
	#print(int(sum(ac[l-1:r-2])))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])
def main():
    N,K,Q=map(int,input().split())
    sum2=[]
    score=[K]*N
    for i in range(Q):
        num=int(input())
        comp[i][:num-1]=[-1]*[num-1]
        comp[i][num-1]=[0]
        comp[i][num:N]=[-1]*[N-num]
    for i in range(N):
        sum2.append(sum(comp[i]))
    for i,j in score,sum2:
        score.append(i+j)
    for s in score:
        if s>0:
            print('Yes')
        else:
            print('No')

if __name__=='__main__':
    main()


### FIXED CODE ###

n, k, q = map(int, input().split())
points = [k] * n
a = []
for i in range(q):
    a.append(int(input())-1)
for cand in a:
    points[cand] += 1
points = [i-q for i in points]
ans = ["Yes" if i > 0 else "No" for i in points]
print(*ans, sep="\n")
N,M=map(int,input().split())
l=[list(map(int,input().split())) for i in range(M)]
kyotu=[]

for m in range(M):
  code="name{}=[]".format(m)
  exec(code)

for j in range(M):
  "name{}=range(l[j][0],l[j][1]+1)".format(j)
  codea=print("name{}").format(j)
  exec(codea)
  
  
for k in range(M):
  co="kyotu=set(name{}) & set(name{})".format(k,k+1)
  za="name{}=kyotu".format(k+1)
  exec(co)
  exec(za)
  
  
print(kyotu)

    


### FIXED CODE ###

N,M=map(int,input().split())
l=[list(map(int,input().split())) for i in range(M)]
maxL=1
minR=N
for j in range(M):
  maxL=max(maxL,l[j][0])
  minR=min(minR,l[j][1])

ans=minR-maxL+1
ans=max(ans,0)
print(ans)
A,B,N=map(int,input().split())
ans=[0]*N
for x in range(0,N+1):
    a=int((A*x)/B)
    b=A*int(x/B)
    ans[x-1]+=a-b
print(max(ans))

### FIXED CODE ###

A,B,N=map(int,input().split())
x=min(B-1,N)
print(int(A*x/B)-int(x/B)*A)
from math import factorial as fact
from collections import Counter

N = int( input() )
tree = list( map( int, input().split() ) )
ans = 1
if tree[0] != 0:
    print(0)
else:
    c = Counter(tree)
    if c[0] != 1:
        print(0)
    else:
        print(c)
        a = 1
        for i in range( 1,len(c)):
            t = c[i]
            if a == 1:
                print(ans)
                ans *= t
            else:
                print(ans)
                ans *= ( a ** t )
                if t != 1
                    ans = int( ans / fact(a) )
            a = t 
        print(ans)

### FIXED CODE ###

from math import factorial as fact
from collections import Counter
import sys

N = int( input() )
tree = list( map( int, input().split() ) )
ans = 1
if tree[0] != 0:
    print(0)
else:
    c = Counter(tree)
    if c[0] != 1:
        print(0)
    else:
        ans = 1
        a = c[0]
        for i in range( 1,len(c)):
            t = c[i]
            if t == 0:
                print(0)
                sys.exit()
            else:
                ans *= ( a**t )
                a = t
        print(ans%998244353)
from itertools import product

N = int(input())
S = [0 if i == 'o' else 1 for i in input()]

for i, j in product(range(2), repeat=2):
	pattern = [i, j] + [0] * (N - 2) 
	for k in range(2, N):
		pattern[k] = ( S[k-1] - (pattern[k - 1] + pattern[k - 2] )) % 2
	if S[-1] != (pattern[-2] + pattern[-1] + pattern[0]) % 2 : 
		continue
	if S[0] != (pattern[-1] + pattern[0] + pattern[1]) % 2 :
		continue 	
	answer = [ 'S' if pattern[k] == 0 else 'W' for k in range(N)]
	print(''.join(answer))
	return None
print(-1)

### FIXED CODE ###

from itertools import product

def solve():
    N = int(input())
    S = [0 if i == 'o' else 1 for i in input()]
    
    for i, j in product(range(2), repeat=2):
        pat = [i, j] + [0]*(N - 2)
        for k in range(2, N):
            pat[k] = (S[k - 1] - (pat[k - 1] + pat[k - 2])) % 2

        if S[-1] != (pat[0] + pat[-1] + pat[-2]) % 2:
            continue
        if S[0] != (pat[1] + pat[0] + pat[-1]) % 2:
            continue

        ans = ['S' if pat[k] == 0 else 'W' for k in range(N)]
        print(''.join(ans))
        return None

    print(-1)

if __name__ == '__main__':
    solve()
from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
C = Counter([])
X, Y = [], []
m = 0
for _ in range(n):
    a = A[m]-1
    C[m] += 1
    X.append(m)
    if C[a] != 0:
        Y = X[X.index(a):]
        X = X[:X.index(a)]
        break
    m = a
# print(X,Y)
x = len(X)
y = len(Y)
if k-1 <= x:
    print(X[k]+1)
else:
    k -= x
    print(Y[k-(k//y)*y]+1)


### FIXED CODE ###

from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
C = Counter([])
X, Y = [], []
m = 0
for _ in range(n):
    a = A[m]-1
    C[m] += 1
    X.append(m)
    if C[a] != 0:
        Y = X[X.index(a):]
        X = X[:X.index(a)]
        break
    m = a
# print(X,Y)
x = len(X)
y = len(Y)
if k <= x-1:
    print(X[k]+1)
else:
    k -= x
    print(Y[k-(k//y)*y]+1)
N = input()
ans = N // 2
print(ans)

### FIXED CODE ###

N = input()
M = int(N)
jud = M % 2
if jud == 1:
    ans = M // 2 + 1
else:
    ans = M // 2
print(ans)
import bisect
MOD = 10**9 + 7

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
  
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
  
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
 
n, k = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]
bit = Bit(n)
ans = 0
 
for i, p in enumerate(a):
    bit.add(p, 1)
    ans += i + 1 - bit.sum(p)
 
a.sort()
big = 0
for item in a:
    big += n - bisect.bisect_right(a, item)

ans2 = (ans * k) + (big * k * (k - 1) // 2)
ans2 %= MOD
print(ans2)

### FIXED CODE ###

import bisect
MOD = 10**9 + 7
 
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
  
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
  
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
 
n, k = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]
bit = Bit(2010 * 2)
ans = 0
 
for i, p in enumerate(a):
    bit.add(p, 1)
    ans += i + 1 - bit.sum(p)
 
a.sort()
big = 0
for item in a:
    big += n - bisect.bisect_right(a, item)
 
times = (k * (k - 1) // 2) % MOD
ans2 = (ans * k) % MOD + (big * times) % MOD
ans2 %= MOD
print(ans2)
import math
a, b, c = map(float, input().split())
sqa = math.sqrt(a)
sqb = math.sqrt(b)
sqc = math.sqrt(c)
if sqa + sqb < sqc:
  print(Yes)
else:
  print(No)

### FIXED CODE ###

import math

a, b, c = map(int, input().split())


if c-a-b > 0 and 4*a*b < (c-a-b)**2:
  print("Yes")
else:
  print("No")
num = list(map(int,input().split()))
num.sort()
print(num[])

### FIXED CODE ###

num = list(map(int,input().split()))
num.sort()
print(num[0],num[1],num[2])
a_list = list(input())
b_list = list(input())
c_list = list(input())
x=a_list.pop(0)
while True:
    if x=="a":
        x = a_list.pop(0)
    elif x == "b":
        x = b_list.pop(0)
    else:
        x = c_list.pop(0)
    if not len(a_list):
        print("A")
        break
    elif not len(b_list):
        print("B")
        break
    elif not len(c_list):
        print("C")
        break

### FIXED CODE ###

a_list = list(input())
b_list = list(input())
c_list = list(input())
x=a_list.pop(0)
while True:
    if x=="a":
        if len(a_list)==0:
            print("A")
            break
        else:
            x = a_list.pop(0)
    elif x == "b":
        if len(b_list)==0:
            print("B")
            break
        else:
            x = b_list.pop(0)
    else:
        if len(c_list)==0:
            print("C")
            break
        else:
            x = c_list.pop(0)
import numpy as np
N,M = map(int,input().split())
A_s = []
for _ in range(N):
  A_s.append(list(map(int,input().split())))
## Aiの順にsortする
A_s = sorted(A_s,key=lambda x:x[0])
money = 0
num = 0
pre_num = 0
for a_s in A_s:
  num += a_s[1]
  if num <= M:
    money += a_s[1] * a_s[0]
    pre_num += a_s[1]
  else:
    money += (M-pre_num) * a_s[0]
    break
  #print(money)
print(money)

### FIXED CODE ###

import numpy as np
H,W = map(int,input().split())
h,w = map(int,input().split())
matrix = np.ones((H,W))
h_num = np.random.choice(H,h,replace=False)
w_num = np.random.choice(W,w,replace=False)

for _ in h_num:
  matrix[_,:] = 0
for _ in w_num:
  matrix[:,_] = 0

print(int(np.sum(matrix)))
S = raw_input()
lis = list(S)
for i in lis:
	mat = []
	if i in S
		print "no"
		break
	mat.add(i)
else:
	print "yes"

### FIXED CODE ###

S = raw_input()
lis = list(S)
mat = []
for i in lis:
	if i in mat:
		print "no"
		break
	mat.append(i)
else:
	print "yes"
import fraction
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fraction.gcd(x, y)

def lcm(nums):
    return reduce(lcm_base, nums, 1)

n, a = input(), list(map(int, input().split()))
l = lcm(a)
sum = 0
for aa in a:
    sum += (l-1) % aa
print(sum)


### FIXED CODE ###

from functools import reduce
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(nums):
    return reduce(lcm_base, nums, 1)

n, a = input(), list(map(int, input().split()))
l = lcm(a)
sum = 0
for aa in a:
    sum += (l-1) % aa
print(sum)
import sys

s = input()
A = "keyence"

ind = 100

for i in range(len(s)):
	if i == 0:
		if s[i] == A[i]:
			continue
		else:
			ind = -1
			break

	if i == 6:
		if s[i] == A[i]:
			print("YES")
			sys.exit()

	else:
		if s[i] == A[i]:
			continue
		else:
			ind == i
			break

if ind == -1:
	print("NO")
	sys.exit()

ind_back = 100

for i in range(1,8):
	if i == 1:
		if s[-i] == A[-i]:
			continue
		else:
			ind_back == -1
			break

	if i == 7:
		if s[-i] == A[-i]:
			print("YES")
			sys.exit()

	else:
		if s[-i] == A[-i]:
			continue
		else:
			ind_back == 7-i+1

if ind == ind_back:
	print("YES")
else:
	print("NO")


### FIXED CODE ###

s = input()
l = len(s)
cond = False
for i in range(8):
	if s[:i] + s[-(7-i):] == "keyence":
		cond = True

if cond:
	print("YES")
else:
	print("NO")
n=int (input())
A=list(map(int,input().split()))
q=int (input())
m=list(map(int,input().split()))

box=[]
for i in range(2**n):
	b = '{0:0{1}b}'.format(i,n)
	tmp=[]
	for j in rangee(n):
		if b[j]=='1':
			if b[j]=='1':
				tmp.append(A[j])
	sum_list.append(box(tmp))
	
for k in m:
	if k in box:
		print("yes")
	else:
		print("no")


### FIXED CODE ###

n=int (input())
A=list(map(int,input().split()))
q=int (input())
m=list(map(int,input().split()))

box=[]
for i in range(2**n):
	b = '{0:0{1}b}'.format(i,n)
	tmp=[]
	for j in range(n):
		if b[j]=='1':
			if b[j]=='1':
				tmp.append(A[j])
	box.append(sum(tmp))
	
for k in m:
	if k in box:
		print("yes")
	else:
		print("no")
N=int(input())
a=list(map(int,input().split()))

b=[0]*(N+1)
PN=[2]
M=0

if a[0]==1:
    b[1]=1
    M+=1
if a[1]==1:
    b[2]=1
    M+=1
    b[4]=1
    M+=1

for i in range(3,N+1):
    if a[i-1]==1 and b[i]==0:
        b[i]=1
        M+=1
        for j in PN:
            if i%j==0:
                if i+j>N:
                    print(-1)
                    exit()
                else:
                    b[i+j]=1
                    M+=1
    if a[i-1]==0 and b[i]==1:
        if i+i>N:
            print(-1)
            exit()
        else:
            b[i+i]=1
        for j in PN:
            if i%j==0:
                if i+j>N:
                    print(-1)
                    exit()
                else:
                    b[i+j]=1
                    M+=1
    f=True
    for j in PN:
        if i%j==0:
            f=False
    if f==True:
        PN.append(i)

print(M)
for i in range(1,N+1):
    if b[i]==1:
        print(i,end=" ")


### FIXED CODE ###

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

b=[0]*(N+1)
M=0

for i in range(N,0,-1):
    cnt = 0

    for j in range(i+i,N+1,i):
        if b[j] == 1:
            cnt += 1

    if a[i-1]==1 and cnt%2==0:
        b[i]=1
        M+=1
    elif a[i-1]==0 and cnt%2==1:
        b[i]=1
        M+=1
        

print(M)
for i in range(1,N+1):
    if b[i]==1:
        print(i,end=" ")
n = input()
a_list = input().split(" ")

b = [int(a) for a in a_list]
max = 10**9 + 7

sum = 0
for i in range(0, len(b)-1):
  for j in range(i+1, len(b)):
    sum += b[i] * b[j]
    sum = sum % max
print(sum)



### FIXED CODE ###

d, t, s = input().split(" ")
 
if int(s) * int(t) < int(d):
  print('No')
else:
  print('Yes')
from itertools import accumulate
from math import gcd
def lcm_(x,y):
    return x*y//gcd(x,y)
def lcm(numbers):
    return list(accumulate(numbers,lcm_))
n=int(input())
A=[int(i) for i in input().split()]
L=lcm(A)[-1]-1
f=0
for i in A:
    f+=L%i

print(f)

### FIXED CODE ###

from itertools import accumulate
from fractions import gcd
def lcm_(x,y):
    return x*y//gcd(x,y)
def lcm(numbers):
    return list(accumulate(numbers,lcm_))
n=int(input())
A=[int(i) for i in input().split()]
L=lcm(A)[-1]-1
f=0
for i in A:
    f+=L%i

print(f)
n, m = map(int, input().split())
a = [-1]
for i in range(m):
    a.append(int(input()))
a.append(n+1)

stairs = [0, 1, 1]
for i in range(3, n+1):
    stairs.append(stairs[i-1] + stairs[i-2])

mod = 10 ** 9 + 7
count = 1
for i in range(m+1):
    diff = a[i+1] - a[i] - 1
    count *= stairs[diff]
print(count % mod)


### FIXED CODE ###

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

ways = [1, 1]
for i in range(2, n + 1):
    ways.append(ways[i-2] + ways[i-1])

stairs = []
now = 0
for i in range(m):
    stairs.append(a[i] - 1 - now)
    now = a[i] + 1

stairs.append(n - now)

ans = 1
for ele in stairs:
    if ele == -1:
        ans *= 0
    else:
        ans *= ways[ele]

mod = 10 ** 9 + 7
print(ans % mod)