A Fantastic Right Triangle is a subgraph which uses
A Stupendous Bowtie consists of an unordered pair of Fantastic Right Triangles which share exactly one vertex. Count the number of Stupendous Bowties in the given graph with
Below is an example of a Stupendous Bowtie:
Constraints
For this problem, you will be required to pass all the samples in order to receive points.
Input Specification
The first line contains two space-separated integers
Output Specification
This problem is graded with an identical
checker. This includes whitespace characters. Ensure that every line of output is terminated with a \n
character and that there are no trailing spaces.
Output the number of Stupendous Bowties in the given graph on a single line.
Sample Input 1
5 6
1 2
2 3
3 1
3 4
3 5
4 5
Sample Output 1
1
Sample Input 2
5 10
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
4 5
Sample Output 2
15
Comments