Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

for i in m:
    yesorno = False
    b = []
    for j in a:
        if j <= i:
            b.append(j)
    #print(b)
    if len(b)>=1:
        for r in range(1, len(b)+1):
            for comb in itr.combinations(b,r):
                #print(i,comb)
                if sum(comb) == i:
                    yesorno = True
                    break
            if yesorno:
                break
    if yesorno:
        print('yes')
    else:
        print('no')


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

for i in m:
    yesorno = False
    b = []
    for j in a:
        if j <= i:
            b.append(j)
    #print(b)
    if len(b)>=1:
        for r in range(1, len(b)+1):
            for comb in itr.combinations(b,r):
                #print(i,comb)
                if sum(comb) == i:
                    yesorno = True
                    break
            if yesorno:
                break
    if yesorno:
        print('yes')
    else:
        print('no')


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

for i in m:
    yesorno = False
    b = []
    for j in a:
        if j <= i:
            b.append(j)
    #print(b)
    lb = len(b)
    if lb >= 1:
        for r in range(1, 2**lb):
            bin_str = format(r, 'b')
            sumb = sum([b[k]*int(bin_str[k]) for k in range(lb)])    #print(i,comb)
            if sumb == i:
                yesorno = True
                break
            if yesorno:
                break
    if yesorno:
        print('yes')
    else:
        print('no')


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

for i in m:
    yesorno = False
    b = []
    for j in a:
        if j <= i:
            b.append(j)
    #print(b)
    lb = len(b)
    if lb >= 1:
        for r in range(1, 2**lb):
            fmt = '0'+str(lb)+'b'
            bin_str = format(r, fmt)
            sumb = sum([b[k]*int(bin_str[k]) for k in range(lb)])    #print(i,comb)
            if sumb == i:
                yesorno = True
                break
            if yesorno:
                break
    if yesorno:
        print('yes')
    else:
        print('no')


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        aum_array.append[sum(comb)]

for i in m:
    yesorno = 'no'
    for j in sum_array:
        if i == j:
            yesorno == 'yes'
            break
    print('yes')



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append[sum(comb)]

for i in m:
    yesorno = 'no'
    for j in sum_array:
        if i == j:
            yesorno == 'yes'
            break
    print('yes')



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Thu May  3 11:39:47 2018

@author: maezawa
"""

# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r2  
@author: maezawa
"""

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m_array = list(map(int, input().split()))

def can_comp(i, m): #i番目以降の数列をつかってmを作れるか？
    if m == 0:
        return True
    elif i == n:
        return False
    else:
        return can_comp(i+1, m) or can_comp(i+1, m-a[i])

for m in m_array:
    if can_comp(0, m):
        print('yes')
    else:
        print('no')



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)

Buggy python submission (verdict: Runtime Error):

# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r2  Time Limit Exceeded
@author: maezawa
"""

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m_array = list(map(int, input().split()))
can_c_array = [[None for _ in range(m)] for _ in range(n)]

def can_comp(i, m): #i番目以降の数列をつかってmを作れるか？
    if m == 0:
        return True
    elif i == n:
        return False
    else:
        if can_c_array[i+1][m] == None:
            c1 = can_comp(i+1, m)
            can_c_array[i+1][m] = c1
        else:
            c1 = can_c_array[i+1][m] 
        if can_c_array[i+1][m-a[i]] == None:
            c2 = can_comp(i+1, m-a[i])
            can_c_array[i+1][m-a[i]] = c2
        else:
            c2 = can_c_array[i+1][m-a[i]]     
        return c1 or c2

for m in m_array:
    if can_comp(0, m):
        print('yes')
    else:
        print('no')



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)

Buggy python submission (verdict: Runtime Error):

# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r2  Time Limit Exceeded
@author: maezawa
"""

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m_array = list(map(int, input().split()))
can_c_array = [[None for _ in range(q)] for _ in range(n)]

def can_comp(i, m): #i番目以降の数列をつかってmを作れるか？
    if m == 0:
        return True
    elif i == n:
        return False
    else:
        if can_c_array[i+1][m] == None:
            c1 = can_comp(i+1, m)
            can_c_array[i+1][m] = c1
        else:
            c1 = can_c_array[i+1][m] 
        if can_c_array[i+1][m-a[i]] == None:
            c2 = can_comp(i+1, m-a[i])
            can_c_array[i+1][m-a[i]] = c2
        else:
            c2 = can_c_array[i+1][m-a[i]]     
        return c1 or c2

for m in m_array:
    if can_comp(0, m):
        print('yes')
    else:
        print('no')



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)

Buggy python submission (verdict: Runtime Error):

# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r2  Time Limit Exceeded
@author: maezawa
"""

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m_array = list(map(int, input().split()))
m_max = max(m_array)
can_c_array = [[None for _ in range(m_max+1)] for _ in range(n+1)]

def can_comp(i, m): #i番目以降の数列をつかってmを作れるか？
    #print(i,m)
    global n
    global a
    global can_c_array
    if m == 0:
        can_c_array[i][m] = True
        return True
    if i >= n:
        can_c_array[i][m] = False
        return False
    if can_c_array[i][m] != None:
        return can_c_array[i][m]
    elif can_comp(i+1,m):
        can_c_array[i][m] = True
    elif m-a[i] >= 0:
        if can_comp(i+1,m-a[i]):
            can_c_array[i][m] = True
    else:
        can_c_array[i][m] = False
    return can_c_array[i][m]

for m in m_array:
    if can_comp(0, m):
        print('yes')
    else:
        print('no')



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)