Language: C++

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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};


template<class T>
void combination(const vector<T>& seed, int target_size, bool (*callback)(const vector<T>&)) {
    vector<int> indices(target_size);
    const int seed_size = seed.size();
    int start_index = 0;
    int size = 0;

    while (size >= 0) {
        for (int i = start_index; i < seed_size; ++i) {
            indices[size++] = i;
            if (size == target_size) {
                vector<T> comb(target_size);
                for (int x = 0; x < target_size; ++x) {
                    comb[x] = seed[indices[x]];
                }
                if (callback(comb)) return;
                break;
            }
        }
        --size;
        if (size < 0) break;
        start_index = indices[size] + 1;
    }
}

bool compare(string a, string b) {
	for (int i; i< 10 ;i++) {
		if (a[i] < b[i]) return false;
	}
    return true;
}

string s[100000];
UnionFind<int> uf(100000);

bool my_callback(const vector<int>& comb) {
    bool result = true;
	rep(i,0,10) {
		if (s[comb[0]][i] != s[comb[1]][i]) {
			result = false;
			break;
		}
	}
	if (result) ans++;
    return false;
}

int main() {
	ll N;
	cin >> N;
	
	rep(i,0,N) {
		cin >> s[i];
		sort(s[i].begin(), s[i].end());
	}
	sort(s, s+N, compare);

	bool result;
	ll suu = 1;
	ll ans = 0;
	rep(i,0,N-1) {
		result = true;
		rep(j,0,10) {
			if (s[i][j] != s[i+1][j]) {
				result = false;
				ans += (suu * (suu-1)) /2;
				// cout << suu << " " << (suu * (suu-1)) /2 << endl;
				suu = 1;
				break;
			}
		}
		if (result) {
			suu++;
			// ans++;
		}
	}
	ans += (suu * (suu-1)) /2;

	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'bool my_callback(const std::vector<int>&)':
a.cc:108:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
  108 |         if (result) ans++;
      |                     ^~~
      |                     abs