Codeforces Round 122 (Div. 1)


A. Cutting Figure
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 4
####
#..#
#..#
#..#
####
Output
2
Input
5 5
#####
#...#
#####
#...#
#####
Output
2
----------------------------------------------------------------------------------------------------
B. Xor
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2 1
7 7 7
8 8 8
1 2 3
1 3 2
Output
96
Input
2 1 0
1 1
1 1
1 -1
1 2
Output
0
----------------------------------------------------------------------------------------------------
C. Hamming Distance
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4 4
4 4
4
Output
6
aaaabb
aabbaa
bbaaaa
bbbbbb
----------------------------------------------------------------------------------------------------
D. Two Segments
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2 3
Output
3
Input
5
1 4 5 3 2
Output
10
Input
5
5 4 3 1 2
Output
10
----------------------------------------------------------------------------------------------------
E. Fibonacci Number
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
13
Output
7
Input
377
Output
14
----------------------------------------------------------------------------------------------------
