Codeforces Round 332 (Div. 2)


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

Examples
Input
10 20 30
Output
60
Input
1 1 5
Output
4
----------------------------------------------------------------------------------------------------
B. Spongebob and Joke
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
3 2 1
1 2 3
Output
Possible
3 2 1 
Input
3 3
1 1 1
1 1 1
Output
Ambiguity
Input
3 3
1 2 1
3 3 3
Output
Impossible
----------------------------------------------------------------------------------------------------
C. Day at the Beach
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2 3
Output
3
Input
4
2 1 3 2
Output
2
----------------------------------------------------------------------------------------------------
D. Spongebob and Squares
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
26
Output
6
1 26
2 9
3 5
5 3
9 2
26 1
Input
2
Output
2
1 2
2 1
Input
8
Output
4
1 8
2 3
3 2
8 1
----------------------------------------------------------------------------------------------------
E. Sandy and Nuts
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 0 0
Output
16
Input
4 0 1
3 4 2
Output
1
Input
3 1 0
1 2
Output
2
Input
3 0 2
2 3 2
2 3 1
Output
0
Input
4 1 2
1 2
2 2 2
3 4 2
Output
1
----------------------------------------------------------------------------------------------------
