Codeforces Round 106 (Div. 2)


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

Examples
Input
5
1 1 1 1 2 2 3 2 2 1 1 1
Output
2
Input
0
0 0 0 0 0 0 0 1 1 2 3 0
Output
0
Input
11
1 1 4 1 1 5 1 1 4 1 1 1
Output
3
----------------------------------------------------------------------------------------------------
B. Martian Clock
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11:20
Output
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Input
2A:13
Output
0
Input
000B:00001
Output
-1
----------------------------------------------------------------------------------------------------
C. Division into Teams
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2 1
Output
2
1 2 
1
3 
Input
5
2 3 3 1 1
Output
3
4 1 3 
2
5 2 
----------------------------------------------------------------------------------------------------
D. Coloring Brackets
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
(())
Output
12
Input
(()())
Output
40
Input
()
Output
4
----------------------------------------------------------------------------------------------------
E. Martian Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
ABCBABA
2
BAAB
ABBA
Output
1
----------------------------------------------------------------------------------------------------
