Codeforces Round 241 (Div. 2)


A. Guess a number!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
>= 1 Y
< 3 N
<= -3 N
> 55 N
Output
17
Input
2
> 100 Y
< -100 Y
Output
Impossible
----------------------------------------------------------------------------------------------------
B. Art Union
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 1
1
2
3
4
5
Output
1 3 6 10 15 
Input
4 2
2 5
3 1
5 3
10 1
Output
7 8 13 21 
----------------------------------------------------------------------------------------------------
C. Booking System
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
10 50
2 100
5 30
3
4 6 9
Output
2 130
2 1
3 2
----------------------------------------------------------------------------------------------------
D. Population Size
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
8 6 4 2 1 4 7 10 2
Output
3
Input
9
-1 6 -1 2 -1 4 7 -1 2
Output
3
Input
5
-1 -1 -1 -1 -1
Output
1
Input
7
-1 -1 4 5 1 2 3
Output
2
----------------------------------------------------------------------------------------------------
E. President's Path
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 6
1 2 1
2 3 1
3 4 1
4 1 1
2 4 2
4 5 4
Output
1 4 1 2 1 5 6 1 2 1 
----------------------------------------------------------------------------------------------------
