Buggy python submission (verdict: Runtime Error):
n = input()
a = []
b = []

for i in range(n):
  a[i] = input()

m = input()
for j in range(m):
  b[j] = input()

for j in range(m):
  for i in range(n):
    if b[j] - a[i] < 0:
      i = i + 1
    elif b[j] - a[i] == 0:
      return yes
    elif b[j] - a[i] > 0:
      b[j] = b[j] - a[i]
return 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) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
  return res

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

Buggy python submission (verdict: Runtime Error):
n = input()
a = []
b = []

for i in range(n):
  a[i] = input()

m = input()

for j in range(m):
  b[j] = input()
  for i in range(n):
    if b[j] - a[i] < 0:
      i = i + 1
    elif b[j] - a[i] == 0:
      return yes
    elif b[j] - a[i] > 0:
      b[j] = b[j] - a[i]
return 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) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
  return res

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

Buggy python submission (verdict: Runtime Error):
n = input()
a = []
b = []

for i in range(n):
  a[i] = input()

m = input()

for j in range(m):
  b[j] = input()
  for i in range(n):
    if b[j] - a[i] < 0:
      i = i + 1
    elif b[j] - a[i] == 0:
      return yes
    elif b[j] - a[i] > 0:
      b[j] = b[j] - a[i]
return 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) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
  return res

for j in range(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) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
    return res
  
for j in range(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) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
  return res

for j in range(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) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
    return res
  
for j in range(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) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
  return res

for j in range(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) > 0:
        return 0
     res = solve(i+1,m) or solve(i+1,m-A[i])
        return res
  
for j in range(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) > 0:
    return 0
  res = solve(i+1,m) or solve(i+1,m-A[i])
  return res

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