Codeforces Beta Round 68


A. Room Leader
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
Petr 3 1 490 920 1000 1200 0
tourist 2 0 490 950 1100 1400 0
Egor 7 0 480 900 950 0 1000
c00lH4x0R 0 10 150 0 0 0 0
some_participant 2 1 450 720 900 0 0
Output
tourist
----------------------------------------------------------------------------------------------------
B. Train
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3 2
to head
0001001
Output
Stowaway
Input
3 2 1
to tail
0001
Output
Controller 2
----------------------------------------------------------------------------------------------------
C. Chessboard Billiard
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4
Output
2
Input
3 3
Output
3
----------------------------------------------------------------------------------------------------
D. Hanger
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9 11
1
2
0 5 8
1
1
3
0 3 8
9
0 6 9
6
0 1 9
Output
2
3
2
5
----------------------------------------------------------------------------------------------------
E. Shift It!
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
01W345
729AB6
CD8FGH
IJELMN
OPKRST
UVQXYZ
Output
2
R2
U3
----------------------------------------------------------------------------------------------------
