Codeforces Round 242 (Div. 2)


A. Squats
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
xxXx
Output
1
XxXx
Input
2
XX
Output
1
xX
Input
6
xXXxXx
Output
0
xXXxXx
----------------------------------------------------------------------------------------------------
B. Megacity
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 999998
1 1 1
2 2 1
3 3 1
2 -2 1
Output
2.8284271
Input
4 999998
1 1 2
2 2 1
3 3 1
2 -2 1
Output
1.4142136
Input
2 1
1 1 999997
2 2 1
Output
-1
----------------------------------------------------------------------------------------------------
C. Magic Formulas
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2 3
Output
3
----------------------------------------------------------------------------------------------------
D. Biathlon Track
time limit per test: 4.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 7 48
3 6 2
5 4 8 3 3 7 9
4 1 6 8 7 1 1
1 6 4 6 4 8 6
7 2 6 1 6 9 4
1 9 8 6 3 9 2
4 5 6 8 4 3 7
Output
4 3 6 7
----------------------------------------------------------------------------------------------------
E. Colored Jenga
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
RGB
GRG
BBB
GGR
BRG
BRB
Output
17.119213696601992
----------------------------------------------------------------------------------------------------
