Codeforces Round 213 (Div. 1)


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

Examples
Input
10
12345
Output
6
Input
16
439873893693495623498263984765
Output
40
----------------------------------------------------------------------------------------------------
B. Free Market
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1 3 10
Output
4 3
Input
3 5
1 2 3
Output
6 2
Input
10 10000
10000 9999 1 10000 10000 10000 1 2 3 4
Output
50010 6
----------------------------------------------------------------------------------------------------
C. Beautiful Set
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
Output
16 18 24 27 36 48 54 72 108 144 
----------------------------------------------------------------------------------------------------
D. Ghd
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
6 2 3 4 5 6
Output
3
Input
5
5 5 6 10 15
Output
5
----------------------------------------------------------------------------------------------------
E. Empty Rectangles
time limit per test: 12 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 3 2
101
000
101
Output
8
Input
5 5 1
00000
00000
00100
00000
00000
Output
81
Input
5 5 6
01010
10101
01010
10101
01010
Output
12
Input
3 3 0
001
010
000
Output
15
Input
4 4 0
0000
0101
0000
0000
Output
52
----------------------------------------------------------------------------------------------------
