Codeforces Round 479 (Div. 3)


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

Examples
Input
512 4
Output
50
Input
1000000000 9
Output
1
----------------------------------------------------------------------------------------------------
B. Two-gram
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
ABACABA
Output
AB
Input
5
ZZZAA
Output
ZZ
----------------------------------------------------------------------------------------------------
C. Less or Equal
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 4
3 7 5 1 10 3 20
Output
6
Input
7 2
3 7 5 1 10 3 20
Output
-1
----------------------------------------------------------------------------------------------------
D. Divide by three, multiply by two
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
4 8 6 3 12 9
Output
9 3 6 12 4 8 
Input
4
42 28 84 126
Output
126 42 84 28 
Input
2
1000000000000000000 3000000000000000000
Output
3000000000000000000 1000000000000000000 
----------------------------------------------------------------------------------------------------
E. Cyclic Components
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 4
1 2
3 4
5 4
3 5
Output
1
Input
17 15
1 8
1 12
5 11
11 9
9 15
15 5
4 13
3 13
4 3
10 16
7 10
16 7
14 3
14 4
17 6
Output
2
----------------------------------------------------------------------------------------------------
F. Consecutive Subsequence
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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