Codeforces Round 866 (Div. 2)


A. Yura's New Name
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
^______^
___^_^^^_^___^
^_
^
^_^^^^^_^_^^
___^^
_
Output
5
5
1
1
0
3
2
----------------------------------------------------------------------------------------------------
B. JoJo's Incredible Adventures
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
0
1
101
011110
101010
Output
0
1
2
6
1
----------------------------------------------------------------------------------------------------
C. Constructive Problem
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
1 2 1
4
0 2 2 0
4
3 2 0 2
1
0
Output
Yes
Yes
No
No
----------------------------------------------------------------------------------------------------
D. The Butcher
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
1 2
3 5
1 3
3
1 1
1 1
1 1
1
10 10
4
3 2
5 5
2 2
8 7
Output
1
4 5
2
1 3
3 1
1
10 10
1
13 7
----------------------------------------------------------------------------------------------------
E. The Fox and the Complete Tree Traversal
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2
1 3
3 4
3 5
Output
Yes
4 5 1 2 3 
Input
3
1 2
1 3
Output
Yes
1 2 3
Input
15
1 2
1 3
2 4
2 5
3 6
3 7
4 8
4 9
5 10
5 11
6 12
6 13
7 14
7 15
Output
No
----------------------------------------------------------------------------------------------------
F. Misha and Apples
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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