Codeforces Round 512 (Div. 1, based on Technocup 2019 Elimination Round 1)


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

Examples
Input
4 3 3
Output
YES
1 0
2 3
4 1
Input
4 4 7
Output
NO
----------------------------------------------------------------------------------------------------
B. Vasya and Good Sequences
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
6 7 14
Output
2
Input
4
1 2 1 16
Output
4
----------------------------------------------------------------------------------------------------
C. Putting Boxes Together
time limit per test: 2.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 8
1 2 6 7 10
1 1 1 1 2
1 1
1 5
1 3
3 5
-3 5
-1 10
1 4
2 5
Output
0
10
3
4
18
7
----------------------------------------------------------------------------------------------------
D. Linear Congruential Generator
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
2 3 5 7
Output
210
Input
3
5 3 3
Output
30
----------------------------------------------------------------------------------------------------
E. Euler tour
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 0 0
Output
yes
1 2 1
Input
4
1 0 3 2 0 0 0
Output
yes
1 4 3 2 3 4 1
Input
5
0 1 2 3 4 1 0 0 0
Output
no
----------------------------------------------------------------------------------------------------
