Codeforces Round 154 (Div. 2)


A. Boys and Girls
time limit per test: 1 second
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
3 3
Output
GBGBGB
Input
4 2
Output
BGBGBB
----------------------------------------------------------------------------------------------------
B. Physics Practical
time limit per test: 1 second
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

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

Examples
Input
4
2 1 6 4
3 4 4 2
Output
3
Input
4
10 5 6 4
1 11 4 2
Output
6
Input
3
10 1 10
1 10 1 1
Output
3
----------------------------------------------------------------------------------------------------
D. Table with Letters - 2
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
3 4 4
aabb
baab
baab
Output
2
Input
4 5 1
ababa
ccaca
ccacb
cbabc
Output
1
----------------------------------------------------------------------------------------------------
E. Printer
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: input.txt
output: output.txt

Examples
Input
3
4 3 -1
0 2 2
1 3 3
7
Output
4
7 8 4
Input
3
3 1 2
2 3 3
3 1 -1
4
Output
4
7 6 4
----------------------------------------------------------------------------------------------------
