Language: C++

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

long long int nCr(int n, int r) {
    long long int ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

int main() {
    int N;
    cin >> N;

    string s[N];
    for(int i=0; i<N; i++){
        cin >> s[i];
    }

    int charcount[N][26] = {0};
    for(int i=0; i<N; i++){
        int mojinum = 0;
        int countnum = 0;
        for(char moji='a'; moji<='z'; moji++){
            for(int j=0; j<s[i].size(); j++){
                if(s[i][j] == moji){
                    charcount[i][mojinum]++;
                    countnum++;
                }

            }
            mojinum++;
            if(countnum >= 10) break;
        }
    }

    long long int ans = 0;
    bool searchflags[N] = {false};
    for(int i=0; i<N; i++){
        int tmp = 0;
        if(searchflags[i] == true) continue;
            for(int j=i+1; j<N; j++){
                //if(searchflags[j] == false) break;
                bool flag = true;
                if(equal(charcount[i][0],charcount[i][25],charcount[j][0],charcount[j][25]) != true) flag = false;
                // for(int mojinum=0; mojinum<26; mojinum++){
                //     if(charcount[i][mojinum]==charcount[j][mojinum]){

                //     }else{
                //         flag = false;
                //         break;
                //     }
                // }
                if(flag){
                    tmp++;
                    searchflags[j] = true;
                    //cerr << j << "flag true" << endl; 
                }

            }
            //cerr << i << " " << tmp << endl;
        
        if(tmp != 0) ans += nCr(tmp+1,2);

    }

    cout << ans << endl;
    return 0;

    
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'bool std::__equal4(_II1, _II1, _II2, _II2) [with _II1 = int; _II2 = int]':
/usr/include/c++/14/bits/stl_algobase.h:1715:38:   required from 'bool std::equal(_II1, _II1, _II2, _II2) [with _II1 = int; _II2 = int]'
 1715 |       return _GLIBCXX_STD_A::__equal4(__first1, __last1, __first2, __last2);
      |                                      ^
a.cc:49:25:   required from here
   49 |                 if(equal(charcount[i][0],charcount[i][25],charcount[j][0],charcount[j][25]) != true) flag = false;
      |                    ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1638:13: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
 1638 |       using _Cat1 = typename iterator_traits<_II1>::iterator_category;
      |             ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1639:13: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
 1639 |       using _Cat2 = typename iterator_traits<_II2>::iterator_category;
      |             ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1640:13: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
 1640 |       using _RAIters = __and_<is_same<_Cat1, _RATag>, is_same<_Cat2, _RATag>>;
      |             ^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1651:19: error: invalid type argument of unary '*' (have 'int')
 1651 |             if (!(*__first1 == *__first2))
      |                   ^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1651:32: error: invalid type argument of unary '*' (have 'int')
 1651 |             if (!(*__first1 == *__first2))
      |                                ^~~~~~~~~