criyle/codenet-compile-errors huggingface dataset:
Language: C++

#i#include<iostream>
#include<algorithm> 
#include<cstring>
#define ios ios::sync_with_stdio(false)
#define mem(arr) memset(arr,0,sizeof(arr))
using namespace std;
typedef long long ll;
const ll maxn = 1e6 + 10;

int a[10],b[10],ans = 0; 

void solve(int a[],int b[])
{
	do
	{
		int flag = 1;
		for(int i = 0;i < n; i++)
		{
			if(a[i] != b[i])
			{
				flag = 0;
				ans++;
				break;
			}
		}
		if(flag) 
			break;
	}while(next_permutation(a,a+n));
}

int main()
{
        int n;
	cin>>n;
	for(int i = 0;i < n; i++) 
		cin>>a[i];
	for(int i = 0;i < n; i++) 
		cin>>b[i];
	for(int i = 0;i < n; i++)
	{
		if(a[i] < b[i])
		{
			solve(a,b);
			break;
		}
		else if(a[i] > b[i])
		{
			solve(b,a);
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #i; did you mean #if?
    1 | #i#include<iostream>
      |  ^
      |  if
a.cc: In function 'void solve(int*, int*)':
a.cc:17:35: error: 'n' was not declared in this scope
   17 |                 for(int i = 0;i < n; i++)
      |                                   ^
a.cc:28:37: error: 'n' was not declared in this scope
   28 |         }while(next_permutation(a,a+n));
      |                                     ^
a.cc: In function 'int main()':
a.cc:34:9: error: 'cin' was not declared in this scope
   34 |         cin>>n;
      |         ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<cstring>
  +++ |+#include <iostream>
    4 | #define ios ios::sync_with_stdio(false)
a.cc:52:9: error: 'cout' was not declared in this scope
   52 |         cout<<ans<<endl;
      |         ^~~~
a.cc:52:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:52:20: error: 'endl' was not declared in this scope
   52 |         cout<<ans<<endl;
      |                    ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include<cstring>
  +++ |+#include <ostream>
    4 | #define ios ios::sync_with_stdio(false)
Language: Java

import java.util.*;
import java.io.*;

public class Main {
	
	static int N;

	public static void main(String[] args) throws IOException {
		
		// 入出力高速化 java.io.* とthrows IOExceptionを忘れずに
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		N = Integer.parseInt(br.readLine());
		String[] P = br.readLine().split(" ") ; 
		String[] Q = br.readLine().split(" ") ; 
		
		String Pmoto = "";
		String Qmoto = "";
		for(int n=0; n<N; n++) {
			Pmoto += P[n];
			Qmoto += Q[n];
		}
		
		int countP = 0;
		int countQ = 0;
		
		ArrayList<String> zenbu = new ArrayList<String>();
		new Cmondai().jisyo("", zenbu);
		
		for(int a=0; a<zenbu.size(); a++) {
			if(zenbu.get(a).equals(Pmoto)) {
				countP = a+1;
			}
			if(zenbu.get(a).equals(Qmoto)) {
				countQ = a+1;
			}
		}
		
		System.out.println(Math.abs(countP-countQ));	
		
	}
	
	//辞書
	private void jisyo(String s, ArrayList<String> zenbu) {
		if(s.length() == N) {
			zenbu.add(s);
		}
		digit: 
		for(int i=1; i<=N; i++) {
			for(int j=0; j<s.length(); j++) {
				if(Character.getNumericValue(s.charAt(j)) == i) {
					continue digit;
				}
			}
			jisyo(s + Integer.toString(i),zenbu);
		}
	}
}

Compiler output:
Main.java:28: error: cannot find symbol
		new Cmondai().jisyo("", zenbu);
		    ^
  symbol:   class Cmondai
  location: class Main
1 error
Language: C++

#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>

using namespace std;
int main() {
	int n;
	int a = 0;
	int b = 0;
	int count = 0;
	int diffp = 0;
	int diffq = 0;
	int p[8], q[8];

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> q[i];
	}

	for (int i = 0; i < n; i++) {
		diffp = p[i] - (i + 1);
		if (diffp >= 0) {
			for (int j = 1; j <= diffp; j++) {
				a += kaijo(n - i + 1);
			}
		}
		else {
			break;
		}
	}
	for (int i = 0; i < n; i++) {
		diffq = q[i] - (i + 1);
		if (diffq >= 0) {
			for (int j = 1; j <= diffq; j++) {
				b += kaijo(n - i + 1);
			}
		}
		else {
			break;
		}
	}
		
	cout << abs(a-b);

	return 0;
}

int kaijo(int n) {
	int sum = 1;
	for (int i = 1; i <= n; i++) {
		sum = sum * i;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:38: error: 'kaijo' was not declared in this scope
   28 |                                 a += kaijo(n - i + 1);
      |                                      ^~~~~
a.cc:39:38: error: 'kaijo' was not declared in this scope
   39 |                                 b += kaijo(n - i + 1);
      |                                      ^~~~~
a.cc: In function 'int kaijo(int)':
a.cc:57:1: warning: no return statement in function returning non-void [-Wreturn-type]
   57 | }
      | ^
Language: C++

#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define el(a) (a).end()-(a).begin()

int main(){
	int n;
	cin>>n;
	vector<int> v;
	rep(i,n)v.push_back(i+1);
	int p=0,q=0,tmp;
	rep(i,n){
		cin>>tmp;
		p=p*10+tmp;
	}
	rep(i,n){
		cin>>tmp;
		q=q*10+tmp;
	}
	int count=0,num,a,b;
	do{
		num=0;
		count++;
		for(int& i:v)num=num*10+i;
		if(num==p)a=count;
		if(num==q)b=count;
	}while(next_permutation(all(v)));
	cout<<abs(b-a);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'in'?
    7 |         cin>>n;
      |         ^~~
      |         in
a.cc:8:9: error: 'vector' was not declared in this scope
    8 |         vector<int> v;
      |         ^~~~~~
a.cc:8:16: error: expected primary-expression before 'int'
    8 |         vector<int> v;
      |                ^~~
a.cc:9:13: error: 'i' was not declared in this scope
    9 |         rep(i,n)v.push_back(i+1);
      |             ^
a.cc:9:9: error: 'rep' was not declared in this scope
    9 |         rep(i,n)v.push_back(i+1);
      |         ^~~
a.cc:23:28: error: 'v' was not declared in this scope
   23 |                 for(int& i:v)num=num*10+i;
      |                            ^
a.cc:26:37: error: 'v' was not declared in this scope
   26 |         }while(next_permutation(all(v)));
      |                                     ^
a.cc:2:18: note: in definition of macro 'all'
    2 | #define all(a)  (a).begin(),(a).end()
      |                  ^
a.cc:26:16: error: 'next_permutation' was not declared in this scope
   26 |         }while(next_permutation(all(v)));
      |                ^~~~~~~~~~~~~~~~
a.cc:27:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   27 |         cout<<abs(b-a);
      |         ^~~~
      |         count
a.cc:27:15: error: 'abs' was not declared in this scope
   27 |         cout<<abs(b-a);
      |               ^~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;

int main(){
  int n;  cin >> n;
  vector<int>P(n);
  vector<int>Q(n);
  for(int i=0;i<n;i++){
    cin >> P.at(i);
  }
  for(int i=0;i<n;i++){
    cin >> Q.at(i);
  }
  vector<int>A(n);
  for(int i=0;i<n;i++){
    A.at(i) = i + 1;
  }

  int pe,qe;
  int jun = 1;
  do{
    int p = 0;
    int q = 0;
    for(int i=0;i<n;i++){
      if(A.at(i) == P.at(i))  p++;
      if(A.at(i) == Q.at(i))  q++;
    }
    if(p == n)  pe = jun;
    if(q == n)  qe = jun;
    jun++;
  }while(next_permutation(A.begin(),A.end()));
  if(pe - qe >= 0) cout << pe - qe << endl;
  else  cout << qe - pe << endl;
}


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

#include <iostream>
#include <vector>
#include <set>
#include <cmath>

using namespace std;

typedef long long ll;


int main() {
    int n;  cin >> n;
    vector<ll> 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<ll> v(n);
    for (int i = 0; i < n; i++)
        v[i] = i;
    
    int a, b, cnt = 1;;
    do {
        bool flag = true;
        for (int i = 0; i < n; i++) {
            if (p[i] != v[i])
                flag = false;
        }
        if (flag)
                a = cnt;

        flag = true;
        for (int i = 0; i < n; i++) {
            if (q[i] != v[i])
                flag = false;
        }
        if (flag)
            b = cnt;
        cnt++;
    } while (next_permutation(v.begin(), v.end()));

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

    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  int num_p,num_q;
  vector<int> p(n),q(n),c(n);
  for(int i=0;i<n;i++)cin>>p[i];
  for(int i=0;i<n;i++)cin>>q[i];
  for(int i=1;i<=n;i++)c[i-1]=i;
  do{
    if(c==p) num_p=cnt;    
    if(c==q) num_q=cnt;
  }while(next_permutation(c.begin(),c.end()));
  cout<<abs(num_p-num_q)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: 'cnt' was not declared in this scope; did you mean 'int'?
   11 |     if(c==p) num_p=cnt;
      |                    ^~~
      |                    int
a.cc:12:20: error: 'cnt' was not declared in this scope; did you mean 'int'?
   12 |     if(c==q) num_q=cnt;
      |                    ^~~
      |                    int
Language: Java

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


int main() {
   int n;
   cin>>n;
   int arr1[n],arr2[n];

    for(int i=0;i<n;i++)cin>>arr1[i];

    for(int i=0;i<n;i++)cin>>arr2[i];

    int arr3[n];

    for(int i=1;i<=n;i++)arr3[i-1]=i;

    int first = 1,ans1 = 0,ans2=0;


    do{

        bool  flag1 =1,flag2=1;

        for(int i=0;i<n;i++){
            if(arr1[i]!=arr3[i]){
                flag1 = 0;
            }
            if(arr2[i]!=arr3[i]){
                flag2 = 0;
            }
        }


        if(flag1)ans1=first;
        if(flag2)ans2=first;


        first++;
    }while(next_permutation(arr3,arr3+n));

    cout<<abs(ans1-ans2)<<endl;



    return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:7: error: not a statement
   cin>>n;
      ^
Main.java:8: error: not a statement
   int arr1[n],arr2[n];
            ^
Main.java:8: error: not a statement
   int arr1[n],arr2[n];
                   ^
Main.java:10: error: not a statement
    for(int i=0;i<n;i++)cin>>arr1[i];
                           ^
Main.java:12: error: not a statement
    for(int i=0;i<n;i++)cin>>arr2[i];
                           ^
Main.java:14: error: not a statement
    int arr3[n];
             ^
Main.java:42: error: not a statement
    cout<<abs(ans1-ans2)<<endl;
                        ^
Main.java:5: error: unnamed classes are a preview feature and are disabled by default.
int main() {
^
  (use --enable-preview to enable unnamed classes)
Main.java:8: error: ';' expected
   int arr1[n],arr2[n];
             ^
Main.java:14: error: ';' expected
    int arr3[n];
              ^
12 errors
Language: C++

ce std;

int main() {
    int N; cin >> N;
    vector<int> P(N),Q(N);
    for(int i=0; i<N; i++){
        cin >> P.at(i);
    }
    for(int i=0; i<N; i++){
        cin >> Q.at(i);
    }
    vector<int> order(N);
    for(int i=0; i<N; i++){
        order.at(i)=i+1;
    }
    int a,b;
    int now=1;
    do{
        int cntp=1; int cntq=1;
        for(int i=0; i<N; i++){
            if(order.at(i)!=P.at(i)) cntp=0;
            if(order.at(i)!=Q.at(i)) cntq=0;
        }
        if(cntp==1) a=now;
        if(cntq==1) b=now;
        now++;
    }while(next_permutation(order.begin(),order.end()));
    
    cout << abs(a-b) << endl;
}


Compiler output:
a.cc:1:1: error: 'ce' does not name a type
    1 | ce std;
      | ^~
a.cc: In function 'int main()':
a.cc:4:12: error: 'cin' was not declared in this scope
    4 |     int N; cin >> N;
      |            ^~~
a.cc:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int> P(N),Q(N);
      |     ^~~~~~
a.cc:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> P(N),Q(N);
      |            ^~~
a.cc:7:16: error: 'P' was not declared in this scope
    7 |         cin >> P.at(i);
      |                ^
a.cc:10:16: error: 'Q' was not declared in this scope
   10 |         cin >> Q.at(i);
      |                ^
a.cc:12:12: error: expected primary-expression before 'int'
   12 |     vector<int> order(N);
      |            ^~~
a.cc:14:9: error: 'order' was not declared in this scope
   14 |         order.at(i)=i+1;
      |         ^~~~~
a.cc:21:16: error: 'order' was not declared in this scope
   21 |             if(order.at(i)!=P.at(i)) cntp=0;
      |                ^~~~~
a.cc:21:29: error: 'P' was not declared in this scope
   21 |             if(order.at(i)!=P.at(i)) cntp=0;
      |                             ^
a.cc:22:16: error: 'order' was not declared in this scope
   22 |             if(order.at(i)!=Q.at(i)) cntq=0;
      |                ^~~~~
a.cc:22:29: error: 'Q' was not declared in this scope
   22 |             if(order.at(i)!=Q.at(i)) cntq=0;
      |                             ^
a.cc:27:29: error: 'order' was not declared in this scope
   27 |     }while(next_permutation(order.begin(),order.end()));
      |                             ^~~~~
a.cc:27:12: error: 'next_permutation' was not declared in this scope
   27 |     }while(next_permutation(order.begin(),order.end()));
      |            ^~~~~~~~~~~~~~~~
a.cc:29:5: error: 'cout' was not declared in this scope
   29 |     cout << abs(a-b) << endl;
      |     ^~~~
a.cc:29:13: error: 'abs' was not declared in this scope
   29 |     cout << abs(a-b) << endl;
      |             ^~~
a.cc:29:25: error: 'endl' was not declared in this scope
   29 |     cout << abs(a-b) << endl;
      |                         ^~~~
Language: C++

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


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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'for'
    7 |   for(int i = 0; i < n; i++){
      |   ^~~
a.cc:7:18: error: 'i' was not declared in this scope
    7 |   for(int i = 0; i < n; i++){
      |                  ^
a.cc:16:52: error: expected ')' before ';' token
   16 |   }while(next_permutation(temp.begin(), temp.end());
      |         ~                                          ^
      |                                                    )
a.cc:27:52: error: expected ')' before ';' token
   27 |   }while(next_permutation(temp.begin(), temp.end());
      |         ~                                          ^
      |                                                    )
Language: C++

//                        Bismillahir Rahmanir Rahim
//ALGO:
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define FILL(a, x) memset(a, x, sizeof(a))
#define ll long long
#define _i ({int a; scanf("%d", &a); a;})
#define _l ({ll a; scanf("%lld", &a); a;})
#define _d ({double a; scanf("%lf", &a); a;})
#define _c ({char a; cin>>a; a;})
#define _s ({string a; cin>>a; a;})
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define INF INT_MAX
#define mx 1000010
#define mod 1000000007
#define dout if(debug) cout
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<pair<int, int>, null_type,less<pair<int, int> >, rb_tree_tag,tree_order_statistics_node_update>
*/
const double Pi=acos(-1);
using namespace std;
int debug=01;
ll n, fact[10];
ll f(){
    int a[n+1];
    set<int>s;
    for(int i=1; i<=n; i++){
        cin>>a[i];
        s.insert(i);
    }
    ll pos=1;
    for(int i=1; i<n; i++){
        pos+=distance(s.begin(), s.lower_bound(a[i]))*fact[n-i];
        s.erase(s.find(a[i]));
    }
    return pos;
}
int main() {
    Fast
    fact[0]=1;
    for(int i=1; i<9; i++) fact[i]=fact[i-1]*i;
    cin>>n;
    cout<<abs(f()-f());
}


Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:6:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_Rb_tree_impl<std::less<int>, true>::~_Rb_tree_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::_Rb_tree_node<int>]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/map:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152:
/usr/include/c++/14/bits/stl_tree.h:658:16: note: called from here
  658 |         struct _Rb_tree_impl
      |                ^~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int mod=1e9+7;
// Not for Rating """"""""""I'm in Love with Experience :)""""""""""""""""""
void solve()
{
    ll N;cin>>N;
    std::vector<ll> A,B,C;
    int x;
    for(ll i=0;i<N;++i)
    {
        cin>>x;A.push_back(x);
    }
    for(ll i=0;i<N;++i)
    {
        cin>>x;B.push_back(x);
    }
    C=B;
    sort(C.begin(),C.end());
    int a=0,b=0,c=0;
    do{
        c++;
        if(C==A)a=c;
        else if(C==B)b=c;
    }while(nex_permutation(C.begin(),C.end()));
    cout<< abs(a-b);
}
int main(void)
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int T=1;while(T--){solve();}return 0;
}/*Solved By:- RITIK AGARWAL*/

Compiler output:
a.cc: In function 'void solve()':
a.cc:26:12: error: 'nex_permutation' was not declared in this scope
   26 |     }while(nex_permutation(C.begin(),C.end()));
      |            ^~~~~~~~~~~~~~~
Language: Java

import java.util.*;

public class Main {
  public static int[] kai;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    kai = new int[9];
    kai[0] = 1;
    for(int i = 1; i < 9; i++) {
      kai[i] = (i * kai[i - 1]);
    }
    int n = sc.nextInt();
    ArrayList<Integer> listp = new ArrayList<Integer>();
    ArrayList<Integer> listq = new ArrayList<Integer>();
    for(int i = 0; i < n; i++) {
      listp.add(sc.nextInt());
    }
    for(int i = 0; i < n; i++) {
      listq.add(sc.nextInt());
    }
    int a = dfs(listp.get(0), litp);
    int b = dfs(listq.get(0), litq);
    System.out.println(Math.abs(a - b));
  }

  public static int dfs(int p, ArrayList<Integer> list) {
    int t = list.size();
    int ret = (p - 1) * kai[t - 1];
    if(t == 1) {
      return 1;
    } else {
      ArrayList<Integer> list2 = new ArrayList<Integer>();
      for(int i = 1; i < t; i++) {
        list2.add(list.get(i));
      }
      ArrayList<Integer> list3 = list2;
      Collections.sort(list3);
      int k = 0;
      for(int i = 0; i < (t - 1); i++) {
        if(list3.get(i) == list2.get(0)) {
          k = (i + 1);
          break;
        }
      }
      ret += dfs(k, list2);
      return ret;
    }
  }
}


Compiler output:
Main.java:21: error: cannot find symbol
    int a = dfs(listp.get(0), litp);
                              ^
  symbol:   variable litp
  location: class Main
Main.java:22: error: cannot find symbol
    int b = dfs(listq.get(0), litq);
                              ^
  symbol:   variable litq
  location: class Main
2 errors
Language: C

#include <stdio.h>
#include <stdlib.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define swap(a,b) {ll tp=a;a=b;b=tp;}

int p[10] = {0};
int my_next_perm(int n){
    int i, j, tmp;
    if(n <= 1) return 0;
    for(i = n-1; i > 0 && p[i-1] >= p[i]; i--);
    if(i == 0) return 0;
    for(j = n-1; j > i && p[i-1] >= p[j]; j--);
    swap(p[i-1], p[j]);
    for(j = n-1; i < j; i++, j--)
        swap(p[i], p[j]);
    return 1;
}

int P[10] = {0}, Q[10] = {0};
int main(){
    int N; scanf("%d", &N);
    rep(i,N) scanf("%d", P+i);
    rep(i,N) scanf("%d", Q+i);

    int p_a,q_b,cnt=0;
    rep(i,N) p[i] = i+1;
    do{
        if(memcmp(P,p,sizeof(p)) == 0) p_a = cnt;
        if(memcmp(Q,p,sizeof(p)) == 0) q_b = cnt;
        cnt++;
    }while(my_next_perm(N));
    
    int ans = abs(p_a-q_b);
    printf("%d\n", ans);
    return 0;
}

Compiler output:
main.c: In function 'my_next_perm':
main.c:4:20: error: unknown type name 'll'
    4 | #define swap(a,b) {ll tp=a;a=b;b=tp;}
      |                    ^~
main.c:13:5: note: in expansion of macro 'swap'
   13 |     swap(p[i-1], p[j]);
      |     ^~~~
main.c:4:20: error: unknown type name 'll'
    4 | #define swap(a,b) {ll tp=a;a=b;b=tp;}
      |                    ^~
main.c:15:9: note: in expansion of macro 'swap'
   15 |         swap(p[i], p[j]);
      |         ^~~~
main.c: In function 'main':
main.c:28:12: error: implicit declaration of function 'memcmp' [-Wimplicit-function-declaration]
   28 |         if(memcmp(P,p,sizeof(p)) == 0) p_a = cnt;
      |            ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'memcmp'
    2 | #include <stdlib.h>
  +++ |+#include <string.h>
    3 | #define rep(i,n) for(int i=0; i<(int)(n); i++)
Language: C++

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

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;
  
  int cnt = 0, A, B;
  do {
    if (p==a) A = cnt;
    if (q==a) B = cnt;
    cnt++;
  }while(next_permutation(a.begin(), a.end()));
  
  cout << abs(A-B) << endl;
}

Compiler output:
a.cc:4:12: error: 'vecotr' does not name a type
    4 | using vi = vecotr<int>;
      |            ^~~~~~
a.cc: In function 'int main()':
a.cc:9:3: error: 'vi' was not declared in this scope
    9 |   vi p(n), q(n);
      |   ^~
a.cc:10:19: error: 'p' was not declared in this scope
   10 |   rep(i,n) cin >> p[i];
      |                   ^
a.cc:11:19: error: 'q' was not declared in this scope
   11 |   rep(i,n) cin >> q[i];
      |                   ^
a.cc:13:5: error: expected ';' before 'a'
   13 |   vi a(n);
      |     ^~
      |     ;
a.cc:14:12: error: 'a' was not declared in this scope
   14 |   rep(i,n) a[i] = i+1;
      |            ^
a.cc:18:9: error: 'p' was not declared in this scope
   18 |     if (p==a) A = cnt;
      |         ^
a.cc:18:12: error: 'a' was not declared in this scope
   18 |     if (p==a) A = cnt;
      |            ^
a.cc:19:9: error: 'q' was not declared in this scope
   19 |     if (q==a) B = cnt;
      |         ^
a.cc:19:12: error: 'a' was not declared in this scope
   19 |     if (q==a) B = cnt;
      |            ^
a.cc:21:27: error: 'a' was not declared in this scope
   21 |   }while(next_permutation(a.begin(), a.end()));
      |                           ^
Language: C++

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

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;
  
  int cnt = 0, A, B;
  do {
    if (p==a) A = cnt;
    if (q==a) B = cnt;
    cnt++;
  }while(next_permutation(a.begin(), a.end()));
  
  cout << abs(a-b) << endl;
}

Compiler output:
a.cc:4:12: error: 'vecotr' does not name a type
    4 | using vi = vecotr<int>;
      |            ^~~~~~
a.cc: In function 'int main()':
a.cc:9:3: error: 'vi' was not declared in this scope
    9 |   vi p(n), q(n);
      |   ^~
a.cc:10:19: error: 'p' was not declared in this scope
   10 |   rep(i,n) cin >> p[i];
      |                   ^
a.cc:11:19: error: 'q' was not declared in this scope
   11 |   rep(i,n) cin >> q[i];
      |                   ^
a.cc:13:5: error: expected ';' before 'a'
   13 |   vi a(n);
      |     ^~
      |     ;
a.cc:14:12: error: 'a' was not declared in this scope
   14 |   rep(i,n) a[i] = i+1;
      |            ^
a.cc:18:9: error: 'p' was not declared in this scope
   18 |     if (p==a) A = cnt;
      |         ^
a.cc:18:12: error: 'a' was not declared in this scope
   18 |     if (p==a) A = cnt;
      |            ^
a.cc:19:9: error: 'q' was not declared in this scope
   19 |     if (q==a) B = cnt;
      |         ^
a.cc:19:12: error: 'a' was not declared in this scope
   19 |     if (q==a) B = cnt;
      |            ^
a.cc:21:27: error: 'a' was not declared in this scope
   21 |   }while(next_permutation(a.begin(), a.end()));
      |                           ^
a.cc:23:17: error: 'b' was not declared in this scope
   23 |   cout << abs(a-b) << endl;
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(void){
  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> vec(n);
  iota(vec.begin(),vec.end(),1);
  int i=1;
  int n1,n2;
  do{
    if(p==vec){
      a=i;
    }
    if(q==vec){
      b=i;
    }
    i++;
  }while(next_permutation(vec.begin(),vec.end()));
  cout<<abs(a-b)<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: 'a' was not declared in this scope
   19 |       a=i;
      |       ^
a.cc:22:7: error: 'b' was not declared in this scope
   22 |       b=i;
      |       ^
a.cc:26:13: error: 'a' was not declared in this scope
   26 |   cout<<abs(a-b)<<endl;
      |             ^
a.cc:26:15: error: 'b' was not declared in this scope
   26 |   cout<<abs(a-b)<<endl;
      |               ^
Language: C++




#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for (int i=0;i<n;i++)
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

int main(){

 long long n;
 cin>>n;

 vector<int>p(n),q(n);

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

  vector<int>v(n);
  iota(v.begin()),v.end(),1);
  int a,b;

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


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

return 0;
}

Compiler output:
a.cc:17:9: warning: "rep" redefined
   17 | #define rep(i,a,n) for(int i=a; i<n; i++)
      |         ^~~
a.cc:16:9: note: this is the location of the previous definition
   16 | #define rep(i,n) for (int i=0;i<n;i++)
      |         ^~~
a.cc:29:9: error: macro "rep" requires 3 arguments, but only 2 given
   29 |  rep(i,n) cin>>p[i];
      |         ^
a.cc:17:9: note: macro "rep" defined here
   17 | #define rep(i,a,n) for(int i=a; i<n; i++)
      |         ^~~
a.cc:30:9: error: macro "rep" requires 3 arguments, but only 2 given
   30 |  rep(i,n) cin>>q[i];
      |         ^
a.cc:17:9: note: macro "rep" defined here
   17 | #define rep(i,a,n) for(int i=a; i<n; i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:29:2: error: 'rep' was not declared in this scope
   29 |  rep(i,n) cin>>p[i];
      |  ^~~
a.cc:30:5: error: expected ';' before 'cin'
   30 |  rep(i,n) cin>>q[i];
      |     ^     ~~~
      |     ;
a.cc:33:7: error: no matching function for call to 'iota(std::vector<int>::iterator)'
   33 |   iota(v.begin()),v.end(),1);
      |   ~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_numeric.h:88:5: note: candidate: 'template<class _ForwardIterator, class _Tp> void std::iota(_ForwardIterator, _ForwardIterator, _Tp)'
   88 |     iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
      |     ^~~~
/usr/include/c++/14/bits/stl_numeric.h:88:5: note:   candidate expects 3 arguments, 1 provided
a.cc:37:20: error: 'i' was not declared in this scope
   37 |     if(p == v) a = i;
      |                    ^
a.cc:38:20: error: 'i' was not declared in this scope
   38 |     if(q == v) b = i;
      |                    ^
a.cc:39:5: error: 'i' was not declared in this scope
   39 |     i++;
      |     ^
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;
  cin >> N;
  
  vector<int> P(N),Q(N);
  rep(i,N){
    cin >> P.at(i);
  }
  rep(i,N){
    cin >> Q.at(i);
  }
  
  vector<int> tmp(N),bigger(N);
  tmp = min(P,Q);
  bigger = max(P,Q);
  
  int ans=0;
  while(true){
    if(tmp == bigger) break;
    tmp = next_permutation(tmp.begin(),tmp.end());
    ans++
  }
  
  cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:49: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'bool')
   25 |     tmp = next_permutation(tmp.begin(),tmp.end());
      |                                                 ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'bool' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'bool' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'bool' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:26:10: error: expected ';' before '}' token
   26 |     ans++
      |          ^
      |          ;
   27 |   }
      |   ~
Language: C++

#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
  int N; cin>>N;
  int ans=1;
  REP(i,N+1)ans*=i;
  vector<int>P(N);
  vector<int>Q(N);
  rep(i,N)cin>>P[i];
  rep(i,N)cin>>Q[i];
  vector<int>A(N);
  int a,k;
  REP(i,N+1)A[i-1]=i;
  rep(j,ans){
    bool b=false;
    bool o=false;
    next_permutation(A.begin(),A.end());
    rep(i,N){
      if(A[i]!=P[i])b=true;
      if(A[i]!=Q[i])o=true;
      if(b=false&&i=N-1)a=j;
      if(o=false&&i=N-1)k=j;
    }
  }
  cout<<max(a,k)-min(a,k)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:17: error: lvalue required as left operand of assignment
   76 |       if(b=false&&i=N-1)a=j;
      |            ~~~~~^~~
a.cc:77:17: error: lvalue required as left operand of assignment
   77 |       if(o=false&&i=N-1)k=j;
      |            ~~~~~^~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int>p(N);
  vector<int>q(N);
  for(int i=0;i<N;i++){
    cin >> p.at(i);
  }
  for(int i=0;i<N;i++){
    cin >> 	q.at(i);
  }
  vector<int>order(N);
  for(int i=0;i<N;i++){
    order.at(i)=i;
  }
  int p_ans,q_ans;
  int count=1;
  do{
    bool p_if=true;
    bool q_if=true;
    for(int i=0;i<N;i++){
      if(p.at(i)!=order.at(i)) p_if=false;
      if(q.at(i)!=order.at(i)) q_if=false;
    }
    if(p_if) p_ans=i;
    if(q_if) q_ans=i;
    i++;
  }while(next_permutation(order.begin(),order.end()));
  cout << abs(p_ans-q_ans) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:20: error: 'i' was not declared in this scope
   28 |     if(p_if) p_ans=i;
      |                    ^
a.cc:29:20: error: 'i' was not declared in this scope
   29 |     if(q_if) q_ans=i;
      |                    ^
a.cc:30:5: error: 'i' was not declared in this scope
   30 |     i++;
      |     ^
Language: C++

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

int main(){
  int n,p,t1,t2,a=0,b=0;
  cin>>n;
  set<int> st;
  vector<int> v(n);
  
  rep(i,n) st.insert(i+1);
  rep(i,n){
    cin>>p;
    t1=1;
    for(int j=i;j<n-1;j++) t1*=(n-j-1);
    t2=distance(st.begin(),lower_bound(ALL(st),p));
    st.erase(p);
    a+=t1*t2;
  }
  rep(i,n) st.insert(i+1);
  rep(i,n){
    cin>>p;
    t1=1;
    for(int j=i;j<n-1;j++) t1*=(n-j-1);
    t2=distance(st.begin(),lower_bound(ALL(st),p));
    st.erase(p);
    b+=t1*t2;
  }
  cout<<ans=abs(a-b)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |   cout<<ans=abs(a-b)<<endl;
      |         ^~~
      |         abs
a.cc:30:21: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   30 |   cout<<ans=abs(a-b)<<endl;
      |             ~~~~~~~~^~~~~~
Language: C++

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

int main(){
    int n;
    cin >> n;

    vector<int> lib(n), p(n), q(n);

    for(int i = 0; i < n; i++){
        lib[i] = i + 1;
    }

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

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

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

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

    

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: could not convert 'lib.std::vector<int>::operator=(p)' from 'std::vector<int>' to 'bool'
   26 |         if(lib = p){
      |            ~~~~^~~
      |                |
      |                std::vector<int>
a.cc:29:16: error: could not convert 'lib.std::vector<int>::operator=(q)' from 'std::vector<int>' to 'bool'
   29 |         if(lib = q){
      |            ~~~~^~~
      |                |
      |                std::vector<int>
Language: C++

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

bool equalFunction(vector<int> a, vector<int> b){
    bool flag = true;
    for(int i = 0; i < a.size; i++){
        if(a[i] != b[i])
            flag = false;
    }
    return flag;
}

int main(){
    int n;
    cin >> n;

    vector<int> a(n), b(n), p(n), q(n);

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

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

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

    int cnta = 0;
    while(next_permutation(a.begin(),a.end())){
        cnta++;
        if(equalFunction(a, p))
            break;
    }

    int cntb = 0;
    while(next_permutation(b.begin(), b.end())){
        cntb++;
        if(equalFunction(b, q))
            break;
    }

    cout << abs(cnta - cntb) << endl;

    

    return 0;
}

Compiler output:
a.cc: In function 'bool equalFunction(std::vector<int>, std::vector<int>)':
a.cc:6:26: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
    6 |     for(int i = 0; i < a.size; i++){
      |                        ~~^~~~
      |                              ()
Language: C

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

int main(){
  int n;  cin >> n;
  vector<int> p(n), q(n), a(n);
  for(int i=0; i<n; i++)  cin >> p[i];
  for(int i=0; i<n; i++){
    cin >> q[i];
    a[i] = i + 1;
  }
    
  map<vector<int>, int> mp;
  do{
    mp[a] = mp.size();
  }while(next_permutation(a.begin(), a.end()));
  
  cout << abs(mp[p] - mp[q]) << endl;

  return 0;
}
  


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <bit>
#include <bitset>
// #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

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

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

	rep(i, n)
	{
		values[i] = i + 1;
	}

	int index = 1;
	int aIndex = -1;
	int bIndex = -1;

	do
	{
		bool oka = true;
		bool okb = true;

		// for (auto i = values.begin(); i != values.end(); ++i)
		// 	std::cout << *i << ' ';

		cout << endl;
		rep(i, n)
		{
			if (values[i] != p[i])
			{
				oka = false;
			}

			if (values[i] != q[i])
			{
				okb = false;
			}
		}

		if (oka)
		{
			aIndex = index;
		}

		if (okb)
		{
			bIndex = index;
		}

		index++;

	} while (next_permutation(values.begin(), values.end()));

	cout << abs(aIndex - bIndex) << endl;
}
//g++ -std=c++17 -g main.cpp -o mai	n

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

import itertools
n=int(input())
p=list(map(int, input().split()))
q=list(map(int, input().split()))

retu=range(1,n+1)
cnt=0
cp=0
cq=0
for r in itertools.permutations(retu):
    rr = [r[i] for i in range(n)]
    cnt+=1
    if rr == p:
        cp=cnt
    if rr == q:
        cq=cnt
print(abs(cp-cq))

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 <bits/stdc++.h> #include <iostream> #include <vector> #include <algorithm>
using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

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:1:26: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h> #include <iostream> #include <vector> #include <algorithm>
      |                          ^
a.cc:2:22: error: stray '#' in program
    2 | using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
      |                      ^
a.cc:2:23: error: 'define' does not name a type
    2 | using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
      |                       ^~~~~~
a.cc:2:61: error: expected constructor, destructor, or type conversion before '<' token
    2 | using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
      |                                                             ^
a.cc:2:71: error: expected constructor, destructor, or type conversion before '++' token
    2 | using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
      |                                                                       ^~
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> r(N);
    for (int i=0; i<N; i++){
        cin >> p[i];
        r[i] = i + 1;
    }
    for (int i=0; i<N; 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:20:11: error: 'a' was not declared in this scope
   20 |        mp[a] = mp.size();
      |           ^
a.cc:21:28: error: 'a' was not declared in this scope
   21 |    }while(next_permutation(a.begin(),a.end()));
      |                            ^
Language: C++

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

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:8:8: error: 'i' was not declared in this scope
    8 |    rep(i,n)cin >> p[i];
      |        ^
a.cc:8:4: error: 'rep' was not declared in this scope
    8 |    rep(i,n)cin >> p[i];
      |    ^~~
Language: C++


#include <bits/stdc++.h>
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> b;
  do{
    b[a]=b.size();
  }while(next_permutation(a.begin(),a.end()));
  cout<<abs(b[p]-b[q])<<endl;
  //記者会見をはじめます！
//　　　 ∧_,,∧ 
　//　　(`･ω･´) 
　　//　Ｕθ Ｕ 
//　／￣￣｜￣￣＼ 
　//|二二二二二二二| 
//｜　　　　　　 ｜ 
//ﾊﾟｼｬ ﾊﾟｼｬ ﾊﾟｼｬ ﾊﾟｼｬ 
//　 ∧∧└　∧∧ 
　//(　　)】(　　)】 
　///　/┘　/　/┘ 
//ノ￣ヽ　ノ￣ヽ
}


Compiler output:
a.cc:21:1: error: extended character 　 is not valid in an identifier
   21 | 　//　　(`･ω･´)
      | ^
a.cc:22:1: error: extended character 　 is not valid in an identifier
   22 | 　　//　Ｕθ Ｕ
      | ^
a.cc:22:1: error: extended character 　 is not valid in an identifier
a.cc:24:1: error: extended character 　 is not valid in an identifier
   24 | 　//|二二二二二二二|
      | ^
a.cc:28:1: error: extended character 　 is not valid in an identifier
   28 | 　//(　　)】(　　)】
      | ^
a.cc:29:1: error: extended character 　 is not valid in an identifier
   29 | 　///　/┘　/　/┘
      | ^
a.cc: In function 'int main()':
a.cc:21:1: error: '\U00003000' was not declared in this scope
   21 | 　//　　(`･ω･´)
      | ^~
Language: C++

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

int main() {
  long long n; cin >> n;
  vector <long long> p(n);
  vector <long long> q(n);
  for(int i = 0; i < n; i++) cin >> p[i];
  for(int i = 0; i < n; i++) cin >> q[i];

  vector <long long> a(n);
  vector <long long> b(n);
  long long t = 0;
  for(int i = 0; i < n; i++) {
    a[i] = i + 1;
    b[i] = i + 1;
  }

  long long num1;
  while(a != p) {
    next_permutation(p.begin(), p.end());
    t++;
    num1 = t;
  }

  long long num2 = 1;
  while(b != q) {
    next_permutation(q.begin(), q.end());
    t++
    num2 = t;
  }

  cout << abs(num1 - num2) << endl;

  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:8: error: expected ';' before 'num2'
   29 |     t++
      |        ^
      |        ;
   30 |     num2 = t;
      |     ~~~~
Language: C++

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

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];
    int count=0,i;
    vector<int> arr(n);
    for(i=0;i<n;i++)
    arr[i]=i+1;
    int a,b;
    do{
        count++;
        if(arr==p)
        a=count;
        if(arr==q)
        b=count;
    }while(next_permutation(arr.begin(),arr.end()));
    cout<<abs(a-b);
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'