fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  5. int N;
  6. cin >> N;
  7. unordered_map<int, int> mp;
  8. for (int i = 0; i < N; i++) {
  9. int a[N];
  10. cin >> a[i];
  11. mp[a[i]]++;
  12. }
  13. int max_fre = 0;
  14. int ans=0;
  15. for (auto it : mp) {
  16. if(it.second > max_fre){
  17. max_fre=it.second;
  18. ans = it.first;
  19. }
  20.  
  21. }
  22. cout << ans << endl;
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
0