Codeforces Round 199 (Div. 2)


A. Xenia and Divisors
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1 1 1 2 2 2
Output
-1
Input
6
2 2 1 1 4 6
Output
1 2 4
1 2 6
----------------------------------------------------------------------------------------------------
B. Xenia and Spies
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 5 1 3
1 1 2
2 2 3
3 3 3
4 1 1
10 1 3
Output
XXRR
----------------------------------------------------------------------------------------------------
C. Cupboard and Balloons
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
Output
3
Input
1 2
Output
5
Input
2 1
Output
2
----------------------------------------------------------------------------------------------------
D. Xenia and Dominoes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
....X
.O...
...X.
Output
1
Input
5
.....
.O...
.....
Output
2
Input
3
...
...
..O
Output
4
----------------------------------------------------------------------------------------------------
E. Xenia and Tree
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 4
1 2
2 3
2 4
4 5
2 1
2 5
1 2
2 5
Output
0
3
2
----------------------------------------------------------------------------------------------------
