Good Bye 2013


A. New Year Candles
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 2
Output
7
Input
6 3
Output
8
----------------------------------------------------------------------------------------------------
B. New Year Present
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 2
Output
PRPLRP
Input
4
0 2 0 2
Output
RPRRPLLPLRRRP
----------------------------------------------------------------------------------------------------
C. New Year Ratings Change
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5 1 1
Output
5 1 2
Input
1
1000000000
Output
1000000000
----------------------------------------------------------------------------------------------------
D. New Year Letter
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2 2 2
Output
AC
AC
Input
3 3 2 2
Output
Happy new year!
Input
3 0 2 2
Output
AA
AA
Input
4 3 2 1
Output
Happy new year!
Input
4 2 2 1
Output
Happy new year!
----------------------------------------------------------------------------------------------------
E. New Year Tree Decorations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
2 1 2
1 2 1
Output
3.000000000000
0.500000000000
Input
1 1
1 1
Output
1.000000000000
Input
4 1
2 7
7 2
5 5
6 4
Output
4.500000000000
1.250000000000
0.050000000000
0.016666666667
----------------------------------------------------------------------------------------------------
F. New Year Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2
3
4
8
5
Output
3
4
4
5
6
----------------------------------------------------------------------------------------------------
G. New Year Cactus
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 0
Output
1 0 
Input
16 20
1 2
3 4
5 6
6 7
7 8
9 10
10 11
11 12
13 14
15 16
1 5
9 13
14 10
10 6
6 2
15 11
11 7
7 3
16 12
8 4
Output
16 13 12 12 10 8 8 7 6 4 4 3 3 1 0 0 0 
----------------------------------------------------------------------------------------------------
