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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s982805954 | p02263 | u573915636 | 1525847872 | Python | Python3 | py | Runtime Error | 0 | 0 | 211 | l=[]
c=0
s=input().split()
for i in s:
if i=="+":
l[c-2]=l[c-2]+l[c-1]
c=c-1
elif i=="-":
l[c-2]=l[c-2]-l[c-1]
c=c-1
elif i=="*":
l[c-2]=l[c-2]*l[c-1]
c=c-1
else:
l[c]=int(i)
c=c+1
printl[0]
|
s573840372 | p02263 | u687567104 | 1526023790 | Python | Python | py | Runtime Error | 0 | 0 | 685 | #include<iostream>
#include<stack>
int main() {
stack<int> S;
for (string s; cin >> s&&s != "$";) {
int a, b;
switch (s[0]) {
case '+':
b = S.top(); S.pop();
a = S.top(); S.pop();
S.push(a + b);
break;
case '-':
b = S.t... |
s446954084 | p02263 | u269391636 | 1526897176 | Python | Python3 | py | Runtime Error | 0 | 0 | 307 | lis = list(map(int,input().split()))
st = []
for i in lis:
if i == "+":
x = st.pop()
y = st.pop()
st.append(x+y)
elif i == "-":
x = st.pop()
y = st.pop()
st.append(y-x)
elif i == "*":
x = st.pop()
y = st.pop()
st.append(x*y)
else:
st.append(i)
print(st[0])
|
s745703567 | p02263 | u810922275 | 1527034611 | Python | Python3 | py | Runtime Error | 0 | 0 | 548 | import numpy as np
A=input().split()
stack=[]
for i in range(len(A)):
n=len(stack)
if A[i]=='*':
y=stack.pop(n-1)
x=stack.pop(n-2)
stack.append(int(x*y))
elif A[i]=='/':
y=stack.pop(n-1)
x=stack.pop(n-2)
stack.append(int(x/y))
elif A[i]=='+':
y=st... |
s216163079 | p02263 | u878596989 | 1527424921 | Python | Python3 | py | Runtime Error | 20 | 5620 | 1013 | def RPN(a,b,c,stk):
if len(stk) == 0:
stk.append(cul(int(a),int(b),c))
else:
if a.isdigit():
if b.isdigit():
stk.append(cul(int(a),int(b),c))
else:
stk = [stk[0],(cul(int(stk[1]),int(a),b))]
else:
stk = [(cul(int(stk[0])... |
s608232325 | p02263 | u242415969 | 1529503196 | Python | Python3 | py | Runtime Error | 0 | 0 | 2031 | def plus(number_list):
return sum([int(num) for num in number_list])
def minus(number_list):
numbers = [int(num) for num in number_list]
return numbers[0] - sum(numbers[1:])
def multiply(number_list):
numbers = [int(num) for num in number_list]
def recrusive(repeat_num, list_):
... |
s225721655 | p02263 | u242415969 | 1529503279 | Python | Python3 | py | Runtime Error | 0 | 0 | 2042 | def plus(number_list):
return sum([int(num) for num in number_list])
def minus(number_list):
numbers = [int(num) for num in number_list]
return numbers[0] - sum(numbers[1:])
def multiply(number_list):
numbers = [int(num) for num in number_list]
def recrusive(repeat_num, list_):
... |
s823333981 | p02263 | u242415969 | 1529503450 | Python | Python3 | py | Runtime Error | 0 | 0 | 1932 | def plus(number_list):
return sum([int(num) for num in number_list])
def minus(number_list):
numbers = [int(num) for num in number_list]
return numbers[0] - sum(numbers[1:])
def multiply(number_list):
numbers = [int(num) for num in number_list]
def recrusive(repeat_num, list_):
... |
s111151179 | p02263 | u242415969 | 1529503534 | Python | Python3 | py | Runtime Error | 0 | 0 | 1916 | def plus(number_list):
return sum([int(num) for num in number_list])
def minus(number_list):
numbers = [int(num) for num in number_list]
return numbers[0] - sum(numbers[1:])
def multiply(number_list):
numbers = [int(num) for num in number_list]
def recrusive(repeat_num, list_):
... |
s131211956 | p02263 | u242415969 | 1529508927 | Python | Python3 | py | Runtime Error | 0 | 0 | 927 | stack = []
store_num = []
store_result = []
for i,c in enumerate(input_list.split()):
def pop_and_stack(list_,num):
list_.pop()
list_.pop()
list_.append(num)
return list_
if c == '+' ... |
s532894442 | p02263 | u242415969 | 1529509268 | Python | Python3 | py | Runtime Error | 0 | 0 | 917 |
stack = []
store_num = []
store_result = []
for i,c in enumerate(input_list.split()):
def pop_and_stack(list_,num):
list_.pop()
list_.pop()
list_.append(num)
return list_
if c == '... |
s034297653 | p02263 | u242415969 | 1529509364 | Python | Python3 | py | Runtime Error | 0 | 0 | 900 | stack = []
store_num = []
store_result = []
for i,c in enumerate(input.split()):
def pop_and_stack(list_,num):
list_.pop()
list_.pop()
list_.append(num)
return list_
if c == '+' :
... |
s124363196 | p02263 | u242415969 | 1529509397 | Python | Python3 | py | Runtime Error | 0 | 0 | 914 | stack = []
store_num = []
store_result = []
for i,c in enumerate(input.split()):
def pop_and_stack(list_,num):
list_.pop()
list_.pop()
list_.append(num)
return list_
if c == '+' :
... |
s862379491 | p02263 | u242415969 | 1529509419 | Python | Python3 | py | Runtime Error | 0 | 0 | 916 | stack = []
store_num = []
store_result = []
for i,c in enumerate(input().split()):
def pop_and_stack(list_,num):
list_.pop()
list_.pop()
list_.append(num)
return list_
if c == '+' :
... |
s640001621 | p02263 | u298224238 | 1529644595 | Python | Python3 | py | Runtime Error | 20 | 5612 | 652 | class Stack:
MAX = 100
def __init__(self):
self.S = [None] * self.__class__.MAX
self.top = 0
def is_empty(self):
return self.top == 0
def is_full(self):
return self.top >= self.__class__.MAX - 1
def push(self, x):
self.top += 1
self.S[self.top] = x... |
s509520940 | p02263 | u298224238 | 1529644888 | Python | Python3 | py | Runtime Error | 0 | 0 | 614 | class Stack:
MAX = 101
def __init__(self):
self.S = [None] * self.__class__.MAX
self.top = 0
def is_empty(self):
return self.top == 0
def is_full(self):
return self.top >= self.__class__.MAX - 1
def push(self, x):
self.top += 1
self.S[self.top] = x... |
s871012953 | p02263 | u298224238 | 1529645066 | Python | Python3 | py | Runtime Error | 0 | 0 | 600 | class Stack:
MAX = 101
def __init__(self):
self.S = [None] * self.__class__.MAX
self.top = 0
def is_empty(self):
return self.top == 0
def is_full(self):
return self.top >= self.__class__.MAX - 1
def push(self, x):
self.top += 1
self.S[self.top] = x... |
s856507458 | p02263 | u298224238 | 1529645093 | Python | Python3 | py | Runtime Error | 0 | 0 | 618 | class Stack:
MAX = 101
def __init__(self):
self.S = [None] * self.__class__.MAX
self.top = 0
def is_empty(self):
return self.top == 0
def is_full(self):
return self.top >= self.__class__.MAX - 1
def push(self, x):
self.top += 1
self.S[self.top] = x... |
s469948889 | p02263 | u292798607 | 1529916124 | Python | Python3 | py | Runtime Error | 0 | 0 | 578 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int top,S[100];
void push(int x){
S[++top] = x;
}
int pop(){
top--;
return S[top+1];
}
int main(){
int a,b;
top = 0;
char s[100];
while( scanf("%s",s) != EOF){
if(s[0] == '+'){
a = pop();
b = pop();
push(a + b);
... |
s777281049 | p02263 | u929141425 | 1529917652 | Python | Python3 | py | Runtime Error | 20 | 5612 | 696 | def ch(x):
if x in ["+", "-", "*"]:
return x
else:
return int(x)
def check(x):
if (type(x[0]) is int) and (type(x[1]) is int) and (type(x[2]) is str):
return True
else:
return False
def calc(x):
if x[2] == "+":
return x[0] + x[1]
elif x[2] == "-":
... |
s310017419 | p02263 | u207394722 | 1530210098 | Python | Python3 | py | Runtime Error | 0 | 0 | 716 | def main():
# データ入力
n, q = input().split()
n = int( n )
q = int( q )
name = []
time = []
for i in range(n):
tmp_n, tmp_t = input().split()
name.append( tmp_n )
time.append( int( tmp_t ) )
# 処理
count = 0
while n > 0:
if time[0] > q:
tim... |
s340488802 | p02264 | u418996726 | 1531207265 | Python | Python3 | py | Runtime Error | 0 | 0 | 297 | import sys
n,q=map(int, input().split())
queue = list(map(lambda x: x.strip().split(),sys.stdin.readlines()))
i = 0
while len(queue) > 0:
if queue[i%len(queue)][1]-=q < 0:
print("{} {}".format(q[i%len(queue)][0], i*q + q + q[i%len(queue)][1]))
q.pop(i%len(queue))
i+=1
|
s284909717 | p02264 | u056253438 | 1535300430 | Python | Python3 | py | Runtime Error | 40 | 6284 | 864 | class a(object):
def __init__(self, buf_size=10000):
self.m = [None for _ in range(buf_size)]
self.ind = 0
self.cur = 0
def enqueue(self, elem):
self.m[self.ind] = elem
self.ind += 1
def dequeue(self):
if self.is_empty(): raise EOFError('this queue is empty'... |
s726555169 | p02264 | u056253438 | 1535300513 | Python | Python3 | py | Runtime Error | 0 | 0 | 864 | class a(object):
def __init__(self, buf_size=10000):
self.m = [None for _ in range(buf_size)]
self.ind = 0
self.cur = 0
def enqueue(self, elem):
self.m[self.ind] = elem
self.ind += 1
def dequeue(self):
if self.is_empty(): raise EOFError('this queue is empty'... |
s775334184 | p02264 | u356729014 | 1535689111 | Python | Python3 | py | Runtime Error | 0 | 0 | 365 | n,q = map(int,input().split())
tmp = [input().split() for i in range(n)]
a = [[name,int(time)] for name,time in tmp]
total_time = 0
count = 0
while(a):
current = a.pop
if(current[1] > q):
current[1] -= q
a.append(current)
total_time += q
else:
total_time += current[1]
... |
s656919106 | p02264 | u285980122 | 1535690368 | Python | Python3 | py | Runtime Error | 240 | 21568 | 1486 | class queue():
def __init__(self):
self.head = 0
self.tail = 0
self.MAX = 100000
self.Q = [[0] for i in range(self.MAX-1)]
def is_empty(self):
return self.head == self.tail
def is_full(self):
return self.head == (self.tail + 1) % self.MAX
def enqueue(se... |
s910135500 | p02264 | u285980122 | 1535690542 | Python | Python3 | py | Runtime Error | 0 | 0 | 1487 | class queue():
def __init__(self):
self.head = 0
self.tail = 0
self.MAX = 100000
self.Q = [[0] for i in range(self.MAX-1)]
def is_empty(self):
return self.head == self.tail
def is_full(self):
return self.head == (self.tail + 1) % self.MAX
def enqueue(se... |
s901309026 | p02264 | u840247626 | 1556109866 | Python | Python3 | py | Runtime Error | 0 | 0 | 269 | n,q = map(int,input().split())
queue = []
for i in range(n):
name,time = input().split()
queue.append((name, int(time)))
t = 0
i = 0
while queue:
p = queue[i % len(queue)]
t += min(q, p[1])
if p[1] > q:
p[1] -= q
i += 1
else:
print(p[0], t)
queue.pop(i)
|
s843648840 | p02264 | u840247626 | 1556110049 | Python | Python3 | py | Runtime Error | 0 | 0 | 273 | n,q = map(int,input().split())
queue = []
for i in range(n):
name,time = input().split()
queue.append((name, int(time)))
t = 0
i = 0
while queue:
i %= len(queue)
p = queue[i]
t += min(q, p[1])
if p[1] > q:
p[1] -= q
i += 1
else:
print(p[0], t)
queue.pop(i)
|
s761938904 | p02264 | u598089062 | 1559019333 | Python | Python3 | py | Runtime Error | 0 | 0 | 2320 | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
struct process {
string name;
int time;
};
class Queue {
private:
int head_;
int tail_;
public:
process queue[100001];
void initialize() {
... |
s692087029 | p02264 | u604774382 | 1433159511 | Python | Python3 | py | Runtime Error | 0 | 0 | 481 | from Queue import Queue
n, q = [ int( val ) for val in input( ).split( " " ) ]
names = Queue( )
times = Queue( )
for i in range( n ):
name, time = input( ).split( " " )
names.put( name )
times.put( int( time ) )
qsum = 0
output = []
while not times.empty( ):
name = names.get( )
time = times.get( )
if time <= q... |
s430374471 | p02264 | u669360983 | 1438328162 | Python | Python | py | Runtime Error | 0 | 0 | 329 | kl=[]
n,p=map(int,raw_input().split())
for i in range(n):
key,value=raw_input().split()
dict.update({key:int(value)})
kl.append(key)
cnt=0
time=0
while True:
for k in kl:
if dict[k]<=p:
cnt+=dict[k]
dict[k]=0
print k,cnt
del dict[k]
kl.remove(k)
time+=1
else:
dict[k]-=p
cnt+=p
if time=... |
s473471583 | p02264 | u669360983 | 1438328210 | Python | Python | py | Runtime Error | 0 | 0 | 329 | kl=[]
n,p=map(int,raw_input().split())
for i in range(n):
key,value=raw_input().split()
dict.update({key:int(value)})
kl.append(key)
cnt=0
time=0
while True:
for k in kl:
if dict[k]<=p:
cnt+=dict[k]
dict[k]=0
print k,cnt
del dict[k]
kl.remove(k)
time+=1
else:
dict[k]-=p
cnt+=p
if time=... |
s421331277 | p02264 | u313994256 | 1442303157 | Python | Python | py | Runtime Error | 0 | 0 | 364 | N_str, q_str = raw_input().spilit()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().spilit()
A.append(t[0],int(t[1]))
while A:
name, time = A.pop(0)
if time < q:
total += time
B.append(name, time)
else:
time -= q
total += q
... |
s173749411 | p02264 | u313994256 | 1442303248 | Python | Python | py | Runtime Error | 0 | 0 | 365 | N_str, q_str = raw_input().spilit()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().spilit()
A.append(t[0],int(t[1]))
while A:
name, time = A.pop(0)
if time < q:
total += time
B.append(name, time)
else:
time -= q
total += q
... |
s057526303 | p02264 | u313994256 | 1442303390 | Python | Python | py | Runtime Error | 0 | 0 | 366 | N_str, q_str = raw_input().spilit()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().spilit()
A.append(t[0],int(t[1]))
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append(name, time)
else:
time -= q
total += q
... |
s623664312 | p02264 | u313994256 | 1442303434 | Python | Python | py | Runtime Error | 0 | 0 | 369 | N_str, q_str = raw_input().spilit()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().spilit()
A.append(t[0],int(t[1]))
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append(name, time)
else:
time -= q
total += q
... |
s852590473 | p02264 | u313994256 | 1442303454 | Python | Python | py | Runtime Error | 0 | 0 | 371 | N_str, q_str = raw_input().spilit()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().spilit()
A.append(t[0],int(t[1]))
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append([name, time])
else:
time -= q
total += q... |
s309562515 | p02264 | u313994256 | 1442303474 | Python | Python | py | Runtime Error | 0 | 0 | 371 | N_str, q_str = raw_input().spilit()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().spilit()
A.append(t[0],int(t[1]))
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append([name, time])
else:
time -= q
total += q... |
s477778895 | p02264 | u313994256 | 1442303747 | Python | Python | py | Runtime Error | 0 | 0 | 379 | N_str, q_str = raw_input().spilit()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().spilit()
A.append(t[0],int(t[1]))
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append(name+" "+ str(total))
else:
time -= q
to... |
s672786323 | p02264 | u313994256 | 1442303889 | Python | Python | py | Runtime Error | 0 | 0 | 381 | N_str, q_str = raw_input().spilit()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().spilit()
A.append([t[0],int(t[1])])
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append(name+" "+ str(total))
else:
time -= q
... |
s233161856 | p02264 | u313994256 | 1442304005 | Python | Python | py | Runtime Error | 0 | 0 | 380 | N_str, q_str = raw_input().split()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().spilit()
A.append([t[0],int(t[1])])
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append(name+" "+ str(total))
else:
time -= q
t... |
s332647415 | p02264 | u313994256 | 1442304024 | Python | Python | py | Runtime Error | 0 | 0 | 379 | N_str, q_str = raw_input().split()
N = int(N_str)
q = int (q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().split()
A.append([t[0],int(t[1])])
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append(name+" "+ str(total))
else:
time -= q
to... |
s558745580 | p02264 | u313994256 | 1442304108 | Python | Python | py | Runtime Error | 0 | 0 | 377 | N_str, q_str = raw_input().split()
N = int(N_str)
q = in(q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().split()
A.append([t[0],int(t[1])])
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append(name+" "+ str(total))
else:
time -= q
tota... |
s800311556 | p02264 | u313994256 | 1442304117 | Python | Python | py | Runtime Error | 0 | 0 | 378 | N_str, q_str = raw_input().split()
N = int(N_str)
q = int(q_str)
A =[]
B =[]
total =0
for i in N:
t = raw_input().split()
A.append([t[0],int(t[1])])
while A:
name, time = A.pop(0)
if time <= q:
total += time
B.append(name+" "+ str(total))
else:
time -= q
tot... |
s092053280 | p02264 | u894381890 | 1442368170 | Python | Python | py | Runtime Error | 10 | 6376 | 895 | import sys
def isEmpty(S):
if len(S) == 0:
return True
def enqueue(x):
x_list_list.append(x)
def dequeue(x_list_list):
if isEmpty(x_list_list):
print 'Error'
del_list = x_list_list[0]
x_list_list.pop(0)
return(del_list)
y = sys.stdin.readline()
a, b = y.split(" ")
a = int(a)
b = int(b)
S = []
x... |
s205075792 | p02264 | u894381890 | 1442368311 | Python | Python | py | Runtime Error | 0 | 0 | 993 | import sys
def isEmpty(S):
if len(S) == 0:
return True
def isFull(S):
if len(S) >= 100000
return True
def enqueue(x):
if isFull(x_list_list):
print 'Error'
x_list_list.append(x)
def dequeue(x_list_list):
if isEmpty(x_list_list):
print 'Error'
del_list = x_list_list[0]
x_list_list.pop(0... |
s380278241 | p02264 | u894381890 | 1442368345 | Python | Python | py | Runtime Error | 10 | 6324 | 994 | import sys
def isEmpty(S):
if len(S) == 0:
return True
def isFull(S):
if len(S) >= 100000:
return True
def enqueue(x):
if isFull(x_list_list):
print 'Error'
x_list_list.append(x)
def dequeue(x_list_list):
if isEmpty(x_list_list):
print 'Error'
del_list = x_list_list[0]
x_list_list.pop(... |
s651293276 | p02264 | u894381890 | 1442368460 | Python | Python | py | Runtime Error | 10 | 6364 | 995 | import sys
def isEmpty(S):
if len(S) == -1:
return True
def isFull(S):
if len(S) >= 100000:
return True
def enqueue(x):
if isFull(x_list_list):
print 'Error'
x_list_list.append(x)
def dequeue(x_list_list):
if isEmpty(x_list_list):
print 'Error'
del_list = x_list_list[0]
x_list_list.pop... |
s445823866 | p02264 | u894381890 | 1442368632 | Python | Python | py | Runtime Error | 10 | 6372 | 994 | import sys
def isEmpty(S):
if len(S) == 0:
return True
def isFull(S):
if len(S) >= 100000:
return True
def enqueue(x):
if isFull(x_list_list):
print 'Error'
x_list_list.append(x)
def dequeue(x_list_list):
if isEmpty(x_list_list):
print 'Error'
del_list = x_list_list[0]
x_list_list.pop(... |
s872724283 | p02264 | u894381890 | 1442368812 | Python | Python | py | Runtime Error | 10 | 6324 | 802 | import sys
def enqueue(x):
x_list_list.append(x)
def dequeue(x_list_list):
del_list = x_list_list[0]
x_list_list.pop(0)
return(del_list)
y = sys.stdin.readline()
a, b = y.split(" ")
a = int(a)
b = int(b)
S = []
x_list_list = []
for i in range(a):
text = raw_input()
x_list = text.split()
x_list[1] ... |
s974512039 | p02264 | u894381890 | 1442368842 | Python | Python | py | Runtime Error | 10 | 6372 | 999 | import sys
def isEmpty(S):
if len(S) == 0:
return True
def isFull(S):
if len(S) >= 100000:
return True
def enqueue(x):
if isFull(x_list_list):
print 'Error'
x_list_list.append(x)
def dequeue(x_list_list):
if isEmpty(x_list_list):
print 'Error'
del_list = x_list_list[0]
x_list_list.pop(... |
s143124794 | p02264 | u197445199 | 1442370609 | Python | Python | py | Runtime Error | 0 | 0 | 733 | 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 ... |
s014287105 | p02264 | u885889402 | 1442415241 | Python | Python3 | py | Runtime Error | 0 | 0 | 1426 | class Trio:
__pre=None
__val=None
__nex=None
def __init__(self,val,p=None,n=None):
self.__pre=p
self.__val=val
self.__nex=n
def get_pre(self):return self.__pre
def get_nex(self):return self.__nex
def set_pre(self,n):self.__pre=n
def set_nex... |
s005931741 | p02264 | u885889402 | 1442415276 | Python | Python3 | py | Runtime Error | 0 | 0 | 1426 | class Trio:
__pre=None
__val=None
__nex=None
def __init__(self,val,p=None,n=None):
self.__pre=p
self.__val=val
self.__nex=n
def get_pre(self):return self.__pre
def get_nex(self):return self.__nex
def set_pre(self,n):self.__pre=n
def set_nex... |
s907856332 | p02264 | u885889402 | 1442415289 | Python | Python3 | py | Runtime Error | 0 | 0 | 1426 | class Trio:
__pre=None
__val=None
__nex=None
def __init__(self,val,p=None,n=None):
self.__pre=p
self.__val=val
self.__nex=n
def get_pre(self):return self.__pre
def get_nex(self):return self.__nex
def set_pre(self,n):self.__pre=n
def set_nex... |
s042927741 | p02264 | u949338836 | 1444444900 | Python | Python3 | py | Runtime Error | 40 | 8036 | 615 | #coding:utf-8
#1_3_B
from collections import deque
def processing(queue, quantum, total_time):
""" queue must be deque object """
if not queue:
return
ps_name, ps_time = queue.popleft()
if ps_time <= quantum:
total_time += ps_time
print(ps_name, total_time)
else:
to... |
s238552090 | p02264 | u963402991 | 1448443708 | Python | Python3 | py | Runtime Error | 0 | 0 | 589 | n, q = map(int, input().split())
q_list = collections.deque()
for i in range(n):
name, time = input().split()
q_list.append([name, int(time)])
time = 0
while q_list:
if q_list[0][1] == 0:
q_list.popleft()
elif q_list[0][1] == 100:
time += 100
print (q_list[0][0], time)
q... |
s542039117 | p02264 | u685815919 | 1474344170 | Python | Python | py | Runtime Error | 0 | 0 | 598 | from collections import deque
class Process:
def __init__(self, name, time):
self.name = name
self.time = time
def getName(self):
return self.name
def getTime(self):
return self.time
def setTime(self, time):
self.time = time
queue = deque()
n, q = map(int, raw_input().split())
for _ in ... |
s825642687 | p02264 | u022407960 | 1477926827 | Python | Python3 | py | Runtime Error | 0 | 0 | 962 | # encoding: utf-8
import sys
from collections import deque
class Solution:
@staticmethod
def message_queue():
# write your code here
# tasks = deque(map(lambda x: x.split(), sys.stdin.readlines()))
task_num, task_time = map(int, input().split())
_input = sys.stdin.readlines()... |
s411589047 | p02264 | u086566114 | 1479911492 | Python | Python | py | Runtime Error | 0 | 0 | 2609 | import time as ti
class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 50005
self.queue = [0] * self.length
self.head = 0
self.tail = 0
# ... |
s187052454 | p02264 | u086566114 | 1479911498 | Python | Python | py | Runtime Error | 0 | 0 | 2609 | import time as ti
class MyQueue(object):
"""
My Queue class
Attributes:
queue: queue
head
tail
"""
def __init__(self):
"""Constructor
"""
self.length = 50005
self.queue = [0] * self.length
self.head = 0
self.tail = 0
# ... |
s412669561 | p02264 | u195186080 | 1480147949 | Python | Python3 | py | Runtime Error | 0 | 0 | 413 | import collections
q = collections.deque(maxlen=100000)
n = int(input())
for i in range(n):
com = input().split()
if com[0]=='insert':
q.appendleft(int(com[1]))
elif com[0]=='delete':
try:
q.remove(int(com[0]))
except ValueError:
pass
elif com[0]=='delete... |
s704246609 | p02264 | u918276501 | 1485054650 | Python | Python3 | py | Runtime Error | 0 | 0 | 291 | n, q = map(int, input().split())
p = [input().split() for _ in range(n)]
t = i = 0
while n:
i = i % n
if int(p[i][1]) <= q:
t += int(p[i][1])
print(p[i][0], t)
del p[i]
n -= 1
else:
p[i][1] -= int(p[i][1]) - q
t += q
i += 1 |
s359294594 | p02264 | u895660619 | 1488070739 | Python | Python3 | py | Runtime Error | 0 | 0 | 864 | class queue:
head = tail = None
size = 0
def enqueue(self, x):
if self.is_empty():
self.head = self.tail = (x, None)
else:
self.tail[1] = (x, None)
self.tail = self.tail[1]
self.size += 1
def dequeue(self):
if not self.is_empty():
... |
s896314510 | p02264 | u300946041 | 1489776244 | Python | Python3 | py | Runtime Error | 0 | 0 | 658 | # encording: utf-8
n, q = [e for e in input().split()]
def main(n, q):
head = 0
tail = -1
lst = []
all_time = 0
for name, time in input().split():
lst.append([name, int(time)])
while head != tail:
name, time = lst[head][0], lst[head][1]
if time <= q:
all... |
s787902857 | p02264 | u297744593 | 1493450015 | Python | Python3 | py | Runtime Error | 0 | 0 | 624 | a = list(map(int, input().split()))
queuekey = []
queuetime = []
for i in range(0, a[0]):
tmp = list(input().split())
queuekey.append(tmp[0])
queuetime.append(int(tmp[1]))
spentTime = 0
while len(queue) > 0:
if queuetime[0] < a[1]:
spentTime += queuetime[0]
print(queuekey[0], end="")
... |
s442405009 | p02264 | u297744593 | 1493450050 | Python | Python3 | py | Runtime Error | 0 | 0 | 628 | a = list(map(int, input().split()))
queuekey = []
queuetime = []
for i in range(0, a[0]):
tmp = list(input().split())
queuekey.append(tmp[0])
queuetime.append(int(tmp[1]))
spentTime = 0
while len(queuetime) > 0:
if queuetime[0] < a[1]:
spentTime += queuetime[0]
print(queuekey[0], end="... |
s076590339 | p02264 | u603049633 | 1495955485 | Python | Python3 | py | Runtime Error | 0 | 0 | 510 | n,q = map(int, input().split())
Q = [0 for i in range(n+1)]
head = 0
tail = 0
def enqueue(x):
global tail
Q[tail] = ???
tail = (tail + 1) % (n + 1)
def dequeue():
global head
x,t = Q[head]
head = (head + 1) % (n + 1)
return [x,t]
for i in range(n):
P = input().split()
enqueue([P[0],... |
s374750849 | p02264 | u603049633 | 1495955624 | Python | Python3 | py | Runtime Error | 0 | 0 | 510 | n,q = map(int, input().split())
Q = [0 for i in range(n+1)]
head = 0
tail = 0
def enqueue(x):
global tail
Q[tail] = ???
tail = (tail + 1) % (n + 1)
def dequeue():
global head
x,t = Q[head]
head = (head + 1) % (n + 1)
return [x,t]
for i in range(n):
P = input().split()
enqueue([P[0],... |
s290852241 | p02264 | u603049633 | 1495956598 | Python | Python3 | py | Runtime Error | 0 | 0 | 510 | def enqueue(x):
global tail
Q[tail] = ???
tail = (tail + 1) % (n + 1)
def dequeue():
global head
x,t = Q[head]
head = (head + 1) % (n + 1)
return [x,t]
n,q = map(int, input().split())
Q = [0 for i in range(n+1)]
head = 0
tail = 0
for i in range(n):
P = input().split()
enqueue([P[0],... |
s986429700 | p02264 | u603049633 | 1495956864 | Python | Python3 | py | Runtime Error | 0 | 0 | 508 | n,q = map(int, input().split())
Q = [0 for i in range(n+1)]
head = 0
tail = 0
def enqueue(x):
global tail
Q[tail] = ???
tail = (tail + 1) % (n + 1)
def dequeue():
global head
x,t = Q[head]
head = (head + 1) % (n + 1)
return [x,t]
for i in range(n):
P = input().split()
enqueue([P[0], ... |
s588689586 | p02264 | u603049633 | 1495957035 | Python | Python3 | py | Runtime Error | 0 | 0 | 514 | n,q = map(int, input().split())
MAX = n + 2
Q = [0 for i in range(MAX)]
head = 0
tail = 0
def enqueue(x):
global tail
Q[tail] = ???
tail = (tail + 1) % MAX
def dequeue():
global head
x,t = Q[head]
head = (head + 1) %MAX
return [x,t]
for i in range(n):
P = input().split()
enqueue([P... |
s379202939 | p02264 | u603049633 | 1495957159 | Python | Python3 | py | Runtime Error | 0 | 0 | 520 | n,q = map(int, input().split())
MAX = n + 2
Q = [0 for i in range(MAX)]
head = 0
tail = 0
def enqueue(x):
global tail
Q[tail] = ???
tail = (tail + 1) % MAX
def dequeue():
global head
x,t = Q[head]
head = (head + 1) %MAX
return [x,t]
for i in range(n):
P = list(input().split())
enqu... |
s185396028 | p02264 | u735204496 | 1499003766 | Python | Python | py | Runtime Error | 0 | 0 | 713 | import Queue
import sys
class Proc:
def __init__(self, name, time):
self.time = time
self.name = name
def main():
array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))
p_num = array[0]
q_time = array[1]
p_queue = Queue.Queue()
for i in range(0, p_num):
... |
s505286287 | p02264 | u735204496 | 1499003843 | Python | Python | py | Runtime Error | 0 | 0 | 716 | import Queue
import sys
class Proc:
def __init__(self, name, time):
self.time = time
self.name = name
def main():
array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))
p_num = array[0]
q_time = array[1]
p_queue = Queue.Queue()
for i in range(0, p_num):
... |
s426539780 | p02264 | u153665391 | 1504951586 | Python | Python3 | py | Runtime Error | 0 | 0 | 381 | N, Q = map(int, input().strip().split())
A = []
D = {}
for l in range(N):
n, t = input().strip().split()
D[n] = int(t)
A.append(n)
print(A)
T = 0
d = 0
while True:
n = A.pop(0)
if D[n] > Q:
D[n] -= Q
T += Q
A.append(n)
else:
T += D[n]
print(str(n) + ' ' ... |
s883825186 | p02264 | u480053997 | 1508726200 | Python | Python3 | py | Runtime Error | 0 | 0 | 387 | ef ALDS1_3B():
n, q = map(int, input().split())
PQ = [[l[0], int(l[1])] for l in [input().split() for i in range(n)] ]
times = 0
while PQ:
p = PQ.pop(0)
if p[1] <= q:
times += p[1]
print('%s %d' %(p[0], times))
else:
times += q
PQ... |
s184140559 | p02264 | u480053997 | 1508726376 | Python | Python3 | py | Runtime Error | 0 | 0 | 387 | ef ALDS1_3B():
n, q = map(int, input().split())
PQ = [[l[0], int(l[1])] for l in [input().split() for i in range(n)] ]
times = 0
while PQ:
p = PQ.pop(0)
if p[1] <= q:
times += p[1]
print('%s %d' %(p[0], times))
else:
times += q
PQ... |
s966298493 | p02264 | u514487486 | 1509191710 | Python | Python3 | py | Runtime Error | 0 | 0 | 816 | n, q = map(int , input().split())
queue = []
for _ in range(n):
line = input().split()
queue.append([line[0], int(line[1])])
class my_queue:
def __init__(self, queue):
self.queue = queue
def enqueue(self, item):
self.queue = self.queue + [item]
self.queue.append(item)
def de... |
s178232658 | p02264 | u530663965 | 1513601123 | Python | Python3 | py | Runtime Error | 30 | 6012 | 1008 | from collections import deque
def main():
process_count, process_time, processes = get_input()
result = run_roundrobin(processes = processes, time = process_time)
for r in result:
print(r.name, r.time)
def run_roundrobin(processes, time, total_time = 0, result=[]):
if not processes:
... |
s227555239 | p02264 | u530663965 | 1513601260 | Python | Python3 | py | Runtime Error | 30 | 15060 | 1048 | from collections import deque
import sys
sys.setrecursionlimit(10000)
def main():
process_count, process_time, processes = get_input()
result = run_roundrobin(processes = processes, time = process_time)
for r in result:
print(r.name, r.time)
def run_roundrobin(processes, time, total_time = 0, re... |
s487256230 | p02264 | u530663965 | 1513601277 | Python | Python3 | py | Runtime Error | 70 | 63588 | 1050 | from collections import deque
import sys
sys.setrecursionlimit(1000000)
def main():
process_count, process_time, processes = get_input()
result = run_roundrobin(processes = processes, time = process_time)
for r in result:
print(r.name, r.time)
def run_roundrobin(processes, time, total_time = 0, ... |
s307124672 | p02264 | u530663965 | 1513601325 | Python | Python3 | py | Runtime Error | 0 | 0 | 1054 | from collections import deque
import sys
sys.setrecursionlimit(10000000000)
def main():
process_count, process_time, processes = get_input()
result = run_roundrobin(processes = processes, time = process_time)
for r in result:
print(r.name, r.time)
def run_roundrobin(processes, time, total_time =... |
s684396614 | p02264 | u530663965 | 1513601331 | Python | Python3 | py | Runtime Error | 60 | 63596 | 1052 | from collections import deque
import sys
sys.setrecursionlimit(100000000)
def main():
process_count, process_time, processes = get_input()
result = run_roundrobin(processes = processes, time = process_time)
for r in result:
print(r.name, r.time)
def run_roundrobin(processes, time, total_time = 0... |
s982729435 | p02264 | u530663965 | 1513601338 | Python | Python3 | py | Runtime Error | 70 | 63588 | 1053 | from collections import deque
import sys
sys.setrecursionlimit(1000000000)
def main():
process_count, process_time, processes = get_input()
result = run_roundrobin(processes = processes, time = process_time)
for r in result:
print(r.name, r.time)
def run_roundrobin(processes, time, total_time = ... |
s568936011 | p02264 | u530663965 | 1513601344 | Python | Python3 | py | Runtime Error | 0 | 0 | 1054 | from collections import deque
import sys
sys.setrecursionlimit(10000000000)
def main():
process_count, process_time, processes = get_input()
result = run_roundrobin(processes = processes, time = process_time)
for r in result:
print(r.name, r.time)
def run_roundrobin(processes, time, total_time =... |
s116275020 | p02264 | u150984829 | 1518302533 | Python | Python3 | py | Runtime Error | 0 | 0 | 224 | import sys
from collections import deque
n,q=map(int,input().split())
d=deque(map(lambda x,y:[x,int(y)],sys.stdin))
t=0
while d:
k,v=d.popleft()
v=int(v)
if v>q:
v-=q
t+=q
d.append([k,v])
else:
t+=v
print(k,t)
|
s566129296 | p02264 | u912143677 | 1519303364 | Python | Python | py | Runtime Error | 0 | 0 | 587 | n, q = [int(i) for i in input().split()]
name = []
time = []
for i in range(n):
x, y = [i for i in input().split()]
y = int(y)
name.append(x)
time.append(y)
from collections import deque
time = deque(time)
name = deque(name)
count = 0
time_out = []
name_out = []
while len(time) > 0:
a = time.po... |
s379950765 | p02264 | u150984829 | 1519867047 | Python | Python3 | py | Runtime Error | 0 | 0 | 313 | 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(map(*e.split())for e in s[1:])
t,a=0,[]
while d:
k,v=d.popleft()
if v>q:v-=q;t+=q;d.append([k,v])
else:t+=v;a+=[f'{k} {t}']
print('\n'.join(a))
if'__main__'==__name__:m()
|
s670195906 | p02264 | u702650865 | 1521857325 | Python | Python3 | py | Runtime Error | 0 | 0 | 569 | import sys
import numpy as np
import copy
fline = input().rstrip().split(' ')
N, Q = int(fline[0]), int(fline[1])
list = []
for i in range(N):
tlist = []
line = input().split(' ')
tlist = [line[0], line[1]]
#print(tlist)
list.append(tlist)
#print(list)
current = 0
while len(list) != 0:
if int... |
s842203922 | p02264 | u702650865 | 1521857410 | Python | Python3 | py | Runtime Error | 0 | 0 | 585 | import sys
import numpy as np
import copy
fline = input().rstrip().split(' ')
N, Q = int(fline[0]), int(fline[1])
list = []
for i in range(N):
tlist = []
line = input().split(' ')
tlist = [line[0], line[1]]
#print(tlist)
list.append(tlist)
#print(list)
current = 0
while len(list) != 0:
if int... |
s091217361 | p02264 | u464859367 | 1523155478 | Python | Python3 | py | Runtime Error | 0 | 0 | 693 | INPUT = list(map(int, input().split()))
head, tail, n, quantum = 0, len(processes), INPUT[0], INPUT[1]
processes = [input().split() for _ in range(n)]
def enqueue(x):
global processes, tail
processes.append(0)
processes[tail] = x
tail += 1
def dequeue():
global head
head += 1
for i in rang... |
s762469796 | p02264 | u464859367 | 1523155519 | Python | Python3 | py | Runtime Error | 0 | 0 | 693 | INPUT = list(map(int, input().split()))
processes = [input().split() for _ in range(n)]
head, tail, n, quantum = 0, len(processes), INPUT[0], INPUT[1]
def enqueue(x):
global processes, tail
processes.append(0)
processes[tail] = x
tail += 1
def dequeue():
global head
head += 1
for i in rang... |
s758783082 | p02264 | u464859367 | 1523155603 | Python | Python3 | py | Runtime Error | 0 | 0 | 700 | INPUT = list(map(int, input().split()))
processes = [input().split() for _ in range(INPUT[0])]
head, tail, n, quantum = 0, len(processes), INPUT[0], INPUT[1]
def enqueue(x):
global processes, tail
processes.append(0)
processes[tail] = x
tail += 1
def dequeue():
global head
head += 1
for i ... |
s997161748 | p02264 | u464859367 | 1523155806 | Python | Python3 | py | Runtime Error | 0 | 0 | 743 | INPUT = list(map(int, input().split()))
processes = [input() for _ in range(INPUT[0])]
for i in range(INPUT[0]):
processes[i].split()
head, tail, n, quantum = 0, len(processes), INPUT[0], INPUT[1]
def enqueue(x):
global processes, tail
processes.append(0)
processes[tail] = x
tail += 1
def dequeu... |
s932188669 | p02264 | u464859367 | 1523156328 | Python | Python3 | py | Runtime Error | 0 | 0 | 728 | n, quantum = [int(i) for i in input().split()]
processes = []
for i in range(n):
processes.append(input())
for i in range(n):
processes[i].split()
head, tail = 0, len(processes)
def enqueue(x):
global processes, tail
processes.append(0)
processes[tail] = x
tail += 1
def dequeue():
global... |
s174724020 | p02264 | u464859367 | 1523157004 | Python | Python3 | py | Runtime Error | 0 | 0 | 713 | def parse(l):
name, time = l.split()
return name, int(time)
n, quantum = map(int, input().split())
queue = list(parse(input()) for _ in range(n))
head, tail = 0, len(queue)
def enqueue(x):
global queue, tail
queue.append(0)
queue[tail] = x
tail += 1
def dequeue():
global head
head ... |
s906838286 | p02264 | u464859367 | 1523158471 | Python | Python3 | py | Runtime Error | 0 | 0 | 615 | def parse(l):
name, time = l.split()
return name, int(time)
n, quantum = map(int, input().split())
queue = list(parse(input()) for _ in range(n))
head = 0
def enqueue(x):
global queue
queue.append(x)
def dequeue():
global head
head += 1
total_time, count = 0, 0
while count < n:
y = q... |
s733111781 | p02264 | u564464686 | 1524819300 | 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:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.