Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
import numpy as np
from numba import njit


def read():
    N = int(input().strip())
    A = [int(input().strip()) for _ in range(N)]
    return N, A


@njit
def segtree_init(size, init_value=10**8, dtype=np.int32):
    """初期化"""
    n = 1
    while size > 1:
        size >>= 1
        n += 1
    treesize = n * 2
    st = np.full(treesize, init_value, dtype=dtype)
    st_idx = np.arange(treesize, dtype=dtype)
    offset = st.shape[0] // 2
    return st, st_idx, offset

@njit
def segtree_update(st, st_idx, offset, key, value, init_value=10**8):
    """値の更新"""
    k = offset + key
    st[k] = value
    k >>= 1
    while k > 0:
        if st[k * 2] <= st[k * 2 + 1]:
            st[k] = st[k * 2]
            st_idx[k] = st_idx[k * 2]
        else:
            st[k] = st[k * 2 + 1]
            st_idx[k] = st_idx[k * 2 + 1]
        k >>= 1

    
@njit
def _segtree_find_le(st, st_idx, offset, value, k=1, init_value=10**8):
    """value以下の最大の値を検索し、(index, value)の組を返す
    k: 着目しているノード (1-indexed)
    l: 探索区間 st[l, r) の左端 (0-indexed)
    r: 探索区間 st[l, r) の右端 (0-indexed)
    """
    if value < st[k]:
        return (st.shape[0], -init_value)
    elif value == st[k] or k >= offset:
        return (st_idx[k], st[k])
    else:
        li, lv = _segtree_find_le(st, st_idx, offset, value, k * 2, init_value=init_value)
        ri, rv = _segtree_find_le(st, st_idx, offset, value, k * 2 + 1,  init_value=init_value)
        mi = li if lv >= rv else ri
        mv = lv if lv >= rv else rv
        if mi < st.shape[0]:
            return (mi, mv)
        else:
            return (st.shape[0], -init_value)
    
@njit
def segtree_find_le(st, st_idx, offset, value, init_value=10**8):
    """value以下の最大値を検索し、(index, value)の組を1つ返す
    見つからない場合は-1を返す
    """
    i, v = _segtree_find_le(st, st_idx, offset, value, k=1, init_value=init_value)
    if i == st.shape[0]:
        return (-1, init_value)
    else:
        return (i - offset, v)


def solve(N, A, INF=10**9+1):
    st, st_idx, offset = segtree_init(N)
    l = 0
    for a in A[::-1]:
        k, v = segtree_find_le(st, st_idx, offset, -a-1)  # 以下を未満にするため-1
        if k == -1:
            segtree_update(st, st_idx, offset, l, -a)
            l += 1
        else:
            segtree_update(st, st_idx, offset, k, -a)
    return l


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline
from bisect import bisect_left, bisect_right


def read():
    N = int(input().strip())
    A = [int(input().strip()) for _ in range(N)]
    return N, A


def solve(N, A, INF=10**9+1):
    # LIS
    # dp[i]: 長さiの最長増加部分列(A[i]<A[j])のうち、最も小さい数字
    dp = [INF for i in range(N)]
    for i in range(N):
        a = A[N-i-1]
        idx = bisect_right(dp, a)
        dp[idx] = a
    return bisect_right(dp, INF-1)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
r,g,b = map(int,input().spllit())
if (g+b)%4 == 0:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

r,g,b = map(int,input().split())
if (g*10+b)%4 == 0:
    print('YES')
else:
    print('NO')
a=list(input())
b=list(input())
c=list(input())

turn='a'

while len(a)!=0 and len(b)!=0 or len(c)!=0:
    if turn=='a':
        turn=a.pop(0)
    elif turn=='b':
        turn=b.pop(0)
    else:
        turn=c.pop(0)

print(turn.upper())

### FIXED CODE ###

a=list(input())
b=list(input())
c=list(input())

turn='a'

while True:
    if turn=='a':
        try:
            turn=a.pop(0)
        except:
            break
    elif turn=='b':
        try:
            turn=b.pop(0)
        except:break
    else:
        try:
            turn=c.pop(0)
        except:
            break
        

print(turn.upper())
import sys

N=int(input())

for i range(101):
  for j in range(101):
    if 4*i + 7*j == N:
      print('Yes')
      sys.exit()
else:
  print('No')

### FIXED CODE ###

import sys
 
N=int(input())
 
for i in range(101):
  for j in range(101):
    if 4*i + 7*j == N:
      print('Yes')
      sys.exit()
else:
  print('No')
n = int(input())
xy = []
for _ in range(n):
  x, y = map(int, input().split())
  xy.append([x, y])

vecs = {}
for i in range(n):
  for j in range(i+1, n):
    if xy[i][0] < xy[j][0]:
      vec = (xy[j][0] - xy[i][0], xy[j][1] - xy[i][1])
    elif xy[i][0] > xy[j][0]:
      vec = (xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
    else:
      vec = (0, abs(xy[j][1] - xy[i][1]))
    
    if vec in vecs:
      vecs[vec] += 1
    else:
      vecs[vec] = 1

vec_max = max(list(vecs.values()))
print(n - vec_max)
    

### FIXED CODE ###

n = int(input())
if n == 1:
  print(1)
  exit()
xy = []
for _ in range(n):
  x, y = map(int, input().split())
  xy.append([x, y])

vecs = {}
for i in range(n):
  for j in range(i+1, n):
    if xy[i][0] < xy[j][0]:
      vec = (xy[j][0] - xy[i][0], xy[j][1] - xy[i][1])
    elif xy[i][0] > xy[j][0]:
      vec = (xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
    else:
      vec = (0, abs(xy[j][1] - xy[i][1]))
    
    if vec in vecs:
      vecs[vec] += 1
    else:
      vecs[vec] = 1

vec_max = max(list(vecs.values()))
print(n - vec_max)
n=int(input())
a=list(map(int,input().split()))

import sys
import math
def setwise_coprime(a):
  ans=a[0]
  for i in range(1,n):
    ans=math.gcd(ans,a[i])
  return ans

def erast(n):
  num_set=set()
  prime_set=set()
  for i in range(2,n+1):
    if i not in num_set:
      prime_set.add(i)
      for j in range(i*i,n+1,i):
        num_set.add(j)
  s=prime_set
  return s

check=set()

if setwise_coprime(a)==1:
  s=erast(1000000)
  s.sort()
  for i in range(n):
    if a[i]!=1:
      for j in range(len(s)):
        if s[j]>a[i]:
          break
        if a[i]%s[j]==0:
          if s[j] in check:
            print("setwise coprime")
            sys.exit()
          else:
            check.add(s[j])
            
  print("pairwise coprime")    
else:
  print("not coprime")
  
  



      
      
    


### FIXED CODE ###

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

import sys
import math
def setwise_coprime(a):
  ans=a[0]
  for i in range(1,n):
    ans=math.gcd(ans,a[i])
  return ans

#エラストテネスのふるい
def create_sieve(n):
  sieve=[0]*(n+1)
  for i in range(2,n+1):
    if sieve[i]==0:
      for j in range(i*i,n+1,i):
        sieve[j]=i
  return sieve

#高速素因数分解
def fast_factorization(n, sieve):
  prime={}
  while n>1:
    p=sieve[n]
    #nが素数の場合
    if p==0:
      prime[n]=prime.get(n,0)+1
      break
    #nが素数ではない場合
    else:
      prime[p]=prime.get(p,0)+1
      n=n//p
  return prime

check=set()
if setwise_coprime(a)==1:
  #素因数のダブリをcheck
  sieve=create_sieve(10**6)
  for i in range(n):
    if a[i]!=1:
      s=fast_factorization(a[i], sieve)
      for i in s:
        if i in check:
          print("setwise coprime")
          sys.exit()
        else:
          check.add(i)
  print("pairwise coprime")    
else:
  print("not coprime")
a_index, a_v = list(map(int, input().split()))
b_index, b_v = list(map(int, input().split()))
t = int(input().split())
 
d = abs(b_index - a_index)
d_v = abs(b_v - a_v)
 
if d == 0 :
  print("YES")
elif d_v != 0 and d / d_v <= t :
  print("YES")
else :
  print("NO")

### FIXED CODE ###

a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = int(input())
 
d = abs(b_index - a_index)
d_v = a_v - b_v
 
if d == 0 :
  print("YES")
elif d_v > 0 and d / d_v <= t :
  print("YES")
else :
  print("NO")
x = list(map(int, input().split()))
y = set(map(int, input().split()))

if x[1] == 0:
    min = x[0]
else:
    for i in range(1, x[1]):
        if set() == {x[0]-i}&y:
            print(x[0]-i)
            exit()
        elif set() == {x[0]+i}&y:
            print(x[0]+i)
            exit()


### FIXED CODE ###

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

for i, j in enumerate(x, 1):
    if i != j:
        print(i)
a = int(input())
b = int(input())
print(a*b)
print(2*a+2*b)

### FIXED CODE ###

a,b=[int(x) for x in input().split()]
print(a*b,(a+b)*2)
import numpy as np
N, K = map(int, input().split())
h = []

for _ in range(N):
    h.append(int(input()))

h_sorted = sorted(h, reverse=False)
diff_h_sorted = np.diff(h_sorted, n=1, axis=-1)

def min_sum(N, a):
    dp = [0]*(N+1)
    for i in range(N):
        dp[i+i] = min(dp[i], dp[i]+a[i])
    return dp[N]

print(min_sum(K-1,diff_h_sorted))

### FIXED CODE ###

N, K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))
h, w = map(int, input().split())
rb = ['#'] * (w + 2)]
a = [rb + [['#'] + list(input()) + ['#'] for _ in range(h)] + rb]
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == '#']
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
    r += 1
    s = []
    for i, j in p:
        for di, dj in d:
            di += i
            dj += j
            if a[di][dj] == '.':
                a[di][dj] = '#'
                s.append((di, dj))
    p = s
print(r)


### FIXED CODE ###

h, w = map(int, input().split())
a = [['#'] * (w + 2)] + [['#'] + list(input()) + ['#']
                          for _ in range(h)] + [['#'] * (w + 2)]
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == '#']
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
    r += 1
    s = []
    for i, j in p:
        for di, dj in d:
            di += i
            dj += j
            if a[di][dj] == '.':
                a[di][dj] = '#'
                s.append((di, dj))
    p = s
print(r)
n = int(input())
uvw = [list(map(int, input().split())) for i in range(n - 1)]
d = [-1 for i in range(n)]
edge = [[] for i in range(n)]
for u, v, w in uvw:
    edge[u - 1].append((v - 1, w))
    edge[v - 1].append((u - 1, w))
def dfs(now, D):
    d[now] = D
    for i, j in edge[now]:
        if d[i] == -1:
            dfs(i, D + j)
dfs(0, 0)
for i in d:
    print(i % 2)

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10 ** 7)
n = int(input())
uvw = [list(map(int, input().split())) for i in range(n - 1)]
d = [-1 for i in range(n)]
edge = [[] for i in range(n)]
for u, v, w in uvw:
    edge[u - 1].append((v - 1, w))
    edge[v - 1].append((u - 1, w))
def dfs(now, D):
    d[now] = D
    for i, j in edge[now]:
        if d[i] == -1:
            dfs(i, D + j)
dfs(0, 0)
for i in d:
    print(i % 2)
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N,K = MI()
K += 1
k = K.bit_length()
K_bit = [(K >> (k-i-1)) & 1 for i in range(k)]
A = LI()
B = [0]*N
ans = 0
for i in range(N):
    a = A[i]
    x = a.bit_length()
    if x > k:
        for j in range(k,x):
            if (a >> j) & 1:
                ans += 1 << j
                a -= 1 << j
    A[i] = a
    B[i] = [(A[i] >> (k-j-1)) & 1 for j in range(k)]

X = [0]*k
for i in range(k):
    a = 0  # 0の個数
    for j in range(N):
        if B[j][i] == 0:
            a += 1
    if a >= k//2+1:
        X[i] = 1
    else:
        X[i] = 0
Y = [0]*k
for i in range(k-2,-1,-1):
    Y[i] = X[i+1] + X[i]*(2**(k-i-1))
Y = Y + [0]


def f(x):
    return sum(x^A[i] for i in range(N))


y = 0
for i in range(k):
    if K_bit[i] == 1:
        y = max(y,f((K >> (k-i) << (k-i))+Y[i+1]))
        if X[i] == 0:
            K -= 1 << (k-i-1)

print(max(ans+y))


### FIXED CODE ###

import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N,K = MI()
K += 1
k = K.bit_length()
K_bit = [(K >> i) & 1 for i in range(k)]  # Kのbitのリスト(下から)
A = LI()
A_bit = [[(A[i] >> j) & 1 for j in range(k)] for i in range(N)]  # Aiたちのbitのリスト(下から)

X = [0]*(k+1)  # 下i桁で最適なもの
for i in range(k):
    a = sum(A_bit[j][i] == 0 for j in range(N))  # 0の個数
    X[i+1] = X[i]
    if a >= N//2+1:
        X[i+1] += 2**i


def f(x):
    return sum(x^A[i] for i in range(N))


ans = 0
for i in range(k-1,-1,-1):
    if K_bit[i] == 1:
        ans = max(ans,f(((K >> (i+1)) << (i+1))+X[i]))

print(ans)
n, m = map(int, input().split())
A = list(map(int, input().split()))
all_vote = sum(A)
cnt = 0
for a in A:
    if a * 4 * m >= all_vote:#1/4mを4m倍したときとおきかえて計算(整数にするため)
        cnt += 1
if cnt >= m:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n, k = map(int, input().split())
m = n%k
print(min(m,k-m))
N, M = map(int, input().split())
lmax = 0
rmin = 10**5
for i in range(M):
    L, R = map(int, input().split())
    lmax = max(lmax, L)
    rmin = min(rmin, R)
ans = rmin - lmax
if ans >= 0:
    print(ans + 1)
else:
    print(0)

### FIXED CODE ###

R, D, X = map(int, input().split())
for i in range(10):
    X = X*R - D
    print(X)
n,m = map(int,input().split())
dict = {}
sum = 0
kounyu = 0

for i in range(n):
  A,B = map(int,input().split())
  dict[A] = B

d = sorted(dict.items())

for i in range(10**12):
  if d[i][1] >= m - kounyu:
    print(sum + d[i][0]*(m - kounyu))
    exit()
    
  kounyu += d[i][1]
  sum += d[i][1]*d[i][0]



### FIXED CODE ###

n,m = map(int,input().split())
dict = {}
su = 0
kounyu = 0
 
for i in range(n):
  A,B = map(int,input().split())
  if A in dict:
    dict[A] += B  #同じAがありうる！！！！！！
  else:
    dict[A] = B
  

d = sorted(dict.items())
 
for i in range(10**99):
  if d[i][1] >= m - kounyu:
    print(su + d[i][0]*(m - kounyu))
    exit()
    
  kounyu += d[i][1]
  su += d[i][1]*d[i][0]
# -*- coding:utf-8 -*-
import sys
array = []
for i in sys.stdin:
    array.append(int(i))

data = [0]*100
for i in range(len(array)):
    data[array[i]] += 1
    
m = [i for i,j in enumerate(data) if j == max(data)]
for i in range(len(m)):
    print(m[i])

### FIXED CODE ###

# -*- coding:utf-8 -*-
array = []
while True:
    try:
        a = int(input())
        array.append(a)
    except EOFError:
        break

data = [0]*101
for i in range(len(array)):
    data[array[i]] += 1
    
m = [i for i,j in enumerate(data) if j == max(data)]
for i in range(len(m)):
    print(m[i])
N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
    ai, bi, ci = map(int, input().split())
    edges[ai].append((bi, ci))
    edges[bi].append((ai, ci))
Q, K = map(int, input().split())

weighted_nodes = [0]*(N+1)
def add_weight(k, pre):
    for v in edges[k]:
        d, w = v
        if d != pre:
            weighted_nodes[d] = w + weighted_nodes[k]
            add_weight(d, k)
add_weight(K, -1)

for _ in range(Q):
    s, e = map(int, input().split())
    print(weighted_nodes[s] + weighted_nodes[e])

### FIXED CODE ###

from collections import deque

N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
    ai, bi, ci = map(int, input().split())
    edges[ai].append((bi, ci))
    edges[bi].append((ai, ci))
Q, K = map(int, input().split())

distance = [-1]*(N+1)
# def add_weight(k, pre):
#     for v in edges[k]:
#         d, w = v
#         if d != pre:
#             distance[d] = w + distance[k]
#             add_weight(d, k)
# add_weight(K, -1)
que = deque()
que.append(K); distance[K] = 0
while len(que):
    a = que.popleft()
    for b, c in edges[a]:
        if distance[b] == -1:
            distance[b] = c + distance[a]
            que.append(b)

# print(distance)

for _ in range(Q):
    s, e = map(int, input().split())
    print(distance[s] + distance[e])
from scipy.special import perm, comb

mod = 10 ** 9 + 7
N, M = map(int, input().split())

A = perm(M, N, exact=True) % mod

B = 0
for i in range(N + 1):
    B += (-1) ** i * comb(N, i, exact=True) * perm(M - i, N - i, exact=True) % mod

print(A * B)

### FIXED CODE ###

mod = 10 ** 9 + 7
N, M = map(int, input().split())

class Combination:
    def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % mod
            self.inv[i] = -self.inv[mod % i] * (mod // i) % mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % mod

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % mod

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % mod) % mod

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1)

comb = Combination(M + 100)

A = comb.npr(M, N) % mod

B = 0
for i in range(N + 1):
    B += (-1) ** i * comb.ncr(N, i) * comb.npr(M - i, N - i) % mod

print(A * B % mod)
n=int(input())
import sys
for a in range(1,3501):
    for b in range(1,3501):
        if (4/n-1/a-1/b)<=0:
            continue
        c=n*a*b/(4*a*b -n*a -n*b)
        if not 0<c<=3500:
            continue
        if c==int(c):
            print(a,b,int(c))
            sys.exit()

### FIXED CODE ###

n=int(input())
import sys
for a in range(1,3501):
    for b in range(1,3501):
        if 4*a*b -n*a -n*b<=0:
            continue
        c=n*a*b/(4*a*b -n*a -n*b)
        if not 0<c<=3500:
            continue
        if c==int(c):
            print(a,b,int(c))
            sys.exit()
a=int(input())*int(input())
print("Even" if a%2 == 0 else "Odd")

### FIXED CODE ###

a,b=list(map(int,input().split()))
if a%2==0 or b%2==0:
	print('Even')
else:
	print('Odd')
N=input()
L=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
print(L[L.index(N)+1])

### FIXED CODE ###

N=input()
L=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
print(L[L.index(N)+1])
import itertools

L, R = map(int, input().split())
comb = itertools.combinations(range(L, R + 1), 2)
result = float('inf')
for a, b in comb:
    mod = a * b % 2019
    if mod < result:
        result = mod
print(result)

### FIXED CODE ###

L, R = map(int, input().split())
if R - L >= 2019:
    print(0)
else:
    result = float('inf')
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            mod = (i * j) % 2019
            if mod == 0:
                result = 0
                break
            elif mod < result:
                result = mod
    print(result)
l = int(input())
edge = []
for i in range(1, 19):
    edge.append((i, i + 1, 1 << (i - 1)))
    edge.append((i, i + 1, 0))
sm = 0
for i in range(19, 0, -1):
    v = 1 << (i - 1)
    while l >= v:
        edge.append((i, 20, sm))
        sm += v
        l -= v
print(20, len(edge))
for x, y, z in edge:
    print(x, y, z)

### FIXED CODE ###

n, k = map(int, input().split())
ans = (n // k) ** 3
if (k & 1) == 0:
    ans += ((n + k // 2) // k) ** 3
print(ans)
import math
import numpy as np

A, B, H, M = map(int, input().split())

r_H = 360 * ((H + M / 60) / 12)
r_M = 360 * M / 60

r = np.abs(r_H - r_M)
r = min(r, 360 - r)

C = np.sqrt(A**2 + B**2 - 2 * A * B * math.cos(math.radians(r)))

print(C)


### FIXED CODE ###

import math
import numpy as np

A, B, H, M = map(int, input().split())

r_H = 360 * ((H + M / 60) / 12)
r_M = 360 * M / 60

r = np.abs(r_H - r_M)
r = min(r, 360 - r)

C = np.sqrt(A**2 + B**2 - 2 * A * B * math.cos(math.radians(r)))

print(C)
N, K = map(int, input().split())
S = str(input())

if K == 1:
	S = S[K-1].lower() + S[K:N]
elif K == N:
	S = S[0:N-1] + S[N].lower()
else:
	S = S[0:K-1] + S[K-1].lower() + S[K:N]

print(S)

### FIXED CODE ###

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

if K == 1:
	S = S[K-1].lower() + S[K:N]
elif K == N:
	S = S[0:N-1] + S[N-1].lower()
else:
	S = S[0:K-1] + S[K-1].lower() + S[K:N]

print(S)
def main ():
N = int(input())
A = list(map(int,input().split()))
if 0 in A: print (0)
return
prod = 1 for a in A:
prod *= a
if prod > 1000000000000000000:
print(-1) return
print(prod) main ()

### FIXED CODE ###

def main ():
  N = int(input())
  A = list(map(int,input().split()))
  prod = 1 
  A.sort()
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  
  print(prod) 
 
main()
n = input()
A = [input() for i in range(n)]
q = input()
m = [input() for i in range(q)]
i = 0
j = 0

def solve(i,m):
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res

while(i < q):
  while(j < n):
    if solve(n, m[q]):
      print 'yes'
    else:
      print 'no'
    n = n+1
  m = m+1

### FIXED CODE ###

n = input()
A = map(int, raw_input().split())
q = input()
M = map(int, raw_input().split())

min = min(A)
sum = sum(A)

def solve(i,m):
  if sum < m:
    return False
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res
 
for m in M:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'
h, w, k = map(int, input().split())
c = []
for i in range(h):
    c.append(list(map(str, input().split())))
ans = 0
for j in range(1<<h):
    for k in range(1<<w):
        black = 0
        for m in range(h):
            for n in range(w):
                if ((j>>m) & 1) == 0 and ((k>>n) & 1) == 0 and c[m][n] == "#":
                    black += 1
        if black == k:
            ans += 1
print(ans)

### FIXED CODE ###

h, w, k = map(int, input().split())
c = [list(input()) for i in range(h)]
ans = 0
for p in range(1<<h):
    for q in range(1<<w):
        black = 0
        for m in range(h):
            for n in range(w):
                if (p>>m)&1 == 0 and (q>>n)&1 == 0 and c[m][n] == "#":
                    black += 1
        if black == k:
            ans += 1
print(ans)
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations

import numpy as np

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def solve():
    mod = 100_000_000_7
    N, M = il()
    a = [True] * (N+1)
    for b in imi(M):
        a[b] = False
    dp = [0] * (N + 1)
    dp[0] = 1
    for now in range(N):
        for next in range(now + 1, min(N, now + 2)+1):
            if a[next]:
                dp[next] += dp[now]
                dp[next] %= mod
    return dp[N]


if __name__ == "__main__":
    print(solve())

### FIXED CODE ###

import sys
from fractions import gcd
from functools import reduce
from itertools import combinations

import numpy as np

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def solve():
    mod = 1000000007
    N, M = il()
    a = [True] * (N+1)
    for b in imi(M):
        a[b] = False
    dp = [0] * (N + 1)
    dp[0] = 1
    for now in range(N):
        for next in range(now + 1, min(N, now + 2)+1):
            if a[next]:
                dp[next] += dp[now]
                dp[next] %= mod
    return dp[N]


if __name__ == "__main__":
    print(solve())
N, M = map(int, input().split())
A = [input() for i in range(M)]
 
if(sum(A) == N):
  print('0')
elif(sum(A) > N):
  print(N - sum(A))
else:
  print('-1')

### FIXED CODE ###

N, M = map(int, input().split())
A = input().split()
B = [ ]
for i in range(M):
  B.append(int(A[i]))
if(sum(B) == N):
  print('0')
elif(sum(B) < N):
  print(N - sum(B))
else:
  print('-1')
a,b,c=map(int, input().split())
print(sum(a,b,c)-max(a,b,c))

### FIXED CODE ###

l=list(map(int, input().split()))
print(sum(l)-max(l))