Harryxun/stf_run huggingface dataset:
n,m = map(int, input().split())
while (n != 0 or m != 0):
    nlist = [] 
    mlist = []
    for i in range(n):
        t = int(input()) 
        nlist.append(t) 
    for i in range(m): 
        t = int(input())
        mlist.append(t)
    nsum = [] 
    for i in range(n):
        for k in range(n-i):
            c = 0 
            for l in range(i+1):
                c += nlist[k+l]
            nsum.append(c)
    msum = [] 
    for i in range(m): 
        for k in range(m-i):
            c = 0
            for l in range(i+1):
                c += mlist[k+l]
            msum.append(c)
    count = 0
    for i in nsum:
        count += msum.count(i)
    print(count) 
    n,m = map(int, input().split())


### FIXED CODE ###

while True:
    n,m = map(int, input().split())
    if n == 0 and m == 0:
        break
    nlist = [0]
    mlist = [0]
    for i in range(n):
        nlist += [nlist[-1] + int(input())]
    for i in range(m):
        mlist += [mlist[-1] + int(input())]

    l = [0for i in range(1000*1501)]
    for i in range(n):
        t = 0
        for k in range(i+1,n+1):
            t = nlist[k] - nlist[i]
            l[t] += 1
    count = 0
    for i in range(m):
        for k in range(i+1,m+1):
            t = mlist[k] - mlist[i]
            count += l[t]
    
    print(count)
import sys
import itertools
# import numpy as np
import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = readline().decode()
n = list(reversed(n))

x = 1
count = [0 for _ in range(2019)]
MOD = 2019
acc = 0

count[0] = 1
ans = 0

for c in n:
    a = x * int(c)
    acc += a
    acc %= MOD
    ans += count[acc]
    count[acc] += 1
    x = (x * 10) % MOD

print(ans)


### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = input()
n = reversed(n)

x = 1
count = [0 for _ in range(2019)]
MOD = 2019
acc = 0
count[0] = 1
ans = 0

for c in n:
    a = x * int(c)
    acc += a
    acc %= MOD
    ans += count[acc]
    count[acc] += 1
    x = (x * 10) % MOD

print(ans)
n,m=[int(i) for i in input().split()]
p=[[0 for i in range(2)] for j in range(n)]

for i in range(m):
  p[i]=[int(i) for i in input().split()]
  
  
#隣接リスト  
l = [[] for i in range(n+1)]
for pi in p:  #0-originedに注意、l[0]は空
        l[pi[0]].append(pi[1])
        l[pi[1]].append(pi[0])  

count=0
for i in l[1]:
  if i in l[n]:
    count=1
    
if count==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
      

### FIXED CODE ###

n,m=[int(i) for i in input().split()]
p=[[0 for i in range(2)] for j in range(m)]

a=[0 for i in range(n+1)]
b=[0 for i in range(n+1)]

for i in range(m):
  p[i]=[int(i) for i in input().split()]

for i in range(m):  
  
  if p[i][0]==1:
    a[p[i][1]]+=1
    
  elif p[i][1]==n:
    a[p[i][0]]+=1
   
    
if max(a)>=2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
n = int(input())
l = list(map(int, input().split()))

mn = min(l)
mx = max(l)

ms = 10**9
ll = [0]*n
for j in range(mn, mx+1):
  	for i in range(n):
      ll[i] = (l[i] - j)**2
    s = sum(ll)
    ms = min(ms, s)
    
print(ms)

### FIXED CODE ###

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

mn = min(l)
mx = max(l)

ms = 10**9
for j in range(mn, mx+1):
    s = sum([(i-j)**2 for i in l])
    ms = min(ms, s)
    
print(ms)
import numpy as np

N = int(input())

ans = np.zeros(int(N))

if N<10001 and N>3:
    maxa = int(np.sqrt(N-2))
    for x in range(1,maxa):
        for y in range(1,x):
            for z in range(1,y):
                p = x*x+y*y+z*z+x*y+y*z+z*x
                if p<N+1:
                    ans[p-1] += 6


    for x in range(1,maxa):
        for y in range(1,x):
            p = x*x*3+y*y+x*y*2
            if p<N+1:
                ans[p-1] += 3
            p = y*y*3+x*x+x*y*2
            if p<N+1:
                ans[p-1] += 3

    for x in range(1,maxa):
        p = x*x*6
        if p<N+1:
            ans[p-1] += 1

for x in range(0,N):
    print(int(ans[x]))

### FIXED CODE ###

import numpy as np
a, b, c = map(int,input().split())
count = 0

for i in range(a,b+1):
    if i % c == 0:
        count += 1

print(count)
n=int(input())
s=[int(input()) for i in range(n)]
print(len(set(s))

### FIXED CODE ###

n=int(input())
s={input() for i in range(n)}
print(len(s))
while True:
    n = int(input())
    if n == 0:
        break
    score = [0, 0]
    for _ in range(n):
        A, B = map(int, input().split())
        if A == B:
            score += [A, B]
        else:
            score[A > B] += A+B
    print(*score)

### FIXED CODE ###

while True:
    n = int(input())
    if n == 0:
        break
    score = [0, 0]
    for _ in range(n):
        A, B = map(int, input().split())
        if A == B:
            score[0] += A
            score[1] += B
        else:
            score[A < B] += A+B
    print(*score)
a, b, c = map(int, input().split())
print(max(c - (a - b)), 0)


### FIXED CODE ###

a, b, c = map(int, input().split())
print(max(c - (a - b), 0))
import sys
sys.setrecursionlimit(10 ** 7)
n = int(input())
adjacent_list = [[] for i in range(n+1)]
data = []
edgedata = {}
for i in range(n-1):
    a, b = list(map(int, input().split()))
    data.append([a,b])
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
#adjacent_list = sorted(adjacent_list, key = lambda x:len(x),reverse = True)
max_node = 0
finished = set()
for i in range(1,n):
    if len(adjacent_list[i]) > max_node:
        max_node = i
k = len(adjacent_list[max_node])
def dfs(node, num):
    global edgedata
    node_list = sorted(adjacent_list[node], key = lambda x:len(adjacent_list[x]))
    color_list = [i for i in range(1,k+1) if i != num]
    c_i = 0
    finished.add(node)
    for i in node_list:
        if i not in finished:
            s = min(node, i)
            t = max(node, i)
            vv = str(s)+str(t)
            edgedata[vv] = color_list[c_i]
            dfs(i, color_list[c_i])
            c_i += 1
dfs(k,-1)
print(k)
for i in data:
    sss = (str(i[0]) + str(i[1]))
    print(edgedata[sss])
#output k

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
n = int(input())
#隣接リスト
adjacent_list = [[] for i in range(n+1)]
#入力されたデータを保存しておくやつ
data = [None] * (n - 1)
#最終的に色を入れておくやつ。
#edgedata[(1,2)] => 1->2の辺の色を入れておく
edgedata = {}
for i in range(n-1):
    a, b = list(map(int, input().split()))
    data[i] = [a, b]
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
#つながってるノードが一番多いやつを保存しておく
max_node = 0
#探索が終わったやつを入れる
finished = set()
for i in range(1,n):
    if len(adjacent_list[i]) > len(adjacent_list[max_node]):
        max_node = i
#kには色の種類を入れる
k = len(adjacent_list[max_node])
#print("k => {}".format(k))
def dfs(node, num):
    #隣接リストの中身を、つながってるノード順にソート
    node_list = sorted(adjacent_list[node], key = lambda x:len(adjacent_list[x]))
    #さっきつかったいろは使わないようにする
    color_list = [i for i in range(1,len(node_list) + 2) if i != num]
    c_i = 0
    finished.add(node)
    for i in node_list:
        #まだ見てなかったら、dfsを掛ける
        if i not in finished:
            #小さいほうから大きいほうに文字を並べ、ハッシュに値を保存
            #print("{}".format(color_list))
            #print("c_i =>{}  node =>{}".format(c_i,node))
            edgedata[(min(node, i), max(node, i))] = color_list[c_i]
            #color_list[c_i]は使ったので、使った色として引数で渡す。
            dfs(i, color_list[c_i])
            #この色は使ったから、一個ずらす
            c_i += 1
#一番のノードを根とし、dfsをかける
dfs(k,-1)
print(k)
for i in data:
    print(edgedata[tuple(i)])
#output k
n,x=map(int,input().split())
l=list(map(int,input().split()))
length=0
i=0
while length<=x:
    length+=l[i]
    i+=1
print(i)


### FIXED CODE ###

n,x=map(int,input().split())
l=list(map(int,input().split()))
length=0
i=0
while length<=x and i<=n-1:
    length+=l[i]
    i+=1
if length<=x:
    print(n+1)
else:
    print(i)
S = input()
if S = 'Sunny':
    print('Cloudy')
elif S = 'Cloudy':
    print('Rainy')
elif S = 'Rainy':
    print('Sunny')


### FIXED CODE ###

S = input()
if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
elif S == 'Rainy':
    print('Sunny')
def visit(current, v, dist, color):
    for ele in v[current]:
        if color[ele] != -1:
            continue
        if dist[(ele, current)] % 2 == 0:
            color[ele] = color[current]
        else:
            if color[current] == 0:
                color[ele] = 1
            else:
                color[ele] = 0
        visit(ele, v, dist, color)

def main():

    num = int(input())

    v = [[] for i in range(num + 1)]

    dist = {}

    for i in range(1, num):
        a, b, d = map(int, input().split())
        v[a].append(b)
        v[b].append(a)
        dist[(a, b)] = d
        dist[(b, a)] = d

    color = [-1 for i in range(num + 1)]
    color[1] = 0
    visit(1, v, dist, color)

    for i in range(1, num + 1):
        print(color[i])

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys


def visit(current, v, dist, color):
    for ele in v[current]:
        if color[ele] != -1:
            continue
        if dist[(ele, current)] % 2 == 0:
            color[ele] = color[current]
        else:
            if color[current] == 0:
                color[ele] = 1
            else:
                color[ele] = 0
        visit(ele, v, dist, color)

def main():
    sys.setrecursionlimit(100100)
    num = int(input())

    v = [[] for i in range(num + 1)]

    dist = {}

    for i in range(1, num):
        a, b, d = map(int, input().split())
        v[a].append(b)
        v[b].append(a)
        dist[(a, b)] = d
        dist[(b, a)] = d

    color = [-1 for i in range(num + 1)]
    color[1] = 0
    visit(1, v, dist, color)

    for i in range(1, num + 1):
        print(color[i])

if __name__ == '__main__':
    main()
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N+1):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)
import sympy

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

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

cities.append(K)

cities.sort()

dif = []

for i in range(N):
	dif.append(cities[i+1] - cities[i])
    

if len(dif) == 1:
	x = dif[0]

else:
    
	x = sympy.gcd(dif[0],dif[1])

	for i in range(2,N):
		x = sympy.gcd(x,dif[i])

print(x)

### FIXED CODE ###

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

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

cities.append(K)

cities.sort()

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

dif = []

for i in range(N):
	dif.append(cities[i+1] - cities[i])
    

if len(dif) == 1:
	x = dif[0]

else:
    
	x = gcd(dif[0],dif[1])

	for i in range(2,N):
		x = gcd(x,dif[i])

print(x)
from collections import Counter
n,*a=map(int,open(0).read().split())
l=[0]*n
r=[0]*n
for i,c in enumerate(a):
  l[i]+=c+i+1
  r[i]+=i+1-c
L=Counter(l)
R=Counter(r)
ans=0
for i in range(1,n+max(a)):
  ans+=L[i]*R[i]
print(ans)

### FIXED CODE ###

x=int(input())
l=[]
for i in range(1,int(x**0.5)+1):
  if x%i==0:
    l.append(i)
    l.append(x//i)
for i in l:
  for j in range(int(x**0.2)+100,0,-1):
    A=j
    B=j-i
    if A<B:
      break
    if A**5-B**5==x:
      print(A,B,sep=' ')
      exit()
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N= I()
xy = [IL() for i in range(N)]

cnt = 0
for i in itertools.permutations(xy):
  data = []
  for j in range(N):
    if j == 0:
      rex,rey = i[j]
    else:
      x,y = i[j]
      if y-rey == 0:
        data.append(MAX_INT)
      else:
        data.append((x-rex)/(y-rey))
      rex,rey = i[j]
  else:
    d = collections.Counter(data)
    cnt = max(cnt,d.most_common()[0][1])
print(N-cnt)

### FIXED CODE ###

import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
xy = [IL() for i in range(N)]

if N == 1 or N == 2:
  print(1)
else:
  data = []
  cnt = 0
  for i in itertools.combinations(xy,2):
    rex,rey = i[0]
    x,y = i[1]
    if rex > x:
      rex,rey,x,y = x,y,rex,rey
    if rex == x:
      if rey > y:
        rex,rey,x,y = x,y,rex,rey
    data.append(str(x-rex)+str(y-rey))
  else:
    d = collections.Counter(data)
    cnt = max(cnt,d.most_common()[0][1])
  
  print(N-cnt)
n = int(input())
ary = []
for i in range(n):
  tmp_ary = list(map(int, input().split()))
  if len(ary) == 0:
    ary = tmp_ary[:]
  else:
    t_rate = math.ceil(ary[0] / tmp_ary[0])
    a_rate = math.ceil(ary[1] / tmp_ary[1])
    rate = max([t_rate, a_rate])
    ary = list(map(lambda x: x * rate, tmp_ary))

print(ary[0] + ary[1])


### FIXED CODE ###

n = int(input())
ary = list(map(int, input().split()))
for i in range(n - 1):
  tmp_ary = list(map(int, input().split()))
  t_rate = (ary[0] - 1) // tmp_ary[0] + 1
  a_rate = (ary[1] - 1) // tmp_ary[1] + 1
  rate = max([t_rate, a_rate])
  ary = list(map(lambda x: x * rate, tmp_ary))
print(int(ary[0] + ary[1]))
r = int(input())
import math
S = "%.5f"%(r ** 2 * math.pi)
L = "%.5f"%(2 * r * math.pi)
print(str(S) + " " + str(L))



### FIXED CODE ###

r = float(input())
import math
S = "%.6f"%(r ** 2 * math.pi)
L = "%.6f"%(2 * r * math.pi)
print(str(S) + " " + str(L))
a=int(input().split())
b=int(input().split())


if (a*b) % 2:
    print("Odd")
else:
    print("Even")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
maxnum = 10100

# エラトステネスのふるい
is_prime = [x for x in range(maxnum)]
for prime in is_prime:
    if prime == 0 or prime == 1:
        is_prime[prime] = 0
        continue
    for non_prime in range(prime * 2, maxnum, prime):
        is_prime[non_prime] = 0

is_like = [False] * maxnum
for i in range(maxnum):
    if (is_prime[i] and is_prime[(i + 1) // 2]):
        is_like[i] =  True

like_sum = [0] * maxnum
for i in range(3, maxnum):
    like_sum[i] = like_sum[i - 1]
    if (is_like[i]):
        like_sum[i] += 1

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(like_sum[r] - like_sum[l - 1])


### FIXED CODE ###

maxnum = 100000

# エラトステネスのふるい
is_prime = [x for x in range(maxnum)]
for prime in is_prime:
    if prime == 0 or prime == 1:
        is_prime[prime] = 0
        continue
    for non_prime in range(prime * 2, maxnum, prime):
        is_prime[non_prime] = 0

is_like = [False] * maxnum
for i in range(maxnum):
    if (is_prime[i] and is_prime[(i + 1) // 2]):
        is_like[i] =  True

like_sum = [0] * maxnum
for i in range(3, maxnum):
    like_sum[i] = like_sum[i - 1]
    if (is_like[i]):
        like_sum[i] += 1

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(like_sum[r] - like_sum[l - 1])
n = input()
paper = 0
if n % 2 == 0:
    paper = n / 2
else:
    paper = n / 2 + 1
print(paper)

### FIXED CODE ###

n = int(input())
print((n+1) // 2)
import numpy as np

(n, m, l) = [int(i) for i in input().split()]

A = []
for nc in range(n):
    A.append([int(i) for i in input().split()])

B = []
for mc in range(m):
    B.append([int(i) for i in input().split()])

product = np.dot(A,B)

for nc in range(n):
    for lc in range(l):
        if lc == l - 1:
            print(product[nc][lc])
        else:
            print(product[nc][lc], '', end='')

### FIXED CODE ###

(n, m, l) = [int(i) for i in input().split()]

A = []
for nc in range(n):
    A.append([int(i) for i in input().split()])

B = []
for mc in range(m):
    B.append([int(i) for i in input().split()])

product = [[0 for d in range(l)] for dd in range(n)]

for nc in range(n):
    for lc in range(l):
        for mc in range(m):
            product[nc][lc] += A[nc][mc] * B[mc][lc]
        
for r in product:
    print(' '.join([str(d) for d in r]))
first_str = input()
second_str = input()

if first_str == secofirst_str = input()
second_str = input()


if first_str == second_str[:len(first_str)] and len(first_str)+1 == len(second_str) and second_str[-1].islower():
    print("Yes")
else:
    print("No")

### FIXED CODE ###

first_str = input()
second_str = input()


if first_str == second_str[:len(first_str)] and len(first_str)+1 == len(second_str) and second_str[-1].islower():
    print("Yes")
else:
    print("No")
s=input()
t=input()
count=0
for i in range(3):
    if s(i)==t(i):
      count+=1
print(count)

### FIXED CODE ###

s=input()
t=input()
count=0
for i in range(3):
    if s[i]==t[i]:
      count+=1
print(count)
N,K = map(int,input().split())
a = list(map(int,input().split()))
b = []
for i in range(N-K+1):
  b.append(min(abs(a[i])+abs(a[i+k-1]-a[i]),abs(a[i+k-1])+abs(a[i+k-1]-a[i])))
print(min(b))
  

### FIXED CODE ###

N,K = map(int,input().split())
a = list(map(int,input().split()))
b = []
dis = N-K+1
for i in range(dis):
  b.append(min(abs(a[i])+abs(a[i]-a[i+K-1]),abs(a[i+K-1])+abs(a[i+K-1]-a[i])))
print(min(b))
n = int(input())

print int(n//2) + n % 2

### FIXED CODE ###

n = int(input())

print(int(n//2) + n % 2)
n,m = map(int, input().split())

S = [[] for _ in range(n)]

for i in range(n):
    S[i] = list(input())

rows = [[] for _ in range(n)]
cols = [[] for _ in range(n)]

start = [[] for _ in range(n)]
end = [[] for _ in range(n)]

for i in range(n):
    rows[i].append(-1)
    for j in range(m):
        if(S[i][j] == '#'):
            rows[i].append(j)
    rows[i].append(m)

    l = 0
    r = 1
    cnt = 0

    for j in range(m):
        if(S[i][j] != '#'):
            start[i].append(rows[i][r] - rows[i][l])
        else:
            start[i].append(0)
        if(j == rows[i][r]):
            l = r
            r = r + 1
ans = 0
for i in range(m):
    cols[i].append(-1)

    for j in range(n):
        if(S[j][i] == '#'):
            cols[i].append(j)
    cols[i].append(n)

    l = 0
    r = 1
    cnt = 0

    for j in range(n):
        if(S[j][i] != '#'):
            end[j].append(cols[i][r] - cols[i][l])
            # ans = max(ans, start[j][i], end[j][i])
        else:
            end[j].append(0)
        if(j == cols[i][r]):
            l = r
            r = r + 1
        



for i in range(n):
    for j in range(m):
        # if(S[i][j] != 'X'):
        ans = max(ans, start[i][j] + end[i][j])

print(ans - 3)




### FIXED CODE ###

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

S = [[] for _ in range(n)]

for i in range(n):
    S[i] = list(input())

rows = [[] for _ in range(n)]
cols = [[] for _ in range(m)]

start = [[] for _ in range(n)]
end = [[] for _ in range(n)]

for i in range(n):
    rows[i].append(-1)
    for j in range(m):
        if(S[i][j] == '#'):
            rows[i].append(j)
    rows[i].append(m)

    l = 0
    r = 1
    cnt = 0

    for j in range(m):
        if(S[i][j] != '#'):
            start[i].append(rows[i][r] - rows[i][l])
        else:
            start[i].append(0)
        if(j == rows[i][r]):
            l = r
            r = r + 1
ans = 0
for i in range(m):
    cols[i].append(-1)

    for j in range(n):
        if(S[j][i] == '#'):
            cols[i].append(j)
    cols[i].append(n)

    l = 0
    r = 1
    cnt = 0

    for j in range(n):
        if(S[j][i] != '#'):
            end[j].append(cols[i][r] - cols[i][l])
            # ans = max(ans, start[j][i], end[j][i])
        else:
            end[j].append(0)
        if(j == cols[i][r]):
            l = r
            r = r + 1
        



for i in range(n):
    for j in range(m):
        # if(S[i][j] != '#'):
            ans = max(ans, start[i][j] + end[i][j])

print(ans - 3)
import sys
import math
from math import gcd

input = sys.stdin.readline

def prime(n):
    primes = {}
    bound = int(math.sqrt(n)) + 1
    for i in range(2, bound):
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                n //= i
                if not i in primes.keys():
                    primes[i] = 1
                else:
                    primes[i] += 1
    if n != 1:
        if not n in primes.keys():
            primes[n] = 1
        else:
            primes[n] += 1
    return primes

A, B = map(int, input().split())
g = gcd(A, B)
print(len(prime(g)) + 1)

### FIXED CODE ###

import sys
import math
from fractions import gcd

input = sys.stdin.readline

def prime(n):
    primes = {}
    bound = int(math.sqrt(n)) + 1
    for i in range(2, bound):
        while n % i == 0:
            n //= i
            if not i in primes.keys():
                primes[i] = 1
            else:
                primes[i] += 1
    if n != 1:
        if n not in primes.keys():
            primes[n] = 1
        else:
            primes[n] += 1
    return primes

A, B = map(int, input().split())
g = gcd(A, B)
cur = prime(g)
print(len(cur) + 1)
def solve(i, m):
  if dp[i][m] != -1:
    return dp[i][m]

  if m == 0:
    dp[i][m] = 1
  elif i >= n:
    dp[i][m] = 0
  elif solve(i+1, m):
    dp[i][m] = 1
  elif solve(i+1, m-A[i]):
    dp[i][m] = 1
  else:
    dp[i][m] = 0

  return dp[i][m]



n = input()
A = map(int, raw_input().split())
p = input()
m = map(int, raw_input().split())

dp = = [[-1 for col in range(p)] for row in range(n)]

for i in range(p):
  if solve(0, m[i]):
    print 'yes'
  else:
    print 'no'

### FIXED CODE ###

def solve(i, m):
  if dp[i][m] != -1:
    return dp[i][m]

  if m == 0:
    dp[i][m] = 1
  elif i >= n:
    dp[i][m] = 0
  elif solve(i+1, m):
    dp[i][m] = 1
  elif solve(i+1, m-A[i]):
    dp[i][m] = 1
  else:
    dp[i][m] = 0

  return dp[i][m]



n = input()
A = map(int, raw_input().split())
p = input()
m = map(int, raw_input().split())

dp = [[-1 for col in range(2000)] for row in range(n+1)]

for i in range(p):
  if solve(0, m[i]):
    print 'yes'
  else:
    print 'no'
s = input()
if "hi" in s:
    if s[s.find("hi")+2] == "i":
        flag = False
    else:
        flag = True
else:
    flag = False
    
if flag == False:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

s = input()
if s == "hi" *(len(s)//2):
    print("Yes")
else:
    print("No")
A = input()
B = input()
C = input()

arr = [A, B, C]
fives = 0
sevens = 0

for num in arr:
    if num == 5:
        fives += 1
    if num == 7:
        sevens += 1

if fives == 2 and sevens == 1:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

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

arr = [A, B, C]
fives = 0
sevens = 0

for num in arr:
    if num == 5:
        fives += 1
    if num == 7:
        sevens += 1

if fives == 2 and sevens == 1:
    print("YES")
else:
    print("NO")
K,w = [int(x) for x in input().split()]
h,w = [int(x) for x in input().split()]
print (K*W -(K-h)*(W-w))

### FIXED CODE ###

K,W = [int(x) for x in input().split()]
h,w = [int(x) for x in input().split()]
print ((K-h)*(W-w))