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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s090841183 | p02265 | u777299405 | 1437125951 | Python | Python3 | py | Runtime Error | 30 | 6732 | 360 | from collections import deque
n = int(input())
que = deque()
for i in range(n):
command = input()
if command == "deleteFirst":
que.popleft()
elif command == "deleteLast":
que.pop()
else:
a, b = command.split()
if a == "insert":
que.appendleft(b)
else:
que.remove(b)
print(*que) | Traceback (most recent call last):
File "/tmp/tmpe3nz1lft/tmp_qdmvh56.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s614072716 | p02265 | u669284080 | 1438152447 | Python | Python | py | Runtime Error | 0 | 0 | 346 | n = int(raw_input())
R = []
for i in xrange(n):
L = raw_input().split()
order = L[0]
value = int(L[1])
if order == 'insert':
R.insert(0, value)
if order == 'delete':
R.remove(value)
if order == 'deleteFirst':
R.pop()
if order == 'deleteLast':
R.pop(len(R)-1)
print ' '.join(map(str, R)) | File "/tmp/tmpjf4fpi92/tmpveumhc6r.py", line 15
print ' '.join(map(str, R))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s937386570 | p02265 | u669284080 | 1438152750 | Python | Python | py | Runtime Error | 20 | 4224 | 376 | n = int(raw_input())
R = []
for i in xrange(n):
L = raw_input().split()
order = L[0]
value = 0
if len(L) > 1:
value = int(L[1])
if order == 'insert':
R.insert(0, value)
if order == 'delete':
R.remove(value)
if order == 'deleteFirst':
R.pop(0)
if order == 'deleteLast':
R.pop()
print ' '.join(map(str, R)) | File "/tmp/tmpgehvc3qp/tmp9hlxg6oa.py", line 17
print ' '.join(map(str, R))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s195309854 | p02265 | u669360983 | 1438665706 | Python | Python | py | Runtime Error | 0 | 0 | 246 | list=[]
n=int(raw_input())
for i in range(n):
inst,value=raw_input().split()
if inst=='insert':
list.insert(0,int(value))
elif inst=='delete':
list.remove(int(value))
elif inst=='deleteFirst':
del list[0]
else :list.pop()
print list
| File "/tmp/tmp0kckdjl0/tmpz035115p.py", line 12
print list
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s672823429 | p02265 | u669360983 | 1438665740 | Python | Python | py | Runtime Error | 0 | 0 | 243 | list=[]
n=int(raw_input())
for i in range(n):
inst,value=raw_input().split()
if inst=='insert':
list.insert(0,int(value))
elif inst=='delete':
list.remove(int(value))
elif inst=='deleteFirst':
del list[0]
else :list.pop()
print list | File "/tmp/tmpj_tbtkss/tmp7_nhb0kn.py", line 12
print list
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s105573423 | p02265 | u669360983 | 1438666443 | Python | Python | py | Runtime Error | 10 | 4220 | 267 | list=[]
n=int(raw_input())
for i in range(n):
inst=raw_input().split()
if inst[0]=='insert':
list.insert(0,int(inst[1]))
elif inst[0]=='delete':
list.remove(int(inst[1]))
elif inst[0]=='deleteFirst':
del list[0]
else :list.pop()
for i in list:
print i, | File "/tmp/tmpgd326hvq/tmpq0mvfyiv.py", line 15
print i,
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s509585812 | p02265 | u237991875 | 1442301291 | Python | Python | py | Runtime Error | 10 | 6336 | 283 | A = []
n = int(raw_input())
stack = []
for i in range(n):
A.append(raw_input())
for i in A:
if "insert" in i:
stack.insert(0, i[7:])
elif "delete " in i:
stack.remove(i[7:])
elif "deleteFirst" in i:
stack.pop(0)
elif "deleteLast" in i:
stack.pop()
print " ".join(stack) | File "/tmp/tmpcm6t6e9w/tmpmr5p_xvb.py", line 16
print " ".join(stack)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s018231946 | p02265 | u237991875 | 1442301474 | Python | Python | py | Runtime Error | 10 | 6264 | 283 | A = []
n = int(raw_input())
stack = []
for i in range(n):
A.append(raw_input())
for i in A:
if "insert" in i:
stack.insert(0, i[7:])
elif "delete " in i:
stack.remove(i[7:])
elif "deleteFirst" in i:
stack.pop(0)
elif "deleteLast" in i:
stack.pop()
print " ".join(stack) | File "/tmp/tmpj019iltu/tmpm8nbf4_e.py", line 16
print " ".join(stack)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s155979215 | p02265 | u237991875 | 1442301624 | Python | Python | py | Runtime Error | 10 | 6312 | 340 | A = []
n = int(raw_input())
stack = []
for i in range(n):
A.append(raw_input())
for i in A:
if "insert" in i:
stack.insert(0, i[7:])
elif "delete " in i and len(stack) > 0:
stack.remove(i[7:])
elif "deleteFirst" in i and len(stack) > 0:
stack.pop(0)
elif "deleteLast" in i and len(stack) > 0:
stack.pop()
print " ".join(stack) | File "/tmp/tmpv3pc1t0u/tmparvrszle.py", line 16
print " ".join(stack)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s421260658 | p02265 | u237991875 | 1442302616 | Python | Python | py | Runtime Error | 10 | 6256 | 363 | A = []
n = int(raw_input())
stack = []
for i in range(n):
A.append(raw_input())
for i in A:
if "insert" in i:
stack.insert(0, i[7:])
elif "delete " in i and len(stack) > 0:
stack.remove(i[7:])
elif "deleteFirst" in i and len(stack) > 0:
stack.pop(0)
elif "deleteLast" in i and len(stack) > 0:
stack.pop()
if len(stack) > 0:
print " ".join(stack) | File "/tmp/tmp02613a4d/tmp58cehrof.py", line 17
print " ".join(stack)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s761782350 | p02265 | u237991875 | 1442302718 | Python | Python | py | Runtime Error | 10 | 6276 | 383 | A = []
n = int(raw_input())
stack = []
for i in range(n):
A.append(raw_input())
for i in A:
if "insert" in i:
stack.insert(0, int(i[7:]))
elif "delete " in i and len(stack) > 0:
stack.remove(int(i[7:]))
elif "deleteFirst" in i and len(stack) > 0:
stack.pop(0)
elif "deleteLast" in i and len(stack) > 0:
stack.pop()
if len(stack) > 0:
print " ".join(map(str, stack)) | File "/tmp/tmpn2d7_yij/tmp9lwxit5_.py", line 17
print " ".join(map(str, stack))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s640146720 | p02265 | u237991875 | 1442304103 | Python | Python | py | Runtime Error | 0 | 0 | 342 | from collections import deque
n = int(raw_input())
stack = deque()
for i in range(n):
i = raw_input()
if "insert" in i:
stack.insert(0, int(i[7:]))
elif "delete " in i:
if int(i[7:]) in stack:
stack.remove(int(i[7:]))
elif "deleteFirst" in i:
stack.pop(0)
elif "deleteLast" in i:
stack.pop()
print " ".join(map(str, stack)) | File "/tmp/tmps5a793xk/tmpojwwgm6z.py", line 15
print " ".join(map(str, stack))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s238376346 | p02265 | u237991875 | 1442304278 | Python | Python | py | Runtime Error | 0 | 0 | 341 | from collections import deque
n = int(raw_input())
stack = []
for i in range(n):
i = raw_input()
if "insert" in i:
stack.appendleft(int(i[7:]))
elif "delete " in i:
if int(i[7:]) in stack:
stack.remove(int(i[7:]))
elif "deleteFirst" in i:
stack.popleft()
elif "deleteLast" in i:
stack.pop()
print " ".join(map(str, stack)) | File "/tmp/tmphyogiyu5/tmpif8rvq9i.py", line 15
print " ".join(map(str, stack))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s583845226 | p02265 | u408701661 | 1442331475 | Python | Python | py | Runtime Error | 10 | 6352 | 2595 | #!/usr/bin/python
# -*- coding:utf-8 -*-
class Node(object):
def __init__(self, data, prev_node, next_node):
self.data = data
self.prev_node = prev_node
self.next_node = next_node
class DoubleList(object):
head = None
tail = None
def insert(self, data):
new_node = Node(data, None, None)
if self.head is None:
self.head = self.tail = new_node
else:
new_node.next_node = self.head
new_node.prev_node = None
self.head.prev_node = new_node
self.head = new_node
def delete(self, data_value):
current_node = self.head
while current_node is not None:
if current_node.data == data_value:
if current_node.prev_node is not None and current_node.next_node is not None:
current_node.prev_node.next_node = current_node.next_node
current_node.next_node.prev_node = current_node.prev_node
elif current_node.prev_node is None:
self.head = current_node.next_node
current_node.next_node.prev_node = None
elif current_node.next_node is None:
self.tail = current_node.prev_node
current_node.prev_node.next_node = None
current_node = current_node.next_node
def deleteFirst(self):
if self.head.next_node is not None:
self.head.next_node.prev_node = None
self.head = self.head.next_node
else:
self.head = self.tail = None
def deleteLast(self):
if self.tail.prev_node is not None:
self.tail.prev_node.next_node = None
self.tail = self.tail.prev_node
else:
self.head = self.tail = None
def show(self):
current_node = self.head
data = ""
while current_node is not None:
data += current_node.data+" "
current_node = current_node.next_node
print data[:-1]
if __name__ == "__main__":
DL = DoubleList()
num = int(raw_input())
for i in range(num):
line = raw_input()
if " " in line:
operation = line.strip().split()[0]
value = line.strip().split()[1]
else:
operation = line.strip()
if operation == "insert":
DL.insert(value)
elif operation == "delete":
DL.delete(value)
elif operation == "deleteFirst":
DL.deleteFirst()
else:
DL.deleteLast()
DL.show() | File "/tmp/tmp9tkl3qol/tmp1al0paia.py", line 59
print data[:-1]
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s228632935 | p02265 | u408701661 | 1442331507 | Python | Python | py | Runtime Error | 10 | 6336 | 2595 | #!/usr/bin/python
# -*- coding:utf-8 -*-
class Node(object):
def __init__(self, data, prev_node, next_node):
self.data = data
self.prev_node = prev_node
self.next_node = next_node
class DoubleList(object):
head = None
tail = None
def insert(self, data):
new_node = Node(data, None, None)
if self.head is None:
self.head = self.tail = new_node
else:
new_node.next_node = self.head
new_node.prev_node = None
self.head.prev_node = new_node
self.head = new_node
def delete(self, data_value):
current_node = self.head
while current_node is not None:
if current_node.data == data_value:
if current_node.prev_node is not None and current_node.next_node is not None:
current_node.prev_node.next_node = current_node.next_node
current_node.next_node.prev_node = current_node.prev_node
elif current_node.prev_node is None:
self.head = current_node.next_node
current_node.next_node.prev_node = None
elif current_node.next_node is None:
self.tail = current_node.prev_node
current_node.prev_node.next_node = None
current_node = current_node.next_node
def deleteFirst(self):
if self.head.next_node is not None:
self.head.next_node.prev_node = None
self.head = self.head.next_node
else:
self.head = self.tail = None
def deleteLast(self):
if self.tail.prev_node is not None:
self.tail.prev_node.next_node = None
self.tail = self.tail.prev_node
else:
self.head = self.tail = None
def show(self):
current_node = self.head
data = ""
while current_node is not None:
data += current_node.data+" "
current_node = current_node.next_node
print data[:-1]
if __name__ == "__main__":
DL = DoubleList()
num = int(raw_input())
for i in range(num):
line = raw_input()
if " " in line:
operation = line.strip().split()[0]
value = line.strip().split()[1]
else:
operation = line.strip()
if operation == "insert":
DL.insert(value)
elif operation == "delete":
DL.delete(value)
elif operation == "deleteFirst":
DL.deleteFirst()
else:
DL.deleteLast()
DL.show() | File "/tmp/tmp6xjzrhd5/tmpsqs1zhq2.py", line 59
print data[:-1]
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s996228869 | p02265 | u408701661 | 1442332532 | Python | Python | py | Runtime Error | 10 | 6404 | 2595 | #!/usr/bin/python
# -*- coding:utf-8 -*-
class Node(object):
def __init__(self, data, prev_node, next_node):
self.data = data
self.prev_node = prev_node
self.next_node = next_node
class DoubleList(object):
head = None
tail = None
def insert(self, data):
new_node = Node(data, None, None)
if self.head is None:
self.head = self.tail = new_node
else:
new_node.next_node = self.head
new_node.prev_node = None
self.head.prev_node = new_node
self.head = new_node
def delete(self, data_value):
current_node = self.head
while current_node is not None:
if current_node.data == data_value:
if current_node.prev_node is not None and current_node.next_node is not None:
current_node.prev_node.next_node = current_node.next_node
current_node.next_node.prev_node = current_node.prev_node
elif current_node.prev_node is None:
self.head = current_node.next_node
current_node.next_node.prev_node = None
elif current_node.next_node is None:
self.tail = current_node.prev_node
current_node.prev_node.next_node = None
current_node = current_node.next_node
def deleteFirst(self):
if self.head.next_node is not None:
self.head.next_node.prev_node = None
self.head = self.head.next_node
else:
self.head = self.tail = None
def deleteLast(self):
if self.tail.prev_node is not None:
self.tail.prev_node.next_node = None
self.tail = self.tail.prev_node
else:
self.head = self.tail = None
def show(self):
current_node = self.head
data = ""
while current_node is not None:
data += current_node.data+" "
current_node = current_node.next_node
print data[:-1]
if __name__ == "__main__":
DL = DoubleList()
num = int(raw_input())
for i in range(num):
line = raw_input()
if " " in line:
operation = line.strip().split()[0]
value = line.strip().split()[1]
else:
operation = line.strip()
if operation == "insert":
DL.insert(value)
elif operation == "delete":
DL.delete(value)
elif operation == "deleteFirst":
DL.deleteFirst()
else:
DL.deleteLast()
DL.show() | File "/tmp/tmpxbc19vlu/tmpgppjdu29.py", line 59
print data[:-1]
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s771988927 | p02265 | u408701661 | 1442332764 | Python | Python | py | Runtime Error | 10 | 6404 | 2621 | #!/usr/bin/python
# -*- coding:utf-8 -*-
class Node(object):
def __init__(self, data, prev_node, next_node):
self.data = data
self.prev_node = prev_node
self.next_node = next_node
class DoubleList(object):
head = None
tail = None
def insert(self, data):
new_node = Node(data, None, None)
if self.head is None:
self.head = self.tail = new_node
else:
new_node.next_node = self.head
new_node.prev_node = None
self.head.prev_node = new_node
self.head = new_node
def delete(self, data_value):
current_node = self.head
while current_node is not None:
if current_node.data == data_value:
if current_node.prev_node is not None and current_node.next_node is not None:
current_node.prev_node.next_node = current_node.next_node
current_node.next_node.prev_node = current_node.prev_node
break
elif current_node.prev_node is None:
self.head = current_node.next_node
current_node.next_node.prev_node = None
elif current_node.next_node is None:
self.tail = current_node.prev_node
current_node.prev_node.next_node = None
current_node = current_node.next_node
def deleteFirst(self):
if self.head.next_node is not None:
self.head.next_node.prev_node = None
self.head = self.head.next_node
else:
self.head = self.tail = None
def deleteLast(self):
if self.tail.prev_node is not None:
self.tail.prev_node.next_node = None
self.tail = self.tail.prev_node
else:
self.head = self.tail = None
def show(self):
current_node = self.head
data = ""
while current_node is not None:
data += current_node.data+" "
current_node = current_node.next_node
print data[:-1]
if __name__ == "__main__":
DL = DoubleList()
num = int(raw_input())
for i in range(num):
line = raw_input()
if " " in line:
operation = line.strip().split()[0]
value = line.strip().split()[1]
else:
operation = line.strip()
if operation == "insert":
DL.insert(value)
elif operation == "delete":
DL.delete(value)
elif operation == "deleteFirst":
DL.deleteFirst()
else:
DL.deleteLast()
DL.show() | File "/tmp/tmp3z6nzkn3/tmpigxv5b5d.py", line 60
print data[:-1]
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s112560289 | p02265 | u019737947 | 1442369532 | Python | Python | py | Runtime Error | 10 | 6292 | 302 | n = int(raw_input())
L = list()
for i in range(n):
S = raw_input().split(" ")
if S[0] == "insert":
L.insert(0, S[1])
elif S[0] == "delete":
L.remove(S[1])
elif S[0] == "deleteFirst":
L.pop(0)
elif S[0] == "deleteLast":
L.pop()
print " ".join(L) | File "/tmp/tmpaauvxwfa/tmpdfv_dca4.py", line 18
print " ".join(L)
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s447017680 | p02265 | u386372280 | 1442369744 | Python | Python | py | Runtime Error | 10 | 6356 | 721 | import sys
DLL = []
def insert(x):
DLL.insert(0, x)
def delete(x):
DLL.remove(x)
def deleteFirst():
DLL.pop(0)
def deleteLast():
DLL.pop(-1)
def main(commands):
for command in commands:
vals = command.strip().split(" ")
com = vals[0]
if len(vals) == 2:
num = vals[1]
if com == "insert":
insert(num)
elif com == "delete":
delete(num)
elif com == "deleteFirst":
deleteFirst()
else:
deleteLast()
return DLL
if __name__ == "__main__":
lines = sys.stdin.readlines()
n = lines[0]
commands = lines[1:]
DLL = main(commands)
print " ".join(DLL) | File "/tmp/tmploaykev6/tmprp6xuc95.py", line 41
print " ".join(DLL)
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s975948879 | p02265 | u019737947 | 1442369764 | Python | Python | py | Runtime Error | 10 | 6340 | 304 | n = int(raw_input())
L = list()
for i in range(n):
S = raw_input().split(" ")
if S[0] == "insert":
L.insert(0, S[1])
elif S[0] == "delete":
L.remove(S[1])
elif S[0] == "deleteFirst":
L.pop(0)
elif S[0] == "deleteLast":
L.pop(-1)
print " ".join(L) | File "/tmp/tmp9_2sm0rf/tmp34ci4lti.py", line 18
print " ".join(L)
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s284185455 | p02265 | u386372280 | 1442369914 | Python | Python | py | Runtime Error | 10 | 6364 | 796 | import sys
DLL = []
def insert(x):
DLL.insert(0, x)
def delete(x):
if len(DLL) > 0:
DLL.remove(x)
def deleteFirst():
if len(DLL) > 0:
DLL.pop(0)
def deleteLast():
if len(DLL) > 0:
DLL.pop(-1)
def main(commands):
for command in commands:
vals = command.strip().split(" ")
com = vals[0]
if len(vals) == 2:
num = vals[1]
if com == "insert":
insert(num)
elif com == "delete":
delete(num)
elif com == "deleteFirst":
deleteFirst()
else:
deleteLast()
return DLL
if __name__ == "__main__":
lines = sys.stdin.readlines()
n = lines[0]
commands = lines[1:]
DLL = main(commands)
print " ".join(DLL) | File "/tmp/tmp1jzzoak4/tmprsp1u3uo.py", line 44
print " ".join(DLL)
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s768227448 | p02265 | u197445199 | 1442370707 | Python | Python | py | Runtime Error | 0 | 0 | 748 | N = int(raw_input())
A = []
B = []
def insert(B, x):
B.insert(0, x)
return B
def delete(B, x):
i = 0
for num in B:
if num == x:
B.pop(i)
break
i += 1
return B
def deleteFirst(B):
B.pop(0)
return B
def deleteLast(B):
B.pop()
return B
operation = {'insert':insert, 'delete':delete, 'deleteFirst':deleteFirst, 'deleteLast':deleteLast}
for i in range(N):
a = raw_input().split()
if len(a) == 2:
A.append([a[0], int(a[1])])
else:
A.append([a[0]])
for item in A:
if len(item) == 2:
command, num = item
B = operation[command](B, int(num))
else:
command = item[0]
B = operation[command](B)
print ' '.join(B) | File "/tmp/tmppl1c378j/tmp22wu_0uy.py", line 40
print ' '.join(B)
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s602064016 | p02265 | u894381890 | 1442370950 | Python | Python | py | Runtime Error | 10 | 6364 | 489 | import sys
def isEmpty(S):
if len(S) == 0:
return True
def isFull(S):
if len(S) >= 100000:
return True
n = sys.stdin.readline()
n = int(n)
a = 0
S = []
for i in range(n):
text = raw_input()
x_list = text.split()
if x_list[0] == 'insert':
S.insert(0, x_list[1])
a += 1
elif x_list[0] == 'delete':
S.remove(x_list[1])
a -= 1
elif x_list[0] == 'deleteFirst':
S.pop(0)
a -= 1
else:
a -= 1
S.pop()
for i in range(a):
print S[i], | File "/tmp/tmp9djfdsys/tmp65mjrd1_.py", line 36
print S[i],
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s828628790 | p02265 | u894381890 | 1442371357 | Python | Python | py | Runtime Error | 10 | 6328 | 489 | import sys
def isEmpty(S):
if len(S) == 0:
return True
def isFull(S):
if len(S) >= 100000:
return True
n = sys.stdin.readline()
n = int(n)
a = 0
S = []
for i in range(n):
text = raw_input()
x_list = text.split()
if x_list[0] == 'insert':
S.insert(0, x_list[1])
a += 1
elif x_list[0] == 'delete':
S.remove(x_list[1])
a -= 1
elif x_list[0] == 'deleteFirst':
S.pop(0)
a -= 1
else:
a -= 1
S.pop()
for i in range(a):
print S[i], | File "/tmp/tmp2u75sqzu/tmpsqraqmci.py", line 36
print S[i],
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s124201203 | p02265 | u894381890 | 1442371853 | Python | Python | py | Runtime Error | 10 | 6300 | 408 | import sys
n = sys.stdin.readline()
n = int(n)
a = 0
S = []
for i in range(n):
text = raw_input()
x_list = text.split()
if x_list[0] == 'insert':
S.insert(0, x_list[1])
a += 1
elif x_list[0] == 'delete':
S.remove(x_list[1])
a -= 1
elif x_list[0] == 'deleteFirst':
S.pop(0)
a -= 1
else:
a -= 1
S.pop()
print " ".join(S)
"""
for i in range(a):
print S[i],
""" | File "/tmp/tmpw1s39p9h/tmpb04f_h04.py", line 25
print " ".join(S)
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s444423935 | p02265 | u197445199 | 1442371905 | Python | Python | py | Runtime Error | 10 | 6372 | 685 | N = int(raw_input())
A = []
B = []
def insert(B, x):
B.insert(0, x)
return B
def delete(B, x):
B.remove(x)
return B
def deleteFirst(B):
B.pop(0)
return B
def deleteLast(B):
B.pop()
return B
operation = {'insert':insert, 'delete':delete, 'deleteFirst':deleteFirst, 'deleteLast':deleteLast}
for i in range(N):
a = raw_input().split()
if len(a) == 2:
A.append([a[0], int(a[1])])
else:
A.append([a[0]])
for item in A:
if len(item) == 2:
command, num = item
B = operation[command](B, int(num))
else:
command = item[0]
B = operation[command](B)
B_str = map(str, B)
print ' '.join(B_str) | File "/tmp/tmp9rh2c2o7/tmpgo4_rlu5.py", line 36
print ' '.join(B_str)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s807402039 | p02265 | u949338836 | 1444460309 | Python | Python3 | py | Runtime Error | 40 | 7920 | 369 | #coding:utf-8
#1_3_C
from collections import deque
n = int(input())
ary = deque()
for i in range(n):
cmd = input().split()
if cmd[0] == "insert":
ary.appendleft(cmd[1])
elif cmd[0] == "delete":
ary.remove(cmd[1])
elif cmd[0] == "deleteFirst":
ary.popleft()
elif cmd[0] == "deleteLast":
ary.pop()
print(" ".join(ary)) | Traceback (most recent call last):
File "/tmp/tmpgughcbcp/tmpyqqxqk5t.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s427344908 | p02265 | u224288634 | 1445609832 | Python | Python | py | Runtime Error | 10 | 6348 | 288 | n=input()
List=[]
for i in range(n):
command=raw_input().split()
if command[0]=="insert":
ll=[]
ll.append(command[1])
List=ll+List
elif command[0]=="delete":
List.remove(command[1])
elif command[0]=="deleteFirst":
List=List[1:]
else :
List=List[:-1]
print(" ".join(List)) | Traceback (most recent call last):
File "/tmp/tmp5bdf8r7k/tmppzui4it8.py", line 1, in <module>
n=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s683960488 | p02265 | u224288634 | 1445610027 | Python | Python | py | Runtime Error | 10 | 6368 | 307 | n=input()
List=[]
for i in range(n):
command=raw_input().split()
if command[0]=="insert":
ll=[]
ll.append(int(command[1]))
List=ll+List
elif command[0]=="delete":
List.remove(int(command[1]))
elif command[0]=="deleteFirst":
List=List[1:]
else :
List=List[:-1]
print(" ".join(map(str,List))) | Traceback (most recent call last):
File "/tmp/tmpeei_zv_8/tmpwiivr45t.py", line 1, in <module>
n=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s574175745 | p02265 | u224288634 | 1445610180 | Python | Python | py | Runtime Error | 10 | 6320 | 307 | n=input()
List=[]
for i in range(n):
command=raw_input().split()
if command[0]=="insert":
ll=[]
ll.append(int(command[1]))
List=ll+List
elif command[0]=="delete":
List.remove(int(command[1]))
elif command[0]=="deleteFirst":
List=List[1:]
else :
List=List[:-1]
print(" ".join(map(str,List))) | Traceback (most recent call last):
File "/tmp/tmpoufv0f_v/tmpv70h903w.py", line 1, in <module>
n=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s397175708 | p02265 | u766163292 | 1446536359 | Python | Python3 | py | Runtime Error | 30 | 8060 | 562 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import collections
def process(commands):
queue = collections.deque()
for c in commands:
if "insert" in c:
queue.appendleft(int(c[7:]))
elif "deleteFirst" in c:
_ = queue.popleft()
elif "deleteLast" in c:
_ = queue.pop()
elif "delete" in c:
queue.remove(int(c[7:]))
print(" ".join(list(map(str, queue))))
def main():
n = int(input())
process([input() for i in range(n)])
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmp9xbnv6bf/tmpkgiu60am.py", line 27, in <module>
main()
File "/tmp/tmp9xbnv6bf/tmpkgiu60am.py", line 22, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s054574291 | p02265 | u960191521 | 1447558246 | Python | Python | py | Runtime Error | 0 | 0 | 354 | # -*- coding: utf-8 -*-
n = input()
list = []
for i in xrange(n):
command, key = raw_input().split()
if command == "insert":
list.insert(0, key)
elif command == "delete":
list.remove(key)
elif command == "deleteFirst":
list.pop(0)
elif command == "deleteLast":
list.pop()
print " ".join(list) | File "/tmp/tmpiyjg78sh/tmp7hi_q9m4.py", line 16
print " ".join(list)
^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s507804468 | p02265 | u960191521 | 1447558519 | Python | Python | py | Runtime Error | 10 | 6352 | 375 | # -*- coding: utf-8 -*-
n = input()
list = []
for i in xrange(n):
command = raw_input().split()
if command[0] == "insert":
list.insert(0, command[1])
elif command[0] == "delete":
list.remove(command[1])
elif command[0] == "deleteFirst":
list.pop(0)
elif command[0] == "deleteLast":
list.pop()
print " ".join(list) | File "/tmp/tmp6tn9xycy/tmpc41__lvd.py", line 16
print " ".join(list)
^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s121206803 | p02265 | u960191521 | 1447561576 | Python | Python | py | Runtime Error | 0 | 0 | 585 | # -*- coding: utf-8 -*-
import numpy as np
n = input()
list = np.array([], dtype=long)
for i in xrange(n):
command = raw_input().split()
if command[0] == "insert":
list = np.append(int(command[1]), list)
elif command[0] == "delete":
key = int(command[1])
for i in xrange(len(list)):
if list[i] == key:
list = np.delete(list, i)
elif command[0] == "deleteFirst":
list = np.delete(list, 0)
elif command[0] == "deleteLast":
list = np.delete(list, len(list)-1)
print " ".join(map(str,list)) | File "/tmp/tmpzb6ultoa/tmpq2zfvmlz.py", line 21
print " ".join(map(str,list))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s250217355 | p02265 | u960191521 | 1447569077 | Python | Python | py | Runtime Error | 0 | 0 | 347 | # -*- coding: utf-8 -*-
n = input()
l = []
tail = 0
for i in xrange(n):
cmd = raw_input().split()
if cmd[0] == "insert":
l.append(cmd[1])
elif cmd[0] == "delete":
l.pop(l.lindex(cmd[1]))
elif cmd[0] == "deleteFirst":
l.pop()
elif cmd[0] == "deleteLast":
tail += 1
print " ".join(l[tail:][::-1]) | File "/tmp/tmppfzwozgp/tmpcyuqx7en.py", line 16
print " ".join(l[tail:][::-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s223621999 | p02265 | u960191521 | 1447569441 | Python | Python | py | Runtime Error | 10 | 6328 | 364 | # -*- coding: utf-8 -*-
n = input()
l = []
tail = 0
for i in xrange(n):
cmd = raw_input().split()
if cmd[0] == "insert":
l.append(cmd[1])
elif cmd[0] == "delete":
l.pop(len(l) - l[::-1].index(cmd[1]) -1)
elif cmd[0] == "deleteFirst":
l.pop()
elif cmd[0] == "deleteLast":
tail += 1
print " ".join(l[tail:][::-1]) | File "/tmp/tmpl8s8q4n9/tmpzu2i4xgv.py", line 16
print " ".join(l[tail:][::-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s808964232 | p02265 | u881590806 | 1447582787 | Python | Python | py | Runtime Error | 10 | 6384 | 1939 | class Node:
def __init__(self,v):
self.next = None
self.prev = None
self.data = v
class DoublyLinkedList:
def __init__(self):
self.head = None
self.tail = None
def __str__(self):
ret = ''
n = self.head
while True:
if n == None:
break
else:
ret += str(n.data) + ' '
n = n.next
return ret[:-1]
def insert(self,v):
n = Node(v)
if self.head == None:
self.head = n
self.tail = n
else:
n.next = self.head
n.next.prev = n
self.head = n
def delete(self,v):
n = self.head
while True:
if n == None:
break
else:
if n.data == v:
if n.next == None:
self.tail = n.prev
else:
n.next.prev = n.prev
if n.prev == None:
self.head = n.next
else:
n.prev.next = n.next
break
n = n.next
def deleteFirst(self):
if self.head != None:
self.head = self.head.next
self.head.prev = None
else:
raise
def deleteLast(self):
if self.tail != None:
self.tail = self.tail.prev
self.tail.next = None
else:
raise
n = int(raw_input())
commends = []
for i in range(n):
commends.append(raw_input())
l = DoublyLinkedList()
for c in commends:
if c == "deleteFirst":
l.deleteFirst()
elif c == "deleteLast":
l.deleteLast()
else:
op,val = c.split(' ')
val = int(val)
if op == "insert":
l.insert(val)
elif op == "delete":
l.delete(val)
print l | File "/tmp/tmpx6jiceo_/tmpvcij6gdy.py", line 86
print l
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s655604227 | p02265 | u963402991 | 1448596431 | Python | Python3 | py | Runtime Error | 20 | 7708 | 366 | # -*- coding:utf-8 -*-
n = int(input())
command = [input().split() for i in range(n)]
ans = []
for i in range(n):
if command[i][0] == "insert":
ans.insert(0, command[i][1])
elif command[i][0] == "delete":
ans.remove(command[i][1])
elif command[i][0] == "deleteFirst":
ans.pop(0)
else:
ans.pop()
print (' '.join(ans)) | Traceback (most recent call last):
File "/tmp/tmp_gth590g/tmp6q7a_qpm.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s870811994 | p02265 | u963402991 | 1448596999 | Python | Python3 | py | Runtime Error | 20 | 7684 | 342 | n = int(input())
command = [input().split() for i in range(n)]
ans = []
for i in range(n):
if command[i][0] == "insert":
ans.insert(0, command[i][1])
elif command[i][0] == "delete":
ans.remove(command[i][1])
elif command[i][0] == "deleteFirst":
ans.pop(0)
else:
ans.pop()
print (' '.join(ans)) | Traceback (most recent call last):
File "/tmp/tmpz1nhfn3k/tmpwg28cv5h.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s266562824 | p02265 | u963402991 | 1448597498 | Python | Python3 | py | Runtime Error | 0 | 0 | 395 | # -*- coding:utf-8 -*-
import sys
n = int(sys.stdin.readline())
command = [sys.stdin.readline() for i in range(n)]
ans = []
for i in range(n):
if command[i][0] == "insert":
ans.insert(0, command[i][1])
elif command[i][0] == "delete":
ans.remove(command[i][1])
elif command[i][0] == "deleteFirst":
ans.pop(0)
else:
ans.pop()
print (' '.join(ans)) | Traceback (most recent call last):
File "/tmp/tmpkyhvw7jq/tmp6iqgp4f8.py", line 4, in <module>
n = int(sys.stdin.readline())
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s115991133 | p02265 | u963402991 | 1448611272 | Python | Python3 | py | Runtime Error | 20 | 7752 | 392 | # -*- coding:utf-8 -*-
import sys
n = int(input())
command = []
command = [ input().split() for i in range(n)]
ans = []
for i in range(n):
if command[i][0] == "insert":
ans.insert(0, command[i][1])
elif command[i][0] == "delete":
ans.remove(command[i][1])
elif command[i][0] == "deleteFirst":
ans.pop(0)
else:
ans.pop()
print (' '.join(ans)) | Traceback (most recent call last):
File "/tmp/tmpdiekopdh/tmp7e822g2i.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s381656702 | p02265 | u963402991 | 1448612038 | Python | Python3 | py | Runtime Error | 20 | 7668 | 336 | # -*- coding:utf-8 -*-
n = int(input())
ans = []
for i in range(n):
command = input().split()
if command[0] == "insert":
ans.insert(0, command[1])
elif command[0] == "delete":
ans.remove(command[1])
elif command[0] == "deleteFirst":
ans.pop(0)
else:
ans.pop()
print (' '.join(ans)) | Traceback (most recent call last):
File "/tmp/tmpwhr6g9k6/tmprftexju9.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s586923866 | p02265 | u317901693 | 1450407868 | Python | Python3 | py | Runtime Error | 30 | 8000 | 555 | from collections import deque
def insert(x, dll):
dll.appendleft(x)
def delete(x, dll):
dll.remove(x)
def deleteFirst(dll):
dll.popleft()
def deleteLast(dll):
dll.pop()
n = int(input())
command1 = {"insert": insert, "delete": delete}
command2 = {"deleteFirst": deleteFirst, "deleteLast": deleteLast}
dll = deque()
for i in range(n):
input_line = [str(s) for s in input().split()]
if(input_line[0] in command1):
command1[input_line[0]](int(input_line[1]), dll)
else:
command2[input_line[0]](dll)
print(*dll) | Traceback (most recent call last):
File "/tmp/tmpqb5q0k1l/tmpme5ygnq_.py", line 15, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s849691043 | p02265 | u317901693 | 1450409034 | Python | Python3 | py | Runtime Error | 0 | 0 | 480 | from collections import deque
f = open("input.txt")
n = int(f.readline())
dll = deque()
for i in range(n):
input_line = [str(s) for s in f.readline().split()]
if input_line[0] == "insert":
dll.appendleft(int(input_line[1]))
elif input_line[0] == "delete":
try:
dll.remove(int(input_line[1]))
except ValueError:
pass
elif input_line[0] == "deleteFirst":
dll.popleft()
else:
dll.pop()
print(*dll) | Traceback (most recent call last):
File "/tmp/tmpubo0g_30/tmpbg881ivm.py", line 3, in <module>
f = open("input.txt")
^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'input.txt'
| |
s542279448 | p02265 | u317901693 | 1450409880 | Python | Python3 | py | Runtime Error | 30 | 8000 | 386 | from collections import deque
n = int(input())
dll = deque()
for i in range(n):
input_line = [str(s) for s in input().split()]
if input_line[0] == "insert":
dll.appendleft(int(input_line[1]))
elif input_line[0] == "delete":
dll.remove(int(input_line[1]))
elif input_line[0] == "deleteFirst":
dll.popleft()
else:
dll.pop()
print(*dll) | Traceback (most recent call last):
File "/tmp/tmptb1o9uod/tmp94tgh8xr.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s449991448 | p02265 | u797673668 | 1452359073 | Python | Python3 | py | Runtime Error | 70 | 8332 | 399 | from functools import reduce
from collections import deque
def operate(dq, op):
if op[0] == 'i':
dq.appendleft(int(op[7:]))
else:
k = op[6]
if k == 'F':
dq.popleft()
elif k == 'L':
dq.pop()
else:
dq.remove(int(op[7:]))
return dq
n = int(input())
print(*reduce(operate, [input() for _ in range(n)], deque())) | Traceback (most recent call last):
File "/tmp/tmpy1f_dd1e/tmprh_oyvtk.py", line 19, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s981166971 | p02265 | u321017034 | 1454031429 | Python | Python3 | py | Runtime Error | 30 | 7744 | 330 | n = int(input())
l_l = list()
for i in range(n):
cmd_l = input().split()
cmd = cmd_l[0]
if cmd == "insert":
l_l.insert(0, cmd_l[1])
elif cmd == "delete":
l_l.remove(cmd_l[1])
elif cmd == "deleteFirst":
del l_l[0]
elif cmd == "deleteLast":
del l_l[-1]
print(' '.join(l_l)) | Traceback (most recent call last):
File "/tmp/tmpa1918rw_/tmp1oanve9s.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s584189304 | p02265 | u731710433 | 1455001039 | Python | Python3 | py | Runtime Error | 30 | 7984 | 310 | from collections import deque
dq = deque()
n = int(input())
for _ in range(n):
cmd = input().split()
if cmd[0] == "insert":
dq.appendleft(cmd[1])
elif cmd[0] == "delete":
dq.remove(cmd[1])
elif cmd[0] == "deleteFirst":
dq.popleft()
else:
dq.pop()
print(*dq) | Traceback (most recent call last):
File "/tmp/tmp4ie8i6pz/tmpbdp0bwr6.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s226360090 | p02265 | u193025715 | 1455378990 | Python | Python3 | py | Runtime Error | 30 | 7700 | 461 | n = int(input())
lists = []
for i in range(n):
inputs = input().split()
commandName = inputs[0]
if len(inputs) == 1:
if commandName == 'deleteFirst':
lists.pop(0)
elif commandName == 'deleteLast':
lists.pop(-1)
else:
num = inputs[1]
if commandName == 'insert':
lists = [num] + lists
elif commandName == 'delete':
lists.remove(num)
print(' '.join(lists)) | Traceback (most recent call last):
File "/tmp/tmpc9pwkmob/tmp2sux9ort.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s476760904 | p02265 | u567281053 | 1456322737 | Python | Python | py | Runtime Error | 0 | 0 | 2148 | class DoublyLinkedList:
def __init__(self):
self.first = Node(-1)
self.first.setNext(Node(-1))
def insert(self, value):
newNode = Node(value)
newNode.setNext(self.first.getNext())
newNode.setPrev(self.first)
self.first.getNext().setPrev(newNode)
self.first.setNext(newNode)
def delete(self, value):
self.first.delete(value)
def deleteFirst(self):
if self.first.getNext().getValue() != -1:
self.first.setNext(self.first.getNext().getNext())
def deleteLast(self):
self.first.deleteLast()
def printAll(self):
if self.first.getNext().getValue() != -1:
self.first.getNext().printAll()
class Node:
def __init__(self, value):
self.value = value
self.prev = None
self.next = None
def getValue(self):
return self.value
def setValue(self, value):
self.value = value
def getNext(self):
return self.next
def setNext(self, next):
self.next = next
def getPrev(self):
return self.prev
def setPrev(self, prev):
self.prev = prev
def delete(self, value):
if self.next.getValue() == value:
self.next = self.next.getNext()
self.next.setPrev(self)
else:
self.next.delete(value)
def deleteLast(self):
if self.next.value == -1:
self.prev.setNext(self.next)
self.next.setPrev(self.prev)
else:
self.next.deleteLast()
def printAll(self):
if self.next.getValue() != -1:
print self.value,
self.next.printAll()
else:
print self.value
if __name__ == "__main__":
dll = DoublyLinkedList()
N = input()
for i in range(N):
raw = raw_input().split()
com = raw[0]
value = int(raw[1])
if com == "insert":
dll.insert(value)
elif com == "delete":
dll.delete(value)
elif com == "deleteFirst":
dll.deleteFirst()
else:
dll.deleteLast()
dll.printAll() | File "/tmp/tmpu2ynb8sd/tmpbkhy3duc.py", line 67
print self.value,
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s867957526 | p02265 | u567281053 | 1456322820 | Python | Python | py | Runtime Error | 10 | 6388 | 2177 | class DoublyLinkedList:
def __init__(self):
self.first = Node(-1)
self.first.setNext(Node(-1))
def insert(self, value):
newNode = Node(value)
newNode.setNext(self.first.getNext())
newNode.setPrev(self.first)
self.first.getNext().setPrev(newNode)
self.first.setNext(newNode)
def delete(self, value):
self.first.delete(value)
def deleteFirst(self):
if self.first.getNext().getValue() != -1:
self.first.setNext(self.first.getNext().getNext())
def deleteLast(self):
self.first.deleteLast()
def printAll(self):
if self.first.getNext().getValue() != -1:
self.first.getNext().printAll()
class Node:
def __init__(self, value):
self.value = value
self.prev = None
self.next = None
def getValue(self):
return self.value
def setValue(self, value):
self.value = value
def getNext(self):
return self.next
def setNext(self, next):
self.next = next
def getPrev(self):
return self.prev
def setPrev(self, prev):
self.prev = prev
def delete(self, value):
if self.next.getValue() == value:
self.next = self.next.getNext()
self.next.setPrev(self)
else:
self.next.delete(value)
def deleteLast(self):
if self.next.value == -1:
self.prev.setNext(self.next)
self.next.setPrev(self.prev)
else:
self.next.deleteLast()
def printAll(self):
if self.next.getValue() != -1:
print self.value,
self.next.printAll()
else:
print self.value
if __name__ == "__main__":
dll = DoublyLinkedList()
N = input()
for i in range(N):
raw = raw_input().split()
com = raw[0]
if len(raw) > 1:
value = int(raw[1])
if com == "insert":
dll.insert(value)
elif com == "delete":
dll.delete(value)
elif com == "deleteFirst":
dll.deleteFirst()
else:
dll.deleteLast()
dll.printAll() | File "/tmp/tmp4i4udxyv/tmph385hu7a.py", line 67
print self.value,
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s915944412 | p02265 | u424209323 | 1456409360 | Python | Python | py | Runtime Error | 0 | 0 | 388 | A = []
n = input()
for i in range(n):
command = [0, 0]
temp = raw_input().split()
command[0] = temp[0]
command[1] = int(temp[1])
if command[0] == "insert":
A.insert(0, command[1])
elif command[0] == "delete":
A.remove(command[1])
elif command[0] == "deleteFirst":
A.pop(0)
elif command[0] == "deleteLast":
A.pop()
print A | File "/tmp/tmp5aoelzrw/tmpfnex_lkx.py", line 19
print A
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s749004472 | p02265 | u424209323 | 1456409489 | Python | Python | py | Runtime Error | 0 | 0 | 420 | A = []
n = input()
for i in range(n):
command = [0, 0]
temp = raw_input().split()
command[0] = temp[0]
command[1] = int(temp[1])
if command[0] == "insert":
A.insert(0, command[1])
elif command[0] == "delete":
A.remove(command[1])
elif command[0] == "deleteFirst":
A.pop(0)
elif command[0] == "deleteLast":
A.pop()
for i in range(len(A)):
print A[i], | File "/tmp/tmpyw9pt2bg/tmp2ju35zab.py", line 20
print A[i],
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s726381176 | p02265 | u424209323 | 1456409541 | Python | Python | py | Runtime Error | 0 | 0 | 420 | A = []
n = input()
for i in range(n):
command = [0, 0]
temp = raw_input().split()
command[0] = temp[0]
command[1] = int(temp[1])
if command[0] == 'insert':
A.insert(0, command[1])
elif command[0] == 'delete':
A.remove(command[1])
elif command[0] == 'deleteFirst':
A.pop(0)
elif command[0] == 'deleteLast':
A.pop()
for i in range(len(A)):
print A[i], | File "/tmp/tmphpt0lsq3/tmp44vxjbr8.py", line 20
print A[i],
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s765424294 | p02265 | u424209323 | 1456410812 | Python | Python | py | Runtime Error | 10 | 6288 | 347 | A = []
n = input()
for i in range(n):
command = raw_input().split()
if command[0] == 'insert':
A.insert(0, command[1])
elif command[0] == 'delete':
A.remove(command[1])
elif command[0] == 'deleteFirst':
A.pop(0)
elif command[0] == 'deleteLast':
A.pop()
for i in range(len(A)):
print A[i], | File "/tmp/tmp4ugfu42j/tmpdmh0x4h6.py", line 17
print A[i],
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s716657716 | p02265 | u233232390 | 1456419726 | Python | Python | py | Runtime Error | 0 | 0 | 462 | A=[]
fp =0
bp =0
cmd = raw_input()
n=int(raw_input())
while n:
if s[0] == 'i':
A.append(int(s[7:]))
fp += 1
elif s[6] == ' ':
try:
i = A[::-1].index(int(s[7:]))
if i!=-1:
del A[-i-1]
fp -=1
except:
pass
elif cmd[6] == 'F':
A.pop()
fp -=1
elif cmd[6] == 'L':
bp +=1
n -=1
for e in A[bp:fp+1][::-1]:
print int(e), | File "/tmp/tmpcjct8zam/tmpxpavj1gd.py", line 26
print int(e),
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s641925511 | p02265 | u233232390 | 1456419758 | Python | Python | py | Runtime Error | 0 | 0 | 466 | A=[]
fp =0
bp =0
cmd = raw_input()
n=int(raw_input())
while n:
if cmd[0] == 'i':
A.append(int(s[7:]))
fp += 1
elif cmd[6] == ' ':
try:
i = A[::-1].index(int(s[7:]))
if i!=-1:
del A[-i-1]
fp -=1
except:
pass
elif cmd[6] == 'F':
A.pop()
fp -=1
elif cmd[6] == 'L':
bp +=1
n -=1
for e in A[bp:fp+1][::-1]:
print int(e), | File "/tmp/tmp_2i26i2e/tmp0x7756fa.py", line 26
print int(e),
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s654007999 | p02265 | u233232390 | 1456419779 | Python | Python | py | Runtime Error | 0 | 0 | 470 | A=[]
fp =0
bp =0
cmd = raw_input()
n=int(raw_input())
while n:
if cmd[0] == 'i':
A.append(int(cmd[7:]))
fp += 1
elif cmd[6] == ' ':
try:
i = A[::-1].index(int(cmd[7:]))
if i!=-1:
del A[-i-1]
fp -=1
except:
pass
elif cmd[6] == 'F':
A.pop()
fp -=1
elif cmd[6] == 'L':
bp +=1
n -=1
for e in A[bp:fp+1][::-1]:
print int(e), | File "/tmp/tmp4zapvpl2/tmpko6l06u0.py", line 26
print int(e),
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s985286834 | p02265 | u567281053 | 1456486070 | Python | Python | py | Runtime Error | 4640 | 69832 | 1491 | class DoublyLinkedList:
def __init__(self, value = -1):
self.value = value
self.prev = self
self.next = self
def insert(self, value):
newNode = DoublyLinkedList(value)
newNode.next = self.next
newNode.prev = self
self.next.prev = newNode
self.next = newNode
def delete(self, value):
nextValue = self.next.value
if nextValue == value:
self.next = self.next.next
self.next.prev = self
elif nextValue != -1:
self.next.delete(value)
def deleteFirst(self):
if self.next.value != -1:
self.next = self.next.next
self.next.prev = self
def deleteLast(self):
if self.prev.value != -1:
self.prev = self.prev.prev
self.prev.next = self
def printAll(self):
if self.next.value != -1:
if self.value != -1:
print self.value,
self.next.printAll()
else:
print self.value
if __name__ == "__main__":
dll = DoublyLinkedList()
N = input()
for i in range(N):
raw = raw_input().split()
com = raw[0]
if len(raw) > 1:
value = int(raw[1])
if com == "insert":
dll.insert(value)
elif com == "delete":
dll.delete(value)
elif com == "deleteFirst":
dll.deleteFirst()
else:
dll.deleteLast()
dll.printAll() | File "/tmp/tmp_mksav1a/tmpuo9tqc45.py", line 35
print self.value,
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s223698366 | p02265 | u894114233 | 1456841205 | Python | Python | py | Runtime Error | 10 | 6456 | 444 | def insert(x,a):
a.insert(0,x)
return a
def delete(x,a):
a.remove(x)
return a
def deletefirst(a):
del a[0]
return a
def deletelast(a):
del a[-1]
return a
n=input()
a=[]
for i in xrange(n):
s=raw_input().split()
if s[0]=="insert":
insert(s[1],a)
elif s[0]=="delete":
delete(s[1],a)
elif s[0]=="deleteFirst":
deletefirst(a)
else:
deletelast(a)
print(" ".join(a)) | Traceback (most recent call last):
File "/tmp/tmpaa9z671d/tmp5tr_97sa.py", line 13, in <module>
n=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s850083018 | p02265 | u572790226 | 1460350358 | Python | Python3 | py | Runtime Error | 20 | 7668 | 382 | n = int(input())
stack = []
for i in range(n):
command = list(input().split())
# print(stack, command)
if command[0] == 'insert':
stack = [command[1]] + stack
elif command[0] == 'delete':
stack.remove(command[1])
elif command[0] == 'deleteFirst':
stack.pop(0)
elif command[0] == 'deleteLast':
stack.pop()
print(' '.join(stack)) | Traceback (most recent call last):
File "/tmp/tmplkxrzjei/tmpc14od0hg.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s403043127 | p02265 | u763534154 | 1462789348 | Python | Python | py | Runtime Error | 0 | 0 | 2274 | MAX_N = 2000000
class DoublyLinkedList(object):
def __init__(self):
self.list = [Node(0, 0, 0, 0)] * MAX_N
self.gen_node = node_generator()
nil = 0
self.nil_node = self.gen_node(0, nil, nil)
self.list[nil] = self.nil_node
def insert(self, x):
inserted = self.gen_node(x, self.nil_node.p, self.nil_node.next)
self.list[inserted.p] = inserted
self.list[self.nil_node.next].prev = inserted.p
self.nil_node.next = inserted.p
def _delete_node(self, i):
self.list[self.list[i].prev].next, self.list[self.list[i].next].prev = self.list[i].next, self.list[i].prev
def _search_node(self, val):
cur = self.nil_node.next
while self.list[cur].p != self.nil_node.p:
if self.list[cur].val == val:
return cur
cur = self.list[self.list[cur].next].p
def delete(self, x):
i = self._search_node(x)
self._delete_node(i)
def delete_first(self):
self._delete_node(self.nil_node.next)
def delete_last(self):
self._delete_node(self.nil_node.prev)
def show(self):
ans = ""
cur = self.nil_node.next
while cur != self.nil_node.p:
ans += self.list[cur].val, " ",
cur = self.list[cur].next
print ans.strip()
class Node(object):
def __init__(self, p, val, prev, _next):
self.p = p
self.val = val
self.prev = prev
self.next = _next
def __repr__(self):
return "p: {}, val: {}, prev: {}, next: {}\n".format(self.p, self.val, self.prev, self.next)
def node_generator():
p = [-1]
def _node_generator(val, prev, _next):
p[0] += 1
return Node(p[0], val, prev, _next)
return _node_generator
if __name__ == '__main__':
n = int(raw_input())
commands = [raw_input().split() for _ in range(n)]
d = DoublyLinkedList()
for command in commands:
if command[0] == "insert":
d.insert(int(command[1]))
elif command[0] == "delete":
d.delete(int(command[1]))
elif command[0] == "deleteFirst":
d.delete_first()
elif command[0] == "deleteLast":
d.delete_last()
d.show() | File "/tmp/tmpdfc3ldmg/tmp6xztt1mc.py", line 49
print ans.strip()
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s424578832 | p02265 | u763534154 | 1462789360 | Python | Python | py | Runtime Error | 0 | 0 | 2270 | MAX_N = 200
class DoublyLinkedList(object):
def __init__(self):
self.list = [Node(0, 0, 0, 0)] * MAX_N
self.gen_node = node_generator()
nil = 0
self.nil_node = self.gen_node(0, nil, nil)
self.list[nil] = self.nil_node
def insert(self, x):
inserted = self.gen_node(x, self.nil_node.p, self.nil_node.next)
self.list[inserted.p] = inserted
self.list[self.nil_node.next].prev = inserted.p
self.nil_node.next = inserted.p
def _delete_node(self, i):
self.list[self.list[i].prev].next, self.list[self.list[i].next].prev = self.list[i].next, self.list[i].prev
def _search_node(self, val):
cur = self.nil_node.next
while self.list[cur].p != self.nil_node.p:
if self.list[cur].val == val:
return cur
cur = self.list[self.list[cur].next].p
def delete(self, x):
i = self._search_node(x)
self._delete_node(i)
def delete_first(self):
self._delete_node(self.nil_node.next)
def delete_last(self):
self._delete_node(self.nil_node.prev)
def show(self):
ans = ""
cur = self.nil_node.next
while cur != self.nil_node.p:
ans += self.list[cur].val, " ",
cur = self.list[cur].next
print ans.strip()
class Node(object):
def __init__(self, p, val, prev, _next):
self.p = p
self.val = val
self.prev = prev
self.next = _next
def __repr__(self):
return "p: {}, val: {}, prev: {}, next: {}\n".format(self.p, self.val, self.prev, self.next)
def node_generator():
p = [-1]
def _node_generator(val, prev, _next):
p[0] += 1
return Node(p[0], val, prev, _next)
return _node_generator
if __name__ == '__main__':
n = int(raw_input())
commands = [raw_input().split() for _ in range(n)]
d = DoublyLinkedList()
for command in commands:
if command[0] == "insert":
d.insert(int(command[1]))
elif command[0] == "delete":
d.delete(int(command[1]))
elif command[0] == "deleteFirst":
d.delete_first()
elif command[0] == "deleteLast":
d.delete_last()
d.show() | File "/tmp/tmp56ke7rk7/tmp4mrxlvh8.py", line 49
print ans.strip()
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s988296449 | p02265 | u763534154 | 1462789480 | Python | Python | py | Runtime Error | 60 | 21960 | 2282 | MAX_N = 2000000
class DoublyLinkedList(object):
def __init__(self):
self.list = [Node(0, 0, 0, 0)] * MAX_N
self.gen_node = node_generator()
nil = 0
self.nil_node = self.gen_node(0, nil, nil)
self.list[nil] = self.nil_node
def insert(self, x):
inserted = self.gen_node(x, self.nil_node.p, self.nil_node.next)
self.list[inserted.p] = inserted
self.list[self.nil_node.next].prev = inserted.p
self.nil_node.next = inserted.p
def _delete_node(self, i):
self.list[self.list[i].prev].next, self.list[self.list[i].next].prev = self.list[i].next, self.list[i].prev
def _search_node(self, val):
cur = self.nil_node.next
while self.list[cur].p != self.nil_node.p:
if self.list[cur].val == val:
return cur
cur = self.list[self.list[cur].next].p
def delete(self, x):
i = self._search_node(x)
self._delete_node(i)
def delete_first(self):
self._delete_node(self.nil_node.next)
def delete_last(self):
self._delete_node(self.nil_node.prev)
def show(self):
ans = ""
cur = self.nil_node.next
while cur != self.nil_node.p:
ans += "{} ".format(self.list[cur].val)
cur = self.list[cur].next
print ans.strip()
class Node(object):
def __init__(self, p, val, prev, _next):
self.p = p
self.val = val
self.prev = prev
self.next = _next
def __repr__(self):
return "p: {}, val: {}, prev: {}, next: {}\n".format(self.p, self.val, self.prev, self.next)
def node_generator():
p = [-1]
def _node_generator(val, prev, _next):
p[0] += 1
return Node(p[0], val, prev, _next)
return _node_generator
if __name__ == '__main__':
n = int(raw_input())
commands = [raw_input().split() for _ in range(n)]
d = DoublyLinkedList()
for command in commands:
if command[0] == "insert":
d.insert(int(command[1]))
elif command[0] == "delete":
d.delete(int(command[1]))
elif command[0] == "deleteFirst":
d.delete_first()
elif command[0] == "deleteLast":
d.delete_last()
d.show() | File "/tmp/tmpyinu7snq/tmpo1q953zf.py", line 49
print ans.strip()
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s969545429 | p02265 | u763534154 | 1462790048 | Python | Python | py | Runtime Error | 10 | 6560 | 2297 | MAX_N = 20000
class DoublyLinkedList(object):
def __init__(self):
self.list = [Node(0, 0, 0, 0)] * MAX_N
self.gen_node = node_generator()
nil = 0
self.nil_node = self.gen_node(0, nil, nil)
self.list[nil] = self.nil_node
def insert(self, x):
inserted = self.gen_node(x, self.nil_node.p, self.nil_node.next)
self.list[inserted.p] = inserted
self.list[self.nil_node.next].prev = inserted.p
self.nil_node.next = inserted.p
def _delete_node(self, i):
self.list[self.list[i].prev].next, self.list[self.list[i].next].prev = self.list[i].next, self.list[i].prev
def _search_node(self, val):
cur = self.nil_node.next
while cur != self.nil_node.p:
if self.list[cur].val == val:
return cur
cur = self.list[self.list[cur].next].p
def delete(self, x):
i = self._search_node(x)
if i is not None:
self._delete_node(i)
def delete_first(self):
self._delete_node(self.nil_node.next)
def delete_last(self):
self._delete_node(self.nil_node.prev)
def show(self):
ans = ""
cur = self.nil_node.next
while cur != self.nil_node.p:
ans += "{} ".format(self.list[cur].val)
cur = self.list[cur].next
print ans.strip()
class Node(object):
def __init__(self, p, val, prev, _next):
self.p = p
self.val = val
self.prev = prev
self.next = _next
def __repr__(self):
return "p: {}, val: {}, prev: {}, next: {}\n".format(self.p, self.val, self.prev, self.next)
def node_generator():
p = [-1]
def _node_generator(val, prev, _next):
p[0] += 1
return Node(p[0], val, prev, _next)
return _node_generator
if __name__ == '__main__':
n = int(raw_input())
commands = [raw_input().split() for _ in range(n)]
d = DoublyLinkedList()
for command in commands:
if command[0] == "insert":
d.insert(int(command[1]))
elif command[0] == "delete":
d.delete(int(command[1]))
elif command[0] == "deleteFirst":
d.delete_first()
elif command[0] == "deleteLast":
d.delete_last()
d.show() | File "/tmp/tmp_v8r7h78/tmpd41fa8eh.py", line 50
print ans.strip()
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s585998182 | p02265 | u763534154 | 1462790237 | Python | Python | py | Runtime Error | 10 | 7272 | 2298 | MAX_N = 100000
class DoublyLinkedList(object):
def __init__(self):
self.list = [Node(0, 0, 0, 0)] * MAX_N
self.gen_node = node_generator()
nil = 0
self.nil_node = self.gen_node(0, nil, nil)
self.list[nil] = self.nil_node
def insert(self, x):
inserted = self.gen_node(x, self.nil_node.p, self.nil_node.next)
self.list[inserted.p] = inserted
self.list[self.nil_node.next].prev = inserted.p
self.nil_node.next = inserted.p
def _delete_node(self, i):
self.list[self.list[i].prev].next, self.list[self.list[i].next].prev = self.list[i].next, self.list[i].prev
def _search_node(self, val):
cur = self.nil_node.next
while cur != self.nil_node.p:
if self.list[cur].val == val:
return cur
cur = self.list[self.list[cur].next].p
def delete(self, x):
i = self._search_node(x)
if i is not None:
self._delete_node(i)
def delete_first(self):
self._delete_node(self.nil_node.next)
def delete_last(self):
self._delete_node(self.nil_node.prev)
def show(self):
ans = ""
cur = self.nil_node.next
while cur != self.nil_node.p:
ans += "{} ".format(self.list[cur].val)
cur = self.list[cur].next
print ans.strip()
class Node(object):
def __init__(self, p, val, prev, _next):
self.p = p
self.val = val
self.prev = prev
self.next = _next
def __repr__(self):
return "p: {}, val: {}, prev: {}, next: {}\n".format(self.p, self.val, self.prev, self.next)
def node_generator():
p = [-1]
def _node_generator(val, prev, _next):
p[0] += 1
return Node(p[0], val, prev, _next)
return _node_generator
if __name__ == '__main__':
n = int(raw_input())
commands = [raw_input().split() for _ in range(n)]
d = DoublyLinkedList()
for command in commands:
if command[0] == "insert":
d.insert(int(command[1]))
elif command[0] == "delete":
d.delete(int(command[1]))
elif command[0] == "deleteFirst":
d.delete_first()
elif command[0] == "deleteLast":
d.delete_last()
d.show() | File "/tmp/tmpaf90hs4v/tmpwchxak7y.py", line 50
print ans.strip()
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s170948376 | p02265 | u763534154 | 1462790264 | Python | Python | py | Runtime Error | 20 | 10180 | 2298 | MAX_N = 500000
class DoublyLinkedList(object):
def __init__(self):
self.list = [Node(0, 0, 0, 0)] * MAX_N
self.gen_node = node_generator()
nil = 0
self.nil_node = self.gen_node(0, nil, nil)
self.list[nil] = self.nil_node
def insert(self, x):
inserted = self.gen_node(x, self.nil_node.p, self.nil_node.next)
self.list[inserted.p] = inserted
self.list[self.nil_node.next].prev = inserted.p
self.nil_node.next = inserted.p
def _delete_node(self, i):
self.list[self.list[i].prev].next, self.list[self.list[i].next].prev = self.list[i].next, self.list[i].prev
def _search_node(self, val):
cur = self.nil_node.next
while cur != self.nil_node.p:
if self.list[cur].val == val:
return cur
cur = self.list[self.list[cur].next].p
def delete(self, x):
i = self._search_node(x)
if i is not None:
self._delete_node(i)
def delete_first(self):
self._delete_node(self.nil_node.next)
def delete_last(self):
self._delete_node(self.nil_node.prev)
def show(self):
ans = ""
cur = self.nil_node.next
while cur != self.nil_node.p:
ans += "{} ".format(self.list[cur].val)
cur = self.list[cur].next
print ans.strip()
class Node(object):
def __init__(self, p, val, prev, _next):
self.p = p
self.val = val
self.prev = prev
self.next = _next
def __repr__(self):
return "p: {}, val: {}, prev: {}, next: {}\n".format(self.p, self.val, self.prev, self.next)
def node_generator():
p = [-1]
def _node_generator(val, prev, _next):
p[0] += 1
return Node(p[0], val, prev, _next)
return _node_generator
if __name__ == '__main__':
n = int(raw_input())
commands = [raw_input().split() for _ in range(n)]
d = DoublyLinkedList()
for command in commands:
if command[0] == "insert":
d.insert(int(command[1]))
elif command[0] == "delete":
d.delete(int(command[1]))
elif command[0] == "deleteFirst":
d.delete_first()
elif command[0] == "deleteLast":
d.delete_last()
d.show() | File "/tmp/tmp2og1l8v2/tmpzkyd4tsq.py", line 50
print ans.strip()
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s256614046 | p02265 | u763534154 | 1462790289 | Python | Python | py | Runtime Error | 30 | 12552 | 2298 | MAX_N = 800000
class DoublyLinkedList(object):
def __init__(self):
self.list = [Node(0, 0, 0, 0)] * MAX_N
self.gen_node = node_generator()
nil = 0
self.nil_node = self.gen_node(0, nil, nil)
self.list[nil] = self.nil_node
def insert(self, x):
inserted = self.gen_node(x, self.nil_node.p, self.nil_node.next)
self.list[inserted.p] = inserted
self.list[self.nil_node.next].prev = inserted.p
self.nil_node.next = inserted.p
def _delete_node(self, i):
self.list[self.list[i].prev].next, self.list[self.list[i].next].prev = self.list[i].next, self.list[i].prev
def _search_node(self, val):
cur = self.nil_node.next
while cur != self.nil_node.p:
if self.list[cur].val == val:
return cur
cur = self.list[self.list[cur].next].p
def delete(self, x):
i = self._search_node(x)
if i is not None:
self._delete_node(i)
def delete_first(self):
self._delete_node(self.nil_node.next)
def delete_last(self):
self._delete_node(self.nil_node.prev)
def show(self):
ans = ""
cur = self.nil_node.next
while cur != self.nil_node.p:
ans += "{} ".format(self.list[cur].val)
cur = self.list[cur].next
print ans.strip()
class Node(object):
def __init__(self, p, val, prev, _next):
self.p = p
self.val = val
self.prev = prev
self.next = _next
def __repr__(self):
return "p: {}, val: {}, prev: {}, next: {}\n".format(self.p, self.val, self.prev, self.next)
def node_generator():
p = [-1]
def _node_generator(val, prev, _next):
p[0] += 1
return Node(p[0], val, prev, _next)
return _node_generator
if __name__ == '__main__':
n = int(raw_input())
commands = [raw_input().split() for _ in range(n)]
d = DoublyLinkedList()
for command in commands:
if command[0] == "insert":
d.insert(int(command[1]))
elif command[0] == "delete":
d.delete(int(command[1]))
elif command[0] == "deleteFirst":
d.delete_first()
elif command[0] == "deleteLast":
d.delete_last()
d.show() | File "/tmp/tmp4trcjtvf/tmpdtwb_6aa.py", line 50
print ans.strip()
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s569177734 | p02265 | u763534154 | 1462790319 | Python | Python | py | Runtime Error | 60 | 14140 | 2299 | MAX_N = 1000001
class DoublyLinkedList(object):
def __init__(self):
self.list = [Node(0, 0, 0, 0)] * MAX_N
self.gen_node = node_generator()
nil = 0
self.nil_node = self.gen_node(0, nil, nil)
self.list[nil] = self.nil_node
def insert(self, x):
inserted = self.gen_node(x, self.nil_node.p, self.nil_node.next)
self.list[inserted.p] = inserted
self.list[self.nil_node.next].prev = inserted.p
self.nil_node.next = inserted.p
def _delete_node(self, i):
self.list[self.list[i].prev].next, self.list[self.list[i].next].prev = self.list[i].next, self.list[i].prev
def _search_node(self, val):
cur = self.nil_node.next
while cur != self.nil_node.p:
if self.list[cur].val == val:
return cur
cur = self.list[self.list[cur].next].p
def delete(self, x):
i = self._search_node(x)
if i is not None:
self._delete_node(i)
def delete_first(self):
self._delete_node(self.nil_node.next)
def delete_last(self):
self._delete_node(self.nil_node.prev)
def show(self):
ans = ""
cur = self.nil_node.next
while cur != self.nil_node.p:
ans += "{} ".format(self.list[cur].val)
cur = self.list[cur].next
print ans.strip()
class Node(object):
def __init__(self, p, val, prev, _next):
self.p = p
self.val = val
self.prev = prev
self.next = _next
def __repr__(self):
return "p: {}, val: {}, prev: {}, next: {}\n".format(self.p, self.val, self.prev, self.next)
def node_generator():
p = [-1]
def _node_generator(val, prev, _next):
p[0] += 1
return Node(p[0], val, prev, _next)
return _node_generator
if __name__ == '__main__':
n = int(raw_input())
commands = [raw_input().split() for _ in range(n)]
d = DoublyLinkedList()
for command in commands:
if command[0] == "insert":
d.insert(int(command[1]))
elif command[0] == "delete":
d.delete(int(command[1]))
elif command[0] == "deleteFirst":
d.delete_first()
elif command[0] == "deleteLast":
d.delete_last()
d.show() | File "/tmp/tmp1oshm8kn/tmp248ep03a.py", line 50
print ans.strip()
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s002783961 | p02265 | u512342660 | 1464272458 | Python | Python | py | Runtime Error | 10 | 6488 | 920 | def insert(o,dll):
dll.append(o)
def delete(o,dll):
dll.remove(o)
def deleteFirst(dll):
dll.pop(0)
def deleteLast(dll):
dll.pop(-1)
def main():
n = input()
dll = []
for _ in xrange(n):
tmp = raw_input().split()
if len(tmp) == 1:
if tmp[0] == "deleteFirst":
deleteFirst(dll)
elif tmp[0] == "deleteLast":
deleteLast(dll)
else:
print "This command is invalid."
break
elif len(tmp)==2:
command = tmp[0]
operand = tmp[1]
if command == "insert":
insert(operand,dll)
elif command == "delete":
delete(operand,dll)
else:
print "This command is invalid."
break
print " ".join(map(str,sorted(dll,reverse=True)))
if __name__ == '__main__':
main() | File "/tmp/tmpon1s7yl4/tmp1dh3ie3g.py", line 21
print "This command is invalid."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s839860926 | p02265 | u512342660 | 1464272777 | Python | Python | py | Runtime Error | 10 | 6376 | 1013 | def insert(o,dll):
dll.insert(0,o)
def delete(o,dll):
dll.remove(o)
def deleteFirst(dll):
dll.pop(0)
def deleteLast(dll):
dll.pop(-1)
def main():
n = input()
dll = []
for _ in xrange(n):
tmp = raw_input().split()
if len(tmp) == 1:
# print dll
# print tmp[0]
if tmp[0] == "deleteFirst":
deleteFirst(dll)
elif tmp[0] == "deleteLast":
deleteLast(dll)
else:
print "This command is invalid."
break
elif len(tmp)==2:
command = tmp[0]
operand = tmp[1]
# print dll
# print command, operand
if command == "insert":
insert(operand,dll)
elif command == "delete":
delete(operand,dll)
else:
print "This command is invalid."
break
print " ".join(map(str,dll))
if __name__ == '__main__':
main() | File "/tmp/tmpqisflxpa/tmpkah48_7d.py", line 23
print "This command is invalid."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s972237554 | p02265 | u569960318 | 1465194490 | Python | Python3 | py | Runtime Error | 30 | 7976 | 356 | from collections import deque
n = int(input())
dl = deque()
for _ in range(n):
cmd = input()
if ' ' in cmd:
op,v = cmd.split()
else:
op = cmd
if op == 'insert' : dl.appendleft(v)
elif op == 'delete' : dl.remove(v)
elif op == 'deleteFirst': dl.popleft()
elif op == 'deleteLast' : dl.pop()
print(*dl) | Traceback (most recent call last):
File "/tmp/tmpvi7fwabe/tmps04u0gmh.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s926869590 | p02265 | u778333573 | 1465630385 | Python | Python | py | Runtime Error | 0 | 0 | 358 | n = input()
lis = []
ans = 0
for i in xrange(n):
com = raw_input()
if com[0] == 'i':
lis.append(com[7:])
elif com[6] == ' ':
try:
lis.pop(~lis[::-1].index(com[7:]))
except:
pass
elif com[6] == 'F':
lis.pop()
else:
bot += 1
print ' '.join( map(str, reversed(lis[ans:])) ) | File "/tmp/tmpdulr19bo/tmp1hnorlbd.py", line 18
print ' '.join( map(str, reversed(lis[ans:])) )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s762533881 | p02265 | u611490888 | 1468234147 | Python | Python | py | Runtime Error | 0 | 0 | 1071 | # -*- coding: utf-8 -*-
commands = {"insert": lambda x, l: insert(x, l),
"delete": lambda x, l: delete(x, l),
"deleteFirst": lambda l: deleteFirst(l),
"deleteLast": lambda l: deleteLast(l)}
# ??£??????????????????????????????x?????????????´?????¶?????¶????
def insert(x, l):
l = [x] + l
return l
# ??????x??????????????????????´??????£??????????????????????????????
def delete(x, l):
for i in xrange(len(l)):
if l[i] == x:
l.pop(i)
break
return l
# ?????????????????????????´????????????????
def deleteFirst(l):
l.pop(0)
return l
# ????????????????°????????´????????????????
def deleteLast(l):
l.pop()
return l
if __name__ == '__main__':
N = input()
functions, args = [], []
for i in xrange(N):
command = raw_input().split()
functions.append(command[0])
args.append(command[1])
result = []
for i in xrange(len(functions)):
result = commands[functions[i]](args[i], result)
print ' '.join(result) | File "/tmp/tmpkz_vy58q/tmpe5sjnnoc.py", line 47
print ' '.join(result)
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s478973502 | p02265 | u096922415 | 1468368669 | Python | Python3 | py | Runtime Error | 30 | 7780 | 1598 | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_C&lang=jp
sample_input = list(range(3))
sample_input[0] = '''7
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5'''
sample_input[1] = '''9
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5
deleteFirst
deleteLast'''
sample_input[2] = ''''''
give_sample_input = None
if give_sample_input is not None:
sample_input_list = sample_input[give_sample_input].split('\n')
def input():
return sample_input_list.pop(0)
# main
class DoublyLinkedList():
def __init__(self, a_data = []):
self.data = a_data
def insert(self, x):
self.data.insert(0, x)
def delete(self, x):
self.data.remove(x)
def delete_first(self):
self.data.pop(0)
def delete_last(self):
self.data.pop()
def to_str(self):
output = ''
for x in self.data:
output += str(x) + ' '
output = output.rstrip()
return output
num_of_command = int(input())
doublely_list = DoublyLinkedList()
for n in range(num_of_command):
str_command = input()
if str_command == 'deleteFirst':
doublely_list.delete_first()
continue
elif str_command == 'deleteLast':
doublely_list.delete_last()
continue
command_name = str_command.split()[0]
command_obj = int(str_command.split()[1])
if command_name == 'insert':
doublely_list.insert(command_obj)
elif command_name == 'delete':
doublely_list.delete(command_obj)
print(doublely_list.to_str()) | Traceback (most recent call last):
File "/tmp/tmptbbpc1cz/tmph2ll7ei_.py", line 53, in <module>
num_of_command = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s957091511 | p02265 | u096922415 | 1468592275 | Python | Python3 | py | Runtime Error | 20 | 7896 | 3405 | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_C&lang=jp
sample_input = list(range(3))
sample_input[0] = '''7
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5'''
sample_input[1] = '''9
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5
deleteFirst
deleteLast'''
sample_input[2] = '''8
insert 1000000000
insert 999999999
deleteLast
insert 1234566890
insert 5
deleteFirst
insert 7
delete 5'''
give_sample_input = None
if give_sample_input is not None:
sample_input_list = sample_input[give_sample_input].split('\n')
def input():
return sample_input_list.pop(0)
# main
class Node:
def __init__(self, value, prev=None, next=None):
self.value = value
self.prev = prev
self.next = next
class DoublyLinkedList:
def __init__(self):
self.be_empty()
def be_empty(self):
self.first = None
self.last = None
def is_empty(self):
if self.first is None:
assert self.last is None
return True
else:
return False
def insert_node(self, node):
if self.is_empty():
self.first = node
self.last = node
else:
self.first.prev = node
node.next = self.first
node.prev = None
self.first = node
def insert(self, x):
self.insert_node(Node(x))
def delete(self, x):
'''Note : if x is not found, this does nothing'''
if self.is_empty():
return
else:
item = self.first
while item is not None:
if item.value == x:
break
else:
item = item.next
if item is self.last:
self.delete_last()
elif item is self.first:
self.delete_first()
else:
prev = item.prev
next = item.next
prev.next = next
next.prev = prev
def delete_first(self):
if self.first is self.last:
self.be_empty()
else:
second = self.first.next
second.prev = None
self.first = second
def delete_last(self):
if self.first is self.last:
self.be_empty()
else:
second = self.last.prev
second.next = None
self.last = second
def to_str(self):
output = ''
if self.is_empty():
return output
else:
item = self.first
while item is not None:
output += str(item.value) + ' '
item = item.next
output = output.rstrip()
return output
num_of_command = int(input())
doublely_list = DoublyLinkedList()
for n in range(num_of_command):
str_command = input()
if str_command == 'deleteFirst':
doublely_list.delete_first()
continue
elif str_command == 'deleteLast':
doublely_list.delete_last()
continue
command_name = str_command.split()[0]
command_obj = int(str_command.split()[1])
if command_name == 'insert':
doublely_list.insert(command_obj)
elif command_name == 'delete':
doublely_list.delete(command_obj)
print(doublely_list.to_str()) | Traceback (most recent call last):
File "/tmp/tmpu6uncc3k/tmpgv42fw2m.py", line 124, in <module>
num_of_command = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s831669597 | p02265 | u612243550 | 1469381105 | Python | Python3 | py | Runtime Error | 0 | 0 | 1157 | class Node:
def __init__(self, key, prevNode, nextNode):
self.key = key
self.prevNode = prevNode
self.nextNode = nextNode
def deleteNode(node):
if node == fNode:
return
node.prevNode.nextNode = node.nextNode
node.nextNode.preNode = node.prevNode
def searchNode(key):
global fNode
node = fNode.nextNode
while node != fNode and node.key != key:
node = node.nextNode
return node
# ????????????????????????
fNode = Node(None, None, None)
fNode.prevNode = fNode
fNode.nextNode = fNode
n = int(input())
for i in range(0, n):
command, key = input().split(' ')
if command == 'insert':
insertNode = Node(key, fNode, fNode.nextNode)
fNode.nextNode.prevNode = insertNode
fNode.nextNode = insertNode
if command == 'delete':
deleteNode(searchNode(key))
if command == 'deleteFirst':
deleteNode(fNode.nextNode)
if command == 'deleteLast':
deleteNode(fNode.lastNode)
#nodeList(fNode)
# node List
node = fNode.nextNode
keys = []
while node != fNode:
keys.append(node.key)
node = node.nextNode
print(" ".join(keys)) | Traceback (most recent call last):
File "/tmp/tmpfnqz7xpz/tmpaiyj2lq4.py", line 25, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s498279304 | p02265 | u612243550 | 1469383982 | Python | Python3 | py | Runtime Error | 0 | 0 | 1477 | class Node:
def __init__(self, key, prevNode, nextNode):
self.key = key
self.prevNode = prevNode
self.nextNode = nextNode
def deleteNode(node):
if node == fNode:
return
node.prevNode.nextNode = node.nextNode
node.nextNode.prevNode = node.prevNode
def searchNode(key):
global fNode
node = fNode.nextNode
while node != fNode and node.key != key:
node = node.nextNode
return node
'''
def searchLast():
global fNode
node = fNode.nextNode
while node != fNode:
prevNode = node
node = node.nextNode
return prevNode
'''
def nodeList():
global fNode
node = fNode.nextNode
keys = []
while node != fNode:
keys.append(node.key)
node = node.nextNode
print(" ".join(keys))
# ????????????????????????
fNode = Node(None, None, None)
fNode.prevNode = fNode
fNode.nextNode = fNode
n = int(input())
for i in range(0, n):
inputs = input().split(' ')
for i in inputs:
inputs2 = inputs.split(' ')
command = inputs2[0]
if command == 'insert':
insertNode = Node(inputs2[1], fNode, fNode.nextNode)
fNode.nextNode.prevNode = insertNode
fNode.nextNode = insertNode
if command == 'delete':
deleteNode(searchNode(inputs[1]))
if command == 'deleteFirst':
deleteNode(fNode.nextNode)
if command == 'deleteLast':
deleteNode(fNode.prevNode)
#deleteNode(searchLast())
nodeList() | Traceback (most recent call last):
File "/tmp/tmpwic8bg1y/tmp9g1zuii_.py", line 45, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s420248800 | p02265 | u554198876 | 1470154730 | Python | Python3 | py | Runtime Error | 30 | 7956 | 427 | from collections import deque
n = int(input())
d = deque()
for i in range(n):
line = input().split()
if len(line) == 2:
command, ele = line
else:
command = line[0]
if command == 'insert':
d.appendleft(ele)
elif command == 'delete':
d.remove(ele)
elif command == 'deleteFirst':
d.popleft()
elif command == 'deleteLast':
d.pop()
print(' '.join(list(d))) | Traceback (most recent call last):
File "/tmp/tmpv6f9owbs/tmp012nlml9.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s894317503 | p02265 | u554198876 | 1470155001 | Python | Python3 | py | Runtime Error | 40 | 7936 | 428 | from collections import deque
n = int(input())
d = deque()
for i in range(n):
line = input().split()
if len(line) == 2:
command, ele = line
else:
command = line[0]
if command == 'insert':
d.appendleft(ele)
elif command == 'delete':
d.remove(ele)
elif command == 'deleteFirst':
d.popleft()
elif command == 'deleteLast':
d.pop()
print(' '.join(list(d))) | Traceback (most recent call last):
File "/tmp/tmpgwz9sxzz/tmpzki5g1m6.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s801540515 | p02265 | u989295536 | 1470234710 | Python | Python3 | py | Runtime Error | 0 | 0 | 713 | # coding:utf-8
# Doubly Linked List
class DLL:
def __init__(self):
self.array = []
def insert(self, x):
self.array = [x] + self.array
def delete(self, x):
del self.array[self.array.index(x)]
def deleteFirst(self):
del self.array[0]
def deleteLast(self):
del self.array[len(self.array)-1]
def main():
dll = DLL()
n = int(input())
for _ in range(n):
key = ''
try:
command, key = map(str, input().split())
except ValueError:
command = input()
print(command, key)
eval("dll." + command + '(' + key + ')')
print(dll.array)
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpmkvnuxjz/tmphi5behzu.py", line 41, in <module>
main()
File "/tmp/tmpmkvnuxjz/tmphi5behzu.py", line 25, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s962801058 | p02265 | u989295536 | 1470234789 | Python | Python3 | py | Runtime Error | 0 | 0 | 713 | # coding:utf-8
# Doubly Linked List
class DLL:
def __init__(self):
self.array = []
def insert(self, x):
self.array = [x] + self.array
def delete(self, x):
del self.array[self.array.index(x)]
def deleteFirst(self):
del self.array[0]
def deleteLast(self):
del self.array[len(self.array)-1]
def main():
dll = DLL()
n = int(input())
for _ in range(n):
key = ''
try:
command, key = map(str, input().split())
except ValueError:
command = input()
print(command, key)
eval("dll." + command + '(' + key + ')')
print(dll.array)
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpbygf5uxd/tmpicbqe24q.py", line 41, in <module>
main()
File "/tmp/tmpbygf5uxd/tmpicbqe24q.py", line 25, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s822667674 | p02265 | u989295536 | 1470237732 | Python | Python3 | py | Runtime Error | 30 | 7720 | 823 | # coding:utf-8
# Doubly Linked List
class DLL:
def __init__(self):
self.array = []
def insert(self, x):
self.array = [x] + self.array
def delete(self, x):
del self.array[self.array.index(x)]
def deleteFirst(self):
del self.array[0]
def deleteLast(self):
del self.array[len(self.array)-1]
def main():
dll = DLL()
n = int(input())
ans = ""
for _ in range(n):
operation = input().split()
command = operation[0]
if command in ["insert", "delete"]:
key = operation[1]
eval("dll." + command + '(' + key + ')')
else:
eval("dll." + command + "()")
for value in dll.array:
ans += str(value) + " "
print(ans.rstrip())
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmp7_2sa_ty/tmpy7356u0o.py", line 44, in <module>
main()
File "/tmp/tmp7_2sa_ty/tmpy7356u0o.py", line 25, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s707655685 | p02265 | u989295536 | 1470237964 | Python | Python3 | py | Runtime Error | 0 | 0 | 878 | # coding:utf-8
# Doubly Linked List
class DLL:
def __init__(self):
self.array = []
def insert(self, x):
self.array = [x] + self.array
def delete(self, x):
if x in dll.array:
del self.array[self.array.index(x)]
def deleteFirst(self):
del self.array[0]
def deleteLast(self):
del self.array[len(self.array)-1]
def main():
dll = DLL()
n = int(input())
ans = ""
for _ in range(n):
operation = input().split()
command = operation[0]
if command in ["insert", "delete"]:
key = operation[1]
eval("dll." + command + '(' + key + ')')
else:
eval("dll." + command + "()")
print(dll.array)
for value in dll.array:
ans += str(value) + " "
print(ans.rstrip())
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmp120tmnbh/tmpyxtyknmr.py", line 45, in <module>
main()
File "/tmp/tmp120tmnbh/tmpyxtyknmr.py", line 26, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s079261277 | p02265 | u989295536 | 1470239146 | Python | Python3 | py | Runtime Error | 20 | 7736 | 561 | # coding:utf-8
# Doubly Linked List
def main():
n = int(input())
ans = ""
dll = []
for _ in range(n):
operation = input().split()
command = operation[0]
if len(command) == 6:
key = str(operation[1])
if command == "insert":
dll.insert(0, key)
else:
dll.remove(key)
else:
if command[6] == 'F':
dll.pop(0)
else:
dll.pop(-1)
print(' '.join(dll))
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmp3qduxchh/tmpqnorbf6a.py", line 29, in <module>
main()
File "/tmp/tmp3qduxchh/tmpqnorbf6a.py", line 7, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s788374388 | p02265 | u589886885 | 1471011676 | Python | Python3 | py | Runtime Error | 0 | 0 | 384 | from collections import deque
n = int(input())
q = deque()
for i in range(n):
command, num = input().split()
if command == 'insert':
q.appendleft(n)
elif command == 'delete':
try:
q.remove(num)
except Exception as e:
pass
elif command == 'deleteFirst':
q.popleft()
else:
q.pop()
print(' '.join(q)) | Traceback (most recent call last):
File "/tmp/tmpjwbvcs_o/tmpk1oxwifh.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s305474323 | p02265 | u589886885 | 1471011781 | Python | Python3 | py | Runtime Error | 0 | 0 | 384 | from collections import deque
n = int(input())
q = deque()
for i in range(n):
command, num = input().split()
if command == 'insert':
q.appendleft(n)
elif command == 'delete':
try:
q.remove(num)
except Exception as e:
pass
elif command == 'deleteFirst':
q.popleft()
else:
q.pop()
print(' '.join(q)) | Traceback (most recent call last):
File "/tmp/tmp6v98oz19/tmp0mnihpd3.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s753004266 | p02265 | u589886885 | 1471013212 | Python | Python3 | py | Runtime Error | 0 | 0 | 419 | rom collections import deque
import sys
n = int(sys.stdin.readline())
q = deque()
for i in range(n):
command = sys.stdin.readline()[:-1]
if command[0] == 'i':
q.appendleft(command[7:])
elif command[6] == ' ':
try:
q.remove(command[7:])
except Exception as e:
pass
elif command[6] == 'F':
q.popleft()
else:
q.pop()
print(' '.join(q)) | File "/tmp/tmp22hvvdny/tmpr77m_8zq.py", line 1
rom collections import deque
^^^^^^^^^^^
SyntaxError: invalid syntax
| |
s660773867 | p02265 | u092047183 | 1471665906 | Python | Python3 | py | Runtime Error | 30 | 7820 | 549 | # coding: utf-8
import sys
from collections import deque
#n, q = map(int, input().split())
n = int(input())
tasks = {
"insert": "appendleft",
"delete": "remove",
"deleteFirst": "pop",
"deleteLast": "popleft"
}
a = deque()
for i in range(n):
input_line = input()
if input_line in tasks:
#deleteFirst,deleteLast
task = input_line
eval("a.{}()".format(tasks[task]))
else:
#insert,delete
task, item = input_line.split()
eval("a.{}({})".format(tasks[task], item))
print(*a) | Traceback (most recent call last):
File "/tmp/tmpe3rst96o/tmppvtpa9dq.py", line 7, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s854032058 | p02265 | u092047183 | 1471666128 | Python | Python3 | py | Runtime Error | 30 | 7928 | 549 | # coding: utf-8
import sys
from collections import deque
#n, q = map(int, input().split())
n = int(input())
tasks = {
"insert": "appendleft",
"delete": "remove",
"deleteFirst": "popleft",
"deleteLast": "pop"
}
a = deque()
for i in range(n):
input_line = input()
if input_line in tasks:
#deleteFirst,deleteLast
task = input_line
eval("a.{}()".format(tasks[task]))
else:
#insert,delete
task, item = input_line.split()
eval("a.{}({})".format(tasks[task], item))
print(*a) | Traceback (most recent call last):
File "/tmp/tmpcrcl6gpc/tmpt1xyzm72.py", line 7, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s117947924 | p02265 | u092047183 | 1471667643 | Python | Python3 | py | Runtime Error | 0 | 0 | 600 | # coding: utf-8
import sys
from collections import deque
n = int(input())
task_name = (
"insert",
"delete",
"deleteFirst",
"deleteLast"
)
tasks = deque(map(lambda x: x if x in task_name else x.split(), sys.stdin.readlines()))
a = deque()
for task in tasks:
#deleteFirst,deleteLast
if len(task) == 1:
if task == "deleteFirst":
a.popleft()
else:
a.pop()
#insert,delete
else:
t, item = task.split()
if t == "insert":
a.appendleft(item)
elif item in a:
a.remove(item)
print(*a) | Traceback (most recent call last):
File "/tmp/tmpz7oi52bk/tmp66hlg7_t.py", line 6, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s501340639 | p02265 | u989295536 | 1472707903 | Python | Python3 | py | Runtime Error | 0 | 0 | 768 | # coding:utf-8
# Doubly Linked List
class DLL:
def __init__(self):
self.array = []
def insert(self, x):
self.array = [x] + self.array
def delete(self, x):
del self.array[self.array.index(x)]
def deleteFirst(self):
del self.array[0]
def deleteLast(self):
del self.array[len(self.array)-1]
def main():
dll = DLL()
n = int(input())
for _ in range(n):
operation = input().split()
command = operation[0]
if command in ["insert", "delete"]:
key = operation[1]
eval("dll." + command + '(' + key + ')')
else:
eval("dll." + command + "()")
print(str(dll.array)[1:len(str(a))-1])
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpnn2bt801/tmpewy6r0k2.py", line 40, in <module>
main()
File "/tmp/tmpnn2bt801/tmpewy6r0k2.py", line 25, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s157309890 | p02265 | u989295536 | 1472708087 | Python | Python3 | py | Runtime Error | 20 | 7760 | 822 | # coding:utf-8
# Doubly Linked List
class DLL:
def __init__(self):
self.array = []
def insert(self, x):
self.array = [x] + self.array
def delete(self, x):
del self.array[self.array.index(x)]
def deleteFirst(self):
del self.array[0]
def deleteLast(self):
del self.array[len(self.array)-1]
def main():
dll = DLL()
n = int(input())
for _ in range(n):
operation = input().split()
command = operation[0]
if command in ["insert", "delete"]:
key = operation[1]
eval("dll." + command + '(' + key + ')')
else:
eval("dll." + command + "()")
ans = ""
for x in dll.array:
ans += str(x) + ' '
print(ans.strip())
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpz_o40jt8/tmp4qwpuyqv.py", line 44, in <module>
main()
File "/tmp/tmpz_o40jt8/tmp4qwpuyqv.py", line 25, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s973520667 | p02265 | u390995924 | 1473173775 | Python | Python3 | py | Runtime Error | 20 | 7672 | 358 | n = int(input().strip())
l = []
for _ in range(n):
cmd = input()
if cmd == "deleteFirst":
l = l[1:]
elif cmd == "deleteLast":
l.pop()
elif cmd.startswith("insert "):
_, e = cmd.split(" ")
l.insert(0, e)
elif cmd.startswith("delete "):
_, e = cmd.split(" ")
l.remove(e)
print(" ".join(l)) | Traceback (most recent call last):
File "/tmp/tmpmxtn86l2/tmpsyxqirbf.py", line 1, in <module>
n = int(input().strip())
^^^^^^^
EOFError: EOF when reading a line
| |
s672771333 | p02265 | u390995924 | 1473221926 | Python | Python3 | py | Runtime Error | 30 | 7944 | 376 | from collections import deque
q = deque()
n = int(input().strip())
for _ in range(n):
cmd = input()
if cmd == "deleteFirst":
q.popleft()
elif cmd == "deleteLast":
q.pop()
elif cmd.startswith("insert "):
v = cmd[7:]
q.appendleft(v)
elif cmd.startswith("delete "):
v = cmd[7:]
q.remove(v)
print(" ".join(q)) | Traceback (most recent call last):
File "/tmp/tmp6dfa8lqo/tmpiuj0e2d5.py", line 5, in <module>
n = int(input().strip())
^^^^^^^
EOFError: EOF when reading a line
| |
s424048790 | p02265 | u890722286 | 1474064022 | Python | Python3 | py | Runtime Error | 20 | 7724 | 417 | n = int(input())
ans = []
for i in range(n):
c = input().split()
cmd = c[0]
x = 0
if 1 < len(c):
x = int(c[1])
if cmd == 'insert':
y = [x] + ans
ans = y
elif cmd == 'delete':
index = ans.index(x)
ans.pop(index)
elif cmd == 'deleteFirst':
ans.pop(0)
elif cmd == 'deleteLast':
ans.pop(len(ans) - 1)
print(' '.join(map(str, ans))) | Traceback (most recent call last):
File "/tmp/tmplk5ey6m_/tmp12j6jp27.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s741250681 | p02265 | u510829608 | 1474205664 | Python | Python3 | py | Runtime Error | 20 | 7652 | 294 | n = int(input())
li = []
for i in range(n):
command = input().split()
if command[0] == 'insert':
li.insert(0, command[1])
elif command[0] == 'delete':
li.remove(command[1])
elif command[0] == 'deleteFirst':
li.pop(0)
else:
li.pop()
print(*li) | Traceback (most recent call last):
File "/tmp/tmp_f7cxg_n/tmpx2pbujcq.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s141995213 | p02265 | u510829608 | 1474206593 | Python | Python3 | py | Runtime Error | 0 | 0 | 429 | from collections import deque
n = int(input())
dll = deque()
for i in range(n):
input_line = input().split()
if input_line[0] == "insert":
dll.appendleft(input_line[1])
elif input_line[0] == "delete":
try:
dll.remove(input_line[1])
except:
pass
elif input_line[0] == "deleteFirst":
dll.popleft()
else:
dll.pop()
print(*dll | File "/tmp/tmps2rncm88/tmphcz6g9i7.py", line 20
print(*dll
^
SyntaxError: '(' was never closed
| |
s901529119 | p02265 | u135273382 | 1475733595 | Python | Python3 | py | Runtime Error | 30 | 7884 | 360 | from collections import deque
n = int(input())
d = deque()
cmd = ['com', 0]
for i in range(n):
cmd = input().split()
if cmd[0] == 'insert':
d.appendleft(int(cmd[1]))
elif cmd[0] == 'delete':
d.remove(int(cmd[1]))
elif cmd[0] == 'deleteFirst':
d.popleft()
elif cmd[0] == 'deleteLast':
d.pop()
print(*list(d)) | Traceback (most recent call last):
File "/tmp/tmpvar8n8yz/tmpu7ec23ns.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s686730779 | p02265 | u135273382 | 1475733623 | Python | Python3 | py | Runtime Error | 30 | 7948 | 360 | from collections import deque
n = int(input())
d = deque()
cmd = ['com', 0]
for i in range(n):
cmd = input().split()
if cmd[0] == 'insert':
d.appendleft(int(cmd[1]))
elif cmd[0] == 'delete':
d.remove(int(cmd[1]))
elif cmd[0] == 'deleteFirst':
d.popleft()
elif cmd[0] == 'deleteLast':
d.pop()
print(*list(d)) | Traceback (most recent call last):
File "/tmp/tmpjjblkmrl/tmp2pojs5_1.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.