Codeforces Round 375 (Div. 2)


A. The New Year: Meeting Friends
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 1 4
Output
6
Input
30 20 10
Output
20
----------------------------------------------------------------------------------------------------
B. Text Document Analysis
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
37
_Hello_Vasya(and_Petya)__bye_(and_OK)
Output
5 4
Input
37
_a_(_b___c)__de_f(g_)__h__i(j_k_l)m__
Output
2 6
Input
27
(LoooonG)__shOrt__(LoooonG)
Output
5 2
Input
5
(___)
Output
0 0
----------------------------------------------------------------------------------------------------
C. Polycarp at the Radio
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 2
1 2 3 2
Output
2 1
1 2 1 2 
Input
7 3
1 3 2 2 2 2 1
Output
2 1
1 3 3 2 2 2 1 
Input
4 4
1000000000 100 7 1000000000
Output
1 4
1 2 3 4 
----------------------------------------------------------------------------------------------------
D. Lakes in Berland
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 4 1
****
*..*
****
**.*
..**
Output
1
****
*..*
****
****
..**
Input
3 3 0
***
*.*
***
Output
1
***
***
***
----------------------------------------------------------------------------------------------------
E. One-Way Reform
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5 5
2 1
4 5
2 3
1 3
3 5
7 2
3 7
4 2
Output
3
1 3
3 5
5 4
3 2
2 1
3
2 4
3 7
----------------------------------------------------------------------------------------------------
F. st-Spanning Tree
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
1 2
2 3
3 1
1 2 1 1
Output
Yes
3 2
1 3
Input
7 8
7 4
1 3
5 4
5 7
3 2
2 4
6 1
1 2
6 4 1 4
Output
Yes
1 3
5 7
3 2
7 4
2 4
6 1
----------------------------------------------------------------------------------------------------
