Buggy python submission (verdict: Runtime Error):
import copy

combinations = []
def make_combination(n):
    S = [0 for i in range(n)]
    rec(0, n, S)

def rec(i, n, S):
    global combinations
    if i == n:
        combinations.append(copy.copy(S))
        return None
    rec(i+1, n, S)
    S[i] = 1
    rec(i+1, n, S)
    S[i] = 0

n = int(input())
A = [int(x) for x in input().split(' ')]
q = int(input())
M = [int(x) for x in input().split(' ')]

make_combination(n)
for m in M:
    flag = False
    for co in combinations:
        sum = 0
        for i in range(n):
            sum += A[i] * co[i]
            if sum >= m:
                break
        if sum == m:
            flag = True
            break

    if flag:
        print('yes')
    else:
        print('no')


Fixed submission:
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

# 上限と下限でフィルター
max_A = 0
min_A = float('inf')
for num in A:
    max_A += num
    if num < min_A:
        min_A = num

def rec(i, m):
    if m < 0:
        return False
    elif m == 0:
        return True
    if i >= n:
        return False

    rst = rec(i+1, m - A[i]) or rec(i+1, m)
    return rst

for m in M:
    if m < min_A or max_A < m:
        print('no')
    elif rec(0, m):
        print('yes')
    else:
        print('no')

Buggy python submission (verdict: Runtime Error):
import copy

combinations = []
def make_combination(n):
    S = [0 for i in range(n)]
    rec(0, n, S)

def rec(i, n, S):
    global combinations
    if i == n:
        combinations.append(copy.copy(S))
        return None
    rec(i+1, n, S)
    S[i] = 1
    rec(i+1, n, S)
    S[i] = 0

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

make_combination(n)
for m in M:
    flag = False
    for co in combinations:
        sum = 0
        for i in range(n):
            sum += A[i] * co[i]
            if sum >= m:
                break
        if sum == m:
            flag = True
            break

    if flag:
        print('yes')
    else:
        print('no')



Fixed submission:
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

# 上限と下限でフィルター
max_A = 0
min_A = float('inf')
for num in A:
    max_A += num
    if num < min_A:
        min_A = num

def rec(i, m):
    if m < 0:
        return False
    elif m == 0:
        return True
    if i >= n:
        return False

    rst = rec(i+1, m - A[i]) or rec(i+1, m)
    return rst

for m in M:
    if m < min_A or max_A < m:
        print('no')
    elif rec(0, m):
        print('yes')
    else:
        print('no')

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

def rec(i, sum, m):
    if i == n:
        if sum == m:
            return True
        else:
            return False

    if sum > m:
        return False

    rst = rec(i+1, sum, m) or rec(i+1, sum + A[i], m)
    return rst

for m in M:
    if rec(0, 0, m):
        print('yes')
    else:
        print('no')



Fixed submission:
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

# 上限と下限でフィルター
max_A = 0
min_A = float('inf')
for num in A:
    max_A += num
    if num < min_A:
        min_A = num

def rec(i, m):
    if m < 0:
        return False
    elif m == 0:
        return True
    if i >= n:
        return False

    rst = rec(i+1, m - A[i]) or rec(i+1, m)
    return rst

for m in M:
    if m < min_A or max_A < m:
        print('no')
    elif rec(0, m):
        print('yes')
    else:
        print('no')

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

def rec(i, sum, m):
    if sum == m:
        return True
    elif sum > m:
        return False

    if i >= n:
        return False

    rst = rec(i+1, sum, m) or rec(i+1, sum + A[i], m)
    return rst

for m in M:
    if rec(0, 0, m):
        print('yes')
    else:
        print('no')


Fixed submission:
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

# 上限と下限でフィルター
max_A = 0
min_A = float('inf')
for num in A:
    max_A += num
    if num < min_A:
        min_A = num

def rec(i, m):
    if m < 0:
        return False
    elif m == 0:
        return True
    if i >= n:
        return False

    rst = rec(i+1, m - A[i]) or rec(i+1, m)
    return rst

for m in M:
    if m < min_A or max_A < m:
        print('no')
    elif rec(0, m):
        print('yes')
    else:
        print('no')

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = sorted(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

def rec(i, sum, m):
    if sum == m:
        return True
    elif sum > m:
        return False

    if i >= n:
        return False

    rst = rec(i+1, sum, m) or rec(i+1, sum + A[i], m)
    return rst

for m in M:
    if rec(0, 0, m):
        print('yes')
    else:
        print('no')


Fixed submission:
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

# 上限と下限でフィルター
max_A = 0
min_A = float('inf')
for num in A:
    max_A += num
    if num < min_A:
        min_A = num

def rec(i, m):
    if m < 0:
        return False
    elif m == 0:
        return True
    if i >= n:
        return False

    rst = rec(i+1, m - A[i]) or rec(i+1, m)
    return rst

for m in M:
    if m < min_A or max_A < m:
        print('no')
    elif rec(0, m):
        print('yes')
    else:
        print('no')

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

def rec(i, m):
    if m == 0:
        return True
    if i >= n:
        return False

    rst = rec(i+1, m - A[i]) or rec(i+1, m)
    return rst

for m in M:
    if rec(0, m):
        print('yes')
    else:
        print('no')


Fixed submission:
n = int(input())
A = list(map(int, input().split(' ')))
q = int(input())
M = list(map(int, input().split(' ')))

# 上限と下限でフィルター
max_A = 0
min_A = float('inf')
for num in A:
    max_A += num
    if num < min_A:
        min_A = num

def rec(i, m):
    if m < 0:
        return False
    elif m == 0:
        return True
    if i >= n:
        return False

    rst = rec(i+1, m - A[i]) or rec(i+1, m)
    return rst

for m in M:
    if m < min_A or max_A < m:
        print('no')
    elif rec(0, m):
        print('yes')
    else:
        print('no')