Submit solution
Points:
1
Time limit:
4.0s
C++11
0.5s
C++14
0.5s
C++17
0.5s
C++20
0.5s
Memory limit:
256M
Author:
Problem type
Problem Statement
You are given an undirected graph with vertices and edges. Pondo would like you to determine the number of -cycles in the graph. A -cycle (triangle) is a cycle of length in the graph.
Input Statement
Your first line will contain two space-separated integers and (respectively).
Your next line lines will contain two space-separated integers each, and , representing an edge between nodes and .
Output Statement
You should output a single integer representing the number of -cycles in the given graph.
Constraints
- all pairs are unique and
Sample Cases
Input 1
5 10
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
4 5
Output 1
10
Explanation 1
Notice that all triples of nodes form -cycles.
Input 2
6 8
1 2
1 3
2 3
2 4
3 5
4 5
4 6
5 6
Output 2
2
Explanation 2
There are only two -cycles formed by and .
Comments