Language: C++

using namespace std;
//bitset<10000> issquare;
vector<int> sq(10000, -1);
 
int dist2(vector<vector<int>>& mat, int i, int j) {
    int res = 0;
    for (int d = 0; d < mat[0].size(); ++d) {
        res += (mat[i][d] - mat[j][d])*(mat[i][d] - mat[j][d]);
    }
    return res;
}
 
int main()
{
    int N, D;
    cin >> N >> D;
    vector<vector<int>> mat(N, vector<int>(D,0));
    for (int i = 0 ; i < N; ++i)
        for (int j = 0; j < D; ++j)
            cin >> mat[i][j];
 
    //for (int i = 0; i < 100; ++i)
        //sq[i*i] = i;
        //issquare[i*i] = true;
    
    int count = 0;
    for (int i = 1 ; i < N; ++i)
        for (int j = 0; j < i; ++j) {
            int d = dist2(mat, i, j);
            int sq = sqrt(d);
            if (sq*sq == d) //(sq[d] != -1 && sq[d]*sq[d] == d)//issquare[d])
                ++count;
        }
    
     cout << count << endl;
    return 0;
}

Compiler output:
a.cc:3:1: error: 'vector' does not name a type
    3 | vector<int> sq(10000, -1);
      | ^~~~~~
a.cc:5:11: error: 'vector' was not declared in this scope
    5 | int dist2(vector<vector<int>>& mat, int i, int j) {
      |           ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:5:18: error: 'vector' was not declared in this scope
    5 | int dist2(vector<vector<int>>& mat, int i, int j) {
      |                  ^~~~~~
a.cc:5:18: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:5:25: error: expected primary-expression before 'int'
    5 | int dist2(vector<vector<int>>& mat, int i, int j) {
      |                         ^~~
a.cc:5:37: error: expected primary-expression before 'int'
    5 | int dist2(vector<vector<int>>& mat, int i, int j) {
      |                                     ^~~
a.cc:5:44: error: expected primary-expression before 'int'
    5 | int dist2(vector<vector<int>>& mat, int i, int j) {
      |                                            ^~~
a.cc:5:49: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | int dist2(vector<vector<int>>& mat, int i, int j) {
      |                                                 ^
a.cc: In function 'int main()':
a.cc:16:5: error: 'cin' was not declared in this scope
   16 |     cin >> N >> D;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:17:5: error: 'vector' was not declared in this scope
   17 |     vector<vector<int>> mat(N, vector<int>(D,0));
      |     ^~~~~~
a.cc:17:5: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:17:19: error: expected primary-expression before 'int'
   17 |     vector<vector<int>> mat(N, vector<int>(D,0));
      |                   ^~~
a.cc:20:20: error: 'mat' was not declared in this scope
   20 |             cin >> mat[i][j];
      |                    ^~~
a.cc:29:27: error: 'mat' was not declared in this scope
   29 |             int d = dist2(mat, i, j);
      |                           ^~~
a.cc:29:26: error: 'dist2' cannot be used as a function
   29 |             int d = dist2(mat, i, j);
      |                     ~~~~~^~~~~~~~~~~
a.cc:30:22: error: 'sqrt' was not declared in this scope; did you mean 'sq'?
   30 |             int sq = sqrt(d);
      |                      ^~~~
      |                      sq
a.cc:35:6: error: 'cout' was not declared in this scope
   35 |      cout << count << endl;
      |      ^~~~
a.cc:35:6: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:23: error: 'endl' was not declared in this scope
   35 |      cout << count << endl;
      |                       ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;