criyle/codenet-compile-errors huggingface dataset:
Language: Java

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


Compiler output:
Main.java:15: error: ';' expected
    	P[i] = sc.nextInt()
    	                   ^
Main.java:19: error: ';' expected
    	Q[i] = sc.nextInt()
    	                   ^
Main.java:28: error: illegal start of expression
     for(int j=0; j<N; ;++){
                       ^
Main.java:28: error: illegal start of expression
     for(int j=0; j<N; ;++){
                          ^
Main.java:42: error: illegal start of expression
     for(int j=0; j<N; ;++){
                       ^
Main.java:42: error: illegal start of expression
     for(int j=0; j<N; ;++){
                          ^
6 errors
Language: C++

 1 #include<bits/stdc++.h>                                                                                            2 using namespace std;
  3
  4 int fact(int x){
  5         if(x==0) return 1;
  6
  7         return x*fact(x-1);
  8 }
  9
 10 int hoge(int a,int t){
 11         return (a-1)*fact(t-1);
 12 }
 13
 14 int main(){
 15         int N;
 16         cin >> N;
 17         int P[N-1],Q[N-1];
 18
 19         for(int i=0;i<N;i++){
 20                 cin >> P[i];
 21         }
 22
 23         for(int i=0;i<N;i++){
 24                 cin >> Q[i];
 25         }
 26
 27         int num_p=0;
 28         int num_q=0;
 29         for(int t=0;t<N;t++){
 30                 int count_p=1;
 31                 int count_q=1;
 32
 33                 for(int i=t+1;i<N;i++){
 34                         if(P[i]<P[t]) count_p++;
 35                         if(Q[i]<Q[t]) count_q++;
 36                 }
 37
 38                 num_p+=hoge(count_p,N-t);
 39                 num_q+=hoge(count_q,N-t);
 40         }
 41
 42         cout <<abs(num_p-num_q);
 43
 44         return 0;
 45 }
 46

Compiler output:
a.cc:1:4: error: stray '#' in program
    1 |  1 #include<bits/stdc++.h>                                                                                            2 using namespace std;
      |    ^
a.cc:1:2: error: expected unqualified-id before numeric constant
    1 |  1 #include<bits/stdc++.h>                                                                                            2 using namespace std;
      |  ^
a.cc:2:3: error: expected unqualified-id before numeric constant
    2 |   3
      |   ^
a.cc:8:3: error: expected unqualified-id before numeric constant
    8 |   9
      |   ^
a.cc:12:2: error: expected unqualified-id before numeric constant
   12 |  13
      |  ^~
a.cc:45:2: error: expected unqualified-id before numeric constant
   45 |  46
      |  ^~
Language: C++

  1 #include<iostream>
  2 using namespace std;
  3
  4 int fact(int x){
  5         if(x==0) return 1;
  6
  7         return x*fact(x-1);
  8 }
  9
 10 int hoge(int a,int t){
 11         return (a-1)*fact(t-1);
 12 }
 13
 14 int main(){
 15         int N;
 16         cin >> N;
 17         int P[N-1],Q[N-1];
 18
 19         for(int i=0;i<N;i++){
 20                 cin >> P[i];
 21         }
 22
 23         for(int i=0;i<N;i++){
 24                 cin >> Q[i];
 25         }
 26
 27         int num_p=0;
 28         int num_q=0;
 29         for(int t=0;t<N;t++){
 30                 int count_p=1;
 31                 int count_q=1;
 32
 33                 for(int i=t+1;i<N;i++){
 34                         if(P[i]<P[t]) count_p++;
 35                         if(Q[i]<Q[t]) count_q++;
 36                 }
 37
 38                 num_p+=hoge(count_p,N-t);
 39                 num_q+=hoge(count_q,N-t);
 40         }
 41
 42         cout <<abs(num_p-num_q);
 43
 44         return 0;
 45 }

Compiler output:
a.cc:1:5: error: stray '#' in program
    1 |   1 #include<iostream>
      |     ^
a.cc:1:3: error: expected unqualified-id before numeric constant
    1 |   1 #include<iostream>
      |   ^
a.cc:3:3: error: expected unqualified-id before numeric constant
    3 |   3
      |   ^
a.cc:9:3: error: expected unqualified-id before numeric constant
    9 |   9
      |   ^
a.cc:13:2: error: expected unqualified-id before numeric constant
   13 |  13
      |  ^~
Language: C

  1 #include<iostream>
  2 using namespace std;
  3
  4 int fact(int x){
  5         if(x==0) return 1;
  6
  7         return x*fact(x-1);
  8 }
  9
 10 int hoge(int a,int t){
 11         return (a-1)*fact(t-1);
 12 }
 13
 14 int main(){
 15         int N;
 16         cin >> N;
 17         int P[N-1],Q[N-1];
 18
 19         for(int i=0;i<N;i++){
 20                 cin >> P[i];
 21         }
 22
 23         for(int i=0;i<N;i++){
 24                 cin >> Q[i];
 25         }
 26
 27         int num_p=0;
 28         int num_q=0;
 29         for(int t=0;t<N;t++){
 30                 int count_p=1;
 31                 int count_q=1;
 32
 33                 for(int i=t+1;i<N;i++){
 34                         if(P[i]<P[t]) count_p++;
 35                         if(Q[i]<Q[t]) count_q++;
 36                 }
 37
 38                 num_p+=hoge(count_p,N-t);
 39                 num_q+=hoge(count_q,N-t);
 40         }
 41
 42         cout <<abs(num_p-num_q);
 43
 44         return 0;
 45 }

Compiler output:
main.c:1:3: error: expected identifier or '(' before numeric constant
    1 |   1 #include<iostream>
      |   ^
main.c:1:5: error: stray '#' in program
    1 |   1 #include<iostream>
      |     ^
main.c:3:3: error: expected identifier or '(' before numeric constant
    3 |   3
      |   ^
main.c:9:3: error: expected identifier or '(' before numeric constant
    9 |   9
      |   ^
main.c:13:2: error: expected identifier or '(' before numeric constant
   13 |  13
      |  ^~
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;




    int main(){
        int n;
        std::cin >> n;
        std::vector<int> p(n), q(n);
        rep(i, n) std::cin >> p[i];
        rep(i, n) std::cin >> q[i];
        std::vector<int> a(n);
        rep(i, n) a[i] = i+1

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

        int ans = abs(mp[p] - mp[q]);
        std::cout << ans << "\n";
        return 0;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: expected ';' before 'std'
   17 |         rep(i, n) a[i] = i+1
      |                             ^
      |                             ;
   18 | 
   19 |         std::map<std::vector<int>, std::int> mp;
      |         ~~~                  
a.cc:22:13: error: 'mp' was not declared in this scope; did you mean 'p'?
   22 |             mp[a] = mp.size();
      |             ^~
      |             p
a.cc:25:23: error: 'mp' was not declared in this scope; did you mean 'p'?
   25 |         int ans = abs(mp[p] - mp[q]);
      |                       ^~
      |                       p
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;




    int main(){
        int n;
        std::cin >> n;
        std::vector<int> p(n), q(n);
        rep(i, n) std::cin >> p[i];
        rep(i, n) std::cin >> q[i];
        std::vector<int> a(n);
        rep(i, n) a[i] = i+1

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

        int ans = abs(mp[p] - mp[q]);
        std::cout << ans << "\n";
        return 0;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: expected ';' before 'std'
   17 |         rep(i, n) a[i] = i+1
      |                             ^
      |                             ;
   18 | 
   19 |         std::map<std::vector<int> name;, std::int> mp;
      |         ~~~                  
a.cc:19:40: error: expected primary-expression before ',' token
   19 |         std::map<std::vector<int> name;, std::int> mp;
      |                                        ^
a.cc:19:47: error: expected unqualified-id before 'int'
   19 |         std::map<std::vector<int> name;, std::int> mp;
      |                                               ^~~
a.cc:22:13: error: 'mp' was not declared in this scope; did you mean 'p'?
   22 |             mp[a] = mp.size();
      |             ^~
      |             p
a.cc:25:23: error: 'mp' was not declared in this scope; did you mean 'p'?
   25 |         int ans = abs(mp[p] - mp[q]);
      |                       ^~
      |                       p
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;




    int main(){
        int n;
        std::cin >> n;
        std::vector<int> p(n), q(n);
        rep(i, n) std::cin >> p[i];
        rep(i, n) std::cin >> q[i];
        std::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]);
        std::cout << ans << "\n";
        return 0;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: expected ';' before 'map'
   17 |         rep(i, n) a[i] = i+1
      |                             ^
      |                             ;
   18 | 
   19 |         map<vector<int>, int> mp;
      |         ~~~                  
a.cc:22:13: error: 'mp' was not declared in this scope; did you mean 'p'?
   22 |             mp[a] = mp.size();
      |             ^~
      |             p
a.cc:25:23: error: 'mp' was not declared in this scope; did you mean 'p'?
   25 |         int ans = abs(mp[p] - mp[q]);
      |                       ^~
      |                       p
Language: C++

# C
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

Pn=list(range(N) )
Qn=Pn
ans=0
for i in range(N):
    P_ind=Pn[P[i]-1]
    Q_ind=Qn[Q[i]-1]
    ans+=(P_ind-Q_ind)*math.factorial(N-i-1)

    Pn=[s if ind < P[i]-1 else s-1 for ind, s in enumerate(Pn)]
    Qn=[s if ind < Q[i]-1 else s-1 for ind, s in enumerate(Qn)]
    
ans=abs(ans)
print(ans)

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #C
    1 | # C
      |   ^
a.cc:2:1: error: 'import' does not name a type
    2 | import math
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>

 using namespace std;
int N;


int factorial(int n)
{
    int x = 1; // 0! = 1

    for (int i = 1; i <= n; ++i)
        x *= i;

    return x;
}

int order(vector<int>P){
  sum=0;
  sum++;
  for(int i=0;i<N;i++){
  sum+=(P[i]-1)*(factorial(N-i-1));
  }
  return sum;
}
int main(){
  int P[10];
  int Q[10];
  for(int i=0;i<N;i++)cin>>P[i];
  for(int i=0;i<N;i++)cin>>Q[i];
  int a=order(P);
  int b=order(Q);
  int ans=a-b;
  if(ans<0)ans*=-1;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int order(std::vector<int>)':
a.cc:18:3: error: 'sum' was not declared in this scope
   18 |   sum=0;
      |   ^~~
a.cc: In function 'int main()':
a.cc:30:15: error: could not convert '(int*)(& P)' from 'int*' to 'std::vector<int>'
   30 |   int a=order(P);
      |               ^
      |               |
      |               int*
a.cc:31:15: error: could not convert '(int*)(& Q)' from 'int*' to 'std::vector<int>'
   31 |   int b=order(Q);
      |               ^
      |               |
      |               int*
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

typedef long long ll;

int main(void)
{
	int a;
	cin >> a;

	vector<int> data1(a), data2(a);
	for (int i = 0; i < a; i++) {
		cin >> data1[i];
	}

	for (int i = 0; i < a; i++) {
		cin >> data2[i];
	}

	map<vector<int>, int> ord;
	int cnt = 0;

	vector<int> v(a);

	for (int i = 0; i < a; i++) {
		v[i] = i;
	}

	do{
		ord[v] = cnt++;
	}while(next_permutation(v.begin(), v.end()));

	cout << abs(ord[p] - ord[q]) << endl;



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:25: error: 'p' was not declared in this scope
   41 |         cout << abs(ord[p] - ord[q]) << endl;
      |                         ^
a.cc:41:34: error: 'q' was not declared in this scope
   41 |         cout << abs(ord[p] - ord[q]) << endl;
      |                                  ^
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

int N;
vector<int> p, q;

int main() {
    cin >> N;
    vector<int> p(N), q(N);
    for (int i = 0; i < N; ++i) cin >> p[i], --p[i];
    for (int i = 0; i < N; ++i) cin >> q[i], --q[i];

    // 各順列が何番目かを求める
    map<vector<int>, int> ord;
    int iter = 0;

    // スタートとなる順列
    vector<int> v(N);
    for (int i = 0; i < N; ++i) v[i] = i;

    // 順番に
    do {
        ord[v] = iter++;
    } while (next_permutation(v.begin(), v.end()));

    cout << abs(ord[p] - ord[q]) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'map' was not declared in this scope
   23 |     map<vector<int>, int> ord;
      |     ^~~
a.cc:8:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    7 | #include <iomanip>
  +++ |+#include <map>
    8 | 
a.cc:23:20: error: expected primary-expression before ',' token
   23 |     map<vector<int>, int> ord;
      |                    ^
a.cc:23:22: error: expected primary-expression before 'int'
   23 |     map<vector<int>, int> ord;
      |                      ^~~
a.cc:32:9: error: 'ord' was not declared in this scope
   32 |         ord[v] = iter++;
      |         ^~~
a.cc:35:17: error: 'ord' was not declared in this scope
   35 |     cout << abs(ord[p] - ord[q]) << endl;
      |                 ^~~
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

int main(void)
{
	int a;
	cin >> a;

	vector<int> data1(a), data2(a);
	for (int i = 0; i < a; i++) {
		cin >> data1[i], --data1[i];
	}

	for (int i = 0; i < a; i++) {
		cin >> data2[i], --data2[i];
	}

	map<vector<int>, int> ord;
	int cnt = 0;

	vector<int> v(a);

	for (int i = 0; i < a; i++) {
		v[i] = i;
	}

	do{
		ord[v] = cnt++;
	}while(next_permutation(v.begin(), v.end()));

	cout << abs(ord[p] - ord[q]) << endl;



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'map' was not declared in this scope
   27 |         map<vector<int>, int> ord;
      |         ^~~
a.cc:8:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    7 | #include <iomanip>
  +++ |+#include <map>
    8 | 
a.cc:27:24: error: expected primary-expression before ',' token
   27 |         map<vector<int>, int> ord;
      |                        ^
a.cc:27:26: error: expected primary-expression before 'int'
   27 |         map<vector<int>, int> ord;
      |                          ^~~
a.cc:37:17: error: 'ord' was not declared in this scope
   37 |                 ord[v] = cnt++;
      |                 ^~~
a.cc:40:21: error: 'ord' was not declared in this scope
   40 |         cout << abs(ord[p] - ord[q]) << endl;
      |                     ^~~
a.cc:40:25: error: 'p' was not declared in this scope
   40 |         cout << abs(ord[p] - ord[q]) << endl;
      |                         ^
a.cc:40:34: error: 'q' was not declared in this scope
   40 |         cout << abs(ord[p] - ord[q]) << endl;
      |                                  ^
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

int main(void)
{
	int a;
	cin >> a;

	vector<int> data1(a), data2(a);
	for (int i = 0; i < a; i++) {
		cin >> data1[i];
	}

	for (int i = 0; i < a; i++) {
		cin >> data2[i];
	}

	map<vector<int>, int> ord;
	int cnt = 0;

	vector<int> v(a);

	for (int i = 0; i < a; i++) {
		v[i] = i;
	}

	do{
		ord[v] = cnt++;
	}while(next_permutation(v.begin(), v.end()));

	cout << abs(ord[p] - ord[q]) << endl;



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'map' was not declared in this scope
   27 |         map<vector<int>, int> ord;
      |         ^~~
a.cc:8:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    7 | #include <iomanip>
  +++ |+#include <map>
    8 | 
a.cc:27:24: error: expected primary-expression before ',' token
   27 |         map<vector<int>, int> ord;
      |                        ^
a.cc:27:26: error: expected primary-expression before 'int'
   27 |         map<vector<int>, int> ord;
      |                          ^~~
a.cc:37:17: error: 'ord' was not declared in this scope
   37 |                 ord[v] = cnt++;
      |                 ^~~
a.cc:40:21: error: 'ord' was not declared in this scope
   40 |         cout << abs(ord[p] - ord[q]) << endl;
      |                     ^~~
a.cc:40:25: error: 'p' was not declared in this scope
   40 |         cout << abs(ord[p] - ord[q]) << endl;
      |                         ^
a.cc:40:34: error: 'q' was not declared in this scope
   40 |         cout << abs(ord[p] - ord[q]) << endl;
      |                                  ^
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

int main(void)
{
	int a;
	cin >> a;

	vector<int> data1(a), data2(a);
	for (int i = 0; i < a; i++) {
		cin >> data1[i];
	}

	for (int i = 0; i < a; i++) {
		cin >> data2[i];
	}

	map<vector<int>, int> ord;
	int cnt = 0;

	vector<int> v(a);

	for (int i = 0; i < a; i++) {
		v[i] = i+1;
	}

	do{
		ord[v] = cnt++;
	}while(next_permutation(v.begin(), v.end()));

	cout << abs(ord[p] - ord[q]) << endl;



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'map' was not declared in this scope
   27 |         map<vector<int>, int> ord;
      |         ^~~
a.cc:8:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    7 | #include <iomanip>
  +++ |+#include <map>
    8 | 
a.cc:27:24: error: expected primary-expression before ',' token
   27 |         map<vector<int>, int> ord;
      |                        ^
a.cc:27:26: error: expected primary-expression before 'int'
   27 |         map<vector<int>, int> ord;
      |                          ^~~
a.cc:37:17: error: 'ord' was not declared in this scope
   37 |                 ord[v] = cnt++;
      |                 ^~~
a.cc:40:21: error: 'ord' was not declared in this scope
   40 |         cout << abs(ord[p] - ord[q]) << endl;
      |                     ^~~
a.cc:40:25: error: 'p' was not declared in this scope
   40 |         cout << abs(ord[p] - ord[q]) << endl;
      |                         ^
a.cc:40:34: error: 'q' was not declared in this scope
   40 |         cout << abs(ord[p] - ord[q]) << endl;
      |                                  ^
Language: C++

#include <bits/stdc++.h>
#include <algorithm> //next_permutation

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
  int n;
  cin>>n;
  vector <int> p(n),q(n);
  for (int i=0;i<n;i++) {cin>>p[i];p[i]--;}
  for (int i=0;i<n;i++) {cin>>q[i];q[i]--;}
  vector<int>V(n);
  map<vector<int>,int> ord;
  int count=0;
  for(int i=0;i<n;i++) V[i]=i;
  do{
    ord[V]=count+;
  }while(next_permutation(V.begin(),V.end()));

int ans=ord[p];
cout<<ans;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: expected primary-expression before ';' token
   19 |     ord[V]=count+;
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n),b(n),c(n);
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++) cin>>b[i];
  c=a;
  sort(c.begin(),c.end());
  int c1=0,c2=0;
  int i=0;
  do{
    if(c==a) c1=i;
    if(c==b) c2=i;
    i++;
  }while(next_permutation(c.begin(),c.end());
  cout<<abs(c1-c2);
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vi a(n),b(n),c(n);
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++) cin>>b[i];
  c=a;
  sort(c.begin(),c.end());
  int c1=0,c2=0;
  int i=0;
  do{
    if(c==a) c1=i;
    if(c==b) c2=i;
    i++;
  }while(next_permutation(c.begin(),c.end());
  cout<<abs(c1-c2);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vi' was not declared in this scope
    6 |   vi a(n),b(n),c(n);
      |   ^~
a.cc:7:29: error: 'a' was not declared in this scope
    7 |   for(int i=0;i<n;i++) cin>>a[i];
      |                             ^
a.cc:8:29: error: 'b' was not declared in this scope
    8 |   for(int i=0;i<n;i++) cin>>b[i];
      |                             ^
a.cc:9:3: error: 'c' was not declared in this scope
    9 |   c=a;
      |   ^
a.cc:9:5: error: 'a' was not declared in this scope
    9 |   c=a;
      |     ^
a.cc:15:11: error: 'b' was not declared in this scope
   15 |     if(c==b) c2=i;
      |           ^
a.cc:17:45: error: expected ')' before ';' token
   17 |   }while(next_permutation(c.begin(),c.end());
      |         ~                                   ^
      |                                             )
Language: C++

#include "bits/stdc++.h"

using namespace std;
using ll = long long;

int main() {
  int n; cin >> n;
  vector<int> p(n), q(n);
  auto solve = [&](vector<int>& v) -> int {
    vector<int> a(n);
    for (int i = 1; i <= n; i++) a[i-1] = i;
    int ans = 1;
    do {
      bool equal = true;
      for (int i = 0; i < n; i++) equal &= v[i] == a[i];
      if (equal) return ans;
      ans++;
    } while (next_permutation(a));
    return ans;
  };
  cout << abs(solve(p) - solve(q)) << endl;
  return 0;
}
#include "bits/stdc++.h"

using namespace std;
using ll = long long;

int main() {
  int n; cin >> n;
  vector<int> p(n), q(n);
  auto solve = [&](vector<int>& v) -> int {
    vector<int> a(n);
    for (int i = 1; i <= n; i++) a[i-1] = i;
    int ans = 1;
    do {
      bool equal = true;
      for (int i = 0; i < n; i++) equal &= v[i] == a[i];
      if (equal) return ans;
      ans++;
    } while (next_permutation(a.begin(), a.end()));
    return ans;
  };
  cout << abs(solve(p) - solve(q)) << endl;
  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:18:30: error: no matching function for call to 'next_permutation(std::vector<int>&)'
   18 |     } while (next_permutation(a));
      |              ~~~~~~~~~~~~~~~~^~~
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:1:
/usr/include/c++/14/bits/stl_algo.h:2939:5: note: candidate: 'template<class _BIter> bool std::next_permutation(_BIter, _BIter)'
 2939 |     next_permutation(_BidirectionalIterator __first,
      |     ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2939:5: note:   candidate expects 2 arguments, 1 provided
/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, 1 provided
a.cc: At global scope:
a.cc:29:5: error: redefinition of 'int main()'
   29 | int main() {
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main() {
      |     ^~~~
Language: C++

#include "bits/stdc++.h"

using namespace std;
using ll = long long;

int main() {
  int n; cin >> n;
  vector<int> p(n), q(n);
  auto solve = [&](vector<int>& v) -> int {
    vector<int> a(n);
    for (int i = 1; i <= n; i++) a[i-1] = i;
    int ans = 1;
    do {
      bool equal = true;
      for (int i = 0; i < n; i++) equal &= v[i] == a[i];
      if (equal) return ans;
      ans++;
    } while (next_permutation(a));
    return ans;
  };
  cout << abs(solve(p) - solve(q)) << endl;
  return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:18:30: error: no matching function for call to 'next_permutation(std::vector<int>&)'
   18 |     } while (next_permutation(a));
      |              ~~~~~~~~~~~~~~~~^~~
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:1:
/usr/include/c++/14/bits/stl_algo.h:2939:5: note: candidate: 'template<class _BIter> bool std::next_permutation(_BIter, _BIter)'
 2939 |     next_permutation(_BidirectionalIterator __first,
      |     ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2939:5: note:   candidate expects 2 arguments, 1 provided
/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, 1 provided
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});
//条件式が真ならwhileの中身を回し続ける

int INF = 100000;

int main() {
	int n;
	cin >> n;
	vector<int>p(n), q(n);
	rep(i, n) {
		cin >> p[i];
		cin >> q[i];
	}
	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;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: 'a' was not declared in this scope
   21 |                 mp[a] = mp.size();
      |                    ^
a.cc:22:35: error: 'a' was not declared in this scope
   22 |         } while (next_permutation(a.begin(), a.end()));
      |                                   ^
Language: C++

n = int(input())
p = [int(s) for s in input().split()]
q = [int(s) for s in input().split()]
pp = []
qq = []
for i in range(n):
    pp.append(0)
    qq.append(0)
for i in range(n-1):
    for j in range(n-i-1):
        if(p[i]>p[j+i+1]):
            pp[i]=pp[i]+1
        if(q[i]>q[j+i+1]):
            qq[i]=qq[i]+1
a = 0
b = 0
x = 1
for i in range(n-1):
    a = a + pp[n-i-2]*x
    b = b + qq[n-i-2]*x
    x = x*(i+2)
if (a>=b):
    print(int(a-b))
else:
    print(int(b-a))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

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


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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:45: error: expected ')' before '{' token
   15 |   while(next_permutation(a.begin(), a.end()){
      |        ~                                    ^
      |                                             )
a.cc:16:21: error: expected ';' before '}' token
   16 |    mp[a] = mp.size()
      |                     ^
      |                     ;
   17 |   }
      |   ~
Language: C++

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

long long N=0,K=0,M=0,A=0,ans=0,p=0;
string S;
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;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: two or more data types in declaration of 'type name'
   18 |     map<vector<int> int> mp;
      |         ^~~~~~~~~~~
a.cc:18:24: error: wrong number of template arguments (1, should be at least 2)
   18 |     map<vector<int> int> mp;
      |                        ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:20:11: error: no match for 'operator[]' (operand types are 'int' and 'std::vector<int>')
   20 |         mp[a] = mp.size();
      |           ^
a.cc:20:20: error: request for member 'size' in 'mp', which is of non-class type 'int'
   20 |         mp[a] = mp.size();
      |                    ^~~~
a.cc:23:21: error: no match for 'operator[]' (operand types are 'int' and 'std::vector<int>')
   23 |     int ans = abs(mp[p] - mp[q]);
      |                     ^
a.cc:23:29: error: no match for 'operator[]' (operand types are 'int' and 'std::vector<int>')
   23 |     int ans = abs(mp[p] - mp[q]);
      |                             ^
Language: C++

int main(){
    int n,a,b;
    cin>>n;
    vector<int> p(n),q(n),number(n);
   // a=0;
   // b=0;
   
    
    rep(i,n){
        cin>>p.at(i);
    }
    rep(i,n){
        cin>>q.at(i);
    }
     rep(i,n){
        number.at(i)=i+1;
    }
    
    int i=0;
    do{
       
        if(number==p)a=i;
        if(number==q)b=i;
        i++;
    }while(next_permutation(number.begin(),number.end()));
    
    cout<<abs(a-b)<<endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin>>n;
      |     ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> p(n),q(n),number(n);
      |     ^~~~~~
a.cc:4:12: error: expected primary-expression before 'int'
    4 |     vector<int> p(n),q(n),number(n);
      |            ^~~
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     rep(i,n){
      |         ^
a.cc:9:5: error: 'rep' was not declared in this scope
    9 |     rep(i,n){
      |     ^~~
a.cc:22:12: error: 'number' was not declared in this scope
   22 |         if(number==p)a=i;
      |            ^~~~~~
a.cc:22:20: error: 'p' was not declared in this scope
   22 |         if(number==p)a=i;
      |                    ^
a.cc:23:12: error: 'number' was not declared in this scope
   23 |         if(number==q)b=i;
      |            ^~~~~~
a.cc:23:20: error: 'q' was not declared in this scope
   23 |         if(number==q)b=i;
      |                    ^
a.cc:25:29: error: 'number' was not declared in this scope
   25 |     }while(next_permutation(number.begin(),number.end()));
      |                             ^~~~~~
a.cc:25:12: error: 'next_permutation' was not declared in this scope
   25 |     }while(next_permutation(number.begin(),number.end()));
      |            ^~~~~~~~~~~~~~~~
a.cc:27:5: error: 'cout' was not declared in this scope
   27 |     cout<<abs(a-b)<<endl;
      |     ^~~~
a.cc:27:11: error: 'abs' was not declared in this scope
   27 |     cout<<abs(a-b)<<endl;
      |           ^~~
a.cc:27:21: error: 'endl' was not declared in this scope
   27 |     cout<<abs(a-b)<<endl;
      |                     ^~~~
Language: C++

from itertools import*
N=range(1,int(input())+1)
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))
l=list(permutations(N))
print(abs(l.index(P)-l.index(Q)))


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import*
      | ^~~~
Language: C++

#include <iostream>
#include <bits/stdc++.h>
#include <vector>
 
using namespace std;
int main(){
	int size;
  	cin >> size;
  
  	vector<int> x(size), perm1(size), perm2(size);
  for( int i = 0; i < size; i++){
   cin >> perm1[i];
  }
  for( int i = 0; i < size; i++){
   cin >> perm2[i];
  }
  for( int i = 0; i < size; i++){
  	x[i] = i+1 
  }
  
  int a = 0, b = 0, counter = 0;
  
  do{
    counter ++;
    if(perm1 == x){
     a = counter; 
    }
    if(perm2 == x){
      b = counter;
    }
    
  }
  while(next_permutation(x.begin(), x.end()))
  cout << abs(a-b);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: expected ';' before '}' token
   18 |         x[i] = i+1
      |                   ^
      |                   ;
   19 |   }
      |   ~                
a.cc:33:46: error: expected ';' before 'cout'
   33 |   while(next_permutation(x.begin(), x.end()))
      |                                              ^
      |                                              ;
   34 |   cout << abs(a-b);
      |   ~~~~
Language: C++

#include <iostream>
#include <bits/stdc++.h>
#include <vector>
 
using namespace std;
int main(){
	int size;
  	cin >> size;
  
  	vector<int> x(size), perm1(size), perm2(size);
  for( int i = 0; i < size; i++){
   cin >> perm1[i];
  }
  for( int i = 0; i < n; i++){
   cin >> perm2[i];
  }
  for( int i = 0; i < n; i++){
  	x[i] = i+1 
  }
  
  int a = 0, b = 0, counter = 0;
  
  do{
    counter ++;
    if(perm1 == x){
     a = counter; 
    }
    if(perm2 == x){
      b = counter;
    }
    
  }
  while(next_permutation(x.begin(), x.end())
  cout << abs(a-b);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: 'n' was not declared in this scope
   14 |   for( int i = 0; i < n; i++){
      |                       ^
a.cc:17:23: error: 'n' was not declared in this scope
   17 |   for( int i = 0; i < n; i++){
      |                       ^
a.cc:18:19: error: expected ';' before '}' token
   18 |         x[i] = i+1
      |                   ^
      |                   ;
   19 |   }
      |   ~                
a.cc:33:45: error: expected ')' before 'cout'
   33 |   while(next_permutation(x.begin(), x.end())
      |        ~                                    ^
      |                                             )
   34 |   cout << abs(a-b);
      |   ~~~~                                       
a.cc:33:45: error: expected ';' before 'cout'
   33 |   while(next_permutation(x.begin(), x.end())
      |                                             ^
      |                                             ;
   34 |   cout << abs(a-b);
      |   ~~~~
Language: C++

#include <iostream>
#include <bits/stdc++.h>
#include <vector>
 
using namespace std;
int main(){
	int size;
  	cin >> size;
  
  	vector<int> x(n), perm1(n), perm2(n);
  for( int i = 0; i < n; i++){
   cin >> perm1[i];
  }
  for( int i = 0; i < n; i++){
   cin >> perm2[i];
  }
  for( int i = 0; i < n; i++){
  	x[i] = i+1 
  }
  
  int a = 0, b = 0, counter = 0;
  
  do{
    counter ++;
    if(perm1 == x){
     a = counter; 
    }
    if(perm2 == x){
      b = counter;
    }
    
  }
  while(next_permutation(x.begin(), x.end())
  cout << abs(a-b);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: 'n' was not declared in this scope
   10 |         vector<int> x(n), perm1(n), perm2(n);
      |                       ^
a.cc:18:19: error: expected ';' before '}' token
   18 |         x[i] = i+1
      |                   ^
      |                   ;
   19 |   }
      |   ~                
a.cc:33:45: error: expected ')' before 'cout'
   33 |   while(next_permutation(x.begin(), x.end())
      |        ~                                    ^
      |                                             )
   34 |   cout << abs(a-b);
      |   ~~~~                                       
a.cc:33:45: error: expected ';' before 'cout'
   33 |   while(next_permutation(x.begin(), x.end())
      |                                             ^
      |                                             ;
   34 |   cout << abs(a-b);
      |   ~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int order(int n){
        vector<int> v;
        for (int i = 1; i <= n; ++i){
                v.push_back(i);
        }

        int o = 1;
        int sum;
        int x;
        for (int i = 1; i <= n; ++i){
                cin >> x;

                int index;
                for (int j = 0; j < v.size(); ++j){
                        if(v[j] == x) {
                                index = j;
                        }
                }

                sum = 1;
                for (int j = 1; j <= n-i; ++j){
                        sum *= j;
                }
                sum *= index;
                v.erase(remove(v.begin(), v.end(), x), v.end());
                o += sum;
        }
        return o;
}


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

        p = order(n);
        q = order(n);

        cout << max(p,q) - min(p,q) << endl;

}

Compiler output:
a.cc: In function 'int order(int)':
a.cc:30:39: error: cannot convert 'std::vector<int>::iterator' to 'const char*'
   30 |                 v.erase(remove(v.begin(), v.end(), x), v.end());
      |                                ~~~~~~~^~
      |                                       |
      |                                       std::vector<int>::iterator
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:158:32: note:   initializing argument 1 of 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |                    ~~~~~~~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int order(int n){
        vector<int> v;
        for (int i = 1; i <= n; ++i){
                v.push_back(i);
        }

        int o = 1;
        int sum;
        int x;
        for (int i = 1; i <= n; ++i){
                cin >> x;

                int index;
                for (int j = 0; j < v.size(); ++j){
                        if(v[j] == x) {
                                index = j;
                        }
                }

                sum = 1;
                for (int j = 1; j <= n-i; ++j){
                        sum *= j;
                }
                sum *= index;
                v.erase(std::remove(v.begin(), v.end(), x), v.end());
                o += sum;
        }
        return o;
}


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

        p = order(n);
        q = order(n);

        cout << max(p,q) - min(p,q) << endl;

}

Compiler output:
a.cc: In function 'int order(int)':
a.cc:30:44: error: cannot convert 'std::vector<int>::iterator' to 'const char*'
   30 |                 v.erase(std::remove(v.begin(), v.end(), x), v.end());
      |                                     ~~~~~~~^~
      |                                            |
      |                                            std::vector<int>::iterator
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:158:32: note:   initializing argument 1 of 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |                    ~~~~~~~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
int main(){
  int n,a,b,i=1,x;
  std::cin>>n;
  std::vector<int> p(n),q(n),v(n);
  for(i=0;i<n;++i){std::cin>>x;p.push_back(x);}
  for(i=0;i<n;++i){std::cin>>x;q.push_back(x);}
  std::iota(v.begin(), v.end(), 1);
  do{
    if(v==p)a=i;
    if(v==q)b=i;
    ++i;
  }
  while(std::next_permutation(v.begin(), v.end()));
  std::cout<<std::abs(a-b)<<"\n";
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: 'next_permutation' is not a member of 'std'; did you mean 'is_permutation'?
   17 |   while(std::next_permutation(v.begin(), v.end()));
      |              ^~~~~~~~~~~~~~~~
      |              is_permutation
Language: C++

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

bool areEqual(vector <int> a, int arr[], int n){
    for(int i = 0; i < n; i++){
        if(a[i] != arr[i]){
            return false;
            break;
        }
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    vector <int> a(n);
    int arr[n];
    //int arr1[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        a[i] = arr[i];
    }
  	sort(a.begin(),a.end());
    int t1,t2 = 0;
    while(!areEqual(a,arr,n)){
        next_permutation(a.begin(),a.end());
        t1++;
    }  
  	for(int i = 0; i < n; i++){
        cin >> arr1[i];
    }
    sort(a.begin(),a.end());
    while(!areEqual(a,arr,n)){
        next_permutation(a.begin(),a.end());
        t2++;
    }
    int ans = t2 - t1;
    cout << abs(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: 'arr1' was not declared in this scope; did you mean 'arr'?
   31 |         cin >> arr1[i];
      |                ^~~~
      |                arr
Language: C++

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

bool areEqual(int a[], int arr[], int n){
    for(int i = 0; i < n; i++){
        if(a[i] != arr[i]){
            return false;
            break;
        }
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    int a[n];
    int arr[n];
    int arr1[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> arr1[i];
    }
    sort(a.begin(),a.end());
    int t1,t2 = 0;
    while(!areEqual(a,arr,n)){
        next_permutation(a.begin(),a.end());
        t1++;
    }
    sort(a.begin(),a.end());
    while(!areEqual(a,arr1,n)){
        next_permutation(a.begin(),a.end());
        t2++;
    }
    int ans = t2 - t1;
    cout << abs(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:12: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   27 |     sort(a.begin(),a.end());
      |            ^~~~~
a.cc:27:22: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   27 |     sort(a.begin(),a.end());
      |                      ^~~
a.cc:30:28: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   30 |         next_permutation(a.begin(),a.end());
      |                            ^~~~~
a.cc:30:38: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   30 |         next_permutation(a.begin(),a.end());
      |                                      ^~~
a.cc:33:12: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   33 |     sort(a.begin(),a.end());
      |            ^~~~~
a.cc:33:22: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   33 |     sort(a.begin(),a.end());
      |                      ^~~
a.cc:35:28: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   35 |         next_permutation(a.begin(),a.end());
      |                            ^~~~~
a.cc:35:38: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   35 |         next_permutation(a.begin(),a.end());
      |                                      ^~~
Language: C++

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

bool areEqual(int a[], int arr[]){
    for(int i = 0; i < n; i++){
        if(a[i] !== arr[i]){
            return false;
            break;
        }
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    int a[n];
    int arr[n];
    int arr1[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> arr1[i];
    }
    sort(a.begin(),a.end());
    int t1,t2 = 0;
    while(!areEqual(a,arr)){
        next_permutation(a.begin(),a.end());
        t1++;
    }
    sort(a.begin(),a.end());
    while(!areEqual(a,arr1)){
        next_permutation(a.begin(),a.end());
        t2++;
    }
    int ans = t2 - t1;
    cout << abs(ans);
}

Compiler output:
a.cc: In function 'bool areEqual(int*, int*)':
a.cc:5:24: error: 'n' was not declared in this scope
    5 |     for(int i = 0; i < n; i++){
      |                        ^
a.cc:6:19: error: expected primary-expression before '=' token
    6 |         if(a[i] !== arr[i]){
      |                   ^
a.cc: In function 'int main()':
a.cc:27:12: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   27 |     sort(a.begin(),a.end());
      |            ^~~~~
a.cc:27:22: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   27 |     sort(a.begin(),a.end());
      |                      ^~~
a.cc:30:28: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   30 |         next_permutation(a.begin(),a.end());
      |                            ^~~~~
a.cc:30:38: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   30 |         next_permutation(a.begin(),a.end());
      |                                      ^~~
a.cc:33:12: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   33 |     sort(a.begin(),a.end());
      |            ^~~~~
a.cc:33:22: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   33 |     sort(a.begin(),a.end());
      |                      ^~~
a.cc:35:28: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   35 |         next_permutation(a.begin(),a.end());
      |                            ^~~~~
a.cc:35:38: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   35 |         next_permutation(a.begin(),a.end());
      |                                      ^~~