Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin>>N;
  int64_t Z=0;
  map<string,vector<int64_t>> m;
  vector<int> em(26);
  m["#"]=em;
  vector<pair<int,string>> p(N);
  for(int i=0;i<N;i++){
    string S;
    cin>>S;
    int N=S.size();
    p[i]=make_pair(N,S);
  }
  sort(p.begin(),p.end());
  for(int i=0;i<N;i++){
    int N;
    string S;
    tie(N,S)=p[i];
    if(N==1){
      char a=S[0];
      m["#"][a-'a']++;
    }
    else{
      reverse(S.begin(),S.end());
      string T="";
      vector<int> q(26);
      for(int j=0;j<N;j++){
        int b=S[j]-'a';
        q[b]++;
      }
      if(m.count("#")){
        vector<int> v=m["#"];
        for(int l=0;l<26;l++){
          if(q[l]!=0){
            Z+=m["#"][l];
          }
        }
      }
      for(int j=0;j<N-1;j++){
        T+=S[j];
        q[S[j]-'a']--;
        if(m.count(T)){
          vector<int> v=m[T];
        for(int l=0;l<26;l++){
          if(q[l]!=0){
            Z+=m[T][l];
          }
        }
        }
      }
      m[T]=em;
      m[T][S[N-1]-'a']++;
      
    }
  }
  cout<<Z<<endl;
      
    
}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: no match for 'operator=' (operand types are 'std::map<std::__cxx11::basic_string<char>, std::vector<long int> >::mapped_type' {aka 'std::vector<long int>'} and 'std::vector<int>')
   10 |   m["#"]=em;
      |          ^~
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:36:28: error: conversion from 'vector<long int>' to non-scalar type 'vector<int>' requested
   36 |         vector<int> v=m["#"];
      |                            ^
a.cc:47:28: error: conversion from 'vector<long int>' to non-scalar type 'vector<int>' requested
   47 |           vector<int> v=m[T];
      |                            ^
a.cc:55:12: error: no match for 'operator=' (operand types are 'std::map<std::__cxx11::basic_string<char>, std::vector<long int> >::mapped_type' {aka 'std::vector<long int>'} and 'std::vector<int>')
   55 |       m[T]=em;
      |            ^~
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long int; _Alloc = std::allocator<long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~