#P6341. Counting Right Triangles
Counting Right Triangles
Counting Right Triangles
Given \(n\) points on the plane, count the number of distinct right triangles whose vertices are among the given points. A triangle is considered right if one of its interior angles is exactly \(\frac{\pi}{2}\) (i.e. the dot product of the vectors forming that angle is 0). Two triangles are distinct if they differ in at least one vertex.
inputFormat
The first line contains an integer \(n\) representing the number of points. Each of the next \(n\) lines contains two space-separated integers \(x\) and \(y\), which are the coordinates of a point.
outputFormat
Output a single integer: the number of distinct right triangles.
sample
3
0 0
3 0
0 4
1