fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7.  
  8. int n;
  9. cin >> n;
  10. map<int, int> freq;
  11. for (int i = 0; i < n; i++) {
  12. int x;
  13. cin >> x;
  14. freq[x]++;
  15. }
  16. int mxid = 0;
  17. for (auto it : freq) {
  18. if (freq[mxid] < it.second)
  19. mxid = it.first;
  20. }
  21. cout << mxid;
  22. }
Success #stdin #stdout 0s 544KB
stdin
4
4000
3500
4000
4000
stdout
4000