Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define hell 1000000007
#define PI 3.14159265358979323846
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;

   // cin>>t;
    while(t--)
    {
        ll n,m,i,j;
        cin>>n;
        map<pair<char,char>,ll> mp;
        for(i=1;i<=n;i++)
        {
            string s=to_string(i);
            mp[{s[0],s.back()}]++;
        }

        ll ans=0;
        map<pair<char,char> >::iterator it;
        for(it=mp.begin();it!=mp.end();it++)
        {
            if(it->first.first==it->second.second)
                ans+=it->second*it->second;
            else
            ans+=it->second*(mp[{it->first.second,it->first.first}]);
        }
        cout<<ans;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:29: error: wrong number of template arguments (1, should be at least 2)
   28 |         map<pair<char,char> >::iterator it;
      |                             ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:28:41: error: expected initializer before 'it'
   28 |         map<pair<char,char> >::iterator it;
      |                                         ^~
a.cc:29:13: error: 'it' was not declared in this scope; did you mean 'i'?
   29 |         for(it=mp.begin();it!=mp.end();it++)
      |             ^~
      |             i
a.cc:34:32: error: no match for 'operator[]' (operand types are 'std::map<std::pair<char, char>, long long int>' and '<brace-enclosed initializer list>')
   34 |             ans+=it->second*(mp[{it->first.second,it->first.first}]);
      |                                ^
/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 = std::pair<char, char>; _Tp = long long int; _Compare = std::less<std::pair<char, char> >; _Alloc = std::allocator<std::pair<const std::pair<char, char>, long long int> >; mapped_type = long long int; key_type = std::pair<char, char>]'
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:34: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::map<std::pair<char, char>, long long int>::key_type&' {aka 'const std::pair<char, char>&'}
  504 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/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 = std::pair<char, char>; _Tp = long long int; _Compare = std::less<std::pair<char, char> >; _Alloc = std::allocator<std::pair<const std::pair<char, char>, long long int> >; mapped_type = long long int; key_type = std::pair<char, char>]'
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:29: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::pair<char, char>, long long int>::key_type&&' {aka 'std::pair<char, char>&&'}
  524 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~