fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <set>
  5. #include <queue>
  6. #include <map>
  7. #include <stack>
  8. #include <algorithm>
  9. #include <cstring>
  10. #include <cmath>
  11. #include <cstdlib>
  12. #include <cstdio>
  13. #include <iomanip>
  14.  
  15. #define F first
  16. #define S second
  17. #define ll long long
  18. #define len length()
  19. #define sqr(x) x*x
  20. #define pb push_back
  21. #define mp make_pair
  22. #define sz(x) ((int) (x).size())
  23. #define all(x) x.begin(), x.end()
  24. #define allr(x) x.rbegin(), x.rend()
  25. #define bp(x) __builtin_popcount(x)
  26. #define INF numeric_limits<long long int>::max()
  27. #define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  28. #define frp freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
  29. #define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
  30.  
  31. const int maxn = (int)1e6;
  32. const int mod = (int)1e9 + 7;
  33.  
  34. using namespace std;
  35.  
  36. int n;
  37. __int64 mx=-1,ans,x;
  38. map<ll,ll> m;
  39.  
  40. int main(){
  41. ios_base::sync_with_stdio(0);
  42. scanf("%d",&n);
  43. for(int i=0; i < n; i++){
  44. scanf("%I64d",&x);
  45. m[x]++;
  46. }
  47. for(map<ll,ll>::iterator it=m.begin(); it != m.end(); it++){
  48. if((*it).S > mx){
  49. mx=(*it).S;
  50. ans=(*it).F;
  51. }
  52. }
  53. printf("%I64d\n",ans);
  54.  
  55. return 0;
  56. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:37:1: error: '__int64' does not name a type
 __int64 mx=-1,ans,x;
 ^
prog.cpp: In function 'int main()':
prog.cpp:44:18: error: 'x' was not declared in this scope
   scanf("%I64d",&x);
                  ^
prog.cpp:48:16: error: 'mx' was not declared in this scope
   if((*it).S > mx){
                ^
prog.cpp:50:4: error: 'ans' was not declared in this scope
    ans=(*it).F;
    ^
prog.cpp:53:19: error: 'ans' was not declared in this scope
  printf("%I64d\n",ans); 
                   ^
stdout
Standard output is empty