criyle/codenet-compile-errors huggingface dataset:
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);
  
  for(int i=0;i<N;i++){
    cin>>P.at(i);
  }
  for(int i=0;i<N;i++){
    cin>>Q.at(i);
  }
  for(int i=1;i<N+1;i++){
    PP.at(i-1)=i;
  }
  do {
    aa++;
    if(PP==P)a=aa;
    }while (my_next_permutation(PP, N));
  do {
    bb++;
    if(PP==Q)b=bb;
    }while (my_next_permutation(PP, N));
  cout<<abs(a-b)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:33: error: cannot convert 'std::vector<int>' to 'int*'
   42 |     }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:46:33: error: cannot convert 'std::vector<int>' to 'int*'
   46 |     }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) {
      |                          ~~~~~^~~~~
Language: C++

#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;

namespace adaptor = boost::adaptors;

void Main()
{
	int n;
    cin >> n;
    vector<int> p(n), q(n);
    req(i,n) cin >> p[i];
    req(i,n) cin >> q[i];
    vector<int> a(n);
    req(i,n) a[i] = i+1;

    map<vector<int>, int> mp;
    do {
        mp[a] = mp.size();
    } while(next_permutation(a.begin(), a.end()));

    int ans = abs(mp[p] - mp[q]);
    cout << ans << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	
	Main();
}

Compiler output:
a.cc:2:9: fatal error: boost/multi_array.hpp: No such file or directory
    2 | #include<boost/multi_array.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++


#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


int main() {
int n;
cin >> n;
vi p(n),q(n);
REP(i,n) cin >> p[i];
REP(i,n) cin >> q[i];
vi a(n);
REP(i,n) a[i]=i+1;
pair<vi,int> pa;
int j=1;
do {
  pa[a]=j;
  j++;
} while (next_permutation(a.begin(),a.end()));
cout << abs(pa[p]-pa[q]) << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: no match for 'operator[]' (operand types are 'std::pair<std::vector<int>, int>' and 'vi' {aka 'std::vector<int>'})
   27 |   pa[a]=j;
      |     ^
a.cc:30:15: error: no match for 'operator[]' (operand types are 'std::pair<std::vector<int>, int>' and 'vi' {aka 'std::vector<int>'})
   30 | cout << abs(pa[p]-pa[q]) << endl;
      |               ^
a.cc:30:21: error: no match for 'operator[]' (operand types are 'std::pair<std::vector<int>, int>' and 'vi' {aka 'std::vector<int>'})
   30 | cout << abs(pa[p]-pa[q]) << endl;
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  int N;
  cin >> N;
  vector<int> P(N), Q(N);
  rep(i,N) cin >> P[i];
  rep(i,N) cin >> Q[i];
  vector<int> a(N);
  rep(i,N) a[i] = i + 1;
  map<vector<int>,int> mp;
  do{
    mp[a] = mp.size();
  }while(next_permutation(a.begin(),a.end()))
    int ans = abs(mp[P] - mp[Q]);
  cout << ans << endl;
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:19:46: error: expected ';' before 'int'
   19 |   }while(next_permutation(a.begin(),a.end()))
      |                                              ^
      |                                              ;
   20 |     int ans = abs(mp[P] - mp[Q]);
      |     ~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  int N;
  cin >> N;
  vector<int> P(N), Q(N);
  rep(i,N) cin >> P[i];
  rep(i,N) cin >> Q[i];
  vector<int> a(N);
  rep(i,N) a[i] = i + 1;
  mp<vector<int>,int> mp;
  do{
    mp[a] = mp.size();
  }while(next_permutation(a.begin(),a.end()))
    int ans = abs(mp[P] - mp[Q]);
  cout << ans << endl;
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'mp' was not declared in this scope
   16 |   mp<vector<int>,int> mp;
      |   ^~
a.cc:16:17: error: expected primary-expression before ',' token
   16 |   mp<vector<int>,int> mp;
      |                 ^
a.cc:16:18: error: expected primary-expression before 'int'
   16 |   mp<vector<int>,int> mp;
      |                  ^~~
a.cc:19:46: error: expected ';' before 'int'
   19 |   }while(next_permutation(a.begin(),a.end()))
      |                                              ^
      |                                              ;
   20 |     int ans = abs(mp[P] - mp[Q]);
      |     ~~~
Language: C++

#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
int n;
  cin>>n;
  vector<int>p(n),q(n);
  rep(i,n) cin>>p[i]>>q[i];
  vector<int>a(n);
  rep(i,n) a[i]=i+1;
  
  map<vector<int>,int> mp;
  do{
    mp[a]=mp.size();
  }while(next_permutation(a.begin,a.end()));
  int ans=abs(mp[p]-mp[q]);
              cout<<ans<<endl;
  
              }
  


Compiler output:
a.cc: In function 'int main()':
a.cc:17:26: error: no matching function for call to 'next_permutation(<unresolved overloaded function type>, std::__debug::vector<int>::iterator)'
   17 |   }while(next_permutation(a.begin,a.end()));
      |          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:2939:5: note: candidate: 'bool std::next_permutation(_BIter, _BIter) [with _BIter = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<int*, __cxx1998::vector<int, allocator<int> > >, __debug::vector<int>, random_access_iterator_tag>]'
 2939 |     next_permutation(_BidirectionalIterator __first,
      |     ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2939:45: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<int*, std::__cxx1998::vector<int, std::allocator<int> > >, std::__debug::vector<int>, std::random_access_iterator_tag>'
 2939 |     next_permutation(_BidirectionalIterator __first,
      |                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2972:5: note: candidate: 'template<class _BIter, class _Compare> bool std::next_permutation(_BIter, _BIter, _Compare)'
 2972 |     next_permutation(_BidirectionalIterator __first,
      |     ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2972:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
int n;
  cin n;
  vector<int>p(n),q(n);
  rep(i,n) cin>>p[i]>>q[i];
  vector<int>a(n);
  rep(i,n) a[i]=i+1;
  
  map<vector<int>,int> mp;
  do{
    mp[a]=mp.size();
  }while(next_permutation(a.begin,a.end()));
  int ans=abs(mp[p]-mp[q];
              cout<<ans<<endl;
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:6: error: expected ';' before 'n'
    8 |   cin n;
      |      ^~
      |      ;
a.cc:17:26: error: no matching function for call to 'next_permutation(<unresolved overloaded function type>, std::__debug::vector<int>::iterator)'
   17 |   }while(next_permutation(a.begin,a.end()));
      |          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:2939:5: note: candidate: 'bool std::next_permutation(_BIter, _BIter) [with _BIter = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<int*, __cxx1998::vector<int, allocator<int> > >, __debug::vector<int>, random_access_iterator_tag>]'
 2939 |     next_permutation(_BidirectionalIterator __first,
      |     ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2939:45: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<int*, std::__cxx1998::vector<int, std::allocator<int> > >, std::__debug::vector<int>, std::random_access_iterator_tag>'
 2939 |     next_permutation(_BidirectionalIterator __first,
      |                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2972:5: note: candidate: 'template<class _BIter, class _Compare> bool std::next_permutation(_BIter, _BIter, _Compare)'
 2972 |     next_permutation(_BidirectionalIterator __first,
      |     ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2972:5: note:   candidate expects 3 arguments, 2 provided
a.cc:18:26: error: expected ')' before ';' token
   18 |   int ans=abs(mp[p]-mp[q];
      |              ~           ^
      |                          )
a.cc:19:31: error: expected '}' at end of input
   19 |               cout<<ans<<endl;
      |                               ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>

typedef long long ll;

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, cnt_a=1, cnt_b=1;
    cin >> n;
    int array[n], a[n], b[n];
    for(int i=0; i<n; i++) array[i] = i+1;
    for(int i=0; i<n; i++) cin >> a[i];
    for(int i=0; i<n; i++) cin >> b[i];

    do
    {
        if(memcmp(a, array, n*sizeof(int)) == 0) break;
        cnt_a++;
    }
    while(next_permutation(array,array+n));

    for(int i=0; i<n; i++) array[i] = i+1;

    do
    {
        if(memcmp(b, array, n*sizeof(int)) == 0) break;
        cnt_b++;
    }
    while(next_permutation(array,array+n));

    cout << abs(cnt_a - cnt_b);

}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:12: error: 'memcmp' was not declared in this scope
   34 |         if(memcmp(a, array, n*sizeof(int)) == 0) break;
      |            ^~~~~~
a.cc:15:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include <cstdio>
  +++ |+#include <cstring>
   15 | #include <stdio.h>
a.cc:43:12: error: 'memcmp' was not declared in this scope
   43 |         if(memcmp(b, array, n*sizeof(int)) == 0) break;
      |            ^~~~~~
a.cc:43:12: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

#define ll long long
using vt = int; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define MOD 1000000007

int main() {
	int n;
	cin >> n;
	vector<int> p(n), q(n), r(n);
	rep(i, n) cin >> p.at(i);
	rep(i, n) cin >> q.at(i);
	rep(i, n) r.at(i) = i + 1;
	int N = 1;
	rep(i, 1, n + 1) N *= i;
	map <vector<int>, int> mp;
	do {
		mp[r] = mp.size();
	} while (next_permutation(r.begin(), r.end()));
	int ans = abs(mp[p] - mp[q]);
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:34:24: error: macro "rep" passed 3 arguments, but takes just 2
   34 |         rep(i, 1, n + 1) N *= i;
      |                        ^
a.cc:22:9: note: macro "rep" defined here
   22 | #define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:34:9: error: 'rep' was not declared in this scope
   34 |         rep(i, 1, n + 1) N *= i;
      |         ^~~
Language: C++

#include <iostream>
#include <vector>
#include <string>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  int N;
  std::cin >> N;

  std::vector<int> v(N, 0);

  std::string P;
  std::string Q;

  for (int i = 0; i < N; i++) {
    v[i] = i + 1;
    int a;
    std::cin >> a;
    P += a + '0';
  }

  for (int i = 0; i < N; i++) {
    int a;
    std::cin >> a;
    Q += a + '0';
  }

  std::vector<std::string> n;
  int c = 0;
  do {
    std::string o;
    for (int i = 0; i < N; i++) {
      o += static_cast<char>(v[i] + '0');
    }
    n.push_back(o);
    c++;
  } while (next_permutation(v.begin(), v.end()));

  std::sort(n.begin(), n.end());
  int p, q;

  for (int i = 0; i < c; i++) {
    if (n[i] == P) {
      p = i;
    } else if (n[i] == Q) {
      q = i;
    }
  }

  std::cout << std::abs(p - q) << std::endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:12: error: 'next_permutation' was not declared in this scope
   39 |   } while (next_permutation(v.begin(), v.end()));
      |            ^~~~~~~~~~~~~~~~
a.cc:41:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   41 |   std::sort(n.begin(), n.end());
      |        ^~~~
      |        qsort
Language: C++

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

int th(vector<int> a){
  int n = a.length();
  int res = 0;
  for(int i = 0; i < n-1; i++){
  	res = (a[i]-1)*(n-1-i);
  }
  return res;
}

int main(){
  int n; cin >> n;
  vector<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];
  
  cout << abs(th(p) - th(q)) << endl;
}

Compiler output:
a.cc: In function 'int th(std::vector<int>)':
a.cc:5:13: error: 'class std::vector<int>' has no member named 'length'
    5 |   int n = a.length();
      |             ^~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n;
    int count = 1;
    string p, q, s;
    int Pnum = 0, Qnum = 0;

    cin >> n;
    for(int i = 1; i <= n; ++i)
        s += to_string(i);

    for(int i = 0; i < n; ++i) {
        char buf;
        cin >> buf;
        p += buf;
    }

    for(int i = 0; i < n; ++i) {
        char buf;
        cin >> buf;
        q += buf;
    }

    do {
        if(!Pnum && s == p) Pnum = count;
        if(!Qnum && s == q) Qnum = count;
        if(Pnum && Qnum) break;
        ++count;
    } while(next_permutation(s.begin(), s.end()));

    cout << abs(Pnum - Qnum);
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:13: error: 'next_permutation' was not declared in this scope
   34 |     } while(next_permutation(s.begin(), s.end()));
      |             ^~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int twodiv(int a){
  int ans = 0;
  while (0 == 0) {
    if (a % 2 == 0) {
      ans++;
      a = a / 2;
    }
    else{
      break;
    }
  }
  return ans;
}

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> a(N);
  vector<int> R(N);
  int ans = 0;
  int L = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    R[i] = twodiv(a[i]);
  }
  sort(R.begin(),R.end());
  if (R[0] != R[N - 1]) {
    cout << 0 << endl;
  }
  else {
    for (int i = 0; i < N - 1; i++) {
      a[i + 1] = lcm(a[i] , a[i + 1]);
    }
    L = a[N - 1];
    if (L / 2 > M) {
      cout << 0 << endl;
    }
    else{
      ans = ((M - (L / 2))/ L) + 1;
    cout << ans << endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:61:4: error: expected '}' at end of input
   61 |   }
      |    ^
a.cc:50:8: note: to match this '{'
   50 |   else {
      |        ^
a.cc:61:4: error: expected '}' at end of input
   61 |   }
      |    ^
a.cc:33:12: note: to match this '{'
   33 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int twodiv(int a){
  int ans = 0;
  while (0 == 0) {
    if (a % 2 == 0) {
      ans++;
      a = a / 2;
    }
    else{
      break;
    }
  }
  return ans;
}

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> a(N);
  vector<int> R(N);
  int ans = 0;
  int L = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    R[i] = twodiv(a[i]);
  }
  sort(R.begin(),R.end());
  if (R[0] != R[N - 1]) {
    cout << 0 << endl;
  }
  else {
    for (int i = 0; i < N - 1; i++) {
      a[i + 1] = lcm(a[i] , a[i + 1]);
    }
    L = a[N - 1];
    if (L / 2 > M) {
      cout << 0 << endl;
    }
    else{
      ans = ((M - (L / 2))/ L) + 1;
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:2: error: expected '}' at end of input
   62 | }
      |  ^
a.cc:33:12: note: to match this '{'
   33 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
#include <sstream>

int main(void)
{
    int64_t N, P, Q;
    std::cin >> N;

    auto getValue = [&](){
        int64_t value = 0;
        for (int64_t i = 0; i < N; ++i) {
            if (i != 0) value *= 10;
            int64_t v;
            std::cin >> v;
            value += v;
        }
        return value;
    };

    P = getValue();
    Q = getValue();

    std::vector<int64_t> perm(N);
    std::iota(perm.begin(), perm.end(), 1);
    int64_t P_pos = 0;
    int64_t Q_pos = 0;
    int64_t count = 1;
    do {
        int64_t value = 0;
        for (int64_t i = 0; i < perm.size(); ++i) {
            if (i != 0) value *= 10;
            value += perm.at(i);
        }
        if (P == value) P_pos = count;
        if (Q == value) Q_pos = count;
        count++;
    } while( next_permutation(perm.begin(), perm.end()) );

    std::cout << (std::abs(P_pos - Q_pos)) << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:10: error: 'iota' is not a member of 'std'
   34 |     std::iota(perm.begin(), perm.end(), 1);
      |          ^~~~
Language: C++

bool equal(int n[], int m[], int k){
    for (int i = 0; i<k ; i++){
        if(n[i] != m[i]){
            return false;
        }
    }
    return true;
}
 
int main(){
    int n, a = 0, b = 0, count = 0;
    cin >> n;
    int p[n], q[n], temp[n];
    
    for(int i = 0; i<n; i++){
        cin >> p[i];
        temp[i] = p[i];
    }
    
    for(int i = 0; i<n; i++){
        cin >> q[i];
    }
    
    sort(temp, temp+n);
 
    do{
        count++;
        if(a != 0 && b != 0){
            break;
        }
        if (equal(temp, p, n) && a == 0){
            a = count;
        }
        if(equal(temp, q, n) && b == 0){
            b = count;
        }
    }while(next_permutation(temp, temp+n));
    
    cout << abs(a-b) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     cin >> n;
      |     ^~~
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |     sort(temp, temp+n);
      |     ^~~~
      |     short
a.cc:37:12: error: 'next_permutation' was not declared in this scope
   37 |     }while(next_permutation(temp, temp+n));
      |            ^~~~~~~~~~~~~~~~
a.cc:39:5: error: 'cout' was not declared in this scope; did you mean 'count'?
   39 |     cout << abs(a-b) << endl;
      |     ^~~~
      |     count
a.cc:39:13: error: 'abs' was not declared in this scope
   39 |     cout << abs(a-b) << endl;
      |             ^~~
a.cc:39:25: error: 'endl' was not declared in this scope
   39 |     cout << abs(a-b) << endl;
      |                         ^~~~
Language: C++

#include<iostream>
#include<string>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)

int abs(int x){
    if(x > 0) return x;
    else return -x;
}


int main(){
    int n;
    cin >> n;
    int p[n], q[n];
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];
    int perm[n];
    rep(i, n) perm[i] = i + 1;
    int cp = 0;
    do{
        bool flag = true;
        for (int i = 0; i < n; i++){
            if (perm[i] != p[i]){
                flag = false;
                break;
            }
        }
        if (flag){
            break;
        }
        cp++;
    }while(next_permutation(perm, perm + n));

    
    rep(i, n) perm[i] = i + 1;
    int cq = 0;
    do{
        bool flag = true;
        for (int i = 0; i < n; i++){
            if (perm[i] != q[i]){
                flag = false;
                break;
            }
        }
        if (flag){
            break;
        }
        cq++;
    }while(next_permutation(perm, perm + n));
    // cout << cp << " " << cq << endl;
    cout << abs(cq - cp) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:12: error: 'next_permutation' was not declared in this scope
   35 |     }while(next_permutation(perm, perm + n));
      |            ^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
using namespace std;


int main()
{
    int N;
    cin >> N;
    vector<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];
    }
    vector<int> a(N);
    for (int i = 0; i < N; ++i){
        a[i] = i + 1;
    }
    map<vector<int>, int> mp;
    do{
        mp[a] = mp.size();
    }while(next_permutation(a.begin(), a.end());
    
    int ans = abs(mp[P] - mp[Q]);
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:48: error: expected ')' before ';' token
   28 |     }while(next_permutation(a.begin(), a.end());
      |           ~                                    ^
      |                                                )
Language: C

#include <stdio.h>
#include <stdlib.h>

int num (int n, int a[]) {
  int count=0;
  
  for (int i=0; i<N-1; i++) {
	for(int j=0; j<N; j++)
      if (a[i]>a[j])
		count++;
    count *= n-i-1;
  }
  return count;
}


int main (void) {
  int N;
  int p[8],q[8];
  int P,Q;
  
  scanf("%d", &N);
  for (int i=0; i<N; i++){
    scanf("%d", &p[i]);
  }
  for (int i=0; i<N; i++){
    scanf("%d", &q[i]);
  }
  
  P = num(N,p);
  Q = num(N,q);
  
  if(P>=Q)
    printf("%d", P-Q);
  else 
    printf("%d", Q-P);
  
  return 0;
}


Compiler output:
main.c: In function 'num':
main.c:7:19: error: 'N' undeclared (first use in this function)
    7 |   for (int i=0; i<N-1; i++) {
      |                   ^
main.c:7:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <stdlib.h>

int num (int n, int a[]) {
  int count=0;
  
  for (int i=0; i<N-1; i++) {
	for(int j=0; j<N-1; j++)
      if (a[i]>a[j])
		count++;
    count *= n-i-1;
  }
  
  return count;
}

int main (void) {
  int N;
  int p[8],q[8];
  int P,Q;
  
  scanf("%d", &N);
  for (int i=0; i<N; i++){
    scanf("%d", &p[i]);
  }
  for (i=0; i<N; i++){
    scanf("%d", &q[i]);
  }
  
  P = num(N,p);
  Q = num(N,q);
  
  if(P>=Q)
    printf("%d", P-Q);
  else 
    printf("%d", Q-P);
  
  return 0;
}


Compiler output:
main.c: In function 'num':
main.c:7:19: error: 'N' undeclared (first use in this function)
    7 |   for (int i=0; i<N-1; i++) {
      |                   ^
main.c:7:19: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:26:8: error: 'i' undeclared (first use in this function)
   26 |   for (i=0; i<N; i++){
      |        ^
Language: C++

#include <stdio.h>
#include <stdlib.h>

int num (int n, int a[]) {
  int count=0;
  
  for (int i=0; i<N-1; i++) {
	for(int j=0; j<N-1; j++)
      if (a[i]>a[j])
		count++;
    count *= n-i-1;
  }
  
  return count;
}

int main (void) {
  int N;
  int p[8],q[8];
  int P,Q;
  
  scanf("%d", &N);
  for (int i=0; i<N; i++){
    scanf("%d", &p[i]);
  }
  for (i=0; i<N; i++){
    scanf("%d", &q[i]);
  }
  
  P = num(N,p);
  Q = num(N,q);
  
  if(P>=Q)
    printf("%d", P-Q);
  else 
    printf("%d", Q-P);
  
  return 0;
}


Compiler output:
a.cc: In function 'int num(int, int*)':
a.cc:7:19: error: 'N' was not declared in this scope
    7 |   for (int i=0; i<N-1; i++) {
      |                   ^
a.cc: In function 'int main()':
a.cc:26:8: error: 'i' was not declared in this scope
   26 |   for (i=0; i<N; i++){
      |        ^
Language: C++

#include <stdio.h>
#include <stdlib.h>

int num (int n, int a[]) {
  int count=0;
  
  for (int i=0; i<N-1; i++) {
	for(int j=0; j<N-1; j++)
      if (a[i]>a[j])
		count++;
    count *= n-i-1;
  }
  
  return count;
}

int main (void) {
  int N;
  int p[8],q[8];
  
  scanf("%d", &N);
  for (int i=0; i<N; i++){
    scanf("%d", &p[i]);
  }
  for (i=0; i<N; i++){
    scanf("%d", &q[i]);
  }
  
  P = num(N,p);
  Q = num(N,q);
  
  if(P>=Q)
    printf("%d", P-Q);
  else 
    printf("%d", Q-P);
  
  return 0;
}

Compiler output:
a.cc: In function 'int num(int, int*)':
a.cc:7:19: error: 'N' was not declared in this scope
    7 |   for (int i=0; i<N-1; i++) {
      |                   ^
a.cc: In function 'int main()':
a.cc:25:8: error: 'i' was not declared in this scope
   25 |   for (i=0; i<N; i++){
      |        ^
a.cc:29:3: error: 'P' was not declared in this scope
   29 |   P = num(N,p);
      |   ^
a.cc:30:3: error: 'Q' was not declared in this scope
   30 |   Q = num(N,q);
      |   ^
Language: C++

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

int main(){
  int N; cin >> n;
  vector<int> A(n), B(n), perm(n);
  for(int i = 0; i < n; i++){
    cin >> A[i];
  }
  for(int i = 0; i < n; i++){
    cin >> B[i];
    perm[i] = i + 1;
  }
  
  int a, b, count = 1;
  do{
    if(A == perm) a = count;
    if(B == perm) b = count;
    count++;
  }while (next_permutation(perm.begin(), perm.end()));
  cout << abs(a - b) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'n' was not declared in this scope
    6 |   int N; cin >> n;
      |                 ^
Language: C++

import itertools
N = int(input())
P = [ int(i) for i in input().split()]
Q = [ int(i) for i in input().split()]

i = 0
p, q = 0, 0
for v in itertools.permutations(range(1,N+1)):
    if P == list(v):
        p = i
    elif Q == list(v):
        q = i
    i += 1

print(abs(p-q))

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import itertools
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;



int main(void)
{
    int n;
    cin >> n;
    vector<int> p(n), q(n);

    rep(i, n)
    {
        cin >> p.at(i);
    }
    
    rep(i, n)
    {
        cin >> q.at(i);
    }

    vector<int> y(n);
    rep(i, n) y[i] = i + 1;
    int cnt = 1;
    int a, b;

    do{
        if(p == y) a = cnt;
        if(q == y) b = cnt;
        cnt++;
    }while(next_permutation(y.begin(), y.end()));

    cout << abs(a - b) << endl;

    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:12: error: 'next_permutation' was not declared in this scope
   35 |     }while(next_permutation(y.begin(), y.end()));
      |            ^~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int n,count=0;
  cin>>n;
 string p,q;
  cin>>p;
  cin>>q;
  do{
     if(p==q)
      break;
    count++;
    while(next_permutation(p.begin(),p.end()));
  }
}
     

Compiler output:
a.cc: In function 'int main()':
a.cc:17:1: error: expected 'while' before '}' token
   17 | }
      | ^
a.cc:17:1: error: expected '(' before '}' token
   17 | }
      | ^
      | (
a.cc:17:1: error: expected primary-expression before '}' token
a.cc:16:4: error: expected ')' before '}' token
   16 |   }
      |    ^
      |    )
   17 | }
      | ~   
a.cc:16:4: error: expected ';' before '}' token
   16 |   }
      |    ^
      |    ;
   17 | }
      | ~
Language: C++

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

int main()
{
  int n,count=0;
  cin>>n;
 string p,q;
  cin>>p;
  cin>>q;
  do{
     if(p==q)
      break;
    count++;
    while(next_permutation(p.begin(),p.end());
  }
}
          

Compiler output:
a.cc: In function 'int main()':
a.cc:15:46: error: expected ')' before ';' token
   15 |     while(next_permutation(p.begin(),p.end());
      |          ~                                   ^
      |                                              )
a.cc:17:1: error: expected 'while' before '}' token
   17 | }
      | ^
a.cc:17:1: error: expected '(' before '}' token
   17 | }
      | ^
      | (
a.cc:17:1: error: expected primary-expression before '}' token
a.cc:16:4: error: expected ')' before '}' token
   16 |   }
      |    ^
      |    )
   17 | }
      | ~   
a.cc:16:4: error: expected ';' before '}' token
   16 |   }
      |    ^
      |    ;
   17 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep_1(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define rep_2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    int n;
    cin >> n;
    vector<int> p(n), q(n);

    rep(i,n)cin >> p[i];p[i]--;
    rep(i,n)cin >> q[i];q[i]--;

    map<vector<int>,int> ord;

    int iter = 0;
    vector<int> v(n);
    rep(i,n) v[i] = i;
    do{
        ord[v] = iter++;
    }while(next_permutation(all(v)));
    
    cout << abs(ord[p] - ord[q]) <<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: 'i' was not declared in this scope
   18 |     rep(i,n)cin >> p[i];p[i]--;
      |                           ^
Language: C++

#include <iostream>

using namespace std;

#define MAXN 8
bool used[MAXN];

void permutation(int **perm, int left, int right) {
  if(left == right) {
    perm_count++;
    return;
  }
  for(int i = 0; i < right; ++i) {
    if(used[i] == false) {
      p[left] = i;
      used[i] = true;
      permutation(left + 1, right);
      used[i] = false;
    }
  }
}

int fact(int N){
  if(N != 1)
    return N*(fact(N-1));
  else
    return 1;
}

int main(){
  int N;
  cin >> N;
  int P[N], Q[N];
  int i;
  for(i=0; i<N; i++)
    cin >> P[i];
  for(i=0; i<N; i++)
    cin >> Q[i];

  int M = fact(N);
  int perm[M][N];

  
  return 0;
}


Compiler output:
a.cc: In function 'void permutation(int**, int, int)':
a.cc:10:5: error: 'perm_count' was not declared in this scope
   10 |     perm_count++;
      |     ^~~~~~~~~~
a.cc:15:7: error: 'p' was not declared in this scope
   15 |       p[left] = i;
      |       ^
a.cc:17:24: error: invalid conversion from 'int' to 'int**' [-fpermissive]
   17 |       permutation(left + 1, right);
      |                   ~~~~~^~~
      |                        |
      |                        int
a.cc:17:18: error: too few arguments to function 'void permutation(int**, int, int)'
   17 |       permutation(left + 1, right);
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~
a.cc:8:6: note: declared here
    8 | void permutation(int **perm, int left, int right) {
      |      ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
 
int main() {
    int N;
    cin >> N;

    vector <int> P(N), Q(N);

    rep(i,N){ cin >> P.at(i);}
    rep(i,N){ cin >> Q.at(i);}

    vector <int> a(N);
    rep(i,N) a.at(i) = i + 1;

    map < vector<int>, int> m_a;
    while(next_permutation(a.begin(),a.end()){
        m_a[a] = m_a.size();
    }
    int ans = abs(m_a.at(P)-m_a.at(Q));

    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:46: error: expected ')' before '{' token
   18 |     while(next_permutation(a.begin(),a.end()){
      |          ~                                   ^
      |                                              )
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int a[10],b[10];
void input(int n,int arr[10])
 {
     for(int i=0;i<n;i++)
       {
           cin>>arr[i];
       }
 }

 int solve(int n,int arr[10],int a1[10])
    {  int c=0;int count=0;
    while(next_permutation(arr,arr+n))
      {    count++;
          for(int i=0;i<n;i++)
             {
                   if(arr[i]==a1[i])
                     c++;
             }
             if(c==n)
                break;
      }
      
      return count;
     }




int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)a
       {
           arr[i]=i+1;
       }
   input(n,a);
   input(n,b);
   int a1=solve(n,arr,a);
   int b1=solve(n,arr,b);
     int m=abs(a1-b1);
    cout<<m;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:26: error: expected ';' before '{' token
   37 |     for(int i=0;i<n;i++)a
      |                          ^
      |                          ;
   38 |        {
      |        ~
Language: Java

package ABC150;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class CountOrder {
	static int count = 0;
	static int firstCount = 0;
	static int finalCount = 0;

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		String firstNumbers = "";
		String finalNumbers = "";
		for (int i = 0; i < x; i++) {
			int y = sc.nextInt();
			firstNumbers = firstNumbers + y;
		}
		for (int i = 0; i < x; i++) {
			int y = sc.nextInt();
			finalNumbers = finalNumbers + y;
		}
		sc.close();
		sortAllNumbers("", x, new ArrayList<>(), firstNumbers, finalNumbers);
		System.out.println(Math.abs(finalCount - firstCount));
	}

	static String sortAllNumbers(String number, int size, List numberList, String firstNumbers, String finalNumbers) {
		for (int i = 1; i <= size; i++) {
			if (numberList.contains(i))
				continue;
			String numbers = number + i;
			if (numbers.length() == size) {
				numberList.remove(numberList.size() - 1);
				count++;
				if (numbers.equals(firstNumbers)) {
					firstCount = count;
				}
				if (numbers.equals(finalNumbers)) {
					finalCount = count;
				}
				return numbers;
			}
			numberList.add(i);
			numbers = sortAllNumbers(numbers, size, numberList, firstNumbers, finalNumbers);
		}
		if (!numberList.isEmpty())
			numberList.remove(numberList.size() - 1);
		return number;
	}

}


Compiler output:
Main.java:7: error: class CountOrder is public, should be declared in a file named CountOrder.java
public class CountOrder {
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include<bits/stdc++.h>

using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> P(N);
  vector<int> Q(N);
  vector<int> w(N);
  vector<int> v(N);
  for(int i = 0; i < N; i++) cin >> P[i];
  for(int i = 0; i < N; i++) cin >> Q[i]; 
  int count = 1;
  vector<int> R(N);
  sort(P.begin(),P.end());
  R = P;
 
 do{
   if(R == P) a = count;
   if(Q == P) b = count;

   count++;
   
  }while(next_permutation(P.begin(),P.end()));
  if(a < b) cout << b - a;
  else cout << a - b;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:15: error: 'a' was not declared in this scope
   19 |    if(R == P) a = count;
      |               ^
a.cc:20:15: error: 'b' was not declared in this scope
   20 |    if(Q == P) b = count;
      |               ^
a.cc:25:6: error: 'a' was not declared in this scope
   25 |   if(a < b) cout << b - a;
      |      ^
a.cc:25:10: error: 'b' was not declared in this scope
   25 |   if(a < b) cout << b - a;
      |          ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vll = vector<ll>;
using vdouble = vector<double>;
using vstr = vector<string>;
typedef pair<int,int> P;
int dx[4] = {1, 0, -1, 0},dy[4] = {0, 1, 0, -1};

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
    ll N;
	cin>>N;
	vll P(N),Q(N);
	REP(i,N) cin>>P[i];
	REP(i,N) cin>>Q[i];
	
	vll a(N);
	REP(i,N) a[i]= i+1;//a={1,2,3};
  
    map<vll, ll> mp; 
  　//mpはvll→llの写像a={1,2,3}に対して1を、mp={1,3,2}に対して2を返す
	do{
		mp[a] = mp.size();//mpの配列のサイズ
        //cout<<mp[a]<<endl;
	}while(next_permutation(a.begin(), a.end()));
  　//next_permutationで文字列を入れ替えて順列aを順番に生成していく
	
	ll ans = abs(mp[P] - mp[Q]);
	cout << ans <<endl;
	return 0;
}

Compiler output:
a.cc:29:3: error: extended character 　 is not valid in an identifier
   29 |   　//mpはvll→llの写像a={1,2,3}に対して1を、mp={1,3,2}に対して2を返す
      |   ^
a.cc:34:3: error: extended character 　 is not valid in an identifier
   34 |   　//next_permutationで文字列を入れ替えて順列aを順番に生成していく
      |   ^
a.cc: In function 'int main()':
a.cc:29:3: error: '\U00003000' was not declared in this scope
   29 |   　//mpはvll→llの写像a={1,2,3}に対して1を、mp={1,3,2}に対して2を返す
      |   ^~
a.cc:34:5: error: expected ';' before 'll'
   34 |   　//next_permutationで文字列を入れ替えて順列aを順番に生成していく
      |     ^
      |     ;
   35 | 
   36 |         ll ans = abs(mp[P] - mp[Q]);
      |         ~~
a.cc:37:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   37 |         cout << ans <<endl;
      |                 ^~~
      |                 abs
Language: Java

import java.util.Scanner;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
public class Main {
    public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    List<Integer> P = new ArrayList<Integer>();
    List<Integer> Q = new ArrayList<Integer>();
    List<Integer> Ps = new ArrayList<Integer>();
    List<Integer> Qs = new ArrayList<Integer>();   
    int a = 0; 
    int b = 0;
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        P.add(x);
        Ps.add(x);
    }
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        Q.add(x);
        Qs.add(x);
    } 
    Collections.sort(Ps);
    Collections.sort(Qs);
      
   for(int i=0; i<N-1;i++){
     int searchNumber = P.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Ps.size(); j++){
     	if(searchNumber == Ps.get(j)){
          x = j;
          Ps.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
   for(int i=0; i<N-1;i++){
     int searchNumber = Q.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Qs.size(); j++){
     	if(searchNumber == Qs.get(j)){
          x = j;
          Qs.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
	if(a == 0) a =1;
    if(b == 0) b =1;
      
   int answer = a - b;
   if(answer < 0) answer = -answer;
   System.out.println(answer);   
    }
}


Compiler output:
Main.java:39: error: variable i is already defined in method main(String[])
   for( int i = (N - i - 1); i > 0; i--) y *= i;
            ^
Main.java:54: error: variable i is already defined in method main(String[])
   for( int i = (N - i - 1); i > 0; i--) y *= i;
            ^
2 errors
Language: Java

import java.util.Scanner;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
public class Main {
    public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    List<Integer> P = new ArrayList<Integer>();
    List<Integer> Q = new ArrayList<>(Integer);
    List<Integer> Ps = new ArrayList<>(Integer);
    List<Integer> Qs = new ArrayList<>(Integer);   
    int a = 0; 
    int b = 0;
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        P.add(x);
        Ps.add(x);
    }
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        Q.add(x);
        Qs.add(x);
    } 
    Collections.sort(Ps);
    Collections.sort(Qs);
      
   for(int i=0; i<N-1;i++){
     int searchNumber = P.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Ps.size(); j++){
     	if(searchNumber == Ps.get(j)){
          x = j;
          Ps.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
   for(int i=0; i<N-1;i++){
     int searchNumber = Q.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Qs.size(); j++){
     	if(searchNumber == Qs.get(j)){
          x = j;
          Qs.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
	if(a == 0) a =1;
    if(b == 0) b =1;
      
   int answer = a - b;
   if(answer < 0) answer = -answer;
   System.out.println(answer);   
    }
}


Compiler output:
Main.java:10: error: cannot find symbol
    List<Integer> Q = new ArrayList<>(Integer);
                                      ^
  symbol:   variable Integer
  location: class Main
Main.java:11: error: cannot find symbol
    List<Integer> Ps = new ArrayList<>(Integer);
                                       ^
  symbol:   variable Integer
  location: class Main
Main.java:12: error: cannot find symbol
    List<Integer> Qs = new ArrayList<>(Integer);   
                                       ^
  symbol:   variable Integer
  location: class Main
Main.java:39: error: variable i is already defined in method main(String[])
   for( int i = (N - i - 1); i > 0; i--) y *= i;
            ^
Main.java:54: error: variable i is already defined in method main(String[])
   for( int i = (N - i - 1); i > 0; i--) y *= i;
            ^
5 errors
Language: Java

import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
public class Main {
    public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    List<> P = new ArrayList<>();
    List<> Q = new ArrayList<>();
    List<> Ps = new ArrayList<>();
    List<> Qs = new ArrayList<>();   
    int a = 0; 
    int b = 0;
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        P.add(x);
        Ps.add(x);
    }
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        Q.add(x);
        Qs.add(x);
    } 
    Arrays.sort(Ps);
    Arrays.sort(Qs);
      
   for(int i=0; i<N-1;i++){
     int searchNumber = P.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Ps.size(); j++){
     	if(searchNumber == Ps.get(j)){
          x = j;
          Ps.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
   for(int i=0; i<N-1;i++){
     int searchNumber = Q.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Qs.size(); j++){
     	if(searchNumber == Qs.get(j)){
          x = j;
          Qs.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
	if(a == 0) a =1;
    if(b == 0) b =1;
      
   int answer = a - b;
   if(answer < 0) answer = -answer;
   System.out.println(answer);   
    }
}


Compiler output:
Main.java:9: error: illegal start of type
    List<> P = new ArrayList<>();
         ^
Main.java:10: error: illegal start of type
    List<> Q = new ArrayList<>();
         ^
Main.java:11: error: illegal start of type
    List<> Ps = new ArrayList<>();
         ^
Main.java:12: error: illegal start of type
    List<> Qs = new ArrayList<>();   
         ^
4 errors
Language: Java

import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
public class Main {
    public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    List<int> P = new ArrayList<int>();
    List<int> Q = new ArrayList<int>();
    List<int> Ps = new ArrayList<int>();
    List<int> Qs = new ArrayList<int>();   
    int a = 0; 
    int b = 0;
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        P.add(x);
        Ps.add(x);
    }
    for(int i=0; i<N; i++){
    	int x = sc.nextInt();
        Q.add(x);
        Qs.add(x);
    } 
    Arrays.sort(Ps);
    Arrays.sort(Qs);
      
   for(int i=0; i<N-1;i++){
     int searchNumber = P.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Ps.size(); j++){
     	if(searchNumber == Ps.get(j)){
          x = j;
          Ps.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
   for(int i=0; i<N-1;i++){
     int searchNumber = Q.get(i);
     int x = 0;
     int y = 1;
     for(int j=0; j<Qs.size(); j++){
     	if(searchNumber == Qs.get(j)){
          x = j;
          Qs.remove(j);
          break;
        }
     }
   for( int i = (N - i - 1); i > 0; i--) y *= i;
   if(x != 0) a = x * y;
   }
      
	if(a == 0) a =1;
    if(b == 0) b =1;
      
   int answer = a - b;
   if(answer < 0) answer = -answer;
   System.out.println(answer);   
    }
}


Compiler output:
Main.java:9: error: unexpected type
    List<int> P = new ArrayList<int>();
         ^
  required: reference
  found:    int
Main.java:9: error: unexpected type
    List<int> P = new ArrayList<int>();
                                ^
  required: reference
  found:    int
Main.java:10: error: unexpected type
    List<int> Q = new ArrayList<int>();
         ^
  required: reference
  found:    int
Main.java:10: error: unexpected type
    List<int> Q = new ArrayList<int>();
                                ^
  required: reference
  found:    int
Main.java:11: error: unexpected type
    List<int> Ps = new ArrayList<int>();
         ^
  required: reference
  found:    int
Main.java:11: error: unexpected type
    List<int> Ps = new ArrayList<int>();
                                 ^
  required: reference
  found:    int
Main.java:12: error: unexpected type
    List<int> Qs = new ArrayList<int>();   
         ^
  required: reference
  found:    int
Main.java:12: error: unexpected type
    List<int> Qs = new ArrayList<int>();   
                                 ^
  required: reference
  found:    int
Main.java:39: error: variable i is already defined in method main(String[])
   for( int i = (N - i - 1); i > 0; i--) y *= i;
            ^
Main.java:54: error: variable i is already defined in method main(String[])
   for( int i = (N - i - 1); i > 0; i--) y *= i;
            ^
10 errors