Buggy python submission (verdict: Time Limit Exceeded):
import sys

def exhaustiveSearch(A, m):
    for i in range(len(A)):
        if m == A[i]:
            return True
        elif m > A[i]:
            if exhaustiveSearch(A[:i] + A[i + 1:], m -  A[i]):
                return True
    return False

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())

    for m in M:
        if exhaustiveSearch(A, m):
            print "yes"
        else:
            print "no"

Fixed submission:
import sys

def exhaustiveSearch(A, m, i, s):
    if A[i] == m:
        return True
    elif i == len(A) - 1 or m < 0 or m > s:
        return False

    return exhaustiveSearch(A, m, i + 1, s) or exhaustiveSearch(A, m - A[i], i + 1, s)

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())
    s = sum(A)

    for m in M:
        if exhaustiveSearch(A, m, 0, s):
            print "yes"
        else:
            print "no"

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def exhaustiveSearch(A, m):
    if len(A) == 1 and A[0] != m:
        return False
    elif A[0] == m:
        return True
    return exhaustiveSearch(A[1:], m) or exhaustiveSearch(A[1:], m - A[0])

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())

    for m in M:
        if exhaustiveSearch(A, m):
            print "yes"
        else:
            print "no"

Fixed submission:
import sys

def exhaustiveSearch(A, m, i, s):
    if A[i] == m:
        return True
    elif i == len(A) - 1 or m < 0 or m > s:
        return False

    return exhaustiveSearch(A, m, i + 1, s) or exhaustiveSearch(A, m - A[i], i + 1, s)

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())
    s = sum(A)

    for m in M:
        if exhaustiveSearch(A, m, 0, s):
            print "yes"
        else:
            print "no"

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def exhaustiveSearch(A, m):
    if len(A) == 1 and A[0] != m or m < 0:
        return False
    elif A[0] == m:
        return True
    return exhaustiveSearch(A[1:], m) or exhaustiveSearch(A[1:], m - A[0])

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())

    for m in M:
        if exhaustiveSearch(A, m):
            print "yes"
        else:
            print "no"

Fixed submission:
import sys

def exhaustiveSearch(A, m, i, s):
    if A[i] == m:
        return True
    elif i == len(A) - 1 or m < 0 or m > s:
        return False

    return exhaustiveSearch(A, m, i + 1, s) or exhaustiveSearch(A, m - A[i], i + 1, s)

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())
    s = sum(A)

    for m in M:
        if exhaustiveSearch(A, m, 0, s):
            print "yes"
        else:
            print "no"

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def exhaustiveSearch(A, m, i):
    if A[i] == m:
        return True
    elif i == len(A) - 1:
        return False

    return exhaustiveSearch(A, m, i + 1) or exhaustiveSearch(A, m - A[i], i + 1)

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())

    for m in M:
        if exhaustiveSearch(A, m, 0):
            print "yes"
        else:
            print "no"

Fixed submission:
import sys

def exhaustiveSearch(A, m, i, s):
    if A[i] == m:
        return True
    elif i == len(A) - 1 or m < 0 or m > s:
        return False

    return exhaustiveSearch(A, m, i + 1, s) or exhaustiveSearch(A, m - A[i], i + 1, s)

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())
    s = sum(A)

    for m in M:
        if exhaustiveSearch(A, m, 0, s):
            print "yes"
        else:
            print "no"

Buggy python submission (verdict: Time Limit Exceeded):
import sys

def exhaustiveSearch(A, m, i):
    if A[i] == m:
        return True
    elif i == len(A) - 1 or m < 0:
        return False

    return exhaustiveSearch(A, m, i + 1) or exhaustiveSearch(A, m - A[i], i + 1)

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())

    for m in M:
        if exhaustiveSearch(A, m, 0):
            print "yes"
        else:
            print "no"

Fixed submission:
import sys

def exhaustiveSearch(A, m, i, s):
    if A[i] == m:
        return True
    elif i == len(A) - 1 or m < 0 or m > s:
        return False

    return exhaustiveSearch(A, m, i + 1, s) or exhaustiveSearch(A, m - A[i], i + 1, s)

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    A = map(int, lines[1].split())
    M = map(int, lines[3].split())
    s = sum(A)

    for m in M:
        if exhaustiveSearch(A, m, 0, s):
            print "yes"
        else:
            print "no"