Codeforces Round 594 (Div. 1)


A. Ivan the Fool and the Probability Theory
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2 3
Output
8
----------------------------------------------------------------------------------------------------
B. The World Is Just a Programming Task (Hard Version)
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
10
()()())(()
Output
5
8 7
Input
12
)(()(()())()
Output
4
5 10
Input
6
)))(()
Output
0
1 1
----------------------------------------------------------------------------------------------------
C. Queue in the Train
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 314
0 310 942 628 0
Output
314 628 1256 942 1570 
----------------------------------------------------------------------------------------------------
D. Catowice City
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
3 4
1 1
2 2
3 3
1 3
3 7
1 1
1 2
1 3
2 2
3 1
3 2
3 3
1 1
1 1
2 4
1 1
1 2
2 1
2 2
Output
Yes
2 1
1 3 
2 
Yes
1 2
2 
1 3 
No
No
----------------------------------------------------------------------------------------------------
E. Turtle
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2
1 4
2 3
Output
1 3 
4 2 
Input
3
0 0 0
0 0 0
Output
0 0 0 
0 0 0 
Input
3
1 0 1
0 0 0
Output
0 0 1
0 1 0
----------------------------------------------------------------------------------------------------
F. Swiper, no swiping!
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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