Codeforces Round 209 (Div. 2)


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

Examples
Input
3 3
0 0 0
0 1 0
0 0 0
Output
4
Input
4 3
0 0 0
0 0 1
1 0 0
0 0 0
Output
2
----------------------------------------------------------------------------------------------------
B. Permutation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 0
Output
1 2
Input
2 1
Output
3 2 1 4
Input
4 0
Output
2 7 4 6 1 3 5 8
----------------------------------------------------------------------------------------------------
C. Prime Number
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
2 2
Output
8
Input
3 3
1 2 3
Output
27
Input
2 2
29 29
Output
73741817
Input
4 5
0 0 0 0
Output
1
----------------------------------------------------------------------------------------------------
D. Pair of Numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
3 1 1
1 0 0
0 1 0
1 0 0
Output
YES
D1R2L2D2UU2
Input
3 1 1
1 0 0
0 1 0
0 0 1
Output
NO
----------------------------------------------------------------------------------------------------
