Codeforces Round 278 (Div. 2)


A. Giga Tower
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
179
Output
1
Input
-1
Output
9
Input
18
Output
10
----------------------------------------------------------------------------------------------------
B. Candy Boxes
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1
1
Output
YES
3
3
Input
3
1
1
1
Output
NO
Input
4
1
2
2
3
Output
YES
----------------------------------------------------------------------------------------------------
C. Fight the Monster
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 2 1
1 100 1
1 100 100
Output
99
Input
100 100 100
1 1 1
1 1 1
Output
0
----------------------------------------------------------------------------------------------------
D. Strip
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 2 2
1 3 1 2 4 1 2
Output
3
Input
7 2 2
1 100 1 100 1 100 1
Output
-1
----------------------------------------------------------------------------------------------------
E. Prefix Product Sequence
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
Output
YES
1
4
3
6
5
2
7
Input
6
Output
NO
----------------------------------------------------------------------------------------------------
