Codeforces Round 181 (Div. 2)


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

Examples
Input
3
-1 2 0
Output
1 -1
1 2
1 0
Input
4
-1 -2 -3 0
Output
1 -1
2 -3 -2
1 0
----------------------------------------------------------------------------------------------------
B. Coach
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 0
Output
3 2 1 
Input
6 4
1 2
2 3
3 4
5 6
Output
-1
Input
3 3
1 2
2 3
1 3
Output
3 2 1 
----------------------------------------------------------------------------------------------------
C. Beautiful Numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 3 3
Output
1
Input
2 3 10
Output
165
----------------------------------------------------------------------------------------------------
D. Painting Square
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
1 0
1 1
3 0
3 1
2 0
2 1
3 2
7 2
Output
1
0
1
1
1
0
0
4
----------------------------------------------------------------------------------------------------
E. Empire Strikes Back
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2
1000 1000
Output
2000
Input
1
2
Output
2
----------------------------------------------------------------------------------------------------
