Codeforces Global Round 1


A. Parity
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
13 3
3 2 7
Output
even
Input
10 9
1 2 3 4 5 6 7 8 9
Output
odd
Input
99 5
32 92 85 74 4
Output
odd
Input
2 2
1 0
Output
even
----------------------------------------------------------------------------------------------------
B. Tape
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 100 2
20 30 75 80
Output
17
Input
5 100 3
1 2 4 60 87
Output
6
----------------------------------------------------------------------------------------------------
C. Meaningless Operations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2
3
5
Output
3
1
7
----------------------------------------------------------------------------------------------------
D. Jongmah
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 6
2 3 3 3 4 4 4 5 5 6
Output
3
Input
12 6
1 5 3 3 3 4 3 5 3 2 3 3
Output
3
Input
13 5
1 1 5 1 2 3 3 2 4 2 3 4 5
Output
4
----------------------------------------------------------------------------------------------------
E. Magic Stones
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
7 2 4 12
7 15 10 12
Output
Yes
Input
3
4 4 4
1 2 3
Output
No
----------------------------------------------------------------------------------------------------
F. Nearest Leaf
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 3
1 10
1 1
3 2
3 3
1 1 5
5 4 5
4 1 2
Output
3
0
13
Input
5 3
1 1000000000
2 1000000000
1 1000000000
1 1000000000
3 4 5
2 1 5
2 4 5
Output
3000000000
1000000000
2000000000
Input
11 8
1 7
2 1
1 20
1 2
5 6
6 2
6 3
5 1
9 10
9 11
5 1 11
1 1 4
9 4 8
6 1 4
9 7 11
9 10 11
8 1 11
11 4 5
Output
8
8
9
16
9
10
0
34
----------------------------------------------------------------------------------------------------
G. Tree-Tac-Toe
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4
1 2
1 3
1 4
NNNW
5
1 2
2 3
3 4
4 5
NNNNN
Output
White
Draw
----------------------------------------------------------------------------------------------------
H. Modest Substrings
time limit per test: 5 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
1
10
3
Output
3
101
Input
1
11
3
Output
5
111
Input
12345
12346
6
Output
1
012345
----------------------------------------------------------------------------------------------------
