Codeforces Round 262 (Div. 2)


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

Examples
Input
2 2
Output
3
Input
9 3
Output
13
----------------------------------------------------------------------------------------------------
B. Little Dima and Equation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2 8
Output
3
10 2008 13726 
Input
1 2 -18
Output
0
Input
2 2 -1
Output
4
1 31 337 967 
----------------------------------------------------------------------------------------------------
C. Present
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 2 3
2 2 2 2 1 1
Output
2
Input
2 5 1
5 8
Output
9
----------------------------------------------------------------------------------------------------
D. Little Victor and Set
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 15 3
Output
1
2
10 11
Input
8 30 7
Output
0
5
14 9 28 11 16
----------------------------------------------------------------------------------------------------
E. Roland and Rose
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1
Output
16
0 1
0 1
0 -1
0 -1
Input
3 6
Output
312
0 6
5 -3
-5 -3
----------------------------------------------------------------------------------------------------
