3250: CF369E - E. Valera and Queries
Description
Valera found the solution of this problem too difficult. So he asked you to help him. Help Valera.
Input
The first line contains two integers $n,m\ (1≤n,m≤3·10^5)$ − the number of segments on the axis of coordinates and the number of queries.
Next $n$ lines contain the desc
Next $m$ lines contain the desc
It is guaranteed that the total number of points in all queries doesn't exceed $3·10^5$.
Output
Sample 1 Input
3 3
1 3
4 5
6 7
3 1 4 7
2 4 5
1 8
Sample 1 Output
3
1
0