#abc190c. [abc190_c]Bowls and Dishes
[abc190_c]Bowls and Dishes
Problem Statement
We have dishes numbered and conditions numbered .
Condition is satisfied when both Dish and Dish have (one or more) balls on them.
There are people numbered . Person will put a ball on Dish or Dish .
At most how many conditions will be satisfied?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4 4
1 2
1 3
2 4
3 4
3
1 2
1 3
2 3
Sample Output 1
2
For example, if People put their balls on Dishes , respectively, Conditions and will be satisfied.
Sample Input 2
4 4
1 2
1 3
2 4
3 4
4
3 4
1 2
2 4
2 4
Sample Output 2
4
For example, if People put their balls on Dishes , respectively, all conditions will be satisfied.
Sample Input 3
6 12
2 3
4 6
1 2
4 5
2 6
1 5
4 5
1 3
1 2
2 6
2 3
2 5
5
3 5
1 4
2 6
4 6
5 6
Sample Output 3
9