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> test, distancePoints[2005];
  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. distancePoints[i].clear();
  22. cin >> points[i].first >> points[i].second;
  23. }
  24. for (i = 0; i < n; i++)
  25. {
  26. distancePoints[i].clear();
  27. }
  28. ans = 0;
  29. for (i = 0; i < n; i++)
  30. {
  31. for (j = i+1; j < n; j++)
  32. {
  33. distance = distanceSquare(points[i], points[j]);
  34. distancePoints[i][distance]++;
  35. distancePoints[j][distance]++;
  36. //cout << "Adding " << i << " " << j << " with " << distance << "\n";
  37. }
  38. }
  39. ans = 0;
  40. for (i = 0; i < n; i++)
  41. {
  42. for (auto it: distancePoints[i])
  43. {
  44. ans += it.second*(it.second-1)/2;
  45. }
  46. }
  47. cout << "Case #" << t << ": " << ans << "\n";
  48. }
  49. return 0;
  50. }