Codeforces Round 691 (Div. 1)


A. Row GCD
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4 4
1 25 121 169
1 2 7 23
Output
2 3 8 24
----------------------------------------------------------------------------------------------------
B. Glass Half Spilled
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
6 5
6 5
10 2
Output
7.0000000000 11.0000000000 12.0000000000
----------------------------------------------------------------------------------------------------
C. Latin Square
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
3 2
1 2 3
2 3 1
3 1 2
DR
3 2
1 2 3
2 3 1
3 1 2
LU
3 1
1 2 3
2 3 1
3 1 2
I
3 1
1 2 3
2 3 1
3 1 2
C
3 16
1 2 3
2 3 1
3 1 2
LDICRUCILDICRUCI
Output
2 3 1 
3 1 2 
1 2 3 
3 1 2 
1 2 3 
2 3 1 
1 2 3 
3 1 2 
2 3 1 
1 3 2 
2 1 3 
3 2 1 
2 3 1 
3 1 2 
1 2 3
----------------------------------------------------------------------------------------------------
D. Flip and Reverse
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
100101
1100011
10101010
Output
010110
0110110
10101010
----------------------------------------------------------------------------------------------------
E. Nim Shortcuts
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 5
3 0
0 1
2 2
0 0
1 1
2 2
3 3
5 4
Output
LOSE
WIN
LOSE
WIN
LOSE
----------------------------------------------------------------------------------------------------
F. Range Diameter Sum
time limit per test: 7 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2
2 4
3 2
Output
10
Input
10
1 8
2 9
5 6
4 8
4 2
7 9
3 6
10 4
3 9
Output
224
----------------------------------------------------------------------------------------------------
