Language: C++

#pragma GCC optimize "-O3"
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<ll,ll>
#define twol pair<ll,ll>
#define four pair<two,two>
#define pb push_back
#define mk make_pair
#define y1 y1922
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<ll>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (ll)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
#define FAST std::ios::sync_with_stdio(false)
#define xRand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rnd rng
#define IT iterator
typedef
tree<
  ll,// aq pair<ll,ll> shegidzlia
  null_type,
  less/*_equal*/<ll>,// aqac
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;
// '_equal' mashin ginda roca multiset gchirdeba
template<class key, class value,class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<ll, ll> my_map;
inline ll rin(){
	ll x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
inline ll bin(){
	ll x=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
map<vll,ll>mp;
ll n,ans;
string str;
ll get(vi v){
	ll p1=29,p2=1000003,p3;
	p3=p1;
	ll o=0;
	for(auto i:v){
		o+=(ll)p1*(ll)i*1LL;
		p1*=p3;
		p1%=p2;
		o%=p2;
	}
	return o;
}
void process(string str){
	map<char,ll>mp_ch;
	vi v;
	for(auto i:str){
		mp_ch[i]++;
	}
	for(char i='a';i<='z';i++){
		v.pb(mp_ch[i]);
	}
	ll u=get(v);
	ans+=mp[u];
//	cout<<mp[u]<<endl;
	mp[u]++;
}
int main(){FAST;xRand;
cin>>n;
for(int i=0;i<n;i++){
	cin>>str;
	process(str);
}
cout<<ans<<endl;

}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/



Compiler output:
a.cc: In function 'void process(std::string)':
a.cc:92:16: error: no match for 'operator[]' (operand types are 'std::map<std::vector<long long int>, long long int>' and 'long long int')
   92 |         ans+=mp[u];
      |                ^
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: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 = std::vector<long long int>; _Tp = long long int; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::pair<const std::vector<long long int>, long long int> >; mapped_type = long long int; key_type = std::vector<long long int>]'
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:34: note:   no known conversion for argument 1 from 'long long int' to 'const std::map<std::vector<long long int>, long long int>::key_type&' {aka 'const std::vector<long long int>&'}
  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::vector<long long int>; _Tp = long long int; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::pair<const std::vector<long long int>, long long int> >; mapped_type = long long int; key_type = std::vector<long long int>]'
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:29: note:   no known conversion for argument 1 from 'long long int' to 'std::map<std::vector<long long int>, long long int>::key_type&&' {aka 'std::vector<long long int>&&'}
  524 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
a.cc:94:11: error: no match for 'operator[]' (operand types are 'std::map<std::vector<long long int>, long long int>' and 'long long int')
   94 |         mp[u]++;
      |           ^
/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::vector<long long int>; _Tp = long long int; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::pair<const std::vector<long long int>, long long int> >; mapped_type = long long int; key_type = std::vector<long long int>]'
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:34: note:   no known conversion for argument 1 from 'long long int' to 'const std::map<std::vector<long long int>, long long int>::key_type&' {aka 'const std::vector<long long int>&'}
  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::vector<long long int>; _Tp = long long int; _Compare = std::less<std::vector<long long int> >; _Alloc = std::allocator<std::pair<const std::vector<long long int>, long long int> >; mapped_type = long long int; key_type = std::vector<long long int>]'
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:29: note:   no known conversion for argument 1 from 'long long int' to 'std::map<std::vector<long long int>, long long int>::key_type&&' {aka 'std::vector<long long int>&&'}
  524 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~