Yandex.Algorithm Open 2011: Qualification 1


A. Plug-in
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
hhoowaaaareyyoouu
Output
wre
Input
reallazy
Output
rezy
Input
abacabaabacabaa
Output
a
----------------------------------------------------------------------------------------------------
B. Sequence Formatting
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1,2 ,3,...,     10
Output
1, 2, 3, ..., 10
Input
1,,,4...5......6
Output
1, , , 4 ...5 ... ...6
Input
...,1,2,3,...
Output
..., 1, 2, 3, ...
----------------------------------------------------------------------------------------------------
C. Average Score
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3 2
4 4 5 4 4
Output
1 1 2 1 2 
Input
4
2 2
3 5 4 5
Output
1 1 2 2 
Input
6
1 5
4 4 4 5 4 4
Output
2 2 2 1 2 2 
----------------------------------------------------------------------------------------------------
D. Polycarp's Picture Gallery
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
5
5 2
3 2
5 1
2 1
4 2
Output
2 2
5 3
4 2
Input
6
5 2
3 2
5 1
2 1
4 2
3 1
Output
3 1
4 2
5 1
3 6
Input
8
2 2
3 2
5 1
3 1
6 1
5 1
8 2
7 1
Output
4 1
5 6
3 4
2 1
7 8
----------------------------------------------------------------------------------------------------
