Codeforces Round 150 (Div. 2)


A. Dividing Orange
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
4 1
Output
2 4 
1 3 
Input
3 1
2
Output
3 2 1 
----------------------------------------------------------------------------------------------------
B. Undoubtedly Lucky Numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
Output
10
Input
123
Output
113
----------------------------------------------------------------------------------------------------
C. The Brand New Function
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2 0
Output
4
Input
10
1 2 3 4 5 6 1 2 9 10
Output
11
----------------------------------------------------------------------------------------------------
D. Hydra
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9 12 2 3
1 2
2 3
1 3
1 4
2 5
4 5
4 6
6 5
6 7
7 5
8 7
9 1
Output
YES
4 1
5 6 
9 3 2 
Input
7 10 3 3
1 2
2 3
1 3
1 4
2 5
4 5
4 6
6 5
6 7
7 5
Output
NO
----------------------------------------------------------------------------------------------------
E. Colorado Potato Beetle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
R 8
U 9
L 9
D 8
L 2
Output
101
Input
7
R 10
D 2
L 7
U 9
D 2
R 3
D 10
Output
52
----------------------------------------------------------------------------------------------------
