Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())

def henkan(x):
    s = [0]*n
    i = 0
    while x != 0:
        s[i] = x%2
        x /= 2
        i += 1
    return s

for k in range(0, q):
    frag = 0
    for i in range(1, 2**n-1):
        sum = 0
        s = henkan(i)
        for j in range(0, len(s)):
            if s[j] == 1:
                sum += A[j]
        if sum == m[k]:
            print "yes"
            frag = 1
            break
    if frag == 0:
        print "no"

Fixed submission:
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())
 
def solve(i, m):
    if m == 0:
        return 1
    if i  >= n or m > sum(A):
        return 0
    res = solve(i + 1, m) or solve(i + 1, m - A[i])
    return res
         
for j in range(0, q):
    if solve(0, m[j]):
        print "yes"
    else:
        print "no"

Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())

def solve(i, m):
    if m == 0:
        return 1
    if i >= n:
        return 0
    res = solve(i + 1, m) or solve(i + 1, m - A[i])
    return res
        
for j in range(0, q):
    if solve(0, m[j]):
        print "yes"
    else:
        print "no"

Fixed submission:
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())
 
def solve(i, m):
    if m == 0:
        return 1
    if i  >= n or m > sum(A):
        return 0
    res = solve(i + 1, m) or solve(i + 1, m - A[i])
    return res
         
for j in range(0, q):
    if solve(0, m[j]):
        print "yes"
    else:
        print "no"

Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())

def solve(i, m):
    if m == 0:
        return 1
    if i >= n:
        return 0
    res = solve(i + 1, m) or solve(i + 1, m - A[i])
    return res
        
for j in range(0, q):
    if solve(0, m[j]):
        print "yes"
    else:
        print "no"

Fixed submission:
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())
 
def solve(i, m):
    if m == 0:
        return 1
    if i  >= n or m > sum(A):
        return 0
    res = solve(i + 1, m) or solve(i + 1, m - A[i])
    return res
         
for j in range(0, q):
    if solve(0, m[j]):
        print "yes"
    else:
        print "no"

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())
 
def solve(i, m):
    if m == 0:
        return 1
    if i > n or m > sum(A):
        return 0
    res = solve(i + 1, m) or solve(i + 1, m - A[i])
    return res
         
for j in range(0, q):
    if solve(0, m[j]):
        print "yes"
    else:
        print "no"

Fixed submission:
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())
 
def solve(i, m):
    if m == 0:
        return 1
    if i  >= n or m > sum(A):
        return 0
    res = solve(i + 1, m) or solve(i + 1, m - A[i])
    return res
         
for j in range(0, q):
    if solve(0, m[j]):
        print "yes"
    else:
        print "no"