Language: C++

#include <stdio.h>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <unordered_map>

int main()
{
    ios::sync_with_stdio(false);

    int N;

    scanf("%d", &N);

    string S;

    vector<string> strings;

    for (int i = 0; i < N; i++)
    {
        cin >> S;
        sort(S.begin(), S.end());
        //cout << endl << S;
        strings.push_back(S);
    }
    
    //helper(strings);

    long long pairs = 0;

    unordered_map<string, long long> strFreq;

    sort(strings.begin(), strings.end());

    for (string s : strings)
    {
        if (strFreq.find(s) == strFreq.end())
        {
            strFreq[s] = 1;
        }
        else 
        {
            pairs += strFreq[s];
            strFreq[s]++;
        }
    }

    cout << pairs << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'ios' has not been declared
   10 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:16:5: error: 'string' was not declared in this scope
   16 |     string S;
      |     ^~~~~~
a.cc:16:5: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from a.cc:3:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:18:5: error: 'vector' was not declared in this scope
   18 |     vector<string> strings;
      |     ^~~~~~
a.cc:18:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:18:20: error: 'strings' was not declared in this scope; did you mean 'stdin'?
   18 |     vector<string> strings;
      |                    ^~~~~~~
      |                    stdin
a.cc:22:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   22 |         cin >> S;
      |         ^~~
      |         std::cin
In file included from a.cc:4:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:22:16: error: 'S' was not declared in this scope
   22 |         cin >> S;
      |                ^
a.cc:23:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   23 |         sort(S.begin(), S.end());
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:32:5: error: 'unordered_map' was not declared in this scope
   32 |     unordered_map<string, long long> strFreq;
      |     ^~~~~~~~~~~~~
a.cc:32:5: note: suggested alternatives:
In file included from /usr/include/c++/14/unordered_map:41,
                 from a.cc:6:
/usr/include/c++/14/bits/unordered_map.h:109:11: note:   'std::unordered_map'
  109 |     class unordered_map
      |           ^~~~~~~~~~~~~
/usr/include/c++/14/unordered_map:67:13: note:   'std::pmr::unordered_map'
   67 |       using unordered_map
      |             ^~~~~~~~~~~~~
a.cc:32:27: error: expected primary-expression before 'long'
   32 |     unordered_map<string, long long> strFreq;
      |                           ^~~~
a.cc:34:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   34 |     sort(strings.begin(), strings.end());
      |     ^~~~
      |     std::sort
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:36:16: error: expected ';' before 's'
   36 |     for (string s : strings)
      |                ^~
      |                ;
a.cc:49:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   49 |     cout << pairs << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:49:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   49 |     cout << pairs << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:51:5: error: expected primary-expression before 'return'
   51 |     return 0;
      |     ^~~~~~
a.cc:49:27: error: expected ')' before 'return'
   49 |     cout << pairs << endl;
      |                           ^
      |                           )
   50 | 
   51 |     return 0;
      |     ~~~~~~                 
a.cc:36:9: note: to match this '('
   36 |     for (string s : strings)
      |         ^