BOXLINGS  Boxlings
Doctor Y, always eager to further his research in the field of boxology, is observing a family of boxen in their natural habitat – a barrel of wine. He has noticed that in addition to the $N$ ($1 \leq N \leq 200,000$) rectangular, twodimensional boxen, there are $M$ ($1 \leq M \leq 200,000$) almost imperceptible points floating on the surface of the wine. He reasons that these must be baby boxen – also known as boxlings.
Curious as to the customs of box families, Doctor Y wishes to count how many boxlings are floating on top of boxen. From his topdown view of the barrel, he has divided the surface of the wine into a twodimensional Cartesian plane, and noted the positions of all the boxen and boxlings. Each box occupies a rectangular region parallel to the axes of the plane, with two of its opposite corners at coordinates ($x_1$, $y_1$) and ($x_2$, $y_2$). Doctor Y has observed that boxen sometimes overlap with one another. On the other hand, each boxling is so small that it occupies only a single point on the plane, with xcoordinate $a$ and ycoordinate $b$. All coordinates have absolute values no larger than $10^9$.
Having recorded the locations of all of the life forms on the surface of the wine, Doctor Y is interested in counting exactly how many boxlings are floating on top of at least one box. Note that if a boxling is on the very edge or corner of a box, it counts as being on top. Also note that two boxlings can occupy the exact same locations, in which case they should still be counted separately. It's also possible for a box to have zero area, in which case it's treated as a line (or point) and can still have boxlings on top of it.
With so many boxen and boxlings living in this wine barrel, Doctor Y doesn’t feel like sitting there and counting them all by hand, crazy though he is. As such, he wants you to write a program to, given the locations of all the boxen and boxlings, count the number of boxlings that are floating on top of at least one box. Don’t worry  your hard work will surely lead to exciting discoveries in the field of boxology.
Input
Line $1$: 2 integers, $N$ and $M$
Next $N$ lines: 4 integers, $x_1$, $y_1$, $x_2$, and $y_2$, the coordinates of each box
Next $M$ lines: 2 integers, $a$ and $b$, the coordinates of each boxling
Output
A single integer – the number of boxlings that are on top of at least one box.
Example
Input:
5 10 1 1 2 5 4 3 5 3 1 2 4 4 5 6 8 4 1 2 8 0 1 4 5 4 2 2 3 1 6 5 5 1 3 3 1 2 1 1 2 1
Output:
6
Explanation of Sample:
Below is a topdown view of the surface of the wine:
The colouredin rectangles are the boxen, the red dots are boxlings that are on top of at least one box, and the blue dots are the other boxlings. Counting the red dots, it can be seen that there are six of them.
hide comments
vilay:
20130624 17:44:50
please give me any tricky case for which my program give wrong ans?


Hasan Jaddouh:
20130517 00:15:08
"All coordinates have absolute values no larger than 10^8"


Edelweiss:
20130517 00:15:08
I've checked my code again and again but still cannot find any problem. I'm afraid there existed some subtle error in my code that would cause big trouble in my future coding.


Edelweiss:
20130517 00:15:08
Yaxis coordinates discretization + segment tree + Xaxis line scan?

Added by:  SourSpinach 
Date:  20130507 
Time limit:  4s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  Own problem 