Language: C++

#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  int n; cin  >>n;
  map<string,int> MAP;
  vector<string> s(n);
  rep(i,n) {
  string a;
  cin >>a;
  s[i]=a;
  MAP[a]++;
  }
  int count=0;
  for(string S:s)  count =max(count,MAP[S]);
  for(map it:MAP) {
      if (it.second == count) {
      cout << it.first << endl;
      }
  }
  //for(auto it=MAP.begin();it!=MAP.end();it++) if(MAP[it]==count) cout <<it<<endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:32:14: error: class template argument deduction failed:
   32 |   for(map it:MAP) {
      |              ^~~
a.cc:32:14: error: no matching function for call to 'map(std::pair<const std::__cxx11::basic_string<char>, int>&)'
In file included from /usr/include/c++/14/debug/map:43,
                 from /usr/include/c++/14/map:69,
                 from a.cc:12:
/usr/include/c++/14/debug/map.h:718:5: note: candidate: 'template<class _InputIterator, class _Compare, class _Allocator, class, class, class> std::__debug::map(_InputIterator, _InputIterator, _Compare, _Allocator)-> map<typename std::remove_const<typename std::iterator_traits< <template-parameter-1-1> >::value_type::first_type>::type, typename std::iterator_traits< <template-parameter-1-1> >::value_type::second_type, _Compare, _Allocator>'
  718 |     map(_InputIterator, _InputIterator,
      |     ^~~
/usr/include/c++/14/debug/map.h:718:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/debug/map.h:727:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator, class, class> std::__debug::map(std::initializer_list<std::pair<_T1, _T2> >, _Compare, _Allocator)-> map<_Key, _Tp, _Compare, _Allocator>'
  727 |     map(initializer_list<pair<_Key, _Tp>>,
      |     ^~~
/usr/include/c++/14/debug/map.h:727:5: note:   template argument deduction/substitution failed:
a.cc:32:14: note:   'std::pair<const std::__cxx11::basic_string<char>, int>' is not derived from 'std::initializer_list<std::pair<_T1, _T2> >'
   32 |   for(map it:MAP) {
      |              ^~~
/usr/include/c++/14/debug/map.h:734:5: note: candidate: 'template<class _InputIterator, class _Allocator, class, class> std::__debug::map(_InputIterator, _InputIterator, _Allocator)-> map<typename std::remove_const<typename std::iterator_traits< <template-parameter-1-1> >::value_type::first_type>::type, typename std::iterator_traits< <template-parameter-1-1> >::value_type::second_type, std::less<typename std::remove_const<typename std::iterator_traits< <template-parameter-1-1> >::value_type::first_type>::type>, _Allocator>'
  734 |     map(_InputIterator, _InputIterator, _Allocator)
      |     ^~~
/usr/include/c++/14/debug/map.h:734:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/debug/map.h:740:5: note: candidate: 'template<class _Key, class _Tp, class _Allocator, class> std::__debug::map(std::initializer_list<std::pair<_T1, _T2> >, _Allocator)-> map<_Key, _Tp, std::less<_Key>, _Allocator>'
  740 |     map(initializer_list<pair<_Key, _Tp>>, _Allocator)
      |     ^~~
/usr/include/c++/14/debug/map.h:740:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/debug/map:37:11: note: candidate: 'template<class _Key, class _Tp, class _Cmp, class _Allocator> map(std::__debug::map<_Key, _Tp, _Cmp, _Allocator>)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
   37 |     class map;
      |           ^~~
/usr/include/c++/14/debug/map:37:11: note:   template argument deduction/substitution failed:
a.cc:32:14: note:   'std::pair<const std::__cxx11::basic_string<char>, int>' is not derived from 'std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
   32 |   for(map it:MAP) {
      |              ^~~
/usr/include/c++/14/debug/map.h:104:7: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> map()-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  104 |       map() = default;
      |       ^~~
/usr/include/c++/14/debug/map.h:104:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/debug/map.h:105:7: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> map(const std::__debug::map<_Key, _Tp, _Compare, _Allocator>&)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  105 |       map(const map&) = default;
      |       ^~~
/usr/include/c++/14/debug/map.h:105:7: note:   template argument deduction/substitution failed:
a.cc:32:14: note:   'std::pair<const std::__cxx11::basic_string<char>, int>' is not derived from 'const std::__debug::map<_Key, _Tp, _Compare, _Allocator>'
   32 |   for(map it:MAP) {
      |              ^~~
/usr/include/c++/14/debug/map.h:106:7: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> map(std::__debug::map<_Key, _Tp, _Compare, _Allocator>&&)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  106 |       map(map&&) = default;
      |       ^~~
/usr/include/c++/14/debug/map.h:106:7: note:   template argument deduction/substitution failed:
a.cc:32:14: note:   'std::pair<const std::__cxx11::basic_string<char>, int>' is not derived from 'std::__debug::map<_Key, _Tp, _Compare, _Allocator>'
   32 |   for(map it:MAP) {
      |              ^~~
/usr/include/c++/14/debug/map.h:108:7: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> map(std::initializer_list<std::pair<const _Key, _Tp> >, const _Compare&, const _Allocator&)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  108 |       map(initializer_list<value_type> __l,
      |       ^~~
/usr/include/c++/14/debug/map.h:108:7: note:   template argument deduction/substitution failed:
a.cc:32:14: note:   'std::pair<const std::__cxx11::basic_string<char>, int>' is not derived from 'std::initializer_list<std::pair<const _Key, _Tp> >'
   32 |   for(map it:MAP) {
      |              ^~~
/usr/include/c++/14/debug/map.h:117:7: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> map(const std::__debug::map<_Key, _Tp, _Compare, _Allocator>&, std::__type_identity_t<_Alloc>&)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  117 |       map(const map& __m, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/debug/map.h:117:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/debug/map.h:120:7: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> map(std::__debug::map<_Key, _Tp, _Compare, _Allocator>&&, std::__type_identity_t<_Alloc>&)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  120 |       map(map&& __m, const __type_identity_t<allocator_type>& __a)
      |       ^~~
/usr/include/c++/14/debug/map.h:120:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/debug/map.h:125:7: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> map(std::initializer_list<std::pair<const _Key, _Tp> >, const _Allocator&)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  125 |       map(initializer_list<value_type> __l, const allocator_type& __a)
      |       ^~~
/usr/include/c++/14/debug/map.h:125:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/debug/map.h:129:9: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator, class _InputIterator> map(_InputIterator, _InputIterator, const _Allocator&)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  129 |         map(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/debug/map.h:129:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/debug/map.h:139:7: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator> map(typename std::__debug::map<_Key, _Tp, _Compare, _Allocator>::_Base_ref)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  139 |       map(_Base_ref __x)
      |       ^~~
/usr/include/c++/14/debug/map.h:139:7: note:   template argument deduction/substitution failed:
a.cc:32:14: note:   couldn't deduce template parameter '_Key'
   32 |   for(map it:MAP) {
      |              ^~~
/usr/include/c++/14/debug/map.h:147:9: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Allocator, class _InputIterator> map(_InputIterator, _InputIterator, const _Compare&, const _Allocator&)-> std::__debug::map<_Key, _Tp, _Cmp, _Allocator>'
  147 |         map(_InputIterator __first, _InputIterator __last,
      |         ^~~
/usr/include/c++/14/debug/map.h:147:9: note:   candidate expects 2 arguments, 1 provided
a.cc:32:14: note: explicit deduction guides not considered for copy-initialization
   32 |   for(map it:MAP) {
      |              ^~~