LearnPy Hub
← Arena
AdvancedRating 1500

Pairs That Can't Meet

Count the pairs of nodes (u < v) in the undirected graph that are not connected by any path.

Input

n and m; then m lines 'u v'.

Output

One integer.

Sample 1

Input
3 3
1 2
2 3
1 3
Output
0

Sample 2

Input
7 5
1 3
1 6
3 5
2 6
4 7
Output
10
solution.py
Output appears here
Pairs That Can't Meet · Python Arena problem · LearnPy Hub