AlgoUniversity
  • Go Back
Discussion
Matchmaking :

Author

Sumeet Kumar Mishra

Difficulty Level : Easy

Submissions : 673

Asked In : Intuit

Marks :10

: 6 | : 0

Intuit has $$$N$$$ experts where each expert knows exactly one language and one topic (represented by pair $$$x$$$ and $$$y$$$). We have $$$M$$$ customers where each customer has exactly one language and one topic which they want the expert to match with.

If a customer doesn't match with an expert then they are unhappy.

Find total number of unhappy customers after assigning.

Input

First line of the input contains two integers, $$$N$$$ (1 $$$\leq$$$ $$$N$$$ $$$\leq$$$ $$$1e5$$$) and $$$M$$$ (1 $$$\leq$$$ $$$M$$$ $$$\leq$$$ $$$1e5$$$)

Next N lines contain the language and topic known by each expert, represented by two integers $$$x$$$ (1 $$$\leq$$$ $$$x$$$ $$$\leq$$$ $$$1e5$$$) and $$$y$$$ (1 $$$\leq$$$ $$$y$$$ $$$\leq$$$ $$$1e5$$$)

Next N lines contain the language and topic customer wants to learn, represented by two integers $$$x$$$ (1 $$$\leq$$$ $$$x$$$ $$$\leq$$$ $$$1e5$$$) and $$$y$$$ (1 $$$\leq$$$ $$$y$$$ $$$\leq$$$ $$$1e5$$$) .

Output

Output a single integer, the number of unhappy customers.

Examples

Input
3 2
1 2
2 1
1 1
1 2
4 4
Output
1
Input
3 2
1 2
2 1
1 1
1 2
1 1
Output
0
Input
1 2
1 2
1 2
1 1
Output
1

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.