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
s256085065
p00036
u350508326
1373503432
Python
Python
py
Runtime Error
0
0
1560
while True: try: a = [[0 for j in range(8)]for i in range(8)] for i in range(8): a[i] = list(map(int,raw_input())) f = 0 for i in range(8): if f == 1: f = 0 break for j in range(8): if a[i][j] == 1: if a[i][j+1] == 1: if a[i][j+2] == 1: print "C" f = 1 break elif a[i+1][j] == 1: if a[i+1][j+1] == 1: print "A" f = 1 break if a[i+1][j-1] == 1: print "G" f = 1 break else: print "E" f = 1 break elif a[i+1][j] == 1: if a[i+2][j] == 1: print "B" f = 1 break elif a[i+1][j+1] == 1: print "F" f = 1 break else: print "D" f = 1 break except EOFError: break
File "/tmp/tmpfrftkpwy/tmppn9dr1ud.py", line 22 print "C" ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s417957742
p00036
u350508326
1373503678
Python
Python
py
Runtime Error
0
0
1923
while True: try: a = [[0 for j in range(8)]for i in range(8)] for i in range(8): a[i] = list(map(int,raw_input())) f = 0 i = 0 j = 0 for i in range(8): if f == 1: f = 0 break for j in range(8): if a[i][j] == 1: if a[i][j+1] == 1: if a[i][j+2] == 1: print "C" f = 1 break elif a[i+1][j] == 1: if a[i+1][j+1] == 1: print "A" f = 1 break if a[i+1][j-1] == 1: print "G" f = 1 break else: print "E" f = 1 break elif a[i+1][j] == 1: if a[i+2][j] == 1: print "B" f = 1 break elif a[i+1][j+1] == 1: print "F" f = 1 break else: print "D" f = 1 break except EOFError: break ~
File "/tmp/tmpcm5c3jfg/tmpqh5v5bs4.py", line 25 print "C" ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s813506232
p00036
u350508326
1373503703
Python
Python
py
Runtime Error
0
0
1902
while True: try: a = [[0 for j in range(8)]for i in range(8)] for i in range(8): a[i] = list(map(int,raw_input())) f = 0 i = 0 j = 0 for i in range(8): if f == 1: f = 0 break for j in range(8): if a[i][j] == 1: if a[i][j+1] == 1: if a[i][j+2] == 1: print "C" f = 1 break elif a[i+1][j] == 1: if a[i+1][j+1] == 1: print "A" f = 1 break if a[i+1][j-1] == 1: print "G" f = 1 break else: print "E" f = 1 break elif a[i+1][j] == 1: if a[i+2][j] == 1: print "B" f = 1 break elif a[i+1][j+1] == 1: print "F" f = 1 break else: print "D" f = 1 break except EOFError: break
File "/tmp/tmptk59tdor/tmp2i82kbrz.py", line 25 print "C" ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s161170414
p00036
u350508326
1373504036
Python
Python
py
Runtime Error
0
0
2015
while True: try: a = [[0 for j in range(8)]for i in range(8)] for i in range(8): a[i] = list(map(int,raw_input())) f = 0 for i in range(8): if f == 1: f = 0 break for j in range(8): if a[i][j] == 1: if a[i][j+1] == 1: if a[i][j+2] == 1: print "C" f = 1 break elif a[i+1][j] == 1: if a[i+1][j+1] == 1: print "A" f = 1 break # if a[i+1][j-1] == 1: # print "G" # f = 1 # break else: print "G" f = 1 break else: print "E" f = 1 break elif a[i+1][j] == 1: if a[i+2][j] == 1: print "B" f = 1 break elif a[i+1][j+1] == 1: print "F" f = 1 break else: print "D" f = 1 break except EOFError: break
File "/tmp/tmpfxma2cn0/tmpnqaw2y4c.py", line 22 print "C" ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s949269055
p00036
u350508326
1373504121
Python
Python
py
Runtime Error
0
0
2055
while True: try: a = [[0 for k in range(8)]for m in range(8)] for i in range(8): a[i] = list(map(int,raw_input())) f = 0 for i in range(8): if f == 1: f = 0 break for j in range(8): if a[i][j] == 1: if a[i][j+1] == 1: if a[i][j+2] == 1: print "C" f = 1 break elif a[i+1][j] == 1: if a[i+1][j+1] == 1: print "A" f = 1 break # if a[i+1][j-1] == 1: # print "G" # f = 1 # break else: print "G" f = 1 break else: print "E" f = 1 break elif a[i+1][j] == 1: if a[i+2][j] == 1: print "B" f = 1 break elif a[i+1][j+1] == 1: print "F" f = 1 break else: print "D" f = 1 break except EOFError: break
File "/tmp/tmp7wqxqrvh/tmpedr9c6m0.py", line 22 print "C" ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s347239599
p00036
u523886269
1384105263
Python
Python
py
Runtime Error
0
0
1635
# -*- coding: utf8 -*- import sys types = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] def main(): while True: try: data = [] for i in xrange(8): data.append(raw_input()) check_figure(data) # 空行 raw_input() except EOFError: break def check_figure(data): # 最初の1を探す for i in xrange(8): for j in xrange(8): if data[i][j] == "1": for t in types: if check_pattern(data, pattern(t, i, j)): print t return return def pattern(p, i, j): if p == 'A': return [(i, j), (i, j + 1), (i + 1, j), (i + 1, j + 1)] elif p == 'B': return [(i, j), (i + 1, j), (i + 2, j), (i + 3, j)] elif p == 'C': return [(i, j), (i, j + 1), (i, j + 2), (i, j + 3)] elif p == 'D': return [(i, j), (i + 1, j - 1), (i + 1, j), (i + 2, j - 1)] elif p == 'E': return [(i, j), (i, j + 1), (i + 1, j + 1), (i + 1, j + 2)] elif p == 'F': return [(i, j), (i + 1, j), (i + 1, j + 1), (i + 2, j + 1)] elif p == 'G': return [(i, j), (i, j + 1), (i + 1, j - 1), (i + 1, j)] else: return None def check_pattern(data, block): for p in block: oob = is_out_of_bounds(p[0], p[1]) empty = (data[p[0]][p[1]] == '0') if oob or empty: return False return True def is_out_of_bounds(x, y): if x < 0 or x >= 8 or y < 0 or y >= 8: return True else: return False main()
File "/tmp/tmpdtx57df7/tmpesa556et.py", line 31 print t ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s455139244
p00036
u633068244
1393579207
Python
Python
py
Runtime Error
0
0
489
while True: try: h = 0 for i in range(10): tmp = raw_input() if sum(int(tmp)) != 0: a[h] = tmp h += 1 if h == 4: print "B" elif h == 1: print "C" elif h == 2: c = int(a[0])/int(a[1]) if c == 1: print "A" elif c == 10: print "E" elif c == 0: print "G" else: c = int(a[0])/int(a[2]) if c == 10: print "F" else: print "D"
File "/tmp/tmp16kbhk_n/tmpj7dfiks6.py", line 3 h = 0 TabError: inconsistent use of tabs and spaces in indentation
s387990267
p00036
u633068244
1393579288
Python
Python
py
Runtime Error
0
0
483
while True: try: h = 0 for i in range(8): tmp = raw_input() if int(tmp) != 0: a[h] = tmp h += 1 if h == 4: print "B" elif h == 1: print "C" elif h == 2: c = int(a[0])/int(a[1]) if c == 1: print "A" elif c == 10: print "E" elif c == 0: print "G" else: c = int(a[0])/int(a[2]) if c == 10: print "F" else: print "D"
File "/tmp/tmp11u8kbb1/tmpt89ek7fz.py", line 3 h = 0 TabError: inconsistent use of tabs and spaces in indentation
s113291386
p00036
u633068244
1393580127
Python
Python
py
Runtime Error
0
0
598
while True: try: h = 0 for i in range(8): tmp = raw_input() if tmp.count(1) = 0: a[h] = tmp h += 1 if h == 1: print "C" elif h == 2: c = a[0].index(1) - a[1].index(1) if c == 0: print "A" elif c == -1: print "E" else: print "G" elif h == 3: c = a[0].index(1) - a[2].index(1) print "D" if c == 1 else "F" else: print "B" except: break
File "/tmp/tmpi1xlsssg/tmplzevcad4.py", line 6 if tmp.count(1) = 0: ^^^^^^^^^^^^ SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
s453207064
p00036
u633068244
1393580168
Python
Python
py
Runtime Error
0
0
594
while True: try: h = 0 for i in range(8): tmp = raw_input() if int(tmp) = 0: a[h] = tmp h += 1 if h == 1: print "C" elif h == 2: c = a[0].index(1) - a[1].index(1) if c == 0: print "A" elif c == -1: print "E" else: print "G" elif h == 3: c = a[0].index(1) - a[2].index(1) print "D" if c == 1 else "F" else: print "B" except: break
File "/tmp/tmp_etpmqc8/tmp4w0i1u9d.py", line 6 if int(tmp) = 0: ^^^^^^^^ SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
s358855845
p00036
u633068244
1393580203
Python
Python
py
Runtime Error
0
0
602
while True: try: h = 0 for i in range(8): tmp = raw_input() if int(tmp) = 0: a[h] = tmp h += 1 if h == 1: print "C" elif h == 2: c = a[0].index("1") - a[1].index("1") if c == 0: print "A" elif c == -1: print "E" else: print "G" elif h == 3: c = a[0].index("1") - a[2].index("1") print "D" if c == 1 else "F" else: print "B" except: break
File "/tmp/tmpqx06lz9k/tmp9s5qfmk4.py", line 6 if int(tmp) = 0: ^^^^^^^^ SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
s181362311
p00036
u633068244
1393581690
Python
Python
py
Runtime Error
0
0
625
while True: try: h = 0 a=["","","",""] for i in range(8): tmp = raw_input() if int(tmp) != 0: a[h] = tmp h += 1 if h == 1: print "C" elif h == 2: c = a[0].index("1") - a[1].index("1") if c == 0: print "A" elif c == -1: print "E" else: print "G" elif h == 3: c = a[0].index("1") - a[2].index("1") print "D" if c == 1 else "F" else: print "B" raw_input() except: break
File "/tmp/tmp2wt_68u0/tmp6auvmscl.py", line 8 a[h] = tmp ^ IndentationError: expected an indented block after 'if' statement on line 7
s051159019
p00036
u912237403
1394326659
Python
Python
py
Runtime Error
0
0
338
import sys N = 8 ptn = [18,48,6,30,20,34,16] def f(D): i = 0 s = 0 D = D[D.index("1"):] for c in D: if c=="1": s += i i += 1 p = "ABCDEF"[ptn.index(s)] return p i=0 D="" for s in sys.stdin: if i<8: D+=s[1:] i+=1 else: print f(D) D="" i=0 print f(D)
File "/tmp/tmpcnn4usp3/tmppno6tly3.py", line 21 print f(D) ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s211112690
p00036
u912237403
1394326724
Python
Python
py
Runtime Error
0
0
339
import sys N = 8 ptn = [18,48,6,30,20,34,16] def f(D): i = 0 s = 0 D = D[D.index("1"):] for c in D: if c=="1": s += i i += 1 p = "ABCDEF"[ptn.index(s)] return p i=0 D="" for s in sys.stdin: if i<8: D+=s[:-1] i+=1 else: print f(D) i=0 D="" print f(D)
File "/tmp/tmpie5bluwv/tmpxuugapm8.py", line 21 print f(D) ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s842358150
p00036
u912237403
1394326938
Python
Python
py
Runtime Error
0
0
349
import sys N = 8 ptn = [18,48,6,30,20,34,16] def f(D): i = 0 s = 0 D = D[D.index("1"):] for c in D: if c=="1": s += i i += 1 p = "ABCDEF"[ptn.index(s)] return p i=0 D="" for s in sys.stdin: if i<8: D+=s[:-1] i+=1 else: print f(D) i=0 D="" if D!="": print f(D)
File "/tmp/tmp8epdqnzd/tmp6aubpo3j.py", line 21 print f(D) ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s518350197
p00036
u912237403
1394339068
Python
Python
py
Runtime Error
0
0
306
import sys ptn = [18,48,6,30,20,34,16] def f(D): i = 0 s = 0 D = D[D.index("1"):] for c in D: if c=="1": s += i i += 1 p = "ABCDEF"[ptn.index(s)] return p i=0 D="" for s in sys.stdin: i+=1 D+=s[:-1] if i==8: print f(D) i=0 D=""
File "/tmp/tmpcr6ewob0/tmp55qf_ce2.py", line 20 print f(D) ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s533967410
p00036
u912237403
1394339580
Python
Python
py
Runtime Error
0
0
294
def f(D): i = 0 s = 0 D = D[D.index("1"):] for c in D: if c=="1": s += i i += 1 p = "ABCDEF"[ptn.index(s)] return p i=0 D="" for s in sys.stdin: if i<8: i+=1 D+=s[:-1] else: print f(D) i=0 D="" print f(D)
File "/tmp/tmprq1acsib/tmppqd8uzfw.py", line 18 print f(D) ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s988470077
p00036
u912237403
1394340532
Python
Python
py
Runtime Error
0
0
295
def f(D): i = 0 s = 0 D = D[D.index("1"):] for c in D: if c=="1": s += i i += 1 p = "ABCDEFG"[ptn.index(s)] return p i=0 D="" for s in sys.stdin: if i<8: i+=1 D+=s[:-1] else: print f(D) i=0 D="" print f(D)
File "/tmp/tmpyt4gts2q/tmpuvla91uu.py", line 18 print f(D) ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s807652175
p00037
u873482706
1434774812
Python
Python
py
Runtime Error
0
0
2874
import sys def xxx(position, direction): if direction == 'R' or direction == 'L': if not (0 <= position[tate] <= 8 and 0 <= position[yoko] <= 3): return elif direction == 'U' or direction == 'D': if not (1 <= position[tate] <= 7 and 0 <= position[yoko] <= 4): return if (position[tate] == 0 and position[yoko] == 0) and direction == 'L' or \ (position[tate] == 1 and position[yoko] == 0) and direction == 'U': result.append(direction) print_result() if mapp[position[tate]][position[yoko]] == 1: result.append(direction) kyoto(position, direction) elif mapp[position[tate]][position[yoko]] == 0: return def kyoto(position, direction): if direction == 'R': #????????????????´¢ check_position = position[tate], position[yoko]+1 direction = 'R' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]-1, position[yoko]+1 direction = 'U' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]+1, position[yoko]+1 direction = 'D' xxx(check_position, direction) elif direction == 'U': #????????????????´¢ check_position = position[tate]-2, position[yoko] direction = 'U' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]-1, position[yoko]-1 direction = 'L' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]-1, position[yoko] direction = 'R' xxx(check_position, direction) elif direction == 'L': #????????????????´¢ check_position = position[tate], position[yoko]-1 direction = 'L' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]+1, position[yoko] direction = 'D' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]-1, position[yoko] direction = 'U' xxx(check_position, direction) elif direction == 'D': #????????????????´¢ check_position = position[tate]+2, position[yoko] direction = 'D' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]+1, position[yoko] direction = 'R' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]+1, position[yoko]-1 direction = 'L' xxx(check_position, direction) def print_result(): print ''.join(result) sys.exit() mapp = [] for i in range(9): mapp.append([int(char) for char in raw_input()]) tate = 0 yoko = 1 result = [] xxx((0,0), 'R')
File "/tmp/tmpokkfix5g/tmp_yv63a66.py", line 75 print ''.join(result) ^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s999878550
p00037
u873482706
1434777537
Python
Python
py
Runtime Error
0
0
3470
import sys def xxx(position, direction): if direction == 'R' or direction == 'L': if not (0 <= position[tate] <= 8 and 0 <= position[yoko] <= 3): return elif direction == 'U' or direction == 'D': if not (1 <= position[tate] <= 7 and 0 <= position[yoko] <= 4): return if (position[tate] == 0 and position[yoko] == 0) and direction == 'L' or \ (position[tate] == 1 and position[yoko] == 0) and direction == 'U': result.append(direction) print_result() if mapp[position[tate]][position[yoko]] == 1: result.append(direction) kyoto(position, direction) elif mapp[position[tate]][position[yoko]] == 0: return def kyoto(position, direction): if direction == 'R': #????????????????´¢ check_position = position[tate]-1, position[yoko]+1 direction = 'U' xxx(check_position, direction) #????????????????´¢ check_position = position[tate], position[yoko]+1 direction = 'R' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]+1, position[yoko]+1 direction = 'D' xxx(check_position, direction) #????????????????´¢ check_position = position[tate], position[yoko] direction = 'L' xxx(check_position, direction) elif direction == 'U': #????????????????´¢ check_position = position[tate]-1, position[yoko]-1 direction = 'L' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]-2, position[yoko] direction = 'U' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]-1, position[yoko] direction = 'R' xxx(check_position, direction) #????????????????´¢ check_position = position[tate], position[yoko] direction = 'D' xxx(check_position, direction) elif direction == 'L': #????????????????´¢ check_position = position[tate]+1, position[yoko] direction = 'D' xxx(check_position, direction) #????????????????´¢ check_position = position[tate], position[yoko]-1 direction = 'L' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]-1, position[yoko] direction = 'U' xxx(check_position, direction) #????????????????´¢ check_position = position[tate], position[yoko] direction = 'R' xxx(check_position, direction) elif direction == 'D': #????????????????´¢ check_position = position[tate]+1, position[yoko] direction = 'R' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]+2, position[yoko] direction = 'D' xxx(check_position, direction) #????????????????´¢ check_position = position[tate]+1, position[yoko]-1 direction = 'L' xxx(check_position, direction) #????????????????´¢ check_position = position[tate], position[yoko] direction = 'U' xxx(check_position, direction) def print_result(): print ''.join(result) sys.exit() mapp = [] for i in range(9): mapp.append([int(char) for char in raw_input()]) tate = 0 yoko = 1 result = [] xxx((0,0), 'R')
File "/tmp/tmp9nd1dw_8/tmp05gtb2ih.py", line 91 print ''.join(result) ^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s350714342
p00037
u873482706
1435293327
Python
Python
py
Runtime Error
0
0
3800
def xxx(position, direction): if direction == 'R' or direction == 'L': if not (0 <= position[tate] <= 8 and 0 <= position[yoko] <= 3): return elif direction == 'U' or direction == 'D': if not (1 <= position[tate] <= 7 and 0 <= position[yoko] <= 4): return if (position[tate] == 0 and position[yoko] == 0) and direction == 'L' or \ (position[tate] == 1 and position[yoko] == 0) and direction == 'U': result.append(direction) print ''.join(result) return True if mapp[position[tate]][position[yoko]] == 1: result.append(direction) if kyoto(position, direction): return True elif mapp[position[tate]][position[yoko]] == 0: return def kyoto(position, direction): if direction == 'R': #????????????????´¢ check_position = position[tate]-1, position[yoko]+1 direction = 'U' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate], position[yoko]+1 direction = 'R' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate]+1, position[yoko]+1 direction = 'D' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate], position[yoko] direction = 'L' if xxx(check_position, direction): return True elif direction == 'U': #????????????????´¢ check_position = position[tate]-1, position[yoko]-1 direction = 'L' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate]-2, position[yoko] direction = 'U' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate]-1, position[yoko] direction = 'R' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate], position[yoko] direction = 'D' if xxx(check_position, direction): return True elif direction == 'L': #????????????????´¢ check_position = position[tate]+1, position[yoko] direction = 'D' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate], position[yoko]-1 direction = 'L' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate]-1, position[yoko] direction = 'U' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate], position[yoko] direction = 'R' if xxx(check_position, direction): return True elif direction == 'D': #????????????????´¢ check_position = position[tate]+1, position[yoko] direction = 'R' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate]+2, position[yoko] direction = 'D' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate]+1, position[yoko]-1 direction = 'L' if xxx(check_position, direction): return True #????????????????´¢ check_position = position[tate], position[yoko] direction = 'U' if xxx(check_position, direction): return True while True: try: mapp = [] for i in range(9): mapp.append([int(char) for char in raw_input()]) tate = 0 yoko = 1 result = [] xxx((0,0), 'R') except EOFError: break
File "/tmp/tmpv0gmo122/tmpp8pn1kav.py", line 11 print ''.join(result) ^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s308970999
p00037
u419407022
1362161694
Python
Python
py
Runtime Error
0
0
762
dist = ['R','D','L','U'] dict = [(1,0),(0,1),(-1,0),(0,-1)] result = '' sell = [[False]*13]*2 for i in xrange(9): l = [False,False] s = raw_input() if len(s) == 4: for j in s: l.append(False) l.append(bool(int(j))) l += [False] * 3 else: for j in s: l.append(bool(int(j))) l.append(False) l += [False] * 2 sell.append(l) sell += [[False]*13]*2 my = (2,2,0) while(True): if sell[my[0]+dict[my[2]][0],my[1]+dict[my[2]][1]]: my = (my[0]+dict[my[2]][0]*2,my[1]+dict[my[2]][1]*2,my[2]) if my[0] == 2 and my[1] == 2: break else: result += dist[my[2]] else: my = (my[0],my[1],(my[2]+1)%4) print result
File "/tmp/tmp5gw0quil/tmpzzujkxap.py", line 34 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s846098170
p00037
u542421762
1368332660
Python
Python
py
Runtime Error
0
0
4450
import sys class Grid: def __init__(self, lines): lines = map((lambda line: list(line)), lines) l = [] for i in range(len(lines)): if i % 2 == 0: l.append(intersperse2(lines[i], '+')) else: l.append(intersperse(lines[i], 'x')) l.insert(0, ['0','x','0','x','0','x','0','x','0']) l.append(['0','x','0','x','0','x','0','x','0']) l = map(lambda x: self._outer(x), l) self.grid = l def show(self): for l in self.grid: print l return self def _outer(self, lis): if lis[0] == '0' or lis[0] == '1': lis.insert(0, 'x') else: lis.insert(0, '0') if lis[-1] == '0' or lis[-1] == '1': lis.append('x') else: lis.append('0') return lis class Walker: def __init__(self, grid, x, y): self.grid = grid self.x = x self.y = y self.dir = 'R' def walk(self): if self.left() == '1': return self.to_left() elif self.ahead() == '1': return self.to_ahead() elif self.right() == '1': return self.to_right() else: return self.to_back() def left(self): x = self.x y = self.y d = self.dir if d == 'R': return self.grid.grid[y-1][x] elif d == 'L': return self.grid.grid[y+1][x] elif d == 'U': return self.grid.grid[y][x-1] else: # d == 'D' return self.grid.grid[y][x+1] def ahead(self): x = self.x y = self.y d = self.dir if d == 'R': return self.grid.grid[y][x+1] elif d == 'L': return self.grid.grid[y][x-1] elif d == 'U': return self.grid.grid[y-1][x] else: # d == 'D' return self.grid.grid[y+1][x] def right(self): x = self.x y = self.y d = self.dir if d == 'R': return self.grid.grid[y+1][x] elif d == 'L': return self.grid.grid[y-1][x] elif d == 'U': return self.grid.grid[y][x+1] else: # d == 'D' return self.grid.grid[y][x-1] def to_left(self): d = self.dir if d == 'R': self.y -= 2 self.dir = 'U' return 'U' elif d == 'L': self.y += 2 self.dir = 'D' return 'D' elif d == 'U': self.x -= 2 self.dir = 'L' return 'L' else: # d == 'D' self.x += 2 self.dir = 'R' return 'R' def to_ahead(self): d = self.dir if d == 'R': self.x += 2 return 'R' elif d == 'L': self.x -= 2 return 'L' elif d == 'U': self.y -= 2 return 'U' else: # d == 'D' self.y += 2 return 'D' def to_right(self): d = self.dir if d == 'R': self.y += 2 self.dir = 'D' return 'D' elif d == 'L': self.y -= 2 self.dir = 'U' return 'U' elif d == 'U': self.x += 2 self.dir = 'R' return 'R' else: # d == 'D' self.x -= 2 self.dir = 'L' return 'L' def to_backt(self): d = self.dir if d == 'R': self.x -= 2 self.dir = 'L' return 'L' elif d == 'L': self.x += 2 self.dir = 'R' return 'R' elif d == 'U': self.y -= 2 self.dir = 'D' return 'D' else: # d == 'D' self.y += 2 self.dir = 'U' return 'U' def intersperse(lis, s): r = [] for a in lis: r.append(a) r.append(s) r.pop() return r def intersperse2(lis, s): r = [] for a in lis: r.append(s) r.append(a) r.append(s) return r lines = sys.stdin.readlines() lines = map(lambda x: x.rstrip("\r\n"), lines) grid = Grid(lines) #grid.show() walker = Walker(grid, 1, 1) path = [] while True: path.append(walker.walk()) if (walker.x, walker.y) == (1,1): break print ''.join(path)
File "/tmp/tmpunq22jma/tmpyi9y00b9.py", line 21 print l ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s379496821
p00038
u379956761
1443343090
Python
Python3
py
Runtime Error
0
0
1299
import sys def is_onepair(x): for i in range(4): if x.count(x[i]) == 2: return True return False def is_twopair(x): count = 0 for e in x: for e2 in x: if e == e2: count += 1 if count == 2: return True return False def is_threecard(x): for i in range(3): if x.count(x[i]) == 3: return True return False def is_straight(x): x.sort() if x[0] == 1 and x[1:] = [10, 11, 12, 13]: return True for i in range(4): if x[i]+1 != x[i+1]: return False return True def is_fullhouse(x): if is_threecard(x) and is_onepair(x): return True return False def is_fourcard(x): for i in range(2): if x.count(x[i]) == 4: return True return False for line in sys.stdin.readlines(): hand = list(map(int, line.split(','))) if is_fourcard(hand): print("four card") elif is_fullhouse(hand): print("full house") elif is_straight(hand): print("straight") elif is_threecard(hand): print("three card") elif is_twopair(hand): print("two pair") elif is_onepair(hand): print("one pair") else: print("null")
File "/tmp/tmpz3euxe4i/tmpu2dnqoco.py", line 30 if x[0] == 1 and x[1:] = [10, 11, 12, 13]: ^ SyntaxError: invalid syntax
s299062267
p00038
u300946041
1469324474
Python
Python3
py
Runtime Error
0
0
1069
# -*- coding: utf-8 -*- def is_four_card(d): return 4 in d.values() def is_full_house(d): return 3 in d.values() and 2 in d.values() def is_straight(d): flag = [False, 0] for i in d.values(): if flag[0] == True and flag[1] == 5: return True if i == 1: flag[0] = True flag[1] += 1 return False def is_three_card(d): return 3 in d.values() def is_two_pair(d): return list(d.values()).count(2) == 2 def is_one_pair(d): return list(d.values()).count(2) == 1 def judge(d): if is_four_card(d): print('four card') elif is_full_house(d): print('full house') elif is_straight(d): print('straight') elif is_three_card(d): print('three card') elif is_two_pair(d): print('two pair') elif is_one_pair(d): print('one pair') else: print('null') def solve(cards): d = {k: 0 for k in range(1, 14)} for card in cards: d[card] += 1 judge(d) _input = input().split(",") solve(_input)
Traceback (most recent call last): File "/tmp/tmph1oh4zmx/tmpjtajz4rq.py", line 59, in <module> _input = input().split(",") ^^^^^^^ EOFError: EOF when reading a line
s333543319
p00038
u150984829
1518109953
Python
Python3
py
Runtime Error
0
0
220
import sys for e in sys.stdin: e=sorted(map(int,e.split(','))) print([['null','straight'][e[4]-e[0]==4 or e[0]*10==e[1]],'one pair','two pair','three card','full house',0,'four card'][(sum(e.count(s)for s in e)//2-2])
File "/tmp/tmpz_kxp4t5/tmpoignpysc.py", line 4 print([['null','straight'][e[4]-e[0]==4 or e[0]*10==e[1]],'one pair','two pair','three card','full house',0,'four card'][(sum(e.count(s)for s in e)//2-2]) ^ SyntaxError: closing parenthesis ']' does not match opening parenthesis '('
s691871498
p00038
u633068244
1393482727
Python
Python
py
Runtime Error
0
0
776
while True: try: hand = sorted(map(int, raw_input().split(","))) kind = len(set(hand)) ma = max([hand.count(i) for i in hand]) if kind == 4: print "one pair" elif kind == 3: if ma == 2: print "two pair" else: print "three card" elif kind == 2: if ma==4: print "four card" else: print "full house" else: if hand==[1,10,11,12,13] or hand[4] - hand[0] == 4: print "straight" else: print "null" except: break
File "/tmp/tmp_g9cegi2/tmppf0shqv5.py", line 7 print "one pair" ^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s222485071
p00039
u873482706
1435044834
Python
Python
py
Runtime Error
0
0
1010
def brain(l): c = l[1] - l[0] if 0 < c: result.append(c) del lis[0] del lis[0] else: lis.append(l[0]) del lis[0] def cisco(l): for i in range(len(l)): if l[i] == 'I': l[i] = 1 elif l[i] == 'V': l[i] = 5 elif l[i] == 'X': l[i] = 10 elif l[i] == 'L': l[i] = 50 elif l[i] == 'C': l[i] = 100 elif l[i] == 'D': l[i] = 500 elif l[i] == 'M': l[i] = 1000 return l while True: result = [] try: lis = list(raw_input())+['*'] while lis: if not (lis[0] == '*' or lis[1] == '*'): l = cisco([lis[0], lis[1]]) brain(l) else: lis.append(lis[0]) del lis[0] del lis[0] break result.append(sum(cisco(lis))) print sum(result) except EOFError: break
File "/tmp/tmplgrdg003/tmp7zm1vri8.py", line 43 print sum(result) ^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s569736704
p00039
u379956761
1443357528
Python
Python3
py
Runtime Error
0
0
1060
import sys def dec_num(x): for i in range(len(x)): if x[i] == 2: x[i] = 5 elif x[i] == 3: x[i] = 10 elif x[i] == 4: x[i] = 50 elif x[i] == 5: x[i] = 100 elif x[i] == 6: x[i] = 500 elif x[i] == 7: x[i] = 1000 def to_index(x): if x == 1: return 1 elif x == 5: return 2 elif x == 10: return 3 elif x == 50: return 4 elif x == 100: return 5 elif x == 500: return 6 elif x == 1000: return 7 def toNum(x): result = 0 tmp = x[0] for i in range(len(x)): if tmp < x[i]: result += x[i]-tmp elif i <= len(x) and x[i] < x[i+1]: result += 0 else: result += x[i] tmp = x[i] return result for line in sys.stdin.readlines(): line = line.translate(str.maketrans('IVXLCDM', '1234567')) num = list(map(int, (' '.join(line)).split())) dec_num(num) print(toNum(num))
s089445379
p00039
u148101999
1460005555
Python
Python
py
Runtime Error
0
0
1532
#encoding=utf-8 import sys def inp(): for line in sys.stdin: word = line.split() je(word[0]) def je(word): ans, i = 0, 0 while True: print word[i], ans if word[i] == "M": ans += 1000 elif word[i] == "D": ans += 500 elif word[i] == "C": ans += 100 try: if word[i + 1] == "D": ans += 300 i += 1 elif word[i + 1] == "M": ans += 800 i += 1 except:pass elif word[i] == "L": ans += 50 try: if word[i - 1] == "X": ans -= 10 i += 1 except: pass elif word[i] == "X": ans += 10 try: if word[i + 1] == "I" and word[i + 2] == "X": ans += 9 i += 2 elif word[i + 1] == "C": ans += 80 i += 1 except: pass elif word[i] == "V": ans += 5 elif word[i] == "I": ans += 1 try: if word[i + 1] == "V": ans += 4 i += 1 if word[i + 1] == "X": ans += 8 i += 1 except: pass i += 1 if i == len(word): print ans break if __name__ == "__main__": inp()
File "/tmp/tmp3coh9n06/tmpvruhwaxp.py", line 12 print word[i], ans ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s882159880
p00039
u148101999
1460005815
Python
Python
py
Runtime Error
0
0
1489
import sys def inp(): for line in sys.stdin: word = line.split() je(word[0]) def je(word): ans, i = 0, 0 while True: if word[i] == "M": ans += 1000 elif word[i] == "D": ans += 500 elif word[i] == "C": ans += 100 try: if word[i + 1] == "D": ans += 300 i += 1 elif word[i + 1] == "M": ans += 800 i += 1 except:pass elif word[i] == "L": ans += 50 try: if word[i - 1] == "X": ans -= 10 i += 1 except: pass elif word[i] == "X": ans += 10 try: if word[i + 1] == "I" and word[i + 2] == "X": ans += 9 i += 2 elif word[i + 1] == "C": ans += 80 i += 1 except: pass elif word[i] == "V": ans += 5 elif word[i] == "I": ans += 1 try: if word[i + 1] == "V": ans += 4 i += 1 if word[i + 1] == "X": ans += 8 i += 1 except: pass i += 1 if i == len(word): print ans break if __name__ == "__main__": inp()
File "/tmp/tmp31bx8ab8/tmpww8bq59l.py", line 57 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s056456436
p00039
u661290476
1482918560
Python
Python3
py
Runtime Error
0
0
309
nums={"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000} while True: try: s=input() except: break ans=nums[s[0]] for i in range(len(s)): if num[s[i-1]]<num[s[i]]: ans+=num[s[i]]-2*num[s[i-1]] else: ans+=num[s[i]] print(ans)
s062840968
p00039
u661290476
1482918592
Python
Python3
py
Runtime Error
0
0
311
nums={"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000} while True: try: s=input() except: break ans=nums[s[0]] for i in range(1,len(s)): if num[s[i-1]]<num[s[i]]: ans+=num[s[i]]-2*num[s[i-1]] else: ans+=num[s[i]] print(ans)
s655399782
p00039
u633068244
1393417348
Python
Python
py
Runtime Error
0
0
457
dict = {"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000} while True: try: roman = raw_input() sum = 0 value = 1000 for i in range(len(roman)): if value >= dict[roman[i]]: value = dict[roman[i]] sum += value elif: sum -= 2*value value = dict[roman[i]] sum += value print sum except: break
File "/tmp/tmpq7a8e8_g/tmp8xc9tp6b.py", line 12 elif: ^ SyntaxError: invalid syntax
s500265614
p00039
u436634575
1401187238
Python
Python3
py
Runtime Error
0
0
315
import sys C = [ 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] N = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] def checkio(data, i = 0): return C[i]*(data // N[i]) + checkio(data % N[i], i + 1) if data else '' for line in sys.stdin: n = int(line) print(checkio(n))
s487629725
p00040
u567380442
1423296374
Python
Python3
py
Runtime Error
0
0
1208
import sys f = sys.stdin import string OFFSET = ord('a') def to_gamma(c): return ord(c) - OFFSET def from_gamma(gamma, alpha, beta): return chr((alpha * gamma + beta) % 26 + OFFSET) def affine(c, alpha, beta): return from_gamma(to_gamma(c), alpha, beta) # g[0]==g[3]である前提 def search_that(w): b = to_gamma(w[2]) for a in range(26): if w[0] == affine('t',a,b) and w[1] == affine('h',a,b): return a, b return -1, -1 def search_this(g): a = (to_gamma(w[0]) - to_gamma(w[3]) + 26) % 26 for b in range(26): if w[0] == affine('t',a,b) and w[1] == affine('h',a,b) and w[2] == affine('i',a,b) and w[3] == affine('s',a,b): return a, b return -1, -1 def search(w): if w[0] == w[3]: return search_that(w) else: return search_this(w) n = int(f.readline()) for i in range(n): line = f.readline().strip() words = [word for word in line.split() if len(word) == 4] for word in words: a, b = search(word) if a != -1: print(line.translate(str.maketrans(''.join([affine(c, a, b) for c in string.ascii_lowercase]), string.ascii_lowercase))) break
Traceback (most recent call last): File "/tmp/tmpbkhwmnl7/tmp6de_5ast.py", line 40, in <module> n = int(f.readline()) ^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s047334270
p00040
u879226672
1429803556
Python
Python
py
Runtime Error
0
0
1207
def affine_cipher(word,alpha,beta): newword = '' for c in word: newword += w[(alpha*dic[c]+beta)%26] return newword def find_quad_word(sentence): r = [] for word in sentence: if len(word)==4: r.append(word) return r def get_alpha_and_beta(quad_word): '''return alpha,beta''' alpha_list = [i for i in range(26) if 26%i !=0] beta_list = [i for i in range(26)] for alpha in alpha_list: for beta in beta_list: tmp = affine_cipher(quad_word,alpha,beta) if tmp=='that' or tmp == 'this': return alpha,beta else: pass def main(): for i in range(int(raw_input())): s = raw_input().split() quad_word_list = find_quad_word(s) for quad_word in quad_word_list: if get_alpha_and_beta(quad_word) is not None: alpha,beta = get_alpha_and_beta(quad_word) new_sentence=[] for word in s: new_sentence.append(affine_cipher(word,alpha,beta)) print ' '.join(new_sentence) import string w = string.ascii_lowercase dic={} for n,ch in enumerate(w): dic[ch]=n main()
File "/tmp/tmps3g78ehy/tmpdlklcnm9.py", line 37 print ' '.join(new_sentence) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s147883287
p00040
u901080241
1491712141
Python
Python3
py
Runtime Error
0
0
577
from math import gcd def unzip(strlist,a,b): ret = [] for word in strlist: tmp = "" for i in range(len(word)): tmp += chr(((ord(word[i])-97)*a+b)%26+97) ret.append(tmp) return ret n = int(input()) for _ in range(n): instr = input().split() for a in range(1,26): if gcd(1,26)!=1 : continue for b in range(26): if "this" in unzip(instr, a, b): print(" ".join(unzip(instr, a, b))) elif "that" in unzip(instr, a, b): print(" ".join(unzip(instr, a, b)))
Traceback (most recent call last): File "/tmp/tmpwtfrjz4t/tmp0uuf663m.py", line 11, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s169719439
p00040
u282635979
1363844680
Python
Python
py
Runtime Error
0
0
2104
list_a = [0,1,3,5,7,9,11,13,15,17,19,21,23] num_al = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k',11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s',19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'} n = input() + 1 for val in range(1,n): num_a = 0 num_b = 0 sentence = raw_input() words = [] for val in sentence: words.append(val) words_num = [] for val in words: if val == 'a': words_num.append(0) elif val == 'b': words_num.append(1) elif val == 'c': words_num.append(2) elif val == 'd': words_num.append(3) elif val == 'e': words_num.append(4) elif val == 'f': words_num.append(5) elif val == 'g': words_num.append(6) elif val == 'h': words_num.append(7) elif val == 'i': words_num.append(8) elif val == 'j': words_num.append(9) elif val == 'k': words_num.append(10) elif val == 'l': words_num.append(11) elif val == 'm': words_num.append(12) elif val == 'n': words_num.append(13) elif val == 'o': words_num.append(14) elif val == 'p': words_num.append(15) elif val == 'q': words_num.append(16) elif val == 'r': words_num.append(17) elif val == 's': words_num.append(18) elif val == 't': words_num.append(19) elif val == 'u': words_num.append(20) elif val == 'v': words_num.append(21) elif val == 'w': words_num.append(22) elif val == 'x': words_num.append(23) elif val == 'y': words_num.append(24) elif val == 'z': words_num.append(25) else: words_num.append(' ') sentence_num = '' for val in words_num: sentence_num += str(val) words_trans = [] sentence_trans = '' while True: for val in words_num: if val == ' ': words_trans.append(' ') else: words_trans.append(num_al[(list_a[num_a] * val + num_b) % 26]) for val in words_trans: sentence_trans += str(val) if 'this' in sentence_trans: break elif 'that' in sentence_trans: break else: words_trans = [] sentence_trans = '' if num_b != 25: num_b += 1 else: num_b = 0 num_a += 1 continue print sentence_trans
File "/tmp/tmp0oqer57i/tmpveys593d.py", line 94 print sentence_trans ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s012105230
p00040
u282635979
1363845387
Python
Python
py
Runtime Error
0
0
2101
list_a = [0,1,3,5,7,9,11,13,15,17,19,21,23] num_al = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k',11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s',19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'} n = input() + 1 for val in range(1,n): num_a = 0 num_b = 0 sentence = raw_input() words = [] for val in sentence: words.append(val) words_num = [] for val in words: if val == 'a': words_num.append(0) elif val == 'b': words_num.append(1) elif val == 'c': words_num.append(2) elif val == 'd': words_num.append(3) elif val == 'e': words_num.append(4) elif val == 'f': words_num.append(5) elif val == 'g': words_num.append(6) elif val == 'h': words_num.append(7) elif val == 'i': words_num.append(8) elif val == 'j': words_num.append(9) elif val == 'k': words_num.append(10) elif val == 'l': words_num.append(11) elif val == 'm': words_num.append(12) elif val == 'n': words_num.append(13) elif val == 'o': words_num.append(14) elif val == 'p': words_num.append(15) elif val == 'q': words_num.append(16) elif val == 'r': words_num.append(17) elif val == 's': words_num.append(18) elif val == 't': words_num.append(19) elif val == 'u': words_num.append(20) elif val == 'v': words_num.append(21) elif val == 'w': words_num.append(22) elif val == 'x': words_num.append(23) elif val == 'y': words_num.append(24) elif val == 'z': words_num.append(25) else: words_num.append(' ') sentence_num = '' for val in words_num: sentence_num += str(val) words_trans = [] sentence_trans = '' while True: for val in words_num: if val == ' ': words_trans.append(' ') else: words_trans.append(num_al[(list_a[num_a] * val + num_b) % 26]) for val in words_trans: sentence_trans += str(val) if 'this' in sentence_trans: break elif 'that' in sentence_trans: break else: words_trans = [] sentence_trans = '' if num_b != 25: num_b += 1 else: num_b = 0 num_a += 1 continue print sentence_trans
File "/tmp/tmp0g509o7p/tmpz1cncnbu.py", line 93 print sentence_trans ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s772791615
p00040
u282635979
1363846241
Python
Python
py
Runtime Error
0
0
2101
list_a = [0,1,3,5,7,9,11,13,15,17,19,21,23] num_al = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k',11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s',19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'} n = input() + 1 for val in range(1,n): num_a = 0 num_b = 0 sentence = raw_input() words = [] for val in sentence: words.append(val) words_num = [] for val in words: if val == 'a': words_num.append(0) elif val == 'b': words_num.append(1) elif val == 'c': words_num.append(2) elif val == 'd': words_num.append(3) elif val == 'e': words_num.append(4) elif val == 'f': words_num.append(5) elif val == 'g': words_num.append(6) elif val == 'h': words_num.append(7) elif val == 'i': words_num.append(8) elif val == 'j': words_num.append(9) elif val == 'k': words_num.append(10) elif val == 'l': words_num.append(11) elif val == 'm': words_num.append(12) elif val == 'n': words_num.append(13) elif val == 'o': words_num.append(14) elif val == 'p': words_num.append(15) elif val == 'q': words_num.append(16) elif val == 'r': words_num.append(17) elif val == 's': words_num.append(18) elif val == 't': words_num.append(19) elif val == 'u': words_num.append(20) elif val == 'v': words_num.append(21) elif val == 'w': words_num.append(22) elif val == 'x': words_num.append(23) elif val == 'y': words_num.append(24) elif val == 'z': words_num.append(25) else: words_num.append(' ') sentence_num = '' for val in words_num: sentence_num += str(val) words_trans = [] sentence_trans = '' while True: for val in words_num: if val == ' ': words_trans.append(' ') else: words_trans.append(num_al[(list_a[num_a] * val + num_b) % 26]) for val in words_trans: sentence_trans += str(val) if 'this' in sentence_trans: break elif 'that' in sentence_trans: break else: words_trans = [] sentence_trans = '' if num_b != 25: num_b += 1 else: num_b = 0 num_a += 1 continue print sentence_trans
File "/tmp/tmphse9ut4r/tmp1ocljcx0.py", line 93 print sentence_trans ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s556325882
p00040
u282635979
1363847578
Python
Python
py
Runtime Error
0
0
2101
list_a = [0,1,3,5,7,9,11,13,15,17,19,21,23] num_al = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k',11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s',19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'} n = input() + 1 for val in range(1,n): num_a = 0 num_b = 0 sentence = raw_input() words = [] for val in sentence: words.append(val) words_num = [] for val in words: if val == 'a': words_num.append(0) elif val == 'b': words_num.append(1) elif val == 'c': words_num.append(2) elif val == 'd': words_num.append(3) elif val == 'e': words_num.append(4) elif val == 'f': words_num.append(5) elif val == 'g': words_num.append(6) elif val == 'h': words_num.append(7) elif val == 'i': words_num.append(8) elif val == 'j': words_num.append(9) elif val == 'k': words_num.append(10) elif val == 'l': words_num.append(11) elif val == 'm': words_num.append(12) elif val == 'n': words_num.append(13) elif val == 'o': words_num.append(14) elif val == 'p': words_num.append(15) elif val == 'q': words_num.append(16) elif val == 'r': words_num.append(17) elif val == 's': words_num.append(18) elif val == 't': words_num.append(19) elif val == 'u': words_num.append(20) elif val == 'v': words_num.append(21) elif val == 'w': words_num.append(22) elif val == 'x': words_num.append(23) elif val == 'y': words_num.append(24) elif val == 'z': words_num.append(25) else: words_num.append(' ') sentence_num = '' for val in words_num: sentence_num += str(val) words_trans = [] sentence_trans = '' while True: for val in words_num: if val == ' ': words_trans.append(' ') else: words_trans.append(num_al[(list_a[num_a] * val + num_b) % 26]) for val in words_trans: sentence_trans += str(val) if 'this' in sentence_trans: break elif 'that' in sentence_trans: break else: words_trans = [] sentence_trans = '' if num_b != 26: num_b += 1 else: num_b = 0 num_a += 1 continue print sentence_trans
File "/tmp/tmpun3r6qk8/tmpj7poc0hi.py", line 93 print sentence_trans ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s856868510
p00040
u282635979
1363848178
Python
Python
py
Runtime Error
0
0
2103
list_a = [0,1,3,5,7,9,11,13,15,17,19,21,23] num_al = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k',11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s',19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'} n = input() + 1 for val in range(1,n): num_a = 0 num_b = 0 sentence = raw_input() words = [] for val in sentence: words.append(val) words_num = [] for val in words: if val == 'a': words_num.append(0) elif val == 'b': words_num.append(1) elif val == 'c': words_num.append(2) elif val == 'd': words_num.append(3) elif val == 'e': words_num.append(4) elif val == 'f': words_num.append(5) elif val == 'g': words_num.append(6) elif val == 'h': words_num.append(7) elif val == 'i': words_num.append(8) elif val == 'j': words_num.append(9) elif val == 'k': words_num.append(10) elif val == 'l': words_num.append(11) elif val == 'm': words_num.append(12) elif val == 'n': words_num.append(13) elif val == 'o': words_num.append(14) elif val == 'p': words_num.append(15) elif val == 'q': words_num.append(16) elif val == 'r': words_num.append(17) elif val == 's': words_num.append(18) elif val == 't': words_num.append(19) elif val == 'u': words_num.append(20) elif val == 'v': words_num.append(21) elif val == 'w': words_num.append(22) elif val == 'x': words_num.append(23) elif val == 'y': words_num.append(24) elif val == 'z': words_num.append(25) else: words_num.append(' ') sentence_num = '' for val in words_num: sentence_num += str(val) words_trans = [] sentence_trans = '' while True: for val in words_num: if val == ' ': words_trans.append(' ') else: words_trans.append(num_al[(list_a[num_a+1] * val + num_b) % 26]) for val in words_trans: sentence_trans += str(val) if 'this' in sentence_trans: break elif 'that' in sentence_trans: break else: words_trans = [] sentence_trans = '' if num_b != 25: num_b += 1 else: num_b = 0 num_a += 1 continue print sentence_trans
File "/tmp/tmpy7p3vrgj/tmp0t30wmfl.py", line 93 print sentence_trans ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s467529826
p00040
u782850731
1375514702
Python
Python
py
Runtime Error
0
0
1121
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import (division, absolute_import, print_function, unicode_literals) from sys import stdin from string import ascii_lowercase from itertools import count def gcd(m, n): m, n = sorted([m, n]) while n: m, n = n, m % n return m def encode(char, A, B): return chr(((A * (ord(char) - 97) + B) % 26) + 97) def solve(words): for a in (i for i in count(0) if gcd(i, 26) == 1): for b in range(26): for word in words: that = ''.join(encode(c, a, b) for c in 'that') if word == that: return (a, b) this = ''.join(encode(c, a, b) for c in 'this') if word == this: return (a, b) def main(): for _ in range(int(stdin.readline())): line = stdin.readline() a, b = solve([s for s in line.split() if len(s) == 4]) d = {encode(c, a, b): c for c in ascii_lowercase} d[b' '] = b' ' print(''.join(d[c] for c in line)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmp1g44xo72/tmp8qu49n6y.py", line 39, in <module> main() File "/tmp/tmp1g44xo72/tmp8qu49n6y.py", line 31, in main for _ in range(int(stdin.readline())): ^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s516363661
p00040
u912237403
1387579507
Python
Python
py
Runtime Error
0
0
799
A2Z="abcdefghijklmnopqrstuvwxyz" def decode(L1,L2,msg): x=[] for c in msg: if 'a'<=c<='z': c = L2[L1.index(c)] x.append(c) return "".join(x) def affine(msg, key): a,b = key L = [A2Z[(i*a+b)%26] for i in range(26)] L = "".join(L) return decode(A2Z,L,msg) def rot(msg, a): if a==0: return msg a = a % 26 L = A2Z[a:]+A2Z[:a] return decode(A2Z,L,msg) def find(msg): c0=ord('t') for i in range(3,26,2): x = affine(msg,[i,0]) a = (c0-ord(x[0]))%26 x = rot(x,a) if x in['this','that']: return [i,a] n = input() for i in range(n): msg = raw_input() for w in msg.split(): if len(w)==4: key = find(w) if key!=[]: break print affine(msg,key)
File "/tmp/tmpj3ehznx8/tmpo062llal.py", line 38 print affine(msg,key) ^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s426287584
p00040
u912237403
1387579575
Python
Python
py
Runtime Error
0
0
813
A2Z="abcdefghijklmnopqrstuvwxyz" def decode(L1,L2,msg): x=[] for c in msg: if 'a'<=c<='z': c = L2[L1.index(c)] x.append(c) return "".join(x) def affine(msg, key): a,b = key L = [A2Z[(i*a+b)%26] for i in range(26)] L = "".join(L) return decode(A2Z,L,msg) def rot(msg, a): if a==0: return msg a = a % 26 L = A2Z[a:]+A2Z[:a] return decode(A2Z,L,msg) def find(msg): c0=ord('t') for i in range(3,26,2): x = affine(msg,[i,0]) a = (c0-ord(x[0]))%26 x = rot(x,a) if x in['this','that']: return [i,a] return [] n = input() for i in range(n): msg = raw_input() for w in msg.split(): if len(w)==4: key = find(w) if key!=[]: break print affine(msg,key)
File "/tmp/tmpucdmouqk/tmpbot6ic72.py", line 39 print affine(msg,key) ^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s196103674
p00040
u633068244
1393662328
Python
Python
py
Runtime Error
0
0
884
dict = ["a","b","c","d","e","f","g","h","i","j","k","l","m",\ "n","o","p","q","r","s","t","u","v","w","x","y","z"] lsalpha = [1,3,5,7,9,11,15,17,19,21,23,25] def deaffine(alpha, beta, code): decode = "" for chara in code: if chara != " ": f = dict.index(chara) for i in range(26): if (alpha*i + beta)%26 == f: dechara = dict[i] break decode += dechara else: decode += " " return decode n = int(raw_input()) for roop in range(n): code = raw_input() for alpha in lsalpha: flag = 0 for beta in range(26): deaffine(alpha, beta, code) if decode.count("that") > 0 or decode.count("this") > 0: flag = 1 break if flag == 1: break print decode
File "/tmp/tmprf14a4j5/tmp_pe5qj6d.py", line 31 print decode ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s621346679
p00041
u329400409
1453031113
Python
Python3
py
Runtime Error
0
0
710
import itertools def calc(n): for op in itertools.product(operators, repeat=3): for form in forms: formula = form.format(op[0], op[1], op[2], n[0], n[1], n[2], n[3]) if eval(formula) == 10: print(formula) return True return False operators = ("+", "-", "*") forms = ( "(({3}{0}{4}){1}{5}){2}{6}", "({3}{0}{4}){1}({5}{2}{6})", "({3}{0}({4}{1}{5})){2}{6}", "{3}{0}(({4}{1}{5}){2}{6})", "{3}{0}({4}{1}({5}{2}{6}))", ) while (True): nums = tuple(map(int, raw_input().split())) if nums == (0,0,0,0): break for n in itertools.permutations(nums): if calc(n): break else: print(0)
Traceback (most recent call last): File "/tmp/tmphtw17wws/tmpu9n46r9u.py", line 23, in <module> nums = tuple(map(int, raw_input().split())) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s375801768
p00041
u329400409
1453031318
Python
Python3
py
Runtime Error
0
0
710
import itertools def calc(n): for op in itertools.product(operators, repeat=3): for form in forms: formula = form.format(op[0], op[1], op[2], n[0], n[1], n[2], n[3]) if eval(formula) == 10: print(formula) return True return False operators = ("+", "-", "*") forms = ( "(({3}{0}{4}){1}{5}){2}{6}", "({3}{0}{4}){1}({5}{2}{6})", "({3}{0}({4}{1}{5})){2}{6}", "{3}{0}(({4}{1}{5}){2}{6})", "{3}{0}({4}{1}({5}{2}{6}))", ) while (True): nums = tuple(map(int, raw_input().split())) if nums == (0,0,0,0): break for n in itertools.permutations(nums): if calc(n): break else: print(0)
Traceback (most recent call last): File "/tmp/tmpjha3lohb/tmps1ab5hyv.py", line 23, in <module> nums = tuple(map(int, raw_input().split())) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s742968238
p00041
u150984829
1518720835
Python
Python3
py
Runtime Error
0
0
386
import itertools def f(a): if len(a)<2:yield(a[0],a[0]) for i in range(1,len(a)): for p,s in f(a[:i]): for q,t in f(a[i:]): yield(p+q,f'({s}+{t})') yield(p-q,f'({s}-{t})') yield(p*q,f'({s}*{t})') def s(a): for p in itertools.permutations(a): for n,s in f(p): if n==10:print(s);return 1 while 1: a=list(map(int,input().split())) if sum(a)and not s(a):print(0)
Traceback (most recent call last): File "/tmp/tmp4412wzd7/tmp_smi3kvu.py", line 15, in <module> a=list(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s423825963
p00041
u150984829
1518721842
Python
Python3
py
Runtime Error
0
0
402
import itertools,sys def f(a): if len(a)<2:yield[a[0]]*2 for i in range(1,len(a)): for p,s in f(a[:i]): for q,t in f(a[i:]): yield(p+q,f'({s} + {t})') yield(p-q,f'({s} - {t})') yield(p*q,f'({s} * {t})') def s(a): for p in itertools.permutations(a): for n,s in f(p): if n==10:print(s);return 1 for e in iter(input,'0 0 0 0\n'): a=list(map(int,e.split())) if not s(a):print(0)
Traceback (most recent call last): File "/tmp/tmpxqhrqtr2/tmpcyy7034b.py", line 14, in <module> for e in iter(input,'0 0 0 0\n'): EOFError: EOF when reading a line
s955181896
p00041
u150984829
1518724665
Python
Python3
py
Runtime Error
0
0
412
from itertools import * def f(s): for t in[f"({a} {x} {b}) {y} ({c} {z} {d})",f"(({a} {x} {b}) {y} {c}) {z} {d}",f"{a} {x} ({b} {y} ({c} {z} {d}))",f"({a} {x} ({b} {y} {c})) {z} {d}",f"{a} {x} (({b} {y} {c}) {z} {d})"]: for a,b,c,d in permutations(s): for x,y,z in product('+-*',repeat=3): if eval(t)==10:return'('+t+')' else:return 0 for e in iter(input,'0 0 0 0'):print(f(list(map(int,e.split()))))
Traceback (most recent call last): File "/tmp/tmpiadep8b9/tmpk73k2is4.py", line 8, in <module> for e in iter(input,'0 0 0 0'):print(f(list(map(int,e.split())))) EOFError: EOF when reading a line
s541356293
p00041
u150984829
1518725349
Python
Python3
py
Runtime Error
0
0
436
from itertools import * def f(s): for t in["({a} {x} {b}) {y} ({c} {z} {d})","(({a} {x} {b}) {y} {c}) {z} {d}","{a} {x} ({b} {y} ({c} {z} {d}))","({a} {x} ({b} {y} {c})) {z} {d}","{a} {x} (({b} {y} {c}) {z} {d})"]: for a,b,c,d in permutations(s): for x,y,z in product('+-*',repeat=3): t='f"'+t+'"' if eval(eval(t))==10:return'('+eval(t)+')' else:return 0 for e in iter(input,'0 0 0 0'):print(f(list(map(int,e.split()))))
Traceback (most recent call last): File "/tmp/tmpujji__cb/tmp9zgw0sjx.py", line 9, in <module> for e in iter(input,'0 0 0 0'):print(f(list(map(int,e.split())))) EOFError: EOF when reading a line
s622880502
p00041
u749355444
1381421508
Python
Python
py
Runtime Error
0
0
402
from itertools import * def find(X): for a,b,c,d in permutations(X): for x,y,z in product("+-*",repeat=3): for f in ("(((%s%s%s)%s%s)%s%s)","(%s%s%s)%s(%s%s%s)"): t = f%(a,x,b,y,c,z,d) if eval(t)==10: return t return 0 while True: X = map(int,raw_input().split()) if X==(0,0,0,0): break print find(X)
File "/tmp/tmp3f_bo96h/tmp62yqj3i6.py", line 16 print find(X) ^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s561914327
p00041
u912237403
1387688999
Python
Python
py
Runtime Error
0
0
1356
def op(x,y,i): if i==0: return x+y elif i==1: return x-y elif i==2: return x*y def check(x, n): a1,a2,a3,a4 = x[0],x[1],x[2],x[3] s='+-*' for i1 in range(3): a1 = op(x[0],x[1],i1) for i2 in range(3): a2 = op(a1,x[2],i2) for i3 in range(3): a3 = op(a2,x[3],i3) if a3==n: b1,b2,b3 = s[i1],s[i2],s[i3] s0 = '((({0} {1} {2}) {3} {4}) {5} {6})' eq = s0.format(x[0],b1,x[1],b2,x[2],b3,x[3]) return eq a2 = op(x[2],x[3],i2) for i3 in range(3): a3 = op(a1,a2,i3) if a3==n: b1,b2,b3 = s[i1],s[i3],s[i2] s0 = '((({0} {1} {2}) {3} ({4} {5} {6}))' eq = s0.format(x[0],b1,x[1],b2,x[2],b3,x[3]) return eq return '' def permutations(L): if L == []: return [[]] else: return [[h]+t for i,h in enumerate(L) for t in permutations(L[:i]+L[i+1:])] n=10 op='+-*' while True: x = map(int,raw_input().split()) if x==[0,0,0,0]:break x = permutations(x) for e in x: s = check(e,n) if s!='': print s break else: print ('0')
File "/tmp/tmpzy63xu5s/tmp0718zji2.py", line 49 print s ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s545869569
p00041
u633068244
1394277906
Python
Python
py
Runtime Error
0
0
668
ex = ["+", "-", "*"] while True: a, b, c, d = map(int, raw_input().split()) if a == 0 and c == 0: break for i in ex: for j in ex: for k in ex: if eval( (((a k b) j c) i d)) == 10: print "(((",a,k,b,")",j,c,")",i,d,")" flag = 1 break if flag == 1: break for i in ex: for j in ex: for k in ex: if eval( ((a k b) i (c j d)) ) == 10: print "((",a,k,b,")",i,"(",c,j,d,"))" flag = 1 break if flag = 1: break else: print 0
File "/tmp/tmpb8al87j1/tmpe2fxjwzo.py", line 9 if eval( (((a k b) j c) i d)) == 10: ^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?
s157799306
p00041
u633068244
1394278884
Python
Python
py
Runtime Error
0
0
634
ex = ["+", "-", "*"] while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break for i in ex: for j in ex: for k in ex: if eval( "((("+a+k+b+")"+j+c+")"+i+d+")") == 10: print "(((",a,k,b,")",j,c,")",i,d,")" flag = 1 break if flag == 1: break for i in ex: for j in ex: for k in ex: if eval( "(("+a+k+b+")"+i+"("+c+j+d+"))" ) == 10: print "((",a,k,b,")",i,"(",c,j,d,"))" flag = 1 break
File "/tmp/tmp8fjawdft/tmpwhpyw8nj.py", line 10 print "(((",a,k,b,")",j,c,")",i,d,")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s726647185
p00041
u633068244
1394278922
Python
Python
py
Runtime Error
0
0
692
ex = ["+", "-", "*"] while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break for i in ex: for j in ex: for k in ex: if eval( "((("+a+k+b+")"+j+c+")"+i+d+")") == 10: print "(((",a,k,b,")",j,c,")",i,d,")" flag = 1 break if flag == 1: break for i in ex: for j in ex: for k in ex: if eval( "(("+a+k+b+")"+i+"("+c+j+d+"))" ) == 10: print "((",a,k,b,")",i,"(",c,j,d,"))" flag = 1 break if flag == 1: break else: print 0
File "/tmp/tmplr5e5vp0/tmp34wgx7hb.py", line 10 print "(((",a,k,b,")",j,c,")",i,d,")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s664061780
p00041
u633068244
1394278956
Python
Python
py
Runtime Error
0
0
692
ex = ["+", "-", "*"] while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break for i in ex: for j in ex: for k in ex: if eval( "((("+a+k+b+")"+j+c+")"+i+d+")") == 10: print "(((",a,k,b,")",j,c,")",i,d,")" flag = 1 break if flag == 1: break for i in ex: for j in ex: for k in ex: if eval( "(("+a+k+b+")"+i+"("+c+j+d+"))" ) == 10: print "((",a,k,b,")",i,"(",c,j,d,"))" flag = 1 break if flag == 1: break else: print 0
File "/tmp/tmpd9j2r04b/tmp8wl86x6f.py", line 10 print "(((",a,k,b,")",j,c,")",i,d,")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s752245597
p00041
u633068244
1394291913
Python
Python
py
Runtime Error
0
0
1598
op = ["+", "-", "*"] while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break n = [0,1,2,3] q = [str(a),str(b),str(c),str(d)] flag = 0 for i in op: for j in op: for k in op: for ii in n: m = [0,1,2,3] m.remove(ii) for jj in m: l = [0,1,2,3] l.remove(ii);l.remove(jj) for kk in l: o = [0,1,2,3] o.remove(ii);o.remove(jj);o.remove(kk) for ll in o: if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == 10: print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" flag = 1 break if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == 10: print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))" flag = 1 break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 0: print 0
File "/tmp/tmpc09b6fey/tmpbxy7xwkn.py", line 23 print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s587427804
p00041
u633068244
1394291935
Python
Python
py
Runtime Error
0
0
1598
op = ["+", "-", "*"] while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break n = [0,1,2,3] q = [str(a),str(b),str(c),str(d)] flag = 0 for i in op: for j in op: for k in op: for ii in n: m = [0,1,2,3] m.remove(ii) for jj in m: l = [0,1,2,3] l.remove(ii);l.remove(jj) for kk in l: o = [0,1,2,3] o.remove(ii);o.remove(jj);o.remove(kk) for ll in o: if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == 10: print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" flag = 1 break if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == 10: print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))" flag = 1 break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag != 0: print 0
File "/tmp/tmpxpmq0eh1/tmpxdr4xlr5.py", line 23 print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s719266638
p00041
u633068244
1394291988
Python
Python
py
Runtime Error
0
0
1598
op = ["+", "-", "*"] while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break n = [0,1,2,3] q = [str(a),str(b),str(c),str(d)] flag = 0 for i in op: for j in op: for k in op: for ii in n: m = [0,1,2,3] m.remove(ii) for jj in m: l = [0,1,2,3] l.remove(ii);l.remove(jj) for kk in l: o = [0,1,2,3] o.remove(ii);o.remove(jj);o.remove(kk) for ll in o: if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == 10: print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" flag = 1 break if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == 10: print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))" flag = 1 break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 0: print 0
File "/tmp/tmpzvh6hfty/tmpjnppuxga.py", line 23 print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s073622564
p00041
u633068244
1394292021
Python
Python
py
Runtime Error
0
0
1598
op = ["+", "-", "*"] while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break n = [0,1,2,3] q = [str(a),str(b),str(c),str(d)] flag = 0 for i in op: for j in op: for k in op: for ii in n: m = [0,1,2,3] m.remove(ii) for jj in m: l = [0,1,2,3] l.remove(ii);l.remove(jj) for kk in l: o = [0,1,2,3] o.remove(ii);o.remove(jj);o.remove(kk) for ll in o: if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == 10: print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" flag = 1 break if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == 10: print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))" flag = 1 break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 0: print 0
File "/tmp/tmpo1k58v2g/tmpsggulz5d.py", line 23 print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s081157157
p00041
u633068244
1394292072
Python
Python
py
Runtime Error
0
0
1598
op = ["+", "-", "*"] while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break n = [0,1,2,3] q = [str(a),str(b),str(c),str(d)] flag = 0 for i in op: for j in op: for k in op: for ii in n: m = [0,1,2,3] m.remove(ii) for jj in m: l = [0,1,2,3] l.remove(ii);l.remove(jj) for kk in l: o = [0,1,2,3] o.remove(ii);o.remove(jj);o.remove(kk) for ll in o: if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == 10: print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" flag = 1 break if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == 10: print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))" flag = 1 break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 0: print 0
File "/tmp/tmpswmq39bk/tmp4z2u5bov.py", line 23 print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s180452399
p00041
u633068244
1394293079
Python
Python
py
Runtime Error
0
0
1521
op = ["+", "-", "*"] x = int(raw_input()) while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break n = [0,1,2,3] q = [str(a),str(b),str(c),str(d)] flag = 0 m = [0,1,2,3] m.remove(ii) for jj in m: l = [0,1,2,3] l.remove(ii);l.remove(jj) for kk in l: o = [0,1,2,3] o.remove(ii);o.remove(jj);o.remove(kk) for ll in o: for i in op: for j in op: for k in op: for ii in n: if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == x: print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" flag = 1 break if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == x: print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))" flag = 1 break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 0: print 0
File "/tmp/tmpmclp1rr6/tmp0a9u4_4k.py", line 24 print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s247173275
p00041
u633068244
1394293165
Python
Python
py
Runtime Error
0
0
1537
op = ["+", "-", "*"] x = int(raw_input()) while True: a, b, c, d = map(str, raw_input().split()) if a == 0 and c == 0: break n = [0,1,2,3] q = [str(a),str(b),str(c),str(d)] flag = 0 m = [0,1,2,3] m.remove(ii) for ii in n: for jj in m: l = [0,1,2,3] l.remove(ii);l.remove(jj) for kk in l: o = [0,1,2,3] o.remove(ii);o.remove(jj);o.remove(kk) for ll in o: for i in op: for j in op: for k in op: if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == x: print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" flag = 1 break if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == x: print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))" flag = 1 break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 0: print 0
File "/tmp/tmputpffpjd/tmp7uksr3zq.py", line 24 print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s176157853
p00041
u633068244
1394293198
Python
Python
py
Runtime Error
0
0
1521
op = ["+", "-", "*"] x = int(raw_input()) while True: a, b, c, d = map(str, raw_input().split()) if a == "0" and c == "0": break n = [0,1,2,3] q = [a,b,c,d] flag = 0 m = [0,1,2,3] m.remove(ii) for ii in n: for jj in m: l = [0,1,2,3] l.remove(ii);l.remove(jj) for kk in l: o = [0,1,2,3] o.remove(ii);o.remove(jj);o.remove(kk) for ll in o: for i in op: for j in op: for k in op: if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == x: print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" flag = 1 break if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == x: print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))" flag = 1 break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 1: break if flag == 0: print 0
File "/tmp/tmp0mdrxezu/tmp11_o8qj8.py", line 24 print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s562102812
p00042
u198477543
1535190442
Python
Python3
py
Runtime Error
0
0
667
count = 0 while True: count += 1 W = int(input()) if W == 0: break N = int(input()) value = [] weight = [] for i in range(N): a, b = map(int, input().split()) value.append(a) weight.append(b) dp = [[-float("inf") for i in range(W+1)] for j in range(N+1)] for i in range(W+1): dp[0][i] = 0 for i in range(N): for w in range(W+1): if w >= weight[i]: dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w]) else: dp[i+1][w] = dp[i][w] print("Case {0}:\n{1}\n{2}".format(count, dp[N][W], dp[N].index(dp[N][W])))
Traceback (most recent call last): File "/tmp/tmpkh_gmcfe/tmp39s3lxoo.py", line 5, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s581468718
p00042
u540744789
1426832129
Python
Python
py
Runtime Error
0
0
795
while True: # try: case=0 while True: case+=1 weight=input() if weight==0: break N=input() data=[[0 for i in range(2)] for j in range(N)] for i in range(N): data[i][0],data[i][1]=map(int,raw_input().split(",")) table=[[-1 for i in range(weight+1)] for j in range(N)] for i in range(N): table[i][0]=0 table[0][data[0][1]]=data[0][0] for i in range(0,N-1): for j in range(weight+1): if table[i][j]!=-1 and j+data[i+1][1] <= weight: table[i+1][j+data[i+1][1]]=table[i][j]+data[i+1][0] sum=max(table[N-1]) print "Case "+str(case)+":" print sum print table[N-1].index(sum) # except: #break
File "/tmp/tmp6vaomwxb/tmpa8c5yffg.py", line 22 print "Case "+str(case)+":" ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s119841462
p00042
u489809100
1447687529
Python
Python
py
Runtime Error
0
0
617
import itertools count = 0 while True: w = int(raw_input()) if w == 0: break m = int(raw_input()) n = [0 for _ in xrange(m)] h = [0 for _ in xrange(m)] count += 1 for i in xrange(m): n[i],h[i] = map(int,raw_input().split(",")) js= [] for i in xrange(m): lis = list(itertools.combinations(n, m - i)) for j in lis: js.append(sum(j)) jk = [] for i in xrange(m): lis = list(itertools.combinations(h, m - i)) for j in lis: jk.append(sum(j)) jc = list(filter(lambda x: x < w, jk)) jc.sort() js.sort() print "Case " + str(count) + ":" print js[len(jc) - 1] print jc[len(jc) - 1]
File "/tmp/tmp43ibzgei/tmpl6y5xpf4.py", line 31 print "Case " + str(count) + ":" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s755133983
p00042
u489809100
1447687696
Python
Python
py
Runtime Error
0
0
594
import itertools count = 0 while True: w = int(raw_input()) if w == 0: break m = int(raw_input()) n = [0 for _ in xrange(m)] h = [0 for _ in xrange(m)] count += 1 for i in xrange(m): n[i],h[i] = map(int,raw_input().split(",")) js= [] jk = [] for i in xrange(m): lis = list(itertools.combinations(h, m - i)) for j in lis: jk.append(sum(j)) las = list(itertools.combinations(n, m - i)) for j in las: js.append(sum(j)) jc = list(filter(lambda x: x < w, jk)) jc.sort() js.sort() print "Case " + str(count) + ":" print js[len(jc) - 1] print jc[len(jc) - 1]
File "/tmp/tmpfp3jo3ls/tmpgcaj1obg.py", line 29 print "Case " + str(count) + ":" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s477125888
p00042
u489809100
1447687985
Python
Python
py
Runtime Error
0
0
595
import itertools count = 0 while True: w = int(raw_input()) if w == 0: break m = int(raw_input()) n = [0 for _ in xrange(m)] h = [0 for _ in xrange(m)] count += 1 for i in xrange(m): n[i],h[i] = map(int,raw_input().split(",")) tr = [] ty = [] for i in xrange(m): lis = list(itertools.combinations(h, m - i)) for j in lis: tr.append(sum(j)) las = list(itertools.combinations(n, m - i)) for j in las: ty.append(sum(j)) te = list(filter(lambda x: x < w, tr)) te.sort() ty.sort() print "Case " + str(count) + ":" print ty[len(te) - 1] print te[len(te) - 1]
File "/tmp/tmpp_ec2o8a/tmpshi13efd.py", line 29 print "Case " + str(count) + ":" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s819002453
p00042
u489809100
1447688180
Python
Python
py
Runtime Error
0
0
647
import itertools count = 0 if __name__ == "__main__": while True: w = int(raw_input()) if w == 0: break m = int(raw_input()) n = [0 for _ in xrange(m)] h = [0 for _ in xrange(m)] count += 1 for i in xrange(m): n[i],h[i] = map(int,raw_input().split(",")) tr = [] ty = [] for i in xrange(m): lis = list(itertools.combinations(h, m - i)) for j in lis: tr.append(sum(j)) las = list(itertools.combinations(n, m - i)) for j in las: ty.append(sum(j)) te = list(filter(lambda x: x < w, tr)) te.sort() ty.sort() print "Case " + str(count) + ":" print ty[len(te) - 1] print te[len(te) - 1]
File "/tmp/tmp_f1yrvbc/tmpicbh4sst.py", line 30 print "Case " + str(count) + ":" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s759286285
p00042
u896025703
1469782069
Python
Python3
py
Runtime Error
1200
72480
686
def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == N: ans = 0, W - j elif j < wl[i]: ans = rec(i + 1, j) else: v1, w1 = rec(i + 1, j) v2, w2 = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = v1, w1 elif v1 < v2: ans = v2, w2 elif v1 == v2: if w1 < w2: ans = v1, w1 else: ans = v2, w2 dp[i][j] = ans return ans case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) dp = [[-1 for j in range(2000)] for i in range(2000)] v, w = rec(0, W) print("Case {}:".format(case)) print(v) print(w) case += 1
Traceback (most recent call last): File "/tmp/tmp8a4_q50d/tmpgtgn4ji9.py", line 28, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s815694651
p00042
u896025703
1469782249
Python
Python3
py
Runtime Error
420
27088
686
def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == N: ans = 0, W - j elif j < wl[i]: ans = rec(i + 1, j) else: v1, w1 = rec(i + 1, j) v2, w2 = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = v1, w1 elif v1 < v2: ans = v2, w2 elif v1 == v2: if w1 < w2: ans = v1, w1 else: ans = v2, w2 dp[i][j] = ans return ans case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) dp = [[-1 for j in range(1100)] for i in range(1100)] v, w = rec(0, W) print("Case {}:".format(case)) print(v) print(w) case += 1
Traceback (most recent call last): File "/tmp/tmph8p4r1_z/tmpigl5p7r3.py", line 28, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s048310023
p00042
u896025703
1469782451
Python
Python3
py
Runtime Error
1870
110788
685
def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == N: ans = 0, W - j elif j < wl[i]: ans = rec(i + 1, j) else: v1, w1 = rec(i + 1, j) v2, w2 = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = v1, w1 elif v1 < v2: ans = v2, w2 elif v1 == v2: if w1 < w2: ans = v1, w1 else: ans = v2, w2 dp[i][j] = ans return ans case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) dp = [[-1 for j in range(2500)] for i in range(2500)] v, w = rec(0, W) print("Case {}:".format(case)) print(v) print(w) case += 1
Traceback (most recent call last): File "/tmp/tmpv7fty_gt/tmp7igeesf8.py", line 28, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s966402467
p00042
u896025703
1469782523
Python
Python3
py
Runtime Error
1870
110656
701
def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == N: ans = (0, W - j) elif j < wl[i]: ans = rec(i + 1, j) else: (v1, w1) = rec(i + 1, j) (v2, w2) = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = (v1, w1) elif v1 < v2: ans = (v2, w2) elif v1 == v2: if w1 < w2: ans = (v1, w1) else: ans = (v2, w2) dp[i][j] = ans return ans case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) dp = [[-1 for j in range(2500)] for i in range(2500)] (v, w) = rec(0, W) print("Case {}:".format(case)) print(v) print(w) case += 1
Traceback (most recent call last): File "/tmp/tmpzahy2toy/tmphqka5pqt.py", line 28, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s961308360
p00042
u896025703
1469782753
Python
Python3
py
Runtime Error
1860
110692
758
def rec(i, j): if 3000 < i or 3000 < j: while True: print("aaa") if dp[i][j] != -1: return dp[i][j] if i == N: ans = (0, W - j) elif j < wl[i]: ans = rec(i + 1, j) else: (v1, w1) = rec(i + 1, j) (v2, w2) = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = (v1, w1) elif v1 < v2: ans = (v2, w2) elif v1 == v2: if w1 < w2: ans = (v1, w1) else: ans = (v2, w2) dp[i][j] = ans return ans case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) dp = [[-1 for j in range(2500)] for i in range(2500)] (v, w) = rec(0, W) print("Case {}:".format(case)) print(v) print(w) case += 1
Traceback (most recent call last): File "/tmp/tmppk0dxnv4/tmp3dclopy7.py", line 32, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s883618968
p00042
u896025703
1469783450
Python
Python3
py
Runtime Error
20
7800
911
def rec(i, j): #print("rec({}, {}) called".format(i, j)) """ if dp[i][j] != -1: return dp[i][j] """ if i in dphash and j in dphash[i]: return dphash[i][j] if i == N: ans = (0, W - j) elif j < wl[i]: ans = rec(i + 1, j) else: (v1, w1) = rec(i + 1, j) (v2, w2) = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = (v1, w1) elif v1 < v2: ans = (v2, w2) elif v1 == v2: if w1 < w2: ans = (v1, w1) else: ans = (v2, w2) #dp[i][j] = ans if i in dphash: dphash[i][j] = ans else: dphash[i] = {} dphash[i][j] = ans return ans case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) #dp = [[-1 for j in range(2500)] for i in range(2500)] dphash = {} (v, w) = rec(0, W) print("Case {}:".format(case)) print(v) print(w) case += 1
Traceback (most recent call last): File "/tmp/tmpl2ofw6vc/tmpihy8gee0.py", line 39, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s281336939
p00042
u896025703
1469783579
Python
Python3
py
Runtime Error
20
7668
911
def rec(i, j): #print("rec({}, {}) called".format(i, j)) """ if dp[i][j] != -1: return dp[i][j] """ if i in dphash and j in dphash[i]: return dphash[i][j] if i == N: ans = (0, W - j) elif j < wl[i]: ans = rec(i + 1, j) else: (v1, w1) = rec(i + 1, j) (v2, w2) = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = (v1, w1) elif v1 < v2: ans = (v2, w2) elif v1 == v2: if w1 < w2: ans = (v1, w1) else: ans = (v2, w2) #dp[i][j] = ans if i in dphash: dphash[i][j] = ans else: dphash[i] = {} dphash[i][j] = ans return ans case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) #dp = [[-1 for j in range(2500)] for i in range(2500)] dphash = {} (v, w) = rec(0, W) print("Case {}:".format(case)) print(v) print(w) case += 1
Traceback (most recent call last): File "/tmp/tmprblv5cy9/tmpnau78gta.py", line 39, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s680688302
p00042
u896025703
1469783622
Python
Python3
py
Runtime Error
20
7688
863
def rec(i, j): #print("rec({}, {}) called".format(i, j)) if i in dphash and j in dphash[i]: return dphash[i][j] if i == N: ans = (0, W - j) elif j < wl[i]: ans = rec(i + 1, j) else: (v1, w1) = rec(i + 1, j) (v2, w2) = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = (v1, w1) elif v1 < v2: ans = (v2, w2) elif v1 == v2: if w1 < w2: ans = (v1, w1) else: ans = (v2, w2) #dp[i][j] = ans if i in dphash: dphash[i][j] = ans else: dphash[i] = {} dphash[i][j] = ans return ans case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) #dp = [[-1 for j in range(2500)] for i in range(2500)] dphash = {} (v, w) = rec(0, W) print("Case {}:".format(case)) print(v) print(w) case += 1
Traceback (most recent call last): File "/tmp/tmpufrvsikk/tmpepxrhvrq.py", line 35, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s494253673
p00042
u896025703
1469783849
Python
Python3
py
Runtime Error
20
7696
866
def rec(i, j): #print("rec({}, {}) called".format(i, j)) if i in dphash and j in dphash[i]: return dphash[i][j] if i == N: ans = (0, W - j) elif j < wl[i]: ans = rec(i + 1, j) else: (v1, w1) = rec(i + 1, j) (v2, w2) = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = (v1, w1) elif v1 < v2: ans = (v2, w2) elif v1 == v2: if w1 < w2: ans = (v1, w1) else: ans = (v2, w2) #dp[i][j] = ans if i in dphash: dphash[i][j] = ans else: dphash[i] = {} dphash[i][j] = ans return ans casea = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) #dp = [[-1 for j in range(2500)] for i in range(2500)] dphash = {} (v, w) = rec(0, W) print("Case {}:".format(casea)) print(v) print(w) casea += 1
Traceback (most recent call last): File "/tmp/tmpgbj3dg2q/tmp98hlw8t8.py", line 35, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s851735541
p00042
u896025703
1469936504
Python
Python3
py
Runtime Error
0
0
704
case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) dp = [[[0, 0] for j in range(W + 1)] for i in range(N + 1)] for i in range(N - 1, -1, -1): for j in range(0, W + 1): if j < wl[i]: dp[i][j] = dp[i + 1][j] else: if dp[i + 1][j][0] > dp[i+1][j - wl[i]][0] + vl[i]: dp[i][j] = dp[i + 1][j] elif dp[i + 1][j][0] < dp[i+1][j - wl[i]][0] + vl[i]: dp[i][j] = dp[i+1][j - wl[i]] dp[i][j][0] += vl[i] elif dp[i + 1][j][0] = dp[i+1][j - wl[i]][0] + vl[i]: v, w = dp[0][W] print("Case {}:".format(case)) print(v) print(w) case += 1
File "/tmp/tmp9mnpsew3/tmp3qf7y_b3.py", line 23 elif dp[i + 1][j][0] = dp[i+1][j - wl[i]][0] + vl[i]: ^^^^^^^^^^^^^^^ SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
s795849336
p00042
u812047151
1469941947
Python
Python3
py
Runtime Error
30
7752
863
def rec(i, j): #print("rec({}, {}) called".format(i, j)) if i in dphash and j in dphash[i]: return dphash[i][j] if i == N: ans = (0, W - j) elif j < wl[i]: ans = rec(i + 1, j) else: (v1, w1) = rec(i + 1, j) (v2, w2) = rec(i + 1, j - wl[i]) v2 += vl[i] if v1 > v2: ans = (v1, w1) elif v1 < v2: ans = (v2, w2) elif v1 == v2: if w1 < w2: ans = (v1, w1) else: ans = (v2, w2) #dp[i][j] = ans if i in dphash: dphash[i][j] = ans else: dphash[i] = {} dphash[i][j] = ans return ans case = 1 while True: W = int(input()) if W == 0: break N = int(input()) vl = [] wl = [] for _ in range(N): v, w = map(int, input().split(',')) vl.append(v) wl.append(w) #dp = [[-1 for j in range(2500)] for i in range(2500)] dphash = {} (v, w) = rec(0, W) print("Case {}:".format(case)) print(v) print(w) case += 1
Traceback (most recent call last): File "/tmp/tmpohb8y9hh/tmpkbr2g9oo.py", line 35, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s774923613
p00042
u661290476
1482134694
Python
Python3
py
Runtime Error
0
0
583
times=0 while True: times+=1 W=int(input()) n=int(input()) if W==0: break w=[0]*n v=[0]*n for i in range(n): v[i],w[i]=map(int,input().split(",")) dp=[[0]*(W+1) for i in range(n+1)] for i in range(n): for j in range(W+1): if j<w[i]: dp[i+1][j]=dp[i][j] else: dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]) MIN=0 for i in range(W+1): if dp[n][i]==dp[n][W]: MIN=i break print("Case %d:"%times) print(dp[n][W]) print(MIN)
Traceback (most recent call last): File "/tmp/tmpzomh60yx/tmpyes8i_wr.py", line 4, in <module> W=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s761508934
p00042
u252368621
1482161628
Python
Python3
py
Runtime Error
20
7736
908
def dfs_dp(w, v, N, W, index, dp): if (dp[index][W][0] != -1): return dp[index][W] if index==N: return [0,0] if W<w[index]: return dfs_dp(w, v, N, W, index + 1, dp) temp1=dfs_dp(w, v, N, W, index + 1, dp) temp=dfs_dp(w, v, N, W - w[index], index + 1, dp) temp2=[v[index] + temp[0],w[index]+temp[1]] if temp1[0]==temp2[0]: if temp1[1]<temp2[1]: ret=temp1 else: ret=temp2 elif temp1[0]>temp2[0]: ret=temp1 else: ret=temp2 dp[index][W]=ret return ret count=1 W=int(input()) while(W!=0): N=int(input()) w=[] v=[] dp=[[[-1,-1] for i in range(W+1)] for j in range(N+1)] for i in range(N): a,b=input().split(',') v.append(int(a)) w.append(int(b)) sum=dfs_dp(w,v,N,W,0,dp) print("Case "+str(count)+":") print(sum[0]) print(sum[1]) W=int(input()) count+=1
Traceback (most recent call last): File "/tmp/tmpb5rrtdph/tmpmoja06e0.py", line 23, in <module> W=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s133473839
p00042
u227162786
1490176514
Python
Python3
py
Runtime Error
20
7636
902
# i????????\??????????????§??????j??§??????(?????§??????, ??????????????????) def ns(vs, ws, i, j, dp): if dp[i][j][0] != -1: return dp[i][j] if i == len(vs): return [0, 0] else: if ws[i] > j: dp[i][j] = ns(vs, ws, i+1, j, dp) return dp[i][j] else: tmp = ns(vs, ws, i+1, j-ws[i], dp) dp[i][j] = max(ns(vs, ws, i+1, j, dp), [vs[i]+tmp[0], ws[i]+tmp[1]], key = lambda x: x[0]) return dp[i][j] casenum = 1 while True: W = int(input()) if W == 0: break N = int(input()) vs, ws = [], [] for _ in range(N): v, w = map(int, input().split(',')) vs.append(v) ws.append(w) dp = [[[-1, -1] for _ in range(W+1)] for __ in range(N+1)] v, w = ns(vs, ws, 0, W, dp) print('Case ' + str(casenum) + ':') print(v) print(w) casenum += 1
Traceback (most recent call last): File "/tmp/tmp7aib2047/tmp9kqdsagc.py", line 18, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s428893666
p00042
u227162786
1490176972
Python
Python3
py
Runtime Error
30
7752
913
# i????????\??????????????§??????j??§??????(?????§??????, -??????????????????) def ns(vs, ws, i, j, dp): if dp[i][j][0] != -1: return dp[i][j] if i == len(vs): return [0, 0] else: if ws[i] > j: dp[i][j] = ns(vs, ws, i+1, j, dp) return dp[i][j] else: tmp = ns(vs, ws, i+1, j-ws[i], dp) dp[i][j] = max(ns(vs, ws, i+1, j, dp), [vs[i]+tmp[0], -ws[i]+tmp[1]], key = lambda x: (x[0], x[1])) return dp[i][j] casenum = 1 while True: W = int(input()) if W == 0: break N = int(input()) vs, ws = [], [] for _ in range(N): v, w = map(int, input().split(',')) vs.append(v) ws.append(w) dp = [[[-1, -1] for _ in range(W+1)] for __ in range(N+1)] v, w = ns(vs, ws, 0, W, dp) print('Case ' + str(casenum) + ':') print(v) print(-w) casenum += 1
Traceback (most recent call last): File "/tmp/tmp98n_a4zf/tmpe8iyrbof.py", line 18, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s323617671
p00042
u227162786
1490177069
Python
Python3
py
Runtime Error
30
7692
831
def ns(vs, ws, i, j, dp): if dp[i][j][0] != -1: return dp[i][j] if i == len(vs): return [0, 0] else: if ws[i] > j: dp[i][j] = ns(vs, ws, i+1, j, dp) return dp[i][j] else: tmp = ns(vs, ws, i+1, j-ws[i], dp) dp[i][j] = max(ns(vs, ws, i+1, j, dp), [vs[i]+tmp[0], -ws[i]+tmp[1]], key = lambda x: (x[0], x[1])) return dp[i][j] casenum = 1 while True: W = int(input()) if W == 0: break N = int(input()) vs, ws = [], [] for _ in range(N): v, w = map(int, input().split(',')) vs.append(v) ws.append(w) dp = [[[-1, -1] for _ in range(W+1)] for __ in range(N+1)] v, w = ns(vs, ws, 0, W, dp) print('Case ' + str(casenum) + ':') print(v) print(-w) casenum += 1
Traceback (most recent call last): File "/tmp/tmpi3_kx8_z/tmp_c6wnkz9.py", line 17, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s397182723
p00042
u144068724
1494954030
Python
Python3
py
Runtime Error
0
0
31
# coding: utf-8 count += 1
File "/tmp/tmpbnk7racz/tmppsb_plr2.py", line 3 count += 1 IndentationError: unexpected indent
s619283595
p00042
u144068724
1494954048
Python
Python3
py
Runtime Error
0
0
30
# coding: utf-8 count = 1
File "/tmp/tmpegr6gkwp/tmpx6rd8ear.py", line 3 count = 1 IndentationError: unexpected indent
s361318135
p00042
u144068724
1494954435
Python
Python3
py
Runtime Error
0
0
470
def get(): p,w = map(int, raw_input().split(",")) for i in range(W-w,-1,-1): if bag[i] > 0 and bag[i]+p > bag[i+w]: bag[i+w] = bag[i]+p else: if p > bag[w]: bag[w] = p return c = 1 while True: W = int(raw_input()) if W == 0: break bag = [0]*(W+1) N = int(raw_input()) for i in range(N): get() w_all = max(bag) money = bag.index(w_all) print "Case {}:\n{}\n{}".format(c,w_all,money) c += 1
File "/tmp/tmpgrmzah2x/tmpw6llc0r2.py", line 19 print "Case {}:\n{}\n{}".format(c,w_all,money) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s213256570
p00042
u868716420
1496190409
Python
Python3
py
Runtime Error
0
0
966
from itertools import combinations case = 0 while True : limit = int(input()) if limit == 0 : break case += 1 number = int(input()) value, weight = [], [] for _ in range(number) : a, b = input().split(',') value.append(int(a)) weight.append(int(b)) temp1, temp2 = [], [] for _ in range(1, number+1) : temp1.append(list(combinations(value, _))) temp2.append(list(combinations(weight, _))) temp1, temp2 = sum(temp1, []), sum(temp2, []) value, weight = [], [] for _ in temp1 : value.append(sum(_)) for _ in temp2 : weight.append(sum(_)) result = [0, 0] for _ in range(len(temp1)) : if result[0] < value[_] and weight[_] =< limit : result = value[_], weight[_] elif result[0] == value and weight[_] < result[1] : result = value[_], weight[_] print('Case {}:'.format(case)) print(result[0]) print(result[1])
File "/tmp/tmp6b84_rog/tmpln9y2j44.py", line 26 if result[0] < value[_] and weight[_] =< limit : ^ SyntaxError: invalid syntax
s802438537
p00042
u009961299
1504775562
Python
Python3
py
Runtime Error
20
7756
704
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import itertools def solve(): cache = dict() def loop(i, w): if (i, w) in cache: return cache[i, w] if i == N: return (0, 0) cache[i, w] = loop(i + 1, w) if v[i][1] <= w: t = loop(i + 1, w - v[i][1]) cache[i, w] = max(cache[i, w], (t[0] + v[i][0], t[1] + v[i][1]), key=lambda u: u[0]) return cache[i, w] return loop(0, W) for dn in itertools.count(1): W = int(input()) if W == 0: break N = int(input()) v = [tuple(map(int, input().split(','))) for _ in range(N)] optim = solve() print("Case %d:\n%d\n%d" % (dn, optim[0], optim[1]))
Traceback (most recent call last): File "/tmp/tmpei4p5pmh/tmprs905zli.py", line 20, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s573891222
p00042
u009961299
1504775668
Python
Python3
py
Runtime Error
30
7696
653
import itertools def solve(): cache = {} def loop(i, w): if (i, w) in cache: return cache[i, w] if i == N: return (0, 0) cache[i, w] = loop(i + 1, w) if v[i][1] <= w: t = loop(i + 1, w - v[i][1]) cache[i, w] = max(cache[i, w], (t[0] + v[i][0], t[1] + v[i][1]), key=lambda u: u[0]) return cache[i, w] return loop(0, W) for dn in itertools.count(1): W = int(input()) if W == 0: break N = int(input()) v = [tuple(map(int, input().split(','))) for _ in range(N)] optim = solve() print("Case %d:\n%d\n%d" % (dn, optim[0], optim[1]))
Traceback (most recent call last): File "/tmp/tmpmoijwc1_/tmpt_arrdgd.py", line 18, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s892533809
p00042
u009961299
1504775859
Python
Python3
py
Runtime Error
30
7796
667
import itertools def solve(W, N, v): cache = {} def loop(i, w): if (i, w) in cache: return cache[i, w] if i == N: return (0, 0) cache[i, w] = loop(i + 1, w) if v[i][1] <= w: t = loop(i + 1, w - v[i][1]) cache[i, w] = max(cache[i, w], (t[0] + v[i][0], t[1] + v[i][1]), key=lambda u: u[0]) return cache[i, w] return loop(0, W) for dn in itertools.count(1): W = int(input()) if W == 0: break N = int(input()) v = [tuple(map(int, input().split(','))) for _ in range(N)] optim = solve(W, N, v) print("Case %d:\n%d\n%d" % (dn, optim[0], optim[1]))
Traceback (most recent call last): File "/tmp/tmpw7buuw2w/tmpsd3dsdrg.py", line 18, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s953407805
p00042
u009961299
1504776121
Python
Python3
py
Runtime Error
30
7716
768
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import itertools def solve(W, N, v): cache = [[None for _ in range(W + 1)] for _ in range(N)] def loop(i, w): if i == N: return (0, 0) if cache[i][w] is not None: return cache[i][w] cache[i][w] = loop(i + 1, w) if v[i][1] <= w: t = loop(i + 1, w - v[i][1]) cache[i][w] = max(cache[i][w], (t[0] + v[i][0], t[1] + v[i][1]), key=lambda u: u[0]) return cache[i][w] return loop(0, W) for dn in itertools.count(1): W = int(input()) if W == 0: break N = int(input()) v = [tuple(map(int, input().split(','))) for _ in range(N)] optim = solve(W, N, v) print("Case %d:\n%d\n%d" % (dn, optim[0], optim[1]))
Traceback (most recent call last): File "/tmp/tmpcimh_m12/tmpn652w5nx.py", line 20, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s709644587
p00042
u009961299
1504776682
Python
Python3
py
Runtime Error
20
7804
788
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import itertools def solve(W, N, v): cache = {} def loop(i, w): if i == N: return (0, 0) if (i, w) in cache: return cache[i, w] cache[i, w] = loop(i + 1, w) if v[i][1] <= w: t = loop(i + 1, w - v[i][1]) t = (t[0] + v[i][0], t[1] + v[i][1]) if cache[i, w][0] < t[0] or cache[i, w][0] == t[0] and t[1] < cache[i, w][1]: cache[i, w] = t return cache[i, w] return loop(0, W) for dn in itertools.count(1): W = int(input()) if W == 0: break N = int(input()) v = [tuple(map(int, input().split(','))) for _ in range(N)] optim = solve(W, N, v) print("Case %d:\n%d\n%d" % (dn, optim[0], optim[1]))
Traceback (most recent call last): File "/tmp/tmp2vzlzong/tmpj9uiblrg.py", line 22, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s630073206
p00042
u150984829
1525016228
Python
Python3
py
Runtime Error
0
0
267
c=0 for W in iter(input,'0\n'): c+=1 W=int(W) dp=[0]*-~W for _ in[0]*int(input()): v,w=map(int,input().split(',')) for i in range(W,w-1,-1): if dp[i]<dp[i-w]+v:dp[i]=dp[i-w]+v for i in range(W+1): if dp[W]==dp[i]:print(f'Case {c}:\n{dp[W]}\n{i}');break
Traceback (most recent call last): File "/tmp/tmpsxy04i5z/tmp9yexmini.py", line 2, in <module> for W in iter(input,'0\n'): EOFError: EOF when reading a line
s197093521
p00042
u019169314
1527996745
Python
Python3
py
Runtime Error
30
5616
1109
case = 0 while True: W = int(input()) if W == 0: break N = int(input()) case += 1 # a list of [itemValue, itemWeight] items = [list(map(int,input().split(','))) for i in range(N)] dp = {} def bestVW(item, capa): if (item,capa) in dp: return dp[(item,capa)] elif item == 0: bestVWForCapa = items[item] if items[item][1] <= capa else [0,0] dp[(item,capa)] = bestVWForCapa return bestVWForCapa else: if items[item][1] > capa: bestVWForCapa = bestVW(item-1, capa) dp[(item,capa)] = bestVWForCapa return bestVWForCapa else: pickedVW = bestVW(item-1,capa) notPickedVW = list(map(sum, zip(items[item], bestVW(item-1, capa-items[item][1])))) bestVWForCapa = pickedVW if pickedVW[0] > notPickedVW[0] else notPickedVW dp[(item,capa)] = bestVWForCapa return bestVWForCapa print('Case ',case, ':', sep='') print('\n'.join(map(str,bestVW(N-1,W))))
Traceback (most recent call last): File "/tmp/tmp6fycouws/tmp_ufc_c7w.py", line 3, in <module> W = int(input()) ^^^^^^^ EOFError: EOF when reading a line