Codeforces Round 159 (Div. 2)


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

Examples
Input
3 5 3
3 1 2
Output
1
Input
4 7 2
3 3 2 4
Output
2
Input
5 5 1
1 3 1 2 1
Output
-1
----------------------------------------------------------------------------------------------------
B. Playing Cubes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1
Output
2 1
Input
2 4
Output
3 2
----------------------------------------------------------------------------------------------------
C. View Angle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2 0
0 2
Output
90.0000000000
Input
3
2 0
0 2
-2 2
Output
135.0000000000
Input
4
2 0
0 2
-2 0
0 -2
Output
270.0000000000
Input
2
2 1
1 2
Output
36.8698976458
----------------------------------------------------------------------------------------------------
D. Sum
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2 3 5
Output
+++-
Input
3
3 3 5
Output
++-
----------------------------------------------------------------------------------------------------
E. Greedy Elevator
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 10
1 2 7
3 6 5
3 4 8
Output
7
11
8
Input
2 10
1 2 5
7 4 5
Output
5
9
----------------------------------------------------------------------------------------------------
