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 int64 0 100 | memory stringlengths 4 6 | code_size int64 15 14.7k | code stringlengths 15 14.7k | problem_id stringlengths 6 6 | problem_description stringlengths 358 9.83k | input stringlengths 2 4.87k | output stringclasses 807
values | __index_level_0__ int64 1.1k 1.22M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s601840083 | p00013 | u957840591 | 1482722157 | Python | Python3 | py | Accepted | 20 | 7652 | 186 | import sys
a=[]
stack=[]
for line in sys.stdin:
a.append(int(line))
for i in range(len(a)):
if a[i]==0:
print(stack[-1])
del stack[-1]
else:stack.append(a[i]) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,702 |
s749155058 | p00013 | u078042885 | 1484113894 | Python | Python3 | py | Accepted | 20 | 7656 | 98 | a=[]
while 1:
try:n=int(input())
except:break
if n:a.append(n)
else:print(a.pop()) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,703 |
s656472286 | p00013 | u711765449 | 1484411513 | Python | Python3 | py | Accepted | 30 | 7628 | 282 | # -*- coding:utf-8 -*-
array = []
while True:
try:
n = int(input())
array.append(n)
except EOFError:
break
data = []
for i in range(len(array)):
if array[i] == 0:
elm = data.pop()
print(elm)
else:
data.append(array[i]) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,704 |
s036501949 | p00013 | u252414452 | 1486040203 | Python | Python | py | Accepted | 10 | 6364 | 163 | import sys
cars = []
while True:
n = sys.stdin.readline()
if not n: break
n = int(n.rstrip())
if n == 0:
print(cars.pop())
else:
cars.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,705 |
s692595662 | p00013 | u901080241 | 1488959021 | Python | Python3 | py | Accepted | 30 | 7500 | 133 | import sys
arr = []
for line in sys.stdin:
n = int(line)
if n == 0:
print(arr.pop())
else:
arr.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,706 |
s485965605 | p00013 | u897625141 | 1489971198 | Python | Python3 | py | Accepted | 30 | 7416 | 240 | array = []
array2 = []
import sys
for i in sys.stdin.readlines():
n = i.rstrip()
if n == "0":
array2.append(array[-1])
array.pop(-1)
else:
array.append(n)
for i in range(len(array2)):
print(array2[i]) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,707 |
s023838320 | p00013 | u797673668 | 1490622925 | Python | Python3 | py | Accepted | 30 | 7536 | 153 | buf = []
while True:
try:
car = int(input())
except:
break
if car:
buf.append(car)
else:
print(buf.pop()) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,708 |
s299099783 | p00013 | u728901930 | 1490785653 | Python | Python3 | py | Accepted | 20 | 7548 | 189 | import sys
import math as mas
a=[]
for t in sys.stdin:
i=int(t)
if i:a.append(i)
else:
print(a[-1])
a.pop()
#for i in sys.stdin:
# a,b=map(int,i.split())
# print(gcd(a,b),lcm(a,b)) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,709 |
s420217556 | p00013 | u462831976 | 1492707730 | Python | Python3 | py | Accepted | 20 | 7560 | 180 | # -*- coding: utf-8 -*-
import sys
import os
import math
stack = []
for s in sys.stdin:
v = int(s)
if v == 0:
print(stack.pop())
else:
stack.append(v) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,710 |
s749274382 | p00013 | u868716420 | 1493859381 | Python | Python3 | py | Accepted | 30 | 7564 | 184 | from sys import stdin
from collections import deque
box = deque()
for _, train in enumerate(stdin) :
if train.strip() != '0' : box.append(train.strip())
else : print(box.pop()) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,711 |
s252183342 | p00013 | u618637847 | 1494898282 | Python | Python3 | py | Accepted | 10 | 7432 | 177 | list = []
while True:
try:
num = int(input())
if num == 0:
print(list.pop())
else:
list.append(num)
except:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,712 |
s650803158 | p00013 | u151242583 | 1496025277 | Python | Python3 | py | Accepted | 20 | 7336 | 209 | import sys
shako = []
s = sys.stdin.read().strip().split("\n")
for i in s:
if i != "0":
# print("appended",i)
shako.append(i)
# print(shako)
else:
print(shako.pop()) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,713 |
s049196748 | p00013 | u151242583 | 1496025366 | Python | Python3 | py | Accepted | 30 | 7324 | 209 | import sys
shako = []
s = sys.stdin.read().strip().split("\n")
for i in s:
if i != "0":
# print("appended",i)
shako.append(i)
# print(shako)
else:
print(shako.pop()) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,714 |
s161326551 | p00013 | u905313459 | 1496402307 | Python | Python3 | py | Accepted | 20 | 7652 | 126 | import sys
l = []
for line in sys.stdin:
v = int(line)
if v != 0:
l.append(v)
else:
print(l.pop()) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,715 |
s282388337 | p00013 | u519227872 | 1496934473 | Python | Python3 | py | Accepted | 30 | 7608 | 157 | from sys import stdin
stack = []
for line in stdin:
line = int(line)
if line == 0:
print(stack.pop(0))
else:
stack.insert(0,line) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,716 |
s946926188 | p00013 | u354053070 | 1501928543 | Python | Python3 | py | Accepted | 20 | 7628 | 125 | import sys
cars = []
for i in sys.stdin:
if int(i) == 0:
print(cars.pop())
else:
cars.append(int(i)) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,717 |
s132878702 | p00013 | u821624310 | 1502604936 | Python | Python3 | py | Accepted | 20 | 7568 | 134 | import fileinput
a = []
for n in fileinput.input():
n = int(n)
if n == 0:
print(a.pop())
else:
a.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,718 |
s482296880 | p00013 | u584777171 | 1503145613 | Python | Python3 | py | Accepted | 20 | 7644 | 200 | import sys
cars = []
num = -1
for user in sys.stdin:
i = int(user)
if i == 0:
print(cars[num])
cars.pop(num)
num -= 1
else:
cars.append(i)
num += 1 | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,719 |
s119320604 | p00013 | u546285759 | 1503899889 | Python | Python3 | py | Accepted | 20 | 7592 | 173 | tracks = []
while True:
try:
c_num = int(input())
except:
break
if c_num == 0:
print(tracks.pop())
else:
tracks.append(c_num) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,720 |
s433075509 | p00013 | u855694108 | 1504146384 | Python | Python3 | py | Accepted | 20 | 7540 | 227 | import sys
def main():
a = []
for line in sys.stdin:
hoge = int(line)
if hoge != 0:
a.append(hoge)
elif hoge == 0:
print(a.pop(-1))
if __name__ == "__main__":
main() | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,721 |
s351498701 | p00013 | u957021183 | 1504764054 | Python | Python3 | py | Accepted | 30 | 7616 | 309 | # Aizu Problem 0013: Switching Railroad Cars
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
stack = []
for line in sys.stdin:
n = int(line)
if n == 0:
print(stack.pop())
else:
stack.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,722 |
s830657420 | p00013 | u299798926 | 1505393160 | Python | Python3 | py | Accepted | 20 | 7556 | 266 | stack=[]
i=0
x=int(input())
stack.append(x)
while 1:
try:
x=int(input())
if (x==0):
print(stack[i])
stack.pop()
i-=1
else:
stack.append(x)
i+=1
except EOFError:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,723 |
s746949425 | p00013 | u197615397 | 1506222905 | Python | Python3 | py | Accepted | 50 | 7528 | 129 | import sys
data = []
for l in sys.stdin:
l = int(l)
if l == 0:
print(data.pop())
else:
data.append(l) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,724 |
s502635954 | p00013 | u926657458 | 1509306335 | Python | Python3 | py | Accepted | 30 | 7328 | 185 | import sys
d = sys.stdin.readline().rstrip()
stack = list()
while d:
if d != '0':
stack.append(d)
else:
print(stack.pop())
d = sys.stdin.readline().rstrip() | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,725 |
s779417799 | p00013 | u917432951 | 1511334362 | Python | Python3 | py | Accepted | 50 | 7704 | 189 | import sys
if __name__ == '__main__':
a = []
for tmpLine in sys.stdin:
x = (int)(tmpLine)
if x != 0:
a.append(x)
else:
print(a.pop()) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,726 |
s258080880 | p00013 | u424041287 | 1512106995 | Python | Python3 | py | Accepted | 20 | 5600 | 239 | t = 0
numbers = []
while t == 0:
try:
number = int(input())
except:
break
else:
if number == 0:
print(numbers[-1])
numbers.pop(-1)
else:
numbers.append(number) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,727 |
s594501694 | p00013 | u548155360 | 1512397277 | Python | Python3 | py | Accepted | 20 | 5596 | 296 | # coding=utf-8
if __name__ == '__main__':
train_list = []
while True:
try:
n = int(input())
except EOFError:
break
if n == 0:
leaving = train_list.pop()
print(leaving)
else:
train_list.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,728 |
s319827203 | p00013 | u205327055 | 1512999737 | Python | Python | py | Accepted | 0 | 4636 | 211 | # coding:utf-8
syako = []
try:
while True:
number = int(raw_input())
if number != 0:
syako.append(number)
elif number == 0:
print syako.pop()
except:
pass | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,729 |
s313189852 | p00013 | u203261375 | 1513428488 | Python | Python | py | Accepted | 10 | 4636 | 175 | arr = []
while True:
try:
n = int(input())
except:
break
if n == 0:
print(arr[-1])
arr = arr[:-1]
else:
arr.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,730 |
s060246655 | p00013 | u600263347 | 1514546363 | Python | Python3 | py | Accepted | 20 | 5588 | 310 | def main():
_Stack = []
while True:
try:
n = int(input())
if n == 0:
print(_Stack.pop())
continue
else:
_Stack.append(n)
except EOFError:
break
if __name__ == '__main__':
main() | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,731 |
s167112578 | p00013 | u028347703 | 1514624916 | Python | Python3 | py | Accepted | 20 | 5592 | 175 | import sys
stack = []
for line in sys.stdin:
try:
train = int(line)
if train == 0:
print(stack.pop())
else:
stack.append(train)
except:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,732 |
s016297792 | p00013 | u585035894 | 1514627434 | Python | Python3 | py | Accepted | 20 | 5592 | 120 | import sys
s = []
for i in map(int, sys.stdin):
if i:
s.insert(len(s), i)
else:
print(s.pop()) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,733 |
s708664948 | p00013 | u764789069 | 1515084530 | Python | Python | py | Accepted | 10 | 4636 | 268 | i= 0
a,b = [],[]
while True:
try:
a.append(int(raw_input()))
if a[i] == 0:
b.append(a[i-1])
a.pop()
print a[i-1]
a.pop()
i -=1
else:
i +=1
except:
break
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,734 |
s291667571 | p00013 | u024715419 | 1515131620 | Python | Python3 | py | Accepted | 20 | 5588 | 182 | stack = []
while True:
try:
car = int(input())
if car == 0:
print(stack.pop())
else:
stack.append(car)
except:
break
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,735 |
s544421153 | p00013 | u846136461 | 1516238036 | Python | Python | py | Accepted | 10 | 4656 | 396 | # coding: utf-8
class Stack(object):
maxnum = 100
array = []
for i in range(100):
array.append(0)
index = 0
def push(self, data):
self.array[self.index] = data
self.index += 1
def pop(self):
print(self.array[self.index-1])
self.index -= 1
road = Stack()
while True:
try:
num = int(raw_input())
if ... | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,736 |
s134706430 | p00013 | u546285759 | 1516338171 | Python | Python3 | py | Accepted | 20 | 5584 | 166 | stack = []
while True:
try:
num = int(input())
except:
break
if num == 0:
print(stack.pop())
else:
stack.append(num)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,737 |
s906586245 | p00013 | u043254318 | 1516461445 | Python | Python3 | py | Accepted | 20 | 5592 | 317 | def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
N = list(get_input())
stack = []
for l in range(len(N)):
a = int(N[l])
if a == 0:
print(stack.pop())
#print("POP")
else:
#print(a)
stack.append(a)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,738 |
s600820063 | p00013 | u150984829 | 1516790448 | Python | Python3 | py | Accepted | 20 | 5592 | 82 | import sys
a=[]
for e in map(int,sys.stdin):
a.append(e)if e else print(a.pop())
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,739 |
s434141259 | p00013 | u150984829 | 1516790587 | Python | Python3 | py | Accepted | 20 | 5584 | 84 | a=[]
while 1:
try:n=int(input());a.append(n)if n else print(a.pop())
except:break
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,740 |
s958340043 | p00013 | u150984829 | 1517404887 | Python | Python3 | py | Accepted | 20 | 5592 | 80 | import sys
a=[]
for e in map(int,sys.stdin):a.append(e)if e else print(a.pop())
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,741 |
s669783215 | p00013 | u166871988 | 1523715828 | Python | Python3 | py | Accepted | 20 | 5600 | 221 | c=[]
s=[]
e=[]
while True:
try:
t=input()
if not t:break
except:break
c.append(int(t))
for i in c:
if i==0:
e.append(s.pop(-1))
else:
s.append(i)
[print(i) for i in e]
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,742 |
s546529392 | p00013 | u352394527 | 1523861152 | Python | Python3 | py | Accepted | 20 | 5584 | 143 | st = []
while True:
try:
n = int(input())
if n == 0:
print(st.pop())
else:
st.append(n)
except EOFError:
break
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,743 |
s186146351 | p00013 | u606460153 | 1523883577 | Python | Python3 | py | Accepted | 20 | 5592 | 152 | li = []
while True:
try:
x = int(input())
except:
break
if x == 0:
print(li.pop())
else:
li.append(x)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,744 |
s856427220 | p00013 | u503263570 | 1525618633 | Python | Python3 | py | Accepted | 20 | 5600 | 110 | import sys
a=[int(i)for i in sys.stdin]
b=[]
for j in a:
if j == 0:
print(b.pop())
else:
b.append(j)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,745 |
s699137194 | p00013 | u503263570 | 1525618723 | Python | Python3 | py | Accepted | 20 | 5600 | 109 | import sys
a=[int(i)for i in sys.stdin]
b=[]
for j in a:
if j == 0:
print(b.pop())
else:
b.append(j)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,746 |
s889791759 | p00013 | u724548524 | 1525745856 | Python | Python3 | py | Accepted | 20 | 5600 | 91 | import sys
s = []
[print(s.pop()) if int(e) == 0 else s.append(int(e)) for e in sys.stdin]
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,747 |
s648485836 | p00013 | u306037418 | 1525946446 | Python | Python3 | py | Accepted | 20 | 5588 | 140 | import sys
queue = []
for line in sys.stdin:
n = int(line)
if n != 0:
queue.append(n)
else:
print(queue.pop())
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,748 |
s704643218 | p00013 | u136916346 | 1527360218 | Python | Python3 | py | Accepted | 20 | 5588 | 123 | import sys
l=[]
for line in sys.stdin:
o=int(line)
if not o:
print(l.pop())
else:
l.append(o)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,749 |
s731743285 | p00013 | u847467233 | 1528545041 | Python | Python3 | py | Accepted | 20 | 5592 | 583 | # AOJ 0013 Switching Railroad Cars
# Python3 2018.6.9 bal4u
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
re... | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,750 |
s836617781 | p00013 | u536280367 | 1529762986 | Python | Python | py | Accepted | 10 | 4632 | 209 | import sys
if __name__ == '__main__':
stack = []
for line in sys.stdin:
n = int(line)
if n == 0:
print(stack.pop(len(stack) - 1))
else:
stack.append(n)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,751 |
s424541621 | p00013 | u017525488 | 1350107479 | Python | Python | py | Accepted | 10 | 4208 | 199 | import sys
lst = []
for line in sys.stdin:
if line:
num = line.strip()
if num == "0":
print(str(lst.pop()) + "")
else:
lst.append(num)
sys.exit(0) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,752 |
s826848580 | p00013 | u017525488 | 1350107566 | Python | Python | py | Accepted | 10 | 4204 | 180 | import sys
lst = []
for line in sys.stdin:
# if line:
num = line.strip()
if num == "0":
print(str(lst.pop()) + "")
else:
lst.append(num)
sys.exit(0) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,753 |
s123274518 | p00013 | u017525488 | 1350107751 | Python | Python | py | Accepted | 10 | 4196 | 161 | import sys
lst = []
for line in sys.stdin:
num = line.strip()
if num == "0":
print(lst.pop() + "")
else:
lst.append(num)
sys.exit(0) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,754 |
s185962512 | p00013 | u017525488 | 1350107802 | Python | Python | py | Accepted | 10 | 4200 | 155 | import sys
lst = []
for line in sys.stdin:
num = line.strip()
if num == "0":
print lst.pop()
else:
lst.append(num)
sys.exit(0) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,755 |
s736982777 | p00013 | u017525488 | 1350107834 | Python | Python | py | Accepted | 20 | 4196 | 143 | import sys
lst = []
for line in sys.stdin:
num = line.strip()
if num == "0":
print lst.pop()
else:
lst.append(num) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,756 |
s853909036 | p00013 | u017525488 | 1350108200 | Python | Python | py | Accepted | 10 | 4204 | 188 | import sys
lst = []
for line in sys.stdin:
if line.strip() :
num = int(line.strip())
if num == 0:
print lst.pop()
else:
lst.append(num) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,757 |
s442893968 | p00013 | u719737030 | 1351125530 | Python | Python | py | Accepted | 10 | 4200 | 173 | import sys
def clearSpace(s):
s.pop()
return s
list=[]
for i in sys.stdin:
if i.strip() != '0':
list.append(i.strip())
else:
print list.pop() | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,758 |
s904120833 | p00013 | u719737030 | 1351125652 | Python | Python | py | Accepted | 20 | 4196 | 129 | import sys
list=[]
for i in sys.stdin:
if i.strip() != '0':
list.append(i.strip())
else:
print list.pop() | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,759 |
s685765914 | p00013 | u647766105 | 1351611365 | Python | Python | py | Accepted | 10 | 4200 | 181 | import sys
stack=[]
for i in sys.stdin:
try:
a=int(i)
if a >0 :
stack.append(a)
else :
print stack.pop()
except:
pass | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,760 |
s702641892 | p00013 | u779627195 | 1352549335 | Python | Python | py | Accepted | 10 | 5440 | 241 | tracks = []
while 1:
try:
c0 = raw_input()
if c0 == '':
break
c = int(c0)
if c == 0:
print tracks.pop()
else:
tracks.append(c)
except EOFError:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,761 |
s646185020 | p00013 | u280179677 | 1355403066 | Python | Python | py | Accepted | 10 | 4988 | 250 | stack = []
def datasets():
import sys
while True:
s = sys.stdin.readline()
if len(s) < 2:
break
yield int(s)
for n in datasets():
if n == 0:
print stack.pop()
else:
stack.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,762 |
s060197869 | p00013 | u419407022 | 1356037687 | Python | Python | py | Accepted | 10 | 4600 | 235 | from collections import deque
garage = deque()
while True:
try:
came = int(raw_input())
if came == 0:
print garage.pop()
else:
garage.append(came)
except ValueError:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,763 |
s692526933 | p00013 | u126791750 | 1357122957 | Python | Python | py | Accepted | 10 | 4200 | 136 | l = []
while True:
try:
train = raw_input()
if train == '0':
print(l.pop())
else:
l.append(train)
except EOFError:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,764 |
s529263357 | p00013 | u894941280 | 1357418779 | Python | Python | py | Accepted | 10 | 4208 | 184 | ans = []
while True:
try:
a = input()
if a != 0: ans.append(a)
elif a == 0:
print ans[-1]
del ans[-1]
except EOFError: break
except SyntaxError: continue | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,765 |
s352710407 | p00013 | u560838141 | 1357483501 | Python | Python | py | Accepted | 20 | 4204 | 127 | stack = [];
while True:
try:
n = input();
if (n == 0):
print stack.pop()
else:
stack.append(n);
except:
break; | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,766 |
s293760606 | p00013 | u560838141 | 1357483565 | Python | Python | py | Accepted | 10 | 4200 | 127 | stack = [];
while True:
try:
n = input();
if (n == 0):
print stack.pop()
else:
stack.append(n);
except:
break; | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,767 |
s010527649 | p00013 | u560838141 | 1357517664 | Python | Python | py | Accepted | 20 | 4208 | 184 | ans = []
while True:
try:
a = input()
if a != 0: ans.append(a)
elif a == 0:
print ans[-1]
del ans[-1]
except EOFError: break
except SyntaxError: continue | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,768 |
s786310164 | p00013 | u782850731 | 1362068216 | Python | Python | py | Accepted | 10 | 4212 | 284 | from __future__ import (division, absolute_import, print_function,
unicode_literals)
from sys import stdin
L = []
for line in stdin:
if not line.strip():
continue
n = int(line)
if not n:
print(L.pop())
else:
L.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,769 |
s275335463 | p00013 | u282635979 | 1363415573 | Python | Python | py | Accepted | 10 | 4216 | 234 | bottom = []
exits = []
while True:
carnum = raw_input()
if carnum == '':
break
elif carnum == '0':
exits.append(bottom[0])
del bottom[0]
continue
else:
bottom.insert(0,int(carnum))
continue
for val in exits:
print val | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,770 |
s742971604 | p00013 | u542421762 | 1368174642 | Python | Python | py | Accepted | 10 | 4196 | 195 | import sys
#input_file = open(sys.argv[1], "r")
stack = []
#for n in input_file:
for n in sys.stdin:
n = int(n)
if n == 0:
print stack.pop()
else:
stack.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,771 |
s332131220 | p00013 | u350508326 | 1368347613 | Python | Python | py | Accepted | 10 | 4204 | 203 | list = []
while True:
try:
a = int(raw_input()
)
if a != 0:
list.append(a)
else:
b = list.pop()
print b
except EOFError:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,772 |
s727174867 | p00013 | u912237403 | 1377411346 | Python | Python | py | Accepted | 20 | 4196 | 128 | x=[]
while True:
try:
n = input()
if n==0: print x.pop()
else: x.append(n)
except:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,773 |
s385854866 | p00013 | u454358619 | 1378179946 | Python | Python | py | Accepted | 10 | 4200 | 113 | import sys
s = []
for line in sys.stdin:
t = int(line)
if t == 0:
print s.pop()
else:
s.append(t) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,774 |
s255848205 | p00013 | u813384600 | 1379496326 | Python | Python | py | Accepted | 10 | 4204 | 187 | stack = []
while True:
try:
n = int(raw_input())
if n == 0:
print stack.pop()
else:
stack.append(n)
except EOFError:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,775 |
s363210358 | p00013 | u523886269 | 1381059487 | Python | Python | py | Accepted | 20 | 4200 | 254 | #! /usr/bin/python
import sys
stack = []
for line in sys.stdin:
#print "input = " + line.strip()
num = int(line)
if num == 0:
pop = stack.pop()
#print "pop " + str(pop)
print(str(pop))
else:
stack.append(num)
#print "pushed " + str(num) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,776 |
s812565129 | p00013 | u351182591 | 1383584841 | Python | Python | py | Accepted | 20 | 4192 | 155 | t = []
while 1:
try:
a = input()
except:
break
if a == 0:
print(t[-1])
t = t[:-1]
else:
t.append(a) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,777 |
s460827217 | p00013 | u260980560 | 1383939211 | Python | Python | py | Accepted | 10 | 4184 | 137 | s = []
while 1:
try:
n = input()
if n==0: print s.pop()
else: s.append(n)
except EOFError:
break; | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,778 |
s049077135 | p00013 | u230836528 | 1392286440 | Python | Python | py | Accepted | 10 | 4192 | 367 | # -*- coding: utf-8 -*-
import sys
lineNumber = 0
#for line in [ "1", "6", "0", "8", "10", "0", "0", "0" ]:
for line in sys.stdin.readlines():
lineNumber += 1
# except line
if lineNumber == 1:
cars = []
# get data
List = map(int, line.strip().split())
n = List[0]
if n == 0:... | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,779 |
s196802599 | p00013 | u633068244 | 1393360769 | Python | Python | py | Accepted | 10 | 4184 | 197 | stuck = []
while True:
try:
x = int(raw_input())
if x == 0:
go = stuck.pop()
print go
else:
stuck.append(x)
except:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,780 |
s405341629 | p00013 | u124909914 | 1393481229 | Python | Python | py | Accepted | 10 | 4188 | 183 | stack = []
while True:
try:
num = input()
if num == 0:
print stack.pop()
else:
stack.append(num)
except EOFError:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,781 |
s829495590 | p00013 | u912237403 | 1393762853 | Python | Python | py | Accepted | 20 | 4180 | 84 | import sys
x=[]
for n in map(int,sys.stdin):
if n:x.append(n)
else:print x.pop() | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,782 |
s822766006 | p00013 | u912237403 | 1393763100 | Python | Python | py | Accepted | 10 | 4180 | 87 | import sys
x=[]
for n in map(int, sys.stdin):
if n: x.append(n)
else: print x.pop() | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,783 |
s410539776 | p00013 | u858885710 | 1393928393 | Python | Python | py | Accepted | 10 | 4192 | 194 | import sys
storage = []
for car in sys.stdin:
car = int(car)
if car > 0:
storage.append(car)
elif car == 0:
print storage.pop()
while storage:
print storage.pop() | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,784 |
s752610069 | p00013 | u193025715 | 1395396144 | Python | Python | py | Accepted | 20 | 4200 | 182 | cars = []
ans = []
while True:
try:
n = int(raw_input())
if n == 0:
ans.append(cars.pop())
else:
cars.append(n)
except EOFError:
for car in ans:
print car
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,785 |
s673058783 | p00013 | u491763171 | 1396395365 | Python | Python | py | Accepted | 10 | 4180 | 153 | L = []
while 1:
try:
n = input()
if n == 0:
print L.pop()
else:
L.append(n)
except:
break | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,786 |
s394714238 | p00013 | u140201022 | 1396476099 | Python | Python | py | Accepted | 10 | 4196 | 282 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
i = 0
inn=[]
for i in sys.stdin:
i=int(i)
if i==0 and len(inn)>0:
print inn[-1]
inn.pop()
elif i==0 and len(inn)==0:
sys.exit()
elif i!=0:
inn.append(i)
for i in inn:
print i | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,787 |
s157865273 | p00013 | u246033265 | 1396613253 | Python | Python | py | Accepted | 10 | 4184 | 161 |
try:
a = []
while True:
p = int(raw_input())
if p == 0:
print a.pop()
else:
a.append(p)
except:
pass | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,788 |
s483055657 | p00013 | u708217907 | 1398176598 | Python | Python | py | Accepted | 10 | 4180 | 120 | import sys
stack = []
for n in sys.stdin:
if int(n) == 0:
print '%d'%int(stack.pop())
else:
stack.append(n) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,789 |
s167532957 | p00013 | u436634575 | 1401133348 | Python | Python3 | py | Accepted | 30 | 6720 | 155 | stack = []
while True:
try:
n = int(input())
except:
break
if n:
stack.append(n)
else:
print(stack.pop()) | p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,790 |
s056278146 | p00013 | u747915832 | 1597124896 | Python | Python3 | py | Accepted | 20 | 5596 | 169 | DE = []
while True:
try:
N = int(input())
except:
break
if N > 0:
DE.insert(0,N)
if N==0:
print(DE[0])
DE.pop(0)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,791 |
s549704061 | p00013 | u525366883 | 1596084686 | Python | Python3 | py | Accepted | 20 | 5584 | 176 | train = []
while True:
try:
tmp = int(input())
if tmp:
train.append(tmp)
else:
print(train.pop())
except:
break
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,792 |
s609758274 | p00013 | u240091169 | 1594866978 | Python | Python3 | py | Accepted | 20 | 5592 | 217 | lst = []
stack = []
while True :
try :
lst.append(int(input()))
except EOFError :
break
for i in lst :
if i == 0 :
print(stack.pop(-1))
else :
stack.append(i)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,793 |
s119640523 | p00013 | u187074069 | 1593270287 | Python | Python3 | py | Accepted | 30 | 5992 | 216 | from collections import deque
d = deque()
while True:
try:
n = int(input())
if n == 0:
print(d.pop())
else:
d.append(n)
except EOFError:
break
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,794 |
s664768903 | p00013 | u630911389 | 1590995575 | Python | Python3 | py | Accepted | 30 | 5592 | 145 | s = []
while 1:
try:
d = int(input())
except:
break
if d == 0:
print(s.pop())
else:
s.append(d)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,795 |
s782969790 | p00013 | u842461513 | 1588912412 | Python | Python3 | py | Accepted | 20 | 5592 | 342 | try:
num = []
while True:
#標準入力
i = int(input())
#0だった場合1番後ろを出力し削除、それ以外はリストに追加
if i == 0:
print(num[-1])
num.pop(-1)
else:num.append(i)
#EOFErrorをひろい、ループを抜ける
except EOFError:
pass
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,796 |
s372496142 | p00013 | u153447291 | 1579428504 | Python | Python3 | py | Accepted | 20 | 5552 | 144 | a = []
while True:
try:
t = input()
except:
break
if t == "0":
print(a.pop())
else:
a.append(t)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,797 |
s531893942 | p00013 | u595265835 | 1570454156 | Python | Python3 | py | Accepted | 20 | 5596 | 231 | a = []
i = 0
while True:
try:
n = int(input())
if (n):
a.append(n)
i += 1
else:
i -= 1
print(a[i])
a.pop()
except EOFError:
break
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,798 |
s751367097 | p00013 | u824708460 | 1566212947 | Python | Python3 | py | Accepted | 20 | 5584 | 161 | s = []
while 1:
try:
n = int(input())
if n == 0:
print(s.pop())
else:
s.append(n)
except:
break
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,799 |
s396329856 | p00013 | u074302614 | 1565187174 | Python | Python3 | py | Accepted | 20 | 5596 | 206 | import sys
numbers = []
try:
while True:
a = int(input())
if a != 0:
numbers.append(a)
elif a == 0:
print(numbers.pop())
except Exception:
sys.exit()
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,800 |
s830128933 | p00013 | u427219397 | 1564894046 | Python | Python3 | py | Accepted | 20 | 5588 | 142 | a = []
while True:
try:
i = int(input())
except:
break
if i == 0:
c = a.pop()
print(c)
else:
a.append(i)
| p00013 |
<H1>Switching Railroad Cars</H1>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_switchingRailroadCars">
</center>
<br>
<p>
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail trac... | 1
6
0
8
10
0
0
0
| 6
10
8
1
| 5,801 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.