Codeforces Round 300


A. Cutting Banner
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
CODEWAITFORITFORCES
Output
YES
Input
BOTTOMCODER
Output
NO
Input
DECODEFORCES
Output
YES
Input
DOGEFORCES
Output
NO
----------------------------------------------------------------------------------------------------
B. Quasi Binary
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
Output
9
1 1 1 1 1 1 1 1 1 
Input
32
Output
3
10 11 11 
----------------------------------------------------------------------------------------------------
C. Tourist's Notes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 2
2 0
7 0
Output
2
Input
8 3
2 0
7 0
8 3
Output
IMPOSSIBLE
----------------------------------------------------------------------------------------------------
D. Weird Chess
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
oxxxx
x...x
x...x
x...x
xxxxo
Output
YES
....x....
....x....
....x....
....x....
xxxxoxxxx
....x....
....x....
....x....
....x....
Input
6
.x.x..
x.x.x.
.xo..x
x..ox.
.x.x.x
..x.x.
Output
YES
...........
...........
...........
....x.x....
...x...x...
.....o.....
...x...x...
....x.x....
...........
...........
...........
Input
3
o.x
oxx
o.x
Output
NO
----------------------------------------------------------------------------------------------------
E. Demiurges Play Again
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2
1 3
2 4
2 5
Output
3 2
Input
6
1 2
1 3
3 4
1 5
5 6
Output
3 3
----------------------------------------------------------------------------------------------------
F. A Heap of Heaps
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
1 5 4 3 2
Output
3 2 1 0
Input
6
2 2 2 2 2 2
Output
0 0 0 0 0
----------------------------------------------------------------------------------------------------
G. Berserk Robot
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
1 1 0
2 1 -1
3 0 -1
Output
RDL
Input
2 2
1 1 0
999 1 0
Output
RL
Input
2 5
10 10 0
20 0 0
Output
NO
----------------------------------------------------------------------------------------------------
H. Summer Dichotomy
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 20
3 0
3 6
4 9
16 25
Output
POSSIBLE
4 16
112
Input
1 10
3 3
0 10
0 10
0 10
1 2
1 3
2 3
Output
IMPOSSIBLE
----------------------------------------------------------------------------------------------------
