#codeforcesP2009D. Satyam and Counting
Satyam and Counting
Problem
Satyam is given n distinct points on the 2D coordinate plane. It is guaranteed that for all given points . How many different nondegenerate right triangles∗ can be formed from choosing three different points as its vertices?
Two triangles and are different if there is point such that is a vertex of but not a vertex of
nondegenerate right triangle has positive area and an interior angle.
Input
The first line contains an integer — the number of test cases.
The first line of each test case contains an integer — the number of points.
The following lines contain two integers and — the -th point that Satyam can choose from. It is guaranteed that all are pairwise distinct.
Output
Output an integer for each test case, the number of distinct nondegenerate right triangles that can be formed from choosing three points.
Example : in
3
5
1 0
1 1
3 0
5 0
2 1
3
0 0
1 0
3 0
9
1 0
2 0
3 0
4 0
5 0
2 1
7 1
8 1
9 1
Example : out
4
0
8
Note
The four triangles in question for the first test case:
相关
在下列比赛中: