buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k | change_count int64 0 100 |
|---|---|---|---|---|---|
#coding:utf-8
#1_3_A
formula = input().split()
stack = []
for char in formula:
if char.isdigit():
stack.append(char)
else:
ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop()))
stack.append(ans)
print(stack)
print(stack.pop()) | #coding:utf-8
#1_3_A
formula = input().split()
stack = []
for char in formula:
if char.isdigit():
stack.append(char)
else:
ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop()))
stack.append(ans)
print(stack.pop()) | [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 63, 319, 500, 22]] | 5 | 80 | 4 |
Stack=[]
def push(x):
Stack.append(x)
def pop():
return Stack.pop()
def solve():
s_list=raw_input().split()
for i in range(len(s_list)):
if s_list[i]=='+':
b=pop()
a=pop()
push(a+b)
elif s_list[i]=='-':
b=pop()
a=pop()
... |
Stack=[]
def push(x):
Stack.append(x)
def pop():
return Stack.pop()
def solve():
s_list=input().split()
for i in range(len(s_list)):
if s_list[i]=='+':
b=pop()
a=pop()
push(a+b)
elif s_list[i]=='-':
b=pop()
a=pop()
... | [["-", 0, 662, 12, 652, 63, 319, 500, 652, 63, 22], ["+", 0, 662, 12, 652, 63, 319, 500, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 23, 0, 652, 3, 4, 0, 25]] | 5 | 166 | 4 |
from collections import deque
def main():
S = input().split()
D = deque([])
for s in S:
if s == '+':
b = D.pop()
a = D.pop()
D.append(a+b)
elif s == '-':
b = D.pop()
a = D.pop()
D.append(a-b)
elif s == '*':
... | from collections import deque
def main():
S = input().split()
D = deque([])
for s in S:
if s == '+':
b = D.pop()
a = D.pop()
D.append(a+b)
elif s == '-':
b = D.pop()
a = D.pop()
D.append(a-b)
elif s == '*':
... | [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 63, 319, 500, 22]] | 5 | 145 | 4 |
import re
data = input().split()
stack = []
for elem in data:
if re.match('\d+', elem):
stack.append(int(elem))
else:
a = stack.pop()
b = stack.pop()
if elem == "+":
stack.append(b+a)
elif elem == "-":
stack.append(b-a)
elif elem == "*":
... | import re
data = input().split()
stack = []
for elem in data:
if re.match('\d+', elem):
stack.append(int(elem))
else:
a = stack.pop()
b = stack.pop()
if elem == "+":
stack.append(b+a)
elif elem == "-":
stack.append(b-a)
elif elem == "*":
... | [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 115 | 6 |
input_ = input().split()
stack = []
for s in input_:
print(stack)
if s.isdigit():
stack.append(s)
else:
x = stack.pop()
y = stack.pop()
ans = eval(y + s + x)
stack.append(str(ans))
print(stack[0]) | input_ = input().split()
stack = []
for s in input_:
if s.isdigit():
stack.append(s)
else:
x = stack.pop()
y = stack.pop()
ans = eval(y + s + x)
stack.append(str(ans))
print(stack[0]) | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 77 | 4 |
ts = input().split(" ")
stack = []
for t in ts:
if t not in ("-", "+", "*"):
stack.push(int(t))
else:
n2 = stack.pop()
n1 = stack.pop()
if t == "-":
stack.push(n1 - n2)
elif t == "+":
stack.push(n1 + n2)
else:
stack.push(n1 * n2... | ts = input().split(" ")
stack = []
for t in ts:
if t not in ("-", "+", "*"):
stack.append(int(t))
else:
n2 = stack.pop()
n1 = stack.pop()
if t == "-":
stack.append(n1 - n2)
elif t == "+":
stack.append(n1 + n2)
else:
stack.append... | [["-", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22]] | 5 | 112 | 8 |
arguments = input().split()
array = []
for word in arguments:
if word == '-':
s1 = array.pop()
s2 = array.pop()
array.append(s1-s2)
elif word == '*':
s1 =array.pop()
s2 = array.pop()
array.append(s1*s2)
elif word == '+':
s1 = array.pop()
s2 =... | arguments = input().split()
array = []
for word in arguments:
if word == '-':
s1 = array.pop()
s2 = array.pop()
array.append(s2-s1)
elif word == '*':
s1 =array.pop()
s2 = array.pop()
array.append(s1*s2)
elif word == '+':
s1 = array.pop()
s2 =... | [["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 124 | 4 |
#!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def stack_polish_calc():
# write your code here
# array_length = int(input())
calc_func = ('+', '-', '*')
array = [str(x) for x in input().split()]
print(array)
result = []
for i in ra... | #!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def stack_polish_calc():
# write your code here
# array_length = int(input())
calc_func = ('+', '-', '*')
array = [str(x) for x in input().split()]
# print(array)
result = []
for i in ... | [["-", 698, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 161 | 16 |
class MyStack(object):
"""stack class
Attributes:
stack: stack
"""
def __init__(self):
self.stack = []
def pop(self):
"""pop method
Returns:
popped object
"""
return self.stack.pop()
def push(self, value):
""" push method
... | class MyStack(object):
"""stack class
Attributes:
stack: stack
"""
def __init__(self):
self.stack = []
def pop(self):
"""pop method
Returns:
popped object
"""
return self.stack.pop()
def push(self, value):
""" push method
... | [["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22]] | 5 | 159 | 4 |
box = []
elem = input().split()
print(elem)
for i in elem:
if i == '+' or i == '-' or i =='*':
v = '{0} {1} {2}'.format(box[-2],i,box[-1])
box.pop()
box.pop()
box.append(eval(v))
else:
box.append(i)
print (box[0]) | box = []
elem = input().split()
for i in elem:
if i == '+' or i == '-' or i =='*':
v = '{0} {1} {2}'.format(box[-2],i,box[-1])
box.pop()
box.pop()
box.append(eval(v))
else:
box.append(i)
print (box[0]) | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 97 | 4 |
f = input().strip().split()
q = []
for e in f:
if e =='+':
q.append(q.pop() + q.pop())
elif e == '-':
q.append(-q.pop() + q.pop())
elif e == '*':
q.append(q.pop() * q.pop())
else:
q.append(int(q))
print(q[0]) | f = input().strip().split()
q = []
for e in f:
if e == '+':
q.append(q.pop() + q.pop())
elif e == '-':
q.append(-q.pop() + q.pop())
elif e == '*':
q.append(q.pop() * q.pop())
else:
q.append(int(e))
print(q[0]) | [["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]] | 5 | 110 | 2 |
if __name__=="__main__":
a = list(input().split())
print(a)
b = []
for i in range(len(a)):
if a[i] == "+":
y = b.pop()
x = b.pop()
z = x + y
b.append(z)
elif a[i] == "-":
y = b.pop()
x = b.pop()
z = x - y... | if __name__=="__main__":
a = list(input().split())
b = []
for i in range(len(a)):
if a[i] == "+":
y = b.pop()
x = b.pop()
z = x + y
b.append(z)
elif a[i] == "-":
y = b.pop()
x = b.pop()
z = x - y
... | [["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 164 | 4 |
import sys
stack = []
array = sys,stdin.readline().strip().split(" ")
for op in array:
if op.isdigit():
stack.append(int(op))
else:
tmp1 = stack.pop()
tmp2 = stack.pop()
if op == "+":
stack.append(tmp1 + tmp2)
elif op == "-":
stack.append(tmp2 -... | import sys
stack = []
array = sys.stdin.readline().strip().split(" ")
for op in array:
if op.isdigit():
stack.append(int(op))
else:
tmp1 = stack.pop()
tmp2 = stack.pop()
if op == "+":
stack.append(tmp1 + tmp2)
elif op == "-":
stack.append(tmp2 -... | [["-", 0, 656, 0, 1, 0, 662, 12, 432, 0, 21], ["+", 63, 319, 500, 652, 63, 319, 500, 319, 0, 131]] | 5 | 143 | 2 |
i = [i for i in input().split()]
op = ['+', '*', '-']
stack = []
for j in i:
if j in op:
l = stack.pop()
r = stack.pop()
stack.append(str(eval(l + j + r)))
else:
stack.append(j)
print (stack[0]) | i = [i for i in input().split()]
op = ['+', '*', '-']
stack = []
for j in i:
if j in op:
r = stack.pop()
l = stack.pop()
stack.append(str(eval(l + j + r)))
else:
stack.append(j)
print (stack[0]) | [["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22]] | 5 | 89 | 4 |
fig = input()
symbol = fig.split(' ')
stack = []
for i in symbol:
try:
stack.append(int(i))
except ValueError:
if i == "+": stack.append(stack.pop()+stack.pop())
elif i == "-": stack.append(stack.pop()-stack.pop())
elif i == "*": stack.append(stack.pop()*stack.pop())
print(stack[0... | fig = input()
symbol = fig.split(' ')
stack = []
for i in symbol:
try:
stack.append(int(i))
except ValueError:
if i == "+": stack.append(stack.pop()+stack.pop())
elif i == "-": stack.append(-(stack.pop()-stack.pop()))
elif i == "*": stack.append(stack.pop()*stack.pop())
print(stac... | [["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 652, 3, 4, 0, 664, 28, 23, 0, 24], ["+", 28, 23, 0, 657, 12, 652, 3, 4, 0, 25]] | 5 | 114 | 3 |
expr = input().split()
my_stack = []
def push(stack, item):
return stack.append(item)
def pop(stack):
return stack[:-1], stack[-1]
for item in expr:
if item.isdigit():
push(my_stack, int(item))
elif item == '+':
my_stack, a = pop(my_stack)
my_stack, b = pop(my_stack)
p... | expr = input().split()
my_stack = []
def push(stack, item):
return stack.append(item)
def pop(stack):
return stack[:-1], stack[-1]
for item in expr:
if item.isdigit():
push(my_stack, int(item))
elif item == '+':
my_stack, a = pop(my_stack)
my_stack, b = pop(my_stack)
pu... | [["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 168 | 4 |
inList = input().split()
stack = []
for i in inList:
if i in ['+', '-', '*']:
b, a = stack.pop(), stack.pop()
if i == '+':
stack.append(b + a)
if i == '-':
stack.append(b - a)
if i == '*':
stack.append(b * a)
else:
stack.append(int(i))
... | inList = input().split()
stack = []
for i in inList:
if i in ['+', '-', '*']:
b, a = stack.pop(), stack.pop()
if i == '+':
stack.append(b + a)
if i == '-':
stack.append(a - b)
if i == '*':
stack.append(b * a)
else:
stack.append(int(i))
... | [["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 114 | 4 |
def main() :
lst = input().split()
stack = []
for i in lst :
if i == ""+"" :
x = stack.pop()
y = stack.pop()
stack.append(x + y)
elif i == "-" :
x = stack.pop()
y = stack.pop()
stack.append(y - x)
elif i == "*"... | def main() :
lst = input().split()
stack = []
for i in lst :
if i == "+" :
x = stack.pop()
y = stack.pop()
stack.append(x + y)
elif i == "-" :
x = stack.pop()
y = stack.pop()
stack.append(y - x)
elif i == "*" :... | [["-", 0, 57, 15, 666, 0, 657, 31, 557, 0, 655], ["-", 0, 57, 15, 666, 0, 657, 12, 557, 0, 654]] | 5 | 141 | 2 |
s=[]
for p in input().split():
if p in "+-*":
b=s.pop()
a=s.pop()
s.append(str(eval(a+p+b)))
else:
s.append(c)
print(*s)
| s=[]
for p in input().split():
if p in "+-*":
b=s.pop()
a=s.pop()
s.append(str(eval(a+p+b)))
else:
s.append(p)
print(*s)
| [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 65 | 2 |
s=[i for i in input().split()]
k=[]
for i in range(len(s)):
if s[i]=="+":
a=k.pop()
b=k.pop()
k.append(int(a)+int(b))
elif s[i]=="-":
a=k.pop()
b=k.pop()
k.append(int(a)-int(b))
elif s[i]=="*":
a=k.pop()
b=k.pop()
k.append(int(a)*int(b... | s=[i for i in input().split()]
k=[]
for i in range(len(s)):
if s[i]=="+":
b=k.pop()
a=k.pop()
k.append(int(a)+int(b))
elif s[i]=="-":
b=k.pop()
a=k.pop()
k.append(int(a)-int(b))
elif s[i]=="*":
b=k.pop()
a=k.pop()
k.append(int(a)*int(b... | [["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 75, 665, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 31, 22]] | 5 | 162 | 12 |
a = input().split()
b = []
for i in a:
if i.isdigit():
b.append(i)
else:
c = b.pop()
d = b.pop()
ans = eval(str(d)+i+str(c))
b.append(ans)
print(b)
| a = input().split()
b = []
for i in a:
if i.isdigit():
b.append(i)
else:
c = b.pop()
d = b.pop()
ans = eval(str(d)+i+str(c))
b.append(ans)
print(b[0])
| [["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]] | 5 | 73 | 3 |
import re
def revPolish(f):
f = re.sub(r'(\-?\d+\.?\d*?)\s(\-?\d+\.?\d*?)\s([\+\-\*/])',
lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),
f)
if f[-1] in ('+','-','*','/'):
return revPolish(f)
else:
return f
print(revPlish(input()))
| import re
def revPolish(f):
f = re.sub(r'(\-?\d+\.?\d*?)\s(\-?\d+\.?\d*?)\s([\+\-\*/])(?!\d)',
lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),
f)
if f[-1] in ('+','-','*','/'):
return revPolish(f)
else:
return f
print(revPolish(input()))
| [["-", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22]] | 5 | 93 | 4 |
def add(a,b):
return a + b
def sub(a,b):
return a - b
def mul(a,b):
return a * b
def div(a,b):
return a/ float(b)
A=input().split()
i=0
for j in range(len(A)):
print(i)
if A[i]=="+":
A[i-2]=(int)(A[i-2])
A[i-1]=(int)(A[i-1])
A[i]=add(A[i-2],A[i-1])
r=A[i]
... | def add(a,b):
return a + b
def sub(a,b):
return a - b
def mul(a,b):
return a * b
def div(a,b):
return a/ float(b)
A=input().split()
i=0
for j in range(len(A)):
if A[i]=="+":
A[i-2]=(int)(A[i-2])
A[i-1]=(int)(A[i-1])
A[i]=add(A[i-2],A[i-1])
r=A[i]
del A[i-... | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 455 | 4 |
def cal(ope,a,b):
if ope=="+":
x=a+b
elif ope=="-":
x=a-b
elif ope=="*":
x=a*b
return x
lst=input().split()
stack=[]
for i in range(len(lst)):
if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": pass
else:
lst[i]=int(lst[i])
for i in range(len(lst)):
if lst[i]=="+"... | def cal(ope,a,b):
if ope=="+":
x=a+b
elif ope=="-":
x=a-b
elif ope=="*":
x=a*b
return x
lst=input().split()
stack=[]
for i in range(len(lst)):
if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": pass
else:
lst[i]=int(lst[i])
for i in range(len(lst)):
if lst[i]=="+"... | [["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]] | 5 | 205 | 4 |
def kei(a,i,x,y):
if a[i]=="+":
st=x+y
#print("+")
elif a[i]=="-":
st=x-y
#print("-")
elif a[i]=="*":
st=x*y
#print("*")
return st
a=[]
stac=[]
a=list(input().split())
for i in range(len(a)):
if a[i].isdigit():
stac.append(int(a[i]))
#print(stac)
else:
x=stac.pop()
y=stac.pop()
stac.appen... | def kei(a,i,x,y):
if a[i]=="+":
st=x+y
#print("+")
elif a[i]=="-":
st=y-x
#print("-")
elif a[i]=="*":
st=x*y
#print("*")
return st
a=[]
stac=[]
a=list(input().split())
for i in range(len(a)):
if a[i].isdigit():
stac.append(int(a[i]))
#print(stac)
else:
x=stac.pop()
y=stac.pop()
stac.appen... | [["-", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]] | 5 | 154 | 4 |
def main():
l = input().split(' ')
s = []
for el in l:
print(s)
if el in ["+", "-", "*"]:
a = s.pop(-1)
b = s.pop(-1)
s.append(eval(str(b) + el + str(a)))
else:
s.append(int(el))
print(s[0])
main()
|
def main():
l = input().split(' ')
s = []
for el in l:
if el in ["+", "-", "*"]:
a = s.pop(-1)
b = s.pop(-1)
s.append(eval(str(b) + el + str(a)))
else:
s.append(int(el))
print(s[0])
main()
| [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 105 | 4 |
input_line = input().split()
stack = []
for i in input_line:
if i == '+':
stack.append(stack.pop() + stack.pop())
elif i == '-':
a = stack.pop()
b = stack.pop()
stack.append(b - a)
elif i =='*':
stack.append(stack.pop() * stack.pop())
else:
stack.append(in... | input_line = input().split()
stack = []
for i in input_line:
if i == '+':
stack.append(stack.pop() + stack.pop())
elif i == '-':
a = stack.pop()
b = stack.pop()
stack.append(b - a)
elif i =='*':
stack.append(stack.pop() * stack.pop())
else:
stack.append(in... | [["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]] | 5 | 108 | 3 |
# initialize stack
Stack = []
A = [i for i in input().split()]
for inputData in A:
if inputData == "+":
x = Stack.pop()
y = Stack.pop()
Stack.append(x+y)
elif inputData == "-":
y = Stack.pop()
x = Stack.pop()
Stack.append(x-y)
elif inputData == "*":
... | # initialize stack
Stack = []
A = [i for i in input().split()]
for inputData in A:
if inputData == "+":
x = Stack.pop()
y = Stack.pop()
Stack.append(x+y)
elif inputData == "-":
y = Stack.pop()
x = Stack.pop()
Stack.append(x-y)
elif inputData == "*":
... | [["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73]] | 5 | 127 | 3 |
stack = []
for x in input().split():
if x == '+':
stack.append(stack.pop()+stack.pop())
elif x == '-':
stack.append(stack.pop()-stack.pop())
elif x == '*':
stack.append(stack.pop()*stack.pop())
else:
stack.append(int(x))
print(stack[0])
| stack = []
for x in input().split():
if x == '+':
stack.append(stack.pop()+stack.pop())
elif x == '-':
stack.append(-stack.pop()+stack.pop())
elif x == '*':
stack.append(stack.pop()*stack.pop())
else:
stack.append(int(x))
print(stack[0])
| [["+", 0, 652, 3, 4, 0, 657, 31, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]] | 5 | 102 | 3 |
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 == '+' ... | 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 == '+' :
... | [["-", 12, 652, 3, 4, 0, 652, 63, 319, 500, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25]] | 5 | 199 | 4 |
#include <iostream>
#include <stdlib.h>
#define N_MAX 1000000
using namespace std;
typedef struct _a {
char name[10];
int time;
} P;
int main() {
int i;
int n;
int q;
int head;
int tail;
int res_time = 0;
char temp[10];
P A[N_MAX];
cin >> n;
cin >> q;
for (i = 0; i < n; i++) {
cin >... | #include <iostream>
#include <stdlib.h>
#define N_MAX 99999
using namespace std;
typedef struct _a {
char name[10];
int time;
} P;
int main() {
int i;
int n;
int q;
int head;
int tail;
int res_time = 0;
char temp[10];
P A[N_MAX];
cin >> n;
cin >> q;
for (i = 0; i < n; i++) {
cin >> ... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]] | 1 | 237 | 2 |
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
long n;
int q;
cin >> n >> q;
queue<string> name;
queue<long> t;
for (long i = 0; i < n; i++) {
string stc;
cin >> stc;
name.push(stc);
long lin;
cin >> lin;
t.push(lin);
}
long total = ... | #include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
long n;
int q;
cin >> n >> q;
queue<string> name;
queue<long> t;
for (long i = 0; i < n; i++) {
string stc;
cin >> stc;
name.push(stc);
long lin;
cin >> lin;
t.push(lin);
}
long total = ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]] | 1 | 198 | 6 |
#include <algorithm>
#include <iostream>
#include <string>
#define LEN 100000
using namespace std;
class Pro {
public:
string name;
int time;
};
class Que {
Pro p[LEN];
public:
int head = 0, tail = 0, n;
void enqueue(Pro x) {
p[tail] = x;
tail = (tail + 1) % LEN;
}
Pro dequeue() {
Pro x =... | #include <algorithm>
#include <iostream>
#include <string>
#define LEN 100000
using namespace std;
class Pro {
public:
string name;
int time;
};
class Que {
Pro p[100000];
public:
int head = 0, tail = 0, n;
void enqueue(Pro x) {
p[tail] = x;
tail = (tail + 1) % LEN;
}
Pro dequeue() {
Pro ... | [["-", 0, 353, 8, 123, 0, 124, 49, 80, 81, 22], ["+", 0, 353, 8, 123, 0, 124, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 107]] | 1 | 253 | 6 |
#include <algorithm>
#include <iostream>
#define LEN 100005
using namespace std;
//?????????????????¨????§???????
typedef struct pp {
char name[100];
int t;
} P;
P Q[LEN];
int head, tail, n;
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue() {
P ret = Q[head];
head = (head + 1) % LE... | #include <algorithm>
#include <iostream>
#define LEN 100005
using namespace std;
//?????????????????¨????§???????
typedef struct pp {
char name[100];
int t;
} P;
P Q[LEN];
int head, tail, n;
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue() {
P ret = Q[head];
head = (head + 1) % LE... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 28, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 17, 131], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 0, 9, 0... | 1 | 245 | 8 |
#include <bits/stdc++.h>
using namespace std;
typedef struct {
string name;
int time;
} P;
int main() {
int n, t;
queue<P> que; //キュー♂♂♂♂♂♂♂♂♂♂
string name;
int time;
cin >> n >> t;
for (int i = 0; i < n; i++) {
cin >> name >> time;
que.push((P){name, time});
}
int cnt = 0;
while (!que.em... | #include <bits/stdc++.h>
using namespace std;
typedef struct {
string name;
int time;
} P;
int main() {
int n, t;
queue<P> que; //キュー♂♂♂♂♂♂♂♂♂♂
string name;
int time;
cin >> n >> t;
for (int i = 0; i < n; i++) {
cin >> name >> time;
que.push((P){name, time});
}
int cnt = 0;
while (!que.em... | [["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]] | 1 | 175 | 4 |
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
queue<int> qi;
queue<string> qs;
int n, q, t;
string s;
cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> s >> t;
qs.push(s);
qi.push(t);
}
t = 0;
while (qi.size()) {
if (qi.front() > q) {
... | #include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
queue<int> qi;
queue<string> qs;
int n, q, t;
string s;
cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> s >> t;
qs.push(s);
qi.push(t);
}
t = 0;
while (qi.size()) {
if (qi.front() > q) {
... | [["+", 0, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 0, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 0, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]] | 1 | 182 | 6 |
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, a) repi(i, 0, a)
typedef std::pair<std::string, int> P;
int n, q;
std::queue<P> que;
int tim;
int main() {
std::cin >> n >> q;
rep(i, n) {
std::string s;
int t;
... | #include <iostream>
#include <queue>
#include <string>
#include <utility>
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, a) repi(i, 0, a)
typedef std::pair<std::string, int> P;
int n, q;
std::queue<P> que;
int tim;
int main() {
std::cin >> n >> q;
rep(i, n) {
std::string s;
int t;
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 22]] | 1 | 192 | 6 |
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define LEN 100005
using namespa... | #include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define LEN 100005
using namespa... | [["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151]] | 1 | 258 | 4 |
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
#define MAX_TASK_SIZE 100000
struct Task {
char name[100];
int time;
};
Task *Q[MAX_TASK_SIZE + 1];
int head, tail, n;
int elaps = 0;
void enqueue(Task *x) {
Q[tail] = x;
tail = (tail + 1) % MAX_TASK_SIZE;... | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
#define MAX_TASK_SIZE 100000
struct Task {
char name[100];
int time;
};
Task *Q[MAX_TASK_SIZE + 1];
int head, tail, n;
int elaps = 0;
void enqueue(Task *x) {
Q[tail] = x;
tail = (tail + 1) % MAX_TASK_SIZE;... | [["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 308 | 19 |
#include <iostream>
#include <queue>
#include <string>
int main() {
int n, q;
std::cin >> n >> q;
std::queue<std::pair<std::string, int>> Q;
for (int i = 0; i < n; ++i) {
std::string s;
int v;
std::cin >> s >> v;
Q.push(std::make_pair(s, v));
}
int time = 0;
while (!Q.empty()) {
... | #include <iostream>
#include <queue>
#include <string>
int main() {
int n, q;
std::cin >> n >> q;
std::queue<std::pair<std::string, int>> Q;
for (int i = 0; i < n; ++i) {
std::string s;
int v;
std::cin >> s >> v;
Q.push(std::make_pair(s, v));
}
int time = 0;
while (!Q.empty()) {
... | [["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]] | 1 | 208 | 2 |
#include <iostream>
typedef struct {
int time;
char name[10];
} process;
const int q_size = 100000;
process queues[q_size];
using namespace std;
int head = 0;
int tail = 0;
bool isEmpty() {
if (head == tail)
return true;
return false;
}
bool isFull() {
if (head == ((tail + 1) % q_size))
return t... | #include <iostream>
typedef struct {
int time;
char name[10];
} process;
const int q_size = 100000;
process queues[q_size];
using namespace std;
int head = 0;
int tail = 0;
bool isEmpty() {
if (head == tail)
return true;
return false;
}
bool isFull() {
if (head == ((tail + 1) % q_size))
return t... | [["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]] | 1 | 312 | 2 |
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
typedef struct {
char name[100];
int time;
} Px;
Px Q[100000];
int min(int a, int b) { return a < b ? a : b; }
int head, tail;
void enqueue(Px x) {
Q[tail] = x;
tail = (tail + 1) % 100000;
}
Px dequeue() {
Px x = Q[head];
... | #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
typedef struct {
char name[100];
int time;
} Px;
Px Q[100000];
int min(int a, int b) { return a < b ? a : b; }
int head, tail;
void enqueue(Px x) {
Q[tail] = x;
tail = (tail + 1) % 100000;
}
Px dequeue() {
Px x = Q[head];
... | [["-", 0, 1, 0, 16, 31, 16, 12, 118, 28, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 17, 131], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 246 | 4 |
#include <iostream>
#include <queue>
using namespace std;
struct elem {
int time;
string name;
};
int main() {
queue<elem> que;
int n, q, curtime = 0;
cin >> n >> q;
struct elem x;
for (int i = 0; i < n; i++) {
cin >> x.name >> x.time;
que.push(x);
}
while (!que.empty()) {
x = que.front();... | #include <iostream>
#include <queue>
using namespace std;
struct elem {
int time;
string name;
};
int main() {
queue<elem> que;
int n, q, curtime = 0;
cin >> n >> q;
struct elem x;
for (int i = 0; i < n; i++) {
cin >> x.name >> x.time;
que.push(x);
}
while (!que.empty()) {
x = que.front();... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 161 | 2 |
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
const int MAX = 100000;
typedef struct process {
string name;
int time;
} Process;
int head, tail;
Process q[MAX];
void initializa() { head = tail = 0; }
bool isEmpty() { return head == tail; }
bool isFull() { retu... | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
const int MAX = 100000;
typedef struct process {
string name;
int time;
} Process;
int head, tail;
Process q[MAX];
void initializa() { head = tail = 0; }
bool isEmpty() { return head == tail; }
bool isFull() { retu... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]] | 1 | 331 | 2 |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#define LEN 100005
#pragma warning(disable : 4996)
using namespace std;
typedef struct pp {
char name[100];
int t;
} P;
P Q[LEN];
int head, tail, n;
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue() {
P x = Q... | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#define LEN 100005
#pragma warning(disable : 4996)
using namespace std;
typedef struct pp {
char name[100];
int t;
} P;
P Q[LEN];
int head, tail, n;
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue() {
P x = Q... | [["+", 0, 16, 31, 16, 31, 16, 12, 103, 0, 104], ["+", 0, 16, 31, 16, 31, 16, 12, 103, 0, 125], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 257 | 4 |
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i =... | #include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i =... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]] | 1 | 283 | 6 |
#include <cstdlib>
#include <iostream>
#include <queue>
#include <string>
struct gay {
std::string taskname;
int tasktime;
};
int main() {
gay gay_meme;
std::queue<gay> G;
int n, q, b, ctime = 0;
std::string fag;
std::cin >> n >> q;
for (int i = 0; i < n; i++) {
std::cin >> fag >> b;
gay_meme.ta... | #include <cstdlib>
#include <iostream>
#include <queue>
#include <string>
struct gay {
std::string taskname;
int tasktime;
};
int main() {
gay gay_meme;
std::queue<gay> G;
int n, q, b, ctime = 0;
std::string fag;
std::cin >> n >> q;
for (int i = 0; i < n; i++) {
std::cin >> fag >> b;
gay_meme.ta... | [["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]] | 1 | 219 | 2 |
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
int n, q;
queue<pair<string, int>> Q;
string tmp_name;
int tmp_time;
cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> tmp_name >> tmp_time;
Q.push(make_pair(tmp_name, tmp_time));
}
pair<string, int> ... | #include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
int n, q;
queue<pair<string, int>> Q;
string tmp_name;
int tmp_time;
cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> tmp_name >> tmp_time;
Q.push(make_pair(tmp_name, tmp_time));
}
pair<string, int> ... | [["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]] | 1 | 170 | 4 |
#include <iostream>
#include <utility>
#define MAX 1001
using namespace std;
class Queue {
pair<string, int> q[MAX];
int head = 0;
int tail = MAX - 1;
public:
bool is_empty() {
int diff = tail - head;
if (diff == -1 || diff == MAX)
return true;
return false;
}
void enqueue(pair<string, i... | #include <iostream>
#include <utility>
#define MAX 100001
using namespace std;
class Queue {
pair<string, int> q[MAX];
int head = 0;
int tail = MAX - 1;
public:
bool is_empty() {
int diff = tail - head;
if (diff == -1 || diff == MAX)
return true;
return false;
}
void enqueue(pair<string,... | [["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 323 | 4 |
#include <iostream>
using namespace std;
#include <algorithm>
#include <string.h>
#define MAX 100000
int head, tail;
struct Proc {
string name;
int t;
};
Proc Q[MAX];
void enqueue(Proc x) {
Q[tail] = x;
tail = (tail + 1) % MAX;
}
Proc dequeue() {
Proc x = Q[head];
head = (head + 1) % MAX;
return x;
}
... | #include <iostream>
using namespace std;
#include <algorithm>
#include <string.h>
#define MAX 100000
int head, tail;
struct Proc {
string name;
int t;
};
Proc Q[MAX];
void enqueue(Proc x) {
Q[tail] = x;
tail = (tail + 1) % MAX;
}
Proc dequeue() {
Proc x = Q[head];
head = (head + 1) % MAX;
return x;
}
... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 218 | 4 |
#include <iostream>
#include <string>
using namespace std;
class Proc {
public:
string nam;
int tim;
Proc() {
nam = "";
tim = 0;
}
};
Proc Q[100001];
class Queue {
private:
int fp;
int rp;
public:
Queue() {
fp = 0;
rp = 0;
}
int next(int p) const { return (p + 1) % 100001; }
bool... | #include <iostream>
#include <string>
using namespace std;
class Proc {
public:
string nam;
int tim;
Proc() {
nam = "";
tim = 0;
}
};
Proc Q[100001];
class Queue {
private:
int fp;
int rp;
public:
Queue() {
fp = 0;
rp = 0;
}
int next(int p) const { return (p + 1) % 100001; }
bool... | [["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32]] | 1 | 368 | 2 |
#include <iostream>
#include <queue>
using namespace std;
int main() {
int n, q;
int a, time = 0;
string s;
queue<int> Q;
queue<string> name;
cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> s >> a;
Q.push(a);
name.push(s);
}
while (Q.empty() == false) {
a = Q.front();
s = na... | #include <iostream>
#include <queue>
using namespace std;
int main() {
int n, q;
int a, time = 0;
string s;
queue<int> Q;
queue<string> name;
cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> s >> a;
Q.push(a);
name.push(s);
}
while (Q.empty() == false) {
a = Q.front();
s = na... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13]] | 1 | 195 | 6 |
#include <iostream>
#include <map>
#include <queue>
#include <string>
#define f first
#define s second
using namespace std;
int main() {
string x;
int y;
int n, q, i, cnt = 0;
queue<pair<string, int>> a;
cin >> n >> q;
for (i = 0; i < n; i++) {
cin >> x >> y;
a.push(make_pair(x, y));
}
while (... | #include <iostream>
#include <map>
#include <queue>
#include <string>
#define f first
#define s second
using namespace std;
int main() {
string x;
int y;
int n, q, i, cnt = 0;
queue<pair<string, int>> a;
cin >> n >> q;
for (i = 0; i < n; i++) {
cin >> x >> y;
a.push(make_pair(x, y));
}
while (... | [["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]] | 1 | 187 | 2 |
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n, q;
cin >> n >> q;
queue<pair<string, int>> pr;
for (int i = 0; i < n; i++) {
string p;
int Q;
cin >> p >> Q;
pr.push(pair<string, int>(p, Q));
}
int c = 0;
while (!pr.empty()) {
pair<string, in... | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n, q;
cin >> n >> q;
queue<pair<string, int>> pr;
for (int i = 0; i < n; i++) {
string p;
int Q;
cin >> p >> Q;
pr.push(pair<string, int>(p, Q));
}
int c = 0;
while (!pr.empty()) {
pair<string, in... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]] | 1 | 181 | 2 |
#include <cstdlib>
#include <iostream>
#include <stdio.h>
using namespace std;
typedef struct {
char name[11] = "\0";
int time;
} P;
class Queue {
private:
int size;
P *queue;
int head = 0;
int tail = 0;
public:
Queue(int n);
void enqueue(P p);
void dequeue();
bool isEmpty();
P get();
void cl... | #include <cstdlib>
#include <iostream>
#include <stdio.h>
using namespace std;
typedef struct {
char name[11] = "\0";
int time;
} P;
class Queue {
private:
int size;
P *queue;
int head = 0;
int tail = 0;
public:
Queue(int n);
void enqueue(P p);
void dequeue();
bool isEmpty();
P get();
void cl... | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 0, 1, 0, 11, 12, 350, 49, 367, 368, 22], ["+", 0, 1, 0, 11, 12, 350, 49, 367, 368, 22]] | 1 | 354 | 4 |
#include <iostream>
#include <queue>
#include <string>
#include <utility>
using namespace std;
int main() {
queue<pair<string, int>> Q;
int n, q;
cin >> n >> q;
int elapsed = 0;
for (int i = 0; i < n; i++) {
string nm;
int t;
cin >> nm >> t;
Q.push(make_pair(nm, t));
}
while (Q.empty() =... | #include <iostream>
#include <queue>
#include <string>
#include <utility>
using namespace std;
int main() {
queue<pair<string, int>> Q;
int n, q;
cin >> n >> q;
int elapsed = 0;
for (int i = 0; i < n; i++) {
string nm;
int t;
cin >> nm >> t;
Q.push(make_pair(nm, t));
}
while (Q.empty() =... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 22]] | 1 | 180 | 6 |
#include <iostream>
#include <queue>
#include <string>
using namespace std;
struct Task {
string t_name;
int t_time;
};
int main(int argc, const char *argv[]) {
int n, q;
int time_count = 0;
cin >> n >> q;
queue<Task> qt;
while (n--) {
Task t;
cin >> t.t_name >> t.t_time;
qt.push(t);
}
... | #include <iostream>
#include <queue>
#include <string>
using namespace std;
struct Task {
string t_name;
int t_time;
};
int main(int argc, const char *argv[]) {
int n, q;
int time_count = 0;
cin >> n >> q;
queue<Task> qt;
while (n--) {
Task t;
cin >> t.t_name >> t.t_time;
qt.push(t);
}
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]] | 1 | 168 | 2 |
#define _CRT_SECURE_NO_WARNINGS
#include <cstdlib>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
struct Process {
Process(string _name, int _time) : name(_name), time(_time) {}
int time;
string name;
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
int q;
... | #define _CRT_SECURE_NO_WARNINGS
#include <cstdlib>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
struct Process {
Process(string _name, int _time) : name(_name), time(_time) {}
int time;
string name;
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
int q;
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 209 | 2 |
/*
???????????????????????????????????????¢??I
???????????????????\??????????????±??????????????????????I
*/
#define VERNIY \
st(); \
int ver = 0, niy = 0, hbk = 0
#includ... | /*
???????????????????????????????????????¢??I
???????????????????\??????????????±??????????????????????I
*/
#define VERNIY \
st(); \
int ver = 0, niy = 0, hbk = 0
#includ... | [["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 22]] | 1 | 852 | 2 |
#include <iostream>
#include <queue>
using namespace std;
main() {
queue<int> Q2;
queue<string> Q1;
int i, n, q, t, total = 0;
char st[10];
cin >> n;
cin >> q;
for (i = 0; i <= n - 1; i++) {
cin >> st;
Q1.push(st);
cin >> t;
Q2.push(t);
}
while (Q2.empty() != 1) {
if (Q2.front()... | #include <iostream>
#include <queue>
using namespace std;
main() {
queue<int> Q2;
queue<string> Q1;
int i, n, q, t, total = 0;
char st[10];
cin >> n;
cin >> q;
for (i = 0; i <= n - 1; i++) {
cin >> st;
Q1.push(st);
cin >> t;
Q2.push(t);
}
while (Q2.empty() != 1) {
if (Q2.front()... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]] | 1 | 201 | 6 |
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
queue<string> s0;
queue<int> s1;
int n, q;
cin >> n >> q;
for (int i = 0; i < n; i++) {
string word;
int k;
cin >> word >> k;
s0.push(word);
s1.push(k);
}
int t = 0;
while (!s1.empty()) {
in... |
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main() {
queue<string> s0;
queue<int> s1;
int n, q;
cin >> n >> q;
for (int i = 0; i < n; i++) {
string word;
int k;
cin >> word >> k;
s0.push(word);
s1.push(k);
}
int t = 0;
while (!s1.empty()) {
i... | [["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 17, 151]] | 1 | 172 | 4 |
#include <algorithm>
#include <cstring>
#include <iostream>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a... | #include <algorithm>
#include <cstring>
#include <iostream>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]] | 1 | 217 | 6 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, q;
queue<string> name;
queue<int> time;
cin >> n >> q;
string ntemp;
int ttemp;
for (int i = 0; i < n; i++) {
cin >> ntemp >> ttemp;
name.push(ntemp);
time.push(ttemp);
}
vector<string> nans;
vector<int> tans;
int t ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, q;
queue<string> name;
queue<int> time;
cin >> n >> q;
string ntemp;
int ttemp;
for (int i = 0; i < n; i++) {
cin >> ntemp >> ttemp;
name.push(ntemp);
time.push(ttemp);
}
vector<string> nans;
vector<int> tans;
int t ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]] | 1 | 247 | 6 |
#include <iostream>
#include <queue>
#include <string>
using namespace std;
class Process {
public:
string name;
int time;
Process(string n, int t) : name(n), time(t) {}
};
void output(string name, int time) {
cout << name << " " << time << endl;
return;
}
int main(void) {
// Input
int numData;
cin... | #include <iostream>
#include <queue>
#include <string>
using namespace std;
class Process {
public:
string name;
int time;
Process(string n, int t) : name(n), time(t) {}
};
void output(string name, int time) {
cout << name << " " << time << endl;
return;
}
int main(void) {
// Input
int numData;
cin... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 218 | 2 |
#include <iostream>
#include <queue>
#include <string>
using namespace std;
class Process {
public:
string name;
int time;
Process(string n, int t) : name(n), time(t) {}
};
void output(string name, int time) {
cout << name << " " << time << endl;
return;
}
int main(void) {
// Input
int numData;
cin... | #include <iostream>
#include <queue>
#include <string>
using namespace std;
/**
* @brief Process Class
*/
class Process {
public:
string name;
int time;
/* Constructor */
Process(string n, int t) : name(n), time(t) {}
};
/**
* @brief Result Output
* @param [in] name Process Name
* @param [in] time Proc... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 218 | 2 |
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
const int INF = 1001001000;
const int MOD = (int)1e9 + 7;
using ll = long long;
using namespace std;
int main() {
int n, q;
string name;
int t;
int t2 = 0;
pair<... | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
const int INF = 1001001000;
const int MOD = (int)1e9 + 7;
using ll = long long;
using namespace std;
int main() {
int n, q;
string name;
int t;
int t2 = 0;
pair<... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 217 | 2 |
#include <cstdio>
#include <iostream>
#define LEN 100005
using namespace std;
typedef struct {
char name[100];
int t;
} P;
P Q[LEN];
int head;
int tail;
int n;
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue() {
P x = Q[head];
head = (head + 1) % LEN;
return x;
}
int min(int a, in... | #include <cstdio>
#include <iostream>
#define LEN 100005
using namespace std;
typedef struct {
char name[100];
int t;
} P;
P Q[LEN];
int head;
int tail;
int n;
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue() {
P x = Q[head];
head = (head + 1) % LEN;
return x;
}
int min(int a, in... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 252 | 2 |
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <queue>
using namespace std;
struct p {
char name[11];
int time;
int num;
};
int n;
int q;
queue<p> P;
p que[100000];
void solve() {
int now = 0;
while (P.size()) {
p tmp = P.front();
P.pop();
if (tmp.time <= 100) {
now +=... | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <queue>
using namespace std;
struct p {
char name[11];
int time;
int num;
};
int n;
int q;
queue<p> P;
p que[100000];
void solve() {
int now = 0;
while (P.size()) {
p tmp = P.front();
P.pop();
if (tmp.time <= q) {
now += t... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22]] | 1 | 213 | 6 |
#include <iostream>
#include <queue>
using namespace std;
int main() {
int n, y, x;
string p;
int total = 0;
queue<int> myQueueNumbers;
queue<string> myQueueName;
cin >> n >> y;
for (int i = 0; i < n; i++) {
cin >> p;
cin >> x;
myQueueNumbers.push(x);
myQueueName.push(p);
}
while (!... | #include <iostream>
#include <queue>
using namespace std;
int main() {
int n, y, x;
string p;
int total = 0;
queue<int> myQueueNumbers;
queue<string> myQueueName;
cin >> n >> y;
for (int i = 0; i < n; i++) {
cin >> p;
cin >> x;
myQueueNumbers.push(x);
myQueueName.push(p);
}
while (!... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]] | 1 | 195 | 2 |
#include <queue>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct Process {
char name[10];
int time;
};
int main() {
int n, q;
scanf("%d", &n);
scanf("%d", &q);
Process process[n];
queue<Process> processList;
for (int i = 0; i < n; i++) {
scanf("%s", process[i].name);
scanf(... | #include <queue>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct Process {
char name[10];
int time;
};
int main() {
int n, q;
scanf("%d", &n);
scanf("%d", &q);
Process process[n];
queue<Process> processList;
for (int i = 0; i < n; i++) {
scanf("%s", process[i].name);
scanf(... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]] | 1 | 212 | 2 |
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
int main() {
string name;
int i, n, q, time, elapsedt = 0;
queue<pair<string, int>> que;
vector<pair<string, int>> ans;
pair<string, int> tmp;
cin >> n >> q;
for (i = 0; i < n; i++) {
cin >> name >> time;
... | #include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
int main() {
string name;
int i, n, q, time, elapsedt = 0;
queue<pair<string, int>> que;
vector<pair<string, int>> ans;
pair<string, int> tmp;
cin >> n >> q;
for (i = 0; i < n; i++) {
cin >> name >> time;
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 12, 13], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 22], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 22]] | 1 | 224 | 6 |
#include <cstdio>
#include <iostream>
#include <string.h>
#include <string>
using namespace std;
#define size 100005
typedef struct pu {
int time;
string name;
} P;
P Q[size];
int head, tail, n; //先頭尻尾、要素数
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % size;
}
P dequeue() {
P x = Q[head];
head = (h... | #include <cstdio>
#include <iostream>
#include <string.h>
#include <string>
using namespace std;
#define size 100005
typedef struct pu {
int time;
string name;
} P;
P Q[size];
int head, tail, n; //先頭尻尾、要素数
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % size;
}
P dequeue() {
P x = Q[head];
head = (h... | [["-", 0, 1, 0, 16, 31, 16, 12, 118, 28, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 17, 131], ["-", 0, 1, 0, 16, 31, 16, 12, 118, 119, 120], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 252 | 4 |
class DoublyLinkedList
def initialize
@head = nil
@size = 0
end
def insert(value)
if @head
new_entry = Entry.new(value, @head.prev, @head)
@head.prev = new_entry
@head.succ = new_entry if @size <= 1
@head = new_entry
else
@head = Entry.new(value, nil, nil)
@head.prev = @head
@head.succ... | class DoublyLinkedList
def initialize
@head = nil
@size = 0
end
def insert(value)
if @head
new_entry = Entry.new(value, @head.prev, @head)
@head.prev = new_entry
@head.succ = new_entry if @size <= 1
@head = new_entry
else
@head = Entry.new(value, nil, nil)
@head.prev = @head
@head.succ... | [["-", 8, 736, 0, 735, 8, 736, 0, 751, 8, 22], ["+", 0, 735, 8, 736, 0, 121, 64, 749, 0, 22], ["+", 8, 736, 0, 121, 64, 749, 0, 38, 0, 38], ["+", 8, 736, 0, 735, 8, 736, 0, 121, 0, 444]] | 4 | 355 | 4 |
# 双方向連結リスト | アルゴリズムとデータ構造 | Aizu Online Judge http://is.gd/5CIlit
n = gets.chomp.to_i
doubleLinkedList = Array.new
n.times do
command = gets.chomp
if command == "deleteFirst" then
doubleLinkedList.shift
elsif command == "deleteLast" then
doubleLinkedList.pop
else
command, x = command.split
x = x... | # 双方向連結リスト | アルゴリズムとデータ構造 | Aizu Online Judge http://is.gd/5CIlit
n = gets.chomp.to_i
doubleLinkedList = Array.new
n.times do
command = gets.chomp
if command == "deleteFirst" then
doubleLinkedList.shift
elsif command == "deleteLast" then
doubleLinkedList.pop
else
command, x = command.split
x = x... | [["+", 0, 121, 75, 759, 64, 749, 0, 751, 0, 121], ["+", 75, 759, 64, 749, 0, 751, 15, 748, 17, 111], ["+", 64, 749, 0, 751, 15, 748, 439, 652, 486, 22], ["+", 64, 749, 0, 751, 15, 748, 439, 652, 17, 131], ["+", 64, 749, 0, 751, 15, 748, 439, 652, 735, 22]] | 4 | 101 | 5 |
class List
def initialize
@head = Node.new
@tail = Node.new(@head)
@head.nxt = @tail
end
def insert(val)
nxt_old = @head.nxt
node = Node.new(@head, nxt_old, val)
@head.nxt = node
nxt_old.prv = node
end
def delete(val)
node = @head.nxt
while node.val
if node.val == v... | class List
def initialize
@head = Node.new
@tail = Node.new(@head)
@head.nxt = @tail
end
def insert(val)
nxt_old = @head.nxt
node = Node.new(@head, nxt_old, val)
@head.nxt = node
nxt_old.prv = node
end
def delete(val)
node = @head.nxt
while node.val
if node.val == v... | [["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 652, 486, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 0, 493, 0, 652, 3, 4, 0, 652, 735, 22]] | 4 | 323 | 4 |
n = gets.to_i
list = []
n.times do
cmd, num = gets.split
case cmd
when "insert"
list.unshift(num.to_i)
when "delete"
index = list.find_index { |i| i == num.to_i }
list.delete_at(index)
when "deleteLast"
list.pop
when "deleteFirst"
list.shift
end
end
puts list.join(" ") | n = gets.to_i
list = []
n.times do
cmd, num = gets.split
case cmd
when "insert"
list.unshift(num.to_i)
when "delete"
index = list.find_index { |i| i == num.to_i }
list.delete_at(index) unless index.nil?
when "deleteLast"
list.pop
when "deleteFirst"
list.shift
end
end
puts list.join(... | [["+", 0, 173, 0, 763, 8, 749, 0, 745, 0, 747], ["+", 0, 763, 8, 749, 0, 745, 15, 652, 486, 22], ["+", 0, 763, 8, 749, 0, 745, 15, 652, 17, 131], ["+", 0, 763, 8, 749, 0, 745, 15, 652, 735, 22]] | 4 | 84 | 4 |
n = gets.to_i
command_list = []
n.times do
command_list << gets.chomp.split
end
list = []
while command_list.length > 0
command = command_list.shift
if command[0] == "insert"
list << command[1].to_i
elsif command[0] == "delete"
x = list.rindex(command[1].to_i)
list.delete_at(x)
elsif command[0] =... | n = gets.to_i
command_list = []
n.times do
command_list << gets.chomp.split
end
list = []
while command_list.length > 0
command = command_list.shift
if command[0] == "insert"
list << command[1].to_i
elsif command[0] == "delete"
x = list.rindex(command[1].to_i)
if x
list.delete_at(x)
end
... | [["+", 0, 121, 75, 759, 64, 749, 0, 121, 0, 121], ["+", 0, 121, 75, 759, 64, 749, 0, 121, 15, 22], ["+", 0, 121, 75, 759, 64, 749, 0, 121, 0, 444]] | 4 | 118 | 3 |
#!/usr/bin/env ruby
n = gets.chomp.to_i
list = []
n.times do
action, num = gets.chomp.split
case action
when 'insert'
list.unshift(num.to_i)
when 'delete'
i = list.index(num.to_i)
list.delete_at(i) if i
when 'deleteFirst'
list.shift
when 'deleteLast'
list.pop
end
end
puts list.reve... | #!/usr/bin/env ruby
n = gets.chomp.to_i
list = []
n.times do
action, num = gets.chomp.split
case action
when 'insert'
list.unshift(num.to_i)
when 'delete'
i = list.index(num.to_i)
list.delete_at(i) if i
when 'deleteFirst'
list.shift
when 'deleteLast'
list.pop
end
end
puts list * ' ... | [["-", 0, 652, 3, 4, 0, 738, 31, 652, 17, 131], ["-", 0, 652, 3, 4, 0, 738, 31, 652, 735, 22]] | 4 | 85 | 2 |
n = gets.chomp.to_i
arr = Array.new
n.times do
order = gets.split(" ")
case order[0]
when "insert"
arr.unshift(order[1].to_i)
when "delete"
arr.index(order[1].to_i) == nil ? (next): (queue.delete_at(queue.index(order[1].to_i)))
when "deleteFirst"
arr.shift
when "deleteLast"
arr.... | n = gets.chomp.to_i
arr = Array.new
n.times do
order = gets.split(" ")
case order[0]
when "insert"
arr.unshift(order[1].to_i)
when "delete"
arr.index(order[1].to_i) == nil ? (next): (arr.delete_at(arr.index(order[1].to_i)))
when "deleteFirst"
arr.shift
when "deleteLast"
arr.pop
... | [["-", 8, 749, 0, 754, 75, 739, 0, 652, 486, 22], ["+", 8, 749, 0, 754, 75, 739, 0, 652, 486, 22], ["-", 75, 739, 0, 652, 3, 4, 0, 652, 486, 22], ["+", 75, 739, 0, 652, 3, 4, 0, 652, 486, 22]] | 4 | 142 | 4 |
array = Array.new
gets.to_i.times do
command = gets.chomp.split
case command[0]
when 'insert'
array.unshift(command[1].to_i)
when 'delete'
array.delete_at(array.index(command[1].to_i))
when 'deleteFirst'
array.shift
when 'deleteLast'
array.pop
end
end
puts array*' ' | array = Array.new
gets.to_i.times do
command = gets.chomp.split
case command[0]
when 'insert'
array.unshift(command[1].to_i)
when 'delete'
begin
array.delete_at(array.index(command[1].to_i))
rescue
end
when 'deleteFirst'
array.shift
when 'deleteLast'
array.pop
end
end
puts a... | [["+", 0, 173, 0, 763, 8, 749, 0, 756, 0, 756], ["+", 0, 763, 8, 749, 0, 756, 0, 764, 0, 764], ["+", 0, 173, 0, 763, 8, 749, 0, 756, 0, 444]] | 4 | 80 | 3 |
l = []
gets.to_i.times do
com, n = gets.split
case com
when 'insert'
l.unshift(n)
when 'delete'
i = l.index(n)
l.delete_at(i)
when 'deleteFirst'
l.shift
when 'deleteLast'
l.pop
end
end
puts l * ' ' | l = []
gets.to_i.times do
com, n = gets.split
case com
when 'insert'
l.unshift(n)
when 'delete'
i = l.index(n)
l.delete_at(i) unless i.nil?
when 'deleteFirst'
l.shift
when 'deleteLast'
l.pop
end
end
puts l * ' ' | [["+", 0, 173, 0, 763, 8, 749, 0, 745, 0, 747], ["+", 0, 763, 8, 749, 0, 745, 15, 652, 486, 22], ["+", 0, 763, 8, 749, 0, 745, 15, 652, 17, 131], ["+", 0, 763, 8, 749, 0, 745, 15, 652, 735, 22]] | 4 | 69 | 4 |
#include <iostream>
using namespace std;
class Node {
public:
Node *prev;
Node *next;
int data;
Node(int x = 0) {
prev = 0;
next = 0;
data = x;
}
};
class List {
private:
Node head;
Node tail;
public:
List() {
head.prev = &head;
head.next = &tail;
tail.prev = &head;
tail.... | #include <iostream>
using namespace std;
class Node {
public:
Node *prev;
Node *next;
int data;
Node(int x = 0) {
prev = 0;
next = 0;
data = x;
}
};
class List {
private:
Node head;
Node tail;
public:
List() {
head.prev = &head;
head.next = &tail;
tail.prev = &head;
tail.... | [["-", 0, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 60]] | 1 | 523 | 2 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node {
int key;
Node *prev, *next;
};
Node *nil;
void init() {
nil = (Node *)malloc(sizeof(Node));
nil->next = nil;
nil->prev = nil;
}
void insert(int key) {
Node *x = (Node *)malloc(sizeof(Node));
x->key = key;
x->next = nil->next;
... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node {
int key;
Node *prev, *next;
};
Node *nil;
void init() {
nil = (Node *)malloc(sizeof(Node));
nil->next = nil;
nil->prev = nil;
}
void insert(int key) {
Node *x = (Node *)malloc(sizeof(Node));
x->key = key;
x->next = nil->next;
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 46]] | 1 | 484 | 4 |
#include <stdio.h>
#include <stdlib.h>
int main() {
char **c;
int n, i, j, k, min = 0, max = 0, num;
int *h;
scanf("%d", &n);
h = (int *)malloc(n * sizeof(int));
c = (char **)malloc(n * sizeof(char));
for (i = 0; i < n; i++) {
c[i] = (char *)malloc(10 * sizeof(char));
}
for (i = 0; i < n; i++)... | #include <stdio.h>
#include <stdlib.h>
int main() {
char **c;
int n, i, j, k, min = 0, max = 0, num;
int *h;
scanf("%d", &n);
h = (int *)malloc(n * sizeof(int));
c = (char **)malloc(n * sizeof(char *));
for (i = 0; i < n; i++) {
c[i] = (char *)malloc(10 * sizeof(char));
}
for (i = 0; i < n; i+... | [["+", 0, 16, 12, 105, 39, 77, 49, 142, 0, 48]] | 0 | 351 | 1 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node {
int key;
struct node *prev, *next;
} Node;
Node *nil;
void Init() {
nil = (Node *)malloc(sizeof(Node));
nil->next = nil;
nil->prev = nil;
}
//?????°??????????????\??°??´????????????
void Insert(int key) {
Node *x = (Node *)... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node {
int key;
struct node *prev, *next;
} Node;
Node *nil;
void Init() {
nil = (Node *)malloc(sizeof(Node));
nil->next = nil;
nil->prev = nil;
}
//?????°??????????????\??°??´????????????
void Insert(int key) {
Node *x = (Node *)... | [["-", 15, 23, 0, 16, 31, 16, 31, 118, 17, 143], ["-", 15, 23, 0, 16, 31, 16, 31, 118, 119, 120]] | 0 | 479 | 2 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct List {
int key;
struct List *next, *prev;
} List;
List *head;
void init();
void listInsert(int);
List *listSearch(int);
void listDelete(List *);
void deleteFisrt();
void deleteLast();
void deleteKeyList(int);
void printList();
int main(vo... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct List {
int key;
struct List *next, *prev;
} List;
List *head;
void init();
void listInsert(int);
List *listSearch(int);
void listDelete(List *);
void deleteFisrt();
void deleteLast();
void deleteKeyList(int);
void printList();
int main(vo... | [["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 0 | 558 | 7 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct key_node_tag {
int key;
struct key_node_tag *prev;
struct key_node_tag *next;
} key_node_contents;
typedef struct {
key_node_contents dammy;
} key_list_contents;
typedef struct {
} * key_list;
key_list key_list_new() {
key_list_cont... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct key_node_tag {
int key;
struct key_node_tag *prev;
struct key_node_tag *next;
} key_node_contents;
typedef struct {
key_node_contents dammy;
} key_list_contents;
typedef struct {
} * key_list;
key_list key_list_new() {
key_list_cont... | [["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 0 | 728 | 7 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//ノード
struct node {
unsigned int key;
struct node *next; //ノードの接続先
struct node *prev; //ノードの接続元
};
typedef struct node *NodePointer;
//ノード列
NodePointer nil;
NodePointer listSearch(int key) { /* your code */ }
// nilの初期化
void init() {
nil = malloc(s... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
//ノード
struct node {
unsigned int key;
struct node *next; //ノードの接続先
struct node *prev; //ノードの接続元
};
typedef struct node *NodePointer;
//ノード列
NodePointer nil;
NodePointer listSearch(int key) { /* your code */ }
// nilの初期化
void init() {
nil = malloc(s... | [["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]] | 0 | 560 | 2 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
unsigned int key;
struct node *next;
struct node *prev;
};
typedef struct node *NodePointer;
NodePointer nil;
NodePointer listSearch(int key) { /* your code */ }
void init() {
nil = malloc(sizeof(struct node));
nil->next = nil;
ni... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
unsigned int key;
struct node *next;
struct node *prev;
};
typedef struct node *NodePointer;
NodePointer nil;
NodePointer listSearch(int key) { /* your code */ }
void init() {
nil = malloc(sizeof(struct node));
nil->next = nil;
ni... | [["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]] | 0 | 532 | 2 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
int key;
struct node *next;
struct node *prev;
};
typedef struct node *NodePointer;
NodePointer nil;
void insert(int key);
int delete (int key);
int deleteFirst();
int deleteLast();
void init();
main() {
int n, i, keydata;
char com[1... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
int key;
struct node *next;
struct node *prev;
};
typedef struct node *NodePointer;
NodePointer nil;
void insert(int key);
int delete (int key);
int deleteFirst();
int deleteLast();
void init();
main() {
int n, i, keydata;
char com[1... | [["-", 0, 57, 15, 23, 0, 16, 12, 144, 0, 145], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22]] | 0 | 491 | 2 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
unsigned int key;
struct node *next;
struct node *prev;
};
typedef struct node *NodePointer;
NodePointer nil;
NodePointer listSearch(int key) {
NodePointer a;
for (a = nil->next; a != nil; a = a->next) {
if (a->key == key)
... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
unsigned int key;
struct node *next;
struct node *prev;
};
typedef struct node *NodePointer;
NodePointer nil;
NodePointer listSearch(int key) {
NodePointer a;
for (a = nil->next; a != nil; a = a->next) {
if (a->key == key)
... | [["+", 0, 14, 8, 9, 0, 37, 0, 144, 0, 145]] | 0 | 525 | 1 |
#include <algorithm>
#include <iostream>
#include <list>
#include <string>
int main() {
std::list<int> lst;
std::string str;
int n;
int tmp;
std::cin >> n;
for (int i = 0; i < n; i++) {
std::cin >> str;
if (str == "insert") {
std::cin >> tmp;
lst.push_front(tmp);
} else if (str == "d... | #include <algorithm>
#include <iostream>
#include <list>
#include <string>
int main() {
std::list<int> lst;
std::string str;
int n;
int tmp;
std::cin >> n;
for (int i = 0; i < n; i++) {
std::cin >> str;
if (str == "insert") {
std::cin >> tmp;
lst.push_front(tmp);
} else if (str == "d... | [["-", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6], ["+", 0, 57, 15, 339, 51, 16, 12, 5, 0, 6]] | 1 | 242 | 2 |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>
using namespace std;
class mp {
public:
struct Node {
int key;
Node *prev, *next;
};
Node *nil;
mp() {
nil = (Node *)malloc(sizeof(Node));
nil->next = nil;
nil->prev = nil;
}
void insert(int key) {
Node *x = (No... | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>
using namespace std;
class mp {
public:
struct Node {
int key;
Node *prev, *next;
};
Node *nil;
mp() {
nil = (Node *)malloc(sizeof(Node));
nil->next = nil;
nil->prev = nil;
}
void insert(int key) {
Node *x = (No... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 1 | 510 | 2 |
#include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;
struct Node {
int key;
Node *prev;
Node *next;
Node(int key) : key(key) {}
};
class DoublyLinkedList {
public:
Node *nil;
void insert(Node *x) {
x->next = nil->next;
nil->next->prev = x;
nil->next = x;
x->prev =... | #include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;
struct Node {
int key;
Node *prev;
Node *next;
Node(int key) : key(key) {}
};
class DoublyLinkedList {
public:
Node *nil;
void insert(Node *x) {
x->next = nil->next;
nil->next->prev = x;
nil->next = x;
x->prev =... | [["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 472 | 7 |
#include <iostream>
#include <queue>
#include <stack>
#include <string>
using namespace std;
int main() {
string fields;
getline(cin, fields);
stack<int> st;
deque<pair<int, int>> areas;
int pool, sum = 0;
for (int i = 0; i < fields.length(); i++) {
if ('\\' == fields[i]) {
st.push(i);
} e... | #include <iostream>
#include <queue>
#include <stack>
#include <string>
using namespace std;
int main() {
string fields;
getline(cin, fields);
stack<int> st;
deque<pair<int, int>> areas;
int pool, sum = 0;
for (int i = 0; i < fields.length(); i++) {
if ('\\' == fields[i]) {
st.push(i);
} e... | [["+", 75, 76, 0, 9, 0, 1, 0, 16, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151]] | 1 | 322 | 2 |
#include <algorithm>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define MAX_L (20010)
int main() {
stack<int> S1;
stack<pair<int, int>> S2;
char s[MAX_L];
int size = 0;
vector<int> ans;
int total = 0;
scanf("%s", s);
while (s[size] != '0') {
size+... | #include <algorithm>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
#define MAX_L (20010)
int main() {
stack<int> S1;
stack<pair<int, int>> S2;
char s[MAX_L];
int size = 0;
vector<int> ans;
int total = 0;
scanf("%s", s);
while (s[size] != 0) {
size++;... | [["-", 0, 52, 15, 339, 51, 16, 12, 103, 0, 104]] | 1 | 340 | 2 |
#include <algorithm>
#include <iostream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
stack<long> S1, ans;
stack<pair<long, long>> S2;
char ch;
long sum = 0;
for (long i = 0; cin >> ch; i++) {
if (ch == '\\')
S1.push(i);
else if (ch == '/' && S1.size() ... | #include <algorithm>
#include <iostream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
stack<long> S1, ans;
stack<pair<long, long>> S2;
char ch;
long sum = 0;
for (long i = 0; cin >> ch; i++) {
if (ch == '\\')
S1.push(i);
else if (ch == '/' && S1.size() ... | [["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 259 | 2 |
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
void show(vector<pair<int, int>> ponds) {
int sum = 0;
for (unsigned int i = 0; i < ponds.size(); i++) {
sum += ponds[i].first;
}
cout << sum << endl << ponds.size() << flush;
for (unsigned int i = 0; i <... | #include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
void show(vector<pair<int, int>> ponds) {
int sum = 0;
for (unsigned int i = 0; i < ponds.size(); i++) {
sum += ponds[i].first;
}
cout << sum << endl << ponds.size() << flush;
for (unsigned int i = 1; i <... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 292 | 4 |
#include <iostream>
#include <stack>
#include <utility>
using namespace std;
void Output(stack<pair<int, int>> lake) {
stack<pair<int, int>> res_lake;
int lake_sum = 0;
int n = lake.size();
for (int i = 0; i < n; i++) {
lake_sum += lake.top().first;
res_lake.push(lake.top());
lake.pop();
}
co... | #include <iostream>
#include <stack>
#include <utility>
using namespace std;
void Output(stack<pair<int, int>> lake) {
stack<pair<int, int>> res_lake;
int lake_sum = 0;
int n = lake.size();
for (int i = 0; i < n; i++) {
lake_sum += lake.top().first;
res_lake.push(lake.top());
lake.pop();
}
co... | [["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22]] | 1 | 358 | 2 |
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <istream>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
//--------------------... | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <istream>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
//--------------------... | [["-", 8, 9, 0, 1, 0, 11, 12, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 11, 12, 118, 119, 120]] | 1 | 304 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.