Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

str = input().split(' ')
x1 = int(str[0])
x2 = int(str[1])
y1 = int(str[2])
y2 = int(str[3])

result = (x1-y1)*(x1-y1) + (x2-y2)*(x2-y2)
result = math.sqrt(result) if result != 0 else 0

print('%.6f'%result)

Fixed submission:
import math

str = input().split(' ')
x1 = float(str[0])
x2 = float(str[1])
y1 = float(str[2])
y2 = float(str[3])

result = (x1-y1)*(x1-y1) + (x2-y2)*(x2-y2)
result = math.sqrt(result) if result != 0 else 0

print('%.6f'%result)

Buggy python submission (verdict: Runtime Error):
import math

str = input().split(' ')
x1 = int(str[0])
x2 = int(str[1])
y1 = int(str[2])
y2 = int(str[3])

result = (x1-y1)*(x1-y1) + (x2-y2)*(x2-y2)
result = math.sqrt(result) if result != 0 else 0

print('%.6f'%result)

Fixed submission:
import math

str = input().split(' ')
x1 = float(str[0])
x2 = float(str[1])
y1 = float(str[2])
y2 = float(str[3])

result = (x1-y1)*(x1-y1) + (x2-y2)*(x2-y2)
result = math.sqrt(result) if result != 0 else 0

print('%.6f'%result)
Buggy python submission (verdict: Runtime Error):
input_str = input().split(' ')
W = int(input_str[0])
H = int(input_str[1])
x = int(input_str[2])
y = int(input_str[3])
r = int(input_str[4])

print('Yes' if x-r >= 0 and x+r =< W and y-r >= 0 and y+r <= H else 'No')

Fixed submission:
input_str = input().split(' ')
W = int(input_str[0])
H = int(input_str[1])
x = int(input_str[2])
y = int(input_str[3])
r = int(input_str[4])

print('Yes' if x-r >= 0 and x+r <= W and y-r >= 0 and y+r <= H else 'No')
Buggy python submission (verdict: Runtime Error):
s = raw_input()
s = s[:-1]
cnt = 0
while True:
	text = raw_input()
	if 'END_OF_TEXT' == text[0:-1]:
		break
	while text.find(s)>=0:
		text = text[text.find(s)+len(s):]
		cnt += 1
print cnt

Fixed submission:
s = raw_input()
s = s.lower().strip()
cnt = 0
while True:
	text = raw_input()
	if 'END_OF_TEXT' == text.strip():
		break
	text = text.lower()
	for item in text.split():
		if item == s:
			cnt += 1
print cnt
Buggy python submission (verdict: Runtime Error):
=int(raw_input())

def comb(tr):
    l=len(tr)
    res=[]
    for i in range(l):
        head,tail=tr[i:],tr[:i]
        headrev=head[::-1]
        tailrev=tail[::-1]
        res.append(head+tail)
        res.append(headrev+tail)
        res.append(head+tailrev)
        res.append(headrev+tailrev)
        res.append(tail+head)
        res.append(tailrev+head)
        res.append(tail+headrev)
        res.append(tailrev+headrev)
    return len(set(res))
    #return res
for i in range(n):
    tr = raw_input()
    print comb(tr)

Fixed submission:
n=int(raw_input())

def comb(tr):
    l=len(tr)
    res=[]
    for i in range(l):
        head,tail=tr[i:],tr[:i]
        headrev=head[::-1]
        tailrev=tail[::-1]
        res.append(head+tail)
        res.append(headrev+tail)
        res.append(head+tailrev)
        res.append(headrev+tailrev)
        res.append(tail+head)
        res.append(tailrev+head)
        res.append(tail+headrev)
        res.append(tailrev+headrev)
    return len(set(res))
    #return res
for i in range(n):
    tr = raw_input()
    print comb(tr)
Buggy python submission (verdict: Runtime Error):
 #_*_ coding:utf-8 _*_
  2 import sys
  3 
  4 
  5 while True:
  6     vals = sys.stdin.readline()
  7     if(vals is  None or vals.strip() == '' ):
  8         break
  9     a,b,c,d,e,f=list( map(float,vals.strip().split()))
 10     temp = a * e - d * b
 11     print(temp)
 12     x = (c * e - b * f) / temp + 0.0
 13     y = (c * d - a * f) / -temp + 0.0
 14     print('%.3f %.3f' % (x,y))
 15     

Fixed submission:
#_*_ coding:utf-8 _*_
import sys


while True:
    vals = sys.stdin.readline()
    if(vals is  None or vals.strip() == '' ):
        break
    a,b,c,d,e,f=list( map(float,vals.strip().split()))
    temp = a * e - d * b
    x = (c * e - b * f) / temp + 0.0
    y = (c * d - a * f) / -temp + 0.0
    print('%.3f %.3f' % (x,y))

Buggy python submission (verdict: Runtime Error):
 #_*_ coding:utf-8 _*_
   import sys
  
   
  while True:
      vals = sys.stdin.readline()
      if(vals is  None or vals.strip() == '' ):
           break
      a,b,c,d,e,f=list( map(float,vals.strip().split()))
      temp = a * e - d * b
      print(temp)
      x = (c * e - b * f) / temp + 0.0
      y = (c * d - a * f) / -temp + 0.0
      print('%.3f %.3f' % (x,y))
     

Fixed submission:
#_*_ coding:utf-8 _*_
import sys


while True:
    vals = sys.stdin.readline()
    if(vals is  None or vals.strip() == '' ):
        break
    a,b,c,d,e,f=list( map(float,vals.strip().split()))
    temp = a * e - d * b
    x = (c * e - b * f) / temp + 0.0
    y = (c * d - a * f) / -temp + 0.0
    print('%.3f %.3f' % (x,y))
Buggy python submission (verdict: Runtime Error):
import  copy
h = w = 0
mymap =[]
const_mymap = []
qlist = []
ans = 0
def bfs(n):
    while True:
        if len(qlist) != 0:
            temp = qlist.pop(0)
            x = temp[0]
            y = temp[1]
            deep = temp[2]

            #print(temp)
            if mymap[y][x] == str(n):

                return temp
            mymap[y] = mymap[y][:x] + '*' + mymap[y][x + 1:]

            if x + 1 < w:
                if mymap[y][x + 1] not in '*X':
                    qlist.append([x + 1, y, deep + 1])
            if x - 1 >= 0:
                if mymap[y][x - 1] not in '*X':
                    qlist.append([x - 1, y, deep + 1])
            if y + 1 < h:
                if mymap[y + 1][x] not in '*X':
                    qlist.append([x, y + 1, deep + 1])
            if y - 1 >= 0:
                if mymap[y - 1][x] not in '*X':
                    qlist.append([x, y - 1, deep + 1])
        else:
            break
h, w, n = list(map(lambda x: int(x), input().split(" ")))
for i in range(0, h):
    const_mymap.append(input())

mymap = copy.deepcopy(const_mymap)

for i in range(0, h):
    for j in range(0, w):
        if mymap[i][j] == 'S':
            nstart = [j, i, 0]

qlist.append(nstart)

for i in range (n):
    mymap = copy.deepcopy(const_mymap)
    temp = bfs(i+1)
    #print(temp)
    #print(const_mymap)
    ans = temp[2]
    qlist = []
    qlist.append(temp)
    #print(ans)

print(ans)

Fixed submission:
import  copy
h = w = 0
mymap =[]
const_mymap = []
qlist = []
ans = 0
def bfs(n):
    while True:
        if len(qlist) != 0:
            temp = qlist.pop(0)
            x = temp[0]
            y = temp[1]
            deep = temp[2]

            #print(temp)
            if mymap[y][x] == str(n):
                #print('get')
                return temp
            if mymap[y][x] != '*':
                mymap[y] = mymap[y][:x] + '*' + mymap[y][x + 1:]

                if x + 1 < w:
                    if mymap[y][x + 1] not in '*X':
                        qlist.append([x + 1, y, deep + 1])
                if x - 1 >= 0:
                    if mymap[y][x - 1] not in '*X':
                        qlist.append([x - 1, y, deep + 1])
                if y + 1 < h:
                    if mymap[y + 1][x] not in '*X':
                        qlist.append([x, y + 1, deep + 1])
                if y - 1 >= 0:
                    if mymap[y - 1][x] not in '*X':
                        qlist.append([x, y - 1, deep + 1])
        else:
            break
h, w, n = list(map(lambda x: int(x), input().split(" ")))
for i in range(0, h):
    const_mymap.append(input())

mymap = copy.deepcopy(const_mymap)

for i in range(0, h):
    for j in range(0, w):
        if mymap[i][j] == 'S':
            nstart = [j, i, 0]
#print(nstart)

qlist.append(nstart)
#print(qlist)
for i in range (n):
    #print(i)
    mymap = copy.deepcopy(const_mymap)
    xy = bfs(i+1)
    #print(xy)
    #print(const_mymap)
    ans = xy[2]
    qlist = []
    qlist.append(xy)
    #print(ans)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def search(l,r) :
    counter =0;
    j=0;
    while j < len(r):
        for i in range(0,len(l)):
            if r[j]==l[i]:
                counter +=1
                break
        j+=1

    return  counter


input()
list1 = list(map(lambda  x : int(x),input().split(' ')))
input()
list2 =  list(map(lambda  x : int(x),input().split(' ')))
#print(list1)
#print(list2)
ans = search(list1,list2)
print(ans)

Fixed submission:
def search(l,r) :
    counter =0;
    j=0
    i=0
    while j < len(r):
        while i < len(l):
            if r[j] > l[i]:
                i+=1
            elif r[j]==l[i]:
                counter +=1
                break
            elif r[j] < l[i]:
                break
        j+=1

    return  counter


input()
list1 = list(map(lambda  x : int(x),input().split(' ')))
input()
list2 =  list(map(lambda  x : int(x),input().split(' ')))
list1.sort()
list2.sort()

#print(list1)
#print(list2)
ans = search(list1,list2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def search(l,r) :
    counter =0;
    j=0;
    while j < len(r):
        for i in range(0,len(l)):
            if r[j]==l[i]:
                counter +=1
                break
        j+=1

    return  counter


input()
list1 = list(map(lambda  x : int(x),input().split(' ')))
input()
list2 =  list(map(lambda  x : int(x),input().split(' ')))
#print(list1)
#print(list2)
ans = search(list1,list2)
print(ans)

Fixed submission:
def search(l,r) :
    counter =0;
    j=0
    i=0
    while j < len(r):
        while i < len(l):
            if r[j] > l[i]:
                i+=1
            elif r[j]==l[i]:
                counter +=1
                break
            elif r[j] < l[i]:
                break
        j+=1

    return  counter


input()
list1 = list(map(lambda  x : int(x),input().split(' ')))
input()
list2 =  list(map(lambda  x : int(x),input().split(' ')))
list1.sort()
list2.sort()

#print(list1)
#print(list2)
ans = search(list1,list2)
print(ans)

Buggy python submission (verdict: Runtime Error):
ef search(l,r) :
    counter =0;
    j=0
    i=0
    while j < len(r):
        while i < len(l):
            if r[j] > l[i]:
                i+=1
            elif r[j]==l[i]:
                counter +=1
                break
            elif r[j] < l[i]:
                break
        j+=1

    return  counter


input()
list1 = list(map(lambda  x : int(x),input().split(' ')))
input()
list2 =  list(map(lambda  x : int(x),input().split(' ')))
list1.sort()
list2.sort()

#print(list1)
#print(list2)
ans = search(list1,list2)
print(ans)

Fixed submission:
def search(l,r) :
    counter =0;
    j=0
    i=0
    while j < len(r):
        while i < len(l):
            if r[j] > l[i]:
                i+=1
            elif r[j]==l[i]:
                counter +=1
                break
            elif r[j] < l[i]:
                break
        j+=1

    return  counter


input()
list1 = list(map(lambda  x : int(x),input().split(' ')))
input()
list2 =  list(map(lambda  x : int(x),input().split(' ')))
list1.sort()
list2.sort()

#print(list1)
#print(list2)
ans = search(list1,list2)
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def qui(l):
    num = len(l)
    if num == 0: return []
    piv = l[int(num/2)]
    mini = []
    maxi = []
    for i in l:
        if piv > i :
            mini.append(i)
        elif piv < i:
            maxi.append(i)
    print(piv)
    print("{0}".format(mini))
    print("{0}".format(maxi))
    return qui(mini) + [piv] + qui(maxi)

input()
list1 = list(map(lambda x: int(x), input().split(" ")))
print(list1)
result = qui(list1)

print(result)

Fixed submission:
# -*- coding: utf-8 -*-


def qui(l):
    num = len(l)
    if num <= 1:
        return l
    piv = 0
    piv2 = len(l)-1
    piv3 = int(len(l)/2)
    if l[piv] > l[piv2] > l[piv3]:
        piv = piv2
    elif l[piv] > l[piv3] > l[piv2]:
        piv = piv3
    else:
        pass
    mini = []
    maxi = []

    for i in range(0,len(l)):
        if i == piv:
            continue
        if l[piv] > l[i]:
            mini.append(l[i])
        elif l[piv] <= l[i]:
            maxi.append(l[i])
    return qui(mini) + [l[piv]] + qui(maxi)

input()
list1 = list(map(lambda x: int(x), input().split(" ")))
result = qui(list1)

print(' '.join(map(str, result)))
Buggy python submission (verdict: Time Limit Exceeded):
cnt_num = int(input())
dataset = [int(input()) for i in range(cnt_num)]

count = 0
for i in dataset:
    if i <= 1:
        continue

    if i == 2:
        count += 1
        continue

    if i == 3:
        count += 1
        continue

    if i % 2 == 0:
        continue

    ng = ''
    for j in range(3,i,2):
        if i % j == 0:
            ng = 'X'
            break

    if ng == '':
        count += 1
        continue

print(count)

Fixed submission:
def check_prime(num):
    if num == 2:
        return True

    if num < 2 or num % 2 == 0:
        return False

    return pow(2,num-1,num) == 1

cnt_num = int(input())
dataset = [int(input()) for i in range(cnt_num)]

count = 0
for i in dataset:
    if check_prime(i):
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
s = int(input()).split()
print(s[0]*s[1],' ',s[0]*2+s[1]*2)

Fixed submission:
s = input().split()
print(int(s[0])*int(s[1]),int(s[0])*2+int(s[1])*2)

Buggy python submission (verdict: Runtime Error):
s = input().split()
print(str(s[0]*s[1]),' ',str(s[0]*2+s[1]*2))

Fixed submission:
s = input().split()
print(int(s[0])*int(s[1]),int(s[0])*2+int(s[1])*2)

Buggy python submission (verdict: Runtime Error):
s = int(input().split())
print(int(s[0])*int(s[1]),' ',int(s[0]*2)+int(s[1]*2))

Fixed submission:
s = input().split()
print(int(s[0])*int(s[1]),int(s[0])*2+int(s[1])*2)
Buggy python submission (verdict: Runtime Error):
while True:
    n = int(input())
    if n == 0:
        break
    c = 0
    for i in range(2, 1001):
        for a in range(1, 1001):
            if i*a+(0.5*(i-1)*i) == n:
                c += 1
    print(c)



Fixed submission:
while True:
    n = int(input())
    if n == 0:
        break
    c = 0
    for i in range(2, 1001//2):
        for a in range(1, 1001//2):
            if i*a+(0.5*(i-1)*i) == n:
                c += 1
    print(c)

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        n = int(input())
    except:
        break
    if n == 0:
        break
    c = 0
    for i in range(2, 1001):
        for a in range(1, 1001):
            if i*a+(0.5*(i-1)*i) == n:
                c += 1
    print(c)



Fixed submission:
while True:
    n = int(input())
    if n == 0:
        break
    c = 0
    for i in range(2, 1001//2):
        for a in range(1, 1001//2):
            if i*a+(0.5*(i-1)*i) == n:
                c += 1
    print(c)

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        n = int(input())
    except ValueError:
        break
    if n == 0:
        break
    c = 0
    for i in range(2, 1001):
        for a in range(1, 1001):
            if i*a+(0.5*(i-1)*i) == n:
                c += 1
    print(c)



Fixed submission:
while True:
    n = int(input())
    if n == 0:
        break
    c = 0
    for i in range(2, 1001//2):
        for a in range(1, 1001//2):
            if i*a+(0.5*(i-1)*i) == n:
                c += 1
    print(c)
Buggy python submission (verdict: Runtime Error):
x = raw_input()
print x**3

Fixed submission:
print int(raw_input())**3
Buggy python submission (verdict: Runtime Error):
s = [[] for n in range(int(raw_input()))]
while True:
    command = raw_input()
    if command.startswith('quit'):
        break
    elif command.startswith('push'):
        p, c = int(command[1]), command[2]
        s[p-1].append(c)
    elif command.startswith('pop'):
        p = int(command[1])
        print s[p-1].pop()
    else:
        p1, p2 = int(command[1]), int(command[2])
        s[p2-1].append(s[p1-1].pop())

Fixed submission:
s = [[] for n in range(int(raw_input()))]
while True:
    command = raw_input().split()
    if command[0] == 'quit':
        break
    elif command[0] == 'push':
        p, c = int(command[1]), command[2]
        s[p-1].append(c)
    elif command[0] == 'pop':
        p = int(command[1])
        print s[p-1].pop()
    else:
        p1, p2 = int(command[1]), int(command[2])
        s[p2-1].append(s[p1-1].pop())
Buggy python submission (verdict: Runtime Error):
def readint():
    for line in sys.stdin:
        yield map(int,line.split())

def gcd(x,y):
    [x,y] = [max(x,y),min(x,y)]
    z = x % y
    while z > 0:
        [x,y,z] = [y,z,x % y]
    return y

for [x,y] in readint():
    GCD = gcd(x,y)
    mx = x/GCD
    print GCD,mx*y

Fixed submission:
import sys

def readint():
    for line in sys.stdin:
        yield map(int,line.split())

def gcd(x,y):
    [x,y] = [max(x,y),min(x,y)]
    while 1:
        z = x % y
        if z == 0:
            break
        [x,y] = [y,z]
    return y

for [x,y] in readint():
    GCD = gcd(x,y)
    mx = x/GCD
    print GCD,mx*y
Buggy python submission (verdict: Time Limit Exceeded):
def findlcs(x, y):
    dp = [[0]*(len(y)+1) for i in range(len(x)+1)]

    for i in range(1, len(x)+1):
        for j in range(1, len(y)+1):
            if x[i-1] == y[j-1]:
                dp[i][j] = dp[i-1][j-1]+1
            else:
                dp[i][j] = max(dp[i-1][j], dp[i][j-1])

    return dp[len(x)][len(y)]


q = int(input())
for k in range(q):
    X = input()
    Y = input()
    print(findlcs(X, Y))

Fixed submission:
def findlcs(x, y):
    dp = [0]*(len(y)+1)

    for c in x:
        tmp = dp[:]
        for j in range(len(y)):
            if c == y[j]:
                dp[j+1] = tmp[j] + 1
            elif dp[j+1] < dp[j]:
                dp[j+1] = dp[j]

    return dp[-1]


q = int(input())
for k in range(q):
    X = input()
    Y = input()
    print(findlcs(X, Y))

Buggy python submission (verdict: Time Limit Exceeded):
def findlcs(x, y):
    dp = [0]*(len(y)+1)

    for i in range(len(x)):
        tmp = dp[:]
        for j in range(len(y)):
            if x[i] == y[j]:
                dp[j+1] = tmp[j] + 1
            else:
                dp[j+1] = max(dp[j+1], dp[j])

    return dp[len(y)]


q = int(input())
for k in range(q):
    X = input()
    Y = input()
    print(findlcs(X, Y))

Fixed submission:
def findlcs(x, y):
    dp = [0]*(len(y)+1)

    for c in x:
        tmp = dp[:]
        for j in range(len(y)):
            if c == y[j]:
                dp[j+1] = tmp[j] + 1
            elif dp[j+1] < dp[j]:
                dp[j+1] = dp[j]

    return dp[-1]


q = int(input())
for k in range(q):
    X = input()
    Y = input()
    print(findlcs(X, Y))

Buggy python submission (verdict: Time Limit Exceeded):
def findlcs(x, y):
    dp = [0]*(len(y)+1)

    for c in x:
        tmp = dp[:]
        for j in range(len(y)):
            if c == y[j]:
                dp[j+1] = tmp[j] + 1
            else:
                dp[j+1] = max(dp[j+1], dp[j])

    return dp[-1]


q = int(input())
for k in range(q):
    X = input()
    Y = input()
    print(findlcs(X, Y))

Fixed submission:
def findlcs(x, y):
    dp = [0]*(len(y)+1)

    for c in x:
        tmp = dp[:]
        for j in range(len(y)):
            if c == y[j]:
                dp[j+1] = tmp[j] + 1
            elif dp[j+1] < dp[j]:
                dp[j+1] = dp[j]

    return dp[-1]


q = int(input())
for k in range(q):
    X = input()
    Y = input()
    print(findlcs(X, Y))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))


def binarysearch(key, a, length):
    left = 0
    right = length-1
    while left < right:
        mid = int((left + right)/2)
        if a[mid] == key:
            return True
        elif key < a[mid]:
            right = mid
        else:
            left = mid
    return False


cnt = 0
for i in T:
    if binarysearch(i, S, n):
        cnt += 1
print(cnt)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))


def binarysearch(key, a, length):
    left = 0
    right = length
    while left < right:
        mid = int((left + right)/2)
        if a[mid] == key:
            return True
        elif key < a[mid]:
            right = mid
        else:
            left = mid+1
    return False


cnt = 0
for i in T:
    if binarysearch(i, S, n):
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))


def binarysearch(key, a, length):
    left = 0
    right = length
    while left < right:
        mid = int((left + right)/2)
        if a[mid] == key:
            return True
        elif key < a[mid]:
            right = mid
        else:
            left = mid
    return False


cnt = 0
for i in T:
    if binarysearch(i, S, n):
        cnt += 1
print(cnt)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))


def binarysearch(key, a, length):
    left = 0
    right = length
    while left < right:
        mid = int((left + right)/2)
        if a[mid] == key:
            return True
        elif key < a[mid]:
            right = mid
        else:
            left = mid+1
    return False


cnt = 0
for i in T:
    if binarysearch(i, S, n):
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = []

if i in range(n):
    order = input().split()
    if order[0] == 'insert':
        d.append(order[1])
    else:
        if order[1] in d:
            print("yes")
        else:
            print("no")

Fixed submission:
n = int(input())
d = {}

for i in range(n):
    order = input().split()
    if order[0] == 'insert':
        d[order[1]] = i
    else:
        if order[1] in d:
            print("yes")
        else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = []

for i in range(n):
    order = input().split()
    if order[0] == 'insert':
        d.append(order[1])
    else:
        if order[1] in d:
            print("yes")
        else:
            print("no")

Fixed submission:
n = int(input())
d = {}

for i in range(n):
    order = input().split()
    if order[0] == 'insert':
        d[order[1]] = i
    else:
        if order[1] in d:
            print("yes")
        else:
            print("no")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))


def exhaustivesearch(i, target):
    if target == 0:
        return True
    if i >= n:
        return False
    ans = exhaustivesearch(i + 1, target) or exhaustivesearch(i + 1, target-A[i])
    return ans


for j in m:
    if exhaustivesearch(0, j):
        print("yes")
    else:
        print("no")

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))
memo = [[None]*2000 for i in range(2000)]


def exhaustivesearch(i, target):
    if memo[i][target] is not None:
        return memo[i][target]
    if target == 0:
        memo[i][target] = True
        return True
    if i >= n:
        memo[i][target] = False
        return False
    else:
        memo[i][target] = exhaustivesearch(i + 1, target) or exhaustivesearch(i + 1, target-A[i])
        return memo[i][target]


for j in m:
    if exhaustivesearch(0, j):
        print("yes")
    else:
        print("no")