Codeforces Round 554 (Div. 2)


A. Neko Finds Grapes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 4
9 14 6 2 11
8 4 7 20
Output
3
Input
5 1
2 4 6 8 10
5
Output
1
Input
1 4
10
20 30 40 50
Output
0
----------------------------------------------------------------------------------------------------
B. Neko Performs Cat Furrier Transform
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
39
Output
4
5 3 
Input
1
Output
0
Input
7
Output
0
----------------------------------------------------------------------------------------------------
C. Neko does Maths
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 10
Output
2
Input
21 31
Output
9
Input
5 10
Output
0
----------------------------------------------------------------------------------------------------
D. Neko and Aki's Prank
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
1
Input
2
Output
3
Input
3
Output
9
----------------------------------------------------------------------------------------------------
E. Neko and Flashback
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4 5 3 5
6 7 4 6
Output
3 4 6 5 7 
Input
3
2 4
3 2
Output
-1
Input
8
2 3 1 1 2 4 3
3 4 4 2 5 5 4
Output
3 4 5 2 1 4 3 2 
----------------------------------------------------------------------------------------------------
F1. Neko Rules the Catniverse (Small Version)
time limit per test: 7 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 1
Output
4
Input
4 2 1
Output
9
Input
5 5 4
Output
120
Input
100 1 2
Output
100
----------------------------------------------------------------------------------------------------
F2. Neko Rules the Catniverse (Large Version)
time limit per test: 7 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 1
Output
4
Input
4 2 1
Output
9
Input
5 5 4
Output
120
Input
100 1 2
Output
100
----------------------------------------------------------------------------------------------------
