s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
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... |
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)
p... |
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 == '... |
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
|
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 |
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, |
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) |
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) |
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()
p... |
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()
i... |
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:
sta... |
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 " "... |
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 " ".... |
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... |
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... |
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... |
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... |
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) |
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... |
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) |
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().... |
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 ... |
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] ==... |
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] ==... |
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
e... |
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... |
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] == "del... |
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)) |
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))) |
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))) |
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:
... |
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.p... |
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] == "delete... |
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)):... |
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
pri... |
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":
... |
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:
... |
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)
... |
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()
... |
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] == "deleteFi... |
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... |
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... |
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}... |
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(in... |
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] == "deleteFir... |
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
... |
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(' '.... |
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) |
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 commandNa... |
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.firs... |
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.firs... |
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.... |
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.... |
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.... |
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 ran... |
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... |
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
... |
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
... |
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... |
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":
... |
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[... |
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.... |
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_... |
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.... |
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.ge... |
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.g... |
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.g... |
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.g... |
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.... |
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":
... |
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 ... |
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 ==... |
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 ' '... |
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 ... |
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... |
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... |
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):
... |
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):
... |
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 == 'd... |
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 == '... |
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):
... |
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):
... |
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):
... |
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]
... |
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, ... |
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':
... |
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':
... |
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:
... |
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:
... |
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:
... |
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(ta... |
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):
... |
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):
... |
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(" ")
... |
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 "):
... |
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.p... |
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) |
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
e... |
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] == 'dele... |
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] == 'dele... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.