Codeforces Round 296 (Div. 2)


A. Playing with Paper
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1
Output
2
Input
10 7
Output
6
Input
1000000000000 1
Output
1000000000000
----------------------------------------------------------------------------------------------------
B. Error Correct System
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
pergament
permanent
Output
1
4 6
Input
6
wookie
cookie
Output
1
-1 -1
Input
4
petr
egor
Output
2
1 2
Input
6
double
bundle
Output
2
4 1
----------------------------------------------------------------------------------------------------
C. Glass Carving
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3 4
H 2
V 2
V 3
V 1
Output
8
4
4
2
Input
7 6 5
H 4
V 3
V 5
H 2
V 1
Output
28
16
12
6
4
----------------------------------------------------------------------------------------------------
D. Clique Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 3
3 1
6 1
0 2
Output
3
----------------------------------------------------------------------------------------------------
E. Data Center Drama
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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