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

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
 
	public static void main(String[] args) {
 
		Scanner scan = new Scanner(System.in);
 
		int N = scan.nextInt();
		int[] suretuP = new int[N];
		int[] suretuQ = new int[N];
 
		ArrayList<Integer> int1 = new ArrayList<>();
		ArrayList<Integer> int2 = new ArrayList<>();
 
		for(int i=0;i<N;i++) {
 
			suretuP[i] = scan.nextInt();
		}
 
		for(int i=0;i<N;i++) {
			suretuQ[i] = scan.nextInt();
		}
 
 
		for(int i=1;i<=N;i++) {
			integer1.add(i);
		}
 
		int countP = 0;
 
		for(int i = 0;i < N - 1; i++) {
			countP += integer1.indexOf(suretuP[i])*fact(N-i-1);
			integer1.remove((Integer)suretuP[i]);
			Collections.sort(integer1);
		}
 
		for(int i = 1;i <= N; i++) {
			integer2.add(i);
		}
		int countQ = 0;
 
		for(int i=0;i < N-1; i++) {
			countQ += integer2.indexOf(suretuQ[i])*fact(N-i-1);
			integer2.remove((Integer)suretuQ[i]);
			Collections.sort(integer2);
		}
 
		System.out.println(Math.abs(countP-countQ));
		scan.close();
 
	}
 
	public static int fact(int num) {
 
		int i=1;
		for(int j=1;j<=num;j++) {
			i *= j;
		}
		return i;
	}
 
}

Compiler output:
Main.java:28: error: cannot find symbol
			integer1.add(i);
			^
  symbol:   variable integer1
  location: class Main
Main.java:34: error: cannot find symbol
			countP += integer1.indexOf(suretuP[i])*fact(N-i-1);
			          ^
  symbol:   variable integer1
  location: class Main
Main.java:35: error: cannot find symbol
			integer1.remove((Integer)suretuP[i]);
			^
  symbol:   variable integer1
  location: class Main
Main.java:36: error: cannot find symbol
			Collections.sort(integer1);
			                 ^
  symbol:   variable integer1
  location: class Main
Main.java:40: error: cannot find symbol
			integer2.add(i);
			^
  symbol:   variable integer2
  location: class Main
Main.java:45: error: cannot find symbol
			countQ += integer2.indexOf(suretuQ[i])*fact(N-i-1);
			          ^
  symbol:   variable integer2
  location: class Main
Main.java:46: error: cannot find symbol
			integer2.remove((Integer)suretuQ[i]);
			^
  symbol:   variable integer2
  location: class Main
Main.java:47: error: cannot find symbol
			Collections.sort(integer2);
			                 ^
  symbol:   variable integer2
  location: class Main
8 errors
Language: C++

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

int main() {
    int n,cnta=0,cntb=0;
    cin>>n;
    vector<int> a(n),b(n),an(n),bn(n);
    bool ok = true;
    for(int i=0; i<n; i++) {
        na[i] = i+1;
        nb[i] = i+1;
    }
    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++) {
        for(int j=0; j<n; j++) {
            if(an[i] != b[i]) ok = false;
        }
        cnta++;
        if(ok) break;
        next_permutation(an.begin(),an.end());
    }
    for(int i=0; ; i++) {
        for(int j=0; j<n; j++) {
            if(bn[i] != b[i]) ok =false;
        }
        if(ok) break;
        cntb++;
        next_permutation(bn.begin(),bn.end());
    }
    cout<<abs(cnta-cntb)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'na' was not declared in this scope; did you mean 'an'?
   11 |         na[i] = i+1;
      |         ^~
      |         an
a.cc:12:9: error: 'nb' was not declared in this scope; did you mean 'bn'?
   12 |         nb[i] = i+1;
      |         ^~
      |         bn
Language: C++

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

int main() {
    int n,cnta=0,cntb=0;
    cin>>n;
    vector<int> a(n),b(n),na(n),nb(n);
    for(int i=0; i<n; i++) {
        na[i] = i+1;
        nb[i] = i+1;
    }
    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++) {
      ok = true;
        for(int j=0; j<n; j++) {
            if(an[i] != b[i]) ok = false;
        }
        cnta++;
        if(ok) break;
        next_permutation(an.begin(),an.end());
    }
    for(int i=0; ; i++) {
       ok=true;
        for(int j=0; j<n; j++) {
            if(bn[i] != b[i]) ok =false;
        }
        if(ok) break;
        cntb++;
        next_permutation(bn.begin(),bn.end());
    }
    cout<<abs(cnta-cntb)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: 'ok' was not declared in this scope
   16 |       ok = true;
      |       ^~
a.cc:18:16: error: 'an' was not declared in this scope; did you mean 'na'?
   18 |             if(an[i] != b[i]) ok = false;
      |                ^~
      |                na
a.cc:22:26: error: 'an' was not declared in this scope; did you mean 'na'?
   22 |         next_permutation(an.begin(),an.end());
      |                          ^~
      |                          na
a.cc:25:8: error: 'ok' was not declared in this scope
   25 |        ok=true;
      |        ^~
a.cc:27:16: error: 'bn' was not declared in this scope; did you mean 'nb'?
   27 |             if(bn[i] != b[i]) ok =false;
      |                ^~
      |                nb
a.cc:31:26: error: 'bn' was not declared in this scope; did you mean 'nb'?
   31 |         next_permutation(bn.begin(),bn.end());
      |                          ^~
      |                          nb
Language: C++

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

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

  rep(i, n) { v.at(i) = i + 1; }
  rep(i, n) { cin >> p.at(i); }
  rep(i, n) { cin >> q.at(i); }

  int idx = 1, pc = -1, qc = -1;
  do
  {
    if (v == p)
    {
      pc = idx;
    }
    if (v == q)
    {
      qc = idx;
    }

    if (pc != -1 && qc != -1)
    {
      break;
    }

    idx++;
  } while (next_permutation(v.begin(), v.end()));

  cout << abs(pc - qc) << endl;
}


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

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

int main(){
  int N ;
  cin >> N ;
  int p[N] ;
  int q[N] ;
  int original[]={1,2,3,4,5,6,7,8} ;
  int count =0;
  int a , b =0;
  for(int i=0;i<N;i++){
    cin >> p[i] ;
  }
  for(int j=0;j<N;j++){
    cin >> q[j] ;
  }
  
  do{
    count++;
    if(original==p) a = count;
    if(original==q) b = count;
    
    while(next_permutation(original.begin(),original.end()))
  }
  
  cout << abs(a-b) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:37: error: request for member 'begin' in 'original', which is of non-class type 'int [8]'
   24 |     while(next_permutation(original.begin(),original.end()))
      |                                     ^~~~~
a.cc:24:54: error: request for member 'end' in 'original', which is of non-class type 'int [8]'
   24 |     while(next_permutation(original.begin(),original.end()))
      |                                                      ^~~
a.cc:25:3: error: expected primary-expression before '}' token
   25 |   }
      |   ^
a.cc:27:3: error: expected 'while' before 'cout'
   27 |   cout << abs(a-b) << endl;
      |   ^~~~
a.cc:27:3: error: expected '(' before 'cout'
   27 |   cout << abs(a-b) << endl;
      |   ^~~~
      |   (
a.cc:27:27: error: expected ')' before ';' token
   27 |   cout << abs(a-b) << endl;
      |   ~~~~                    ^
      |                           )
Language: C++

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

int main(){
  int N ;
  cin >> N ;
  int p[N] ;
  int q[N] ;
  int original[]={1,2,3,4,5,6,7,8} ;
  int count =0;
  int a , b =0;
  for(int i=0;i<N;i++){
    cin >> p[i] ;
  }
  for(int j=0;j<N;j++){
    cin >> q[i] ;
  }
  
  do{
    count++;
    if(original==p) a = count;
    if(original==q) b = count;
    
    while(next_permutation(original.begin(),original.end()))
  }
  
  cout << abs(a-b) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: 'i' was not declared in this scope
   16 |     cin >> q[i] ;
      |              ^
a.cc:24:37: error: request for member 'begin' in 'original', which is of non-class type 'int [8]'
   24 |     while(next_permutation(original.begin(),original.end()))
      |                                     ^~~~~
a.cc:24:54: error: request for member 'end' in 'original', which is of non-class type 'int [8]'
   24 |     while(next_permutation(original.begin(),original.end()))
      |                                                      ^~~
a.cc:25:3: error: expected primary-expression before '}' token
   25 |   }
      |   ^
a.cc:27:3: error: expected 'while' before 'cout'
   27 |   cout << abs(a-b) << endl;
      |   ^~~~
a.cc:27:3: error: expected '(' before 'cout'
   27 |   cout << abs(a-b) << endl;
      |   ^~~~
      |   (
a.cc:27:27: error: expected ')' before ';' token
   27 |   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);
  for(int i=0;i<n;i++){
    cin>>p[i];
  }
  for(int i=0;i<n;i++){
    cin>>q[i];
  }
  vector<int>a(n);
  for(int i=0;i<n;i++){
    a[i]=i+1;
  }
  map<vector<int>,int>mp;
  do{
    mp[a]=mp.size();
    {while (next_permutation(a.begin(),a.end()));
  int ans=abs(mp[p]-mp[q]);
  cout<<ans<<endl;
}
          
          
      
  
    

  


Compiler output:
a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:19:5: note: to match this '{'
   19 |   do{
      |     ^
a.cc:24:2: error: expected 'while' at end of input
   24 | }
      |  ^
a.cc:24:2: error: expected '(' at end of input
   24 | }
      |  ^
      |  (
a.cc:24:2: error: expected primary-expression at end of input
a.cc:24:2: error: expected ')' at end of input
   24 | }
      |  ^
      |  )
a.cc:24:2: error: expected ';' at end of input
   24 | }
      |  ^
      |  ;
a.cc:24:2: error: expected '}' at end of input
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
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>mp;
  do{
    mp[a]=mp.size();
    while} (next_permutation(a.begin(),a.end()));
  int ans=abs(mp[p]-mp[q]);
  cout<<ans<<endl;
}
          
          
      
  
    

  

Compiler output:
a.cc: In function 'int main()':
a.cc:21:10: error: expected '(' before '}' token
   21 |     while} (next_permutation(a.begin(),a.end()));
      |          ^
      |          (
a.cc:21:10: error: expected primary-expression before '}' token
a.cc:21:10: error: expected ')' before '}' token
   21 |     while} (next_permutation(a.begin(),a.end()));
      |          ^
      |          )
a.cc:21:10: error: expected primary-expression before '}' token
a.cc:21:12: error: expected 'while' before '(' token
   21 |     while} (next_permutation(a.begin(),a.end()));
      |            ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
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> a(n);
    for(int i = 0;i < n;i++){
        a[i] = i + 1;
    }
    
    map<vector<int>,int> m;
    
    do{
        m[a] = m.size();
    }while(next_permutation(a.begin(),a.end()));
    
    int ans = abs(m[p] - m[q]);
    cout << ans << endl;
    
    return 0;
}
å

Compiler output:
a.cc:32:1: error: '\U000000e5' does not name a type
   32 | å
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
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> a(n);
    for(int i = 0;i < n;i++){
        a[i] = i + 1;
    }
    map<vector<int>,int> m;
    
    do{
        m[a] = m.size();
    }while(next_permitaiton(a.begin(),a.end()));
    
    int ans = abs(m[p] - m[q]);
    cout << ans <<< endl;
    
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'map' was not declared in this scope
   19 |     map<vector<int>,int> m;
      |     ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    3 | #include <algorithm>
  +++ |+#include <map>
    4 | using namespace std;
a.cc:19:20: error: expected primary-expression before ',' token
   19 |     map<vector<int>,int> m;
      |                    ^
a.cc:19:21: error: expected primary-expression before 'int'
   19 |     map<vector<int>,int> m;
      |                     ^~~
a.cc:22:9: error: 'm' was not declared in this scope
   22 |         m[a] = m.size();
      |         ^
a.cc:23:12: error: 'next_permitaiton' was not declared in this scope
   23 |     }while(next_permitaiton(a.begin(),a.end()));
      |            ^~~~~~~~~~~~~~~~
a.cc:25:19: error: 'm' was not declared in this scope
   25 |     int ans = abs(m[p] - m[q]);
      |                   ^
a.cc:26:19: error: expected primary-expression before '<' token
   26 |     cout << ans <<< endl;
      |                   ^
Language: C++

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

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

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

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

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'map' was not declared in this scope
   15 |     map <vector<int>, int> mp;
      |     ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    3 | #include <algorithm>
  +++ |+#include <map>
    4 | using namespace std;
a.cc:15:21: error: expected primary-expression before ',' token
   15 |     map <vector<int>, int> mp;
      |                     ^
a.cc:15:23: error: expected primary-expression before 'int'
   15 |     map <vector<int>, int> mp;
      |                       ^~~
a.cc:17:9: error: 'mp' was not declared in this scope; did you mean 'p'?
   17 |         mp[a] = mp.size();
      |         ^~
      |         p
a.cc:20:19: error: 'mp' was not declared in this scope; did you mean 'p'?
   20 |     int ans = abs(mp[p] - mp[q]);
      |                   ^~
      |                   p
Language: C++

#include "iostream"
#include "vector"
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    for(int &x:a) cin >> x;
    for(int &y:b) cin >> y;
    if(a > b)
        swap(a,b);
    int cnt = 0;
    while(a < b && ++cnt ) next_permutation(a.begin(),a.end());
    cout << cnt << endl;
    return 0;
}


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

#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
  int N,p,q,r;
  cin >> N;
  vector<int> P(N),Q(N),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];
  }
  do{
    if(P == R){
      p = r;
    }
    if(Q == R){
      q = r;
    }
    r++;
  }while(next_permutation(all(R)));
  cout << abs(p-q) << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:27: error: 'all' was not declared in this scope
   26 |   }while(next_permutation(all(R)));
      |                           ^~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
  int N,p,q,r;
  cin >> N;
  vector<int> P(N),Q(N),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];
  }
  do{
    if(P == R){
      p = r;
    }
    if(Q == R){
      q = r;
    }
    r++;
  }while(next_permutation(all(R)));
  cout << abs(p-q) << endl;
  
  return 0;
}
  
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: expected ';' before '<' token
   11 |   for(int i=0,i<N;i++){
      |                ^
      |                ;
a.cc:11:16: error: expected primary-expression before '<' token
a.cc:26:27: error: 'all' was not declared in this scope
   26 |   }while(next_permutation(all(R)));
      |                           ^~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
  int N,p,q,r;
  cin >> N;
  vector<int> P(N),Q(N),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];
  }
  do{
    if(P == R){
      p = r;
    }
    if(Q == R){
      q = r;
    }
    r++;
  }while(next_permutation(all(r)));
  cout << abs(p-q) << endl;
  
  return 0;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: expected ';' before '<' token
   11 |   for(int i=0,i<N;i++){
      |                ^
      |                ;
a.cc:11:16: error: expected primary-expression before '<' token
a.cc:26:27: error: 'all' was not declared in this scope
   26 |   }while(next_permutation(all(r)));
      |                           ^~~
Language: C

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

int kaijo(int nb){
	int sum = 1;
	while(nb > 0){
		sum *= nb;
		nb --;
	}
	return(sum);
}


int main(void){
	int N;
	scanf("%d", &N);
	int i = 1;
	
	int p[N +1], q[N+1];
	
	for(i = 0; i < N; i++){
		scanf("%d", &p[i];
	}
	
	for(i = 0; i < N; i++){
		scanf("%d", &q[i);
	}
	
	int ans1 = 1;
	int ans2 = 1;
	int j,pre1,pre2;
	
	for(i = 0; i < N -1; i++){
		pre1 = 0;
		pre2 = 0;
		for(j = 0; j < i;j++){
			if(p[j] < p[i]){
				pre1++;
			}
			if(q[j] < q[i]){
				pre2++;
			}
		}
		
		ans1 += kaijo(N-i-1) * (p[i]-1-pre1);
		ans2 += kaijo(N-i-1) * (q[i]-1-pre2);
	}
	printf("%d\n",abs(ans1 - ans2));
	return 0;
}




Compiler output:
main.c: In function 'main':
main.c:22:34: error: expected ')' before ';' token
   22 |                 scanf("%d", &p[i];
      |                      ~           ^
      |                                  )
main.c:22:35: error: expected ';' before '}' token
   22 |                 scanf("%d", &p[i];
      |                                   ^
      |                                   ;
   23 |         }
      |         ~                          
main.c:26:33: error: expected ']' before ')' token
   26 |                 scanf("%d", &q[i);
      |                                 ^
      |                                 ]
Language: C

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

int kaijo(int nb){
	int sum = 1;
	while(nb > 0){
		sum *= nb;
		nb --;
	}
	return(sum);
}


int main(){
	int N;
	scanf("%d", &N);
	int i = 1;
	
	int p[N +1], q[N+1];
	
	for(i = 0; i < N; i++){
		scanf("%d", &p[i];
	}
	
	for(i = 0; i < N; i++){
		scanf("%d", &q[i);
	}
	
	int ans1 = 1;
	int ans2 = 1;
	int j,pre1,pre2;
	
	for(i = 0; i < N -1; i++){
		pre1 = 0;
		pre2 = 0;
		for(j = 0; j < i;j++){
			if(p[j] < p[i]){
				pre1++;
			}
			if(q[j] < q[i]){
				pre2++;
			}
		}
		
		ans1 += kaijo(N-i-1) * (p[i]-1-pre1);
		ans2 += kaijo(N-i-1) * (q[i]-1-pre2);
	}
	printf("%d\n",abs(ans1 - ans2));
	return 0;
}




Compiler output:
main.c: In function 'main':
main.c:22:34: error: expected ')' before ';' token
   22 |                 scanf("%d", &p[i];
      |                      ~           ^
      |                                  )
main.c:22:35: error: expected ';' before '}' token
   22 |                 scanf("%d", &p[i];
      |                                   ^
      |                                   ;
   23 |         }
      |         ~                          
main.c:26:33: error: expected ']' before ')' token
   26 |                 scanf("%d", &q[i);
      |                                 ^
      |                                 ]
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;

int main(){
    int n,i=0,P,Q;
    cin>>n;
    vi p(n),q(n),a(n);
    rep(i,n)cin>>p[i],a[i]=i+1;
    rep(i,n)cin>>q[i];
    do{
        if(a==p)P=i;
        if(a==q)Q=i;
        i++;
    }while(next_permutation(all(a)));
    cout<<abs(P-Q)<<endl;
}


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

#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#define rep(i,N) for(int i=0; i<N;i++)
using namespace std;

int factorial(int a){
    int ans=1;
    rep(i,a){
        ans*=(i+1);
    }
    return ans;
};


int main(){
    int N;
    cin >>N;
    vector<int> P(N),Q(N),R(N),countP(N),countQ(N);
    int orderP=1;int orderQ=1;
    int n1,n2;
    rep(i,N){
        cin >> P[i];
    }
    rep(i,N){
        cin >> Q[i];
    }
    rep(i,N){
        countP[i]=1;
        countQ[i]=1;
    }
    rep(i,N){
        n1=0;
        n2=0;
        rep(j,P[i]-1){
            n1+=countP[j];
        }
        rep(j,Q[i]-1){
            n2+=countQ[j];
        }
        orderP+=n1*factorial(N-i-1);
        orderQ+=n2*factorial(N-i-1);
        countP[P[i]-1]=0;
        countQ[Q[i]-1]=0;
    }
    cout << abs(orderP-orderQ) << endl;



    

Compiler output:
a.cc: In function 'int main()':
a.cc:49:40: error: expected '}' at end of input
   49 |     cout << abs(orderP-orderQ) << endl;
      |                                        ^
a.cc:19:11: note: to match this '{'
   19 | int main(){
      |           ^
Language: Java

import java.util.Scanner;
import Math;
public class Main {

    public static int fact(int n){
        int ans = 1;
        while(n != 0){
            ans *= n;
            n--;
        }
        return ans;
    }

    public static int func(int[] a,int num){
        int ans = 0;
        for(int i = 0; i < a.length ; i++){
            ans += fact(num-(i+1))*(a[i]-1);
        }
        return ans;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int in_num = Integer.parseInt(sc.next());
        int[] p = new int[in_num];
        int[] q = new int[in_num];
        for(int i = 0 ; i < in_num ; i++){
            p[i] = Integer.parseInt(sc.next());
        }
        for(int i = 0 ; i < in_num ; i++){
            q[i] = Integer.parseInt(sc.next());
        }
        System.out.println(Math.abs(func(p,in_num)-func(q,in_num)));
    }
}

Compiler output:
Main.java:2: error: '.' expected
import Math;
           ^
1 error
Language: C++

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

int main(){
    int N;
    cin >> N;
    int p[N],q[N];
    rep(i,N){
        cin >> p[i];
    }
    rep(i,N){
        cin >> q[i];
    }
    int m[N];
    rep(i,N) m[i]=i+1;

    int a,b,count=0;
    do{
        int p_match = memcmp(p, m, sizeof(m));
        int q_match = memcmp(q, m, sizeof(m));
        
        if(p_match==0){
            a = count;
        }
        if(q_match==0){
            b = count;
        }
        count++;
    }while(next_permutation(m, m+N));

    cout << abs(a-b) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: 'memcmp' was not declared in this scope
   21 |         int p_match = memcmp(p, m, sizeof(m));
      |                       ^~~~~~
a.cc:3:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 | #define rep(i,n) for (int i=0; i<(n); i++)
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>  
using namespace std;
 
int main() {
    int n;
    cin >> n;
    vector<int> p;
    vector<int> q;
    for(int i = 0;i < n;i++){
      int a;
      cin >> a;
      p.push_back(a);
    }
    for(int i = 0;i < n;i++){
      int b;
      cin >> b;
      q.push_back(b);
    }
    vector<int> one_case;
    for (int i = 1; i < n+1; i++) { // one_case = {0,1,2,3,...n-1} とする
        one_case.emplace_back(i);
    }
  
    int f = 0;
   int h = 0;
   int kaisuu = 1;
   int pnogyou = 0;
   int hnogyou = 0;
    do {
        for (auto num : one_case) {
          if(num == p[f]){
            f++;
          }
          if(num == q[h]){
            h++;
          }
        };
        if(f == n) pnogyou = kaisuu;
        if(h == n) hnogyou = kaisuu;
        h = 0;
        f = 0;
        kaisuu ++;
    } while (next_permutation(one_case.begin(), one_case.end()));
    // 順列の最後になるまで one_case を並び替えながらループ
    cout << abs(pnogyou - hnogyou);
    return 0;
}

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

#include <iostream>
#include <vector>
#include <cstdlib>  
using namespace std;
 
int main() {
    int n;
    cin >> n;
    vector<int> p;
    vector<int> q;
    for(int i = 0;i < n;i++){
      int a;
      cin >> a;
      p.push_back(a);
    }
    for(int i = 0;i < n;i++){
      int b;
      cin >> b;
      q.push_back(b);
    }
    vector<int> one_case;
    for (int i = 1; i < n+1; i++) { // one_case = {0,1,2,3,...n-1} とする
        one_case.emplace_back(i);
    }
  
    int f = 0;
   int h = 0;
   int kaisuu = 1;
   int pnogyou = 0;
   int hnogyou = 0;
    do {
        for (auto num : one_case) {
          if(num == p[f]){
            f++;
          }
          if(num == q[h]){
            h++;
          }
        }
        if(f == n) pnogyou = kaisuu;
        if(h == n) hnogyou = kaisuu;
        h = 0;
        f = 0;
        kaisuu ++;
    } while (next_permutation(one_case.begin(), one_case.end()));
    // 順列の最後になるまで one_case を並び替えながらループ
    cout << abs(pnogyou - hnogyou);
    return 0;
}

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

#include <stdio.h>
int list[10] = {};

int abs(a){
    return (a>0) ? a : -a;
}

void list_set(){
    int i;
    for(i=0; i<8; i++){
        list[i] = i+1;
    }
}
//list = {1,2,3,4,5,6,7,8,0,0}

int list_where(int n){
    int i;
    for(i=0; i<8; i++){
        if(list[i]==n){
            return i;
        }
    }
    return 0;
}

void list_d(int n){
    int i, j;
    for(i=0;i<10;i++){
        if(list[i]==n){
            for(j=i; j<9; j++){
                list[j] = list[j+1];
            }
        }
    }
}

unsigned int kaijo(unsigned int n){
    if(n==0 || n==1){
        return 1;
    }
    else{
        return n * kaijo(n-1);
    }
}

int main(){
    int n, i, j, a, b;
    int p[8] = {};
    int q[8] = {};
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &p[i]);
    }
    for(i=0; i<n; i++){
        scanf("%d", &q[i]);
    }
    a = b = 0;
    list_set();
    for(i=0; i<n; i++){
        a += list_where(p[i]) * kaijo(n-i-1);
        list_d(p[i]);
    }

    list_set();
    for(i=0; i<n; i++){
        b += list_where(q[i]) * kaijo(n-i-1);
        list_d(q[i]);
    }
    printf("%d\n", abs(a-b));
    return 0;
}

Compiler output:
a.cc:4:5: warning: built-in function 'abs' declared as non-function [-Wbuiltin-declaration-mismatch]
    4 | int abs(a){
      |     ^~~
a.cc:4:9: error: 'a' was not declared in this scope
    4 | int abs(a){
      |         ^
a.cc: In function 'int main()':
a.cc:69:23: error: 'abs' cannot be used as a function
   69 |     printf("%d\n", abs(a-b));
      |                    ~~~^~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	scanf("%d", &n);

	vector<int> p(n), q(n);
	for(int &x : p) scanf("%d", &x);
	for(int &x : q) scanf("%d", &x);

	vector<int> id(n);
	iota(id.begin(), id.end(), 1);

	int a = -1, b = -1;
	int tmp = 0;
	do {
		if(a != -1 and b != -1) break;
		tmp++;
		if(id == p) a = tmp;
		if(id == q) b = tmp;

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

	printf("%d\n", abs(a - b));

}


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

#include<iostream>
#include<vector>
#include<cstdlib>
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> v;
    for(int i=1;i<=N;i++) {
        v.push_back(i);
    }
    int a=0,b=0,cnt=0;
    while(next_permutation(v.begin(),v.end())) { // if its the first one it will never check so value stays 0
        cnt++;
        bool check = true;
        for(int i=0;i<N;i++) {
            if(P[i] != v[i]) check = false;
        }
        if(check) a = cnt;
        check = true;
        for(int i=0;i<N;i++) {
            if(Q[i] != v[i]) check = false;
        }
        if(check) b = cnt;
    }
    cout << abs(a-b) << endl;
    cout << a << " " << b << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: 'next_permutation' was not declared in this scope
   22 |     while(next_permutation(v.begin(),v.end())) { // if its the first one it will never check so value stays 0
      |           ^~~~~~~~~~~~~~~~
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
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:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
	int n;
	cin >> n;
	vector<int> p(n), q(n), t(n);
	rep(i, n)
	{
		cin >> p[i];
		t[i] = i + 1;
	}
	rep(i, n)
	{
		cin >> q[i];
	}
	int p_count, q_count;
	p_count = q_count = 0;
	int count = 0;
	do
	{
		count++;
		p_find = true;
		q_find = true;
		rep(i, n)
		{
			if (p[i] != t[i])
				p_find = false;
			if (q[i] != t[i])
				q_find = false;
		}
		if (p_find)
			p_count = count;
		if (q_find)
			Q_count = count;
	} while (next_permutation(t.begin(), t.end()));
	cout << abs(p_count - q_count) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:17: error: 'p_find' was not declared in this scope
   36 |                 p_find = true;
      |                 ^~~~~~
a.cc:37:17: error: 'q_find' was not declared in this scope
   37 |                 q_find = true;
      |                 ^~~~~~
a.cc:48:25: error: 'Q_count' was not declared in this scope; did you mean 'q_count'?
   48 |                         Q_count = count;
      |                         ^~~~~~~
      |                         q_count
Language: C++

import sys
import math
from itertools import permutations
input = sys.stdin.readline

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

cur = []
for i in permutations(range(1, n + 1)):
    copy = []
    for u in i:
        copy.append(u)
    cur.append(str(copy))

a = cur.index(str(p))
b = cur.index(str(q))
print(abs(b - a))

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

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

int main(){
    int N;
    cin >> N;
    vector<int> X(N), P(N), Q(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++) {
        X[i] = i;
    }
    int A = 0;
    int B = 0;
    int cnt = 0;
    do{
        cnt++;
        if(P == X) a = cnt;
        if(Q == X) b = cnt;
    }while(next_permutation(X.begin(), X.end()));
    cout << abs(a - b) << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: 'a' was not declared in this scope
   22 |         if(P == X) a = cnt;
      |                    ^
a.cc:23:20: error: 'b' was not declared in this scope
   23 |         if(Q == X) b = cnt;
      |                    ^
a.cc:25:17: error: 'a' was not declared in this scope
   25 |     cout << abs(a - b) << endl;
      |                 ^
a.cc:25:21: error: 'b' was not declared in this scope
   25 |     cout << abs(a - b) << endl;
      |                     ^
Language: C++

#include <iostream>
#include <math.h>
#define max(i , j) (i > j) i : j
using namespace std;

int kaijou(int _x) {
	int num = 1;
	for (int i = 1; i <= _x; i++)
		num *= i;

	return num;
}

int main() {
	int n, p[8], q[8], p_b = 0, q_b = 0, ans;
	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++) {
		p_b += (p[i] - 1) * kaijou(n - 1 - i);
		q_b += (q[i] - 1) * kaijou(n - 1 - i);

		for (int j = 0; j < n; j++) {
			if (p[i] < p[j])
				p[j]--;
			if (q[i] < q[j])
				q[j]--;
		}
	}

	ans = max(p_b - q_b, q_b - p_b);
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:19: error: expected ';' before 'p_b'
   36 |         ans = max(p_b - q_b, q_b - p_b);
      |                   ^~~
a.cc:3:28: note: in definition of macro 'max'
    3 | #define max(i , j) (i > j) i : j
      |                            ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  int N;
  cin >> N;
  
  int P[N], Q[N], R[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++) {
    cin >> R[i];
  }
  
  int count = 0;
  int countP, countQ;
  do {
    count++;
    for (int i = 0; i < N; i++) {
      int condP = 0;
      int condQ = 0;
      
      if (P[i] == R[i]) condP++;
      if (Q[i] == R[i]) condQ++;
    }
    
    if (condP == N) countP = count;
    if (condQ == N) countQ = count;
    
  } while(next_permutation(R, R+N));
  
  cout << abs(countP - countQ) << endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'condP' was not declared in this scope; did you mean 'countP'?
   33 |     if (condP == N) countP = count;
      |         ^~~~~
      |         countP
a.cc:34:9: error: 'condQ' was not declared in this scope; did you mean 'countQ'?
   34 |     if (condQ == N) countQ = count;
      |         ^~~~~
      |         countQ
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int>P(N);
  for(int i=0;i<N;i++)
    cin>>P.at(i);
  vector<int>Q(N);
  for(int i=0;i<N;i++)
    cin>>Q.at(i);
  vector<int>vec(N);
  for(int i=0;i<N;i++)
    vec.at(i)=i+1;
  int a=0;
  do{
  a++;
    bool x=true;
    for(int i=0;i<N;i++){
    if(P.at(i)!=vec.at(i)){
    x=false; break;
    }
    
    } if(x)break;
  }while(next_permutation(vec.begin(),vec.end());
   int b=0;
  do{
  a++;
    bool x=true;
    for(int i=0;i<N;i++){
    if(Q.at(i)!=vec.at(i)){
    x=false; break;
    }
    
    } if(x)break;
  }while(next_permutation(vec.begin(),vec.end());
         int ans=abs(a-b);
         cout<<ans<<endl;
         return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int>P(N);
  for(int i=0;i<N;i++)
    cin>>P.at(i);
  vector<int>Q(N);
  for(int i=0;i<N;i++)
    cin>>Q.at(i);
  vector<int>vec(N);
  for(int i=0;i<N;i++)
    A.at(i)=i+1;
  int a=0;
  do{
  a++;
    bool x=true;
    for(int i=0;i<N;i++){
    if(P.at(i)!=vec.at(i)){
    x=false; break;
    }
    
    } if(x)break;
  }while(next_permutation(vec.begin(),vec.end());
   int b=0;
  do{
  a++;
    bool x=true;
    for(int i=0;i<N;i++){
    if(Q.at(i)!=vec.at(i)){
    x=false; break;
    }
    
    } if(x)break;
  }while(next_permutation(vec.begin(),vec.end());
         int ans=abs(a-b);
         cout<<ans<<endl;
         return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'A' was not declared in this scope
   14 |     A.at(i)=i+1;
      |     ^
a.cc:25:49: error: expected ')' before ';' token
   25 |   }while(next_permutation(vec.begin(),vec.end());
      |         ~                                       ^
      |                                                 )
a.cc:36:49: error: expected ')' before ';' token
   36 |   }while(next_permutation(vec.begin(),vec.end());
      |         ~                                       ^
      |                                                 )
Language: C++

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

int main() {

  int N;
  cin >> N;
  
  int P[N];
  int Q[N];
  
  int kaijo[i];
  
  kaijo[0] = 1;
  for (int i = 0; i < 8;i++)
    kaijo[i+1] = kaijo[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;
  
  for (int i = 0; i < N; i++) {
    a += (a[i] - 1) * kaijo[8-i];
    b += (b[i] - 1) * kaijo[8-i];
  }
  
  cout << abs(a-b) << endl;
    
  
  
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'i' was not declared in this scope
   12 |   int kaijo[i];
      |             ^
a.cc:14:3: error: 'kaijo' was not declared in this scope
   14 |   kaijo[0] = 1;
      |   ^~~~~
a.cc:25:12: error: invalid types 'int[int]' for array subscript
   25 |     a += (a[i] - 1) * kaijo[8-i];
      |            ^
a.cc:26:12: error: invalid types 'int[int]' for array subscript
   26 |     b += (b[i] - 1) * kaijo[8-i];
      |            ^
Language: C++

#include <bits/stdc++.h>

typedef long long ll;
const int INF = 1e9;

using namespace std; 

#define REP(inc, bgn, end) for (int inc = bgn; inc < end; inc++)

int main() {
    int n;
    vector<int> p(n), q(n), a(n);
    REP(i, 0, n) cin >> p[i];
    REP(i, 0, n) {
        cin >> q[i];
        a[i] = i;
    }
    
    map<vector<int>, int> mp;
    do {
        mp[a] = mp.size();
    } while (next_premutation(a.begin(), a.end()));

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

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

#include <iostream>

using namespace std;

int kaijo(int n)
{
	int sum = 1;
	while (n >= 1)
	{
		sum *= n;
		n--;
	}
	return (sum);
}

int main()
{
	int N;
	cin >> N;
	int i = 0;
	int P[N];
	int Q[N];
	while (i < N)
		cin >> P[i++];
	i = 0;
	while (i < N)
		cin >> Q[i++];
	int ans1 = 1,ans2 =1;
	int j,p,q;
	i = 0;
	while (i < N)
	{
		j = 0;
		p = 0;
		q = 0;
		while (j < i)
		{
			if (P[j] < P[i])
				p++;
			if (Q[j] < Q[i])
				q++;
			j++;
		}
		ans1 += kaijo(N - (i + 1)) * (P[i] - 1 - p);
		ans2 += kaijo(N - (i + 1)) * (Q[i] - 1 - q);
		i++;
	}
	printf("%d", abs(ans1-ans2));
	return 0;
}

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

#include <iostream> // cout, endl, cin
#include <vector> // vector


#include <map> // map

#include <set> // set

using namespace std;

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

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


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

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:24:10: error: 'next_permutation' was not declared in this scope
   24 |   }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);

  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++;
  }
  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:10:11: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin>>p(i);
      |          ~^~~
a.cc:13:11: error: no match for call to '(std::vector<int>) (int&)'
   13 |     cin>>q(i);
      |          ~^~~
a.cc:17:6: error: no match for call to '(std::vector<int>) (int&)'
   17 |     a(i)=i++;
      |     ~^~~
Language: C++

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

int main(){
  int N;
  cin>>N;
  vector<int> num1(N),num2(N);

  for(int i=0;i<N;i++){
    cin>>num1(i);
  }
  for(int i=0;i<N;i++){
    cin>>num2(i);
  }
  vector<int> a(N);
  for(int i=0;i<N;i++){
    a(i)=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:10:14: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin>>num1(i);
      |          ~~~~^~~
a.cc:13:14: error: no match for call to '(std::vector<int>) (int&)'
   13 |     cin>>num2(i);
      |          ~~~~^~~
a.cc:17:6: error: no match for call to '(std::vector<int>) (int&)'
   17 |     a(i)=i++;
      |     ~^~~
a.cc:24:18: error: 'p' was not declared in this scope; did you mean 'mp'?
   24 |   int ans=abs(mp[p]-mp[q]);
      |                  ^
      |                  mp
a.cc:24:24: error: 'q' was not declared in this scope
   24 |   int ans=abs(mp[p]-mp[q]);
      |                        ^
Language: C++

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

int main(){
  int N;
  cin>>N;
  vector<int>num1(N);
  vector<int>num2(N);
  for(int i=0;i<N;i++){
    cin>>num1(i);
  }
  for(int i=0;i<N;i++){
    cin>>num2(i);
  }
  vector<int> a(N);
  for(int i=0;i<N;i++){
    a(i)=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:10:14: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin>>num1(i);
      |          ~~~~^~~
a.cc:13:14: error: no match for call to '(std::vector<int>) (int&)'
   13 |     cin>>num2(i);
      |          ~~~~^~~
a.cc:17:6: error: no match for call to '(std::vector<int>) (int&)'
   17 |     a(i)=i++;
      |     ~^~~
a.cc:24:18: error: 'p' was not declared in this scope; did you mean 'mp'?
   24 |   int ans=abs(mp[p]-mp[q]);
      |                  ^
      |                  mp
a.cc:24:24: error: 'q' was not declared in this scope
   24 |   int ans=abs(mp[p]-mp[q]);
      |                        ^
Language: C++

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

int main(){
  int N;
  cin>>N;
  vector<int>num1(N);
  vector<int>num2(N);
  for(int i=0;i<N;i++){
    cin>>num1(i);
  }
  for(int i=0;i<N;i++){
    cin>>num2(i);
  }
  vector<int> a(N);
  for(int i=0;i<N;i++){
    a(i)=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:13:14: error: no match for call to '(std::vector<int>) (int&)'
   13 |     cin>>num1(i);
      |          ~~~~^~~
a.cc:16:14: error: no match for call to '(std::vector<int>) (int&)'
   16 |     cin>>num2(i);
      |          ~~~~^~~
a.cc:20:6: error: no match for call to '(std::vector<int>) (int&)'
   20 |     a(i)=i++;
      |     ~^~~
a.cc:27:18: error: 'p' was not declared in this scope; did you mean 'mp'?
   27 |   int ans=abs(mp[p]-mp[q]);
      |                  ^
      |                  mp
a.cc:27:24: error: 'q' was not declared in this scope
   27 |   int ans=abs(mp[p]-mp[q]);
      |                        ^
Language: C++

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

int main(){
  int N;
  vector<int>num1(N);
  vector<int>num2(N);
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>num1(i);
  }
  for(int i=0;i<N;i++){
    cin>>num2(i);
  }
  vector<int> a(N);
  for(int i=0;i<N;i++){
    a(i)=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:13:14: error: no match for call to '(std::vector<int>) (int&)'
   13 |     cin>>num1(i);
      |          ~~~~^~~
a.cc:16:14: error: no match for call to '(std::vector<int>) (int&)'
   16 |     cin>>num2(i);
      |          ~~~~^~~
a.cc:20:6: error: no match for call to '(std::vector<int>) (int&)'
   20 |     a(i)=i++;
      |     ~^~~
a.cc:27:18: error: 'p' was not declared in this scope; did you mean 'mp'?
   27 |   int ans=abs(mp[p]-mp[q]);
      |                  ^
      |                  mp
a.cc:27:24: error: 'q' was not declared in this scope
   27 |   int ans=abs(mp[p]-mp[q]);
      |                        ^