There are points given in a space.
There are no three points, such that they lie on the same straight line.
Each pair of points is connected by a segment coloured red or black.
Each triangle, whose sides have the same colour is called a monochromatic triangle.
We are given a list of all red segments and we want to find the number of all monochromatic triangles.
Task
Write a program that:
reads from the standard input the following data:
the number of points, the number of red segments and their list,
finds the number of monochromatic triangles,
writes the result to the standard output.
Input
In the first line of the standard input there is one integer , ,
which equals the number of points.
In the second line there is one integer , ,
which equals the number of red segments.
In each of the following lines there are two integers and separated by a single space,
.
They are numbers of vertices which are ends of a red segment.
Output
In the first line of the standard output there should be written one integer —
the number of monochromatic triangles.
Example
For the input data:
6
9
1 2
2 3
2 5
1 4
1 6
3 4
4 5
5 6
3 6
the correct result is:
2
Task author: Wojciech Guzicki.
Kontakt
W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem szkopul@fri.edu.pl.
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, odwiedź nasze serwery na Discordzie. Są one moderowane przez społeczność, ale członkowie zespołu wsparcia również aktywnie się tam udzielają.