s_id
string
p_id
string
u_id
string
date
string
language
string
original_language
string
filename_ext
string
status
string
cpu_time
string
memory
string
code_size
string
code
string
error
string
stdout
string
s046969740
p02271
u255317651
1525342426
Python
Python3
py
Runtime Error
0
0
921
# -*- 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')
Traceback (most recent call last): File "/tmp/tmp94cz9vku/tmpzlhez5i1.py", line 9, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s105386352
p02271
u126478680
1525348371
Python
Python3
py
Runtime Error
7980
5612
426
n = int(input()) A = list(map(int, input().split(' '))) q = int(input()) M = list(map(int, input().split(' '))) def rec(i, sum, m): if i == n: if sum == m: return True else: return False if sum > m: return False rst = rec(i+1, sum, m) or rec(i+1, sum + A[i], m) return rst for m in M: if rec(0, 0, m): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpw13wnko5/tmpelgxuwra.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s520652891
p02271
u126478680
1525356541
Python
Python3
py
Runtime Error
10000
5608
401
n = int(input()) A = list(map(int, input().split(' '))) q = int(input()) M = list(map(int, input().split(' '))) def rec(i, sum, m): if sum == m: return True elif sum > m: return False if i >= n: return False rst = rec(i+1, sum, m) or rec(i+1, sum + A[i], m) return rst for m in M: if rec(0, 0, m): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmppkkx77ib/tmpd_bhiw63.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s661483592
p02271
u126478680
1525357165
Python
Python3
py
Runtime Error
9570
5612
403
n = int(input()) A = sorted(map(int, input().split(' '))) q = int(input()) M = list(map(int, input().split(' '))) def rec(i, sum, m): if sum == m: return True elif sum > m: return False if i >= n: return False rst = rec(i+1, sum, m) or rec(i+1, sum + A[i], m) return rst for m in M: if rec(0, 0, m): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpx2cmkruf/tmp00cilwn5.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s683892189
p02271
u126478680
1525357669
Python
Python3
py
Runtime Error
8070
5612
341
n = int(input()) A = list(map(int, input().split(' '))) q = int(input()) M = list(map(int, input().split(' '))) def rec(i, m): if m == 0: return True if i >= n: return False rst = rec(i+1, m - A[i]) or rec(i+1, m) return rst for m in M: if rec(0, m): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpp59y5074/tmpd9922gs3.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s579889343
p02271
u255317651
1525432279
Python
Python3
py
Runtime Error
13910
5916
987
# -*- 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')
Traceback (most recent call last): File "/tmp/tmpt9ki1vfn/tmpkm6ptrv_.py", line 9, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s645133288
p02271
u011621222
1525965307
Python
Python3
py
Runtime Error
20
5596
451
n=int(input()) A=[int(x) for x in input().split()] q=int(input()) M=[int(x) for x in input().split()] def solve(m,AA): if len(AA)==0: return False if m in AA: return True else: for i in range(len(AA)): if solve(m-AA[i],AA[:i]+AA[i+1:]): return True break return False for m in M: if solve(m,A): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpfexwbx1p/tmpbjvct0jp.py", line 1, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s285677990
p02271
u011621222
1525966807
Python
Python3
py
Runtime Error
7220
5620
437
import sys sys.setrecursionlimit(100000) # set the maximum depth as 10000 n=int(input()) A=[int(x) for x in input().split()] q=int(input()) M=[int(x) for x in input().split()] def solve(i,m): global n global A if m==0: return True if i>=n: return False return solve(i+1,m) or solve(i+1,m-A[i]) for m in M: if solve(0,m): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmppt_88cfh/tmpdkw3683_.py", line 4, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s499022099
p02271
u088372268
1526197920
Python
Python3
py
Runtime Error
8500
5612
442
N = int(input()) A = list(map(int, input().split())) def make_m(i, m): if m == 0: return True if i >= N or m < 0: return False return make_m(i+1, m) or make_m(i+1, m-A[i]) def main(): q = int(input()) m_lst = list(map(int, input().split())) for i in range(q): if make_m(0, m_lst[i]): print("yes") else: print("no") if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmpqsym7fmp/tmppx_jwk4x.py", line 1, in <module> N = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s636725703
p02271
u113295414
1526910929
Python
Python3
py
Runtime Error
7510
5612
453
n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) # リストi番目以降の数字を足して、jが作れるかどうかを判定する関数を定義 def judge(i, j): if j == 0: return True elif i >= n: return False else: return judge(i + 1, j) or judge(i + 1, j - A[i]) for m in M: if judge(0, m): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpmu748t60/tmpj1gnfeqg.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s868898467
p02271
u408444038
1527062396
Python
Python3
py
Runtime Error
10590
5656
349
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) A.sort() for h in range(q): cnt=0 for i in range(n): for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpmhy9jupj/tmp7qb7g17t.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s080817728
p02271
u408444038
1527062496
Python
Python3
py
Runtime Error
11260
5656
340
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) for h in range(q): cnt=0 for i in range(n): for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp91_oid73/tmp0x_iibnx.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s937917453
p02271
u408444038
1527062672
Python
Python3
py
Runtime Error
10780
5652
349
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) A.sort() for h in range(q): cnt=0 for i in range(n): for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmptxj3zov8/tmpzcorx9sk.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s111005309
p02271
u848218390
1527062822
Python
Python3
py
Runtime Error
8020
5656
369
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for mi in M: flg = False for i in range(len(A)): C = itl.combinations(A, i) for j in C: if sum(j) == mi: flg = True break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpbo3u9t3w/tmpwgcggkbz.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s905758796
p02271
u848218390
1527063025
Python
Python3
py
Runtime Error
0
0
386
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for mi in M: flg = False for i in range(len(A)): C = itl.combinations_with_replacemant(A, i) for j in C: if sum(j) == mi: flg = True break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpjwrr5zvp/tmph6kbcan_.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s799042271
p02271
u408444038
1527063027
Python
Python3
py
Runtime Error
9210
5652
384
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) A.sort() for h in range(q): cnt=0 for i in range(n): for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 break if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpvt6mjjki/tmp1ldw8jon.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s220367170
p02271
u408444038
1527063099
Python
Python3
py
Runtime Error
8130
5652
421
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) A.sort() for h in range(q): cnt=0 for i in range(n): if cnt==1: break for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 break if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpt8rur3sc/tmpcgfaaagf.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s023749328
p02271
u408444038
1527063212
Python
Python3
py
Runtime Error
8240
5660
412
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) for h in range(q): cnt=0 for i in range(n): if cnt==1: break for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 break if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpfzleasyb/tmpz_6i7vag.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s858384987
p02271
u848218390
1527063293
Python
Python3
py
Runtime Error
7770
5652
369
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for mi in M: flg = False for i in range(len(A)): C = itl.combinations(A, i) for j in C: if sum(j) == mi: flg = True break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp472y5bap/tmps5yt6cx4.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s383646427
p02271
u848218390
1527063751
Python
Python3
py
Runtime Error
7840
5652
387
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for mi in M: flg = False for i in range(len(A)): C = itl.combinations(A, i) #print(C) for j in C: if sum(j) == mi: flg = True break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpwjqdhsym/tmplosnxc5e.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s069220070
p02271
u408444038
1527063919
Python
Python3
py
Runtime Error
7710
5656
415
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) A.sort() for h in range(q): cnt=0 for i in range(n-1,0,-1): if cnt==1: break for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 break if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpniejrlw4/tmp25259211.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s401584859
p02271
u408444038
1527064266
Python
Python3
py
Runtime Error
0
0
456
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) A.sort() for h in range(q): cnt=0 if m[q] > sum(A): break for i in range(n-1,0,-1): if cnt==1: break for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 break if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpta_c15gv/tmpaiaf602d.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s718945856
p02271
u408444038
1527064787
Python
Python3
py
Runtime Error
10690
5656
349
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) A.sort() for h in range(q): cnt=0 for i in range(n): for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp2b83ur28/tmprzt35hu4.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s073282318
p02271
u408444038
1527064829
Python
Python3
py
Runtime Error
10720
5652
351
import itertools as it n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) A.sort() for h in range(q): cnt=0 for i in range(n+1): for j in it.combinations(A,i): if sum(j)==m[h]: cnt = 1 if cnt==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp6hl1lt2z/tmpj5fv3uis.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s067221397
p02271
u564464686
1527065499
Python
Python3
py
Runtime Error
5790
13540
579
import itertools n=int(input()) A=[0 for i in range(n)] A=input().split() for i in range(n): A[i]=int(A[i]) q=int(input()) B=[0 for i in range(q)] B=input().split() C=[] for i in range(q): B[i]=int(B[i]) l=[0,1] p=[] k=0 D=[] for v in itertools.product(l,repeat=n): sum=0 for i in range(n): if v[i]==1: sum=sum+A[i] D.append(sum) k+=1 for i in range(q): c=0 for j in range(k): if B[i]==D[j] and c==0: C.append("yes") c+=1 if c==0: C.append("no") for i in range(q): print(C[i])
Traceback (most recent call last): File "/tmp/tmpdnydwaz3/tmpumk0ir0m.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s811018096
p02271
u564464686
1527065685
Python
Python3
py
Runtime Error
6000
13540
578
import itertools n=int(input()) A=[0 for i in range(n)] A=input().split() for i in range(n): A[i]=int(A[i]) q=int(input()) B=[0 for i in range(q)] B=input().split() C=[] for i in range(q): B[i]=int(B[i]) l=[0,1] p=[] k=0 D=[] for v in itertools.product(l,repeat=n): sum=0 for i in range(n): if v[i]==1: sum=sum+A[i] D.append(sum) k+=1 for i in range(q): c=0 for j in range(k): if B[i]==D[j] and c==0: C.append("yes") c+=1 if c==0: C.append("no") for i in range(q): print(C[i])
Traceback (most recent call last): File "/tmp/tmp_xc40w42/tmpr_kiptpj.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s781530870
p02271
u564464686
1527065907
Python
Python3
py
Runtime Error
6760
13548
600
import itertools n=int(input()) A=[0 for i in range(n)] A=input().split() for i in range(n): A[i]=int(A[i]) q=int(input()) B=[0 for i in range(q)] B=input().split() C=[] for i in range(q): B[i]=int(B[i]) l=[0,1] p=[] k=0 D=[] for v in itertools.product(l,repeat=n): sum=0 for i in range(n): if v[i]==1: sum=sum+A[i] D.append(sum) k+=1 for i in range(q): c=0 j=0 while c==0 and j<k: if B[i]==D[j] and c==0: C.append("yes") c+=1 j+=1 if c==0: C.append("no") for i in range(q): print(C[i])
Traceback (most recent call last): File "/tmp/tmpnn5gszxe/tmpt9c7mcf0.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s283010129
p02271
u564464686
1527066255
Python
Python3
py
Runtime Error
7060
13544
600
import itertools n=int(input()) A=[0 for i in range(n)] A=input().split() for i in range(n): A[i]=int(A[i]) q=int(input()) B=[0 for i in range(q)] B=input().split() C=[] for i in range(q): B[i]=int(B[i]) l=[0,1] p=[] k=0 D=[] for v in itertools.product(l,repeat=n): sum=0 for i in range(n): if v[i]==1: sum=sum+A[i] D.append(sum) k+=1 for i in range(q): c=0 j=0 while c==0 and j<k: if B[i]==D[j] and c==0: C.append("yes") c+=1 j+=1 if c==0: C.append("no") for i in range(q): print(C[i])
Traceback (most recent call last): File "/tmp/tmp4v8mj18x/tmpj6ksakrt.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s598836421
p02271
u564464686
1527066443
Python
Python3
py
Runtime Error
7060
13548
600
import itertools n=int(input()) A=[0 for i in range(n)] A=input().split() for i in range(n): A[i]=int(A[i]) q=int(input()) B=[0 for i in range(q)] B=input().split() C=[] for i in range(q): B[i]=int(B[i]) l=[0,1] p=[] k=0 D=[] for v in itertools.product(l,repeat=n): sum=0 for i in range(n): if v[i]==1: sum=sum+A[i] D.append(sum) k+=1 for i in range(q): c=0 j=0 while c==0 and j<k: if B[i]==D[j] and c==0: C.append("yes") c+=1 j+=1 if c==0: C.append("no") for i in range(q): print(C[i])
Traceback (most recent call last): File "/tmp/tmpcf5zr3wx/tmpokdt4nn1.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s665953244
p02271
u848218390
1527067432
Python
Python3
py
Runtime Error
8610
5652
385
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for mi in M: flg = False for i in range(n): C = itl.combinations(A, i+1) #print(C) for j in C: if sum(j) == mi: flg = True break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpw5k6e78m/tmpglouzq_x.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s921109654
p02271
u848218390
1527067577
Python
Python3
py
Runtime Error
8930
5652
406
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for mi in M: flg = False for i in range(n): C = itl.combinations(A, i+1) #print(C) for j in C: if sum(j) == mi: flg = True break if flg: break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpqecwctor/tmp7cy71_ct.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s046373020
p02271
u848218390
1527068422
Python
Python3
py
Runtime Error
6880
5656
389
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for mi in M: flg = False for i in range(n): C = itl.combinations(A, i+1) for j in C: if sum(j) == mi: flg = True break if flg: break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp6twmt3hq/tmpv3v2eh69.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s220299271
p02271
u398978447
1527069444
Python
Python3
py
Runtime Error
0
0
374
n=int(input()) A=[int(j) for j in input().split()] m=int(input()) B=[int(j) for j in input().split()] ans=[0 for i in range(n)] C=[0 for i in range(n)] for i in range(0,m+1): for j in range(i+1,m+1): if i==j: break ans=A[i]+A[j] C.append(ans) for i in range(m): if B[i] in C: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpy3kx5giz/tmp3hqrt6tn.py", line 1, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s240640507
p02271
u848218390
1527071100
Python
Python3
py
Runtime Error
9680
5660
387
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) C = [False for i in range(q)] for i in range(1, n+1): for j in itl.combinations(A, i): for mi in range(q): if sum(j) == M[mi]: C[mi] = True for c in C: if c: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp2sd0kl62/tmpjx32l_7o.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s219354005
p02271
u843517396
1527099297
Python
Python3
py
Runtime Error
3630
18500
455
#coading Shift_JIS import itertools n=int(input()) str=input().split() A=[0 for i in range(n)] for i in range(n): A[i]=int(str[i]) q=int(input()) m=[0 for i in range(q)] str=input().split() for i in range(q): m[i]=int(str[i]) cn=n while cn>0: l=list(itertools.combinations(A,cn)) for j in l: sum=0 for k in j: sum+=k for cnt in range(q): if sum==m[cnt]: m[cnt]=-1 cn-=1 for i in range(q): if m[i]>0: print("no") else: print("yes")
Traceback (most recent call last): File "/tmp/tmpbd2se4k7/tmpt9mwuyk0.py", line 3, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s034045137
p02271
u843517396
1527101077
Python
Python3
py
Runtime Error
0
0
365
#coading Shift_JIS import numpy as np n=int(input()) str=input().split() A=np.zeros(n) for i in range(n): A[i]=int(str[i]) q=int(input()) m=np.zeros(q) str=input().split() def solve(i,m): if m==0: return 1 if i>=n: return 0 res=solve(i+1,m) or solve(i+1,m-A[i]) return res for i in range(q): m=int(str[i]) if solve(0,m)==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpwgnqxtek/tmp9y9jf70f.py", line 3, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s261444500
p02271
u843517396
1527101138
Python
Python3
py
Runtime Error
7570
5612
366
#coading Shift_JIS n=int(input()) str=input().split() A=[0 for i in range(n)] for i in range(n): A[i]=int(str[i]) q=int(input()) m=[0 for i in range(q)] str=input().split() def solve(i,m): if m==0: return 1 if i>=n: return 0 res=solve(i+1,m) or solve(i+1,m-A[i]) return res for i in range(q): m=int(str[i]) if solve(0,m)==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp2wjeb86f/tmp2s9g244z.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s669680245
p02271
u063056051
1527159452
Python
Python3
py
Runtime Error
0
0
398
n=int(input()) list1=map(int,input().split()) q=int(input()) list2=map(int,input().split()) for i in range(len(list2)): list3=[] ok=0 for j in range(len(list1)): if list2[i]<list1[j]: list3.append(list1[j]) for k in range(len(list3)-1): if ok==1: break for l in range(1,len(list3)): if list3[k]+list3[l]==list2[i]: print("yes") ok=1 break if ok==0: print("no")
Traceback (most recent call last): File "/tmp/tmpp1ln508o/tmpgs5fsyst.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s075674058
p02271
u063056051
1527161990
Python
Python3
py
Runtime Error
12980
21000
408
import itertools n=int(input()) list1=[int(x) for x in input().split()] q=int(input()) list2=[int(x) for x in input().split()] for i in range(len(list2)): ok=0 for j in range(1,len(list1)): if ok==1: break list3=list(itertools.combinations(list1,j)) for k in range(len(list3)): if ok==1: break if sum(list3[k])==list2[i]: print("yes") ok=1 break if ok==0: print("no")
Traceback (most recent call last): File "/tmp/tmp855tzw17/tmppj405x4j.py", line 4, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s016216421
p02271
u217703215
1527217942
Python
Python3
py
Runtime Error
8560
5612
400
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 n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) m=int(input()) B=list(input().split()) ans=[] for i in range(m): B[i]=int(B[i]) ans=solve(0,B[i]) if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmprx07ubnu/tmpb6lmdbdx.py", line 9, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s924935408
p02271
u217703215
1527218329
Python
Python3
py
Runtime Error
7690
5612
400
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 n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) m=int(input()) B=list(input().split()) ans=[] for i in range(m): B[i]=int(B[i]) ans=solve(0,B[i]) if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpcqwld2vn/tmpbl89ik9r.py", line 9, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s194928832
p02271
u217703215
1527301872
Python
Python3
py
Runtime Error
8230
5612
401
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 n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) m=int(input()) B=list(input().split()) ans=[] for i in range(m): B[i]=int(B[i]) ans=solve(0,B[i]) if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpjbm9l8ni/tmprt5qaq1e.py", line 9, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s297390120
p02271
u848218390
1527308335
Python
Python3
py
Runtime Error
7150
5652
374
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for mi in M: flg = False for i in range(n): for j in itl.combinations(A, i+1): if sum(j) == mi: flg = True break if flg: break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp_bf_dp8v/tmpzofy3fim.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s345491173
p02271
u848218390
1527310042
Python
Python3
py
Runtime Error
6970
5612
369
def solve(A, n, i, m): if m == 0: return True if i >= n: return False res = solve(A, n, i+1, m) or solve(A, n, i+1, m-A[i]) return res n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for m in M: if solve(A, len(A), 0, m): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpncwntzyj/tmpt64t76iy.py", line 9, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s952538629
p02271
u848218390
1527311508
Python
Python3
py
Runtime Error
9330
14928
381
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) for mi in M: flg = False for i in range(n): for j in list(itl.combinations(A, i+1)): if sum(j) == mi: flg = True break if flg: break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpw0ccf_t5/tmp58agc9rb.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s388028671
p02271
u848218390
1527314672
Python
Python3
py
Runtime Error
8960
14944
679
import itertools as itl n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) S = [] """通る(ko) for i in range(n): cmb = list(itl.combinations(A, i+1)) for j in cmb: S.append(sum(j)) for m in M: flg = False for s in S: if s == m: flg = True break if flg: print("yes") else: print("no") """ for mi in M: flg = False for i in range(n): for j in list(itl.combinations(A, i+1)): if sum(j) == mi: flg = True break if flg: break if flg: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp2jeqe2bu/tmp6arb04q0.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s153853625
p02271
u938045879
1527323157
Python
Python3
py
Runtime Error
7580
5616
370
n = int(input()) a = list(map(int, input().split(' '))) q = int(input()) M = list(map(int, input().split(' '))) S = [0 for i in range(n)] 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 j in M: if solve(0, j): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpdlsh1rbt/tmp_ccr424q.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s795743862
p02271
u938045879
1527323295
Python
Python3
py
Runtime Error
7480
5608
343
n = int(input()) a = list(map(int, input().split(' '))) q = int(input()) M = list(map(int, 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 j in M: if solve(0, j): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpml3v0g6c/tmp7a5nzup4.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s997333763
p02271
u938045879
1527323469
Python
Python3
py
Runtime Error
0
0
419
n = int(input()) a = list(map(int, input().split(' '))) q = int(input()) M = list(map(int, input().split(' '))) minA = min(a) sumA = sum(a) 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 j in M: if j < minA or m>sumA: print('no') if solve(0, j): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpp4taosgv/tmpa3c6eui9.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s352297429
p02271
u938045879
1527323498
Python
Python3
py
Runtime Error
0
0
445
n = int(input()) a = list(map(int, input().split(' '))) q = int(input()) M = list(map(int, input().split(' '))) minA = min(a) sumA = sum(a) 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 j in M: if j < minA or m>sumA: print('no') else: if solve(0, j): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmptxyv5nad/tmphl2y6za0.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s784631266
p02271
u217703215
1527485125
Python
Python3
py
Runtime Error
8130
5612
401
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 n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) m=int(input()) B=list(input().split()) ans=[] for i in range(m): B[i]=int(B[i]) ans=solve(0,B[i]) if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmphihj60hz/tmpg4qblbph.py", line 9, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s557998406
p02271
u405027099
1527489747
Python
Python3
py
Runtime Error
7470
5612
381
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 n=int(input()) A=input().split() q=int(input()) M=input().split() ans=[] for i in range(n): A[i]=int(A[i]) for i in range(q): M[i]=int(M[i]) ans=solve(0,M[i]) if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpe98aw3ho/tmp462ofbqn.py", line 9, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s998095461
p02271
u733945366
1527491286
Python
Python3
py
Runtime Error
7880
5612
376
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; n=int(input()) a=input().split() q=int(input()) m=input().split() ans=[] for i in range(n): a[i]=int(a[i]) for i in range(q): m[i]=int(m[i]) ans=solve(0,m[i]); if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpxhho0e7g/tmpp6n2h5o7.py", line 10, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s010454582
p02271
u165447384
1527519170
Python
Python3
py
Runtime Error
8100
5608
401
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 n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) m=int(input()) B=list(input().split()) ans=[] for i in range(m): B[i]=int(B[i]) ans=solve(0,B[i]) if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp7uz9oh0y/tmpd98jzl64.py", line 9, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s491479870
p02271
u165447384
1527519456
Python
Python3
py
Runtime Error
0
0
431
sys.setrecursionlimit(20000) 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 n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) m=int(input()) B=list(input().split()) ans=[] for i in range(m): B[i]=int(B[i]) ans=solve(0,B[i]) if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp5tt5p2ts/tmphhm2uhzy.py", line 1, in <module> sys.setrecursionlimit(20000) ^^^ NameError: name 'sys' is not defined
s873060896
p02271
u165447384
1527519604
Python
Python3
py
Runtime Error
7840
5612
442
import sys sys.setrecursionlimit(20000) 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 n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) m=int(input()) B=list(input().split()) ans=[] for i in range(m): B[i]=int(B[i]) ans=solve(0,B[i]) if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpq9d_4f3a/tmp8zudh6bg.py", line 12, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s250315644
p02271
u165447384
1527519787
Python
Python3
py
Runtime Error
9270
5612
477
#import sys #sys.setrecursionlimit(20000) def solve(i,m): if m==0: return True if m<0: return False if i>=n: return False res=solve(i+1,m) or solve(i+1,m-A[i]) return res n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) m=int(input()) B=list(input().split()) ans=[] for i in range(m): B[i]=int(B[i]) ans=solve(0,B[i]) if ans==True: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp7rkfgtpc/tmp7stf2a8g.py", line 14, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s835725684
p02271
u165447384
1527520260
Python
Python3
py
Runtime Error
0
0
440
#import sys #sys.setrecursionlimit(20000) def solve(i,sum): if i==n: ans[sum] = 1 ans[sum+A[i]] = 1 solve(i+1,sum) if sum+A[i] <=2000: solve(i+1,sum+A[i]) n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) ans=[0]*2001 solve(0,0) m=int(input()) B=list(input().split()) for i in range(m): if ans[B[i]]==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp2oc46q04/tmp10z85190.py", line 12, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s635624954
p02271
u165447384
1527520426
Python
Python3
py
Runtime Error
0
0
436
def solve(i,sum): if i==n: ans[sum] = 1 ans[sum+A[i]] = 1 solve(i+1,sum) if sum+A[i] <= 2000: solve(i+1,sum+A[i]) n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) ans=[0]*2001 solve(0,0) m=int(input()) B=list(input().split()) for i in range(m): B[i]=int(B[i]) for i in range(m): if ans[B[i]]==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpo6vaao21/tmp0kij9dny.py", line 9, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s916094183
p02271
u165447384
1527520495
Python
Python3
py
Runtime Error
0
0
469
def solve(i,sum): if i==n: ans[sum] = 1 if sum+A[i] <= 2000: ans[sum+A[i]] = 1 solve(i+1,sum) if sum+A[i] <= 2000: solve(i+1,sum+A[i]) n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) ans=[0]*2001 solve(0,0) m=int(input()) B=list(input().split()) for i in range(m): B[i]=int(B[i]) for i in range(m): if ans[B[i]]==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp3jxpjf90/tmpg5_0wlrj.py", line 10, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s405905992
p02271
u165447384
1527520563
Python
Python3
py
Runtime Error
0
0
471
def solve(i,sum): if i==n-1: ans[sum] = 1 if sum+A[i] <= 2000: ans[sum+A[i]] = 1 solve(i+1,sum) if sum+A[i] <= 2000: solve(i+1,sum+A[i]) n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) ans=[0]*2001 solve(0,0) m=int(input()) B=list(input().split()) for i in range(m): B[i]=int(B[i]) for i in range(m): if ans[B[i]]==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp7qmn8yci/tmpaxag1zub.py", line 10, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s053474554
p02271
u165447384
1527520787
Python
Python3
py
Runtime Error
0
0
470
def solve(j,sum): if j==n-1: ans[sum] = 1 if sum+A[j] <= 2000: ans[sum+A[j]] = 1 solve(j+1,sum) if sum+A[j] <= 2000: solve(j+1,sum+A[j]) n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) ans=[0]*2001 solve(0,0) m=int(input()) B=list(input().split()) for i in range(m): B[i]=int(B[i]) for i in range(m): if ans[B[i]]==1: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmplcus39qi/tmpoez_pi6v.py", line 10, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s766084197
p02271
u165447384
1527520888
Python
Python3
py
Runtime Error
0
0
487
def solve(j,sum): print j, sum if j==n-1: ans[sum] = 1 if sum+A[j] <= 2000: ans[sum+A[j]] = 1 solve(j+1,sum) if sum+A[j] <= 2000: solve(j+1,sum+A[j]) n=int(input()) A=[]*n A=list(input().split()) for i in range(n): A[i]=int(A[i]) ans=[0]*2001 solve(0,0) m=int(input()) B=list(input().split()) for i in range(m): B[i]=int(B[i]) for i in range(m): if ans[B[i]]==1: print("yes") else: print("no")
File "/tmp/tmppc8w3xy0/tmput2204ez.py", line 2 print j, sum ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s520974890
p02271
u826549974
1527522378
Python
Python3
py
Runtime Error
11870
5612
431
def solve(i,m,n,A): if(m == 0): return 1 elif(i >= n): return 0 res1 = solve(i+1,m,n,A) res2 = solve(i+1,m-A[i],n,A) if(res1 == 1 or res2 == 1): return 1 else: return 0 n = int(input()) A = list(map(int,input().split())) q = int(input()) M = list(map(int,input().split())) for i in range(q): if(solve(0,M[i],n,A)): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpwq6gbb_h/tmpp3iwymmr.py", line 16, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s941736955
p02271
u826549974
1527522523
Python
Python3
py
Runtime Error
15050
5616
348
def solve(i,m,n,A): if(m == 0): return 1 elif(i >= n): return 0 return max(solve(i+1,m,n,A),solve(i+1,m-A[i],n,A)) n = int(input()) A = list(map(int,input().split())) q = int(input()) M = list(map(int,input().split())) for i in range(q): if(solve(0,M[i],n,A)): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp62n4d9_h/tmpwaph6b68.py", line 10, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s313189254
p02271
u165447384
1527558777
Python
Python3
py
Runtime Error
9120
5612
444
n = int(input()) A = list(input().split()) for i in range(n): A[i] = int(A[i]) m = int(input()) B = list(input().split()) for i in range(m): B[i] = int(B[i]) def solve(x,y): if y<0: return False elif y==0: return True elif x==n: return False else: return solve(x+1,y) or solve(x+1,y-A[x]) for i in range(m): if solve(0,B[i]): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp1um7szcz/tmpxnjeicmd.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s894048403
p02271
u165447384
1527559172
Python
Python3
py
Runtime Error
0
0
434
n = int(input()) A = list(input().split()) for i in range(n): A[i] = int(A[i]) m = int(input()) B = list(input().split()) for i in range(m): B[i] = int(B[i]) def solve(x,y): if x==n: S[y] = 1 else: solve(x+1,y) if y+A[x] < 2001: solve(x+1,y+A[x] S = [0]*2001 solve(0,0) for i in range(m): if S[B[i]] == 1: print("yes") else: print("no")
File "/tmp/tmppa5h_llr/tmpgyd_dmz8.py", line 16 solve(x+1,y+A[x] ^ SyntaxError: '(' was never closed
s381702926
p02271
u165447384
1527559215
Python
Python3
py
Runtime Error
0
0
451
n = int(input()) A = list(input().split()) for i in range(n): A[i] = int(A[i]) m = int(input()) B = list(input().split()) for i in range(m): B[i] = int(B[i]) def solve(x,y): if x==n: S[y] = 1 else: solve(x+1,y) if y+A[x] < 2001: solve(x+1,y+A[x] S = [0 for i in range(2001)] solve(0,0) for i in range(m): if S[B[i]] == 1: print("yes") else: print("no")
File "/tmp/tmpew6fkpwa/tmpcm278zml.py", line 16 solve(x+1,y+A[x] ^ SyntaxError: '(' was never closed
s651573128
p02271
u165447384
1527561981
Python
Python3
py
Runtime Error
9470
5612
381
n = int(input()) A = list(map(int,input().split())) m = int(input()) B = list(map(int,input().split())) def solve(x,y): if y<0: return False elif y==0: return True elif x==n: return False else: return solve(x+1,y) or solve(x+1,y-A[x]) for i in range(m): if solve(0,B[i]): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp3i93dx08/tmpxc3yu1cc.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s505532515
p02271
u165447384
1527562347
Python
Python3
py
Runtime Error
8170
5632
710
n = int(input()) A = list(map(int,input().split())) m = int(input()) B = list(map(int,input().split())) def solve2(x,y): if x==n: S[y] = 1 else: solve2(x+1,y) if y+A[x] < 2001: solve2(x+1,y+A[x]) S = [0 for i in range(2001)] solve2(0,0) def solve(x,y): if y<0: return False elif y==0: return True elif x==n: return False else: return solve(x+1,y) or solve(x+1,y-A[x]) for i in range(m): if (i>80 and (S[B[i]] == 1)): print("yes") elif (i>80 and (S[B[i]] == 0)): print("no") else: if solve(0,B[i]): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpp0zldhm6/tmpdzr3ggcf.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s986683226
p02271
u055885332
1527575593
Python
Python3
py
Runtime Error
0
0
331
n=int (input()) A=list(map(int,input().split())) q=int (input()) m=list(map(int,input().split())) box=[] for i in range(2**n): b = '{0:0{1}b}'.format(i,n) tmp=[] for j in rangee(n): if b[j]=='1': if b[j]=='1': tmp.append(A[j]) sum_list.append(box(tmp)) for k in m: if k in box: print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpb7w3km3g/tmpscutm2n_.py", line 1, in <module> n=int (input()) ^^^^^^^ EOFError: EOF when reading a line
s301948881
p02271
u165447384
1527578090
Python
Python3
py
Runtime Error
0
0
420
n = int(input()) A = list(map(int,input().split())) m = int(input()) B = list(map(int,input().split())) T = [[0]*2001 for i in range(n)] T[0][0] = 1 T[0][A[0]] = 1 for i in range(1:n): for j in range(2001): T[i][j] = T[i-1][j] if (j - B[i] >=0) and (T[i-1][j-B[i]] == 1): T[i][j] = 1 for i in range(m): if T[n-1][B[i]] == 1: print("yes") else: print("no")
File "/tmp/tmpwth8guqp/tmp3d9ulbc4.py", line 10 for i in range(1:n): ^ SyntaxError: invalid syntax
s990367634
p02271
u810922275
1527588459
Python
Python3
py
Runtime Error
0
0
384
import numpy as np def rec(x,y): x.sort() for i in range(len(x)): if x[i]>y: return "no" for j in range(len(x)): if i!=j: if x[i]+x[j]==y: return "yes" n=int(input()) A=list(map(int,input().split(' '))) p=int(input()) m=list(map(int,input().split(' '))) for i in range(len(m)): print(rec(A,m[i])
File "/tmp/tmp5expjv82/tmp51d0i388.py", line 16 print(rec(A,m[i]) ^ SyntaxError: '(' was never closed
s244889579
p02271
u684241248
1527589393
Python
Python3
py
Runtime Error
8670
5616
437
n = int(input()) ary = [int(_) for _ in input().split()] q = int(input()) qs = [int(_) for _ in input().split()] def search(ary, s, q): if not ary: return False else: tmp = ary[0] if s + tmp == q: return True else: return search(ary[1:], s, q) or search(ary[1:], s + tmp, q) for q in qs: if search(ary, 0, q): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpb_xlxj2a/tmp6ts620su.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s525052591
p02271
u684241248
1527589540
Python
Python3
py
Runtime Error
8870
5620
480
import sys sys.setrecursionlimit(2 ** 20) n = int(input()) ary = [int(_) for _ in input().split()] q = int(input()) qs = [int(_) for _ in input().split()] def search(ary, s, q): if not ary: return False else: tmp = ary[0] if s + tmp == q: return True else: return search(ary[1:], s, q) or search(ary[1:], s + tmp, q) for q in qs: if search(ary, 0, q): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmp1eeiv0js/tmpzp402rby.py", line 4, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s912077493
p02271
u684241248
1527589890
Python
Python3
py
Runtime Error
8070
5616
438
n = int(input()) ary = [int(_) for _ in input().split()] q = int(input()) qs = [int(_) for _ in input().split()] def search(ind, s, q): if ind == n: return False else: tmp = ary[ind] if s + tmp == q: return True else: return search(ind + 1, s, q) or search(ind + 1, s + tmp, q) for q in qs: if search(0, 0, q): print('yes') else: print('no')
Traceback (most recent call last): File "/tmp/tmpfv4t_ftd/tmpnkse9tx2.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s402521505
p02271
u398978447
1527599319
Python
Python3
py
Runtime Error
7730
5616
458
class ES: def solve(self, A, M): for m in M: if self.search(0, m): print("yes") else: print("no") def search(self, i, m): if m == 0: return True elif i >= n: return False return self.search(i + 1, m) or self.search(i + 1, m - A[i]) if __name__ == '__main__': n = int(input()) A = [int(i) for i in input().rstrip().split(" ")] q = int(input()) M = [int(i) for i in input().rstrip().split(" ")] x = ES() x.solve(A, M)
Traceback (most recent call last): File "/tmp/tmptvo7fvgi/tmpeh6f_sxw.py", line 19, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s297880846
p02271
u573915636
1527600144
Python
Python3
py
Runtime Error
0
0
321
def solve(i,m): if m==0: return true elif i>=n: return false else: res=any(solve(i+1,m),solve(i+1,m-a[i])) return res n=int(input()) a=input().split() q=int(input()) m=input().split() for j in range(n): a[j]=int(a[j]) for i in range(q): m[i]=int(m[i]) if solve(i,m[i]): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp_5j39hsi/tmp8g_w4uux.py", line 10, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s643084821
p02271
u165447384
1527646479
Python
Python3
py
Runtime Error
8770
5612
348
n = int(input()) A = list(map(int,input().split())) m = int(input()) B = list(map(int,input().split())) def solve(x,y): if y<0: return False elif y==0: return True elif x==n: return False else: return solve(x+1,y) or solve(x+1,y-A[x]) for i in range(m): if solve(0,B[i]): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmp_xhjr0x6/tmp7z21h_g6.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s930976135
p02271
u165447384
1527646534
Python
Python3
py
Runtime Error
8690
5608
348
n = int(input()) A = list(map(int,input().split())) m = int(input()) B = list(map(int,input().split())) def solve(x,y): if y<0: return False elif y==0: return True elif x==n: return False else: return solve(x+1,y-A[x]) or solve(x+1,y) for i in range(m): if solve(0,B[i]): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpq4773m58/tmpgjcx6b61.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s387956466
p02271
u165447384
1527646647
Python
Python3
py
Runtime Error
9110
5612
360
n = int(input()) A = list(map(int,input().split())) m = int(input()) B = list(map(int,input().split())) def solve(x,y): if y<0: return False elif y==0: return True elif x==n: return False elif solve(x+1,y-A[x]): return True else: return solve(x+1,y) for i in range(m): if solve(0,B[i]): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpa4kajvyn/tmptob17d9a.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s226586095
p02271
u165447384
1527646690
Python
Python3
py
Runtime Error
8860
5608
360
n = int(input()) A = list(map(int,input().split())) m = int(input()) B = list(map(int,input().split())) def solve(x,y): if y<0: return False elif y==0: return True elif x==n: return False elif solve(x+1,y-A[x]): return True else: return solve(x+1,y) for i in range(m): if solve(0,B[i]): print("yes") else: print("no")
Traceback (most recent call last): File "/tmp/tmpnqxh5rkm/tmpvfrgkl6e.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s641143176
p02271
u404682284
1527913029
Python
Python3
py
Runtime Error
8220
5612
349
n = int(input()) A = [int(i) for i in input().split()] input() M = [int(i) for i in input().split()] def solve(i, m): if m == 0: res = True elif i >= n: res = False else: 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')
Traceback (most recent call last): File "/tmp/tmp0mggkdzg/tmpmarnwmjs.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s244912962
p02271
u404682284
1527913423
Python
Python3
py
Runtime Error
7930
5616
335
n = int(input()) A = [int(i) for i in input().split()] input() M = [int(i) for i in 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')
Traceback (most recent call last): File "/tmp/tmphkkimz8v/tmpco5abbv6.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s550733725
p02271
u404682284
1527914174
Python
Python3
py
Runtime Error
8380
5616
344
n = int(input()) A = [int(i) for i in input().split()] input() M = [int(i) for i in input().split()] def solve(i, m): if m == 0: return True if i >= n or m < 0: 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')
Traceback (most recent call last): File "/tmp/tmp9odf95an/tmpy8q2gsc9.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s816910248
p02271
u007270338
1527968184
Python
Python3
py
Runtime Error
13460
22224
437
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) def solve(i, num): if num == 0: global sw sw = 1 return 1 if i >= n or num < 0: return "" return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmpn3_a86sw/tmppih_abta.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s617844474
p02271
u007270338
1527968804
Python
Python3
py
Runtime Error
13520
22228
438
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) def solve(i, num): if num == 0: global sw sw = 1 return 1 if i >= n or num < 0: return "" return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmpoptbyq3q/tmpw5m_n71e.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s664117379
p02271
u007270338
1527968955
Python
Python3
py
Runtime Error
14080
22228
428
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) def solve(i, num): if num == 0: global sw sw = 1 return if i >= n or num < 0: return return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") else: print("yes")
Traceback (most recent call last): File "/tmp/tmpm0b8ibim/tmp9xg6ddxw.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s780399114
p02271
u007270338
1527969048
Python
Python3
py
Runtime Error
13740
22228
434
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) def solve(i, num): if num == 0: global sw sw = 1 return if i >= n or num < 0: return return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmp5a08exey/tmpt5ngbr7f.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s090556696
p02271
u007270338
1527969407
Python
Python3
py
Runtime Error
3690
7660
468
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) def solve(i, num): num = int(num) i = int(i) if num == 0: global sw sw = 1 return 0 if i >= n or num < 0: return 0 return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmpucrihd8z/tmp5_h9rsox.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s606925227
p02271
u007270338
1527969469
Python
Python3
py
Runtime Error
13450
22224
434
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) def solve(i, num): if num == 0: global sw sw = 1 return 0 if i >= n or num < 0: return 0 return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmpw3ybsqga/tmpb_n_5993.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s410044624
p02271
u007270338
1527970108
Python
Python3
py
Runtime Error
0
0
458
#coding:utf-8 import numpy as np n = int(input()) A = np.array(map(int, input().split())) q = int(input()) m = np.array(map(int, input().split())) def solve(i, num): if num == 0: global sw sw = 1 return 0 if i >= n or num < 0: return 0 return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmp07qbd87l/tmpta2fojyi.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s715158630
p02271
u007270338
1527998918
Python
Python3
py
Runtime Error
12690
22220
460
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) def solve(i, num): global sw if sw == 1: return 1 if num == 0: sw = 1 return 0 if i >= n or num < 0: return 0 return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmpwt_s2r7t/tmp0turiqhp.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s669498827
p02271
u007270338
1527999980
Python
Python3
py
Runtime Error
14430
22216
509
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) def solve(i, num): global sw if sw == 1: return 1 if num == 0: sw = 1 return 0 if i >= n or num < 0: return 0 if num < A[i]: return solve(i+1,num) return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmpztyf_5mb/tmpngva9zd3.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s613154360
p02271
u007270338
1528000099
Python
Python3
py
Runtime Error
12750
22220
460
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) m = list(map(int, input().split())) def solve(i, num): global sw if sw == 1: return 1 if num == 0: sw = 1 return 0 if i >= n or num < 0: return 0 return solve(i+1, num), solve(i+1, num-A[i]) for num in m: i = 0 sw = 0 solve(i,num) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmptdkdlepj/tmp46ux7po1.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s773607726
p02271
u007270338
1528008293
Python
Python3
py
Runtime Error
16490
22208
563
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) imList = [] def solve(i, m): global sw if sw == 1: return 0 elif m == 0: sw = 1 return 1 elif [i,m] in imList: print("NN") imList.append([i,m]) return 0 elif m < 0 or i >= n: return 0 else: return solve(i+1, m), solve(i+1, m-A[i]) for m in M: i = 0 sw = 0 solve(i,m) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmplcglsmzs/tmpasz6u8se.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s545313906
p02271
u007270338
1528012336
Python
Python3
py
Runtime Error
4680
5812
581
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) def solve(i, m): global sw if sw == 1: return 0 if m == 0: sw = 1 return 1 if m < 0: return 0 if [i,m] in imList: return 0 else: imList.append([i,m]) if i >= n: return 0 else: return solve(i+1, m), solve(i+1, m-A[i]) for m in M: i = 0 sw = 0 imList = [] solve(i,m) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmp20wcsqon/tmpp7wxfj_y.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s003438998
p02271
u007270338
1528012481
Python
Python3
py
Runtime Error
12920
22220
493
#coding:utf-8 n = int(input()) A = list(map(int, input().split())) q = int(input()) M = list(map(int, input().split())) def solve(i, m): global sw if sw == 1: return 0 if m == 0: sw = 1 return 1 if m < 0: return 0 if i >= n: return 0 else: return solve(i+1, m), solve(i+1, m-A[i]) for m in M: i = 0 sw = 0 imList = [] solve(i,m) if sw == 0: print("no") if sw == 1: print("yes")
Traceback (most recent call last): File "/tmp/tmp4c79r968/tmpehbwn7l4.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s992400677
p02271
u007270338
1528024931
Python
Python3
py
Runtime Error
0
0
916
#coding:utf-8 import numpy as np import math pi = math.pi cos = math.cos sin = math.sin n = int(input()) if n == 0: n = int(input()) A, B = np.array([0,0]), np.array([100,0]) def inc(A, B): AB = B - A rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]]) convertedAB = np.dot(rot, AB) normAB = np.linalg.norm(AB) D = AB / 2 + (3**(1/2)/6) * convertedAB return D def koch(A, B, i): AB = B - A if i >= n: return 1 C = A + AB/3 koch(A,C,i+1) print(" ".join([str(num) for num in C])) D = inc(A, B) koch(C,D,i+1) print(" ".join([str(num) for num in D])) E = A + 2*AB/3 koch(D,E,i+1) print(" ".join([str(num) for num in E])) koch(E,B,i+1) koch(A, C, i+1),koch(C, D, i+1), koch(D, E, i+1), koch(E,B,i+1) print(" ".join([str(float(num)) for num in A])) i = 0 koch(A,B,i) print(" ".join([str(float(num)) for num in B]))
Traceback (most recent call last): File "/tmp/tmpijcbstdl/tmpzi6xvc21.py", line 7, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s733781592
p02271
u256748051
1528540798
Python
Python
py
Runtime Error
4610
4656
301
n = int(input()) arr = map(int,raw_input().split()) m = int(input()) arr_m = map(int,raw_input().split()) def rec(m,i,s): if s == m: return True elif i >= n: return False else : return rec(m,i+1,s) or rec(m,i+1,s+arr[i]) for i in range(m): print 'yes' if rec(arr_m[i],0,0) else 'no'
File "/tmp/tmpmxv2293t/tmpe7lz7px7.py", line 21 print 'yes' if rec(arr_m[i],0,0) else 'no' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?