Codeforces Round 490 (Div. 3)


A. Mishka and Contest
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 4
4 2 3 1 5 1 6 4
Output
5
Input
5 2
3 1 2 1 3
Output
0
Input
5 100
12 34 55 43 21
Output
5
----------------------------------------------------------------------------------------------------
B. Reversing Encryption
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
rocesfedoc
Output
codeforces
Input
16
plmaetwoxesisiht
Output
thisisexampletwo
Input
1
z
Output
z
----------------------------------------------------------------------------------------------------
C. Alphabetic Removals
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
15 3
cccaabababaccbc
Output
cccbbabaccbc
Input
15 9
cccaabababaccbc
Output
cccccc
Input
1 1
u
Output
----------------------------------------------------------------------------------------------------
D. Equalize the Remainders
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 3
3 2 0 6 10 12
Output
3
3 2 0 7 10 14 
Input
4 2
0 1 2 3
Output
0
0 1 2 3 
----------------------------------------------------------------------------------------------------
E. Reachability from the Capital
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9 9 1
1 2
1 3
2 3
1 5
5 6
6 1
1 8
9 8
7 1
Output
3
Input
5 4 5
1 2
2 3
3 4
4 1
Output
1
----------------------------------------------------------------------------------------------------
F. Cards and Joy
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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