Language: C++

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

bool my_next_permutation(int* array, unsigned int num) {
    for (int i = num - 1; i >= 0; i--) {
        if (array[i] < array[i+1]) {
            int j = num;
            do{
                j--;
            }while (!(array[i] < array[j]));
            std::swap(array[i], array[j]);
            std::sort(array + i+1, array+num);
            return true;
        }
        if (i == 0) {
            std::reverse(array, array + num);
        }
    }
    return false;
}

int main(){
  int N,aa,bb,a,b;
  aa=0;b=0;
  cin>>N;
  vector<int>P(N);
  vector<int>Q(N);
  vector<int>PP(N);
  vector<int>QQ(N);
  for(int i=0;i<N;i++){
    cin>>P.at(i);
  }
  for(int i=0;i<N;i++){
    cin>>Q.at(i);
  }
  PP=sort(P.begin(),P.end());
  QQ=sort(Q.begin(),Q.end());
  do {
    aa++;
    if(PP==P)a=aa;
    }while (my_next_permutation(PP, N));
  do {
    bb++;
    if(QQ==Q)b=bb;
    }while (my_next_permutation(QQ, N));
  cout<<abs(a-b)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:28: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'void')
   36 |   PP=sort(P.begin(),P.end());
      |                            ^
In file included from /usr/include/c++/14/vector:72,
                 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/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'void' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'void' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'void' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:37:28: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'void')
   37 |   QQ=sort(Q.begin(),Q.end());
      |                            ^
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'void' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'void' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'void' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:41:33: error: cannot convert 'std::vector<int>' to 'int*'
   41 |     }while (my_next_permutation(PP, N));
      |                                 ^~
      |                                 |
      |                                 std::vector<int>
a.cc:4:31: note:   initializing argument 1 of 'bool my_next_permutation(int*, unsigned int)'
    4 | bool my_next_permutation(int* array, unsigned int num) {
      |                          ~~~~~^~~~~
a.cc:45:33: error: cannot convert 'std::vector<int>' to 'int*'
   45 |     }while (my_next_permutation(QQ, N));
      |                                 ^~
      |                                 |
      |                                 std::vector<int>
a.cc:4:31: note:   initializing argument 1 of 'bool my_next_permutation(int*, unsigned int)'
    4 | bool my_next_permutation(int* array, unsigned int num) {
      |                          ~~~~~^~~~~