Language: C++

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

double distance(pair<int> a, pair<int> b){
  return sqrt(pow(a.first-b.first,2.0)+pow(a.second-b.second,2.0));
}

int main(){
  int N;
  cin>>N;
  vector<pair<int,int>> xy(N);
  for(int i=0;i<N;i++){
    cin>>xy.at(i).first>>xy.at(i).second;
  }
  
  double sum=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j++){
      sum+=distance(xy.at(i),xy.at(j));
    }
  }
  
  cout<<xy.at(i)*2.0/(double)N<<endl;
}

  

Compiler output:
a.cc:4:25: error: wrong number of template arguments (1, should be 2)
    4 | double distance(pair<int> a, pair<int> b){
      |                         ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:4:38: error: wrong number of template arguments (1, should be 2)
    4 | double distance(pair<int> a, pair<int> b){
      |                                      ^
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc: In function 'double distance(int, int)':
a.cc:5:21: error: request for member 'first' in 'a', which is of non-class type 'int'
    5 |   return sqrt(pow(a.first-b.first,2.0)+pow(a.second-b.second,2.0));
      |                     ^~~~~
a.cc:5:29: error: request for member 'first' in 'b', which is of non-class type 'int'
    5 |   return sqrt(pow(a.first-b.first,2.0)+pow(a.second-b.second,2.0));
      |                             ^~~~~
a.cc:5:46: error: request for member 'second' in 'a', which is of non-class type 'int'
    5 |   return sqrt(pow(a.first-b.first,2.0)+pow(a.second-b.second,2.0));
      |                                              ^~~~~~
a.cc:5:55: error: request for member 'second' in 'b', which is of non-class type 'int'
    5 |   return sqrt(pow(a.first-b.first,2.0)+pow(a.second-b.second,2.0));
      |                                                       ^~~~~~
a.cc: In function 'int main()':
a.cc:18:22: error: expected ';' before ')' token
   18 |     for(int j=i+1;j++){
      |                      ^
      |                      ;
a.cc:19:20: error: no matching function for call to 'distance(__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type&, __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type&)'
   19 |       sum+=distance(xy.at(i),xy.at(j));
      |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h: In substitution of 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = std::pair<int, int>]':
a.cc:19:20:   required from here
   19 |       sum+=distance(xy.at(i),xy.at(j));
      |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: error: no type named 'difference_type' in 'struct std::iterator_traits<std::pair<int, int> >'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
a.cc:4:8: note: candidate: 'double distance(int, int)'
    4 | double distance(pair<int> a, pair<int> b){
      |        ^~~~~~~~
a.cc:4:27: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'int'
    4 | double distance(pair<int> a, pair<int> b){
      |                 ~~~~~~~~~~^
In file included from /usr/include/c++/14/filesystem:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_path.h:1431:1: note: candidate: 'std::ptrdiff_t std::distance(filesystem::__cxx11::path::iterator, filesystem::__cxx11::path::iterator)'
 1431 | distance(filesystem::path::iterator __first, filesystem::path::iterator __last)
      | ^~~~~~~~
/usr/include/c++/14/bits/fs_path.h:1431:37: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'std::filesystem::__cxx11::path::iterator'
 1431 | distance(filesystem::path::iterator __first, filesystem::path::iterator __last)
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:23:15: error: 'i' was not declared in this scope
   23 |   cout<<xy.at(i)*2.0/(double)N<<endl;
      |               ^