fork download
  1. #include <bits/stdc++.h>
  2. #define sz(x) (int) x.size()
  3. #define pb push_back
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9. int n; cin >> n;
  10. map<int, int> votos;
  11.  
  12. for(int i=0; i<n; i++) {
  13. int ai; cin >> ai;
  14. votos[ai]++;
  15. }
  16.  
  17. int ans = 0, ma = 0;
  18.  
  19. for(auto [c, v] : votos) {
  20. if(v > ma) {
  21. ma = v;
  22. ans = c;
  23. }
  24. }
  25.  
  26. cout << ans << endl;
  27. }
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
0