Codeforces Round 409 (rated, Div. 1, based on VK Cup 2017 Round 2)


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

Examples
Input
2 1
2 2
2 1000
Output
2.0000000000
Input
1 100
1 1
Output
-1
Input
3 5
4 3
5 2
6 1
Output
0.5000000000
----------------------------------------------------------------------------------------------------
B. Volatile Kite
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 0
0 1
1 1
1 0
Output
0.3535533906
Input
6
5 0
10 0
12 -4
10 -8
5 -8
3 -4
Output
1.0000000000
----------------------------------------------------------------------------------------------------
C. Vulnerable Kerbals
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0 5
Output
5
1 2 4 3 0
Input
3 10
2 9 1
Output
6
3 9 2 9 8 0
----------------------------------------------------------------------------------------------------
D. Varying Kibibits
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
123 321 555
Output
292711924
Input
1
999999
Output
997992010006992
Input
10
1 1 1 1 1 1 1 1 1 1
Output
28160
----------------------------------------------------------------------------------------------------
E. Verifying Kingdom
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
X
Z
Y
Y
X
Output
1 4 2
1 2 4
2 4 1
2 3 5
2 4 3
-1
-1 1 1 2 2 3 3 6 6
----------------------------------------------------------------------------------------------------
