Codeforces Round 814 (Div. 2)


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

Examples
Input
6
1 1
1 4
5 6
2 2
6 3
999999999 1000000000
Output
Tonya
Burenka
Burenka
Tonya
Burenka
Burenka
----------------------------------------------------------------------------------------------------
B. Mathematical Circus
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4 1
2 0
12 10
14 11
Output
YES
1 2
3 4
NO
YES
3 4
7 8
11 12
2 1
6 5
10 9
YES
1 2
3 4
5 6
7 8
9 10
11 12
13 14
----------------------------------------------------------------------------------------------------
C. Fighting Tournament
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 1
3 1 2
1 2
4 2
1 3 4 2
4 5
3 2
5 2
1 2 3 5 4
5 1000000000
4 6
Output
2
0
1
0
4
----------------------------------------------------------------------------------------------------
D1. Burenka and Traditions (easy version)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
4
5 5 5 5
3
1 3 2
2
0 0
3
2 5 7
6
1 2 3 3 2 1
10
27 27 34 32 2 31 23 56 52 4
5
1822 1799 57 23 55
Output
2
2
0
2
4
7
4
----------------------------------------------------------------------------------------------------
D2. Burenka and Traditions (hard version)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
4
5 5 5 5
3
1 3 2
2
0 0
3
2 5 7
6
1 2 3 3 2 1
10
27 27 34 32 2 31 23 56 52 4
5
1822 1799 57 23 55
Output
2
2
0
2
4
7
4
----------------------------------------------------------------------------------------------------
E. Fibonacci Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1
1
2
1 1
2
1 2
3
3 1 3
2
7 5
6
26 8 3 4 13 34
Output
YES
YES
NO
YES
NO
YES
----------------------------------------------------------------------------------------------------
F. Tonya and Burenka-179
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 1
1 2
1 3
4 4
4 1 3 2
2 6
4 6
1 1
3 11
9 3
1 7 9 4 5 2 3 6 8
3 1
2 1
9 1
6 3
1 1 1 1 1 1
1 5
4 4
3 8
Output
3
5
14
16
24
24
24
57
54
36
36
6
18
27
28
----------------------------------------------------------------------------------------------------
