C. Bees and Flowers
time limit per test
1.5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Examples
Input
2 2
1 7
2 10
7 8
10 10
Output
1
2
Input
10 5
21 10
28 25
25 7
6 25
30 12
23 20
2 12
17 14
18 15
13 21
20 4
7 1
11 2
1 5
27 3
Output
1
5
0
2
0
0
4
0
0
3
Input
3 2
1 7
2 10
18 10
7 8
10 10
Output
0
1
2