Language: C++

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

bool check(long n) {
  return long(sqrt(n)) * long(sqrt(n)) == n;
}

long dis(vector<int> a, vector<int> b, int n) {
  vector<pair<int,int>> t(n);
  for(int i = 0; i < n; i++)
    t[i].first = a[i], t[i].second = b[i];
  long x = accumulate(t.begin(), t.end(), 0, [](pair<int,int> a, pair<int,int> b) { return (a.first-a.second)*(a.first-a.second) + (b.first-b.second)*(b.first-b.second);});
  if(check(x)) return x;
  else return -1;
}

int main() {
  int m,n;
  cin >> m >> n;
  vector<vector<int>> arr(m);
  for(auto &i:arr) i.resize(n);
  
  for(int i = 0; i < m; i++)
    for(int j = 0; j < n; j++)
      cin >> arr[i][j];
  for(int i = 0; i < m; i++)
    for(int j = i+1; j < m; j++)
      if(dis(arr[i], arr[j]) != -1) cout << dis(arr[i], arr[j]) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: too few arguments to function 'long int dis(std::vector<int>, std::vector<int>, int)'
   28 |       if(dis(arr[i], arr[j]) != -1) cout << dis(arr[i], arr[j]) << endl;
      |          ~~~^~~~~~~~~~~~~~~~
a.cc:8:6: note: declared here
    8 | long dis(vector<int> a, vector<int> b, int n) {
      |      ^~~
a.cc:28:48: error: too few arguments to function 'long int dis(std::vector<int>, std::vector<int>, int)'
   28 |       if(dis(arr[i], arr[j]) != -1) cout << dis(arr[i], arr[j]) << endl;
      |                                             ~~~^~~~~~~~~~~~~~~~
a.cc:8:6: note: declared here
    8 | long dis(vector<int> a, vector<int> b, int n) {
      |      ^~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h: In instantiation of '_Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation) [with _InputIterator = __gnu_cxx::__normal_iterator<pair<int, int>*, vector<pair<int, int> > >; _Tp = int; _BinaryOperation = dis(std::vector<int>, std::vector<int>, int)::<lambda(pair<int, int>, pair<int, int>)>]':
a.cc:12:22:   required from here
   12 |   long x = accumulate(t.begin(), t.end(), 0, [](pair<int,int> a, pair<int,int> b) { return (a.first-a.second)*(a.first-a.second) + (b.first-b.second)*(b.first-b.second);});
      |            ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:169:29: error: no match for call to '(dis(std::vector<int>, std::vector<int>, int)::<lambda(std::pair<int, int>, std::pair<int, int>)>) (int&, std::pair<int, int>&)'
  169 |         __init = __binary_op(_GLIBCXX_MOVE_IF_20(__init), *__first);
      |                  ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:169:29: note: candidate: 'int (*)(std::pair<int, int>, std::pair<int, int>)' (conversion)
/usr/include/c++/14/bits/stl_numeric.h:169:29: note:   candidate expects 3 arguments, 3 provided
a.cc:12:46: note: candidate: 'dis(std::vector<int>, std::vector<int>, int)::<lambda(std::pair<int, int>, std::pair<int, int>)>'
   12 |   long x = accumulate(t.begin(), t.end(), 0, [](pair<int,int> a, pair<int,int> b) { return (a.first-a.second)*(a.first-a.second) + (b.first-b.second)*(b.first-b.second);});
      |                                              ^
a.cc:12:46: note:   no known conversion for argument 1 from 'int' to 'std::pair<int, int>'