Codeforces Round 313 (Div. 1)


A. Gerald's Hexagon
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 1 1 1 1
Output
6
Input
1 2 1 2 1 2
Output
13
----------------------------------------------------------------------------------------------------
B. Equivalent Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
aaba
abaa
Output
YES
Input
aabb
abab
Output
NO
----------------------------------------------------------------------------------------------------
C. Gerald and Giant Chess
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4 2
2 2
2 3
Output
2
Input
100 100 3
15 16
16 15
99 88
Output
545732279
----------------------------------------------------------------------------------------------------
D. Randomizer
time limit per test: 2.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 0
2 0
2 2
0 2
Output
0.2
Input
5
0 0
2 0
2 2
1 3
0 2
Output
0.8125
----------------------------------------------------------------------------------------------------
E. Gerald and Path
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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