Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N =1e7+100;
const int mod =1e7+3;
char s[100];
int cnt[N];
long long base =211,Hash1[100];

void Hash2()
{
   ll ha=0,ba =213,mod1 =1e6+7;
   for(int i=1;s[i]!='\0';i++)
   {
       ha =(ha*ba)%mod1;
       ha =(ha+Hash1[i])%mod1;
   }
   cnt[ha]++;
   return ;
}
void Hash()
{
   ll ha=0,ans =0;
   for(ll i=1;s[i]!='\0';i++)
   {
       ha =(ha*base)%mod;
       ha =(ha+s[i])%mod;
       Hash1[i] =ha;
   }
   Hash2();
   return ;
}
void init()
{
    memset(cnt,0,sizeof(cnt));
}
int main()
{
    ll n;
    while(~scanf("%lld",&n))
    {
        init();
        for(ll i=0; i<n; i++)
        {
            scanf("%s",s+1);
            int l =strlen(s);
            sort(s+1,l);
            Hash();
        }
        ll ans =0;
        for(int i=0;i<1e6+7;i++)
        {
            ans +=(long long)cnt[i]*(cnt[i]-1)/2;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:17: error: no matching function for call to 'sort(char*, int&)'
   47 |             sort(s+1,l);
      |             ~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   template argument deduction/substitution failed:
a.cc:47:17: note:   deduced conflicting types for parameter '_RAIter' ('char*' and 'int')
   47 |             sort(s+1,l);
      |             ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided