Codeforces Round 177 (Div. 2)


A. Polo the Penguin and Segments
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3
1 2
3 4
Output
2
Input
3 7
1 2
3 3
4 7
Output
0
----------------------------------------------------------------------------------------------------
B. Polo the Penguin and Matrix
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2 2
2 4
6 8
Output
4
Input
1 2 7
6 7
Output
-1
----------------------------------------------------------------------------------------------------
C. Polo the Penguin and Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 4
Output
ababacd
Input
4 7
Output
-1
----------------------------------------------------------------------------------------------------
D. Polo the Penguin and Houses
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2
Output
54
Input
7 4
Output
1728
----------------------------------------------------------------------------------------------------
E. Polo the Penguin and XOR operation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
Output
20
0 2 1 4 3
----------------------------------------------------------------------------------------------------
