- #include<bits/stdc++.h>
- #define distanceSquare(a, b) ((a.first - b.first)*(a.first - b.first) + (a.second - b.second)*(a.second - b.second))
- using namespace std;
- int main()
- {
- #ifdef VSP4
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif // VSP4
- int T, t, n, m, x, y, i, j, repeat, distance;
- long long int ans;
- vector< pair<int, int> > points;
- map<int, int> distancePoints;
- cin >> T;
- for (t = 1; t <= T; t++)
- {
- cin >> n;
- points.resize(n);
- for (i = 0; i < n; i++)
- {
- cin >> points[i].first >> points[i].second;
- }
- ans = 0;
- for (i = 0; i < n; i++)
- {
- distancePoints.clear();
- for (j = 0; j < n; j++)
- {
- if (i != j)
- {
- distance = distanceSquare(points[i], points[j]);
- distancePoints[distance]++;
- //cout << "Adding " << i << " " << j << " with " << distance << "\n";
- }
- }
- for (auto it: distancePoints)
- {
- ans += it.second*(it.second-1)/2;
- }
- }
- cout << "Case #" << t << ": " << ans << "\n";
- }
- return 0;
- }