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

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
#define chmax(a, b) a = (((a)<(b))?(b):(a))
#define chmin(a, b) a = (((a)<(b))?(a):(b))

const int INF = 1001001001;
const ll MOD = 1e9+7;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){std::fill((T*)array, (T*)(array+N),val);}

class CompareDist
{
public:
    bool operator()(PLL n1,PLL n2) {
				if(n1.first!=n2.first) return n1.first<n2.first;
				else return n1.second<n2.second;
    }
};

#define lengthof(x) (sizeof(x) / sizeof(*(x)))


__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

bool contain(int mask, int position){
  if((mask&(1<<position))) return true;
  else return false;
}


class Radix {
private:
  const char* s;
  int a[128];
public:
  Radix(const char* s = "0123456789ABCDEF") : s(s) {
    int i;
    for(i = 0; s[i]; ++i)
      a[(int)s[i]] = i;
  }
  std::string to(long long p, int q) {
    int i;
    if(!p)
      return "0";
    char t[64] = { };
    for(i = 62; p; --i) {
      t[i] = s[p % q];
      p /= q;
    }
    return std::string(t + i + 1);
  }
  std::string to(const std::string& t, int p, int q) {
    return to(to(t, p), q);
  }
  long long to(const std::string& t, int p) {
    int i;
    long long sm = a[(int)t[0]];
    for(i = 1; i < (int)t.length(); ++i)
      sm = sm * p + a[(int)t[i]];
    return sm;
  }
};


signed main(){
	int n; cin>>n;
	VI p(n), q(n), r(n);
  rep(i,n) cin>>p[i];
  rep(i,n) cin>>q[i];
  VVI v;
  iota(ALL(r), 1);
  do{
    v.PB(r);
  }while(next_permutation(ALL(r)));
  int a = lower_bound(ALL(v), p)-v.begin();
  int b = lower_bound(ALL(v), q)-v.begin();
  cout << abs(a-b) << endl;


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:112:3: error: 'iota' was not declared in this scope
  112 |   iota(ALL(r), 1);
      |   ^~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  int sum=1;
  for(int i=1; i<=N; i++) sum*=i;
  cout << sum << endl;
  int res = sum;
  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];
  }
  vecror<int> sample(N);
  for(int i=1; i<=N; i++){
  	sample[i] = i;
  }
  
  int a=0,b=0,k=1;
  
  for(int i=0; i<N; i++){
  	for(int j=1; j<=N; j++){
    	if(p[i] == j) {
          sum /= k;
          a += (sum/k)/(N-i)*(p[i]-1);
          cout << a << " ";
          if(i==0) k=N+1;
          k--;
        }
    }
  }
  k = 1;
  sum = res;
  for(int i=0; i<N; i++){
  	for(int j=1; j<=N; j++){
    	if(q[i] == j) {
          b += (sum/k)/(N-i)*(j-1);
          cout << b << " ";
          if(i==0) k=N+1;
          k--;
        }
    }
  }
  cout << a << endl;
  cout << b << endl;
  cout << a-b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'vecror' was not declared in this scope; did you mean 'perror'?
   18 |   vecror<int> sample(N);
      |   ^~~~~~
      |   perror
a.cc:18:10: error: expected primary-expression before 'int'
   18 |   vecror<int> sample(N);
      |          ^~~
a.cc:20:15: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |         sample[i] = i;
      |               ^
Language: C++

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

//これはもつさんの著作権あるので、決して私オリジナルのものではありません。メモ用に提出する。
int main(){
    int n;
    cin>>n;
    vector<int> p(n),q(n),r(n);
    for(auto&i:p) cin>>i,--i;
    for(auto&i:q) cin>>i,--i;
    for(int i=0;i<n;++i) r[i]=i;
    int a{},b{},c{};
    do{
        bool f=true,g=true;
        fr(i,n){
            if(p[i]!=r[i]) f=false;
            if(q[i]!=r[i]) g=false;
        }
        if(f) a=c;
        if(g) b=c;
        ++c;
    }while(next_permutation(r.begin(),r.end()));
    cout<<abs(a-b)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: 'i' was not declared in this scope
   15 |         fr(i,n){
      |            ^
a.cc:15:9: error: 'fr' was not declared in this scope; did you mean 'f'?
   15 |         fr(i,n){
      |         ^~
      |         f
Language: C++

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

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

//--------------------------------------------------------------------

int facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

int main() {
    int n;
    cin >> n;
    int P[n];
    for(int i=0; i<n; i++) cin >> P[i];    
    int Q[n];
    for(int i=0; i<n; i++) cin >> Q[i];
    int A[n]
    for(int i=0; i<n; i++) A[i] = P[i] - Q[i];
    long long double ans = 0
    for(int i=0; i<n; i++) {
        ans += facctorialMethod(n-i-1) * A[i]
    }
    ans = std::abs(ans);
    cout << ans << endl;




    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: expected initializer before 'for'
   26 |     for(int i=0; i<n; i++) A[i] = P[i] - Q[i];
      |     ^~~
a.cc:26:18: error: 'i' was not declared in this scope
   26 |     for(int i=0; i<n; i++) A[i] = P[i] - Q[i];
      |                  ^
a.cc:27:10: error: 'long long' specified with 'double'
   27 |     long long double ans = 0
      |          ^~~~
a.cc:28:5: error: expected ',' or ';' before 'for'
   28 |     for(int i=0; i<n; i++) {
      |     ^~~
Language: C

#include <stdio.h>
#include <vector>
#include <algorithm>

int main(void) {
    int N, B, a, b, X, i;
    scanf("%d", &N);
    std::vector<int> P(N);
    std::vector<int> Q(N);
    for (i=0; i<N; i++) scanf("%d", &P[i]);
    for (i=0; i<N; i++) scanf("%d", &Q[i]);
    a=0;
    while (1) {
        a++;
        B=1;
        for (i=0; i<N; i++) {
            if (P[i]!=i+1) {
                B=0;
                break;
            }
        }
        // for (i=0; i<N; i++) printf("%d ", P[i]);
        // printf("\n");
        if (B==1) break;
        prev_permutation(P.begin(), P.end());
    }
    b=0;
    while (1) {
        b++;
        B=1;
        for (i=0; i<N; i++) {
            if (Q[i]!=i+1) {
                B=0;
                break;
            }
        }
        if (B==1) break;
        prev_permutation(Q.begin(), Q.end());
    }
    X=a-b;
    if (X<0) X=-X;
    printf("%d", X);
    // next_permutation(s.begin(),s.end()));
}

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

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

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

//--------------------------------------------------------------------

int facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

int main() {
    int n;
    cin >> n;
    int P[n];
    for(int i=0; i<n; i++) cin >> P[i];    
    int Q[n];
    for(int i=0; i<n; i++) cin >> Q[i];
    int A[n]
    for(int i=0; i<n; i++) A[i] = P[i] - Q[i];
    long long double ans = 0
    for(int i=0; i<n; i++) {
        ans += facctorialMethod(n-i-1) * A[i]
    }
    ans = (ans**2)**0.5;
    cout << ans << endl;




    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: expected initializer before 'for'
   26 |     for(int i=0; i<n; i++) A[i] = P[i] - Q[i];
      |     ^~~
a.cc:26:18: error: 'i' was not declared in this scope
   26 |     for(int i=0; i<n; i++) A[i] = P[i] - Q[i];
      |                  ^
a.cc:27:10: error: 'long long' specified with 'double'
   27 |     long long double ans = 0
      |          ^~~~
a.cc:28:5: error: expected ',' or ';' before 'for'
   28 |     for(int i=0; i<n; i++) {
      |     ^~~
a.cc:31:16: error: invalid type argument of unary '*' (have 'int')
   31 |     ans = (ans**2)**0.5;
      |                ^~
a.cc:31:20: error: invalid type argument of unary '*' (have 'double')
   31 |     ans = (ans**2)**0.5;
      |                    ^~~~
Language: C++

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

#define FOR(n) for(int i=0;i<n;i++)
#define ll long long

ll mob=1000000007;

using namespace std;
int main()
{ int n;int o=0;int flag=0;
 cin>>n;
 int a[9];
 FOR(n) cin>>a[i];
int s[9];
 FOR(n) cin>>s[i];
 ll a[1000000000];
 int j[2];int y=0;
 while(y<3)
 { int g[9];
   FOR(n) cin>>g[i+1];
    o++;
    next_permutation(g,g+n);
    for(int k=0;k<n;k++)
    {if(g[k]==a[k])
       {if (k==n-1) flag=1;continue;
        else continue;
         }
    
    }
  if(flag=1) y++,flag=0,j[1]=o;
   for(int k=0;k<n;k++)
    {if(g[k]==a[k])
       {if (k==n-1) flag=1,y++;continue;
        else continue;
         }
    
    }
  f(flag=1) y++,flag=0,j[0];
    
 }
 

cout<<abs(j[1]-j[0]);å

return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: conflicting declaration 'long long int a [1000000000]'
   17 |  ll a[1000000000];
      |     ^
a.cc:13:6: note: previous declaration as 'int a [9]'
   13 |  int a[9];
      |      ^
a.cc:27:9: error: expected '}' before 'else'
   27 |         else continue;
      |         ^~~~
a.cc:26:8: note: to match this '{'
   26 |        {if (k==n-1) flag=1;continue;
      |        ^
a.cc:33:9: error: 'g' was not declared in this scope
   33 |     {if(g[k]==a[k])
      |         ^
a.cc:35:9: error: expected '}' before 'else'
   35 |         else continue;
      |         ^~~~
a.cc:34:8: note: to match this '{'
   34 |        {if (k==n-1) flag=1,y++;continue;
      |        ^
a.cc: At global scope:
a.cc:39:4: error: expected constructor, destructor, or type conversion before '(' token
   39 |   f(flag=1) y++,flag=0,j[0];
      |    ^
a.cc:41:2: error: expected declaration before '}' token
   41 |  }
      |  ^
a.cc:44:1: error: 'cout' does not name a type
   44 | cout<<abs(j[1]-j[0]);å
      | ^~~~
a.cc:44:22: error: '\U000000e5' does not name a type
   44 | cout<<abs(j[1]-j[0]);å
      |                      ^
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: Java

import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] p = new int[n];
		int[] q = new int[n];
		for(int i = 0; i < n; i++){
		    p[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
		    q[i] = sc.nextInt();
		}
		int P = 0;
		for(int i = 0; i < n; i++){
		    P += p[i]*(int)pow(10, (n-i-1));
		}
		int Q = 0;
		for(int i = 0; i < n; i++){
		    Q += q[i]*(int)pow(10, (n-i-1));
		}
		
		// 計算
		int result = Q;
		int[] usea = new int[n];
		int[] useb = new int[n];
		int a = func(n, P, usea, 0, 0);
		int b = func(n, Q, useb, 0, 0);
		
		// 出力
		System.out.println(abs(a-b));
	}
	
	static int func(int n, int p, int[] use, int num, int r){
	    int res = 0;
	    if(String.valueOf(num).length() == n){
	        r++;
	        if(p == num) return r;
	    }
	    for(int i = 1,; i <= n; i++){
	        if(use[i-1] == 1) continue;
	        use[i-1] = 1;
	        res = func(n, p, use, num*10+i, r);
	    }
	    return res;
	}
	
}




Compiler output:
Main.java:45: error: <identifier> expected
	    for(int i = 1,; i <= n; i++){
	                  ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

ll kaijyou(ll n){
                  n*kaijyou(n-1);
                  return; 
}


int main() {
     ll n,a,b;cin>>n;
     a=b=0;
     set <ll> st;
     vector<ll>v1(n);
     vector<ll>v2(n);
     rep(i,n){
              cin>>v1[i];
     }
     rep(i,n){
              cin>>v2[i];
     }
    rep(i,n){
        st.insert(i+1);
    }
    rep(x,n){
        int id = 0;
        for (auto itr = st.begin(); itr != st.end(); itr++)
        {
            if(*itr==v1[x]){
                break;
            }
            id++;
        
        }
        st.erase(v1[x]);
        a+=id*kaijyou(n-x-1);
    }
    rep(i,n){
        st.insert(i+1);
    }
    rep(x,n){
        int id = 0;
        for (auto itr = st.begin(); itr != st.end(); itr++)
        {
            if(*itr==v2[x]){
                break;
            }
            id++;
        
        }
        st.erase(v2[x]);
        b+=id*kaijyou(n-x-1);
    }
    cout<<abs(a-b)<<endl;
}



Compiler output:
a.cc: In function 'll kaijyou(ll)':
a.cc:19:19: error: return-statement with no value, in function returning 'll' {aka 'long long int'} [-fpermissive]
   19 |                   return;
      |                   ^~~~~~
Language: C++

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

int kaijyou(int n){
  if(n==1){
    return 1;
  }else{
    return kaijyou(n-1) + n;
  }
}  

int main() {
  int a;
  cin >> a;
  vector<int> p(a);
  vector<int> q(a);
  for(int i=0;i<a;i++){
    cin >> p.at(i);
  }
  for(int i=0;i<a;i++){
    cin >> q.at(i);
  }
  int pnumber=1;
  for(int i=0;i<a-1;i++){
    pnumber = pnumber + (p.at(i)-1)*kaijyou(a-i-1)
  }
  pnumber = pnumber + p.at(a-1) -1;
  int qnumber=1;
  for(int i=0;i<a-1;i++){
    qnumber = qnumber + (q.at(i)-1)*kaijyou(a-i-1)
  }
  qnumber = qnumber + q.at(a-1) -1;
  if(pnumber>qnumber){
    cout << pnumber - qnumber << endl;
  }else{
    cout << qnumber = pnumber << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:51: error: expected ';' before '}' token
   25 |     pnumber = pnumber + (p.at(i)-1)*kaijyou(a-i-1)
      |                                                   ^
      |                                                   ;
   26 |   }
      |   ~                                                
a.cc:30:51: error: expected ';' before '}' token
   30 |     qnumber = qnumber + (q.at(i)-1)*kaijyou(a-i-1)
      |                                                   ^
      |                                                   ;
   31 |   }
      |   ~                                                
a.cc:36:31: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   36 |     cout << qnumber = pnumber << endl;
      |                       ~~~~~~~~^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
  {
     int n,cnt=0;
     cin>>n;
     string s;
     for(int 1=0;1<n-2;i++)
     {
        if(s[i]=='A' and s[i+1]=='8' and s[i+2]=='c')
        {
          cnt++;
        }
     }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: expected unqualified-id before numeric constant
    8 |      for(int 1=0;1<n-2;i++)
      |              ^
a.cc:8:13: error: expected ';' before numeric constant
    8 |      for(int 1=0;1<n-2;i++)
      |             ^~
      |             ;
a.cc:8:14: error: lvalue required as left operand of assignment
    8 |      for(int 1=0;1<n-2;i++)
      |              ^
a.cc:8:23: error: expected ')' before ';' token
    8 |      for(int 1=0;1<n-2;i++)
      |         ~             ^
      |                       )
a.cc:8:24: error: 'i' was not declared in this scope
    8 |      for(int 1=0;1<n-2;i++)
      |                        ^
Language: C++

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


int main()
{
	unsigned long long N;
	std::cin >> N;

	std::vector<int> seqs;

	unsigned long long min = 0;
	unsigned long long max = 0;
	for (int j = 0; j < N; ++j) {
		min += (j + 1) * pow(10, N - j - 1);
		max += (N - j) * pow(10, N - j - 1);
	}

	for (unsigned long long i = min; i <= max; ++i) {

		std::set<int> digits;
		unsigned long long t = i;
		for (int j = 0; j < N; ++j) {
			const int digit = t % 10;

			if ((digit == 0) || (N < digit)) {
				break;
			}

			if (digits.find(digit) != digits.end()) {
				break;
			}

			digits.insert(digit);

			t /= 10;
		}

		if (digits.size() == N) {
			seqs.push_back(i);
		}
	}

	unsigned long long P = 0;
	for (int i = N; 0 < i; --i) {
		int p = 0;
		std::cin >> p;

		P += p * pow(10, i - 1);
	}

	unsigned long long Q = 0;
	for (int i = N; 0 < i; --i) {
		int q = 0;
		std::cin >> q;

		Q += q * pow(10, i - 1);
	}

	int p = 0;
	int q = 0;
	for (int i = 0; i < seqs.size(); ++i) {
		if (seqs[i] == P) {
			p = i + 1;
		}

		if (seqs[i] == Q) {
			q = i + 1;
		}
	}

	const int distance = p < q ? q - p : p - q;

	std::cout << distance << std::endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:34: error: 'pow' was not declared in this scope
   16 |                 min += (j + 1) * pow(10, N - j - 1);
      |                                  ^~~
a.cc:50:26: error: 'pow' was not declared in this scope
   50 |                 P += p * pow(10, i - 1);
      |                          ^~~
a.cc:58:26: error: 'pow' was not declared in this scope
   58 |                 Q += q * pow(10, i - 1);
      |                          ^~~
Language: C++

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

int bikkuri(int x) {
  if (x == 0) {
    return 0;
  }
  else {
    int bb = 1;
    for (int j = 1; j <= x; j++) {
      bb *= j;
    }
    return bb;
  }
}
  
int main() {
  int N;
  vector<int> P(N), Q(N), np(N), nq(N);
  for (int i = 0; i < N; i++) {
    cin >> P.at(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> Q.at(i);
  }
  for (int i = 0; i < N; i++) {
    np.at(P.at(i) - 1) = i + 1;
  }
  for (int i = 0; i < N; i++) {
    nq.at(Q.at(i) - 1) = i + 1;
  }
  int nop, noq;
  nop = 0;
  noq = 0;
  for (int i = 1; i <= N; i++) {
    nop += ((i - 1) * (bikkuri(N - np.at(i))));
  }
  for (int i = 1; i <= N; i++) {
    noq += ((i - 1) * (bikkuri(N - nq.at(i))));
  }
  int ans = abs(nop - noq);
  cout << ans << endl;
            
            
  
  
  
   


Compiler output:
a.cc: In function 'int main()':
a.cc:42:23: error: expected '}' at end of input
   42 |   cout << ans << endl;
      |                       ^
a.cc:17:12: note: to match this '{'
   17 | int main() {
      |            ^
Language: C++

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

// N!の順列を並べたい
void foreach_permutation(int n, std::function<void(int *)> f) {
  int indexes[n];
  for (int i = 1; i <= n; i++) indexes[i] = i;
  do {
    f(indexes);
  } while (std::next_permutation(indexes, indexes + n));
}


int main() {
  
  int N, n, a, b;
  cin >> N;
  n = 0;
  a = 0;
  b = 0;
  
  for(int i = 0; i < N - 1; i++){
    n += N * (N - 1);
  }
  //cout << n << endl;
    
  vector<vector<int>> data(n, vector<int>(N));
  foreach_permutation(N, [](int * indexes){
                    
  for(int i = 0; i < n; i++){
    for(int j = 0; j < N; j++){
      data.at(i).at(j) = indexes[j];
    }
  }
  
  }
                      
                      
  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);
  }
  
  for(int i = 0; i < n; i++){
    if(data.at(i) == P){
      a = i;
    }
    if(data.at(i) == Q){
      b = i;
    }
  } 
  
  if(a - b >= 0){
    cout << a - b << endl;
  }
  else{
    cout << b - a << endl;
  }
    
}



Compiler output:
a.cc: In lambda function:
a.cc:30:22: error: 'n' is not captured
   30 |   for(int i = 0; i < n; i++){
      |                      ^
a.cc:28:27: note: the lambda has no capture-default
   28 |   foreach_permutation(N, [](int * indexes){
      |                           ^
a.cc:16:10: note: 'int n' declared here
   16 |   int N, n, a, b;
      |          ^
a.cc:31:24: error: 'N' is not captured
   31 |     for(int j = 0; j < N; j++){
      |                        ^
a.cc:28:27: note: the lambda has no capture-default
   28 |   foreach_permutation(N, [](int * indexes){
      |                           ^
a.cc:16:7: note: 'int N' declared here
   16 |   int N, n, a, b;
      |       ^
a.cc:32:7: error: 'data' is not captured
   32 |       data.at(i).at(j) = indexes[j];
      |       ^~~~
a.cc:28:27: note: the lambda has no capture-default
   28 |   foreach_permutation(N, [](int * indexes){
      |                           ^
a.cc:27:23: note: 'std::vector<std::vector<int> > data' declared here
   27 |   vector<vector<int>> data(n, vector<int>(N));
      |                       ^~~~
a.cc: In function 'int main()':
a.cc:36:4: error: expected ')' before 'vector'
   36 |   }
      |    ^
      |    )
......
   39 |   vector<int> P(N);
      |   ~~~~~~
a.cc:28:22: note: to match this '('
   28 |   foreach_permutation(N, [](int * indexes){
      |                      ^
a.cc:43:12: error: 'P' was not declared in this scope
   43 |     cin >> P.at(i);
      |            ^
a.cc:50:22: error: 'P' was not declared in this scope
   50 |     if(data.at(i) == P){
      |                      ^
Language: C++


#include <bits/stdc++.h>
using namespace std;
int main()
  {
  int n;
  int x, y;
  cin >> n >> x >> y;
  bool ar[n+1];
  int r;
  int cnt =0;
  bool flag;
  for(int i=x+1; i<=y;i++)
    { 
    flag=true;
    memset(ar,0,sizeof(ar));
     r=i;
    while(r>0)
      {
      ar[r%10]=1;
      r=r/10;
      }
    for(int j=1;j<=n;j++){
      if(ar[j]==false)
        { flag= false;
          break;
         }
      }
    if(flag ==true)
      cnt++;
    }
  }
 cout << cnt << endl;
return 0;
}
         
    
    
     


Compiler output:
a.cc:33:2: error: 'cout' does not name a type
   33 |  cout << cnt << endl;
      |  ^~~~
a.cc:34:1: error: expected unqualified-id before 'return'
   34 | return 0;
      | ^~~~~~
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string x,p,s;
  int b[n],c[n];
  
  for(int i=0;i<n;i++){cin>>b[i];s+=b[i];}
  for(int i=0;i<n;i++)cin>>c[i];p+=c[i];;
  x=p;
  sort(x.begin(),x.end());
  int e=0,d=0;
  vector<string> v;
  while(next_permutation(x.begin(),x.end())){
    v.push_back(x);
  }
  sort(v.begin(),v.end());
  for(int i=0;i<v.size();i++){
    if(v[i]==s)e=i;
    if(v[i]==p)d=i;
  }
        cout<<abs(e-d)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:38: error: 'i' was not declared in this scope
   10 |   for(int i=0;i<n;i++)cin>>c[i];p+=c[i];;
      |                                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string x,p,s;
  int b[n],c[n];
  
  for(int i=0;i<n;i++){cin>>b[i];s+=b[i];}
  for(int i=0;i<n;i++)cin>>c[i];p+=c[i];;
  x=p;
  sort(x.begin(),x.end());
  int e=0,d=0;
  vector<string> v;
  while(next_permutation(x.begin(),x.end()){
    v.push_back(x);
  }
  sort(v.begin(),v.end());
  for(int i=0;i<v.size();i++){
    if(v[i]==s)e=i;
    if(v[i]==p)d=i;
  }
        cout<<abs(e-d)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:38: error: 'i' was not declared in this scope
   10 |   for(int i=0;i<n;i++)cin>>c[i];p+=c[i];;
      |                                      ^
a.cc:15:44: error: expected ')' before '{' token
   15 |   while(next_permutation(x.begin(),x.end()){
      |        ~                                   ^
      |                                            )
Language: C++

#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
    long long int n,e,i,a=0,b=0;
    vector <long long int> ara,ara1,ara2,ara3;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>e;
        ara.push_back(e);
        ara2.push_back(e);
    }
    for(i=0;i<n;i++)
    {
        cin>>e;
        ara1.push_back(e);
    }
    i=0;
    int c=0;
    sort(ara.begin(), ara.end());
    do {
        i++;
        if(ara==ara2)
        {
            a=i;
            c++;
        }
        if(ara==ara1)
        {
            b=i;
            c++;
        }
        if(c==2)
        {
            break;
        }
    } while (next_permutation(ara.begin(), ara.end()));
    int sum=abs(a-b);
    cout<<sum<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector <long long int> ara,ara1,ara2,ara3;
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <iostream>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:7:13: error: expected primary-expression before 'long'
    7 |     vector <long long int> ara,ara1,ara2,ara3;
      |             ^~~~
a.cc:12:9: error: 'ara' was not declared in this scope
   12 |         ara.push_back(e);
      |         ^~~
a.cc:13:9: error: 'ara2' was not declared in this scope
   13 |         ara2.push_back(e);
      |         ^~~~
a.cc:18:9: error: 'ara1' was not declared in this scope
   18 |         ara1.push_back(e);
      |         ^~~~
a.cc:22:10: error: 'ara' was not declared in this scope
   22 |     sort(ara.begin(), ara.end());
      |          ^~~
a.cc:25:17: error: 'ara2' was not declared in this scope
   25 |         if(ara==ara2)
      |                 ^~~~
a.cc:30:17: error: 'ara1' was not declared in this scope
   30 |         if(ara==ara1)
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
  {
  int n;
  int x, y;
  bool ar[n+1];
  int r;
  int cnt =0;
  bool flag;
  for(int i=x+1; i<=y;i++)
    { 
    flag=true;
    memset(ar,0,sizeof(ar));
     r=i;
    while(r>0)
      {
      ar[r%10]=1;
      r=r/10;
      }
    for(int j=1;j<=n;j++){
      if(ar[j]==false)
        { flag= false;
          break;
         }
      }
    if(flag ==true)
      cnt++;
    }
  }
 cout << cnt << endl;
return 0;
}
         
    
    
     

Compiler output:
a.cc:31:2: error: 'cout' does not name a type
   31 |  cout << cnt << endl;
      |  ^~~~
a.cc:32:1: error: expected unqualified-id before 'return'
   32 | return 0;
      | ^~~~~~
a.cc:33:1: error: expected declaration before '}' token
   33 | }
      | ^
Language: Java

public class Main {
    private static int n, cnt = 0, x = 0;
    private static int[][] targetSeq = new int[2][10];
    private static int[] vis = new int[10];
    private static int[] tempSeq = new int[10];
    private static int[] ans = new int[2];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        for(int i = 0;i < 2;i++) {
            for(int j = 0;j < n;j++) {
                targetSeq[i][j] = in.nextInt();
            }
        }
        dfs(0);
        System.out.println(Math.abs(ans[0] - ans[1]));
    }

    private static void dfs(int k) {
        if(x == 2) {
            return;
        }
        if(k == n) {
            cnt++;
            for(int i = 0;i < 2;i++) {
                boolean isOk = true;
                for(int j = 0;j < n;j++) {
                    if(tempSeq[j] != targetSeq[i][j]) {
                        isOk = false;
                        break;
                    }
                }
                if(isOk) {
                    ans[x++] = cnt;
                }
            }
            return;
        }
        for(int i = 1;i <= n;i++) {
            if(vis[i] == 0) {
                vis[i] = 1;
                tempSeq[k] = i;
                dfs(k + 1);
                vis[i] = 0;
            }
        }
    }
}

Compiler output:
Main.java:9: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:9: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define PUTS(x) cout << (x) << endl;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define PB push_back
#define perm(c)   \
    sort(ALL(c)); \
    for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))
int main() {
    int n;
    cin >> n;
    auto v = vector<int>();
    reps(i, n) {
        v.PB(i);
    }
    auto a = vector<int>();
    auto b = vector<int>();
    rep(i, n) {
        int x;
        cin >> x;
        a.PB(x);
    }
    rep(i, n) {
        int x;
        cin >> x;
        b.PB(x);
    }
    int x, y;
    int c = 0;
    perm(v) {
        if (v == a) x = c;
        if (v == b) y = c;
        c++;
    }
    PUTS(abs(x - y));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'ALL' was not declared in this scope
    8 |     sort(ALL(c)); \
      |          ^~~
a.cc:31:5: note: in expansion of macro 'perm'
   31 |     perm(v) {
      |     ^~~~
Language: C++

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


int main() {
	int n;
	cin >> n;
	vector<int>P(n), Q(n);
	rep(i, n) {
		cin >> P[i] >> Q[i];
	}
	int ans = 0;
	int repeat = 1;
	for (int i = 1;i <= n;++i) {
		repeat *= i;
	}
	rep(i, repeat) {
		if (P == Q) {
			cout << ans << endl;
			break;
		}
		auto P=next_permutation(P.begin(), P.end());
		ans += 1;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:41: error: use of 'P' before deduction of 'auto'
   26 |                 auto P=next_permutation(P.begin(), P.end());
      |                                         ^
a.cc:26:52: error: use of 'P' before deduction of 'auto'
   26 |                 auto P=next_permutation(P.begin(), P.end());
      |                                                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int p[n],q[n];
  int s,t=0,u=0;
  int d=1;
  for(int i=2;i<=n;i++){
    d=d*i;
  }
  int z=n;
  for(int i=0;i<n;i++){
    cin>>p[i];
    s=p[i];
    for(int j=0;j<i;j++){
      if(p[i]>p[j]){
        s--;
      }
    }
    t=t+s*(d/z);
    z=z*(n-i-1);
  }
  z=n;
  for(int i=0;i<n;i++){
    cin>>q[i];
    s=q[i];
    for(int j=0;j<i;j++){
      if(q[i]>q[j]){
        s--;
      }
    }
    u=u+s*(d/z);
    z=z*(n-i-1);
  }
  int aa;
  if(u-v<0){
    aa=u;
    u=v;
    v=aa;
  }
  cout << u-v;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:8: error: 'v' was not declared in this scope
   37 |   if(u-v<0){
      |        ^
a.cc:42:13: error: 'v' was not declared in this scope
   42 |   cout << u-v;
      |             ^
Language: Java

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
N = int(input())
^
1 error
Language: C++

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

int main()
{
  int N;
  int A[10]={0};
  int B[10]={0};
  int C[10]={0,1,2,3,4,5,6,7,8,9};
  int aa=0;
  int bb=0;
  for(int i=1;i<N;i++){
    cin>>A[i];
    aa+=(N-i)*C[i];
    for(int j=A[i];j<10;j++)C[i]--;
  }
  C[10]={0,1,2,3,4,5,6,7,8,9};
  for(int i=1;i<N;i++){
    cin>>B[i];
    bb+=(N-i)*C[i];
    for(int j=B[i];j<10;j++)C[i]--;
  }
  cout<<max(bb-aa,aa-bb)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: cannot convert '<brace-enclosed initializer list>' to 'int' in assignment
   17 |   C[10]={0,1,2,3,4,5,6,7,8,9};
      |                             ^
Language: C++

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


int main() {
	int n;
	cin >> n;
	vector<int>P(n), Q(n);
	rep(i, n) {
		cin >> P[i] >> Q[i];
	}
	int ans = 0;
	rep(i, n) {
		if (P == Q) {
			cout << ans << endl;
			break;
		}
		P = next_permutation(P.begin(), P.end());
		ans += 1;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:56: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'bool')
   22 |                 P = next_permutation(P.begin(), P.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)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

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


int main() {
	int n;
	cin >> n;
	vector<int>P(n), Q(n);
	rep(i, n) {
		cin >> P[i] >> Q[i];
	}
	int ans = 0;
	rep(i, n) {
		if (P(n) == Q(n)) {
			cout << ans << endl;
			break;
		}
		P(n) = next_permutation(P.begin(), P.end());
		ans += 1;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: no match for call to '(std::vector<int>) (int&)'
   18 |                 if (P(n) == Q(n)) {
      |                     ~^~~
a.cc:18:30: error: no match for call to '(std::vector<int>) (int&)'
   18 |                 if (P(n) == Q(n)) {
      |                             ~^~~
a.cc:22:18: error: no match for call to '(std::vector<int>) (int&)'
   22 |                 P(n) = next_permutation(P.begin(), P.end());
      |                 ~^~~
Language: C

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n, P[15], Q[15];
int a, b;
int input[15];
void next()
{
	int index1, index2;
	for(int i=n;i>=1;i--)      //第一步 
	{
		if(input[i-1]<input[i])
		{
			index1 = i-1;
			break;
		}
    } 
    for(int i=n;i>=index1;i--)   //第二步 
    {
    	if(input[i]>input[index1])
    	{
    		index2 = i;
    		break;
		}
	}
	int t = input[index1];        //第三步 
	input[index1] = input[index2];
	input[index2] = t;
	int i = index1+1, j = n;
	while(i<j)
	{
		int t = input[i];
		input[i] = input[j];
		input[j] = t;
		i++; j--;
	}
//	printf("index1=%d index2=%d\n", index1, index2);
}
int cmp(int a[])
{
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=input[i])
		    return 0;
	}
	return 1;
}
int main()
{
    scanf("%d", &n);
    for(int i=1;i<=n;i++)
    {
    	scanf("%d", &P[i]);
	}
	for(int i=1;i<=n;i++)
    {
    	scanf("%d", &Q[i]);
	}
	for(int i=1;i<=n;i++)
	{
		input[i] = i;
	}
	int i = 1;
	while(1)
	{
		if(a&&b) break;
		if(cmp(P))
		{
			a = i;
		}
		if(cmp(Q))
		{
			b = i;
		}
		i++;
		next();
	}
	if(a>b) printf("%d\n", a-b);
	else printf("%d\n", b-a);
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for (int i=(a); i<(b); i++)

int fac(int x){
	int ans=1;
	For(i,1,x+1){
		ans*=i;
	}
	return ans;
}

int rank(int n){
	int a[n];
	For(i,0,n)
		cin>>a[i];
	int ans=0;
	For(i,0,n){
		int cnt=0;
		For(j,0,i)
			if (a[j]<=a[i])
				cnt++;
		ans+=(a[i]-cnt)*fac(n-i-1);
	}
	return ans+1;
}

int main(){
	int n;
	cin>>n;
	int a=rank(n), b=rank(n);
	cout<<abs(a-b);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:15: error: reference to 'rank' is ambiguous
   31 |         int a=rank(n), b=rank(n);
      |               ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:13:5: note:                 'int rank(int)'
   13 | int rank(int n){
      |     ^~~~
a.cc:32:21: error: 'b' was not declared in this scope
   32 |         cout<<abs(a-b);
      |                     ^
Language: C++

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for(int& x: a)
    cin >> x;
  for(int& x: b)
    cin >> x;
  if(a > b)
    swap(a, b)
  int r = 0;
  for(; a < b; r++)
    next_permutation(begin(a), end(a));
  cout << r << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: expected ';' before 'int'
   18 |     swap(a, b)
      |               ^
      |               ;
   19 |   int r = 0;
      |   ~~~          
a.cc:20:16: error: 'r' was not declared in this scope
   20 |   for(; a < b; r++)
      |                ^
a.cc:22:11: error: 'r' was not declared in this scope
   22 |   cout << r << '\n';
      |           ^
Language: Java

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int p = 0;
        int q = 0;
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            p += x * Math.pow(10, n - i -1);
        }
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            q += x * Math.pow(10, n - i -1);
        }
        List<Integer> a = new ArrayList<>();
        dfs(a, n, 1, 0, 0);
        Collections.sort(a);
        int b = 0;
        int c = 0;
        for (int i = 0; i < a.size(); i++) {
            if(a.get(i) == p) b = i;
            if(a.get(i) == q) c = i;
        }
        System.out.println(Math.abs(b-c));
        sc.close();

    }

    private static void dfs(List<Integer> a, int n, int x, int sum, int bit) {
        for (int i = 0; i < n; i++) {
            if((bit >> i & 1) == 1)continue;
            int y = sum + x * (int)Math.pow(10, n - i -1);
            if(x == n) a.add(y);
            else {
                bit |= 1 << i;
                dfs(a, n, x+1, y, bit);
                bit ^= 1 << i;
            }
        }
    }

}


Compiler output:
Main.java:30: error: cannot find symbol
    private static void dfs(List<Integer> a, int n, int x, int sum, int bit) {
                            ^
  symbol:   class List
  location: class Main
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:16: error: cannot find symbol
        List<Integer> a = new ArrayList<>();
        ^
  symbol:   class List
  location: class Main
Main.java:16: error: cannot find symbol
        List<Integer> a = new ArrayList<>();
                              ^
  symbol:   class ArrayList
  location: class Main
Main.java:18: error: cannot find symbol
        Collections.sort(a);
        ^
  symbol:   variable Collections
  location: class Main
6 errors
Language: C++

#include <bits/stdc++.h>

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    vector<int> v;
    int N; cin >> N;
    vector<int> A;
    vector<int> B;
    int a = -1;
    int b = -1;
    int cnt = 0;
    REP(i,N) {
        int tmp; cin >> tmp;
        A.push_back(tmp);
        v.push_back(tmp);
    }
    REP(i,N) {
        int tmp; cin >> tmp;
        B.push_back(tmp);
    }
    sort(v.begin(),v.end());
    do {
        cnt++;
        if (v[0] == A[0] && v[1] == A[1] && v[2] == A[2]) a = cnt;
        if (v[0] == B[0] && v[1] == B[1] && v[2] == B[2]) b = cnt;
        cout <<         
    } while (std::next_permutation(v.begin(), v.end()));
    cout << abs(a-b) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:33:5: error: expected primary-expression before '}' token
   33 |     } while (std::next_permutation(v.begin(), v.end()));
      |     ^
Language: Java


import java.util.*;

public class ABC150C {
    static int[] arr;
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        arr = new int[n];
        for (int i = 1; i <= n; i++) {
            arr[i - 1] = i;
        }

        int[] a = new int[n];
        for (int i = 0; i < n; i++) {

            a[i] = in.nextInt();

        }

        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            b[i] = in.nextInt();
        }

        int first = -1;
        int second = -1;


        int times = 1;

        while (true) {


            if (eq(a, arr)) {
                first = times;
            } else if (eq(b, arr)) {
                second = times;
            }

            if (first != -1 && second != -1) {
                break;
            }

            if (!nextPermutation()) {
                break;
            }
            times++;



        }

        System.out.println((int) Math.abs(first - second));


    }
    static boolean nextPermutation() {
        int i = arr.length - 1;
        while (i > 0 && arr[i - 1] >= arr[i]) {
            i--;
        }
        if (i <= 0) {
            return false;
        }
        int j = arr.length - 1;
        while (arr[j] <= arr[i - 1]) {
            j--;
        }
        swap(i-1, j);
        j = arr.length - 1;
        while (i < j) {
            swap(i, j);
            i++;
            j--;
        }
        return true;
    }//NP

    static void swap(int i, int j) {

        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;

    }


    static boolean eq(int[] a, int[] b) {


        for (int i = 0; i < a.length; i++) {

            if (a[i] != b[i]) {
                return false;
            }

        }
        return true;


    }


}


Compiler output:
Main.java:4: error: class ABC150C is public, should be declared in a file named ABC150C.java
public class ABC150C {
       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


bool isEqual(vector<int>& v1,vector<int>&v2){
  for(int i=0;i<v1.size();i++){
    if(v1[i]!=v2[i]) return false;
  }
  return true;
}


int32_t main(){
    
  fast;
  int n; cin >> n;
  vector<int> v1;
  vector<int> v2;

  vector<int> A(n);
  vector<int> B(n);

  for(int i=0;i<n;i++){
    int x; cin >> x;
    v1.push_back(x);
    A[i] = B[i] = i+1;
  }

  for(int i=0;i<n;i++){
    int x; cin >> x;
    v2.push_back(x);
  }

  int cnt1 = 1;
 
  do{
    if(isEqual(A,v1)){
      break;
    }else{
      cnt1++;
    }
  }while(next_permutation(all(A)));

  int cnt2 = 1;

  do{
    if(isEqual(B,v2)){
      break;
    }else{
      cnt2++;
    }
  }while(next_permutation(all(B)));

  cout << abs(cnt1-cnt2);



  return 0;
}

Compiler output:
a.cc:9:10: fatal error: debug.cpp: No such file or directory
    9 | #include "debug.cpp"
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int P[8], Q[8], T[8];
string S[];

int main()
{
	int N, p = 0, q = 0, cnt = 0;

	cin >> N;
	rep(i, N) cin >> P[i];
	rep(i, N) cin >> Q[i];
	rep(i, N) T[i] = i + 1;

	do {
		cnt++;
		bool ok = true;
		rep(i, N) {
			if (T[i] != P[i]) ok = false;
		}
		if (ok) p = cnt;
		ok = true;
		rep(i, N) {
			if (T[i] != Q[i]) ok = false;
		}
		if (ok) q = cnt;
	} while (next_permutation(T, T + N));

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

	return 0;
}


Compiler output:
a.cc:24:8: error: array size missing in 'S'
   24 | string S[];
      |        ^
Language: C++

//
//  main.cpp
//  dp
//
//  Created by 贾皓翔 on 2019/11/26.
//  Copyright © 2019 贾皓翔. All rights reserved.
//
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

int buf[10];
int A[10];
int B[10];
int main(){
    int N;
    cin>>N;
    bool af=false;
    bool bf=false;
    int aval=1;
    int bval=1;
    for(int i=0;i<N;i++){
        buf[i]=i+1;
    }
    for (int i=0; i<N;i++) {
        cin>>A[i];
    }
    for (int i=0; i<N;i++) {
        cin>>B[i];
    }
    do{
        if (!af) {
            if (memcmp(A, buf, sizeof(int)*N)==0) {
                af=true;
            }else{
                aval++;
            };
        }
        if (!bf) {
            if (memcmp(B, buf, sizeof(int)*N)==0) {
                bf=true;
            }else{
                bval++;
            };
        }
        if (af&&bf) {
            break;
        }
    }while(next_permutation(buf, buf+N));
    cout<<abs(aval-bval)<<endl;
    

}




Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'memcmp' was not declared in this scope
   35 |             if (memcmp(A, buf, sizeof(int)*N)==0) {
      |                 ^~~~~~
a.cc:12:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <algorithm>
  +++ |+#include <cstring>
   12 | using namespace std;
a.cc:42:17: error: 'memcmp' was not declared in this scope
   42 |             if (memcmp(B, buf, sizeof(int)*N)==0) {
      |                 ^~~~~~
a.cc:42:17: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'