1. #include<bits/stdc++.h>
  2. #define distanceSquare(a, b) ((a.first - b.first)*(a.first - b.first) + (a.second - b.second)*(a.second - b.second))
  3. using namespace std;
  4. int main()
  5. {
  6. #ifdef VSP4
  7. freopen("input.txt", "r", stdin);
  8. freopen("output.txt", "w", stdout);
  9. #endif // VSP4
  10. int T, t, n, m, x, y, i, j, repeat, distance;
  11. long long int ans;
  12. vector< pair<int, int> > points;
  13. map<int, int> distancePoints;
  14. cin >> T;
  15. for (t = 1; t <= T; t++)
  16. {
  17. cin >> n;
  18. points.resize(n);
  19. for (i = 0; i < n; i++)
  20. {
  21. cin >> points[i].first >> points[i].second;
  22. }
  23. ans = 0;
  24. for (i = 0; i < n; i++)
  25. {
  26. distancePoints.clear();
  27. for (j = 0; j < n; j++)
  28. {
  29. if (i != j)
  30. {
  31. distance = distanceSquare(points[i], points[j]);
  32. distancePoints[distance]++;
  33. //cout << "Adding " << i << " " << j << " with " << distance << "\n";
  34. }
  35. }
  36. for (auto it: distancePoints)
  37. {
  38. ans += it.second*(it.second-1)/2;
  39. }
  40. }
  41. cout << "Case #" << t << ": " << ans << "\n";
  42. }
  43. return 0;
  44. }