Language: C++

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

int main(){
int N;
cin>>N;
vector int loc(2*N);
int n=2*N;
for(i=0;i<n;i++){
    cin>>loc.at(i);
}

vector v(N);
for(i=0;i<N;i++){
    v.at(i)=i+1;
}

//kaijou
int n!=1;
for(i=1;i<N+1,i++){n!*=i;}


double dis;
do
{

   
    double dev=0;
    int x=0;
    int y=0;
    for (int i = 0; i < N-2; i++)
    {
        x=pow(loc(i)-loc(i+2),2);
        y=pow(loc(i+1)-loc(i+3),2);
        dev+=sqrt(x+y);

    }
    
    dis+=dev;
    





} while (next_permutation(v.begin(0),v.end(N)));

cout<<dis/n!;


}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: two or more data types in declaration of 'loc'
    7 | vector int loc(2*N);
      | ^~~~~~
a.cc:9:5: error: 'i' was not declared in this scope
    9 | for(i=0;i<n;i++){
      |     ^
a.cc:10:10: error: 'loc' was not declared in this scope; did you mean 'log'?
   10 |     cin>>loc.at(i);
      |          ^~~
      |          log
a.cc:13:11: error: class template argument deduction failed:
   13 | vector v(N);
      |           ^
a.cc:13:11: error: no matching function for call to 'vector(int&)'
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  707 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  678 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note:   template argument deduction/substitution failed:
a.cc:13:11: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   13 | vector v(N);
      |           ^
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
  659 |       vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
  640 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
  635 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
  624 |       vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
  620 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note:   template argument deduction/substitution failed:
a.cc:13:11: note:   mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
   13 | vector v(N);
      |           ^
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
  601 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note:   template argument deduction/substitution failed:
a.cc:13:11: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
   13 | vector v(N);
      |           ^
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  569 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note:   template argument deduction/substitution failed:
a.cc:13:11: note:   couldn't deduce template parameter '_Tp'
   13 | vector v(N);
      |           ^
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>'
  542 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note:   template argument deduction/substitution failed:
a.cc:13:11: note:   couldn't deduce template parameter '_Tp'
   13 | vector v(N);
      |           ^
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>'
  531 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   template argument deduction/substitution failed:
a.cc:13:11: note:   mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
   13 | vector v(N);
      |           ^
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> vector<_ValT, _Allocator>'
 2033 |     vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
      |     ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:2033:5: note:   candidate expects 2 arguments, 1 provided
a.cc:14:5: error: 'i' was not declared in this scope
   14 | for(i=0;i<N;i++){
      |     ^
a.cc:19:6: error: expected initializer before '!=' token
   19 | int n!=1;
      |      ^~
a.cc:20:5: error: 'i' was not declared in this scope
   20 | for(i=1;i<N+1,i++){n!*=i;}
      |     ^
a.cc:20:18: error: expected ';' before ')' token
   20 | for(i=1;i<N+1,i++){n!*=i;}
      |                  ^
      |                  ;
a.cc:20:21: error: expected ';' before '!' token
   20 | for(i=1;i<N+1,i++){n!*=i;}
      |                     ^
      |                     ;
a.cc:33:15: error: 'loc' was not declared in this scope; did you mean 'log'?
   33 |         x=pow(loc(i)-loc(i+2),2);
      |               ^~~
      |               log
a.cc:48:12: error: expected ';' before '!' token
   48 | cout<<dis/n!;
      |            ^
      |            ;