Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main(){
    int N;
    cin >> N;
    int P[N], Q[N];
    for (int i=0; i <N; i++){
        cin >> P[i];
    }
    for (int i=0; i<N; i++){
        cin >> Q[i];
    }
    int p = 1;
    int q = 1;
    vector<int> s(N);
    for (int i=0 ;i<N; i++){
        s[i] = i+1;
    }
    for(int i=0 ;i<N; i++){
        int l = find(s.begin(), s.end(), P[i]) - s.begin();
        s.erase(find(s.begin(), s.end(), P[i]));
        for (int j = 1; j<N-i; j++){
            l *= j;
        }
        p += l;        
    }
    vector<int> t(N);
    for (int i=0 ;i<N; i++){
        t[i] = i+1;
    }
    for(int i=0 ;i<N; i++){
        int l = find(t.begin(), t.end(), Q[i]) - t.begin();
        t.erase(find(t.begin(), t.end(), Q[i]));
        for (int j = 1; j<N-i; j++){
            l *= j;
        }
        q += l;        
    }
    cout << max(p-q, q-p) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:21: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   23 |         int l = find(s.begin(), s.end(), P[i]) - s.begin();
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:23:21: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   23 |         int l = find(s.begin(), s.end(), P[i]) - s.begin();
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:24:21: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   24 |         s.erase(find(s.begin(), s.end(), P[i]));
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:24:21: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   24 |         s.erase(find(s.begin(), s.end(), P[i]));
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:35:21: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   35 |         int l = find(t.begin(), t.end(), Q[i]) - t.begin();
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:35:21: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   35 |         int l = find(t.begin(), t.end(), Q[i]) - t.begin();
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:36:21: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   36 |         t.erase(find(t.begin(), t.end(), Q[i]));
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:36:21: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   36 |         t.erase(find(t.begin(), t.end(), Q[i]));
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~