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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s675569578 | p02264 | u564464686 | 1524819352 | Python | Python3 | py | Runtime Error | 0 | 0 | 391 | s=0
A=input().split()
n=(int)(A[0])
t=(int)(A[1])
x=[0 for i in range(2*n)]
for i in range(n):
B=input().split()
k=2*i
x[k]=(B[0])
x[k+1]=(int)(B[1])
while len(x)>0:
s=x[1]-t
if s>0:
sum+=t
x.append(x[0])
x.append(s)
del x[0]
del x[0]
if s<=0:
sum+=x[1]
print( x[0],sum)
del x[0]
del x[0]
| Traceback (most recent call last):
File "/tmp/tmprlp1o1te/tmp4gwjnxqe.py", line 2, in <module>
A=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s021068423 | p02264 | u150984829 | 1524896392 | Python | Python3 | py | Runtime Error | 0 | 0 | 278 | import sys
from collections import deque
def m():
s=sys.stdin.readlines()
q=int(s[0].split()[1])
f=lambda x,y:(x,int(y))
d=deque(f(*e.split())for e in s[1:])
t,a=0,[]
while d:
k,v=d.popleft()
if v>q:v-=q;t+=q;d+[[k,v]]
else:t+=v;a+=[f'{k} {t}\n']
print(a[:-1])
m()
| Traceback (most recent call last):
File "/tmp/tmpyzm75vg7/tmp2_w8yv9i.py", line 14, in <module>
m()
File "/tmp/tmpyzm75vg7/tmp2_w8yv9i.py", line 5, in m
q=int(s[0].split()[1])
~^^^
IndexError: list index out of range
| |
s485966979 | p02264 | u055885332 | 1524900007 | Python | Python3 | py | Runtime Error | 0 | 0 | 483 | #16D8101014F 久留米 竜之介 Python
from collections import deque
n,time=map(int,input().split())
timenow = 0
p=[]
q=[]
queue=[] #p1,p2....
Queue=[] #time
for i in range (n):
line=input().split()
q.append(int(line.pop()))
p.append(line.pop())
print(len(p))
while len(p) is not 0:
Ptmp=p.deque()
if Ptmp<=100:
timenow+=Ptmp
queue.append(q.deque())
Queue.append()
else:
timenow+=100
Ptmp-=100
q.append(ptmp)
p.append(p.deque())#??
print(queue,Queue)
| /tmp/tmpqebt2y71/tmp6twm6cf5.py:16: SyntaxWarning: "is not" with a literal. Did you mean "!="?
while len(p) is not 0:
/tmp/tmpqebt2y71/tmp6twm6cf5.py:16: SyntaxWarning: "is not" with a literal. Did you mean "!="?
while len(p) is not 0:
Traceback (most recent call last):
File "/tmp/tmpqebt2y71/tmp6twm6cf5.py", line 4, in <module>
n,time=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s459091030 | p02264 | u055885332 | 1524902084 | Python | Python3 | py | Runtime Error | 20 | 5600 | 626 | #16D8101014F 久留米 竜之介 Python
n,time=map(int,input().split())
timenow = 0
p=[]
q=[]
queue=[] #p1,p2....
Queue=[] #time
for i in range (n):
line=input().split()
q.append(int(line.pop()))
p.append(line.pop())
head=0
tail=len(p)-1
while head is not tail:
#print(p)
#print(q)
#print(head,tail)
Ptmp=q[head]
if Ptmp<=time:
timenow+=Ptmp
queue.append(p[head])
Queue.append(timenow)
head+=1
else:
timenow+=time
Ptmp-=time
q.append(Ptmp)
p.append(p[head])
head+=1
tail+=1
Ptmp=q[head]
timenow+=Ptmp
queue.append(p[head])
Queue.append(timenow)
for i in range(n):
print(queue[i],Queue[i])
| Traceback (most recent call last):
File "/tmp/tmpk53qmuia/tmp4vk5zk1j.py", line 3, in <module>
n,time=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s797547289 | p02264 | u724548524 | 1524975790 | Python | Python3 | py | Runtime Error | 0 | 0 | 363 | n, p = map(int, input().split())
ps = []
for i in range(n):
ps.append(input().split())
ps[i][1] = int(ps[i][1])
t = 0
i = 0
j = 0
while len(ps) > 0:
if ps[i][1] > p:
ps[i][1] -= p
t += p
i = (i + 1) % n
elif ps[i][1] != 0:
t += ps[i][1]
print("{0} {1}".format(ps[i][0], t))
ps.pop(i)
n -= 1
| Traceback (most recent call last):
File "/tmp/tmphzi6aiep/tmp4ksxtgdi.py", line 1, in <module>
n, p = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s950370922 | p02264 | u255317651 | 1524991574 | Python | Python3 | py | Runtime Error | 0 | 0 | 1045 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 29 14:42:43 2018
@author: maezawa
"""
def print_array(g):
ans = str(g[0])
if len(g) > 1:
for i in range(1,len(g)):
ans += ' '+str(g[i])
print(ans)
name=[]
time=[]
current_time = 0
n, q = list(map(int, input().split()))
for i in range(n):
s = input().split()
name.append(s[0])
time.append(int(s[1]))
# =============================================================================
# print(n,q)
# print(name)
# print(time)
# =============================================================================
finished = []
fin_time = []
i=0
remain = n
while True:
if time[i] <= q:
current_time += time.pop(i)
finished.append(name.pop(i))
fin_time.append(current_time)
remain -= 1
if remain == 0:
break
% i = (i+1)%remain
else:
time[i] -= q
current_time += q
i = (i+1)%remain
for i in range(n):
print("{} {}".format(finished[i], fin_time[i]))
| File "/tmp/tmplztp5vr6/tmpsxd5a_dq.py", line 41
% i = (i+1)%remain
^
SyntaxError: invalid syntax
| |
s949157861 | p02264 | u255317651 | 1524991605 | Python | Python3 | py | Runtime Error | 0 | 0 | 1045 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 29 14:42:43 2018
@author: maezawa
"""
def print_array(g):
ans = str(g[0])
if len(g) > 1:
for i in range(1,len(g)):
ans += ' '+str(g[i])
print(ans)
name=[]
time=[]
current_time = 0
n, q = list(map(int, input().split()))
for i in range(n):
s = input().split()
name.append(s[0])
time.append(int(s[1]))
# =============================================================================
# print(n,q)
# print(name)
# print(time)
# =============================================================================
finished = []
fin_time = []
i=0
remain = n
while True:
if time[i] <= q:
current_time += time.pop(i)
finished.append(name.pop(i))
fin_time.append(current_time)
remain -= 1
if remain == 0:
break
#i = (i+1)%remain
else:
time[i] -= q
current_time += q
i = (i+1)%remain
for i in range(n):
print("{} {}".format(finished[i], fin_time[i]))
| Traceback (most recent call last):
File "/tmp/tmp2txnt5ez/tmpfbbvqnh5.py", line 19, in <module>
n, q = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s720912149 | p02264 | u255317651 | 1524991710 | Python | Python3 | py | Runtime Error | 0 | 0 | 1044 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 29 14:42:43 2018
@author: maezawa
"""
def print_array(g):
ans = str(g[0])
if len(g) > 1:
for i in range(1,len(g)):
ans += ' '+str(g[i])
print(ans)
name=[]
time=[]
current_time = 0
n, q = list(map(int, input().split()))
for i in range(n):
s = input().split()
name.append(s[0])
time.append(int(s[1]))
# =============================================================================
# print(n,q)
# print(name)
# print(time)
# =============================================================================
finished = []
fin_time = []
i=0
remain = n
while True:
if time[i] <= q:
current_time += time.pop(i)
finished.append(name.pop(i))
fin_time.append(current_time)
i = (i+1)%remain
remain -= 1
if remain == 0:
break
else:
time[i] -= q
current_time += q
i = (i+1)%remain
for i in range(n):
print("{} {}".format(finished[i], fin_time[i]))
| Traceback (most recent call last):
File "/tmp/tmpcyrn2s28/tmpojm6znsu.py", line 19, in <module>
n, q = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s689753925 | p02264 | u255317651 | 1524991923 | Python | Python3 | py | Runtime Error | 0 | 0 | 1040 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 29 14:42:43 2018
@author: maezawa
"""
def print_array(g):
ans = str(g[0])
if len(g) > 1:
for i in range(1,len(g)):
ans += ' '+str(g[i])
print(ans)
name=[]
time=[]
current_time = 0
n, q = list(map(int, input().split()))
for i in range(n):
s = input().split()
name.append(s[0])
time.append(int(s[1]))
# =============================================================================
# print(n,q)
# print(name)
# print(time)
# =============================================================================
finished = []
fin_time = []
i=0
remain = n
while True:
if time[i] <= q:
current_time += time.pop(i)
finished.append(name.pop(i))
fin_time.append(current_time)
i = i%remain
remain -= 1
if remain == 0:
break
else:
time[i] -= q
current_time += q
i = (i+1)%remain
for i in range(n):
print("{} {}".format(finished[i], fin_time[i]))
| Traceback (most recent call last):
File "/tmp/tmp12ehi1cq/tmpblf1pzkq.py", line 19, in <module>
n, q = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s102187155 | p02264 | u255317651 | 1524992013 | Python | Python3 | py | Runtime Error | 0 | 0 | 1040 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 29 14:42:43 2018
@author: maezawa
"""
def print_array(g):
ans = str(g[0])
if len(g) > 1:
for i in range(1,len(g)):
ans += ' '+str(g[i])
print(ans)
name=[]
time=[]
current_time = 0
n, q = list(map(int, input().split()))
for i in range(n):
s = input().split()
name.append(s[0])
time.append(int(s[1]))
# =============================================================================
# print(n,q)
# print(name)
# print(time)
# =============================================================================
finished = []
fin_time = []
i=0
remain = n
while True:
if time[i] <= q:
current_time += time.pop(i)
finished.append(name.pop(i))
fin_time.append(current_time)
remain -= 1
i = i%remain
if remain == 0:
break
else:
time[i] -= q
current_time += q
i = (i+1)%remain
for i in range(n):
print("{} {}".format(finished[i], fin_time[i]))
| Traceback (most recent call last):
File "/tmp/tmp27a8ed62/tmpdc8n6oce.py", line 19, in <module>
n, q = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s654923190 | p02264 | u064313887 | 1525094404 | Python | Python3 | py | Runtime Error | 0 | 0 | 794 |
class Process:
def __init__(self,n,head,tail):
self.n = n
self.head = head
self.tail = tail
self.name = []
self.time = []
def void enqueue(self,x):
self.data = x
tail = (tail+1) % n
def dequeue(self):
self.x = self.[head]
head = (head+1) % n
return x
process = Process()
n,q = map(int,input(),split())
for i in range(n):
name[i],time[i] = map(input(),split())
list(map(int,time))
elaps = 0
head = 1
tail = n+1
process = Process(n,head,tail)
while head != tail:
process.name = dequeue()
process.time = dequeue()
c = min(q,process.time)
process.time -= c
elaps += c
if process.time > 0:
enqueue(process.time)
enqueue(process.name)
else:
print(process.name,elaps)
| File "/tmp/tmpjh02jp_w/tmpo_of0ct8.py", line 11
def void enqueue(self,x):
^^^^^^^
SyntaxError: expected '('
| |
s576149476 | p02264 | u405027099 | 1525174696 | Python | Python3 | py | Runtime Error | 0 | 0 | 417 | a=input().split()
n=int(a[0])
q=int(a[1])
b=[0 for i in range(2*n)]
cnt=0
for i in range(n):
B=input().split()
b[2*i]=B[0]
b[2*i+1]=int(B[1])
while len(b)>0:
if b[1]-100>0:
tmp1=b[0]
tmp2=b[1]-100
del b[0]
del b[0]
b.append(tmp1)
b.append(tmp2)
cnt=cnt+100
else:
cnt=cnt+b[1]
print(b[0],cnt)
del b[0]
del b[0
| File "/tmp/tmpmaph9iu9/tmpg44k2dqw.py", line 23
del b[0
^
SyntaxError: '[' was never closed
| |
s931750062 | p02264 | u088372268 | 1525355002 | Python | Python3 | py | Runtime Error | 20 | 5604 | 1490 | class Queue():
def __init__(self, size=10):
self.queue = [None] * size
self.head = self.tail = 0
self.MAX = size
self.num_items = 0
def is_empty(self):
return self.num_items == 0
def is_full(self):
return self.num_items == self.MAX
def enqueue(self, x):
if self.is_full():
raise IndexError
self.queue[self.tail] = x
self.num_items += 1
if self.tail+1 == self.MAX:
self.tail = 0
else:
self.tail += 1
def dequeue(self):
if self.is_empty():
raise IndexError
x = self.queue[self.head]
self.num_items -= 1
if self.head+1 == self.MAX:
self.head = 0
else:
self.head += 1
return x
class Process:
def __init__(self, name, time):
self.name = name
self.time = time
def print_time(self):
return self.time
def print_name(self):
return self.name
def main():
n, q = map(int, input().split())
qq = Queue()
t = 0
for i in range(n):
name, time = input().split()
p = Process(name, int(time))
qq.enqueue(p)
while not qq.is_empty():
p = qq.dequeue()
if p.time - q <= 0:
t += p.time
print("{} {}".format(p.name, t))
else:
p.time -= q
t += q
qq.enqueue(p)
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmp59ydety1/tmp6l41h7e5.py", line 74, in <module>
main()
File "/tmp/tmp59ydety1/tmp6l41h7e5.py", line 52, in main
n, q = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s721949024 | p02264 | u810922275 | 1527034662 | Python | Python3 | py | Runtime Error | 0 | 0 | 347 | from collections import deque
import numpy as np
n,q=map(int,input().split())
s=0
queue=deque([])
for i in range(n):
name,time=input().split()
queue.append([name,int(time)])
while len(queue)>0:
t=queue.popleft()
if t[1]>q:
s=s+q
t[1]=t[1]-q
queue.append(t)
else:
s=s+t[1]
print(t[0],s)
| Traceback (most recent call last):
File "/tmp/tmpuebg7mtn/tmpk1ejp0nk.py", line 3, in <module>
n,q=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s567931957 | p02264 | u810922275 | 1527034670 | Python | Python | py | Runtime Error | 0 | 0 | 347 | from collections import deque
import numpy as np
n,q=map(int,input().split())
s=0
queue=deque([])
for i in range(n):
name,time=input().split()
queue.append([name,int(time)])
while len(queue)>0:
t=queue.popleft()
if t[1]>q:
s=s+q
t[1]=t[1]-q
queue.append(t)
else:
s=s+t[1]
print(t[0],s)
| Traceback (most recent call last):
File "/tmp/tmps1m5om4i/tmp9lzd_j69.py", line 3, in <module>
n,q=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s336472898 | p02264 | u657361950 | 1529630782 | Python | Python3 | py | Runtime Error | 0 | 0 | 2099 | import java.util.Scanner;
public class Main {
static class Node<E> {
public E value;
public Node<E> next;
public Node(E value) {
this.value = value;
this.next = null;
}
}
static class SimpleQueue<E> {
private Node<E> head;
private Node<E> tail;
int size;
public SimpleQueue() {
size = 0;
head = null;
tail = null;
}
public int getSize() {
return size;
}
public boolean isEmpty() {
return size == 0;
}
public void enqueue(E element) {
Node<E> node = new Node<E>(element);
if (head == null && tail == null) {
head = tail = node;
} else {
tail.next = node;
tail = node;
}
size++;
}
public E dequeue() {
if (isEmpty()) {
return null;
}
E element = head.value;
head = head.next;
if (head == null) {
tail = null;
}
size--;
return element;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");
Node<E> current = head;
while (current != null) {
sb.append(current.value);
current = current.next;
if (current != null) {
sb.append(", ");
}
}
sb.append("](");
if (tail != null) {
sb.append(tail.value);
}
sb.append(")");
return sb.toString();
}
}
static class Process {
public String name;
public int time;
public Process(String name, int time) {
this.name = name;
this.time = time;
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int q = sc.nextInt();
SimpleQueue<Process> queue = new SimpleQueue<Process>();
for (int i = 0; i < n; i++) {
String name = sc.next();
int time = sc.nextInt();
queue.enqueue(new Process(name, time));
}
sc.close();
int total = 0;
while (!queue.isEmpty()) {
Process process = queue.dequeue();
if (process.time > q) {
process.time = process.time - q;
total += q;
queue.enqueue(process);
} else {
total += process.time;
System.out.println(process.name + " " + total);
}
}
}
}
| File "/tmp/tmpi_vad8bw/tmp96uorjz6.py", line 3
public class Main {
^^^^^
SyntaxError: invalid syntax
| |
s553533115 | p02264 | u153665391 | 1529886683 | Python | Python3 | py | Runtime Error | 0 | 0 | 894 | process_num, qms = map(int, input().split())
raw_procs = [input() for i in range(process_num)]
if __name__ == '__main__':
procs = []
for row in raw_procs:
name, time = row.split()
procs.push = {
"name": name,
"time": int(time),
}
total_time = 0
current_proc = 0
while len(procs) > 0:
if procs[current_proc]["time"] > 100:
procs[current_proc]["time"] = procs[current_proc]["time"] - qms
total_time += qms
if current_proc == len(procs)-1:
current_proc = 0
else:
current_proc += 1
else:
total_time += procs[current_proc]["time"]
print("{} {}".format(procs[current_proc]["name"], total_time))
del procs[current_proc]
if current_proc >= len(procs)-1:
current_proc = 0
| Traceback (most recent call last):
File "/tmp/tmpng31oid_/tmpobs9tg29.py", line 1, in <module>
process_num, qms = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s234344135 | p02264 | u682153677 | 1530423336 | Python | Python3 | py | Runtime Error | 0 | 0 | 577 | # -*- coding: utf-8 -*-
def simu(pro, q):
end_time = 0
while bool(pro):
if pro[1] > q:
end_time += q
pro.append(pro[0])
pro.append(pro[1] - q)
pro.pop(0)
pro.pop(1)
elif pro[1] <= q:
end_time += pro[1]
print('{0} {1}'.format(pro[1], end_time))
pro.pop(0)
pro.pop(1)
n, q = list(map(int, input().split()))
pro = []
for i in range(n):
name, time = list(input().split())
pro.append(name)
pro.append(int(time))
simu(pro, q)
| Traceback (most recent call last):
File "/tmp/tmp2y_2s39i/tmpk4_jp69l.py", line 22, in <module>
n, q = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s367531533 | p02264 | u682153677 | 1530423797 | Python | Python3 | py | Runtime Error | 0 | 0 | 547 | # -*- coding: utf-8 -*-
def simu(pro, q):
end_time = 0
while bool(pro):
if pro[1] > q:
end_time += q
pro.append(pro[0])
pro.append(pro[1] - q)
pro.pop(0) * 2
elif pro[1] <= q:
end_time += pro[1]
print('{0} {1}'.format(pro[0], end_time))
pro.pop(0) * 2
n, q = list(map(int, input().split()))
pro = []
for i in range(n):
name, time = list(input().split())
pro.append(name)
pro.append(int(time))
simu(pro, q)
| Traceback (most recent call last):
File "/tmp/tmpt283yuu5/tmpbee8tgg0.py", line 20, in <module>
n, q = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s403653552 | p02264 | u682153677 | 1530423882 | Python | Python3 | py | Runtime Error | 0 | 0 | 547 | # -*- coding: utf-8 -*-
def simu(pro, q):
end_time = 0
while bool(pro):
if pro[1] > q:
end_time += q
pro.append(pro[0])
pro.append(pro[1] - q)
pro.pop(0) * 2
elif pro[1] <= q:
end_time += pro[1]
print('{0} {1}'.format(pro[0], end_time))
pro.pop(0) * 2
n, q = list(map(int, input().split()))
pro = []
for i in range(n):
name, time = list(input().split())
pro.append(name)
pro.append(int(time))
simu(pro, q)
| Traceback (most recent call last):
File "/tmp/tmpwbzfmbde/tmpfvhqgfcn.py", line 20, in <module>
n, q = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s710626654 | p02264 | u912237403 | 1373785675 | Python | Python | py | Runtime Error | 0 | 0 | 1212 | #coding: utf-8
class Queue:
class Cell:
def __init__(self,data,link=None):
self.data=data
self.link=link
def __init__(self):
self.size=0
self.front=None
self.rear=None
def enqueue(self,x):
if self.size==0:
self.front = self.rear = Queue.Cell(x)
else:
new_cell = Queue.Cell(x)
self.rear.link=new_cell
self.rear=new_cell
self.size +=1
def dequeue(self):
if self.size==0:
raise IndexError
value=self.front.data
self.front=self.front.link
self.size -=1
if self.size==0:
self.rear=None
return value
def isEmpty(self):
return self.size==0
def generator(n1, n2, step=1):
n = n1
while n<n2:
yield n
n+= step
n, q = map(int, raw_input().split())
que = queue()
for i in generator(0,n):
name, time = raw_input().split()
que.enqueue([name, int(time)])
stime = 0
while not que.isEmpty:
job = que.dequeue()
tmp=min(q,job[1])
stime += tmp
job[1] -= tmp
if job[1]==0:
print job[0], stime
else:
que.que.enqueue(job) | File "/tmp/tmp7ecbc78s/tmpaglw3ad4.py", line 56
print job[0], stime
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s467279928 | p02264 | u912237403 | 1373789590 | Python | Python | py | Runtime Error | 0 | 0 | 1233 | #coding: utf-8
import sys
class Queue:
class Cell:
def __init__(self, x, y = None):
self.data = x
self.next = y
def __init__(self):
self.size = 0
self.rear = None
def enqueue(self, x):
if self.size == 0:
self.rear = Queue.Cell(x)
self.rear.next = self.rear
else:
new_cell = Queue.Cell(x, self.rear.next)
self.rear.next = new_cell
self.rear = new_cell
self.size += 1
def dequeue(self):
if self.size == 0: raise IndexError
front = self.rear.next
self.rear.next = front.next
self.size -= 1
if self.size == 0: self.rear = None
return front.data
def isEmpty(self):
return self.size == 0
def generator(n1, n2, step=1):
n = n1
while n<n2:
yield n
n+= step
n, q = map(int, raw_input().split())
A = Queue()
for i in generator(0,n):
name, time = raw_input().split()
A.enqueue([name, int(time)])
stime = 0
while not A.isEmpty():
job = A.dequeue()
if q>=job[1]:
stime += job[1]
print job[0], stime
else:
stime += q
job[1] -= tmp
A.enqueue(job) | File "/tmp/tmplv1elv_u/tmpbqh7wgpd.py", line 53
print job[0], stime
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s112267070 | p02264 | u633068244 | 1395990682 | Python | Python | py | Runtime Error | 0 | 0 | 323 | n,q = map(int, raw_input().split())
que = [map(str, raw_input().split()) for i in range(n)]
for i in range(n):que[i][1] = int(que[i][1])
mxt = sum([y for x,y in que])
t = 0
i = 0
while t < mxt:
i %= n
c = que[i][1]
if c <= q:
t += c
que.pop(i)
n -= 1
print a[0],t
else:
t += q
que[i][1] = c - q
i += 1 | File "/tmp/tmp06l3d70o/tmpvybtn3ft.py", line 14
print a[0],t
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s996177350 | p02264 | u633068244 | 1395990886 | Python | Python | py | Runtime Error | 0 | 0 | 334 | n,q = map(int, raw_input().split())
que = [map(str, raw_input().split()) for i in range(n)]
for i in range(n):que[i][1] = int(que[i][1])
mxt = sum([y for x,y in que])
t = 0
i = 0
while t < mxt:
if que[i][1] <= q:
t += que[i][1]
que.pop(i)
n -= 1
print que[i][0],t
else:
t += q
que[i][1] = que[i][1] - q
i = (i+1)%n | File "/tmp/tmp20uhpxs8/tmpofumstud.py", line 12
print que[i][0],t
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s650015596 | p02264 | u633068244 | 1395991660 | Python | Python | py | Runtime Error | 0 | 0 | 382 | n,q = map(int, raw_input().split())
que = [map(str, raw_input().split()) for i in range(n)]
for i in range(n):que[i][1] = int(que[i][1])
mxt = sum([y for x,y in que])
t = 0
i = 0
while t < mxt:
if i = n: i = 0
if que[i][1] <= q:
t += que[i][1]
print que[i][0],t
que.pop(i)
n -= 1
else:
t += q
que[i][1] -= q
i += 1 | File "/tmp/tmp_qy015xz/tmpk51trcw_.py", line 8
if i = n: i = 0
^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s764533521 | p02265 | u007270338 | 1531051351 | Python | Python3 | py | Runtime Error | 20 | 5616 | 1315 | #coding:utf-8
dic = {}
nil = -1
class Doubly:
def __init__(self,key,l=nil,r=nil):
self.l = l
self.r = r
self.key = key
def Insert(self,key):
obj = Doubly(key)
obj.l = fake
fakeR = fake.r
fake.r = obj
obj.r = fakeR
fakeR.l = obj
dic[key] = obj
def deleteFirst(self):
fakeR = fake.r
fake.r = fakeR.r
fakeR.r.l = fake
key = fakeR.key
del dic[key]
def deleteLast(self):
fakeL = fake.l
fake.l = fakeL.l
fakeL.l.r = fake
key = fakeL.key
del dic[key]
def Delete(self,target):
obj = dic[target]
objL = obj.l
objR = obj.r
objL.r = objR
objR.l = objL
del dic[target]
n = int(input())
fake = Doubly(nil)
fake.l = fake
fake.r = fake
for i in range(n):
data = list(input().split())
order = data[0]
if order == "insert":
Doubly.Insert(Doubly, int(data[1]))
elif order == "delete":
Doubly.Delete(Doubly, int(data[1]))
elif order == "deleteFirst":
Doubly.deleteFirst(Doubly)
else:
Doubly.deleteLast(Doubly)
obj = fake.r
List = []
while obj.key != -1:
List.append(str(obj.key))
obj = obj.r
print(" ".join(List))
| Traceback (most recent call last):
File "/tmp/tmpsbwd5siq/tmpuhlol4g5.py", line 45, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s793616428 | p02265 | u007270338 | 1531051910 | Python | Python3 | py | Runtime Error | 20 | 5616 | 1440 | #coding:utf-8
dic = {}
nil = -1
class Doubly:
def __init__(self,key,l=nil,r=nil):
self.l = l
self.r = r
self.key = key
def Insert(self,key):
obj = Doubly(key)
obj.l = fake
fakeR = fake.r
fake.r = obj
obj.r = fakeR
fakeR.l = obj
if key in dic.keys():
dic[key].append(obj)
else:
dic[key] = [obj]
def deleteFirst(self):
fakeR = fake.r
fake.r = fakeR.r
fakeR.r.l = fake
key = fakeR.key
dic[key].pop()
def deleteLast(self):
fakeL = fake.l
fake.l = fakeL.l
fakeL.l.r = fake
key = fakeL.key
dic[key].pop()
def Delete(self,target):
if target in dic.keys():
obj = dic[target].pop()
objL = obj.l
objR = obj.r
objL.r = objR
objR.l = objL
n = int(input())
fake = Doubly(nil)
fake.l = fake
fake.r = fake
for i in range(n):
data = list(input().split())
order = data[0]
if order == "insert":
Doubly.Insert(Doubly, int(data[1]))
elif order == "delete":
Doubly.Delete(Doubly, int(data[1]))
elif order == "deleteFirst":
Doubly.deleteFirst(Doubly)
else:
Doubly.deleteLast(Doubly)
obj = fake.r
List = []
while obj.key != -1:
List.append(str(obj.key))
obj = obj.r
print(" ".join(List))
| Traceback (most recent call last):
File "/tmp/tmpusa81uom/tmpvqpe3fkt.py", line 47, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s560247241 | p02265 | u500386459 | 1531127038 | Python | Python3 | py | Runtime Error | 0 | 0 | 295 | list = []
count = int(input())
for ver in range(count):
try:
conditions,num = input().split()
except ValueError:
print(conditions)
if(conditions == "insert"):
list.append(num)
elif(conditions == "delete"):
list.remove(num)
for ver in range(len(list)):
print(list[ver],end=" ")
| Traceback (most recent call last):
File "/tmp/tmpv5442e0h/tmpycv62zmh.py", line 3, in <module>
count = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s454318986 | p02265 | u500386459 | 1531127095 | Python | Python3 | py | Runtime Error | 0 | 0 | 306 | list = []
count = int(input())
for ver in range(count):
try:
conditions,num = input().split()
except ValueError:
print(conditions)
if(conditions == "insert"):
list.append(num)
elif(conditions == "delete"):
list.remove(num)
for ver in range(len(list)):
print(list[ver],end=" ")
print('/n')
| Traceback (most recent call last):
File "/tmp/tmpah6emlup/tmpns4a_jra.py", line 3, in <module>
count = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s965999438 | p02265 | u500386459 | 1531127200 | Python | Python3 | py | Runtime Error | 0 | 0 | 304 | list = []
count = int(input())
for ver in range(count):
try:
conditions,num = input().split()
except ValueError:
print(conditions)
if(conditions == "insert"):
list.append(num)
elif(conditions == "delete"):
list.remove(num)
for ver in range(len(list)):
print(list[ver],end=" ")
print("")
| Traceback (most recent call last):
File "/tmp/tmpegwffb6o/tmpgne0yc6a.py", line 3, in <module>
count = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s290772812 | p02265 | u500386459 | 1531127407 | Python | Python3 | py | Runtime Error | 0 | 0 | 407 | list = []
count = int(input())
for ver in range(count):
try:
conditions,num = input().split()
except ValueError:
print(conditions)
if(conditions == "insert"):
list.append(num)
elif(conditions == "delete"):
list.remove(num)
elif(conditions == "insertFirst"):
list.insert(0,num)
elif(conditions == "deleteLast"):
list.pop
for ver in range(len(list)):
print(list[ver],end=" ")
print("")
| Traceback (most recent call last):
File "/tmp/tmpvlwjeqro/tmpkn295jc5.py", line 3, in <module>
count = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s704796503 | p02265 | u500386459 | 1531127512 | Python | Python3 | py | Runtime Error | 0 | 0 | 400 | list = []
count = int(input())
for ver in range(count):
try:
conditions,num = input().split()
except ValueError:
print(conditions)
if(conditions == "insert"):
list.append(num)
elif(conditions == "delete"):
list.remove(num)
elif(conditions == "deleteFirst"):
del list[0]
elif(conditions == "deleteLast"):
list.pop
for ver in range(len(list)):
print(list[ver],end=" ")
print("")
| Traceback (most recent call last):
File "/tmp/tmpc2ci29dz/tmphgkry4ld.py", line 3, in <module>
count = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s148793184 | p02265 | u908984540 | 1531206920 | Python | Python3 | py | Runtime Error | 30 | 5996 | 448 | from collections import deque
if __name__ == '__main__':
n = int(input())
dll = deque()
for _ in range(n):
command = input().split()
if command[0] == 'insert':
dll.appendleft(command[1])
elif command[0] == 'delete':
dll.remove(command[1])
elif command[0] == 'deleteFirst':
dll.popleft()
elif command[0] == 'deleteLast':
dll.pop()
print(*dll)
| Traceback (most recent call last):
File "/tmp/tmplwl81_fl/tmpm3n5rpk4.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s804495357 | p02265 | u564464686 | 1531904721 | Python | Python3 | py | Runtime Error | 0 | 0 | 401 | n=int(input())
list=[]
for i in range(n):
A=input().split()
if A[0]=="insert":
a=int(A[1])
list.insert(0,a)
elif A[0]=="delete":
a=int(A[1])
list.remove(a)
else:
if A[0]=="deleteFirst":
list.pop(0)
elif A[0]=="deleteLast":
n=len(list)
list.pop(n)
for i in range(len(list)):
print(list[i],end="")
| Traceback (most recent call last):
File "/tmp/tmpcqtfp0u9/tmpfgko4by8.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s454622402 | p02265 | u564464686 | 1531905042 | Python | Python3 | py | Runtime Error | 20 | 5600 | 430 | n=int(input())
list=[]
for i in range(n):
A=input().split()
if A[0]=="insert":
a=int(A[1])
list.insert(0,a)
elif A[0]=="delete":
a=int(A[1])
list.remove(a)
else:
if A[0]=="deleteFirst":
list.pop(0)
elif A[0]=="deleteLast":
n=len(list)
list.pop(n-1)
for i in range(len(list)-1):
print(list[i],end=" ")
print(list[len(list)-1])
| Traceback (most recent call last):
File "/tmp/tmpzjmsbz_m/tmpvaksoxwg.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s516665464 | p02265 | u256678932 | 1534836264 | Python | Python3 | py | Runtime Error | 20 | 5632 | 2338 | class DoublyLinkedListNode:
def __init__(self, num):
self.num = num
self.next = None
self.prev = None
def setNext(self, node):
self.next = node
def setPrev(self, node):
self.prev = node
def getNum(self):
return self.num
def getNext(self):
return self.next
def getPrev(self):
return self.prev
class DoublyLinkedList:
def __init__(self):
self.first = None
self.last = None
def insert(self, x):
node = DoublyLinkedListNode(x)
if self.first == None:
self.first = node
self.last = node
return
self.first.setPrev(node)
node.setNext(self.first)
self.first = node
def delete(self, x):
node = self.first
while node != None:
if node.getNum() == x:
if id(node) == id(self.first):
self.deleteFirst()
break
if id(node) == id(self.last):
self.deleteLast()
break
pnode = node.getPrev()
nnode = node.getNext()
if pnode != None:
pnode.setNext(nnode)
if nnode != None:
nnode.setPrev(pnode)
break
node = node.getNext()
def deleteFirst(self):
node = self.first.getNext()
node.setPrev(None)
self.first = node
def deleteLast(self):
node = self.last.getPrev()
node.setNext(None)
self.last = node
def __iter__(self):
self._it = self.first
return self
def __next__(self):
node = self._it
if node == None:
raise StopIteration
self._it = self._it.getNext()
return node.getNum()
def main():
n = int(input())
lst = DoublyLinkedList()
for _ in range(n):
cmds = input().split()
if 'insert' == cmds[0]:
lst.insert(int(cmds[1]))
if 'delete' == cmds[0]:
lst.delete(int(cmds[1]))
if 'deleteFirst' == cmds[0]:
lst.deleteFirst()
if 'deleteLast' == cmds[0]:
lst.deleteLast()
print(" ".join([str(x) for x in lst]))
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpitcp6m4u/tmp4ua1ckcv.py", line 107, in <module>
main()
File "/tmp/tmpitcp6m4u/tmp4ua1ckcv.py", line 88, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s433553240 | p02265 | u308033440 | 1535084713 | Python | Python3 | py | Runtime Error | 0 | 0 | 658 | from collections import deque
# 命令数入力
n = int(input())
# 命令入力
order_list = [input().split() for i in range(n)]
# 双方向連結リスト
doubly_linked_list = deque()
for _ in range(n):
#order = input().split()
if order[0] == "insert":
doubly_linked_list.appendleft(order[1])
elif order[0] == "delete":
if order[1] in doubly_linked_list:
doubly_linked_list.remove(order[1])
elif order[0] =="deleteFirst":
doubly_linked_list.popleft()
elif order[0] == "deleteLast":
doubly_linked_list.pop()
# 最終結果出力
print(*doubly_linked_list)
| Traceback (most recent call last):
File "/tmp/tmpjfstzrvp/tmp5zz3layk.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s431065712 | p02265 | u581154076 | 1535100725 | Python | Python3 | py | Runtime Error | 30 | 6004 | 401 | from collections import deque
d = deque()
for _ in range(int(input())):
s = input()
try:
com, val = s.split()
val = int(val)
except ValueError:
com = s
if com == 'insert':
d.appendleft(val)
elif com == 'delete':
d.remove(val)
elif com == 'deleteFirst':
d.popleft()
elif com == 'deleteLast':
d.pop()
print(*d)
| Traceback (most recent call last):
File "/tmp/tmpc8xtoa3f/tmpqbsp1w38.py", line 4, in <module>
for _ in range(int(input())):
^^^^^^^
EOFError: EOF when reading a line
| |
s469796740 | p02265 | u665238221 | 1535608092 | Python | Python3 | py | Runtime Error | 30 | 5996 | 303 | from collections import deque
q = deque()
for _ in range(int(input())):
c, *k = input().split()
k = k[0] if k else None
if c == 'insert':
q.appendleft(k)
elif c == 'delete':
q.remove(k)
elif c == 'deleteFirst':
q.popleft()
else:
q.pop()
print(*q)
| Traceback (most recent call last):
File "/tmp/tmposa4k15e/tmpttpu_flq.py", line 3, in <module>
for _ in range(int(input())):
^^^^^^^
EOFError: EOF when reading a line
| |
s038879995 | p02265 | u665238221 | 1535608633 | Python | Python3 | py | Runtime Error | 0 | 0 | 363 | from collections import deque
q = deque()
for _ in range(int(input())):
c, *k = input().split()
k = k[0] if k else None
if c[0] == 'i':
q.appendleft(k)
elif c[0] == 'd':
if c[6] == 'F':
q.popleft()
elif c[6] == 'L':
q.pop()
else:
if k in q:
q.remove(k)
print(*q)
| Traceback (most recent call last):
File "/tmp/tmp6gwz6__e/tmpsmqhq7rf.py", line 3, in <module>
for _ in range(int(input())):
^^^^^^^
EOFError: EOF when reading a line
| |
s279897943 | p02265 | u665238221 | 1535609048 | Python | Python3 | py | Runtime Error | 0 | 0 | 335 | from collections import deque
from sys import stdin
q = deque()
input()
for s in stdin:
c, *k = s.split()
k = k[0] if k else None
if c[0] == 'i':
q.appendleft(k)
elif c[0] == 'delete':
if k in q:
q.remove(k)
if c == 'deleteFirst':
q.popleft()
else:
q.pop()
print(*q)
| Traceback (most recent call last):
File "/tmp/tmp4prp0f_o/tmpfktpmimv.py", line 4, in <module>
input()
EOFError: EOF when reading a line
| |
s328035170 | p02265 | u356729014 | 1535690686 | Python | Python3 | py | Runtime Error | 0 | 0 | 363 | n = map(int,input())
a = [input(sep=" ")[1]]
for i in range(n):
command = input()
if(command == "deleteFirst"):
a.pop(0)
elif(command == "deleteLast"):
a.pop()
else:
command,num = command.split(sep = " ")
num = int(num)
if(command == "delete"):
a.remove(n)
else:
a.append(n)
| Traceback (most recent call last):
File "/tmp/tmpe_c_dxh6/tmpw_4dm1mo.py", line 1, in <module>
n = map(int,input())
^^^^^^^
EOFError: EOF when reading a line
| |
s631595738 | p02265 | u356729014 | 1535691022 | Python | Python3 | py | Runtime Error | 0 | 0 | 421 | n = map(int,input())
a = [int(input().split(sep=" ")[1])]
for i in range(n):
command = input()
if(command == "deleteFirst"):
a.pop(0)
elif(command == "deleteLast"):
a.pop()
else:
command,num = command.split(sep = " ")
num = int(num)
if(command == "delete"):
a.remove(n)
else:
a.append(n)
for num in a:
print(num,end=" ")
print()
| Traceback (most recent call last):
File "/tmp/tmp0c706t_k/tmpyxf43wfn.py", line 1, in <module>
n = map(int,input())
^^^^^^^
EOFError: EOF when reading a line
| |
s269004143 | p02265 | u356729014 | 1535691099 | Python | Python3 | py | Runtime Error | 0 | 0 | 425 | n = map(int,input())
a = [int(input().split(sep=" ")[1])]
for i in range(n - 1):
command = input()
if(command == "deleteFirst"):
a.pop(0)
elif(command == "deleteLast"):
a.pop()
else:
command,num = command.split(sep = " ")
num = int(num)
if(command == "delete"):
a.remove(n)
else:
a.append(n)
for num in a:
print(num,end=" ")
print()
| Traceback (most recent call last):
File "/tmp/tmpw0szc069/tmpudh_7k_l.py", line 1, in <module>
n = map(int,input())
^^^^^^^
EOFError: EOF when reading a line
| |
s264750208 | p02265 | u356729014 | 1535692336 | Python | Python3 | py | Runtime Error | 20 | 5592 | 463 | n = int(input())
a = [int(input().split(sep=" ")[1])]
for i in range(n - 1):
command = input()
if(command == "deleteFirst"):
a.pop(0)
elif(command == "deleteLast"):
a.pop()
else:
command,num = command.split(sep = " ")
num = int(num)
if(command == "delete"):
a.remove(num)
else:
a.append(num)
print(a[0],end = "")
for num in a[1:]:
print(" ",num,sep = "",end="")
print()
| Traceback (most recent call last):
File "/tmp/tmpzy29lser/tmpnjb_aki2.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s085204653 | p02265 | u554503378 | 1541050358 | Python | Python3 | py | Runtime Error | 20 | 5608 | 425 | n = int(input())
num_list = []
for _ in range(n):
cmd = (input().split())
if cmd[0] == 'insert':
num_list.insert(0,int(cmd[1]))
elif cmd[0] == 'delete':
idx = num_list.index(int(cmd[1]))
del(num_list[idx])
elif cmd[0] == 'deleteFirst':
del(num_list[0])
elif cmd[0] == 'deleteLast':
num_list.pop()
ans_list = [str(i) for i in num_list]
print(' '.join(ans_list))
| Traceback (most recent call last):
File "/tmp/tmp9wc8w5do/tmpbjkw5tku.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s402519078 | p02265 | u554503378 | 1541051254 | Python | Python3 | py | Runtime Error | 0 | 0 | 357 | n = int(input())
num_list = []
for _ in range(n):
cmd = (input().split())
if cmd[0] == 'insert':
num_list.insert(0,cmd[1])
elif cmd[0] == 'delete':
if cmd[1] in num_list:
num_list.remove(cmd[0])
elif cmd[0] == 'deleteFirst':
del(num_list[0])
else:
num_list.pop()
print(' '.join(num_list))
| Traceback (most recent call last):
File "/tmp/tmp0_9lqj18/tmpkvwk79p9.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s340000591 | p02265 | u356729014 | 1545367294 | Python | Python3 | py | Runtime Error | 0 | 0 | 2522 |
from sys import stdin
import sys
class node:
def __init__(self,num,pre = None,nextnode = None):
self.num = num
self.prenode = pre
self.nextnode = nextnode
class doubly_linked_list:
import sys
begin_node = None
end_node = None
def insert(self,num):
if(self.end_node):
self.end_node.nextnode = node(num,pre = self.end_node)
self.end_node = self.end_node.nextnode
else:
self.begin_node = self.end_node = node(num)
def deleteFirst(self):
if self.begin_node is self.end_node:
self.begin_node = self.end_node = None
else:
self.begin_node = self.begin_node.nextnode
self.begin_node.prenode = None
def deleteLast(self):
if self.begin_node is self.end_node:
self.begin_node = self.end_node = None
else:
self.end_node = self.end_node.prenode
self.end_node.nextnode = None
def delete_num(self, target):
it = self.begin_node
while it is not None:
if it.num == target:
if it.prenode is None and it.nextnode is None:
self.begin_node = self.end_node = None
else:
if it.prenode is not None:
it.prenode.nextnode = it.nextnode
else:
self.begin_node = self.begin_node.nextnode
if it.nextnode is not None:
it.nextnode.prenode = it.prenode
else:
self.end_node = self.end_node.prenode
break
it = it.nextnode
def print_all(self):
current_node = self.begin_node
while(current_node is not self.end_node):
print(current_node.num,end = " ",flush = True)
current_node = current_node.nextnode
print(self.end_node.num,flush = True)
sys.stdout.flush()
n = int(input())
dll = doubly_linked_list()
dll.insert(stdin.readline().strip().split()[1])
for i in range(n - 1):
command = stdin.readline().strip()
if(command == "deleteFirst"):
dll.deleteFirst()
elif(command == "deleteLast"):
dll.deleteLast()
else:
command,num = command.split(sep = " ")
#num = int(num)
if(command == "delete"):
dll.delete(num)
else:
dll.insert(num)
dll.print_all()
| Traceback (most recent call last):
File "/tmp/tmpvu4epbps/tmpb6u5rb62.py", line 62, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s827312878 | p02265 | u803657704 | 1545889173 | Python | Python3 | py | Runtime Error | 0 | 0 | 2372 | import sys
import time
class NodeList:
class Node:
def __init__(self, left, x, right):
self.key = x
self.right = right
self.left = left
def __repr__(self):
return str(self.key)
def printDetail(self):
print(str(self.left) + ' ' + str(self) + ' ' + str(self.right))
def __init__(self):
self.head = NodeList.Node(None,None,None)
self.head.right = self.head
self.head.left = self.head
def insert(self, x):
newNode = NodeList.Node(None, x, None)
newNode.right = self.head.right
newNode.right.left = newNode
self.head.right = newNode
newNode.left = self.head
def print(self):
point = self.head.right
start = self.head.right
flag = False
while point != self.head:
sys.stdout.write(str(point))
if point.right:
point = point.right
if flag and point == start:
break
if point != self.head:
sys.stdout.write(' ')
flag = True
sys.stdout.write('\n')
def printAll(self):
print(self.head)
point = self.head.right
while point != self.head:
point.printDetail()
point = point.right
sys.stdout.write('\n')
def delete(self,point):
point.right.left = point.left
point.left.right = point.right
def searchDelete(self, x):
point = self.head.right
while point != self.head:
if point.key == x:
break
point = point.right
self.delete(point)
def deleteFirst(self):
self.delete(self.head.right)
def deleteLast(self):
point = self.head
while point.right != self.head:
point = point.right
#print(point.key)
#time.sleep(3)
self.delete(point)
from sys import stdin
node = NodeList()
n = int(input())
for i in range(n):
#print(i)
query = stdin.readline().split()
if query[0][0] == 'i':
node.insert(int(query[1]))
elif query[0][0] == 'd':
node.searchDelete(int(query[1]))
elif query[0][6] == 'F':
node.deleteFirst()
elif query[0][6] == 'L':
node.deleteLast()
node.print()
| Traceback (most recent call last):
File "/tmp/tmpq0z00hk5/tmpphslf4zf.py", line 79, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s056466203 | p02265 | u803657704 | 1545889390 | Python | Python3 | py | Runtime Error | 0 | 0 | 2367 | import sys
import time
class NodeList:
class Node:
def __init__(self, left, x, right):
self.key = x
self.right = right
self.left = left
def __repr__(self):
return str(self.key)
def printDetail(self):
print(str(self.left) + ' ' + str(self) + ' ' + str(self.right))
def __init__(self):
self.head = NodeList.Node(None,None,None)
self.head.right = self.head
self.head.left = self.head
def insert(self, x):
newNode = NodeList.Node(None, x, None)
newNode.right = self.head.right
newNode.right.left = newNode
self.head.right = newNode
newNode.left = self.head
def print(self):
point = self.head.right
start = self.head.right
flag = False
while point != self.head:
sys.stdout.write(str(point))
if point.right:
point = point.right
if flag and point == start:
break
if point != self.head:
sys.stdout.write(' ')
flag = True
sys.stdout.write('\n')
def printAll(self):
print(self.head)
point = self.head.right
while point != self.head:
point.printDetail()
point = point.right
sys.stdout.write('\n')
def delete(self,point):
point.right.left = point.left
point.left.right = point.right
def searchDelete(self, x):
point = self.head.right
while point != self.head:
if point.key == x:
break
point = point.right
self.delete(point)
def deleteFirst(self):
self.delete(self.head.right)
def deleteLast(self):
point = self.head
while point.right != self.head:
point = point.right
#print(point.key)
#time.sleep(3)
self.delete(point)
from sys import stdin
node = NodeList()
n = int(input())
for i in range(n):
#print(i)
query = stdin.readline().split()
c = list(query[0])
if c[0] == 'i':
node.insert(int(query[1]))
elif c[0] == 'd':
node.searchDelete(int(query[1]))
elif c[6] == 'F':
node.deleteFirst()
elif c[6] == 'L':
node.deleteLast()
node.print()
| Traceback (most recent call last):
File "/tmp/tmpepw3jffd/tmps4uoqnpn.py", line 79, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s053085192 | p02265 | u771410206 | 1545962528 | Python | Python3 | py | Runtime Error | 20 | 5608 | 357 | n = int(input())
A = [list(map(str,input().split())) for _ in range(n)]
B = []
for i in range(n):
if A[i][0] == 'insert':
B.insert(0,int(A[i][1]))
elif A[i][0] == 'delete':
B.remove(int(A[i][1]))
elif A[i][0] == 'deleteFirst':
del B[0]
elif A[i][0] == 'deleteLast':
del B[-1]
print(' '.join(map(str,B)))
| Traceback (most recent call last):
File "/tmp/tmpm_ygn4ff/tmphtya_g77.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s595672897 | p02265 | u065504661 | 1546168859 | Python | Python3 | py | Runtime Error | 0 | 0 | 1267 | class Node:
def __init__(self, key):
self._key = key
self._prev = None
self._next = None
def list_search(head, key):
cur = head._next
while cur._key != None and cur._key != key:
cur = cur._next
return cur
def initiation():
head = Node(None)
head._prev = head
head._next = head
return head
def delete_node(node):
if node._key == None:
return
node._prev._next = node._next
node._next._prev = node._prev
node._prev = node._next = node._key = None
def deleteFirst(head):
delete_node(head._next)
def deleteLast(head):
delete_node(head._prev)
def delete(head, key):
delete_node(list_search(head, key))
def insert(head, x):
node = Node(x)
node._next = head._next
head._next._prev = node
node._prev = head
head._next = node
if __name__ == "__main__":
num_command = int(input())
head = initiation()
for i in range(num_command):
command = input().split()
order = command[0]
if order == 'insert':
value = command[1]
insert(head, value)
elif order == 'delete':
value = command[1]
delete(head, value)
elif order == 'deleteFirst':
deleteFirst(head)
else:
deleteLast(head)
cur = head._next
while cur._next._key != None
print(str(cur._key), end = ' ')
cur = cur._next
print(str(cur._key))
| File "/tmp/tmplehflpe1/tmp7ghuahl6.py", line 61
while cur._next._key != None
^
SyntaxError: expected ':'
| |
s418798158 | p02265 | u065504661 | 1546168867 | Python | Python3 | py | Runtime Error | 0 | 0 | 1267 | class Node:
def __init__(self, key):
self._key = key
self._prev = None
self._next = None
def list_search(head, key):
cur = head._next
while cur._key != None and cur._key != key:
cur = cur._next
return cur
def initiation():
head = Node(None)
head._prev = head
head._next = head
return head
def delete_node(node):
if node._key == None:
return
node._prev._next = node._next
node._next._prev = node._prev
node._prev = node._next = node._key = None
def deleteFirst(head):
delete_node(head._next)
def deleteLast(head):
delete_node(head._prev)
def delete(head, key):
delete_node(list_search(head, key))
def insert(head, x):
node = Node(x)
node._next = head._next
head._next._prev = node
node._prev = head
head._next = node
if __name__ == "__main__":
num_command = int(input())
head = initiation()
for i in range(num_command):
command = input().split()
order = command[0]
if order == 'insert':
value = command[1]
insert(head, value)
elif order == 'delete':
value = command[1]
delete(head, value)
elif order == 'deleteFirst':
deleteFirst(head)
else:
deleteLast(head)
cur = head._next
while cur._next._key != None
print(str(cur._key), end = ' ')
cur = cur._next
print(str(cur._key))
| File "/tmp/tmp2cnpkq55/tmp83al_ejh.py", line 61
while cur._next._key != None
^
SyntaxError: expected ':'
| |
s303954609 | p02265 | u874395007 | 1546434993 | Python | Python3 | py | Runtime Error | 20 | 6012 | 661 | from collections import deque
n = int(input())
d = deque()
for _i in range(n):
line = input().split()
order = line[0]
if order in ('insert', 'delete'):
key = int(line[1])
if order == 'insert':
d.appendleft(key)
elif order == 'delete':
d.remove(key)
elif order == 'deleteFirst':
d.popleft()
elif order == 'deleteLast':
d.pop()
else:
raise ValueError('Invalid order: {order}')
i = 0
while True:
try:
if i == 0:
print(d.popleft(), end='')
else:
print(f' {d.popleft()}', end='')
i += 1
except IndexError:
break
print()
| Traceback (most recent call last):
File "/tmp/tmpyt7l_4qh/tmp2a2nak_u.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s515533582 | p02265 | u809233245 | 1546475965 | Python | Python3 | py | Runtime Error | 20 | 5608 | 376 | n = int(input())
cmds = [input().split(' ') for _ in range(n)]
dl_list = []
for cmd in cmds:
if cmd[0] == 'insert':
dl_list.insert(0, int(cmd[1]))
elif cmd[0] == 'delete':
dl_list.remove(int(cmd[1]))
elif cmd[0] == 'deleteFirst':
del dl_list[0]
elif cmd[0] == 'deleteLast':
del dl_list[-1]
print(' '.join(map(str, dl_list)))
| Traceback (most recent call last):
File "/tmp/tmpgj85xi2w/tmpqq603hge.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s753925998 | p02265 | u452220492 | 1551524744 | Python | Python3 | py | Runtime Error | 0 | 0 | 169 | n = int(input())
l = []
for i in range(n):
c, d = input().split()
if c[0] == 'i':
l.append(d)
else:
l.remove(d)
print(" ".join(sorted(l)))
| Traceback (most recent call last):
File "/tmp/tmp7bqclyyk/tmpm3nprcln.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s736819209 | p02265 | u452220492 | 1551525149 | Python | Python3 | py | Runtime Error | 20 | 5592 | 314 | n = int(input())
l = []
for i in range(n):
s = input()
if s == "deleteFirst":
l.pop(0)
continue
if s == "deleteLast":
l.pop()
continue
c, d = s.split()
if c == 'insert':
l.append(d)
elif c == "delete":
l.remove(d)
print(" ".join(l[::-1]))
| Traceback (most recent call last):
File "/tmp/tmpb4ni011i/tmprcdhainx.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s185052488 | p02265 | u452220492 | 1551533130 | Python | Python3 | py | Runtime Error | 20 | 5604 | 1178 | class Node:
def __init__(self, d, next):
self.d = d
self.next = next
def __str__(self):
if self.next is None:
return "(" + self.d + ")"
else:
return "(" + self.d + "," + str(self.next) + ")"
# import time
n = int(input())
node = None
for i in range(n):
# time.sleep(0.1)
s = input()
# print(s)
if s == "deleteFirst":
node = node.next
elif s == "deleteLast":
if node.next is None:
node = None
n = node
while n.next.next is not None:
n = n.next
n.next = None
else:
c, d = s.split()
if c == 'insert':
n = Node(d, node)
n.next = node
node = n
elif c == "delete":
n = node
if n.d == d:
node = n.next
else:
while n.next is not None:
if n.next.d == d:
n.next = n.next.next
break
n = n.next
# print(node)
while node.next is not None:
d = node.d
print(d, "", end="")
node = node.next
print(node.d)
| Traceback (most recent call last):
File "/tmp/tmpi4kqf8v_/tmprus2d7u7.py", line 14, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s589604356 | p02265 | u799595944 | 1556788050 | Python | Python3 | py | Runtime Error | 0 | 0 | 2117 | class Node():
def __init__(self,value,prv,nxt):
self.value = value
self.prv = prv
self.nxt = nxt
class LinkedList():
def __init__(self,head,tail):
self.head = head
self.tail = tail
def insert(self,value):
if self.head == None:
self.head = Node(value,None,None)
self.tail = self.head
else:
node = Node(value,None,self.head)
if self.head.nxt == self.tail: #when only one node exists.
self.head.prv = node
self.head = node
else:
self.head.prv = node
self.head = node
def delete(self,value):
check_node = self.head
while True:
if check_node.value == value:
if check_node.nxt == None:
self.deleteLast()
else:
check_node.prv.nxt = check_node.nxt
check_node.nxt.prv = check_node.prv
break
else:
check_node = check_node.nxt
def deleteFirst(self):
if self.head.nex == None:
self.head == None
else:
self.head = self.head.nxt
def deleteLast(self):
self.tail.prv.nxt = None
self.tail = self.tail.prv
n = int(input())
linkedList = LinkedList(None,None)
def getAnswer(linkedList):
answer = []
check = linkedList.head
while True:
answer.append(check.value)
if check.nxt == None:
break
else:
check = check.nxt
print(" ".join(map(str,answer)))
for _ in range(n):
line = input()
if not (line == "deleteFirst" and line == "deleteLast"):
command = line.split(" ")[0]
value = int(line.split(" ")[1])
else:
command = line
if command == "insert":
linkedList.insert(value)
elif command == "delete":
linkedList.delete(value)
elif command == "deleteFirst":
linkedList.deleteFirst()
elif command == "deleteLast":
linkedList.deleteLast()
getAnswer(linkedList)
| Traceback (most recent call last):
File "/tmp/tmpg852w_z3/tmpalb6tvdn.py", line 49, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s564722441 | p02265 | u799595944 | 1556788613 | Python | Python3 | py | Runtime Error | 30 | 5608 | 2304 | class Node():
def __init__(self,value,prv,nxt):
self.value = value
self.prv = prv
self.nxt = nxt
class LinkedList():
def __init__(self,head,tail):
self.head = head
self.tail = tail
def insert(self,value):
if self.head == None:
self.head = Node(value,None,None)
self.tail = self.head
else:
node = Node(value,None,self.head)
if self.head.nxt == self.tail: #when only one node exists.
self.head.prv = node
self.head = node
else:
self.head.prv = node
self.head = node
def delete(self,value):
check_node = self.head
while True:
if check_node.value == value:
if check_node == self.tail:
self.deleteLast()
elif check_node == self.head:
self.head = check_node.nxt
check_node.nxt.prv = None
else:
check_node.prv.nxt = check_node.nxt
check_node.nxt.prv = check_node.prv
break
else:
check_node = check_node.nxt
def deleteFirst(self):
if self.head.nxt == None:
self.head == None
else:
self.head = self.head.nxt
def deleteLast(self):
self.tail.prv.nxt = None
self.tail = self.tail.prv
n = int(input())
linkedList = LinkedList(None,None)
def getAnswer(linkedList):
answer = []
check = linkedList.head
while True:
answer.append(check.value)
if check.nxt == None:
break
else:
check = check.nxt
print(" ".join(map(str,answer)))
for _ in range(n):
line = input()
#print(line)
if not line == "deleteFirst" and not line == "deleteLast":
command = line.split(" ")[0]
value = int(line.split(" ")[1])
else:
command = line
if command == "insert":
linkedList.insert(value)
elif command == "delete":
linkedList.delete(value)
elif command == "deleteFirst":
linkedList.deleteFirst()
elif command == "deleteLast":
linkedList.deleteLast()
#getAnswer(linkedList)
getAnswer(linkedList)
| Traceback (most recent call last):
File "/tmp/tmp7g80_ich/tmpns8yl_lh.py", line 52, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s808862834 | p02265 | u336705996 | 1559022641 | Python | Python3 | py | Runtime Error | 0 | 0 | 287 | n = int(input())
a = [input() for _ in range(n)]
queue = []
for command in a:
if 'insert 'in command:
queue.append(command.replace('insert ', ''))
elif 'delete 'in command:
queue.remove(command.replace('delete ', ''))
print(' '.join(map(str, reversed(queue)))
| File "/tmp/tmp7wxratml/tmplv3lmh46.py", line 11
print(' '.join(map(str, reversed(queue)))
^
SyntaxError: '(' was never closed
| |
s482127124 | p02265 | u336705996 | 1559181547 | Python | Python3 | py | Runtime Error | 30 | 6000 | 436 | from collections import deque
n = int(input())
a = [input() for _ in range(n)]
queue = deque()
for command in a:
if 'insert 'in command:
queue.append(command.replace('insert ', ''))
elif 'delete 'in command:
queue.remove(command.replace('delete ', ''))
elif 'deleteFirst' in command:
queue.popleft()
elif 'deleteLast' in command:
queue.pop()
print(' '.join(map(str, reversed(queue))))
| Traceback (most recent call last):
File "/tmp/tmp43v99vqw/tmpgb5pbej7.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s262932945 | p02265 | u822165491 | 1559291655 | Python | Python3 | py | Runtime Error | 0 | 0 | 3055 | class Node:
def __init__(self, key, prev, next):
self.key = key
self.prev = prev
self.next = next
class MyDLL:
def __init__(self):
self.linkedlist = []
self.length = 0
def isEmpty(self):
if self.length==0:
return True
return False
def insert(self, x):
# 連結リストの先頭にキー x を持つ要素を継ぎ足す。
if self.isEmpty():
# 連結リストが空の時
new = Node(x, None, None)
self.linkedlist.insert(0, new)
else:
# 連結リストが空ではない時
old = self.linkedlist[0] # 今まで先頭にいたノード
new = Node(x, None, old) # 新しく先頭になるノード
old.prev = new # 今まで先頭にいたノードの前に新しいノードを登録
self.linkedlist.insert(0, new)
self.length += 1 # 連結リストの長さを更新
def delete(self, x):
# キー x を持つ最初の要素を連結リストから削除する。そのような要素が存在しない場合は何もしない。
for node in self.linkedlist:
if node.key==x:# キー x を持つ最初の要素
if node.prev is None:# 先頭だった時
node.next.prev = None # 次の要素の前の要素をNoneにする
elif node.next is None:# 最後尾だった時
node.prev.next = None
else:# 途中だった時
prev_node = node.prev
next_node = node.next
prev_node.next = next_node
next_node.prev = prev_node
self.linkedlist.remove(node)# listから削除
break # キーxを持つ最初だけで良いのでbreak
def deleteFirst(self):
# リストの先頭の要素を削除する。
if not self.isEmpty():
first = self.linkedlist.pop(1)
if self.length>1:
first.next.prev = None
else:
print("List is empty")
def deleteLast(self):
# リストの末尾の要素を削除する。
if not self.isEmpty():
last = self.linkedlist.pop()
if self.length>1:
last.prev.next = None
else:
print("List is empty")
def main():
n = int(input())
commands = [input().split() for i in range(n)]
commands = [{'order': order, 'value': int(value)} for order, value in commands]
dll = MyDLL()
for c in commands:
if c['order']=='insert':
dll.insert(c['value'])
elif c['order']=='delete':
dll.delete(c['value'])
elif c['order']=='deleteFirst':
dll.deleteFirst()
elif c['order']=='deleteLast':
dll.deleteLast()
print(' '.join([str(node.key) for node in dll.linkedlist]))
main()
| Traceback (most recent call last):
File "/tmp/tmpmipavcha/tmpc4ur4bcf.py", line 84, in <module>
main()
File "/tmp/tmpmipavcha/tmpc4ur4bcf.py", line 69, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s369664889 | p02265 | u822165491 | 1559374424 | Python | Python3 | py | Runtime Error | 0 | 0 | 3769 | class Node:
def __init__(self, key, prev, next):
self.key = key
self.prev = prev
self.next = next
class MyDLL:
def __init__(self):
self.linkedlist = []
self.length = 0
def isEmpty(self):
if self.length==0:
return True
return False
def insert(self, x):
# 連結リストの先頭にキー x を持つ要素を継ぎ足す。
if self.isEmpty():
# 連結リストが空の時
new = Node(x, None, None)
else:
# 連結リストが空ではない時
old = self.linkedlist[0] # 今まで先頭にいたノード
new = Node(x, None, old) # 新しく先頭になるノード
old.prev = new # 今まで先頭にいたノードの前に新しいノードを登録
self.linkedlist.insert(0, new)
self.length += 1 # 連結リストの長さを更新
def delete(self, x):
# キー x を持つ最初の要素を連結リストから削除する。そのような要素が存在しない場合は何もしない。
for node in self.linkedlist:
if node.key==x:# キー x を持つ最初の要素
if node.prev is None:# 先頭だった時
node.next.prev = None # 次の要素の前の要素をNoneにする
elif node.next is None:# 最後尾だった時
node.prev.next = None
else:# 途中だった時
prev_node = node.prev
next_node = node.next
prev_node.next = next_node
next_node.prev = prev_node
self.linkedlist.remove(node)# listから削除
self.length -= 1
break # キーxを持つ最初だけで良いのでbreak
def deleteFirst(self):
# リストの先頭の要素を削除する。
if not self.isEmpty():
first = self.linkedlist.pop(0)
if self.length>1:
first.next.prev = None
self.length -= 1
else:
print("List is empty")
def deleteLast(self):
# リストの末尾の要素を削除する。
if not self.isEmpty():
last = self.linkedlist.pop()
if self.length>1:
last.prev.next = None
self.length -= 1
else:
print("List is empty")
def print(self):
if not self.isEmpty():
print(' '.join([node.key for node in self.linkedlist]))
else:
print('')
def main():
input()
n = 1786329# int(input())
commands = (input() for i in range(n)) # generator式リスト内包表記
# commands = ({'order': c[0], 'value': c[1]} if len(c)==2 else {'order': c[0]} for c in commands)
dll = MyDLL()
# for c in commands:
# if c['order']=='insert':
# dll.insert(c['value'])
# elif c['order']=='delete':
# dll.delete(c['value'])
# elif c['order']=='deleteFirst':
# dll.deleteFirst()
# elif c['order']=='deleteLast':
# dll.deleteLast()
# else:
# print("the command dont't exist")
# print(c)
for c in commands:
if 'insert' in c:
dll.insert(c.split()[1])
elif 'deleteFirst' in c:
dll.deleteFirst()
elif 'deleteLast' in c:
dll.deleteLast()
elif 'delete' in c:
dll.delete(c.split()[1])
else:
print("the command dont't exist")
print(c)
dll.print()
if __name__=='__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpje05bafp/tmpt2lntmth.py", line 108, in <module>
main()
File "/tmp/tmpje05bafp/tmpt2lntmth.py", line 75, in main
input()
EOFError: EOF when reading a line
| |
s716776693 | p02265 | u566160059 | 1559403152 | Python | Python3 | py | Runtime Error | 0 | 0 | 335 | n = int(input())
commands = [input().split() for _ in range(n)]
l = []
for com in commands:
val = com[1]
com = com[0]
if com=='insert':
l.insert(0, val)
elif com=='delete':
l.remove(val)
elif com=='deleteFirst':
l.pop(0)
elif com=='deleteLast':
l.pop()
s = ' '.join(l)
print(s)
| Traceback (most recent call last):
File "/tmp/tmpce77s_7s/tmp_rvxqwy_.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s811314578 | p02265 | u566160059 | 1559403546 | Python | Python3 | py | Runtime Error | 20 | 5604 | 319 | n = int(input())
commands = [input().split() for _ in range(n)]
l = []
for com in commands:
if com[0]=='insert':
l.insert(0, com[1])
elif com[0]=='delete':
l.remove(com[1])
elif com[0]=='deleteFirst':
l.pop(0)
elif com[0]=='deleteLast':
l.pop()
s = ' '.join(l)
print(s)
| Traceback (most recent call last):
File "/tmp/tmpr09_u2my/tmphagfts_e.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s241512951 | p02265 | u566160059 | 1559403826 | Python | Python3 | py | Runtime Error | 0 | 0 | 349 | n = int(input())
commands = [input().split() for _ in range(n)]
l = []
for com in commands:
print(l)
if com[0]=='insert':
l.insert(0, com[1])
elif com[0]=='delete':
try:
l.remove(com[1])
elif com[0]=='deleteFirst':
l.pop(0)
elif com[0]=='deleteLast':
l.pop()
s = ' '.join(l)
print(s)
| File "/tmp/tmp9tv6jqaj/tmp6f0swvvc.py", line 12
elif com[0]=='deleteFirst':
SyntaxError: expected 'except' or 'finally' block
| |
s081013215 | p02265 | u566160059 | 1559404745 | Python | Python3 | py | Runtime Error | 0 | 0 | 407 | from collections import deque
n = int(input())
commands = [input().split() for _ in range(n)]
l = deque([])
for com in commands:
if com[0]=='insert':
l.insert(0, com[1])
elif com[0]=='delete':
try:
l.remove(com[1])
except:
pass
elif com[0]=='deleteFirst':
l.pop(0)
elif com[0]=='deleteLast':
l.pop()
s = ' '.join(l)
print(s)
| Traceback (most recent call last):
File "/tmp/tmp7_zid0yt/tmp4fftasx7.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s721013568 | p02265 | u566160059 | 1559407067 | Python | Python3 | py | Runtime Error | 30 | 6004 | 357 | from collections import deque
n = int(input())
commands = [input() for _ in range(n)] # splitとかしてると間に合わない
l = deque()
for com in commands:
if com[0]=='i':
l.appendleft(com[7:])
elif com[6]=='F':
l.popleft()
elif com[6]=='L':
l.pop()
else:
l.remove(com[7:])
s = ' '.join(l)
print(s)
| Traceback (most recent call last):
File "/tmp/tmpeaqbeeis/tmpx2fmoix0.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s001622452 | p02265 | u566160059 | 1559407102 | Python | Python3 | py | Runtime Error | 30 | 6008 | 357 | from collections import deque
n = int(input())
commands = [input() for _ in range(n)] # splitとかしてると間に合わない
l = deque()
for com in commands:
if com[0]=='i':
l.appendleft(com[7:])
elif com[6]=='F':
l.popleft()
elif com[6]=='L':
l.pop()
else:
l.remove(com[7:])
s = ' '.join(l)
print(s)
| Traceback (most recent call last):
File "/tmp/tmpxb8_3bb0/tmp3se9zci8.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s767513042 | p02265 | u822165491 | 1559449034 | Python | Python3 | py | Runtime Error | 0 | 0 | 2537 | class Node:
def __init__(self, key):
self.key = key
self.prev = None
self.next = None
class MyDLL:
def __init__(self):
# 番兵:仮想的な先頭
self.sentinel = Node(None)
self.sentinel.prev = self.sentinel
self.sentinel.next = self.sentinel
def insert(self, x):
# 連結リストの先頭にキー x を持つ要素を継ぎ足す。
new = Node(x)
new.next = self.sentinel.next # 新しく先頭.next = 番兵.next = 今まで先頭
self.sentinel.next.prev = new # 番兵.next.prev = 今まで先頭.prev = 新しく先頭
self.sentinel.next = new # 番兵.next = 新しく先頭
new.prev = self.sentinel # 新しく先頭.prev = 番兵
def listSearch(self, x):
cursor = self.sentinel.next # 番兵の次の要素から巡る
while (cursor != self.sentinel) & (cursor.key != x):
cursor = cursor.next
return cursor
def deleteNode(self, node):
# あるノードを削除するとき
# 例 A - B - C でBを削除
if node!=self.sentinel: # Bは番兵ではないことを確認
node.prev.next = node.next # B.prev.next = A.next = B.next = C
node.next.prev = node.prev # B.next.prev = C.prev = B.prev = A
def deleteKey(self, x):
self.deleteNode(self.listSearch(x))
def deleteFirst(self):
# リストの先頭の要素を削除する。
self.deleteNode(self.sentinel.next)
def deleteLast(self):
# リストの末尾の要素を削除する。
self.deleteNode(self.sentinel.prev)
def print(self):
cursor = self.sentinel.next
count = 0
while cursor != self.sentinel:
if count==0:
print(cursor.key)
else:
print(' '+ cursor.key)
count +=1
cursor = cursor.next
def main():
input()
n = 1786329# int(input())
# n = int(input())
commands = (input() for i in range(n)) # generator式リスト内包表記
dll = MyDLL()
for c in commands:
if 'insert' in c:
dll.insert(c.split()[1])
elif 'First' in c:
dll.deleteFirst()
elif 'Last' in c:
dll.deleteLast()
elif 'delete' in c:
dll.deleteKey(c.split()[1])
else:
print("the command dont't exist")
print(c)
dll.print()
main()
| Traceback (most recent call last):
File "/tmp/tmpn5leys7s/tmptl5nefyx.py", line 79, in <module>
main()
File "/tmp/tmpn5leys7s/tmptl5nefyx.py", line 60, in main
input()
EOFError: EOF when reading a line
| |
s489061059 | p02265 | u535719732 | 1559567584 | Python | Python3 | py | Runtime Error | 0 | 0 | 382 | from collections import deque
n = int(input())
dList = deque()
for _ in range(n):
op = list(map(str,input().split()))
if(op[0] == "insert"):
dList.appendleft(op[1])
elif(op[0] == "delete"):
try:
dList.remove(op[1])
except:
pass
elif(op[0] == "deleteFirst"):
dList.popleft()
elif(op[0] == "deleteLast") :
dList.pop()
print(*dList[1])
| Traceback (most recent call last):
File "/tmp/tmpztcqrwnw/tmp841po7ln.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s507764972 | p02265 | u135880652 | 1559568964 | Python | Python3 | py | Runtime Error | 0 | 0 | 478 | from collections import deque
n = int(input())
dlist = deque()
for i in range(n):
arr = input().split()
cmd = ''
key = 0
cmd = arr[0]
if len(arr) > 1:
key = arr[1]
if cmd == 'insert':
dlist.appendleft(key)
elif cmd == 'delete':
try:
dlist.remove(key)
except:
#
elif cmd == 'deleteFirst':
dlist.pop()
elif cmd == 'deleteLast':
dlist.popleft()
print(' '.join(dlist))
| File "/tmp/tmp2f6ygprl/tmpxy9tws47.py", line 21
elif cmd == 'deleteFirst':
IndentationError: expected an indented block after 'except' statement on line 19
| |
s990645531 | p02265 | u319740114 | 1559584922 | Python | Python3 | py | Runtime Error | 0 | 0 | 502 | array = []
def func_insert(num):
array.insert(0, num)
def func_delete(num):
array.remove(num)
def func_deleteFirst():
array.pop(0)
def func_deleteLast():
array.pop()
n = int(input())
for _ in range(n):
command, key = input().split()
if command == 'insert':
func_insert(key)
elif command == 'delete':
func_delete(key)
elif command == 'deleteFirst':
func_deleteFirst()
else:
func_deleteLast()
print(' '.join(map(str, array)))
| Traceback (most recent call last):
File "/tmp/tmptcp913le/tmp9dxsz5w0.py", line 15, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s279304965 | p02265 | u319740114 | 1559585169 | Python | Python3 | py | Runtime Error | 20 | 5600 | 519 | array = []
def func_insert(num):
array.insert(0, num)
def func_delete(num):
array.remove(num)
def func_deleteFirst():
array.pop(0)
def func_deleteLast():
array.pop()
n = int(input())
for _ in range(n):
command = input().split()
if command[0] == 'insert':
func_insert(command[1])
elif command[0] == 'delete':
func_delete(command[1])
elif command[0] == 'deleteFirst':
func_deleteFirst()
else:
func_deleteLast()
print(' '.join(map(str, array)))
| Traceback (most recent call last):
File "/tmp/tmp5skl5yvt/tmpme3pb0vy.py", line 15, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s335152730 | p02265 | u507118101 | 1419911209 | Python | Python | py | Runtime Error | 20 | 4220 | 302 | n = input()
array = []
for i in range(n):
inst = raw_input().split()
if inst[0] == "insert":
array.insert(0,inst[1])
if inst[0] == "delete":
array.remove(inst[1])
if inst[0] == "deleteFirst":
del array[0]
if inst[0] == "deleteLast":
del array[len(array)-1]
print " ".join(i for i in array) | File "/tmp/tmpys_95u4b/tmprzuy0f66.py", line 13
print " ".join(i for i in array)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s083232437 | p02265 | u507118101 | 1420127021 | Python | Python | py | Runtime Error | 0 | 0 | 328 | n = input()
array = []
for i in range(n):
inst = raw_input().split()
if inst[0] == "insert":
array.insert(0,inst[1])
if inst[0] == "delete":
if inst[1] in array:
array.remove(inst[1])
if inst[0] == "deleteFirst":
array.pop[0]
if inst[0] == "deleteLast":
array.pop([len(array)-1])
print " ".join(i for i in array) | File "/tmp/tmpmc_tsifj/tmp652runxf.py", line 14
print " ".join(i for i in array)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s145182070 | p02265 | u507118101 | 1420127190 | Python | Python | py | Runtime Error | 0 | 0 | 326 | n = input()
array = []
for i in range(n):
inst = raw_input().split()
if inst[0] == "insert":
array.insert(0,inst[1])
if inst[0] == "delete":
if inst[1] in array:
array.remove(inst[1])
if inst[0] == "deleteFirst":
array.pop[0]
if inst[0] == "deleteLast":
array.pop(len(array)-1)
print " ".join(i for i in array) | File "/tmp/tmpuny3flqr/tmpzjca47zc.py", line 14
print " ".join(i for i in array)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s135674345 | p02265 | u567380442 | 1421368695 | Python | Python3 | py | Runtime Error | 30 | 6728 | 364 | from collections import deque
import sys
dlist = deque()
func = {'insert':dlist.appendleft, 'delete':dlist.remove, 'deleteFirst':dlist.popleft, 'deleteLast':dlist.pop}
n = int(sys.stdin.readline())
for line in sys.stdin:
command = line.split()
if len(command) == 2:
command[1] = int(command[1])
func[command[0]](*command[1:])
print(*dlist) | Traceback (most recent call last):
File "/tmp/tmpyvf8a2ll/tmpitvcu00_.py", line 8, in <module>
n = int(sys.stdin.readline())
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s578387919 | p02265 | u481221703 | 1421636353 | Python | Python | py | Runtime Error | 0 | 0 | 304 | n=int(raw_input())
l = []
for x in xrange(n):
cmd, a = raw_input().split()
cmd = str(cmd)
a = int(a)
if cmd is "insert":
l.insert(0, a)
elif cmd is "delete":
l.pop(a)
elif cmd is "deleteFirst":
l.pop(0)
elif cmd is "deleteLast":
l.pop()
print l | File "/tmp/tmpj0jw0e9v/tmpte3v8cac.py", line 15
print l
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s925941852 | p02265 | u481221703 | 1421636503 | Python | Python | py | Runtime Error | 0 | 0 | 307 | n=int(raw_input())
l = []
for x in xrange(n):
cmd = raw_input().split()
cmd = str(cmd[0])
if cmd is "insert":
l.insert(0, int(cmd[1])
elif cmd is "delete":
l.pop(int(cmd[1])
elif cmd is "deleteFirst":
l.pop(0)
elif cmd is "deleteLast":
l.pop()
print l | File "/tmp/tmpcokofohm/tmpn2qqfgym.py", line 8
elif cmd is "delete":
^^^^
SyntaxError: invalid syntax
| |
s495709897 | p02265 | u481221703 | 1421640152 | Python | Python | py | Runtime Error | 0 | 0 | 327 | n=int(raw_input())
l = []
for x in xrange(n):
msg = raw_input().split()
cmd = str(msg[0])
if cmd == "insert":
l.insert(0, int(msg[1]))
elif cmd == "delete":
l.pop(int(msg[1]))
elif cmd == "deleteFirst":
l.pop(0)
elif cmd == "deleteLast":
l.pop()
for x in l:
print x, | File "/tmp/tmpqda7m57a/tmp_ql5ukr7.py", line 16
print x,
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s201237298 | p02265 | u481221703 | 1421640435 | Python | Python | py | Runtime Error | 20 | 4212 | 320 | n=int(raw_input())
l = []
for x in xrange(n):
msg = raw_input().split()
cmd = msg[0]
if cmd == "insert":
l.insert(0, msg[1])
elif cmd == "delete":
l.remove(msg[1])
elif cmd == "deleteFirst":
l.pop(0)
elif cmd == "deleteLast":
l.pop()
for x in l:
print int(x), | File "/tmp/tmp3yunm9jk/tmpqxzfs2h9.py", line 16
print int(x),
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s226619569 | p02265 | u481221703 | 1421640893 | Python | Python | py | Runtime Error | 20 | 4216 | 315 | n=int(raw_input())
l = []
for x in xrange(n):
msg = raw_input().split()
cmd = msg[0]
if cmd == "insert":
l.insert(0, msg[1])
elif cmd == "delete":
l.remove(msg[1])
elif cmd == "deleteFirst":
l.pop(0)
elif cmd == "deleteLast":
l.pop()
for x in l:
print x, | File "/tmp/tmpy85wnz3e/tmp8s1va16_.py", line 16
print x,
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s168585116 | p02265 | u481221703 | 1421645685 | Python | Python | py | Runtime Error | 0 | 0 | 308 | n=int(raw_input())
l = []
for x in xrange(n):
m = raw_input().split()
cmd = m[0]
if cmd == "insert":
l.insert(0, m[1])
elif cmd == "delete":
if msg[1] in l:
l.remove(m[1])
elif cmd[7] == "F":
l.pop(0)
else:
l.pop()
for x in l:
print x, | File "/tmp/tmp06c0ew6o/tmpdv76mtt_.py", line 17
print x,
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s263511193 | p02265 | u481221703 | 1421645972 | Python | Python | py | Runtime Error | 0 | 0 | 345 | n=int(raw_input())
l = []
for x in xrange(n):
m = raw_input().split()
cmd = m[0][-4]
if c == "s":
l.insert(0, m[1])
elif c == "i":
l.pop(0)
elif c == "L":
l.pop()
else:
try:
l.remove(m[1])
except Exception, e:
pass
print " ".join(l) | File "/tmp/tmpbdzj07_t/tmp9oa8j7ko.py", line 15
except Exception, e:
^^^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized
| |
s296034245 | p02265 | u879226672 | 1426873219 | Python | Python | py | Runtime Error | 10 | 4592 | 388 | from collections import deque
n=int(raw_input())
que = deque()
for i in xrange(n):
o = raw_input()
if o == 'deleteFirst':
del que[0]
elif o == 'deleteLast':
del que[-1]
else:
c,p = o.split()
p = int(p)
if c == 'insert':
que.appendleft(p)
elif c == 'delete':
que.remove(p)
print ' '.join(map(str,que)) | File "/tmp/tmp1zrmtc13/tmponz4xtx9.py", line 17
print ' '.join(map(str,que))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s251929031 | p02265 | u879226672 | 1426873679 | Python | Python | py | Runtime Error | 20 | 4596 | 412 | # -*- coding: utf-8 -*-
from collections import deque
n=int(raw_input())
que = deque()
for i in xrange(n):
o = raw_input()
if o == 'deleteFirst':
del que[0]
elif o == 'deleteLast':
del que[-1]
else:
c,p = o.split()
p = int(p)
if c == 'insert':
que.appendleft(p)
elif c == 'delete':
que.remove(p)
print ' '.join(map(str,que)) | File "/tmp/tmp68ld63hb/tmpdw64u7pz.py", line 18
print ' '.join(map(str,que))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s836072404 | p02265 | u408260374 | 1431623040 | Python | Python3 | py | Runtime Error | 30 | 6732 | 402 | from collections import deque
que = deque()
for i in range(int(input())):
command = input()
if command == 'deleteFirst':
que.popleft()
elif command == 'deleteLast':
que.pop()
else:
c, n = command.split()
if c == 'insert':
que.appendleft(int(n))
elif c == 'delete':
que.remove(int(n))
print(' '.join([str(x) for x in que])) | Traceback (most recent call last):
File "/tmp/tmp__cuvjed/tmpjeoyt8oh.py", line 3, in <module>
for i in range(int(input())):
^^^^^^^
EOFError: EOF when reading a line
| |
s722836916 | p02265 | u689297737 | 1432224208 | Python | Python | py | Runtime Error | 20 | 4344 | 2376 | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_C
# Doubly Linked List
# Result:
import sys
class DoublyLikedList(object):
def __init__(self):
self.head = None
self.tail = None
def __str__(self):
vals = []
pointer = self.head
while pointer != None:
vals.append(str(pointer.val))
pointer = pointer.next
if len(vals) == 0:
return ''
else:
return ' '.join(vals)
def insert(self, x):
itm = ListItem(x)
if self.head == None:
self.head = itm
self.tail = itm
else:
itm.next = self.head
self.head.prev = itm
self.head = itm
def delete(self, x):
pointer = self.head
while pointer != None:
if pointer.val == x:
if pointer == self.head:
self.delete_first()
elif pointer == self.tail:
self.delete_last()
else:
if pointer.prev != None:
pointer.prev.next = pointer.next
if pointer.next != None:
pointer.next.prev = pointer.prev
break
pointer = pointer.next
def delete_first(self):
if self.head == None:
return
if self.head == self.tail:
self.tail = None
self.head = self.head.next
if self.head == None:
return
else:
self.head.prev = None
def delete_last(self):
if self.head == None:
return
if self.head == self.tail:
self.tail = None
self.tail = self.tail.prev
if self.tail == None:
return
else:
self.tail.next = None
class ListItem(object):
def __init__(self, x):
self.val = x
self.prev = None
self.next = None
### main
lst = DoublyLikedList()
n = int(sys.stdin.readline().rstrip())
for e in range(0, n):
strs = sys.stdin.readline().rstrip().split(' ')
if strs[0] == 'insert':
lst.insert(int(strs[1]))
elif strs[0] == 'delete':
lst.delete(int(strs[1]))
elif strs[0] == 'deleteFirst':
lst.delete_first()
elif strs[0] == 'deleteLast':
lst.delete_last()
print lst | File "/tmp/tmp575xm3su/tmp_djtfa44.py", line 91
print lst
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s452319717 | p02265 | u604774382 | 1433155300 | Python | Python | py | Runtime Error | 10 | 4216 | 298 | n = int( raw_input( ) )
eles = []
for i in range( n ):
op = raw_input( ).split( " " )
if "insert" == op[0]:
eles.insert( 0, op[1] )
elif "delete" == op[0]:
eles.remove( op[1] )
elif "deleteFirst" == op[0] :
del eles[0]
elif "deleteLast" == op[0]:
eles.pop( )
print( " ".join( eles ) ) | Traceback (most recent call last):
File "/tmp/tmpquqop6iw/tmp_aui5crg.py", line 1, in <module>
n = int( raw_input( ) )
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s073148789 | p02265 | u604774382 | 1433156909 | Python | Python | py | Runtime Error | 0 | 0 | 332 | n = int( raw_input( ) )
eles = []
for i in range( n ):
op = raw_input( ).split( " " )
if "insert" == op[0]:
eles.insert( 0, op[1] )
elif "delete" == op[0]:
for val in eles:
if op[1] == val:
eles.pop( i )
elif "deleteFirst" == op[0] :
del eles[0]
elif "deleteLast" == op[0]:
eles.pop( )
print( " ".join( eles ) ) | Traceback (most recent call last):
File "/tmp/tmpzyo96bwc/tmpqcdryjcf.py", line 1, in <module>
n = int( raw_input( ) )
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s449762330 | p02265 | u604774382 | 1433160553 | Python | Python | py | Runtime Error | 0 | 0 | 385 | import sys
n = int( raw_input( ) )
eles = []
lines = sys.stdin.readlines()
for line in lines:
op = line.split( " " )
op[1] = op[1].strip( )
if "insert" == op[0]:
eles.insert( 0, op[1] )
elif "delete" == op[0]:
if op[1].rstrip( ) in eles:
eles.remove( op[1] )
elif "deleteFirst" == op[0] :
del eles[0]
elif "deleteLast" == op[0]:
eles.pop( )
print( " ".join( eles ) ) | Traceback (most recent call last):
File "/tmp/tmp85yubbw_/tmpponvfxu5.py", line 3, in <module>
n = int( raw_input( ) )
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s878451648 | p02265 | u604774382 | 1433160647 | Python | Python | py | Runtime Error | 0 | 0 | 359 | import sys
n = int( raw_input( ) )
eles = []
for line in sys.stdin:
op = line.split( " " )
op[1] = op[1].strip( )
if "insert" == op[0]:
eles.insert( 0, op[1] )
elif "delete" == op[0]:
if op[1].rstrip( ) in eles:
eles.remove( op[1] )
elif "deleteFirst" == op[0] :
del eles[0]
elif "deleteLast" == op[0]:
eles.pop( )
print( " ".join( eles ) ) | Traceback (most recent call last):
File "/tmp/tmpdz2qsw0z/tmpp94eywfu.py", line 3, in <module>
n = int( raw_input( ) )
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s069549351 | p02265 | u140201022 | 1433309728 | Python | Python | py | Runtime Error | 0 | 0 | 267 | n=int(raw_input())
while n:
n-=1
s=map(str,raw_input().split())
if s[0][0]=='i':
ans.insert(0,s[1])
elif s[0][-3]=='r':
ans.pop(0)
elif s[0][-3]=='a':
ans.pop(0)
else:
ans.remove(s[1])
for i in ans:
print i, | File "/tmp/tmpvb52qbmg/tmpoucmaf7x.py", line 14
print i,
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s204536467 | p02265 | u140201022 | 1433311073 | Python | Python | py | Runtime Error | 0 | 0 | 347 | ans=[]
n=int(raw_input())
while n:
n-=1
s=map(str,raw_input().split())
if s[0][0]=='i':
ans.insert(0,s[1])
elif s[0][-3]=='r':
ans.pop(0)
elif s[0][-3]=='a':
ans.pop()
else:
for i,j in enumerate(ans):
if j==s[1]:
ans.pop(i)
break
print ' '.join(i) | File "/tmp/tmp9um_kynm/tmp5s_inwol.py", line 17
print ' '.join(i)
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s519409197 | p02265 | u140201022 | 1433349313 | Python | Python | py | Runtime Error | 20 | 4596 | 348 | import sys
import collections
n=int(raw_input())
ans=collections.deque()
while n:
n-=1
s=sys.stdin.readline().rstrip().split(' ')
if s[0][0]=='i':
ans.appendleft(s[1])
elif s[0][-3]=='r':
ans.popleft()
elif s[0][-3]=='a':
ans.pop()
else:
ans.remove(s[1])
sys.stdout.write(' '.join(ans))
print | Traceback (most recent call last):
File "/tmp/tmp2bezm3__/tmps29xkl_r.py", line 3, in <module>
n=int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s849680961 | p02265 | u749752649 | 1434260375 | Python | Python | py | Runtime Error | 20 | 4236 | 710 | class LinkedList():
def __init__(self):
self.linked_list = []
def insert(self,x):
self.linked_list.insert(0,x)
def delete(self,x):
self.linked_list.remove(x)
def deleteFirst(self):
self.linked_list.pop(0)
def deleteLast(self):
self.linked_list.pop(-1)
def get(self):
return ' '.join(self.linked_list)
linkedlist = LinkedList()
for i in range(int(raw_input())):
line = raw_input()
if line.count(' '):
c, x = line.split(' ')
else:
c = line
x = ''
if c == "insert":
linkedlist.insert(x)
elif c == "delete":
linkedlist.delete(x)
elif c == "deleteFirst":
linkedlist.deleteFirst()
else:
linkedlist.deleteLast()
print linkedlist.get() | File "/tmp/tmprhbvnl9a/tmpvdams_zk.py", line 32
print linkedlist.get()
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s677066717 | p02265 | u609407244 | 1436261798 | Python | Python3 | py | Runtime Error | 30 | 6732 | 440 | import collections
n = int(input())
que = collections.deque()
for _ in range(n):
command = input()
if 'insert' in command:
command, num = command.split()
que.appendleft(int(num))
elif 'deleteFirst' in command:
que.popleft()
elif 'deleteLast' in command:
que.pop()
elif 'delete' in command:
command, num = command.split()
que.remove(int(num))
print(' '.join(map(str, que))) | Traceback (most recent call last):
File "/tmp/tmphhykb7o0/tmpa_il_wpb.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s174167682 | p02265 | u609407244 | 1436263121 | Python | Python3 | py | Runtime Error | 0 | 0 | 498 | import sys
import collections
n = int(input())
que = collections.deque()
for _ in range(n):
command = sys.stdin.readline().strip()
if 'i' == command[0]:
command, num = command
que.appendleft(num)
elif 'deleteFirst\n' == command:
que.popleft()
elif 'deleteLast\n' == command:
que.pop()
else:
command, num = command.split()
try:
que.remove(num)
except ValueError:
pass
print(' '.join(map(str, que))) | Traceback (most recent call last):
File "/tmp/tmp_4a74nz7/tmp6tjil6pj.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.