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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s098564764 | p02265 | u782850731 | 1379802549 | Python | Python | py | Runtime Error | 20 | 4236 | 441 | #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
n = int(stdin.readline())
dll = []
while n:
n -= 1
cmd = stdin.readline().rstrip()
if cmd.startswith('insert '):
dll.insert(0, cmd[7:])
elif cmd.startswith('delete '):
dll.remove(cmd[7:])
elif cmd.startswith('deleteFirst'):
del dll[0]
elif cmd.startswith('deleteLast'):
del dll[-1]
print(*dll) | Traceback (most recent call last):
File "/tmp/tmpzpb83y_8/tmp9e1b_rs2.py", line 4, in <module>
n = int(stdin.readline())
^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s523395054 | p02265 | u140201022 | 1389803883 | Python | Python | py | Runtime Error | 0 | 0 | 412 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
ans=[]
n=int(raw_input())
for _ in range(n):
(a,b)=map(str, raw_input().split())
if a=='insert': ans.insert(0,b)
elif a=='deleteFirst': del ans[0]
elif a=='deleteLast': del ans[-1]
else: ans.remove(b)
for i in ans:
print i | File "/tmp/tmp3zif8ovw/tmpwl33udeo.py", line 20
print i
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s425515502 | p02265 | u140201022 | 1389804042 | Python | Python | py | Runtime Error | 0 | 0 | 406 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
ans=[]
n=int(raw_input())
for _ in range(n):
(a,b)=map(str, raw_input().split())
if a=='insert': ans.insert(0,b)
elif a=='deleteFirst': del ans[0]
elif a=='deleteLast': del ans[-1]
else: ans.remove(b)
print ' '.join(ans) | File "/tmp/tmpwsai8iam/tmp05nh2gaf.py", line 19
print ' '.join(ans)
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s229594456 | p02265 | u140201022 | 1389804226 | Python | Python | py | Runtime Error | 20 | 4568 | 407 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
ans=[]
n=int(raw_input())
for _ in range(n):
a=raw_input().split()
if a[0]=='insert': ans.insert(0,a[1])
elif a[0]=='deleteFirst': del ans[0]
elif a[0]=='deleteLast': del ans[-1]
else: ans.remove(a[1])
print ' '.join(ans) | File "/tmp/tmphdw0bniv/tmpas37718v.py", line 19
print ' '.join(ans)
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s973184292 | p02265 | u140201022 | 1389822979 | Python | Python | py | Runtime Error | 0 | 0 | 536 | aya7581026@Ayas-Mac-mini:alds$ cat ./al3c.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
i = 0
ans=[]
n=int(raw_input())
for _ in range(n):
a=raw_input().split()
if a[0]=='insert': ans.insert(0,a[1])
elif a[0]=='deleteFirst': del ans[0]
elif a[0]=='deleteLast': del ans[-1]
# else: ans.remove(str(a[1]))
else:
if a[1] in ans:
ans.remove(a[1])
# print ans
print ' '.join(ans) | File "/tmp/tmpwp3cgm07/tmpzng9ah3v.py", line 1
aya7581026@Ayas-Mac-mini:alds$ cat ./al3c.py
^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: illegal target for annotation
| |
s247803999 | p02265 | u633068244 | 1393746957 | Python | Python | py | Runtime Error | 0 | 0 | 354 | n = int(raw_input())
ls = []
for i in range(n):
cmd = map(str, raw_input().split())
if cmd[0] == "insert":
ls.insert(0, cmd[0])
elif cmd[0] == "delete":
ls.remove(ls.index(cmd[1]))
elif cmd[0] == "deleteFirst":
ls.remove(0)
elif cmd[0] == "deleteLast":
ls.remove(len(ls)-1)
print " ".join(map(str, ls)) | File "/tmp/tmpt6hrxp5k/tmprl2kmf_h.py", line 13
print " ".join(map(str, ls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s019378018 | p02265 | u633068244 | 1393747155 | Python | Python | py | Runtime Error | 0 | 0 | 357 | n = int(raw_input())
ls = []
for i in range(n):
cmd = map(str, raw_input().split())
if cmd[0] == "insert":
ls.insert(0, cmd[1])
elif cmd[0] == "delete":
ls.remove(cmd[1])
elif cmd[0] == "deleteFirst":
ls.remove(0)
elif cmd[0] == "deleteLast":
ls.remove(len(ls)-1)
print ls
print " ".join(map(str, ls)) | File "/tmp/tmp_is9geqn/tmptd8wvy96.py", line 13
print ls
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s766764345 | p02265 | u633068244 | 1393747577 | Python | Python | py | Runtime Error | 20 | 4224 | 340 | n = int(raw_input())
ls = []
for i in range(n):
cmd = map(str, raw_input().split())
if cmd[0] == "insert":
ls.insert(0, cmd[1])
elif cmd[0] == "delete":
ls.remove(cmd[1])
elif cmd[0] == "deleteFirst":
del ls[:1]
elif cmd[0] == "deleteLast":
del ls[len(ls)-1:]
print " ".join(map(str, ls)) | File "/tmp/tmpmeg98to2/tmps4yv2qzx.py", line 13
print " ".join(map(str, ls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s745108783 | p02265 | u633068244 | 1393749856 | Python | Python | py | Runtime Error | 0 | 0 | 396 | n = int(raw_input())
ls = []
for i in range(n):
cmd = map(str, raw_input().split())
if cmd[0] == "insert":
ls.append(cmd[1])
elif cmd[0] == "deleteFirst":
del ls[len(ls)-1:]
elif cmd[0] == "deleteLast":
del ls[1:]
else:
for i in range(len(ls)-1,0,-1):
if ls[i] == cmd[1]:
a = ls.pop(i)
print " ".join(map(str, ls[::-1])) | File "/tmp/tmpixevrzve/tmpy3izrjqw.py", line 14
a = ls.pop(i)
^
IndentationError: expected an indented block after 'if' statement on line 13
| |
s038312588 | p02265 | u633068244 | 1395986397 | Python | Python | py | Runtime Error | 10 | 4220 | 270 | n = int(raw_input())
ls = []
for i in range(n):
cmd = raw_input()
if cmd[0] == "i":
ls.insert(0,cmd[7])
elif cmd[6] == " ":
ls.remove(cmd[7])
elif cmd[6] == "F":
ls.pop(0)
else:
ls.pop(-1)
print " ".join(map(str, ls)) | File "/tmp/tmpm0iohex5/tmptrym4y7l.py", line 14
print " ".join(map(str, ls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s445927065 | p02265 | u436634575 | 1400883414 | Python | Python3 | py | Runtime Error | 30 | 6732 | 403 | from collections import deque
n = int(input())
q = deque()
for i in range(n):
cmd = input().strip()
if cmd == 'deleteFirst':
q.popleft()
continue
if cmd == 'deleteLast':
q.pop()
continue
cmd, x = cmd.split()
if cmd == 'insert':
q.appendleft(x)
continue
if cmd == 'delete':
q.remove(x)
continue
print(' '.join(q)) | Traceback (most recent call last):
File "/tmp/tmpdymgaug0/tmpd1c_s7gv.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s254666713 | p02265 | u436634575 | 1400885045 | Python | Python3 | py | Runtime Error | 0 | 0 | 437 | n = int(input())
q = deque()
for i in range(n):
cmd = input().strip()
if cmd == 'deleteFirst':
q.popleft()
continue
if cmd == 'deleteLast':
q.pop()
continue
cmd, x = cmd.split()
x = int(x)
if cmd == 'insert':
q.appendleft(x)
continue
if cmd == 'delete':
try:
q.remove(x)
except:
pass
continue
print(' '.join(q)) | Traceback (most recent call last):
File "/tmp/tmpofp2bz_h/tmpsnar2l0m.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s030499926 | p02265 | u436634575 | 1400885090 | Python | Python3 | py | Runtime Error | 0 | 0 | 447 | n = int(input())
q = deque()
for i in range(n):
cmd = input().strip()
if cmd == 'deleteFirst':
q.popleft()
continue
if cmd == 'deleteLast':
q.pop()
continue
cmd, x = cmd.split()
x = int(x)
if cmd == 'insert':
q.appendleft(x)
continue
if cmd == 'delete':
try:
q.remove(x)
except:
pass
continue
print(' '.join(map(str, q))) | Traceback (most recent call last):
File "/tmp/tmp2qsftqy9/tmprw9hlox2.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s709658173 | p02265 | u436634575 | 1400887413 | Python | Python | py | Runtime Error | 0 | 0 | 338 | n = int(input())
q = []
bottom = 0
for i in range(n):
cmd = input()
if cmd[0] == 'i':
q.append(cmd[7:])
elif cmd[6] == ' ':
try:
q.pop(~q[::-1].index(cmd[7:]))
except:
pass
elif cmd[6] == 'F':
q.pop()
else:
bottom += 1
print(' '.join(q[bottom:][::-1])) | Traceback (most recent call last):
File "/tmp/tmpqt33yxzh/tmpm225vdd9.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s211692086 | p02265 | u436634575 | 1400887438 | Python | Python | py | Runtime Error | 0 | 0 | 337 | n = int(input())
q = []
bottom = 0
for i in range(n):
cmd = input()
if cmd[0] == 'i':
q.append(cmd[7:])
elif cmd[6] == ' ':
try:
q.pop(~q[::-1].index(cmd[7:]))
except:
pass
elif cmd[6] == 'F':
q.pop()
else:
bottom += 1
print ' '.join(q[bottom:][::-1]) | File "/tmp/tmpmzqo8puy/tmppuur87nw.py", line 18
print ' '.join(q[bottom:][::-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s460464513 | p02265 | u436634575 | 1400887830 | Python | Python3 | py | Runtime Error | 0 | 0 | 345 | n = int(raw_input())
q = []
bottom = 0
for i in range(n):
cmd = raw_input()
if cmd[0] == 'i':
q.append(cmd[7:])
elif cmd[6] == ' ':
try:
q.pop(~q[::-1].index(cmd[7:]))
except:
pass
elif cmd[6] == 'F':
q.pop()
else:
bottom += 1
print(' '.join(q[bottom:][::-1])) | Traceback (most recent call last):
File "/tmp/tmpxfc8nttv/tmptijhsyic.py", line 1, in <module>
n = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s625385587 | p02265 | u436634575 | 1400888152 | Python | Python3 | py | Runtime Error | 0 | 0 | 391 | from code import InteractiveConsole as C
n = int(C.raw_input())
q = []
bottom = 0
for i in range(n):
cmd = C.raw_input()
if cmd[0] == 'i':
q.append(cmd[7:])
elif cmd[6] == ' ':
try:
q.pop(~q[::-1].index(cmd[7:]))
except:
pass
elif cmd[6] == 'F':
q.pop()
else:
bottom += 1
print(' '.join(q[bottom:][::-1])) | Traceback (most recent call last):
File "/tmp/tmp45nqq31e/tmpntq4xfin.py", line 3, in <module>
n = int(C.raw_input())
^^^^^^^^^^^^^
TypeError: InteractiveConsole.raw_input() missing 1 required positional argument: 'self'
| |
s560358076 | p02266 | u924810243 | 1531115728 | Python | Python3 | py | Runtime Error | 0 | 0 | 367 | li2 = []
ans = 0
for i, s in enumerate(input()):
if s == "\\":
li1.append(i)
elif s == "/" and li1:
j = li1.pop()
c = i - j
ans += c
while li2 and li2[-1][0] > j:
c += li2[-1][1]
li2.pop()
li2.append((j, c))
print(ans)
if li2:
print(len(li2), *list(zip(*li2))[1])
else:
print(0)
| Traceback (most recent call last):
File "/tmp/tmp07qjzv2x/tmp8ly9u2uh.py", line 3, in <module>
for i, s in enumerate(input()):
^^^^^^^
EOFError: EOF when reading a line
| |
s299076350 | p02266 | u924810243 | 1531115744 | Python | Python3 | py | Runtime Error | 0 | 0 | 367 | li2 = []
ans = 0
for i, s in enumerate(input()):
if s == "\\":
li1.append(i)
elif s == "/" and li1:
j = li1.pop()
c = i - j
ans += c
while li2 and li2[-1][0] > j:
c += li2[-1][1]
li2.pop()
li2.append((j, c))
print(ans)
if li2:
print(len(li2), *list(zip(*li2))[1])
else:
print(0)
| Traceback (most recent call last):
File "/tmp/tmpyjq5ddh2/tmptntyieqa.py", line 3, in <module>
for i, s in enumerate(input()):
^^^^^^^
EOFError: EOF when reading a line
| |
s266432155 | p02266 | u418996726 | 1535623088 | Python | Python3 | py | Runtime Error | 0 | 0 | 587 | arr = list(input())
down = list()
areas = list()
for i, el in enumerate(arr):
if el == "\\":
down.append(i)
elif el == "/" and not len(down) == 0:
start_ind = down.pop()
area = i - start_ind
while len(areas) > 0 and areas[-1][0] > start_ind:
area += areas.pop()[1]
areas.append((start_ind, area))
areas = [areas[i][1] for i in range(len(areas))]
print(sum(areas))
if len(areas) == 0:
print("0")
else:
print(len(areas), " ".join(map(str,areas)))
| File "/tmp/tmpoo99v89i/tmp5t00aoej.py", line 4
^
SyntaxError: invalid non-printable character U+00A0
| |
s141073689 | p02266 | u418996726 | 1535623106 | Python | Python3 | py | Runtime Error | 0 | 0 | 745 | arr = list(input())
down = list()
areas = list()
for i, el in enumerate(arr):
if el == "\\":
down.append(i)
elif el == "/" and not len(down) == 0:
start_ind = down.pop()
area = i - start_ind
while len(areas) > 0 and areas[-1][0] > start_ind:
area += areas.pop()[1]
areas.append((start_ind, area))
# print("LOOP: {}".format(i))
# print("DOWN INDICES")
# print(down)
# print("AREAS")
# print(areas)
# print()
areas = [areas[i][1] for i in range(len(areas))]
print(sum(areas))
if len(areas) == 0:
print("0")
else:
print(len(areas), " ".join(map(str,areas)))
| File "/tmp/tmpvlvuv84h/tmp1xi_08x0.py", line 4
^
SyntaxError: invalid non-printable character U+00A0
| |
s403240428 | p02266 | u885258297 | 1546306570 | Python | Python | py | Runtime Error | 0 | 0 | 232 | s=j=0
a=[];b=[];d=[]
for i,x in enumerate(input()):
if x=='\\':a+=[i]
elif x=='/' and a:
j=a.pop()
c=i-j;s+=c
while b and b[-1]>j:c+=d.pop();b.pop()
b+=[j];d+=[c]
print(s)
print(len(b),*(d))
| Traceback (most recent call last):
File "/tmp/tmpiw724f82/tmpogq6tpnf.py", line 3, in <module>
for i,x in enumerate(input()):
^^^^^^^
EOFError: EOF when reading a line
| |
s460650126 | p02266 | u805716376 | 1556803974 | Python | Python3 | py | Runtime Error | 0 | 0 | 636 | A = input()
#高さ、面積,位置
st = [(0, 0, -1)]
#高さ、高さの最高値?
cur = 0; ma = 0
for i, a in enumerate(A):
if a == '/':
cur += 1
s = 0
while st and st[-1][0] == cur-1 and cur <= ma:
lev, su, j = st.pop()
s += su
if st and st[-1][0] == cur:
s += i - st[-1][2] - 1
ma = max(ma, cur)
st.append(cur, s, i)
elif a == '\\':
cur -= 1
st.append((cur, 0, i))
elif c == '_':
st.append((cur, 0, i))
ans = []
for lev, su, j in st:
if su > 0:
and.append(su)
print(sum(ans))
print(len(ans), *ans)
| File "/tmp/tmpgwlgix33/tmpmu3v77nr.py", line 25
and.append(su)
^^^
SyntaxError: invalid syntax
| |
s782765990 | p02266 | u805716376 | 1556804001 | Python | Python3 | py | Runtime Error | 0 | 0 | 636 | A = input()
#高さ、面積,位置
st = [(0, 0, -1)]
#高さ、高さの最高値?
cur = 0; ma = 0
for i, a in enumerate(A):
if a == '/':
cur += 1
s = 0
while st and st[-1][0] == cur-1 and cur <= ma:
lev, su, j = st.pop()
s += su
if st and st[-1][0] == cur:
s += i - st[-1][2] - 1
ma = max(ma, cur)
st.append(cur, s, i)
elif a == '\\':
cur -= 1
st.append((cur, 0, i))
elif a == '_':
st.append((cur, 0, i))
ans = []
for lev, su, j in st:
if su > 0:
and.append(su)
print(sum(ans))
print(len(ans), *ans)
| File "/tmp/tmp8gbjzr0f/tmpj80s5a51.py", line 25
and.append(su)
^^^
SyntaxError: invalid syntax
| |
s806356869 | p02266 | u805716376 | 1556804570 | Python | Python3 | py | Runtime Error | 0 | 0 | 582 | A = input()
st = [(0, 0, -1)]
cur = 0; ma = 0
for i, a in enumerate(A):
if a == '/':
cur += 1
s = 0
while st and st[-1][0] == cur-1 and cur <= ma:
lev, su, j = st.pop()
s += su
if st and st[-1][0] == cur:
s += i - st[-1][2] - 1
ma = max(ma, cur)
st.append((cur, s, i))
elif a == '\\':
cur -= 1
st.append((cur, 0, i))
elif a == '_':
st.append((cur, 0, i))
ans = []
for lev, su, j in st:
if su > 0:
and.append(su)
print(sum(ans))
print(len(ans), *ans)
| File "/tmp/tmp6o0h153e/tmp2f_z0hwo.py", line 23
and.append(su)
^^^
SyntaxError: invalid syntax
| |
s283278514 | p02266 | u604774382 | 1433246019 | Python | Python | py | Runtime Error | 0 | 0 | 628 | section = raw_input( )
depth = 0
area = 0
depthArr = deque( )
areaArr = deque( )
for i, ground in enumerate( section ):
if "\\" == ground:
depth += 1
depthArr.append( i )
elif 0 < depth and "/" == ground:
if len( depthArr ):
j = depthArr.pop( )
pool = i - j
area += pool
while len( areaArr ):
preJ, prePool = areaArr.pop( )
if j <= preJ:
pool += prePool
else:
areaArr.append( ( preJ, prePool ) )
break
areaArr.append( ( j, pool ) )
print( area )
output = []
output.append( len( areaArr ) )
for arr in areaArr:
output.append( arr[1] )
print( " ".join( map( str, output ) ) ) | Traceback (most recent call last):
File "/tmp/tmp1jjwwnka/tmp8eepqc8i.py", line 1, in <module>
section = raw_input( )
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s881307817 | p02266 | u072053884 | 1447815837 | Python | Python3 | py | Runtime Error | 0 | 0 | 547 | import collections
import sys
S1 = collections.deque()
S2 = collections.deque()
f = open('in47', 'r')
for i, j in enumerate(f.readline()):
if j == '\\':
S1.append(i)
elif j == '/':
if S1:
left_edge = S1.pop()
new_puddle = i - left_edge
while S2 and (S2[-1][0] > left_edge):
new_puddle += S2[-1][1]
S2.pop()
S2.append((left_edge, new_puddle))
else:
pass
print(sum(j for i, j in S2))
print(len(S2), *(j for i, j in S2)) | Traceback (most recent call last):
File "/tmp/tmp087d7s5j/tmppp_nh2pj.py", line 7, in <module>
f = open('in47', 'r')
^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'in47'
| |
s731583865 | p02266 | u797673668 | 1452432612 | Python | Python3 | py | Runtime Error | 0 | 0 | 616 | from collections import deque
def marge_ponds(lx, area_of_pond):
global ponds
if ponds and ponds[-1][0] > lx:
return marge_ponds(lx, area_of_pond + ponds.pop()[1])
return area_of_pond
terrains = input().strip()
x, last_x, ponds = 0, deque(), deque()
for terrain in terrains:
if terrain == '\\':
last_x.append(x)
elif terrain == '/':
if last_x:
lx = last_x.pop()
ponds.append((lx, marge_ponds(lx, x - lx)))
x += 1
print(sum(pond[1] for pond in ponds))
ponds.insert(0, (0, len(ponds)))
print(' '.join(map(str, [pond[1] for pond in ponds]))) | Traceback (most recent call last):
File "/tmp/tmpstuzie_n/tmpf1a9qs1z.py", line 11, in <module>
terrains = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s081304584 | p02266 | u567281053 | 1456674918 | Python | Python | py | Runtime Error | 10 | 6480 | 1820 | def calc(list):
#print list
d = 0
a = 0.0
for c in list:
if c == "\\":
d += 1
a += d - 1 + 0.5
elif c == "_":
a += d
else:
a += d - 1 + 0.5
d -= 1
return a
if __name__ == "__main__":
line = raw_input()
areas = []
mode = True
d = 0
edge = 0
for i in range(len(line)):
c = line[i]
if mode:
if c == "\\":
d += 1
elif c == "/":
d -= 1
if d == 0:
areas.append(calc(line[edge:i + 1]))
mode = False
else:
if c == "\\":
d += 1
edge = i
mode = True
elif c == "_":
edge = i
else:
edge = i
last = len(areas)
high = edge
if d != 0:
d = 0
edge = len(line) - 1
mode = False
for i in range(len(line) - 1 , high - 1, -1):
#print i, line[i], d, edge, mode
c = line[i]
if mode:
if c == "/":
d += 1
elif c == "\\":
d -= 1
if d == 0:
#print i, edge
areas.insert(last, calc(line[i:edge + 1]))
mode = False
else:
if c == "/":
d += 1
edge = i
mode = True
elif c == "_":
edge = i
else:
edge = i
areas = map(int, areas)
print sum(areas)
print len(areas),
for i in range(len(areas) - 1):
print areas[i],
print areas[len(areas) - 1] | File "/tmp/tmp13_avpcm/tmpxm88zcxf.py", line 71
print sum(areas)
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s652273486 | p02266 | u567281053 | 1456675357 | Python | Python | py | Runtime Error | 10 | 6492 | 1862 | def calc(list):
#print list
d = 0
a = 0.0
for c in list:
if c == "\\":
d += 1
a += d - 1 + 0.5
elif c == "_":
a += d
else:
a += d - 1 + 0.5
d -= 1
return a
if __name__ == "__main__":
line = raw_input()
areas = []
mode = False
d = 0
edge = 0
for i in range(len(line)):
#print i, line[i], d, edge, mode
c = line[i]
if mode:
if c == "\\":
d += 1
elif c == "/":
d -= 1
if d == 0:
areas.append(calc(line[edge:i + 1]))
mode = False
else:
if c == "\\":
d += 1
edge = i
mode = True
elif c == "_":
edge = i
else:
edge = i
last = len(areas)
high = edge
if d != 0:
d = 0
edge = len(line) - 1
mode = False
for i in range(len(line) - 1 , high - 1, -1):
#print i, line[i], d, edge, mode
c = line[i]
if mode:
if c == "/":
d += 1
elif c == "\\":
d -= 1
if d == 0:
#print i, edge
areas.insert(last, calc(line[i:edge + 1]))
mode = False
else:
if c == "/":
d += 1
edge = i
mode = True
elif c == "_":
edge = i
else:
edge = i
areas = map(int, areas)
print sum(areas)
print len(areas),
for i in range(len(areas) - 1):
print areas[i],
print areas[len(areas) - 1] | File "/tmp/tmpns4v0uco/tmpx11uu8tf.py", line 72
print sum(areas)
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s150285329 | p02266 | u390995924 | 1473315218 | Python | Python3 | py | Runtime Error | 20 | 7620 | 1618 | # -*- coding: utf-8 -*-
import sys
I = list(input())
A = 0
L = []
k = 0
while len(I) > 0:
i = I.pop()
if i == '/':
d = 1
a = 0.5
tmp_I = ['/']
# print("[{}] d: {}".format(i, d))
while len(I) > 0:
i = I.pop()
tmp_I.append(i)
if i == '/':
d += 1
a += 0.5 + d - 1
elif i == '\\':
a += 0.5 + d - 1
d -= 1
if d == 0:
A += a
L.append(a)
k += 1
tmp_I = []
break
elif i == '_':
a += d
# print("[{}] d: {}".format(i, d))
# print("{}".format(tmp_I))
LH = []
if len(tmp_I) > 0:
d = a = 0
while len(tmp_I) > 0:
i = tmp_I.pop()
# print("{}".format(i))
if i == '\\':
d += 1
a += 0.5 + d - 1
elif i == '_':
a += d
elif i == '/' and d > 0:
a += 0.5 + d - 1
d -= 1
if d == 0:
# print("Add tmp: {} ({})".format(a, tmp_I))
A += a
LH.append(a)
k += 1
a = 0
print(int(A))
sys.stdout.write(str(k))
for l in LH:
sys.stdout.write(" {}".format(int(l)))
while len(L) > 0:
sys.stdout.write(" {}".format(int(L.pop())))
sys.stdout.write('\n') | Traceback (most recent call last):
File "/tmp/tmpnbv_g3i5/tmp03niy1gc.py", line 5, in <module>
I = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s809318018 | p02266 | u159356473 | 1477293360 | Python | Python3 | py | Runtime Error | 0 | 0 | 1350 | #coding:UTF-8
def checkDepth(A):
depth=0
for i in range(len(A)):
if A[i]=="\\":
depth+=1
elif A[i]=="/":
depth-=1
else:
continue
if depth==0:
return True
return False
def SD(a):
A=list(a)
areaList=[]
areaAll=0
start=0
for i in range(len(A)):
area=0
if A[i]=="\\":
Flag=checkDepth(A[i:])
if Flag==True:
count=0
for j in range(i,len(A)):
if A[j]=="\\":
area+=(count)+0.5
count+=1
elif A[j]=="/":
count-=1
area+=(count)+0.5
else:
area+=count
if count==0:
for k in range(i,j):
A[k]="_"
break
areaList.append(int(area))
areaAll+=int(area)
continue
else:
continue
else:
continue
print(areaAll)
for i in range(len(areaList)):
areaList[i]=str(areaList[i])
print(len(areaList)+" "+" ".join(areaList))
if __name__=="__main__":
a=input()
SD(a) | Traceback (most recent call last):
File "/tmp/tmptg415gzb/tmp7ul3q3he.py", line 54, in <module>
a=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s374380454 | p02266 | u159356473 | 1477293389 | Python | Python3 | py | Runtime Error | 0 | 0 | 1350 | #coding:UTF-8
def checkDepth(A):
depth=0
for i in range(len(A)):
if A[i]=="\\":
depth+=1
elif A[i]=="/":
depth-=1
else:
continue
if depth==0:
return True
return False
def SD(a):
A=list(a)
areaList=[]
areaAll=0
start=0
for i in range(len(A)):
area=0
if A[i]=="\\":
Flag=checkDepth(A[i:])
if Flag==True:
count=0
for j in range(i,len(A)):
if A[j]=="\\":
area+=(count)+0.5
count+=1
elif A[j]=="/":
count-=1
area+=(count)+0.5
else:
area+=count
if count==0:
for k in range(i,j):
A[k]="_"
break
areaList.append(int(area))
areaAll+=int(area)
continue
else:
continue
else:
continue
print(areaAll)
for i in range(len(areaList)):
areaList[i]=str(areaList[i])
print(len(areaList)+" "+" ".join(areaList))
if __name__=="__main__":
a=input()
SD(a) | Traceback (most recent call last):
File "/tmp/tmps7xrfslb/tmp5j3ufsrr.py", line 54, in <module>
a=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s402522681 | p02266 | u159356473 | 1477293696 | Python | Python3 | py | Runtime Error | 0 | 0 | 1350 | #coding:UTF-8
def checkDepth(A):
depth=0
for i in range(len(A)):
if A[i]=="\\":
depth+=1
elif A[i]=="/":
depth-=1
else:
continue
if depth==0:
return True
return False
def SD(a):
A=list(a)
areaList=[]
areaAll=0
start=0
for i in range(len(A)):
area=0
if A[i]=="\\":
Flag=checkDepth(A[i:])
if Flag==True:
count=0
for j in range(i,len(A)):
if A[j]=="\\":
area+=(count)+0.5
count+=1
elif A[j]=="/":
count-=1
area+=(count)+0.5
else:
area+=count
if count==0:
for k in range(i,j):
A[k]="_"
break
areaList.append(int(area))
areaAll+=int(area)
continue
else:
continue
else:
continue
print(areaAll)
for i in range(len(areaList)):
areaList[i]=str(areaList[i])
print(len(areaList)+" "+" ".join(areaList))
if __name__=="__main__":
a=input()
SD(a) | Traceback (most recent call last):
File "/tmp/tmpty0xs9aw/tmpoq86rw2t.py", line 54, in <module>
a=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s691428626 | p02266 | u742013327 | 1478869093 | Python | Python3 | py | Runtime Error | 30 | 7716 | 2154 | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
#?°´??????????????¢????¨????
import re
def cal_puddle(diagram_list):
score = 0
depth = 0
for i, symbol in enumerate(diagram_list):
if symbol == "\\":
score += depth + 0.5
depth += 1
elif symbol == "/":
depth = depth - 1
score += depth + 0.5
elif symbol == "_":
score += depth
continue
if depth == 0:
return int(score)
return None
def cal(diagram):
puddle_areas = []
diagram_list = []
puddle_list = []
i = 0
score = []
while i < len(diagram):
if diagram[i] == "\\":
res = cal_puddle(diagram[i:])
if res[1]:
i = i + res[1]
score.append(res[0])
i += 1
return score
def cal_revision(diagram):
hight = 0
hight_list = []
hight_index_list = []
in_puddle = False
for i, s in enumerate(diagram + "\\"):
if s == "\\":
if not in_puddle:
in_puddle = True
hight_list.append(hight)
hight_index_list.append(i)
hight -= 1
elif s == "/":
in_puddle = False
hight += 1
puddle_list = []
i = 0
while i < len(hight_list) - 1:
if hight_list[i] <= hight_list[i + 1]:
puddle_list.append((hight_index_list[i], hight_index_list[i + 1]))
i = i + 1
else:
hight_list[i] -= 1
hight_index_list[i] += 1
if hight_list[i] in hight_list[i + 1:]:
index = i + hight_list[i + 1:].index(hight_list[i]) + 1
puddle_list.append((hight_index_list[i], hight_index_list[index]))
i = index
result = [cal_puddle(diagram[s:e]) for s, e in puddle_list]
print(sum(result))
print(len(result), " ".join([str(a) for a in result]))
if __name__ == "__main__":
a = input()
cal_revision(a)
#print(sum(result))
#print(str(len(result)) + "".join([" " + str(a) for a in result])) | Traceback (most recent call last):
File "/tmp/tmpzkvv32t6/tmpbvy5tu6s.py", line 78, in <module>
a = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s224415031 | p02266 | u908984540 | 1483360182 | Python | Python3 | py | Runtime Error | 0 | 0 | 857 | from collections import deque
input_list = input()
area = 0
depth_arr = deque()
area_arr = deque()
flag = false;
for i, input_str in enumerate(input_list):
if "\\" == input_str:
flag = true;
depth_arr.append(i)
elif "/" == input_str and flag:
if len(depth_arr):
position = depth_arr.pop()
pool = i - position
area += pool
while len(area_arr):
pre_position, pre_pool = area_arr.pop()
if position <= pre_position:
pool += pre_pool
else:
area_arr.append((pre_position, pre_pool))
break
area_arr.append((position, pool))
areas = 0
for pos, pool in area_arr:
areas += pool
print(areas)
print(len(area_arr), end=" ")
print(*[list[1] for list in area_arr]) | Traceback (most recent call last):
File "/tmp/tmpw0fy5hod/tmpszvz4asn.py", line 3, in <module>
input_list = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s554744978 | p02266 | u941958472 | 1484196035 | Python | Python3 | py | Runtime Error | 30 | 7420 | 352 | # l = open('input.txt').readline()
l = input()
k = 0
S1, S2 = [], []
for i in range(len(l)):
if l[i] == '\\':
S1.append(i)
elif l[i] == '/':
j = S1.pop()
a = i - j
k += i - j
while S2 and S2[-1][0] > j:
a += S2.pop()[1]
S2.append((j, a))
print(k)
print(len(S2), *(a for j, a in S2)) | Traceback (most recent call last):
File "/tmp/tmpgxh9rm28/tmpdh_7f_9u.py", line 2, in <module>
l = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s461533073 | p02266 | u656153606 | 1487421563 | Python | Python3 | py | Runtime Error | 0 | 0 | 947 | def water(square, depth, line):
if line == '?\':
square = square + 0.5 + depth
depth += 1
return square, depth
elif line == '_':
square += depth
return square, depth
elif line == '/':
if depth > 0:
depth -= 1
square = square + 0.5 + depth
return square, depth
line = input()
square = 0
squares = []
depth = 0
counter = 0
water_flag = False
for i in line:
if depth == 0 and i == '?\':
counter += 1
water_flag = True
# print(square,depth,i)
square, depth = water(square, depth, i)
if water_flag == True and depth == 0 and i == '/':
squares.append(square)
square = 0
all_squares = 0
for i in range(len(squares)):
all_squares += squares[i]
print(all_squares)
print(str(counter)+' ',end='')
for i in range(len(squares)):
print(squares[i]) if i == len(squares)-1 else print(str(squares[i])+' ',end='') | File "/tmp/tmp9w82tcgs/tmp61y6159t.py", line 2
if line == '?\':
^
SyntaxError: unterminated string literal (detected at line 2)
| |
s775254431 | p02266 | u656153606 | 1487421755 | Python | Python3 | py | Runtime Error | 0 | 0 | 945 | def water(square, depth, line):
if line == '\':
square = square + 0.5 + depth
depth += 1
return square, depth
elif line == '_':
square += depth
return square, depth
elif line == '/':
if depth > 0:
depth -= 1
square = square + 0.5 + depth
return square, depth
line = input()
square = 0
squares = []
depth = 0
counter = 0
water_flag = False
for i in line:
if depth == 0 and i == '\':
counter += 1
water_flag = True
# print(square,depth,i)
square, depth = water(square, depth, i)
if water_flag == True and depth == 0 and i == '/':
squares.append(square)
square = 0
all_squares = 0
for i in range(len(squares)):
all_squares += squares[i]
print(all_squares)
print(str(counter)+' ',end='')
for i in range(len(squares)):
print(squares[i]) if i == len(squares)-1 else print(str(squares[i])+' ',end='') | File "/tmp/tmpjshu80yl/tmpg91ziaxk.py", line 2
if line == '\':
^
SyntaxError: unterminated string literal (detected at line 2)
| |
s269060565 | p02266 | u735204496 | 1499765015 | Python | Python | py | Runtime Error | 10 | 6524 | 1405 | import sys
class Area:
def __init__(self, start, end, area):
self.start = start
self.end = end
self.area = area
def addArea(self, area):
self.area += area
if __name__ == "__main__":
line = sys.stdin.readline().strip()
area_stack = []
field_stack = []
for i in range(0, len(line)):
c = line[i]
if (c == "\\"):
field_stack.append((c, i))
elif (c == "/"):
if len(field_stack) == 0:
continue
cc = field_stack.pop()
current_area = Area(cc[1], i, (i - cc[1]))
if len(area_stack) == 0:
area_stack.append(current_area)
continue
prev_area = area_stack.pop()
flag = True
while (prev_area.start > current_area.start) and (prev_area.end < current_area.end):
current_area.addArea(prev_area.area)
if len(area_stack) == 0:
flag = False
break
prev_area = area_stack.pop()
if flag:
area_stack.append(prev_area)
area_stack.append(current_area)
print str(reduce(lambda x, y: x + y, map(lambda x: x.area, area_stack)))
s = ""
s += str(len(area_stack)) + " "
for item in area_stack:
s += str(item.area) + " "
s = s.strip()
print s | File "/tmp/tmpi426m_pc/tmpk641w915.py", line 40
print str(reduce(lambda x, y: x + y, map(lambda x: x.area, area_stack)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s700309350 | p02266 | u264972437 | 1500391988 | Python | Python3 | py | Runtime Error | 20 | 7444 | 783 | data = input()
#data = '\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\'
diff = {'\\':-1, '_':0, '/':1}
height = [0]
[height.append(height[-1]+diff[i]) for i in data]
bottom = min(height)
height = [h-bottom for h in height]
m = max(height)
water = [m for h in height]
height00 = [0] + height + [0]
water00 = [0] + water + [0]
roop = True
while roop:
temp = water00[:]
for i in range(1,len(water00)-1):
water00[i] = max(height00[i],min(water00[i-1:i+2]))
roop = temp != water00
water = water00[1:-1]
depth = [w-h for w,h in zip(water,height)]
paddles = []
for d1,d2 in zip(depth[:-1],depth[1:]):
if d1==0 and d2>0:
paddles.append(0)
paddles[-1] += min(d1,d2) + 0.5*abs(d1-d2)
paddles = [int(p) for p in paddles]
print(sum(paddles))
print(len(paddles), *paddles) | Traceback (most recent call last):
File "/tmp/tmp13j0rjto/tmpl5ospzbk.py", line 1, in <module>
data = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s187767903 | p02266 | u264972437 | 1500392021 | Python | Python3 | py | Runtime Error | 20 | 7468 | 783 | data = input()
#data = '\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\'
diff = {'\\':-1, '_':0, '/':1}
height = [0]
[height.append(height[-1]+diff[i]) for i in data]
bottom = min(height)
height = [h-bottom for h in height]
m = max(height)
water = [m for h in height]
height00 = [0] + height + [0]
water00 = [0] + water + [0]
roop = True
while roop:
temp = water00[:]
for i in range(1,len(water00)-1):
water00[i] = max(height00[i],min(water00[i-1:i+2]))
roop = temp != water00
water = water00[1:-1]
depth = [w-h for w,h in zip(water,height)]
paddles = []
for d1,d2 in zip(depth[:-1],depth[1:]):
if d1==0 and d2>0:
paddles.append(0)
paddles[-1] += min(d1,d2) + 0.5*abs(d1-d2)
paddles = [int(p) for p in paddles]
print(sum(paddles))
print(len(paddles), *paddles) | Traceback (most recent call last):
File "/tmp/tmpegld3ear/tmp3qu0as2m.py", line 1, in <module>
data = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s880116584 | p02266 | u146816547 | 1506081276 | Python | Python | py | Runtime Error | 0 | 0 | 394 | s = raw_input()
St1, St2 = [], []
sumv = 0
for i in range(len(s)):
if s[i] == '\\':
St1.append(i)
elif s[i] == '/' and len(St1) > 0:
j = St1.pop()
a = i-j
sumv += a
while len(St2) > 0 and St2[-1][0] > j:
a += St2.pop()[1]
St2.append([j, a])
St2.insert(0, len(St2))
print sumv
print ' '.join(map(lambda x: str(x[1]), St2)) | File "/tmp/tmphgnyi85i/tmp6d6ouwre.py", line 20
print sumv
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s871290823 | p02266 | u343251190 | 1509357576 | Python | Python3 | py | Runtime Error | 0 | 0 | 960 | #include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
stack <int> s1;
stack < pair <int, int> > s2;
char ch;
int sum = 0;
for (int i = 0; cin >> ch; i++) {
if (ch == '\\') s1.push(i);
else if (ch == '/' && s1.size() > 0) {
int j = s1.top();
s1.pop();
sum += i - j;
int a = i - j;
while (s2.size() > 0 && s2.top().first > j) {
a += s2.top().second;
s2.pop();
}
s2.push(make_pair(j, a));
}
}
vector<int> ans;
while (s2.size() > 0) {
ans.push_back(s2.top().second);
s2.pop();
}
reverse(ans.begin(), ans.end());
cout << sum << endl;
cout << ans.size();
for (int i = 0; i < ans.size(); i++) {
cout << " ";
cout << ans[i];
}
cout << endl;
return 0;
} | File "/tmp/tmppbj13v4w/tmphohpou8m.py", line 6
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s228054644 | p02266 | u947762778 | 1509879370 | Python | Python3 | py | Runtime Error | 0 | 0 | 388 | a = input()
slope = []
pool = []
ridge = []
for i in range(len(a)):
if a[i] == '\\':
slope.append(i)
if a[i] == '/' and slope:
down = slope.pop()
s = i - down
while ridge:
if ridge[-1] > down:
ridge.pop()
s += pool.pop()
ridge.append(down)
pool.append(s)
print(sum(pool))
print(len(pool), *pool) | Traceback (most recent call last):
File "/tmp/tmptgu4ifb9/tmp93l6jgzj.py", line 1, in <module>
a = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s400747742 | p02266 | u957470671 | 1515065299 | Python | Python3 | py | Runtime Error | 20 | 5568 | 811 | def main():
line = input()
s1 = []
s2 = []
sum = 0
for i, s in enumerate(line):
if s == "\\":
# 谷の位置をスタックに積む
s1.append(i)
elif s == "/" and len(s1) > 0:
# 山で対応する谷があるなら、面積に追加
j = s1.pop()
sum += i - j # 谷から山の距離を水たまりの面積に追加
# jより前に位置する水たまりの面積を追加
a = i - j
while len(s2) > 0 and s2[-1][0] > j:
a += s2.pop()[1]
# (水たまりの左端の位置, 水たまりの面積)のタプルをスタックに積む
s2.append((j, a))
print(sum)
print(len(s2), s2[0][1])
if __name__ == "__main__":
main()
| Traceback (most recent call last):
File "/tmp/tmpzcic2h6y/tmpan1y2jmh.py", line 27, in <module>
main()
File "/tmp/tmpzcic2h6y/tmpan1y2jmh.py", line 2, in main
line = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s488865467 | p02266 | u426534722 | 1516460990 | Python | Python3 | py | Runtime Error | 0 | 0 | 598 | import sys
readline = sys.stdin.readline
li = []
for i, s in enumerate(readline().replace("_").strip()):
if s == "\\":
li.append([i, 0])
elif s == "/":
if li:
if li[-1][1] == 0:
li[-1][1] = i - li[-1][0]
else:
for j in range(len(li) - 1, -1, -1):
if li[j][1] == 0:
li = li[:j] + [[li[j][0], sum(tuple(zip(*li[j + 1:]))[1]) + i - li[j][0]]]
break
ans = []
for a in li:
if a[1] != 0:
ans.append(a[1])
print(sum(ans))
print(len(ans), *ans)
| Traceback (most recent call last):
File "/tmp/tmpivl2myfj/tmpnvhfbndv.py", line 4, in <module>
for i, s in enumerate(readline().replace("_").strip()):
^^^^^^^^^^^^^^^^^^^^^^^
TypeError: replace expected at least 2 arguments, got 1
| |
s650672340 | p02266 | u426534722 | 1516545093 | Python | Python3 | py | Runtime Error | 20 | 5568 | 346 | li1 = []
li2 = []
ans = 0
for i, s in enumerate(input()):
if s == "\\":
li1.append(i)
elif s == "/" and li1:
j = li1.pop()
c = i - j
ans += c
while li2 and li2[-1][0] > j:
c += li2[-1][1]
li2.pop()
li2.append((j, c))
print(ans)
print(len(li2), *list(zip(*li2))[1])
| Traceback (most recent call last):
File "/tmp/tmpqdtv8aq3/tmp8elkt3zu.py", line 4, in <module>
for i, s in enumerate(input()):
^^^^^^^
EOFError: EOF when reading a line
| |
s724116864 | p02266 | u426534722 | 1516545105 | Python | Python3 | py | Runtime Error | 20 | 5568 | 346 | li1 = []
li2 = []
ans = 0
for i, s in enumerate(input()):
if s == "\\":
li1.append(i)
elif s == "/" and li1:
j = li1.pop()
c = i - j
ans += c
while li2 and li2[-1][0] > j:
c += li2[-1][1]
li2.pop()
li2.append((j, c))
print(ans)
print(len(li2), *list(zip(*li2))[1])
| Traceback (most recent call last):
File "/tmp/tmpq9fxmktm/tmpu5xdkehr.py", line 4, in <module>
for i, s in enumerate(input()):
^^^^^^^
EOFError: EOF when reading a line
| |
s912874189 | p02266 | u426534722 | 1516545409 | Python | Python3 | py | Runtime Error | 30 | 5568 | 336 | li1 = []
li2 = []
for i, s in enumerate(input()):
if s == "\\":
li1.append(i)
elif s == "/" and li1:
j = li1.pop()
c = i - j
while li2 and li2[-1][0] > j:
c += li2[-1][1]
li2.pop()
li2.append((j, c))
li3 = list(zip(*li2))[1]
print(sum(li3))
print(len(li3), *li3)
| Traceback (most recent call last):
File "/tmp/tmpisqxmgxx/tmprlto8d74.py", line 3, in <module>
for i, s in enumerate(input()):
^^^^^^^
EOFError: EOF when reading a line
| |
s553749990 | p02266 | u749243807 | 1516960957 | Python | Python3 | py | Runtime Error | 20 | 5568 | 502 | def cross_section_area(data):
area = 0;
k = 0;
section_areas = [];
section_area = 0;
stack = [];
for i in range(len(data)):
if data[i] == '\\':
stack.append(i);
elif data[i] == '/':
section_area += i - stack.pop();
if len(stack) == 0:
k += 1;
section_areas.append(section_area);
area += section_area;
print(area);
print(k, *section_areas);
cross_section_area(input());
| Traceback (most recent call last):
File "/tmp/tmpqqwxkbgf/tmp9e93d_s6.py", line 19, in <module>
cross_section_area(input());
^^^^^^^
EOFError: EOF when reading a line
| |
s097892603 | p02266 | u267728784 | 1517158941 | Python | Python3 | py | Runtime Error | 0 | 0 | 928 | class dllist:
def __init__(self):
self._list = []
self._fp = 0
self._bp = 0
def insert(self, x):
self._list.append(x)
self._fp += 1
def delete(self, x):
t = self._list[::-1]
if x in t[:-self._bp]:
self._list.remove(x)
self._fp -= 1
def deleteFirst(self):
self._list.pop()
def deleteLast(self):
self._bp += 1
def disp(self):
print(" ".join([str(x) for x in self._list[self._bp:][::-1]]))
if __name__ == '__main__':
q = dllist()
n = int(input())
for _ in range(n):
inst = input().split()
if inst[0] == "insert":
q.insert(int(inst[1]))
elif inst[0] == "delete":
q.delete(int(inst[1]))
elif inst[0] == "deleteFirst":
q.deleteFirst()
elif inst[0] == "deleteLast":
q.deleteLast()
q.disp()
| Traceback (most recent call last):
File "/tmp/tmpmwpy3cj7/tmp_prkap5a.py", line 32, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s913132263 | p02266 | u150984829 | 1518458777 | Python | Python3 | py | Runtime Error | 0 | 0 | 224 | s=[]
p=[]
a=i=0
for c in input():
if"\\"==c:s+=[i]
elif c=="/"and s:
j=p.pop()
t=i-j
a+=t
while p and p[-1][0]>j:t+=p[-1][1];p.pop()
p+=[(j,t)]
i+=1
print(ans)
if p:print(len(p),*list(zip(*p))[1])
else:print(0)
| Traceback (most recent call last):
File "/tmp/tmp5v8hs3ik/tmp8v6on3em.py", line 4, in <module>
for c in input():
^^^^^^^
EOFError: EOF when reading a line
| |
s400070607 | p02266 | u909075105 | 1525798598 | Python | Python3 | py | Runtime Error | 0 | 0 | 224 | A=[]
B=[]
a=0
x=0
for c in input():
if"\\"==c:A+=[x]
elif"/"==c and A:
j=A.pop()
t=x-j
a+=t
while B and B[-1][0]>j:t+=B[-1][1];B.pop()
B+=[(j,t)]
x+=1
print(a)
if p:print(len(B),*list(zip(*B))[1])
else:print(0)
| Traceback (most recent call last):
File "/tmp/tmpimg12s2v/tmp5hcfhzzh.py", line 5, in <module>
for c in input():
^^^^^^^
EOFError: EOF when reading a line
| |
s660489479 | p02266 | u909075105 | 1525798678 | Python | Python3 | py | Runtime Error | 0 | 0 | 222 | A=[]
B=[]
a=i=0
for c in input():
if"\\"==c:A+=[i]
elif"/"==c and A:
j=A.pop()
t=i-j
a+=t
while B and B[-1][0]>j:t+=B[-1][1];B.pop()
B+=[(j,t)]
i+=1
print(a)
if p:print(len(B),*list(zip(*B))[1])
else:print(0)
| Traceback (most recent call last):
File "/tmp/tmpjqa1dp8d/tmpu01xjvt5.py", line 4, in <module>
for c in input():
^^^^^^^
EOFError: EOF when reading a line
| |
s385633054 | p02266 | u909075105 | 1525798721 | Python | Python3 | py | Runtime Error | 0 | 0 | 222 | x=[]
y=[]
a=i=0
for c in input():
if"\\"==c:x+=[i]
elif"/"==c and x:
j=x.pop()
t=i-j
a+=t
while y and y[-1][0]>j:t+=y[-1][1];y.pop()
y+=[(j,t)]
i+=1
print(a)
if p:print(len(y),*list(zip(*y))[1])
else:print(0)
| Traceback (most recent call last):
File "/tmp/tmp4ndwlk3k/tmpyj1m2g_b.py", line 4, in <module>
for c in input():
^^^^^^^
EOFError: EOF when reading a line
| |
s397934894 | p02266 | u011621222 | 1525918571 | Python | Python3 | py | Runtime Error | 30 | 5968 | 571 | from collections import deque
d1 = deque()
d2 = deque()
ss=input()
lenss=len(ss)
sum=0
for i in range(lenss):
if ss[i]=='\\':
d1.append(i)
elif ss[i]=='/' and len(d1)!=0:
j=d1.pop()
a=i-j
sum+=a
while len(d2)!=0 and j<d2[-1][0]:
a+=d2[-1][1]
d2.pop()
tupja=(j,a)
d2.append(tupja)
ans=[]
for i in d2:
ans.append(i[1])
print(sum)
print(len(ans),end=' ')
length=len(ans)
for i in range(0,length-1,1):
print(ans[i],end=' ')
print(ans[length-1])
| Traceback (most recent call last):
File "/tmp/tmpe9m974nd/tmpfengdec0.py", line 4, in <module>
ss=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s677430481 | p02266 | u011621222 | 1525918857 | Python | Python3 | py | Runtime Error | 30 | 5976 | 601 | from collections import deque
d1 = deque()
d2 = deque()
ss=input()
lenss=len(ss)
sum=0
for i in range(lenss):
if ss[i]=='\\':
d1.append(i)
elif ss[i]=='/' and len(d1)!=0:
j=d1.pop()
a=i-j
sum+=a
if len(d2)!=0:
while len(d2)!=0 and j<d2[-1][0]:
a+=d2[-1][1]
d2.pop()
tupja=(j,a)
d2.append(tupja)
ans=[]
for i in d2:
ans.append(i[1])
print(sum)
print(len(ans),end=' ')
length=len(ans)
for i in range(0,length-1,1):
print(ans[i],end=' ')
print(ans[length-1])
| Traceback (most recent call last):
File "/tmp/tmpt_kf_8xe/tmp6uhyf04g.py", line 4, in <module>
ss=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s146993744 | p02266 | u007270338 | 1527726082 | Python | Python3 | py | Runtime Error | 0 | 0 | 1465 | #coding:utf-8
data = input()
xmax = len(data)
data_list = list(data)
data_list.reverse()
reverse_data = []
for sig in data_list:
if sig == "\\":
reverse_data.append("/")
elif sig == "/":
reverse_data.append("\\")
else:
reverse_data.append(sig)
reverse_data = "".join(reverse_data)
def partialSqu(h, sig):
if sig == "\\":
squ = h + 1/2
h += 1
elif sig == "/":
squ = h - 1/2
h -= 1
elif sig == "_":
squ = h
return squ, h
x_squ_dict = {}
cnt = 0
sw, x, h, totalSqu = 0, 0, 0, 0
for sig in data:
x += 1
if sw == 0 and sig == "\\":
sw = 1
if sw == 1 :
squ, h = partialSqu(h, sig)
totalSqu += squ
if h == 0:
x_squ_dict[x] = totalSqu
totalSqu = 0
sw = 0
keys = x_squ_dict.keys()
sw, x, h, totalSqu = 0, 0, 0, 0
for sig in reverse_data:
x += 1
if sw == 0 and sig == "\\" :
sw = 1
x_p = xmax - x +1
if sw == 1 :
squ, h = partialSqu(h, sig)
totalSqu += squ
if h == 0:
x_squ_dict[x_p] = totalSqu
totalSqu = 0
sw = 0
)
keys = x_squ_dict.keys()
keys = list(keys)
keys.sort()
squ_list = []
for key in keys:
squ_list.append(x_squ_dict[key])
a = int(sum(squ_list))
print(a)
squ_list.insert(0,len(keys))
squ_list = " ".join([str(int(num)) for num in squ_list])
print(squ_list)
| File "/tmp/tmpt0cs0xyr/tmpad9z2apw.py", line 63
)
^
SyntaxError: unmatched ')'
| |
s806647152 | p02266 | u318430977 | 1528216718 | Python | Python3 | py | Runtime Error | 20 | 5592 | 1343 | def print_list_split_whitespace(a):
for x in a[:-1]:
print(x, end=' ')
print(a[-1])
def calc_puddle(map, l, r):
ans = 0
top = map[l]
before = map[l]
for i in range(l + 1, r + 1):
be_ans = ans
if map[i] == before:
ans += top - map[i]
elif map[i] < before:
ans += top - map[i] - 0.5
before = map[i]
else:
ans += top - map[i] + 0.5
before = map[i]
#print(ans - be_ans)
return int(ans)
cross_section = list(input())
map = [0]
y = 0
for c in cross_section:
if c == "/":
y += 1
map.append(y)
elif c == "\\":
y += -1
map.append(y)
else:
map.append(y)
max_right = len(map) - 1
#print(map)
#print(len(map))
left = 0
right = 1
ans = []
while left < max_right:
#print(left, right)
if map[left] <= map[right]:
left = right
right += 1
if right == max_right:
left = max_right
else:
right += 1
if map[left] == map[right]:
ans.append(calc_puddle(map, left, right))
elif right == max_right:
left += 1
right = left + 1
if right == max_right:
left = max_right
print(sum(ans))
ans.insert(0, len(ans))
print_list_split_whitespace(ans)
| Traceback (most recent call last):
File "/tmp/tmpblfo4nt9/tmpdb0k6ajy.py", line 25, in <module>
cross_section = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s018495734 | p02266 | u298224238 | 1529819907 | Python | Python3 | py | Runtime Error | 0 | 0 | 871 | input_str = input()
this_depth = 0
depth_list = [this_depth]
for c in input_str:
if c == '\\':
this_depth += 1
elif c == '_'
this_depth += 0
else
this_depth += -1
depth_list.append(this_depth)
min_depth = min(depth_list)
max_depth = max(depth_list)
length = len(depth_list)
holes = [(-1, -1)] * length
for target_depth in range(min_depth, max_depth + 1):
i = 0
l = [i for i in range(len(depth_list)) if depth_list[i] == target_depth]
for j in range(len(l) - 1):
area = 0
for k in range(l[j] + 1, l[j + 1]):
area += depth_list[k] - target_depth
depth_list[k] = target_depth
holes.append((l[j], area))
holes = [h[1]for h in sorted(
[h for h in holes if h[1] and h[1] > 0], key=lambda hole: hole[0])]
print(sum(holes))
print(" ".join(map(str, [len(holes)] + holes)))
| File "/tmp/tmp_lvu8avv/tmpp6ce2rt5.py", line 7
elif c == '_'
^
SyntaxError: expected ':'
| |
s693548091 | p02267 | u153665391 | 1531019549 | Python | Python3 | py | Runtime Error | 0 | 0 | 227 | N = int(input())
S = list(map(int, input()))
Q = int(input())
T = list(map(int, input()))
match_count = 0
for i in T:
for j in S:
if i == j:
match_count += 1
break
print(str(match_count))
| Traceback (most recent call last):
File "/tmp/tmp__ynv8vn/tmpqwko54qw.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s520741817 | p02267 | u286589639 | 1556516868 | Python | Python3 | py | Runtime Error | 0 | 0 | 152 | n = int(input())
S = list(int, input().split())
q = int(input())
T = list(int, input().split())
cnt = 0
for t in T:
if s in S:
cnt += 1
print(cnt)
| Traceback (most recent call last):
File "/tmp/tmp2xv7gpgx/tmpb8xwj3dd.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s460631025 | p02267 | u286589639 | 1556516916 | Python | Python3 | py | Runtime Error | 0 | 0 | 162 | n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
cnt = 0
for t in T:
if s in S:
cnt += 1
print(cnt)
| Traceback (most recent call last):
File "/tmp/tmppkf29xh4/tmpox51c_ib.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s970840474 | p02267 | u245286435 | 1423641612 | Python | Python | py | Runtime Error | 20 | 4204 | 192 | n = int(raw_input())
S = map(int, raw_input().split(" "))
q = int(raw_input())
T = map(int, raw_input().split(" "))
count = 0
for n in S:
for j in T:
if n == j:
count += 1
print count | File "/tmp/tmpy20b2_8t/tmpvq98m0q5.py", line 12
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s961619405 | p02267 | u245286435 | 1423641845 | Python | Python | py | Runtime Error | 0 | 0 | 216 |
n = int(raw_input())
S = map(int, raw_input().split(" ").strip(" "))
q = int(raw_input())
T = map(int, raw_input().split(" ").strip(" "))
count = 0
for n in S:
for j in T:
if n == j:
count += 1
print count | File "/tmp/tmpw1r6q5s4/tmpmxnp3ef2.py", line 14
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s948722876 | p02267 | u024599888 | 1428561297 | Python | Python | py | Runtime Error | 0 | 0 | 673 | class Sequence:
def __init__(self,num, seq):
self.n = num
self.sequence = seq
def LinearSearch(A, n, key):
i=0
A[n] = key
while A[i] != key:
i += 1
if i==n:
return "NOT_FOUND"
return i
if __name__ == "__main__":
with open("LinearSearch.txt") as fp:
data = fp.readlines()
x = data[1].split()
x.append(" ")
A = Sequence(int(data[0]), x)
x = data[3].split()
x.append(" ")
B = Sequence(int(data[2]), x)
C = []
for i in range(B.n):
res = LinearSearch(A.sequence, A.n, B.sequence[i])
if res != "NOT_FOUND":
C.append(A.sequence[res])
print(C) | Traceback (most recent call last):
File "/tmp/tmpk_ko5ktk/tmplsoyoa2g.py", line 16, in <module>
with open("LinearSearch.txt") as fp:
^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'LinearSearch.txt'
| |
s352087424 | p02267 | u604774382 | 1433330504 | Python | Python | py | Runtime Error | 10 | 4212 | 245 | n = int( raw_input( ) )
t = [ int( val ) for val in raw_input( ).split( " " ) ]
q = int( raw_input( ) )
s = [ int( val ) for val in raw_input( ).split( " " ) ]
cnt = 0
for si in s:
for ti in t:
if si == ti:
cnt += 1
break
print( cnt ) | Traceback (most recent call last):
File "/tmp/tmpfeb897fy/tmpb2pzoh4w.py", line 1, in <module>
n = int( raw_input( ) )
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s036963045 | p02267 | u604774382 | 1433330781 | Python | Python | py | Runtime Error | 10 | 4212 | 245 | n = int( raw_input( ) )
t = [ int( val ) for val in raw_input( ).split( " " ) ]
q = int( raw_input( ) )
s = [ int( val ) for val in raw_input( ).split( " " ) ]
cnt = 0
for si in s:
for ti in t:
if si == ti:
cnt += 1
break
print( cnt ) | Traceback (most recent call last):
File "/tmp/tmpashx4d7y/tmpzpcqnneh.py", line 1, in <module>
n = int( raw_input( ) )
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s546060605 | p02267 | u604774382 | 1433330794 | Python | Python3 | py | Runtime Error | 0 | 0 | 237 | n = int( input( ) )
t = [ int( val ) for val in raw_input( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in raw_input( ).split( " " ) ]
cnt = 0
for si in s:
for ti in t:
if si == ti:
cnt += 1
break
print( cnt ) | Traceback (most recent call last):
File "/tmp/tmpp4p96be4/tmplgeoaa8s.py", line 1, in <module>
n = int( input( ) )
^^^^^^^^
EOFError: EOF when reading a line
| |
s088252171 | p02267 | u604774382 | 1433330903 | Python | Python3 | py | Runtime Error | 30 | 6720 | 229 | n = int( input( ) )
t = [ int( val ) for val in input( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
cnt = 0
for si in s:
for ti in t:
if si == ti:
cnt += 1
break
print( cnt ) | Traceback (most recent call last):
File "/tmp/tmplvt3gb3h/tmpzxftsx3a.py", line 1, in <module>
n = int( input( ) )
^^^^^^^^
EOFError: EOF when reading a line
| |
s153452975 | p02267 | u881590806 | 1448607579 | Python | Python | py | Runtime Error | 10 | 6356 | 264 | n = int(raw_input())
S = map(int, raw_input().split(' '))
q = int(raw_input())
T = map(int, raw_input().split(' '))
def search(S,k):
for s in S:
if s == k:
return True
return False
c = 0
for t in T:
if search(S,t): c += 1
print c | File "/tmp/tmpyjcr3vbn/tmpy7mx0oeo.py", line 16
print c
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s736829266 | p02267 | u963402991 | 1448889351 | Python | Python3 | py | Runtime Error | 20 | 7588 | 396 | # -*- coding: utf-8 -*-
def linerSearch(S, key):
tmp = S[::1]
i = 0
tmp.append(key)
while S[i] != key:
i += 1
if i == len(tmp)-1:
return False
return True
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
count = 0
for i in range(q):
if linerSearch(S, T[i]):
count += 1
print(count) | Traceback (most recent call last):
File "/tmp/tmpnttomrk7/tmpxfwiwhd7.py", line 14, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s630138611 | p02267 | u000228958 | 1452075468 | Python | Python | py | Runtime Error | 0 | 0 | 236 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
cnt = 0
for i in range(n):
for j in range(q):
if S[i] == T[j]:
cnt = cnt + 1
print cnt
~ | File "/tmp/tmp8wifc6ny/tmp84f32sr1.py", line 15
print cnt
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s377249382 | p02267 | u000228958 | 1452075707 | Python | Python3 | py | Runtime Error | 0 | 0 | 219 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
cnt = 0
for i in range(n):
for j in range(q):
if S[i] == T[j]:
cnt = cnt + 1
print cnt | File "/tmp/tmp4510c0os/tmpxoldtj8p.py", line 15
print cnt
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s650933499 | p02267 | u000228958 | 1452075842 | Python | Python3 | py | Runtime Error | 0 | 0 | 225 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
cnt = 0
for i in range(n):
for j in range(q):
if S[i] == T[j]:
cnt = cnt + 1
break
print cnt | File "/tmp/tmpszpoi1me/tmp0qfb9q7_.py", line 16
print cnt
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s268040794 | p02267 | u000228958 | 1452075912 | Python | Python3 | py | Runtime Error | 0 | 0 | 225 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
cnt = 0
for j in range(q):
for i in range(n):
if S[i] == T[j]:
cnt = cnt + 1
break
print cnt | File "/tmp/tmpwflcjxv3/tmplziitg84.py", line 16
print cnt
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s608827623 | p02267 | u000228958 | 1452077086 | Python | Python3 | py | Runtime Error | 0 | 0 | 251 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
S.append(0)
cnt = 0
for i in range(q):
j = 0
S[n] = T[j]
while S[j] != S[n]:
j = j + 1
if j != n:
cnt = cnt + 1
print cnt | File "/tmp/tmp1srpisab/tmpqrxaydci.py", line 20
print cnt
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s297918577 | p02267 | u000228958 | 1452077365 | Python | Python3 | py | Runtime Error | 0 | 0 | 251 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
S.append(0)
cnt = 0
for i in range(q):
j = 0
S[n] = T[i]
while S[j] != S[n]:
j = j + 1
if j != n:
cnt = cnt + 1
print cnt | File "/tmp/tmpqqp5kwb_/tmpwtpx9ixr.py", line 20
print cnt
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s641258493 | p02267 | u619765879 | 1452080029 | Python | Python | py | Runtime Error | 0 | 0 | 169 | n = input()
S = [int(x) for x in raw_input().split]
q = input()
T = [int(x) for x in raw_input().split]
C = 0
for i in S:
for j in T:
if i==j:
C += 1
print C | File "/tmp/tmpa17fmt97/tmpt_aryief.py", line 16
print C
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s491681487 | p02267 | u619765879 | 1452080484 | Python | Python | py | Runtime Error | 0 | 0 | 183 | n = input()
S = [int(x) for x in raw_input().split()]
q = input()
T = [int(x) for x in raw_input().split()]
C = 0
for i in S:
for j in T:
if i==j:
C += 1
break:
print C | File "/tmp/tmp4xyznbwp/tmpxg1lo9w7.py", line 15
break:
^
SyntaxError: invalid syntax
| |
s325056289 | p02267 | u177295149 | 1452614030 | Python | Python | py | Runtime Error | 0 | 0 | 192 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
C = 0
for i in range(n):
for j in range(q):
if T[j] == S[i]:
C++
print C | File "/tmp/tmpfwui1cbi/tmply05mipc.py", line 11
for i in range(n):
IndentationError: unexpected indent
| |
s261577257 | p02267 | u177295149 | 1452614141 | Python | Python | py | Runtime Error | 0 | 0 | 195 | n = input()
S[ ] = map(int, raw_input().split())
q = input()
T[ ] = map(int, raw_input().split())
C = 0
for i in range(0,n):
for j in range(0,q):
if T[j] == S[i]:
C++
print C | File "/tmp/tmpjme87z90/tmp2o3uqn1e.py", line 3
S[ ] = map(int, raw_input().split())
^
SyntaxError: invalid syntax
| |
s345875607 | p02267 | u177295149 | 1452614154 | Python | Python | py | Runtime Error | 0 | 0 | 189 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
C = 0
for i in range(0,n):
for j in range(0,q):
if T[j] == S[i]:
C++
print C | File "/tmp/tmp9s1xhadv/tmpb51y7681.py", line 14
C++
^
SyntaxError: invalid syntax
| |
s778106684 | p02267 | u177295149 | 1452614281 | Python | Python | py | Runtime Error | 0 | 0 | 189 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
C = 0
for i in range(n-1):
for j in range(q-1):
if T[j] == S[i]:
C++
print C | File "/tmp/tmp9px9i1fo/tmp7uzrwlm8.py", line 14
C++
^
SyntaxError: invalid syntax
| |
s564171041 | p02267 | u177295149 | 1452614348 | Python | Python | py | Runtime Error | 0 | 0 | 189 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
C = 0
for i in range(n-1):
for j in range(q-1):
if T[j] == S[i]:
C++
print C | File "/tmp/tmpndbl8w04/tmpvof4zf5l.py", line 14
C++
^
SyntaxError: invalid syntax
| |
s438196383 | p02267 | u424209323 | 1456576114 | Python | Python | py | Runtime Error | 0 | 0 | 251 | n = input()
S = map(int, raw_input().split())
q = input()
T = map(int, raw_input().split())
count = 0
for i in range(n):
Search = T[i]
for j in range(q):
if S[j] == Search:
count = count + 1
break
print count | File "/tmp/tmplfkp4usf/tmpm13hf46_.py", line 15
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s128647488 | p02267 | u247279609 | 1457495635 | Python | Python | py | Runtime Error | 10 | 6276 | 205 | n = int(raw_input(''))
S = raw_input('').split(' ')
q = int(raw_input(''))
T = raw_input('').split(' ')
count = 0
for t in T:
for s in S:
if int(t)==int(s):
count+=1
print count | File "/tmp/tmpkb6_shwd/tmpmub5cops.py", line 12
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s769824365 | p02267 | u159356473 | 1477294473 | Python | Python3 | py | Runtime Error | 0 | 0 | 355 | #coding:UTF-8
def LS(n,S,q,T):
count=0
if n>q:
for i in q:
if T[i] in S:
count+=1
else:
for i in n:
if S[i] in T:
count+=1
print(count)
if __name__=="__main__":
n=int(input())
S=input().split(" ")
q=int(input())
T=input().split(" ")
LS(n,S,q,T) | Traceback (most recent call last):
File "/tmp/tmpxqodlaex/tmphedcepoq.py", line 15, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s102050512 | p02267 | u022407960 | 1478068332 | Python | Python3 | py | Runtime Error | 0 | 0 | 974 | # encoding: utf-8
import sys
class Solution:
def __init__(self):
"""
init input array
"""
self.__input = sys.stdin.readlines()
@property
def solution(self):
length_1 = int(self.__input[0])
array_1 = list(map(int, self.__input[1].split()))
length_2 = int(self.__input[2])
array_2 = list(map(int, self.__input[3].split()))
assert length_1 == len(array_1) and length_2 == len(array_2)
count = 0
for each in array_2:
if self.linear_search(key=each, array=array_1, array_length=length_1):
count += 1
return str(count)
@staticmethod
def linear_search(key, array, array_length):
# print(len(set(array_1).intersection(set(array_2))))
for i in array_length:
if array[i] == key:
return True
return False
if __name__ == '__main__':
case = Solution()
print(case.solution) | Traceback (most recent call last):
File "/tmp/tmp_gblvn_b/tmpvm2esmc0.py", line 41, in <module>
print(case.solution)
^^^^^^^^^^^^^
File "/tmp/tmp_gblvn_b/tmpvm2esmc0.py", line 16, in solution
length_1 = int(self.__input[0])
~~~~~~~~~~~~^^^
IndexError: list index out of range
| |
s624850935 | p02267 | u918276501 | 1485102538 | Python | Python3 | py | Runtime Error | 0 | 0 | 159 | input()
s = set(map(int,input().split()))
n = int(input())
t = set(map(int,input().split()))
c = 0
for i in range(n):
if t[i] in s:
c += 1
print(c) | Traceback (most recent call last):
File "/tmp/tmpw4oyue2b/tmp_2xgo5d5.py", line 1, in <module>
input()
EOFError: EOF when reading a line
| |
s141405016 | p02267 | u370086573 | 1488724837 | Python | Python3 | py | Runtime Error | 0 | 0 | 378 | def linearSearch(A, n, key):
i = 0
A.append(key)
while A[i] != key:
i += 1
del A[n]
return i != n
if __name__ == '__main__':
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
cnt = 0
for i in q:
if linearSearch(S, n,T[i]):
cnt += 1
print(cnt) | Traceback (most recent call last):
File "/tmp/tmpvxz6c2kj/tmp66ohpkyx.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s745794494 | p02267 | u300946041 | 1490269990 | Python | Python3 | py | Runtime Error | 0 | 0 | 262 | # encording: utf-8
n = int(input())
ns = [int(input()) for _ in range(n)]
q = int(input())
qs = [int(input()) for _ in range(n)]
def main(ns, qs):
total = 0
for q in qs:
if q in ns:
total += 1
return total
print(main(ns, qs)) | Traceback (most recent call last):
File "/tmp/tmpredzbbjy/tmp95n1q3s0.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s717103841 | p02267 | u130834228 | 1490515947 | Python | Python3 | py | Runtime Error | 0 | 0 | 138 | n = input()
S = input().split()
q = input()
T = input().split()
cnt = 0
for i in range(T):
if T[i] in S:
cnt += 1
print(cnt) | Traceback (most recent call last):
File "/tmp/tmpx2rd37a_/tmpnm0nzs83.py", line 1, in <module>
n = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s948915848 | p02267 | u796784914 | 1494659297 | Python | Python | py | Runtime Error | 0 | 0 | 470 | def main():
n = input()
D = []
O = []
for i in range(n):
c, k = raw_input().split()
if c == 'insert':
D.append(k)
else:
O.append(search(D,k))
for item in O:
print item
return 0
def search(D,k):
Dc = D[:]
o = 'no'
while Dc != []:
d = Dc.pop()
if d == k:
o = 'yes'
break
return o
if __name__ == "__main__":
main() | File "/tmp/tmp5m8vfwh5/tmpqwdpklje.py", line 13
print item
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s927040538 | p02267 | u279605379 | 1499655512 | Python | Python3 | py | Runtime Error | 0 | 0 | 101 | n=input()
S=input().split()
q=input()
T=input().split()
c=0
for(t in T):
if(t in S):c+=1
print(c) | File "/tmp/tmpqszxhwz6/tmpjz42jw00.py", line 6
for(t in T):
^
SyntaxError: invalid syntax
| |
s030185147 | p02267 | u747635679 | 1500329015 | Python | Python3 | py | Runtime Error | 30 | 7660 | 223 | n = int(input())
s = [int(x) for x in input().split()]
q = int(input())
t = [int(x) for x in input().split()]
s.sort()
t.sort()
i = 0
cnt = 0
for x in t:
while s[i] <= x:
if s[i] == x:
cnt += 1
i += 1
print(cnt) | Traceback (most recent call last):
File "/tmp/tmpqsa_20mc/tmp4x79dtee.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s699185356 | p02267 | u747635679 | 1500349449 | Python | Python3 | py | Runtime Error | 20 | 7716 | 253 | n = int(input())
s = [int(x) for x in input().split()]
q = int(input())
t = [int(x) for x in input().split()]
s.sort()
t.sort()
i = 0
cnt = 0
for x in t:
if i < n:
while s[i] <= x:
if s[i] == x:
cnt += 1
i += 1
else:
break
print(cnt) | Traceback (most recent call last):
File "/tmp/tmp1ly8kzxz/tmpl_y7isw8.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s665128603 | p02267 | u735204496 | 1505025101 | Python | Python | py | Runtime Error | 0 | 0 | 261 | import sys
n = int(sys.stdin.readline().strip())
S = map(int, sys.stdin.readline().strip().split(" "))
n = int(sys.stdin.readline().strip())
T = map(int, sys.stdin.readline().strip().split(" "))
res = []
for t in T:
rse.append(S.count(t))
print sum(res) | File "/tmp/tmp_rpqfczp/tmpk8uctyjf.py", line 13
print sum(res)
^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s809877424 | p02267 | u735204496 | 1505025137 | Python | Python | py | Runtime Error | 0 | 0 | 261 | import sys
n = int(sys.stdin.readline().strip())
S = map(int, sys.stdin.readline().strip().split(" "))
n = int(sys.stdin.readline().strip())
T = map(int, sys.stdin.readline().strip().split(" "))
res = []
for t in T:
rse.append(S.count(t))
print sum(res) | File "/tmp/tmpcgskd4m_/tmpl1gwb8tc.py", line 13
print sum(res)
^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.