fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. vector<int> a;
  8. map<int, int> mp;
  9. for(int i=0; i<n; i++){
  10. int x, y;
  11. cin >> x >> y;
  12. mp[x]++;
  13. }
  14. vector<int> k;
  15. for(auto &p : mp){
  16. if(p.second >= 2){
  17. int x = p.second;
  18. k.push_back(x);
  19. }
  20. }
  21. int s = 0;
  22. for(int x : k){
  23. x--;
  24. for(int i=0; i<=x; i++){
  25. s += i;
  26. }
  27. }
  28. cout << s;
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0.01s 5224KB
stdin
Standard input is empty
stdout
Standard output is empty