Codeforces Round 517 (Div. 2, based on Technocup 2019 Elimination Round 2)


A. Golden Plate
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 1
Output
8
Input
7 9 1
Output
28
Input
7 9 2
Output
40
----------------------------------------------------------------------------------------------------
B. Curiosity Has No Limits
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
3 3
Output
1
3 
2
2 1 
Input
9 12
Output
2
3 6
4
1 2 4 5
----------------------------------------------------------------------------------------------------
D. Minimum path
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 2
abcd
bcde
bcad
bcde
Output
aaabcde
Input
5 3
bwwwz
hrhdh
sepsp
sqfaf
ajbvw
Output
aaaepfafw
Input
7 6
ypnxnnp
pnxonpm
nxanpou
xnnpmud
nhtdudu
npmuduh
pmutsnz
Output
aaaaaaadudsnz
----------------------------------------------------------------------------------------------------
E. Triple Flips
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1 0 1 1
Output
YES
2
1 3 5
2 3 4
Input
3
0 1 0
Output
NO
----------------------------------------------------------------------------------------------------
F. Familiar Operations
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
9 10
100 17
220 70
17 19
4 18
32 20
100 32
224 385
Output
1
3
1
0
1
0
1
1
----------------------------------------------------------------------------------------------------
