Codeforces Beta Round 25 (Div. 2 Only)


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

Examples
Input
5
2 4 7 8 10
Output
3
Input
4
1 2 1 1
Output
2
----------------------------------------------------------------------------------------------------
B. Phone numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
549871
Output
54-98-71
Input
7
1198733
Output
11-987-33
----------------------------------------------------------------------------------------------------
C. Roads in Berland
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
0 5
5 0
1
1 2 3
Output
3 
Input
3
0 4 5
4 0 9
5 9 0
2
2 3 8
1 2 1
Output
17 12 
----------------------------------------------------------------------------------------------------
D. Roads not only in Berland
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
ab
bc
cd
Output
4
Input
abacaba
abaaba
x
Output
11
----------------------------------------------------------------------------------------------------
