Buggy python submission (verdict: Runtime Error):
n = input()
A = [input() for i in range(n)]
q = input()
m = [input() for i in range(q)]
i = 0
j = 0

def solve(i,m):
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res

while(i < q):
  while(j < n):
    if solve(n, m[q]):
      print 'yes'
    else:
      print 'no'
    n = n+1
  m = m+1

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

min = min(A)
sum = sum(A)

def solve(i,m):
  if sum < m:
    return False
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res
 
for m in M:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'

Buggy python submission (verdict: Runtime Error):
n = input()
A = [input() for i in range(n)]
q = input()
m = [input() for i in range(q)]
i = 0
j = 0

def solve(i,m):
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) | solve(i+1, m - A[i])
  return res

while(i < q):
  while(j < n):
    if solve(n, m[q]):
      print 'yes'
    else:
      print 'no'
    n = n+1
  m = m+1

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

min = min(A)
sum = sum(A)

def solve(i,m):
  if sum < m:
    return False
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res
 
for m in M:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'

Buggy python submission (verdict: Runtime Error):
n = input()
A = [input() for i in range(n)]
q = input()
m = [input() for i in range(q)]
i = 0
j = 0

def solve(i,m):
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) | solve(i+1, m - A[i])
  return res

for m in q:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'

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

min = min(A)
sum = sum(A)

def solve(i,m):
  if sum < m:
    return False
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res
 
for m in M:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'

Buggy python submission (verdict: Runtime Error):
n = input()
A = [input() for i in range(n)]
q = input()
m = [input() for i in range(q)]
i = 0
j = 0

def solve(i,m):
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) | solve(i+1, m - A[i])
  return res

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

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

min = min(A)
sum = sum(A)

def solve(i,m):
  if sum < m:
    return False
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res
 
for m in M:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'

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

def solve(i,m):
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res

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

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

min = min(A)
sum = sum(A)

def solve(i,m):
  if sum < m:
    return False
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res
 
for m in M:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'

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

def solve(i,m):
  if m == 0:
    return True
  if i >= n:
    return False
  i = i + 1
  res = solve(i,m) or solve(i, m - A[i])
  return res

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

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

min = min(A)
sum = sum(A)

def solve(i,m):
  if sum < m:
    return False
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res
 
for m in M:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'

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

def solve(i,m):
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i,m) or solve(i, m - A[i])
  return res

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

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

min = min(A)
sum = sum(A)

def solve(i,m):
  if sum < m:
    return False
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res
 
for m in M:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'

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

def solve(i,m):
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res

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

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

min = min(A)
sum = sum(A)

def solve(i,m):
  if sum < m:
    return False
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1,m) or solve(i+1, m - A[i])
  return res
 
for m in M:
    if solve(0, m):
      print 'yes'
    else:
      print 'no'