Language: C++

#include <iostream>
#include <map>
#include <string>
using namespace std;

int main(){
	map<int,int> name;
  	map<char,int> name_to_int;
  	
  	name_to_int["M"]=0;
  	name_to_int["A"]=1;
  	name_to_int["R"]=2;
  	name_to_int["C"]=3;
  	name_to_int["H"]=4;
  
  	int n;
  	cin>>n;
  	for(int i=0;i<n;i++){
      string s;
      name[name_to_int[s[0]]]+=1;
    }
  	int ans=0;
  	for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
        for(int k=j+1;k<n;k++){
          ans+=name[i]*name[j]*name[k];
        }
      }
    }
  	cout<<ans<<endl;
}
      


Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: ambiguous overload for 'operator[]' (operand types are 'std::map<char, int>' and 'const char [2]')
   10 |         name_to_int["M"]=0;
      |                    ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:10:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   10 |         name_to_int["M"]=0;
      |                     ^~~
      |                     |
      |                     const char*
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:10:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   10 |         name_to_int["M"]=0;
      |                     ^~~
      |                     |
      |                     const char*
a.cc:11:20: error: ambiguous overload for 'operator[]' (operand types are 'std::map<char, int>' and 'const char [2]')
   11 |         name_to_int["A"]=1;
      |                    ^
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:11:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   11 |         name_to_int["A"]=1;
      |                     ^~~
      |                     |
      |                     const char*
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:11:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   11 |         name_to_int["A"]=1;
      |                     ^~~
      |                     |
      |                     const char*
a.cc:12:20: error: ambiguous overload for 'operator[]' (operand types are 'std::map<char, int>' and 'const char [2]')
   12 |         name_to_int["R"]=2;
      |                    ^
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:12:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   12 |         name_to_int["R"]=2;
      |                     ^~~
      |                     |
      |                     const char*
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:12:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   12 |         name_to_int["R"]=2;
      |                     ^~~
      |                     |
      |                     const char*
a.cc:13:20: error: ambiguous overload for 'operator[]' (operand types are 'std::map<char, int>' and 'const char [2]')
   13 |         name_to_int["C"]=3;
      |                    ^
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:13:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   13 |         name_to_int["C"]=3;
      |                     ^~~
      |                     |
      |                     const char*
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:13:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   13 |         name_to_int["C"]=3;
      |                     ^~~
      |                     |
      |                     const char*
a.cc:14:20: error: ambiguous overload for 'operator[]' (operand types are 'std::map<char, int>' and 'const char [2]')
   14 |         name_to_int["H"]=4;
      |                    ^
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:14:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   14 |         name_to_int["H"]=4;
      |                     ^~~
      |                     |
      |                     const char*
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; mapped_type = int; key_type = char]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:14:21: error: invalid conversion from 'const char*' to 'std::map<char, int>::key_type' {aka 'char'} [-fpermissive]
   14 |         name_to_int["H"]=4;
      |                     ^~~
      |                     |
      |                     const char*