Codeforces Round 449 (Div. 1)


A. Nephren gives a riddle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 1
1 2
1 111111111111
Output
Wh.
Input
5
0 69
1 194
1 139
0 47
1 66
Output
abdef
Input
10
4 1825
3 75
3 530
4 1829
4 1651
3 187
4 584
4 255
4 774
2 474
Output
Areyoubusy
----------------------------------------------------------------------------------------------------
B. Ithea Plays With Chtholly
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 4 4
2
1
3
Output
1
2
2
----------------------------------------------------------------------------------------------------
C. Willem, Chtholly and Seniorious
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 10 7 9
Output
2
1
0
3
Input
10 10 9 9
Output
1
1
3
3
----------------------------------------------------------------------------------------------------
D. Nephren Runs a Cinema
time limit per test: 2.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 97 2 3
Output
13
Input
4 100 0 4
Output
35
----------------------------------------------------------------------------------------------------
E. Welcome home, Chtholly
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 6
1 5 5 5 8
2 2 5 5
1 2 4 3
2 2 5 2
2 2 5 5
1 3 5 1
2 1 5 1
Output
3
3
0
3
Input
7 7
1 9 2 6 8 1 7
2 1 7 1
2 2 5 2
1 4 7 7
2 2 4 2
1 3 4 5
2 3 3 3
2 3 7 2
Output
2
1
1
0
1
Input
8 13
75 85 88 100 105 120 122 128
1 1 8 70
2 3 8 30
1 3 8 3
2 2 5 15
1 2 4 10
2 1 5 5
1 2 7 27
2 1 5 5
1 3 7 12
1 1 7 4
2 1 8 1
1 4 8 5
2 1 8 1
Output
1
2
3
4
5
6
----------------------------------------------------------------------------------------------------
