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
s408375639
p00431
u599161451
1360392663
Python
Python
py
Runtime Error
19930
4296
1026
def foo(nw, visited): last = visited[-1] r = 0 for k in nw[last]: if k not in visited: v = foo(nw, visited + (k,)) else: v = len(visited) if r < v: r = v return r def findlongetstpath(nw): return max([foo(nw, (k,)) for k in nw.keys()]) def chunker(f): while True: line = f.readline() line = line.strip() dsize = int(line) if dsize == 0: raise StopIteration network = {} for i in range(dsize): line = f.readline() line = line.strip() s, d = line.split() rel = network.get(s, None) if rel is None: rel = set() rel.add(d) network[s] = rel rel = network.get(d, None) if rel is None: rel = set() rel.add(s) network[d] = rel yield network import sys for nw in chunker(sys.stdin): print findlongetstpath(nw)
File "/tmp/tmph65s8s8u/tmpocuq5bhq.py", line 44 print findlongetstpath(nw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s300252241
p00431
u599161451
1360392856
Python
Python
py
Runtime Error
19930
4296
1042
#!/usr/bin/python def foo(nw, visited): last = visited[-1] r = 0 for k in nw[last]: if k not in visited: v = foo(nw, visited + (k,)) else: v = len(visited) if r < v: r = v return r def findlongetstpath(nw): return max([foo(nw, (k,)) for k in nw.keys()]) def chunker(f): while True: line = f.readline() line = line.strip() dsize = int(line) if dsize == 0: raise StopIteration network = {} for i in range(dsize): line = f.readline() line = line.strip() s, d = line.split() rel = network.get(s, None) if rel is None: rel = set() rel.add(d) network[s] = rel rel = network.get(d, None) if rel is None: rel = set() rel.add(s) network[d] = rel yield network import sys for nw in chunker(sys.stdin): print findlongetstpath(nw)
File "/tmp/tmpzbis79is/tmp33fv1zrt.py", line 44 print findlongetstpath(nw) ^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s803655381
p00431
u604412493
1378276626
Python
Python
py
Runtime Error
0
0
922
import sys from copy import deepcopy #fp = open("input.txt", "r") fp = sys.stdin def countLength(chain, start, prev): node = chain[start][:] if not node: return 0 chain[start] = [] max_len = 0 for i in node: if i == prev: continue cloned = deepcopy(chain) length = countLength(cloned, i, start) + 1 if length > max_len: max_len = length return max_len while True: n = int(fp.readline()[:-1]) if n == 0: break chain = [[] for i in xrange(n)] for i in xrange(n): string = map(int , fp.readline()[:-1].split(" ")) chain[string[0]-1].append(string[1]-1) chain[string[1]-1].append(string[0]-1) max_len = 0 for i in xrange(n): cloned = deepcopy(chain) length = countLength(cloned, i, -1) if length > max_len: max_len = length print max_len
File "/tmp/tmpo62b1fyv/tmpwn4va32c.py", line 39 print max_len ^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s614180489
p00431
u604412493
1378276722
Python
Python
py
Runtime Error
0
0
942
import sys #fp = open("input.txt", "r") fp = sys.stdin def deepcopy(li): return [i for i in li] def countLength(chain, start, prev): node = chain[start][:] if not node: return 0 chain[start] = [] max_len = 0 for i in node: if i == prev: continue cloned = deepcopy(chain) length = countLength(cloned, i, start) + 1 if length > max_len: max_len = length return max_len while True: n = int(fp.readline()[:-1]) if n == 0: break chain = [[] for i in xrange(n)] for i in xrange(n): string = map(int , fp.readline()[:-1].split(" ")) chain[string[0]-1].append(string[1]-1) chain[string[1]-1].append(string[0]-1) max_len = 0 for i in xrange(n): cloned = deepcopy(chain) length = countLength(cloned, i, -1) if length > max_len: max_len = length print max_len
File "/tmp/tmp8a2_ahir/tmpl0ujmx1d.py", line 41 print max_len ^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s461681137
p00431
u604412493
1378276924
Python
Python
py
Runtime Error
0
0
945
import sys #fp = open("input.txt", "r") fp = sys.stdin def deepcopy(li): return [i for i in li] def countLength(chain, start, prev): node = chain[start][:] if not node: return 0 chain[start] = [] max_len = 0 for i in node: if i == prev: continue cloned = deepcopy(chain) length = countLength(cloned, i, start) + 1 if length > max_len: max_len = length return max_len while True: n = int(fp.readline()[:-1]) if n == 0: break chain = [[] for i in xrange(n)] for i in xrange(n): string = map(int , fp.readline()[:-1].split(" ")) chain[string[0]-1].append(string[1]-1) chain[string[1]-1].append(string[0]-1) max_len = 0 for i in xrange(n): cloned = deepcopy(chain) #length = countLength(cloned, i, -1) #if length > max_len: # max_len = length print max_len
File "/tmp/tmp8kzu4um3/tmpoizuww31.py", line 41 print max_len ^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s513184950
p00431
u604412493
1378277008
Python
Python
py
Runtime Error
0
0
342
import sys #fp = open("input.txt", "r") fp = sys.stdin while True: n = int(fp.readline()[:-1]) if n == 0: break chain = [[] for i in xrange(n)] for i in xrange(n): string = map(int , fp.readline()[:-1].split(" ")) chain[string[0]-1].append(string[1]-1) chain[string[1]-1].append(string[0]-1)
Traceback (most recent call last): File "/tmp/tmp7xm_yabn/tmpgw48xy4_.py", line 7, in <module> n = int(fp.readline()[:-1]) ^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s662529535
p00431
u604412493
1378277231
Python
Python
py
Runtime Error
0
0
330
import sys fp = sys.stdin while True: n = int(fp.readline()[:-1]) if n == 0: break chain = [[] for i in xrange(n)] for i in xrange(n): string = map(int , fp.readline()[:-1].split(" ")) chain[string[0]-1].append(string[1]-1) chain[string[1]-1].append(string[0]-1) print 'hoge'
File "/tmp/tmpjnukcep2/tmphbm2rz3o.py", line 15 print 'hoge' ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s103399316
p00431
u604412493
1378277277
Python
Python
py
Runtime Error
0
0
304
import sys fp = sys.stdin while True: n = int(fp.readline()[:-1]) if n == 0: break cha = [[] for i in xrange(n)] for i in xrange(n): st = map(int , fp.readline()[:-1].split(" ")) cha[st[0]-1].append(st[1]-1) cha[st[1]-1].append(st[0]-1) print 'hoge'
File "/tmp/tmpep63ne8f/tmprls43m_k.py", line 15 print 'hoge' ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s822001992
p00431
u604412493
1378277341
Python
Python
py
Runtime Error
0
0
317
import sys fp = sys.stdin while True: n = int(fp.readline()[:-1]) if n == 0: break hoge = [[] for i in xrange(n)] for i in xrange(n): fuga = map(int , fp.readline()[:-1].split(" ")) hoge[fuga[0]-1].append(fuga[1]-1) hoge[fuga[1]-1].append(fuga[0]-1) print 'hoge'
File "/tmp/tmp_jbhuygx/tmpdpeh686u.py", line 15 print 'hoge' ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s872762646
p00431
u604412493
1378277428
Python
Python
py
Runtime Error
0
0
357
import sys fp = sys.stdin while True: n = int(fp.readline()[:-1]) if n == 0: break chain = [] for i in xrange(n): chain.append([]) for i in xrange(n): string = map(int , fp.readline()[:-1].split(" ")) chain[string[0]-1].append(string[1]-1) chain[string[1]-1].append(string[0]-1) print 'hoge'
File "/tmp/tmp0u9jzzuw/tmpytbw587o.py", line 16 print 'hoge' ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s968647875
p00432
u352394527
1531143083
Python
Python3
py
Runtime Error
0
0
1184
def main(): while True: n, r = map(int, input().split()) if n == 0: break plst = [] minx = miny = 20000 maxx = maxy = 0 for _ in range(n): x1, y1, x2, y2 = map(int, input().split()) minx = min(minx, x1) miny = min(miny, y1) maxx = max(maxx, x2) maxy = max(maxy, y2) plst.append((x1, y1, x2, y2)) mp = [[0] * (maxx + 5) for _ in range(maxy + 5)] for x1, y1, x2, y2 in plst: mp[y1 + 1][x1 + 1] += 1 mp[y1 + 1][x2 + 1] -= 1 mp[y2 + 1][x1 + 1] -= 1 mp[y2 + 1][x2 + 1] += 1 for line in mp: acc = 0 for x in range(maxx + 5): acc += line[x] line[x] = acc for x in range(maxx + 5): acc = 0 for y in range(maxy + 5): acc += mp[y][x] mp[y][x] = bool(acc) if r == 1: ans = 0 for line in mp: ans += sum(line) print(ans) else: ans1 = ans2 = 0 for y in range(1, maxy + 4): for x in range(1, maxx + 4): if mp[y][x]: ans1 += 1 ans2 += (4 - mp[y + 1][x] - mp[y - 1][x] - mp[y][x + 1] - mp[y][x - 1]) print(ans1, ans2,sep="\n") main()
Traceback (most recent call last): File "/tmp/tmpbl0rfcw0/tmpr8dk7hs_.py", line 48, in <module> main() File "/tmp/tmpbl0rfcw0/tmpr8dk7hs_.py", line 3, in main n, r = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s354496116
p00432
u898097781
1467373196
Python
Python
py
Runtime Error
0
0
495
import numpy as np import csv area = np.zeros([10002,10002]) fw = open('output.txt', 'w') with open('input.txt') as f: data = [line for line in csv.reader(f, delimiter=' ')] n, r = data[0] for i in range(1, n+1): area[data[i][0]:data[i][2]+1,data[i][1]:data[i][3]+1] = 1 menseki = len(np.nonzero(area)[0]) fw.write('{}\n'.format(menseki)) if r == 2: tate = len(np.nonzero(area[:-1,:] - area[1:,:])[0]) tate += len(np.nonzero(area[:,:-1] - area[:,1:])[0]) fw.write('{}\n'.format(tate))
Traceback (most recent call last): File "/tmp/tmphsutuh1k/tmpljgiuj8a.py", line 8, in <module> with open('input.txt') as f: ^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'input.txt'
s096748458
p00432
u898097781
1467373564
Python
Python
py
Runtime Error
0
0
467
import numpy as np import csv area = np.zeros([10002,10002]) while (line=raw_input()): n, r = map(int, line.split(' ')) for i in xrange(n): line = raw_input() data = map(int, line.split(' ')) area[data[0]:data[2]+1,data[1]:data[3]+1] = 1 menseki = len(np.nonzero(area)[0]) print '{}\n'.format(menseki) if r == 2: tate = len(np.nonzero(area[:-1,:] - area[1:,:])[0]) tate += len(np.nonzero(area[:,:-1] - area[:,1:])[0]) print '{}\n'.format(tate)
File "/tmp/tmp3zp4d3k1/tmp073f1a6b.py", line 6 while (line=raw_input()): ^^^^^^^^^^^^^^^^ SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
s087314575
p00432
u898097781
1467374317
Python
Python
py
Runtime Error
0
0
634
import numpy as np import csv while 1: line=raw_input() n, r = map(int, line.split(' ')) if n == 0: break data = [] for i in xrange(n): line = raw_input() data.append(map(int, line.split(' '))) data = np.array(data) X = np.max(data[:,2]) Y = np.max(data[:,3]) area = np.zeros([X,Y]) for d in data: area[d[0]:d[2],d[1]:d[3]] = 1 menseki = len(np.nonzero(area)[0]) print '{}\n'.format(menseki) area2 = np.zeros([X+2,Y+2]) area2[1:-1,1:-1] = area if r == 2: tate = len(np.nonzero(area2[:-1,:] - area2[1:,:])[0]) tate += len(np.nonzero(area2[:,:-1] - area2[:,1:])[0]) print '{}\n'.format(tate)
File "/tmp/tmpz43jd8a7/tmp33n4hzvr.py", line 26 print '{}\n'.format(menseki) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s853372972
p00432
u898097781
1467374393
Python
Python
py
Runtime Error
0
0
742
import numpy as np import csv while 1: line=raw_input() n, r = map(int, line.split(' ')) if n == 0: break data = [] for i in xrange(n): line = raw_input() data.append(map(int, line.split(' '))) data = np.array(data) X = np.max(data[:,2]) Y = np.max(data[:,3]) area = np.zeros([X,Y]) for d in data: area[d[0]:d[2],d[1]:d[3]] = 1 menseki = len(np.nonzero(area)[0]) print '{}\n'.format(menseki) area2 = np.zeros([X+2,Y+2]) area2[1:-1,1:-1] = area if r == 2: tate = len(np.nonzero(area2[:-1,:] - area2[1:,:])[0]) tate += len(np.nonzero(area2[:,:-1] - area2[:,1:])[0]) print '{}\n'.format(tate)
File "/tmp/tmp4tnmhbce/tmpgcars4b5.py", line 26 print '{}\n'.format(menseki) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s330907972
p00432
u898097781
1467374515
Python
Python
py
Runtime Error
0
0
738
import numpy as np import csv while 1: line=raw_input() n, r = map(int, line.split(' ')) if n == 0: break data = [] for i in xrange(n): line = raw_input() data.append(map(int, line.split(' '))) data = np.array(data) X = np.max(data[:,2]) Y = np.max(data[:,3]) area = np.zeros([X,Y]) for d in data: area[d[0]:d[2],d[1]:d[3]] = 1 menseki = len(np.nonzero(area)[0]) print '{}'.format(menseki) area2 = np.zeros([X+2,Y+2]) area2[1:-1,1:-1] = area if r == 2: tate = len(np.nonzero(area2[:-1,:] - area2[1:,:])[0]) tate += len(np.nonzero(area2[:,:-1] - area2[:,1:])[0]) print '{}'.format(tate)
File "/tmp/tmp0azddn_b/tmp58rrq10k.py", line 26 print '{}'.format(menseki) ^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s125920835
p00432
u898097781
1467374652
Python
Python
py
Runtime Error
0
0
749
import numpy as np import csv while 1: line=raw_input() n, r = map(int, line.split(' ')) if n == 0 and r == 0: break data = [] for i in xrange(n): line = raw_input() data.append(map(int, line.split(' '))) data = np.array(data) X = np.max(data[:,2]) Y = np.max(data[:,3]) area = np.zeros([X,Y]) for d in data: area[d[0]:d[2],d[1]:d[3]] = 1 menseki = len(np.nonzero(area)[0]) print '{}'.format(menseki) area2 = np.zeros([X+2,Y+2]) area2[1:-1,1:-1] = area if r == 2: tate = len(np.nonzero(area2[:-1,:] - area2[1:,:])[0]) tate += len(np.nonzero(area2[:,:-1] - area2[:,1:])[0]) print '{}'.format(tate)
File "/tmp/tmp6wjo4s4y/tmpsv22samy.py", line 26 print '{}'.format(menseki) ^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s316020388
p00432
u898097781
1467374667
Python
Python
py
Runtime Error
0
0
18
import numpy as np
s422231041
p00432
u898097781
1467376485
Python
Python
py
Runtime Error
0
0
911
import numpy import csv while 1: line=raw_input() n, r = map(int, line.split(' ')) if n == 0 and r == 0: break data = [] for i in xrange(n): line = raw_input() data.append(map(int, line.split(' '))) X = max(map(lambda x:x[2],data)) Y = max(map(lambda x:x[3],data)) area = [[0 for x in xrange(X+2)] for y in xrange(Y+2)] if r == 2: area1 = [[0 for x in xrange(X+2)] for y in xrange(Y+2)] area2 = [[0 for x in xrange(X+2)] for y in xrange(Y+2)] for d in data: for y in xrange(d[1]+1, d[3]+1): for x in xrange(d[0]+1,d[2]+1): area[y][x] = 1 if r == 2: area1[y][x+1] = 1 area2[y+1][x] = 1 menseki = 0 for line in area: menseki += sum(line) print '{}'.format(menseki) if r == 2: nagasa = 0 for a, (a1, a2) in zip(area, zip(area1, area2)): nagasa += sum([abs(b-b1)+abs(b-b2) for b, (b1, b2) in zip(a, zip(a1,a2))]) print '{}'.format(nagasa)
File "/tmp/tmpjfzxead3/tmpshz5ct97.py", line 36 print '{}'.format(menseki) ^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s791075335
p00432
u898097781
1467376645
Python
Python
py
Runtime Error
0
0
19
from numpy import *
s486957006
p00432
u662488567
1480422275
Python
Python3
py
Runtime Error
0
0
1790
from itertools import chain with 0 as efafe: max_size = 10002 while 1: n, r = (int(i) for i in input().strip().split()) if n == r == 0: break flag = False if r == 2 else True sheets = dict() max_size = 0 for i in range(n): points = tuple(int(i) + 1 for i in input().strip().split()) max_size = max(max_size, max(points)) sheets[points[0]] = tuple(chain(sheets.get(points[0], ()), ((points[1], 1), (points[3], -1)))) sheets[points[2]] = tuple(chain(sheets.get(points[2], ()), ((points[3], 1),( points[1], -1)))) max_size += 2 size, perimeter = 0, 0 # dp[0] is left, dp[1] is now vertical line dp0, dp1 = dict(), dict() for x in range(0, max_size): # put value to each point for i in range(0, len(sheets.get(x, ()))): pos, val = sheets[x][i] dp1[pos] = val + dp1.get(pos, 0) # paint '1' to left line, and '-1' to right line for y in range(1, max_size): dp1[y] = dp1.get(y, 0) + dp1.get(y - 1, 0) # merge `left' and `now' for y in range(1, max_size): dp1[y] = dp1.get(y, 0) + dp0.get(y, 0) # check and add for y in range(1, max_size): # if `now' or `left' equal zero, and another more than zero. up = (dp0.get(y, 0) == 0 and dp1.get(y, 0) > 0) \ or (dp0.get(y, 0) > 0 and dp1.get(y, 0) == 0) # if `now' or `under' equal zero, and another more than zero. left = (dp1.get(y - 1, 0) == 0 and dp1.get(y, 0) > 0) \ or (dp1.get(y - 1, 0) > 0 and dp1.get(y, 0) == 0) # if `now' is more than zero. flag = dp1.get(y, 0) > 0 perimeter += up + left size += flag dp0, dp1 = dp1, dict() print(size) if r == 2: print(perimeter)
Traceback (most recent call last): File "/tmp/tmpnnghpi1v/tmph61japte.py", line 5, in <module> with 0 as efafe: TypeError: 'int' object does not support the context manager protocol
s429466156
p00432
u662488567
1480422319
Python
Python3
py
Runtime Error
0
0
1654
max_size = 10002 while 1: n, r = (int(i) for i in input().strip().split()) if n == r == 0: break flag = False if r == 2 else True sheets = dict() max_size = 0 for i in range(n): points = tuple(int(i) + 1 for i in input().strip().split()) max_size = max(max_size, max(points)) sheets[points[0]] = tuple(chain(sheets.get(points[0], ()), ((points[1], 1), (points[3], -1)))) sheets[points[2]] = tuple(chain(sheets.get(points[2], ()), ((points[3], 1),( points[1], -1)))) max_size += 2 size, perimeter = 0, 0 # dp[0] is left, dp[1] is now vertical line dp0, dp1 = dict(), dict() for x in range(0, max_size): # put value to each point for i in range(0, len(sheets.get(x, ()))): pos, val = sheets[x][i] dp1[pos] = val + dp1.get(pos, 0) # paint '1' to left line, and '-1' to right line for y in range(1, max_size): dp1[y] = dp1.get(y, 0) + dp1.get(y - 1, 0) # merge `left' and `now' for y in range(1, max_size): dp1[y] = dp1.get(y, 0) + dp0.get(y, 0) # check and add for y in range(1, max_size): # if `now' or `left' equal zero, and another more than zero. up = (dp0.get(y, 0) == 0 and dp1.get(y, 0) > 0) \ or (dp0.get(y, 0) > 0 and dp1.get(y, 0) == 0) # if `now' or `under' equal zero, and another more than zero. left = (dp1.get(y - 1, 0) == 0 and dp1.get(y, 0) > 0) \ or (dp1.get(y - 1, 0) > 0 and dp1.get(y, 0) == 0) # if `now' is more than zero. flag = dp1.get(y, 0) > 0 perimeter += up + left size += flag dp0, dp1 = dp1, dict() print(size) if r == 2: print(perimeter)
Traceback (most recent call last): File "/tmp/tmpb0s9kx9_/tmpa51ax5g9.py", line 3, in <module> n, r = (int(i) for i in input().strip().split()) ^^^^^^^ EOFError: EOF when reading a line
s969199506
p00432
u368408684
1514081695
Python
Python3
py
Runtime Error
0
0
3606
class All_Column: def __init__(self, rec_num): self.rec_num = rec_num self.x_stack = [] self.y_stack = [0 for i in range(10002)] def add(self, x, up, down): if self.y_stack[x+1] == 0: self.x_stack.append(x) self.y_stack[x+1] = One_Column(x, up, down) else: self.y_stack[x+1].add(up, down) def calc_menseki(self): self.x_stack.sort() menseki = 0 for i in self.x_stack: for j in range(len(self.y_stack[i+1].up)): #print(i,j) menseki += (self.y_stack[i+1].up[j] - self.y_stack[i+1].down[j]) #print("x: "+str(i)+", menseki: "+str(menseki)) #print("menseki: "+str(menseki)) print(str(menseki)) def calc_shuui(self): shuui = 0 for i in self.x_stack: #print("x:"+str(i)+", rec num:"+str(len(self.y_stack[i+1].up))) one_shuui = 0 #print("up + down: "+str((len(self.y_stack[i+1].up) + len(self.y_stack[i+1].down)))) one_shuui += (len(self.y_stack[i+1].up) + len(self.y_stack[i+1].down)) for j in range(len(self.y_stack[i+1].up)): edge = 2*(self.y_stack[i+1].up[j] - self.y_stack[i+1].down[j]) # subtract edge for k in [i,i+2]: if self.y_stack[k] != 0: for l in range(len(self.y_stack[k].up)): if (self.y_stack[k].down[l] <= self.y_stack[i+1].down[j]) and (self.y_stack[k].up[l] < self.y_stack[i+1].up[j]) and (self.y_stack[k].up[l] > self.y_stack[i+1].down[j]): #print("pass 1") edge -= (self.y_stack[k].up[l] - self.y_stack[i+1].down[j]) elif (self.y_stack[k].down[l] >= self.y_stack[i+1].down[j]) and (self.y_stack[k].up[l] <= self.y_stack[i+1].up[j]): #print("pass 2") edge -= (self.y_stack[k].up[l] - self.y_stack[k].down[l]) elif (self.y_stack[k].down[l] > self.y_stack[i+1].down[j]) and (self.y_stack[k].up[l] >= self.y_stack[i+1].up[j]) and (self.y_stack[k].down[l] < self.y_stack[i+1].up[j]): #print("pass 3") edge -= (self.y_stack[i+1].up[j] - self.y_stack[k].down[l]) elif (self.y_stack[k].down[l] <= self.y_stack[i+1].down[j]) and (self.y_stack[k].up[l] >= self.y_stack[i+1].up[j]): #print("pass 4") edge -= (self.y_stack[i+1].up[j] - self.y_stack[i+1].down[j]) one_shuui += edge #print("one shuui:"+str(one_shuui)) shuui += one_shuui #print("shuui: "+str(shuui)) print(str(shuui)) class One_Column: def __init__(self, x, up=None, down=None): self.x = x self.up = [up] self.down = [down] def add(self, up, down): append_flag =True for i in range(len(self.up)): if (down <= self.down[i]) and (up >= self.up[i]): del self.down[i] del self.up[i] elif (down < self.down[i]) and (up >= self.down[i]): self.down[i] = down append_flag =False elif (down <= self.up[i]) and (up > self.up[i]): self.up[i] = up append_flag = False elif (down >= self.down[i]) and (up <= self.up[i]): append_flag = False if append_flag: self.up.append(up) self.down.append(down) self.up.sort() self.down.sort() flag =False #for line in open("input.txt","r"): while(1): line = input() line = line.rstrip("\n") #print(line) line_list = line.split(" ") if(len(line_list) == 2): if flag: if option == 1: all_col.calc_menseki() elif option == 2: all_col.calc_menseki() all_col.calc_shuui() if (line_list[0] == "0") and (line_list[1] == "0"): break flag = True all_col = All_Column(int(line_list[0])) option = int(line_list[1]) elif(len(line_list) == 4): for i in range(int(line_list[0]), int(line_list[2])): # x1 ~ x2 all_col.add(int(i), int(line_list[3]), int(line_list[1])) # up = y2, down = y1
Traceback (most recent call last): File "/tmp/tmpf3ko8hdy/tmpex55cqsh.py", line 87, in <module> line = input() ^^^^^^^ EOFError: EOF when reading a line
s359742594
p00432
u846136461
1514197262
Python
Python
py
Runtime Error
0
0
516
# coding: utf-8 field = [] for i in range(99): line = [] for j in range(99): line.append(0) field.append(line) while True: n, r = map(int, raw_input().split()) if n == 0: break else: for _ in range(n): data = map(int, raw_input().split()) x_start = data[0] y_start = data[1] x_end = data[2] y_end = data[3] for i in range(x_start, x_end): for j in range(y_start, y_end): field[i][j] = 1 s = 0 for i in range(len(field)): s += sum(field[i]) if r == 1: print(s)
Traceback (most recent call last): File "/tmp/tmpgt16coil/tmpy71xgrx6.py", line 11, in <module> n, r = map(int, raw_input().split()) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s391148490
p00432
u599161451
1362030742
Python
Python
py
Runtime Error
19920
211212
1608
#!/usr/bin/python def readints(line): return map(int, line.split()) def mark(d, p): m = d.get(p, 0) d[p] = m + 1 def chunker(f): while True: line = f.readline() n, r = readints(line) if n == 0 and r == 0: raise StopIteration tiles = set() v_test = set() h_test = set() for i in range(n): line = f.readline() lbx, lby, rtx, rty = readints(line) w = rtx - lbx h = rty - lby for x in range(lbx, rtx): for y in range(lby, rty): tiles.add((x,y)) for x in range(lbx-1, rtx): v_test.add((x, rty-1)) v_test.add((x, lby-1)) for y in range(lby-1, rty): h_test.add((lbx-1, y)) h_test.add((rtx-1, y)) area = len(tiles) if r == 1: yield area, elif r == 2: edge = 0 for x, y in v_test: p = x, y q = x, y+1 if p in tiles and q not in tiles or p not in tiles and q in tiles: edge += 1 for x, y in h_test: p = x, y q = x+1, y if p in tiles and q not in tiles or p not in tiles and q in tiles: edge += 1 yield area, edge import sys for ans in chunker(sys.stdin): if len(ans) == 1: print ans[0] elif len(ans) == 2: print ans[0] print ans[1] else: pass
File "/tmp/tmp243wgsk4/tmpex1817wm.py", line 59 print ans[0] ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s457581368
p00433
u814278309
1559224779
Python
Python3
py
Runtime Error
0
0
150
while True: a,b,c,d=map(int,input().split()) e,f,g,h=map(int,input().split()) x=a+b+c+d y=e+f+g+h if x<y: print(y) else: print(x)
Traceback (most recent call last): File "/tmp/tmpvipan5un/tmp5ugvkwup.py", line 2, in <module> a,b,c,d=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s876651820
p00433
u814278309
1559224812
Python
Python3
py
Runtime Error
0
0
151
while True: a,b,c,d=map(int,input().split()) e,f,g,h=map(int,input().split()) x=a+b+c+d y=e+f+g+h if x<=y: print(y) else: print(x)
Traceback (most recent call last): File "/tmp/tmpxr4140ny/tmp3qmm59qt.py", line 2, in <module> a,b,c,d=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s011850113
p00433
u340500592
1499407104
Python
Python3
py
Runtime Error
0
0
98
A = list(map(input().split()) B = list(map(input().split()) max = max([max(A), max(B)]) print(max)
File "/tmp/tmp_025aq5q/tmplhygulyc.py", line 1 A = list(map(input().split()) ^^^^^^^^^^^^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?
s025754458
p00433
u340500592
1499407143
Python
Python3
py
Runtime Error
0
0
100
A = list(map(input().split())) B = list(map(input().split())) max = max([max(A), max(B)]) print(max)
Traceback (most recent call last): File "/tmp/tmpiq9r6z_c/tmpokqgrg68.py", line 1, in <module> A = list(map(input().split())) ^^^^^^^ EOFError: EOF when reading a line
s148029152
p00433
u256256172
1508404461
Python
Python3
py
Runtime Error
0
0
80
a = map(int, input().split()) b = map(int, input().split()) print(max(sum(a,b)))
Traceback (most recent call last): File "/tmp/tmpa0yhwjd1/tmplqyr_7o8.py", line 1, in <module> a = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s031809613
p00433
u915761101
1357141530
Python
Python
py
Runtime Error
0
0
170
magro = 0 saba = [] saba=map(int,raw_input().split(‘ ‘)) #print(“ika”) ika=map(int,raw_input().split(‘ ‘)) print(max(sum(saba), sum(ika))) neko = 0 hage = 90
File "/tmp/tmpamrm25gj/tmp3d_4_zw5.py", line 4 saba=map(int,raw_input().split(‘ ‘)) ^ SyntaxError: invalid character '‘' (U+2018)
s681868785
p00433
u604412493
1377610160
Python
Python
py
Runtime Error
0
0
449
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ //$fp = fopen("input.txt", "r"); $fp = fopen("php://stdin", "r"); $str = explode(" ", rtrim(fgets($fp))); $sum_a = 0; for($i = 0; $i < 4; $i++) { $sum_a += (int)($str[$i]); } $str = explode(" ", rtrim(fgets($fp))); $sum_b = 0; for($i = 0; $i < 4; $i++) { $sum_b += (int)($str[$i]); } echo $sum_a > $sum_b ? $sum_a : $sum_b . "\n"; ?>
File "/tmp/tmpwna0v9h8/tmp4s0j0qvn.py", line 1 <?php ^ SyntaxError: invalid syntax
s399389804
p00433
u180584272
1379908308
Python
Python
py
Runtime Error
0
0
104
from sys import stdin print max(map(sum,map(lambda s: map(int,s.split(' ')), stdin.read().split('\n'))))
File "/tmp/tmpkq71ga_f/tmpchg29rkv.py", line 2 print max(map(sum,map(lambda s: map(int,s.split(' ')), stdin.read().split('\n')))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s506265126
p00433
u229085388
1391313053
Python
Python
py
Runtime Error
0
0
125
a = sum(map(int, input().split())) b = sum(map(int, input().split())) print (max(a,b))
Traceback (most recent call last): File "/tmp/tmp2txjk7zt/tmpv1xmos1j.py", line 1, in <module> a = sum(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s131634179
p00433
u633068244
1395076924
Python
Python
py
Runtime Error
0
0
90
s = sum(map(int, raw_input().split()) t = sum(map(int, raw_input().split()) print max(s,t)
File "/tmp/tmp__mdm3c2/tmp5zaz234z.py", line 1 s = sum(map(int, raw_input().split()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?
s915608709
p00434
u811773570
1475423262
Python
Python3
py
Runtime Error
0
0
150
a = [False for i in range(31)] for i in range(30): x = int(input()) a[x] = True for i in range(1, 30): if a[i] == False: print(i)
Traceback (most recent call last): File "/tmp/tmppccbk6gy/tmpzns9h706.py", line 4, in <module> x = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s602690473
p00434
u662488567
1480607875
Python
Python3
py
Runtime Error
0
0
119
students = list(range(30)) [students.remove(int(input())) for _ in range(28)] [print(student) for student in students]
Traceback (most recent call last): File "/tmp/tmpnuaiyoxu/tmp8u29s85m.py", line 2, in <module> [students.remove(int(input())) for _ in range(28)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpnuaiyoxu/tmp8u29s85m.py", line 2, in <listcomp> [students.remove(int(input())) for _ in range(28)] ^^^^^^^ EOFError: EOF when reading a line
s516427086
p00434
u147801965
1375165948
Python
Python
py
Runtime Error
0
0
98
c=0 for i,j in enumerate(sorted([input() for i in range(30)])): c+=1 if c!=j:print c ;c+=1
File "/tmp/tmp41x99v9n/tmpjiw6e5o5.py", line 4 if c!=j:print c ;c+=1 ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s157381340
p00434
u350508326
1392653129
Python
Python
py
Runtime Error
0
0
162
data = [x + 1 for x in xrange(30)] # print(data) for i in xrange(30): a = int(raw_input()) data.remove(a) # print(data) for i in data: print(i)
Traceback (most recent call last): File "/tmp/tmpsxt62qi1/tmpvyfvq8g7.py", line 1, in <module> data = [x + 1 for x in xrange(30)] ^^^^^^ NameError: name 'xrange' is not defined. Did you mean: 'range'?
s561461607
p00434
u633068244
1395077246
Python
Python
py
Runtime Error
0
0
121
ref = set[i for i in range(1,31)] for i in range(28): ls.append(i) print "".join(map(str, sorted(list(ref-set(ls)))))
File "/tmp/tmpymxoj0q4/tmp1rngwq92.py", line 1 ref = set[i for i in range(1,31)] ^^^ SyntaxError: invalid syntax
s619496977
p00434
u633068244
1395077684
Python
Python
py
Runtime Error
0
0
108
ref = [i for i in range(1,31)] for i in range(28): ref.pop(int(raw_input())-1) for i in ref: print i
File "/tmp/tmpprahy7hb/tmpzhs7habn.py", line 5 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s079789536
p00435
u436259757
1540874948
Python
Python3
py
Runtime Error
0
0
203
x = input() str_list = list(x) dict_ = { } for a in str_list: if ord(a) - 3 < 65: print(chr(90 - 65 - ord(a) - 3) ,end = "") else: print(chr(ord(a) - 3) ,end = "") print()
Traceback (most recent call last): File "/tmp/tmp8fndkxrh/tmp6efwann_.py", line 1, in <module> x = input() ^^^^^^^ EOFError: EOF when reading a line
s400174153
p00435
u855694108
1506840483
Python
Python3
py
Runtime Error
0
0
347
def main(): d = list(input()) alp = [chr(i) for i in range(65, 65 + 26)] for x in range(len(d)): idx = alp.index(d[x]) - 3 if idx < 0: idx = 26 - idx else: pass d[x] = alp[idx] ans = "" for x in d: ans += x print(ans) if __name__ == "__main__": main()
Traceback (most recent call last): File "/tmp/tmpafpxl4v2/tmpdtlp6eju.py", line 20, in <module> main() File "/tmp/tmpafpxl4v2/tmpdtlp6eju.py", line 2, in main d = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s709109573
p00435
u855694108
1506840584
Python
Python3
py
Runtime Error
0
0
347
def main(): d = list(input()) alp = [chr(i) for i in range(65, 65 + 26)] for x in range(len(d)): idx = alp.index(d[x]) - 3 if idx < 0: idx = 26 - idx else: pass d[x] = alp[idx] ans = "" for x in d: ans += x print(ans) if __name__ == "__main__": main()
Traceback (most recent call last): File "/tmp/tmp4q3ncydr/tmpgx7c9m2_.py", line 20, in <module> main() File "/tmp/tmp4q3ncydr/tmpgx7c9m2_.py", line 2, in main d = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s552226413
p00435
u633068244
1397317793
Python
Python
py
Runtime Error
0
0
116
dic="ABCDEFGHIJKLMNOPQRSTUVWXYZ" code=raw_input() ans="" for w in code: ans+=dic[(dic.index(w)+24)%27] print ans
File "/tmp/tmp5k7h4j38/tmpv6y69wje.py", line 6 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s027047566
p00436
u545973195
1475153439
Python
Python3
py
Runtime Error
0
0
289
import copy n=int(input()) m=int(input()) card=[i for i in range(2n+1)] sub=[] for i in range(m): move=int(input()) if move!=0: sub+=card[k:] sub+=card[:k] else: for i in range(n+1): sub+=card[i] sub+=card[n+i] card=copy.deepcopy(sub) for i in range(2n+1): print(card[i])
File "/tmp/tmpwmk8rk54/tmp313shmr3.py", line 4 card=[i for i in range(2n+1)] ^ SyntaxError: invalid decimal literal
s042965869
p00436
u545973195
1475153619
Python
Python3
py
Runtime Error
0
0
287
import copy n=int(input()) m=int(input()) card=[i for i in range(1,2n+1)] sub=[] for i in range(m): move=int(input()) if move!=0: sub+=card[k:] sub+=card[:k] else: for j in range(n): sub+=card[j] sub+=card[n+j] card=copy.deepcopy(sub) for i in range(2n): print(card[i])
File "/tmp/tmp8vfztaov/tmpb_sfw0vl.py", line 4 card=[i for i in range(1,2n+1)] ^ SyntaxError: invalid decimal literal
s031462071
p00436
u545973195
1475153794
Python
Python3
py
Runtime Error
0
0
323
import copy n=int(input()) m=int(input()) card=[i for i in range(1,2n+1)] sub=[] for i in range(m): move=int(input()) if move!=0: sub.append(card[k:]) sub.append(card[:k]) else: for j in range(n): sub.append(card[j]) sub.append(card[n+j]) card=copy.deepcopy(sub) sub=[] for i in range(2n): print(card[i])
File "/tmp/tmpdgyk8yqd/tmp9ywu730j.py", line 4 card=[i for i in range(1,2n+1)] ^ SyntaxError: invalid decimal literal
s407324175
p00436
u633068244
1395078493
Python
Python
py
Runtime Error
0
0
317
n = int(raw_input()) deck = [i for i in range(1,2*n+1)] m = int(raw_input()) for i in range(m): k = int(raw_input()) if k == 0: deck1 = [] for j in range(n): deck1 += deck[i]+deck[n+i] deck = deck1 elif: deck = deck[k+1:]+deck[:k+1] for i in deck: print deck
File "/tmp/tmpv48u_cx9/tmpj2k4prpa.py", line 11 elif: ^ SyntaxError: invalid syntax
s624432675
p00437
u811434779
1440132709
Python
Python
py
Runtime Error
0
0
770
while True: l = map(int, raw_input().split()) if l[0]==0 and l[1]==0 and l[2]==0: break n = l[0]+l[1]+l[2] s = [] #????¨???? a = set(range(n)) #?????? b = set() #?£???? c = set() #??£??? for i in range(input()): x, y, z, r = map(int, raw_input().split()) x-=1;y-=1;z-=1; if r==0: s.append(set([x,y,z])) else: c.add(x);c.add(y);c.add(z); while True: f = True for lst in s: if len(lst & c) >=2: s.remove(lst) lst = lst - c b.add(lst.pop()) f = False if f : break a = a - b; a = a - c; for i in range(n): if i in a: print 2 elif i in b: print 0 else: print 1
File "/tmp/tmpedp54ljf/tmpn7msacq5.py", line 26 if i in a: print 2 ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s574281187
p00437
u811434779
1440133712
Python
Python
py
Runtime Error
0
0
786
while True: l = map(int, raw_input().split()) if l[0]==0 and l[1]==0 and l[2]==0: break n = l[0]+l[1]+l[2] s = [] #????¨???? a = set(range(n)) #?????? b = set() #?£???? c = set() #??£??? for i in range(input()): x, y, z, r = map(int, raw_input().split()) x-=1;y-=1;z-=1; if r==0: s.append(set([x,y,z])) else: c.add(x);c.add(y);c.add(z); while True: f = True for lst in s: if len(lst & c) >=2: s.remove(lst) lst = lst - c if len(lst)>=1: b.add(lst.pop()) f = False if f : break a = a - b; a = a - c; for i in range(n): if i in a: print 2 elif i in b: print 0 else: print 1
File "/tmp/tmp8o49mxz2/tmphbuwa2rz.py", line 26 if i in a: print 2 ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s285244364
p00437
u797673668
1477043063
Python
Python3
py
Runtime Error
0
0
652
while True: m = sum(map(int, input().split())) n = int(input()) fixed = [2] * m failures = [] for _ in range(n): i, j, k, r = map(int, input().split()) i, j, k = (x - 1 for x in (i, j, k)) if r: fixed[i] = fixed[j] = fixed[k] = 1 else: failures.append((i, j, k)) for i, j, k in failures: fi, fj, fk = (fixed[x] for x in (i, j, k)) if fi == 1: if fj == 1: fixed[k] = 0 elif fk == 1: fixed[j] = 0 elif fj == 1 and fk == 1: fi = 0 print('\n'.join(str(x) for x in fixed) + '\n')
Traceback (most recent call last): File "/tmp/tmpyyrsd814/tmp6bb9js6d.py", line 2, in <module> m = sum(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s027212428
p00438
u835866094
1412110722
Python
Python
py
Runtime Error
0
0
1221
#coding:utf-8 import sys import copy def main(): line = sys.stdin.readline() #case while line.split() != ["0","0"]: analy(line) line = sys.stdin.readline() return def analy(line): #t field = [int(n) for n in line.split()] # *& num = int(sys.stdin.readline()) data = [] for i in range(num): a = sys.stdin.readline() b = [int(n) for n in a.split()] #*& data.append(b) print (compute(field, data)) def compute(field, ng): list = [] for i in range(field[1]): for j in range(field[0]): #*?&k??WfDO if i == 0 : #j if [j+1,i+1] in ng: list.append(0) elif j == 0: #?LjD list.append(1) else: list.append(list[j-1]) else: if [j+1,i+1] in ng: list[j] = 0 elif j != 0: #no left >> the same. list[j] = list[j-1] + list[j] return list[len(list)-1] if __name__ == "__main__": main()
File "/tmp/tmptyajwerz/tmpokqzypw6.py", line 33 # SyntaxError: source code cannot contain null bytes
s550345253
p00438
u835866094
1412139640
Python
Python
py
Runtime Error
0
0
1231
#coding:utf-8 import sys import copy def main(): line = sys.stdin.readline() #case while line.split() != ["0","0"]: analy(line) line = sys.stdin.readline() return def analy(line): #t field = [int(n) for n in line.split()] # *& num = int(sys.stdin.readline()) data = [] for i in range(num): a = sys.stdin.readline() b = [int(n) for n in a.split()] #*& data.append(b) print (compute(field, data)) def compute(field, ng): list = [] for i in range(field[1]): for j in range(field[0]): #*?&k??WfDO if i == 0 : #j if [j+1,i+1] in ng: list.append(0) elif j == 0: #?LjD list.append(1) else: list.append(list[j-1]) else: if [j+1,i+1] in ng: list[j] = 0 elif j != 0: #no left >> the same. list[j] = list[j-1] + list[j] return list[len(list)-1] if __name__ == "__main__": main()
File "/tmp/tmp_7k292x5/tmphirnmf0f.py", line 33 # SyntaxError: source code cannot contain null bytes
s697916746
p00438
u835866094
1412410078
Python
Python
py
Runtime Error
0
0
1231
#coding:utf-8 import sys import copy def main(): line = sys.stdin.readline() #case while line.split() != ["0","0"]: analy(line) line = sys.stdin.readline() return def analy(line): #t field = [int(n) for n in line.split()] # *& num = int(sys.stdin.readline()) data = [] for i in range(num): a = sys.stdin.readline() b = [int(n) for n in a.split()] #*& data.append(b) print (compute(field, data)) def compute(field, ng): list = [] for i in range(field[1]): for j in range(field[0]): #*?&k??WfDO if i == 0 : #j if [j+1,i+1] in ng: list.append(0) elif j == 0: #?LjD list.append(1) else: list.append(list[j-1]) else: if [j+1,i+1] in ng: list[j] = 0 elif j != 0: #no left >> the same. list[j] = list[j-1] + list[j] return list[len(list)-1] if __name__ == "__main__": main()
File "/tmp/tmp03jqty4b/tmpn_kg6ha3.py", line 33 # SyntaxError: source code cannot contain null bytes
s267288604
p00438
u260980560
1385397377
Python
Python
py
Runtime Error
0
0
490
p = [[0 for i in xrange(16)] for j in xrange(16)] while 1: a,b = map(int, raw_input().split()) if a==b==0: break n = input() for i in xrange(b): for j in xrange(a): p[i][j] = 0 for i in xrange(n): x,y = map(int, raw_input().split()) p[y-1][x-1] = -10**6 p[0][0] = 1 for i in xrange(b): for j in xrange(a): if p[i][j]<0: continue p[i+1][j] += p[i][j]; p[i][j+1] += p[i][j]; print p[b-1][a-1]
File "/tmp/tmpne6a1_90/tmplpphf41m.py", line 17 print p[b-1][a-1] ^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s563912364
p00439
u921038488
1555836116
Python
Python3
py
Runtime Error
0
0
386
from itertools import accumulate # 区間[N-k, N) の総和の最大値 while True: n, k = map(int, input().split(" ")) if n == 0: break a_n = [int(input()) for _ in range(n)] _ = input() a_n = list(accumulate(a_n)) # print(a_n) result = -99999999999999 for i in range(n-k): val = a_n[k+i] - a_n[i] if result < val: result = val print(result)
Traceback (most recent call last): File "/tmp/tmp_zwktzj3/tmpz2ul71fd.py", line 6, in <module> n, k = map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s036247740
p00439
u921038488
1555836180
Python
Python3
py
Runtime Error
0
0
383
from itertools import accumulate # 区間[N-k, N) の総和の最大値 while True: n, k = map(int, input().split()) if n == 0: break a_n = [int(input()) for _ in range(n)] _ = input() a_n = list(accumulate(a_n)) # print(a_n) result = -99999999999999 for i in range(n-k): val = a_n[k+i] - a_n[i] if result < val: result = val print(result)
Traceback (most recent call last): File "/tmp/tmptbxxjcjy/tmpvine8y5n.py", line 6, in <module> n, k = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s801955022
p00439
u094029895
1555857974
Python
Python3
py
Runtime Error
0
0
282
n = int(input()) k = int(input()) l = list(map(int, input().split())) L=[] for i in range(n): if(i == 0): L.append(0) L.append(l[i]) else: L.append(L[i]+l[i]) ans=0 for i in range(n-k+1): tmp = L[i+k] - L[i] ans = max(ans, tmp) print(ans)
Traceback (most recent call last): File "/tmp/tmpe1va2ig1/tmp25lwo0dp.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s413887028
p00439
u060839454
1556534261
Python
Python
py
Runtime Error
0
0
351
while True: a, b = map(int, input().split(" ")) if a == 0 & b == 0: break li1 = [] for i in range(0, a): li1.append(int(input())) max = 0 for n in range(0, a + 1 - b): sum = 0 for n1 in range(n, n + b): sum = sum + li1[n1] if max < sum: max = sum print(sum)
Traceback (most recent call last): File "/tmp/tmpm6jf4qku/tmp5rsmjy_8.py", line 2, in <module> a, b = map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s516223765
p00439
u134812425
1559175670
Python
Python3
py
Runtime Error
0
0
1417
#!/usr/bin/env python import string import sys from itertools import chain, dropwhile, takewhile def read( *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace) ): def read_word(): w = lambda c: c in whitespaces nw = lambda c: c not in whitespaces return f("".join(takewhile(nw, dropwhile(w, it)))) if not shape: return read_word() elif len(shape) == 1: return [read_word() for _ in range(shape[0])] elif len(shape) == 2: return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])] def readi(*shape): return read(*shape) def readi1(*shape): return [i - 1 for i in read(*shape)] def readf(*shape): return read(*shape, f=float) def reads(*shape): return read(*shape, f=str) def arr(*shape, fill_value=0): if len(shape) == 1: return [fill_value] * shape[fill_value] elif len(shape) == 2: return [[fill_value] * shape[1] for _ in range(shape[0])] def dbg(**kwargs): print( ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()), file=sys.stderr, ) def main(): n, k = readi(2) a = readi(n) tmp = sum(a[:k]) ans = tmp dbg(tmp=tmp) for i in range(k, len(a)): tmp += a[i] - a[i - k] ans = max(ans, tmp) dbg(tmp=tmp) print(ans) if __name__ == "__main__": main()
Traceback (most recent call last): File "/tmp/tmpsms8sfjx/tmp4gae90yw.py", line 67, in <module> main() File "/tmp/tmpsms8sfjx/tmp4gae90yw.py", line 54, in main n, k = readi(2) ^^^^^^^^ File "/tmp/tmpsms8sfjx/tmp4gae90yw.py", line 24, in readi return read(*shape) ^^^^^^^^^^^^ File "/tmp/tmpsms8sfjx/tmp4gae90yw.py", line 18, in read return [read_word() for _ in range(shape[0])] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpsms8sfjx/tmp4gae90yw.py", line 18, in <listcomp> return [read_word() for _ in range(shape[0])] ^^^^^^^^^^^ File "/tmp/tmpsms8sfjx/tmp4gae90yw.py", line 13, in read_word return f("".join(takewhile(nw, dropwhile(w, it)))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s527754153
p00439
u476702877
1559176787
Python
Python3
py
Runtime Error
0
0
354
def func(n,k): A = [] ans = 0 for i in range(n): A.append(int(input())) for i in range(k-1): SUM += A[i] for i in range(k,len(a)): ans = max(ans,SUM+a[i]-a[i-k]) print(ans) for i in range(100): n,k = [int(s) for s in input().split()] if n == 0 and k ==0: break else: func(n,k)
Traceback (most recent call last): File "/tmp/tmpmgjfo_p3/tmpnkl50_0w.py", line 13, in <module> n,k = [int(s) for s in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s456141895
p00439
u476702877
1559176911
Python
Python3
py
Runtime Error
0
0
366
def func(n,k): A = [] ans = 0 SUM = 0 for i in range(n): A.append(int(input())) for i in range(k-1): SUM += A[i] for i in range(k,len(a)): ans = max(ans,SUM+a[i]-a[i-k]) print(ans) for i in range(100): n,k = [int(s) for s in input().split()] if n == 0 and k ==0: break else: func(n,k)
Traceback (most recent call last): File "/tmp/tmp_7p0m7vz/tmp2i_j4h_1.py", line 14, in <module> n,k = [int(s) for s in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s934489431
p00439
u476702877
1559177387
Python
Python3
py
Runtime Error
0
0
342
def func(n,k): SUM = 0 A = [int(input()) for _ in range(n)] for i in range(k-1): SUM += A[i] ans = SUM for i in range(k,len(A)): ans = max(ans,SUM+A[i]-A[i-k]) print(ans) for _ in range(10) n,k = [int(s) for s in input().split()] if n == 0 and k ==0: break else: func(n,k)
File "/tmp/tmpi76gvo1d/tmpydf4jao1.py", line 11 for _ in range(10) ^ SyntaxError: expected ':'
s221122542
p00439
u476702877
1559177468
Python
Python3
py
Runtime Error
0
0
370
def func(n,k): SUM = 0 ans = 0 A = [int(input()) for _ in range(n)] for i in range(k-1): SUM += A[i] for i in range(k,len(A)): ans = max(ans,SUM+A[i]-A[i-k]) SUM = SUM+A[i]-A[i-k] print(ans) for _ in range(10) n,k = [int(s) for s in input().split()] if n == 0 and k ==0: break else: func(n,k)
File "/tmp/tmpjbmtaeb_/tmpb84dz831.py", line 12 for _ in range(10) ^ SyntaxError: expected ':'
s248963734
p00439
u662488567
1480610577
Python
Python3
py
Runtime Error
0
0
689
while 1: n, k = (int(x) for x in input().split()) if n == 0: break max_num = -30001 queue = list() for _ in range(k): queue.append(int(input())) max_num = sum(queue) queue.pop(0) for _ in range(n - k): queue.append(int(input())) max_num = max(sum(queue), max_num) queue.pop(0) print(max_num)
File "/tmp/tmpi1hr1k03/tmpdsc96rrk.py", line 1 while 1: IndentationError: unexpected indent
s642077639
p00439
u662488567
1480610636
Python
Python3
py
Runtime Error
0
0
689
while 1: n, k = (int(x) for x in input().split()) if n == 0: break max_num = -30001 queue = list() for _ in range(k): queue.append(int(input())) max_num = sum(queue) queue.pop(0) for _ in range(n - k): queue.append(int(input())) max_num = max(sum(queue), max_num) queue.pop(0) print(max_num)
File "/tmp/tmpgb4jgcba/tmpagwv8nvh.py", line 1 while 1: IndentationError: unexpected indent
s281521384
p00439
u563075864
1526220375
Python
Python3
py
Runtime Error
0
0
296
while 1: n,k = [int(i) for i in input().split()] if not n and k: break a = [int(input()) for i in range(n)] b = [0]*len(a) for i in range(n): b[i] = b[i-1] + a[i] b = b + [0] c = [b[i + k - 1] - b[i - 1] for i in range(n - k + 1)] print(max(c))
Traceback (most recent call last): File "/tmp/tmpxpbediw4/tmpbbs_kyyd.py", line 2, in <module> n,k = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s607792502
p00439
u104911888
1367649853
Python
Python
py
Runtime Error
0
0
309
#include <stdio.h> int main(){ int i,n,k,s; while (1){ int ma=0; scanf("%d %d",&n,&k); if (n==0 && k==0)break; int a[n]; for (i=0;i<n;i++) scanf("%d",&a[i]); for (i=0;i<n-2;i++){ s=a[i]+a[i+1]+a[i+2]; if (s>ma) ma=s; } printf("%d\n",ma); } return 0; }
File "/tmp/tmpscgx_k5m/tmp6tne049r.py", line 2 int main(){ ^^^^ SyntaxError: invalid syntax
s162002008
p00439
u238820099
1386399073
Python
Python
py
Runtime Error
0
0
232
L = [x for x in open('input.txt', 'r')] n = int(L[0].split(' ')[0]) k = int(L[0].split(' ')[1]) L = map(int, L[1:]) max = 0 for x in range(1,n-(k-1)): if max < sum(L[x:x+k]): max = sum(L[x:x+3]) print max
File "/tmp/tmpwebnel9d/tmpewi09yi_.py", line 13 print max ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s566093507
p00439
u238820099
1386400291
Python
Python
py
Runtime Error
0
0
425
import sys f = open('input.txt','w') while 1: line = raw_input() if line == '0 0': break f.write(line) f.write('\n') f.close() L = [x for x in open('input.txt', 'r') if x != "0 0"] n = int(L[0].split(' ')[0]) k = int(L[0].split(' ')[1]) L = map(int, L[1:]) max = 0 for x in range(1,n-(k-1)): if max < sum(L[x:x+k]): max = sum(L[x:x+3]) print max
File "/tmp/tmp_t70jakn/tmpht9eo4sv.py", line 26 print max ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s785175827
p00439
u238820099
1386400766
Python
Python
py
Runtime Error
0
0
469
import sys f = open('input.txt','w') while 1: line = raw_input() if line == '0 0': f.write(line) break f.write(line) f.write('\n') f.close() L = [x for x in open('input.txt', 'r')] L[0].split(' ') n = int(L[0].split(' ')[0]) k = int(L[0].split(' ')[1]) L = L[:-1] L = map(int, L[1:]) max = 0 for x in range(1,n-(k-1)): if max < sum(L[x:x+k]): max = sum(L[x:x+3]) print max
File "/tmp/tmpfwyjv2u8/tmpc1_r8s8f.py", line 30 print max ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s224692267
p00439
u238820099
1386401274
Python
Python
py
Runtime Error
0
0
457
f = open('input.txt','w') while 1: line = raw_input() if line == '0 0': f.write(line) break f.write(line) f.write('\n') f.close() L = [x for x in open('input.txt', 'r')] L[0].split(' ') n = int(L[0].split(' ')[0]) k = int(L[0].split(' ')[1]) L = L[:-1] L = map(int, L[1:]) max = 0 for x in range(1,n-(k-1)): if max < sum(L[x:x+k]): max = sum(L[x:x+3]) print max
File "/tmp/tmpv7ldrpjw/tmpxl977iku.py", line 28 print max ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s532137928
p00440
u316268279
1430136373
Python
Python
py
Runtime Error
0
0
795
#!/usr/bin/env python # -*- coding: utf-8 -*- while True: N,K = map(int,raw_input().split()) A = sorted([int(rraw_input()) for i in range(0,K)]) if (N,K) == (0,0): break if A[0] == 0: flag = True A = A[1:] K -= 1 else: flag = False diff = [] ans = 0 prev = 0 prev_prev = 0 count = 0 for i in range(1,K): if A[i] - A[i-1] == 1: count += 1 ans = max(ans,count-prev_prev) elif A[i] - A[i-1] == 2: if flag is True: count += 1 ans = max(ans,count-prev_prev) prev_prev = prev prev = count - prev else: count = 0 else: count = 0 print(ans + A[0])
Traceback (most recent call last): File "/tmp/tmpr20alhkq/tmp3n3ob1f8.py", line 5, in <module> N,K = map(int,raw_input().split()) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s443604798
p00440
u847467233
1530313695
Python
Python3
py
Runtime Error
0
0
424
# AOJ 0517: Longest Steps # Python3 2018.6.30 bal4u while True: n, k = map(int, input().split()) if n == 0: break c = [0]*(n+1) f = 0; for i in range(k): a = int(input()) if a == 0: f = 1 else: c[a] = 1 ans = w0 = w = 0 for i in range(1, n+1): if c[i]: w += 1 elif w > 0: if w0 + w + f > ans: ans = w0 + w + f w0 = w if f and c[i+1] else 0 w = 0 if w0 + w + f > ans: ans = w0 + w + f print(ans)
Traceback (most recent call last): File "/tmp/tmp7uk3t_ko/tmpx37j2jhj.py", line 5, in <module> n, k = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s053887838
p00440
u633068244
1399240376
Python
Python
py
Runtime Error
0
0
323
while 1: n,k = map(int,raw_input().split()) if n == 0: break s = [0]*(n+1) c = sorted([int(raw_input()) for i in range(k)]) p = min(0,C[0]) pre = 0 for i in c[p:]: s[i] = s[i-1] + 1 if p and s[i-1] == 0: if s[i-2]: s[i] += s[i-2] + 1 - pre pre = s[i-2] + 1 if s[i-2] == 0: pre = 0 print max(s)
File "/tmp/tmpa6e_wb9b/tmpgmx8anyt.py", line 16 print max(s) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s752628273
p00441
u352394527
1526289204
Python
Python3
py
Runtime Error
0
0
486
points = [[False for i in range(5001)] for j in range(5001)] ps = [] for i in range(n): x, y = map(int,input().split()) points[x][y] = True ps.append((x,y)) ans = 0 for i in range(n): for j in range(n): p1 = ps[i] p2 = ps[j] vx = p2[0] - p1[0] vy = p2[1] - p1[1] p3 = p1[0] + vy, p1[1] - vx if points[p1[0] + vy][p1[1] - vx] and points[p2[0] + vy][p2[1] - vx]: ans = max(ans, vx ** 2 + vy ** 2) print(ans)
File "/tmp/tmpo77iut4z/tmp35t3wsey.py", line 1 points = [[False for i in range(5001)] for j in range(5001)] IndentationError: unexpected indent
s649994467
p00441
u352394527
1526289531
Python
Python3
py
Runtime Error
0
0
699
def main(): while True: n = int(input()) if not n: break points = [[False for i in range(5001)] for j in range(5001)] ps = [] for i in range(n): x, y = map(int,input().split()) points[x][y] = True ps.append((x,y)) ans = 0 for i in range(n): for j in range(n): p1 = ps[i] p2 = ps[j] vx = p2[0] - p1[0] vy = p2[1] - p1[1] if 0 <= p1[0] + vy <= 5000 and 0 <= p1[1] - vx <= 5000 and 0 <= p2[0] + vy <= 5000 and 0 <= p2[1] - vx <= 5000: if points[p1[0] + vy][p1[1] - vx] and points[p2[0] + vy][p2[1] - vx]: ans = max(ans, vx ** 2 + vy ** 2) print(ans) main()
Traceback (most recent call last): File "/tmp/tmpa4t2q7nv/tmpbjzgqze0.py", line 27, in <module> main() ^^^^^^ File "/tmp/tmpa4t2q7nv/tmpbjzgqze0.py", line 3, in main n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s275835153
p00441
u352394527
1526289724
Python
Python3
py
Runtime Error
0
0
699
def main(): while True: n = int(input()) if not n: break points = [[False for i in range(5001)] for j in range(5001)] ps = [] for i in range(n): x, y = map(int,input().split()) points[x][y] = True ps.append((x,y)) ans = 0 for i in range(n): for j in range(n): p1 = ps[i] p2 = ps[j] vx = p2[0] - p1[0] vy = p2[1] - p1[1] if 0 <= p1[0] + vy <= 5000 and 0 <= p1[1] - vx <= 5000 and 0 <= p2[0] + vy <= 5000 and 0 <= p2[1] - vx <= 5000: if points[p1[0] + vy][p1[1] - vx] and points[p2[0] + vy][p2[1] - vx]: ans = max(ans, vx ** 2 + vy ** 2) print(ans) main()
Traceback (most recent call last): File "/tmp/tmpm3nmg046/tmpbugw305c.py", line 27, in <module> main() ^^^^^^ File "/tmp/tmpm3nmg046/tmpbugw305c.py", line 3, in main n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s137514954
p00441
u352394527
1526289726
Python
Python3
py
Runtime Error
0
0
699
def main(): while True: n = int(input()) if not n: break points = [[False for i in range(5001)] for j in range(5001)] ps = [] for i in range(n): x, y = map(int,input().split()) points[x][y] = True ps.append((x,y)) ans = 0 for i in range(n): for j in range(n): p1 = ps[i] p2 = ps[j] vx = p2[0] - p1[0] vy = p2[1] - p1[1] if 0 <= p1[0] + vy <= 5000 and 0 <= p1[1] - vx <= 5000 and 0 <= p2[0] + vy <= 5000 and 0 <= p2[1] - vx <= 5000: if points[p1[0] + vy][p1[1] - vx] and points[p2[0] + vy][p2[1] - vx]: ans = max(ans, vx ** 2 + vy ** 2) print(ans) main()
Traceback (most recent call last): File "/tmp/tmpbp9ops5e/tmph_ic0grf.py", line 27, in <module> main() ^^^^^^ File "/tmp/tmpbp9ops5e/tmph_ic0grf.py", line 3, in main n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s620747055
p00441
u352394527
1526289944
Python
Python3
py
Runtime Error
0
0
748
def main(): points = [[False for i in range(5001)] for j in range(5001)] while True: n = int(input()) if not n: break ps = [] for i in range(n): x, y = map(int,input().split()) points[x][y] = True ps.append((x,y)) ans = 0 for i in range(n): for j in range(n): p1 = ps[i] p2 = ps[j] vx = p2[0] - p1[0] vy = p2[1] - p1[1] if 0 <= p1[0] + vy <= 5000 and 0 <= p1[1] - vx <= 5000 and 0 <= p2[0] + vy <= 5000 and 0 <= p2[1] - vx <= 5000: if points[p1[0] + vy][p1[1] - vx] and points[p2[0] + vy][p2[1] - vx]: ans = max(ans, vx ** 2 + vy ** 2) for p in ps: points[p[0]][p[1]] = False print(ans) main()
Traceback (most recent call last): File "/tmp/tmp49dr_725/tmp9kmkdoup.py", line 30, in <module> main() ^^^^^^ File "/tmp/tmp49dr_725/tmp9kmkdoup.py", line 4, in main n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s096050512
p00441
u604412493
1378127427
Python
Python
py
Runtime Error
20000
7064
910
import sys from copy import deepcopy #fp = open("input.txt", "r") fp = sys.stdin while True: n = int(fp.readline()[:-1]) if n == 0: break li = [] for i in xrange(n): element = map(int, fp.readline()[:-1].split(" ")) li.append(element) ret = 0 for i in xrange(n): element = li.pop(0) cloned = deepcopy(li) for j in xrange(n-1): cloned[j][0] -= element[0] cloned[j][1] -= element[1] cloned[j].append(cloned[j][0]*cloned[j][0]+cloned[j][1]*cloned[j][1]) cloned.sort(key=lambda x:x[2]) for j in xrange(n-2): if cloned[j][2] == cloned[j+1][2]: key = [cloned[j][k]+cloned[j+1][k] for k in xrange(3)] if key in cloned: if cloned[j][2] > ret: ret = cloned[j][2] li.append(element) print ret
File "/tmp/tmpds93fo60/tmpbrdqm0sy.py", line 33 print ret ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s490866206
p00441
u604412493
1378127579
Python
Python
py
Runtime Error
20000
5752
912
import sys #fp = open("input.txt", "r") fp = sys.stdin while True: n = int(fp.readline()[:-1]) if n == 0: break li = [] for i in xrange(n): element = map(int, fp.readline()[:-1].split(" ")) li.append(element) ret = 0 for i in xrange(n): element = li.pop(0) cloned = [li[j][:] for j in xrange(n-1)] for j in xrange(n-1): cloned[j][0] -= element[0] cloned[j][1] -= element[1] cloned[j].append(cloned[j][0]*cloned[j][0]+cloned[j][1]*cloned[j][1]) cloned.sort(key=lambda x:x[2]) for j in xrange(n-2): if cloned[j][2] == cloned[j+1][2]: key = [cloned[j][k]+cloned[j+1][k] for k in xrange(3)] if key in cloned: if cloned[j][2] > ret: ret = cloned[j][2] li.append(element) print ret
File "/tmp/tmpptlj3a8c/tmp4nx6gu3v.py", line 33 print ret ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s643700253
p00441
u633068244
1399293235
Python
Python
py
Runtime Error
0
0
468
p = 50 while 1: n = input() if n == 0: break xy = sorted([map(int,raw_input().split()) for i in range(n)]) x1,y1 = xy[0] xy = sorted(xy, key = lambda XY:(XY[0]-x1)**2 + (XY[1]-y11)**2) ans = 0 for j in range(n-3,0,-1): x2,y2 = xy[j] dx,dy = x2-x1,y2-y1 if [x1-dy,y1-dx] in xy[j+1:j+p] and [x2+dy,y2-dx] in xy[j+1:j+p]: ans = dx**2+dy**2 if [x1-dy,y1+dx] in xy[j+1:j+p] and [x2-dy,y2+dx] in xy[j+1:j+p]: ans = dx**2+dy**2 if ans: break print ans
File "/tmp/tmpoe1y65r8/tmp1xmvmb21.py", line 17 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s607233169
p00441
u633068244
1399295877
Python
Python
py
Runtime Error
0
0
337
while 1: n = input() if n == 0: break xy = [map(int,raw_input().split()) for i in range(n)] S = set(map(tuple,xy)) ans = 0 for i in range(n): x1,y1 = xy[i] for j in range(n-1,i,-1): x2,y2 = xy[j] a = (x2-y2+y1,y2+x2-x1) b = (x1-y2+y1,y1+x2-x1) if a in S and b in S: ans = max((x1-x2)**2 + (y1-y2)**2) print ans
File "/tmp/tmpy_7a5z2u/tmpvaus8vor.py", line 15 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s516049953
p00442
u072053884
1524553221
Python
Python3
py
Runtime Error
20
5620
643
import sys file_input = sys.stdin n = int(file_input.readline()) m = int(file_input.readline()) adj_list = [[] for i in range(n + 1)] for line in file_input: i, j = map(int, line.split()) adj_list[i].append(j) unvisited = [True] * (n + 1) ans = [] def dfs(u): unvisited[u] = False for v in adj_list[u]: if unvisited[v]: dfs(v) ans.append(u) for s in range(1, n + 1): if unvisited[s]: dfs(s) ans.reverse() print(*ans, sep = '\n') # Check whether there is a Hamilton path for s, t in zip(ans, ans[1:]): if t not in adj_list[s]: print(1) break else: print(0)
Traceback (most recent call last): File "/tmp/tmp45g4qa9j/tmp4pfz25mn.py", line 5, in <module> n = int(file_input.readline()) ^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s681167086
p00442
u352394527
1526566850
Python
Python3
py
Runtime Error
20
5624
534
V, E = int(input()), int(input()) L = [] visited = [0 for i in range(V)] edges = [[] for i in range(V)] #flag = 0 def visit(x): # if visited[x] == 1: # flag = 1 if not visited[x]: visited[x] = 1 for e in edges[x]: visit(e) L.insert(0,x) for i in range(E): s, t = map(int,input().split()) edges[s - 1].append(t - 1) for i in range(V): if not visited[i]: visit(i) flag = 0 for i in range(V): print(L[i] + 1) if not flag and i < V - 1 and (L[i + 1] not in edges[L[i]]): flag = 1 print(flag)
Traceback (most recent call last): File "/tmp/tmpxvb95ynd/tmpkavgogaw.py", line 1, in <module> V, E = int(input()), int(input()) ^^^^^^^ EOFError: EOF when reading a line
s617355658
p00442
u352394527
1526566932
Python
Python3
py
Runtime Error
0
0
564
sys.setrecursionlimit(100000) V, E = int(input()), int(input()) L = [] visited = [0 for i in range(V)] edges = [[] for i in range(V)] #flag = 0 def visit(x): # if visited[x] == 1: # flag = 1 if not visited[x]: visited[x] = 1 for e in edges[x]: visit(e) L.insert(0,x) for i in range(E): s, t = map(int,input().split()) edges[s - 1].append(t - 1) for i in range(V): if not visited[i]: visit(i) flag = 0 for i in range(V): print(L[i] + 1) if not flag and i < V - 1 and (L[i + 1] not in edges[L[i]]): flag = 1 print(flag)
Traceback (most recent call last): File "/tmp/tmp9rqh6__5/tmpn9qstcz5.py", line 1, in <module> sys.setrecursionlimit(100000) ^^^ NameError: name 'sys' is not defined
s796994259
p00442
u847467233
1529488778
Python
Python3
py
Runtime Error
0
0
685
# AOJ 0519: Worst Reporter # Python3 2018.6.20 bal4u # トポロジーソート V:総ノード数, to[][]:隣接リスト def topological_sort(V, to): cnt = [0]*V for i in range(V): for j in to[i]: cnt[j] += 1 Q = [] for i in range(V): if cnt[i] == 0: Q.append(i) f = 0 while len(Q) > 0: f |= len(Q) > 1 i = Q[0] del Q[0] print(i+1) # ノードの表示 for k in to[i]: cnt[k] -= 1 if cnt[k] == 0: Q.append(k) return f import fileinput n = int(fileinput.input()) to = [[] for i in range(n)] m = int(fileinput.input()) for i in range(m): a, b = list(map(int, fileinput.input().split())) to[a-1].append(b-1) print(1 if topological_sort(n, to) else 0)
Traceback (most recent call last): File "/tmp/tmpko0cqqj9/tmp0helzej4.py", line 24, in <module> n = int(fileinput.input()) ^^^^^^^^^^^^^^^^^^^^^^ TypeError: int() argument must be a string, a bytes-like object or a real number, not 'FileInput'
s518732952
p00443
u901080241
1489042620
Python
Python3
py
Runtime Error
0
0
1295
import math class Mobile: def __init__(self,leftratio=0,rightratio=0,left=-1,right=-1): self.weight = 0 self.leftratio = leftratio self.rightratio = rightratio self.left = left self.leftweight = 0 self.right = right self.rightweight = 0 def calc(self): if self.weight != 0 : return self.weight if self.left == -1: self.leftweight = 1 else: self.leftweight = Mobile.calc(self.left) if self.right == -1: self.rightweight = 1 else: self.rightweight = Mobile.calc(self.right) lmoment = self.leftratio*self.leftweight rmoment = self.rightratio*self.rightweight lcs = lmoment * rmoment // math.gcd(lmoment,rmoment) self.weight = (lcs//self.leftratio) + (lcs//self.rightratio) return self.weight def stdout(self): print(self.left, self.right) n = int(input()) barlist = [Mobile() for i in range(n)] for i in range(n): p,q,r,b = map(int, input().split()) barlist[i].leftratio = p barlist[i].rightratio = q if r != 0 : barlist[i].left = barlist[r-1] if b != 0 : barlist[i].right = barlist[b-1] maxi = 0 for i in range(n): maxi = max(barlist[i].calc(),maxi) print(maxi)
Traceback (most recent call last): File "/tmp/tmp5ud3kp77/tmpobdvn9xd.py", line 34, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s774335012
p00443
u901080241
1489042719
Python
Python3
py
Runtime Error
0
0
1373
import math class Mobile: def __init__(self,leftratio=0,rightratio=0,left=-1,right=-1): self.weight = 0 self.leftratio = leftratio self.rightratio = rightratio self.left = left self.leftweight = 0 self.right = right self.rightweight = 0 def calc(self): if self.weight != 0 : return self.weight if self.left == -1: self.leftweight = 1 else: self.leftweight = Mobile.calc(self.left) if self.right == -1: self.rightweight = 1 else: self.rightweight = Mobile.calc(self.right) lmoment = self.leftratio*self.leftweight rmoment = self.rightratio*self.rightweight lcs = lmoment * rmoment // math.gcd(lmoment,rmoment) self.weight = (lcs//self.leftratio) + (lcs//self.rightratio) return self.weight def stdout(self): print(self.left, self.right) while True: n = int(input()) if n==0: break barlist = [Mobile() for i in range(n)] for i in range(n): p,q,r,b = map(int, input().split()) barlist[i].leftratio = p barlist[i].rightratio = q if r != 0 : barlist[i].left = barlist[r-1] if b != 0 : barlist[i].right = barlist[b-1] maxi = 0 for i in range(n): maxi = max(barlist[i].calc(),maxi) print(maxi)
Traceback (most recent call last): File "/tmp/tmpui8x4c43/tmpebo7uj4z.py", line 34, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s920746675
p00443
u901080241
1489042885
Python
Python3
py
Runtime Error
0
0
1494
def gcd(x,y): if x<y: tmp = x x = y y = tmp if x%y == 0: return y else: gcd(y,x%y) class Mobile: def __init__(self,leftratio=0,rightratio=0,left=-1,right=-1): self.weight = 0 self.leftratio = leftratio self.rightratio = rightratio self.left = left self.leftweight = 0 self.right = right self.rightweight = 0 def calc(self): if self.weight != 0 : return self.weight if self.left == -1: self.leftweight = 1 else: self.leftweight = Mobile.calc(self.left) if self.right == -1: self.rightweight = 1 else: self.rightweight = Mobile.calc(self.right) lmoment = self.leftratio*self.leftweight rmoment = self.rightratio*self.rightweight lcs = lmoment * rmoment // gcd(lmoment,rmoment) self.weight = (lcs//self.leftratio) + (lcs//self.rightratio) return self.weight def stdout(self): print(self.left, self.right) while True: n = int(input()) if n==0: break barlist = [Mobile() for i in range(n)] for i in range(n): p,q,r,b = map(int, input().split()) barlist[i].leftratio = p barlist[i].rightratio = q if r != 0 : barlist[i].left = barlist[r-1] if b != 0 : barlist[i].right = barlist[b-1] maxi = 0 for i in range(n): maxi = max(barlist[i].calc(),maxi) print(maxi)
Traceback (most recent call last): File "/tmp/tmpht7d682r/tmp6kwp76nm.py", line 45, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s434241720
p00443
u352394527
1524997782
Python
Python3
py
Runtime Error
0
0
936
from math import gcd def lcm(i,j): return i * j // gcd(i,j) def main(): while True: n = int(input()) if not n: break lst = [[]] weight = [-1 for i in range(n + 1)] def setWeight(n): p,q,r,b = lst[n] if weight[n] != -1:pass elif r == 0 and b == 0: weight[n] = (p + q) // gcd(p,q) elif r == 0: setWeight(b) l = lcm(weight[b] * q, p) weight[n] = l // q + l // p elif b == 0: setWeight(r) l = lcm(weight(r) * p, q) weight[n] = l // p + l // q else: if weight[r] == -1: setWeight(r) if weight[b] == -1: setWeight(b) l = lcm(weight[r] * p, weight[b] * q) weight[n] = l // p + l // q for i in range(n): lst.append(list(map(int,input().split()))) for i in range(0,n): if weight[i + 1] == -1: setWeight(i+1) print(max(weight)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmp0bcmw5rx/tmpswdrtyp5.py", line 35, in <module> main() File "/tmp/tmp0bcmw5rx/tmpswdrtyp5.py", line 6, in main n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s530764103
p00443
u352394527
1524997809
Python
Python3
py
Runtime Error
0
0
936
from math import gcd def lcm(i,j): return i * j // gcd(i,j) def main(): while True: n = int(input()) if not n: break lst = [[]] weight = [-1 for i in range(n + 1)] def setWeight(n): p,q,r,b = lst[n] if weight[n] != -1:pass elif r == 0 and b == 0: weight[n] = (p + q) // gcd(p,q) elif r == 0: setWeight(b) l = lcm(weight[b] * q, p) weight[n] = l // q + l // p elif b == 0: setWeight(r) l = lcm(weight(r) * p, q) weight[n] = l // p + l // q else: if weight[r] == -1: setWeight(r) if weight[b] == -1: setWeight(b) l = lcm(weight[r] * p, weight[b] * q) weight[n] = l // p + l // q for i in range(n): lst.append(list(map(int,input().split()))) for i in range(0,n): if weight[i + 1] == -1: setWeight(i+1) print(max(weight)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmpt290bseb/tmpqnn1m76y.py", line 35, in <module> main() File "/tmp/tmpt290bseb/tmpqnn1m76y.py", line 6, in main n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s570083063
p00443
u352394527
1524997980
Python
Python3
py
Runtime Error
0
0
948
from math import gcd def lcm(i, j): return i * j // gcd(i, j) def main(): while True: n = int(input()) if not n: break lst = [[]] weight = [-1 for i in range(n + 1)] def setWeight(n): p, q, r, b = lst[n] if weight[n] != -1: pass elif r == 0 and b == 0: weight[n] = (p + q) // gcd(p, q) elif r == 0: setWeight(b) l = lcm(weight[b] * q, p) weight[n] = l // q + l // p elif b == 0: setWeight(r) l = lcm(weight(r) * p, q) weight[n] = l // p + l // q else: if weight[r] == -1: setWeight(r) if weight[b] == -1: setWeight(b) l = lcm(weight[r] * p, weight[b] * q) weight[n] = l // p + l // q for i in range(n): lst.append(list(map(int,input().split()))) for i in range(0, n): if weight[i + 1] == -1: setWeight(i + 1) print(max(weight)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmpnq_7op5x/tmpvhpdaw8t.py", line 37, in <module> main() File "/tmp/tmpnq_7op5x/tmpvhpdaw8t.py", line 7, in main n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s991084201
p00443
u352394527
1524998018
Python
Python3
py
Runtime Error
0
0
918
from math import gcd def lcm(i, j): return i * j // gcd(i, j) def main(): while True: n = int(input()) if not n: break lst = [[]] weight = [-1 for i in range(n + 1)] def setWeight(n): p, q, r, b = lst[n] if weight[n] != -1: pass elif r == 0 and b == 0: weight[n] = (p + q) // gcd(p, q) elif r == 0: setWeight(b) l = lcm(weight[b] * q, p) weight[n] = l // q + l // p elif b == 0: setWeight(r) l = lcm(weight(r) * p, q) weight[n] = l // p + l // q else: if weight[r] == -1: setWeight(r) if weight[b] == -1: setWeight(b) l = lcm(weight[r] * p, weight[b] * q) weight[n] = l // p + l // q for i in range(n): lst.append(list(map(int,input().split()))) for i in range(0, n): if weight[i + 1] == -1: setWeight(i + 1) print(max(weight)) main()
Traceback (most recent call last): File "/tmp/tmp5r8h2k4e/tmpa7i6v1z0.py", line 36, in <module> main() File "/tmp/tmp5r8h2k4e/tmpa7i6v1z0.py", line 7, in main n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s309124358
p00443
u467175809
1527202910
Python
Python
py
Runtime Error
0
0
1241
#!/usr/bin/env python import numpy as np def GCD(a, b): dummy1 = max(a, b) dummy2 = min(a, b) while True: dummy = dummy1 % dummy2 dummy1 = dummy2 dummy2 = dummy if(dummy == 0): break return dummy1 while True: N = input() if not N: break cost = [] E = [] root = N * (N - 1) / 2 for i in range(N): S = raw_input().split() c1, c2, e1, e2 = list(map(int,S)) cost.append((c1, c2)) root -= e1 + e2 e1 -= 1 e2 -= 1 E.append((e1, e2)) def nums(e): N_lst1 = [] N_lst2 = [] val_lst1 = [] val_lst2 = [] if E[e][0] != -1: N_lst1, val_lst1 = nums(E[e][0]) else: N_lst1 = [1] val_lst1 = [] if E[e][1] != -1: N_lst2, val_lst2 = nums(E[e][1]) else: N_lst2 = [1] val_lst2 = [] mul1 = cost[e][0] for num in val_lst1: mul1 *= num mul2 = cost[e][1] for num in val_lst2: mul2 *= num for i in range(len(N_lst1)): N_lst1[i] *= mul2 for i in range(len(N_lst2)): N_lst2[i] *= mul1 return N_lst1 + N_lst2, val_lst1 + val_lst2 + [cost[e][0] + cost[e][1]] N_lst, v_lst = nums(root - 1) #print N_lst num_GCD = N_lst[0] for num in N_lst: num_GCD = GCD(num, num_GCD) for i in range(len(N_lst)): N_lst[i] //= num_GCD #print N_lst print sum(N_lst)
File "/tmp/tmph8yndekt/tmp66em4m91.py", line 70 print sum(N_lst) ^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s636360965
p00444
u811434779
1440387195
Python
Python
py
Runtime Error
0
0
185
while 1: n = 1000 - input() if n==0:break m = [500,100,50,10,5,1] for i in range(6): x = n / m[i]; n -= m[i] * x; m[i] = x; print reduce(lambda a, x: a+x, m)
File "/tmp/tmpihnetrn4/tmpt_lr2izw.py", line 7 print reduce(lambda a, x: a+x, m) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s562043202
p00444
u150984829
1525451707
Python
Python3
py
Runtime Error
0
0
119
for e in iter(input,'0'): while 1: b,c=1000-int(e),0 for i in[500,100,50,10,5]: d,b=divmod(b,i) c+=d print(b+c)
File "/tmp/tmpyide5isq/tmphu8quzdt.py", line 2 while 1: ^ IndentationError: expected an indented block after 'for' statement on line 1
s201598239
p00444
u894941280
1344883384
Python
Python
py
Runtime Error
0
0
422
while True: c =0 a = int(input()) me = 1000 -a while me != 0: if me >= 500: me -= 500 c +=1 elif me >= 100: me -= 100 c +=1 elif me >= 50: me -= 50 c+=1 elif me >= 10: me -= 10 c +=1 elif me >= 5: me -= 5 c +=1 elif me >= 1: me -= 1 c+=1 print c
File "/tmp/tmppsao0dnk/tmpr8gar652.py", line 28 print c ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?