100 atcoder#ABC133B. [ABC133B] Good Distance
[ABC133B] Good Distance
Score : points
Problem Statement
There are points in a -dimensional space.
The coordinates of the -th point are .
The distance between two points with coordinates and is $\sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}$.
How many pairs are there such that the distance between the -th point and the -th point is an integer?
Constraints
- All values in input are integers.
- No two given points have the same coordinates. That is, if , there exists such that .
Input
Input is given from Standard Input in the following format:
Output
Print the number of pairs such that the distance between the -th point and the -th point is an integer.
3 2
1 2
5 5
-2 8
1
The number of pairs with an integer distance is one, as follows:
- The distance between the first point and the second point is , which is an integer.
- The distance between the second point and the third point is , which is not an integer.
- The distance between the third point and the first point is , which is not an integer.
3 4
-3 7 8 2
-12 1 10 2
-2 8 9 3
2
5 1
1
2
3
4
5
10