Codeforces Round 887 (Div. 2)


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

Examples
Input
4
2
1 1
4
1 8 10 13
3
1 3 2
3
1 9 14
Output
1
2
0
3
----------------------------------------------------------------------------------------------------
B. Fibonaccharsis
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
22 4
3 9
55 11
42069 6
69420 4
69 1434
1 3
1 4
Output
4
0
1
1052
11571
0
1
0
----------------------------------------------------------------------------------------------------
C. Ntarsis' Set
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
5 1
1 2 4 5 6
5 3
1 3 5 6 7
4 1000
2 3 4 5
9 1434
1 4 7 9 12 15 17 18 20
10 4
1 3 5 7 9 11 13 15 17 19
10 6
1 4 7 10 13 16 19 22 25 28
10 150000
1 3 4 5 10 11 12 13 14 15
Output
3
9
1
12874
16
18
1499986
----------------------------------------------------------------------------------------------------
D. Imbalanced Arrays
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1
1
4
1 4 3 4
3
0 1 0
4
4 3 2 1
3
1 3 1
Output
YES
1 
NO
YES
-3 1 -2 
YES
4 2 -1 -3 
YES
-1 3 -1
----------------------------------------------------------------------------------------------------
E. Ina of the Mountain
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4 3
1 2 1 3
7 3
1 2 3 1 3 2 1
Output
2
4
----------------------------------------------------------------------------------------------------
F. Miriany and Matchstick
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
10 1
ABBAAABBAA
4 5
AAAA
9 17
BAAABBAAB
4 9
ABAB
Output
NO
YES
BABB
YES
ABABAABAB
NO
----------------------------------------------------------------------------------------------------
