Score : 1400 points
There are N turkeys. We number them from 1 through N.
M men will visit here one by one. The i-th man to visit will take the following action:
Find the number of pairs (i,\ j) (1 ≤ i < j ≤ N) such that the following condition is held:
Input is given from Standard Input in the following format:
N M x_1 y_1 x_2 y_2 : x_M y_M
Print the number of pairs (i,\ j) (1 ≤ i < j ≤ N) such that the condition is held.
3 1 1 2
2
(i,\ j) = (1,\ 3), (2,\ 3) satisfy the condition.
4 3 1 2 3 4 2 3
1
(i,\ j) = (1,\ 4) satisfies the condition. Both turkeys 1 and 4 are alive if:
3 2 1 2 1 2
0
10 10 8 9 2 8 4 6 4 9 7 8 2 8 1 8 3 4 3 4 2 7
5