Codeforces Round 481 (Div. 3)


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

Examples
Input
6
1 5 5 1 6 1
Output
3
5 6 1 
Input
5
2 4 2 4 4
Output
2
2 4 
Input
5
6 6 6 6 6
Output
1
6 
----------------------------------------------------------------------------------------------------
B. File Name
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
xxxiii
Output
1
Input
5
xxoxx
Output
0
Input
10
xxxxxxxxxx
Output
8
----------------------------------------------------------------------------------------------------
C. Letters
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 6
10 15 12
1 9 12 23 26 37
Output
1 1
1 9
2 2
2 13
3 1
3 12
Input
2 3
5 10000000000
5 6 9999999999
Output
1 5
2 1
2 9999999994
----------------------------------------------------------------------------------------------------
D. Almost Arithmetic Progression
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
24 21 14 10
Output
3
Input
2
500 500
Output
0
Input
3
14 5 1
Output
-1
Input
5
1 3 6 9 12
Output
1
----------------------------------------------------------------------------------------------------
E. Bus Video System
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
4 2
10 4 10 15
1 2
4 3
Output
0 0 1 2 
Input
10 4
5 4 1 5 4 3 7 1 2 5
4 6
2 1
10 8
3 5
Output
5 4 0 5 3 3 9 0 2 5 
----------------------------------------------------------------------------------------------------
G. Petya's Exams
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2
1 3 1
1 5 1
Output
1 2 3 0 3 
Input
3 2
1 3 1
1 2 1
Output
-1
Input
10 3
4 7 2
1 10 3
8 9 1
Output
2 2 2 1 1 0 4 3 4 4 
----------------------------------------------------------------------------------------------------
