Codeforces Round 742 (Div. 2)


A. Domino Disaster
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1
U
2
LR
5
LRDLR
6
UUUUUU
Output
D
LR
LRULR
DDDDDD
----------------------------------------------------------------------------------------------------
B. MEXor Mixup
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1
2 1
2 0
1 10000
2 10000
Output
3
2
3
2
3
----------------------------------------------------------------------------------------------------
C. Carrying Conundrum
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
100
12
8
2021
10000
Output
9
4
7
44
99
----------------------------------------------------------------------------------------------------
D. Expression Evaluation Error
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
97 2
17 1
111 4
100 2
10 9
999999 3
Output
70 27 
17 
3 4 100 4
10 90
1 1 2 1 1 1 1 1 1 
999900 90 9
----------------------------------------------------------------------------------------------------
E. Non-Decreasing Dilemma
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 6
3 1 4 1 5
2 2 5
2 1 3
1 4 4
2 2 5
1 2 6
2 2 5
Output
6
4
10
7
----------------------------------------------------------------------------------------------------
F. One-Four Overload
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5
.....
.XXX.
.X.X.
.XXX.
.....
Output
YES
4 1 4 4 1
4 5 5 5 1
4 5 1 5 4
1 5 5 5 4
1 4 4 1 4
Input
5 5
.....
.XXX.
.XXX.
.XXX.
.....
Output
NO
Input
3 2
..
..
..
Output
YES
4 1
4 1
1 4
Input
9 9
.........
.XXXXX.X.
.X...X...
.X.XXXXX.
.X.X.X.X.
.X.XXX.X.
.X.....X.
.XXXXXXX.
.........
Output
YES
4 4 4 1 4 1 4 1 4
1 5 5 5 5 5 4 10 1
4 5 1 4 1 5 4 4 4
4 5 1 5 5 0 5 5 1
4 5 1 5 4 5 1 5 4
4 5 1 5 5 5 4 5 1
1 5 4 4 1 1 4 5 1
4 5 5 5 5 5 5 5 4
1 1 1 1 4 4 1 1 4
----------------------------------------------------------------------------------------------------
