Buggy python submission (verdict: Runtime Error):
def solve(a, m): 
    if len(a) == 0:
        if m == 0:
            return True
        else:
            return False
    else:
        if solve(a[1:], m - a[0]):
            return True
        else:
            return solve(a[1:], m)

n = int(input())
tmp = input().split()
a = []
for i in range(n):
    a.append(int(tmp[i]))
q = int(input())
tmp = input().split()
m = []
for i in range(q):
    m.append(int(tmp[i]))

for i in range(q):
    if solve(a, m[i]):
        print("yes")
    else:
        print("no")



Fixed submission:
def solve(a, m, sumA):
    if m < 0 or m > sumA:
        return False
    if m == 0:
        return True
    if len(a) == 0:
        return False
    return solve(a[1:], m - a[0], sumA) or solve(a[1:], m, sumA)

n = int(input())
tmp = input().split()
a = []
for i in range(n):
    a.append(int(tmp[i]))
q = int(input())
tmp = input().split()
m = []
for i in range(q):
    m.append(int(tmp[i]))

sumA = sum(a)

for i in range(q):
    if solve(a, m[i], sumA):
        print("yes")
    else:
        print("no")

Buggy python submission (verdict: Runtime Error):
def solve(a, m): 
    if len(a) == 0:
        if m == 0:
            return True
        else:
            return False
    else:
        if solve(a[1:], m - a[0]):
            return True
        else:
            return solve(a[1:], m)

n = int(input())
tmp = input().split()
a = []
for i in range(n):
    a.append(int(tmp[i]))
q = int(input())
tmp = input().split()
m = []
for i in range(q):
    m.append(int(tmp[i]))

for i in range(q):
    if solve(a, m[i]):
        print("yes")
    else:
        print("no")



Fixed submission:
def solve(a, m, sumA):
    if m < 0 or m > sumA:
        return False
    if m == 0:
        return True
    if len(a) == 0:
        return False
    return solve(a[1:], m - a[0], sumA) or solve(a[1:], m, sumA)

n = int(input())
tmp = input().split()
a = []
for i in range(n):
    a.append(int(tmp[i]))
q = int(input())
tmp = input().split()
m = []
for i in range(q):
    m.append(int(tmp[i]))

sumA = sum(a)

for i in range(q):
    if solve(a, m[i], sumA):
        print("yes")
    else:
        print("no")

Buggy python submission (verdict: Runtime Error):
def solve(a, m): 
    if m < 0 or m > sumA:
        return False
    if m == 0:
        return True
    if len(a) == 0:
        return False
    return solve(a[1:], m - a[0]) or solve(a[1:], m)

n = int(input())
tmp = input().split()
a = []
for i in range(n):
    a.append(int(tmp[i]))
q = int(input())
tmp = input().split()
m = []
for i in range(q):
    m.append(int(tmp[i]))

for i in range(q):
    if solve(a, m[i]):
        print("yes")
    else:
        print("no")



Fixed submission:
def solve(a, m, sumA):
    if m < 0 or m > sumA:
        return False
    if m == 0:
        return True
    if len(a) == 0:
        return False
    return solve(a[1:], m - a[0], sumA) or solve(a[1:], m, sumA)

n = int(input())
tmp = input().split()
a = []
for i in range(n):
    a.append(int(tmp[i]))
q = int(input())
tmp = input().split()
m = []
for i in range(q):
    m.append(int(tmp[i]))

sumA = sum(a)

for i in range(q):
    if solve(a, m[i], sumA):
        print("yes")
    else:
        print("no")