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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long m = in.nextLong();
        long n = in.nextLong();
        System.out.print(lcm(m, n));
    }

    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}

Compiler output:
Main.java:3: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: 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;
ll kiriage(ll a,ll b){return a%b==0?a/b:a/b+1;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
const int MAX=2e5;
const ll MOD=1e9+7;
const int INF=1<<30;

ll gcd(ll a,ll b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}

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

int main(){
  ll a,b;
  cin >> a >> b;
  cout << lcm(a,b) << endl;
  
}

Compiler output:
a.cc:3:1: error: 'll' does not name a type; did you mean 'all'?
    3 | ll kiriage(ll a,ll b){return a%b==0?a/b:a/b+1;}
      | ^~
      | all
Language: C++

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

int main(void)
{
 
  ll a, b, r, x, tmp;
 

  cin >> a >> b;
 
  x = a * b;
 

  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 

  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
　cout << x/b << endl;

 
  return 0;
}


Compiler output:
a.cc:32:1: error: extended character 　 is not valid in an identifier
   32 | 　cout << x/b << endl;
      | ^
a.cc: In function 'int main()':
a.cc:32:1: error: '\U00003000cout' was not declared in this scope
   32 | 　cout << x/b << endl;
      | ^~~~~~
Language: C++

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
  int A,B:
  cin>>A>>B:
  cout<<A*B/gcd(A,B)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:10: error: found ':' in nested-name-specifier, expected '::'
   64 |   int A,B:
      |          ^
      |          ::
a.cc:64:9: error: 'B' has not been declared
   64 |   int A,B:
      |         ^
a.cc:65:6: error: qualified-id in declaration before '>>' token
   65 |   cin>>A>>B:
      |      ^~
Language: C++

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

int main()
{
  int a,b;
  long long int ans=0;
  cin>>a>>b;
  if(b>a)
  swap(a,b);
  tem1=0;
  for(int t=1;t<b;t++)
  {
    if(a%t==0&&b%t==0)
    {
      tem1=t;  
    }
  }
  ans=a*b/t;
  cout<<ans;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'tem1' was not declared in this scope; did you mean 'tm'?
   11 |   tem1=0;
      |   ^~~~
      |   tm
a.cc:19:11: error: 't' was not declared in this scope
   19 |   ans=a*b/t;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int MAXN = 10000;
int n, m, a, b, c, ans, A[MAXN];
string str1, str2;
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> a >> b;
	cout << __lcm(a, b) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: '__lcm' was not declared in this scope
   12 |         cout << __lcm(a, b) << endl;
      |                 ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

using Graph=vector<vector<int>>;
Graph G;
ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;
  cin >> a>> b;
  cout<<lcm(a,b)<<endl;
}
    

Compiler output:
a.cc:22:4: error: redefinition of 'll gcd(ll, ll)'
   22 | ll gcd(ll a, ll b)
      |    ^~~
a.cc:11:4: note: 'll gcd(ll, ll)' previously defined here
   11 | ll gcd(ll x, ll y){
      |    ^~~
a.cc:34:4: error: redefinition of 'll lcm(ll, ll)'
   34 | ll lcm(ll a, ll b)
      |    ^~~
a.cc:15:4: note: 'll lcm(ll, ll)' previously defined here
   15 | ll lcm(ll x,ll y){
      |    ^~~
Language: C++

#include<bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <functional>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,j,n) for(int i=j;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    ll x,y;
	cin >> x>> y;
    ll t=0;
    ll a=x;
    ll b=y;
    while(y!=0){
      x%y=t;
      x=y;
      y=t;
    }
      cout << a*b/x << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:8: error: lvalue required as left operand of assignment
   22 |       x%y=t;
      |       ~^~
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ll a,b;
    cin>>a>>b;
    cout<<(a/gcd__(a,b))*b;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: 'gcd__' was not declared in this scope
    9 |     cout<<(a/gcd__(a,b))*b;
      |              ^~~~~
Language: C++

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

#define INF_LL (int64)1e18
#define INF (int64)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

template<typename T,T MOD,T B>
struct RollingHash{
  using ll = long long;
  vector<T> hash,po;
  RollingHash(){}
  RollingHash(vector<T> vs){init(vs);}
  RollingHash(string &s){
    vector<T> vs;
    for(char c:s) vs.emplace_back(c);
    init(vs);
  }
  void init(vector<T> vs){
    int n=vs.size();
    hash.assign(n+1,0);
    po.assign(n+1,1);
    for(int i=0;i<n;i++){
      hash[i+1]=((ll)hash[i]*B+vs[i])%MOD;
      po[i+1]=(ll)po[i]*B%MOD;
    }
  }
  //S[l, r)
  T find(int l,int r){
    T res=(ll)hash[r]+MOD-(ll)hash[l]*po[r-l]%MOD;
    return res>=MOD?res-MOD:res;
  }
};

int main(void) {
  int64 A, B;
  cin >> A >> B;
  cout << A/__gcd(A, B)*B << Endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:72:30: error: 'Endl' was not declared in this scope
   72 |   cout << A/__gcd(A, B)*B << Endl;
      |                              ^~~~
Language: C

#include<stdio.h>
int main(){
  int n,i,c=0,j;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  j=0;
  for(i=0;i<n;i++){
    if(a[i]==j){
      j++;
    }
  }
  if(j==0){
    printf("-1");
  }
  else{
    printf("%d,n-j);
  }
  return 0;
  
}

Compiler output:
main.c: In function 'main':
main.c:19:12: warning: missing terminating " character
   19 |     printf("%d,n-j);
      |            ^
main.c:19:12: error: missing terminating " character
   19 |     printf("%d,n-j);
      |            ^~~~~~~~~
main.c:20:3: error: expected expression before '}' token
   20 |   }
      |   ^
main.c:19:12: error: expected ';' before '}' token
   19 |     printf("%d,n-j);
      |            ^
      |            ;
   20 |   }
      |   ~
Language: Java

import java.util.*;
public class MyClass {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
         int n=sc.nextInt();
         int a[]=new int[n];
         for(int i=0;i<n;i++)
         {
             a[i]=sc.nextInt();
         }
         int count=1,x=-1;
         for(int i=0;i<n;i++)
         {
             if(count==a[i])
             {
             count++;
             }
         }
         count=count-1;
         if(count==0)
         {
              System.out.println("-1");
         }
         else

      System.out.println(n-count);
    }
}


Compiler output:
Main.java:2: error: class MyClass is public, should be declared in a file named MyClass.java
public class MyClass {
       ^
1 error
Language: Java

import java.util.*;
public class MyClass {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
         int n=sc.nextInt();
         int a[]=new int[n];
         for(int i=0;i<n;i++)
         {
             a[i]=sc.nextInt();
         }
         int count=1,x=-1;
         for(int i=0;i<n;i++)
         {
             if(count==a[i])
             {
             count++;
             }
         }
         count=count-1;
         if(count==0)
         {
              System.out.println("-1");
         }
         else

      System.out.println(n-count);
    }
}

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

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

#define vt          vector
#define sz(x)       int((x).size())
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

using ll = long long;
using pii = pair<int, int>;

void solve() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x == mex + 1) mex++;
    }

    cout << (mex ? n - mex : -1);
}

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

    int tcs = 1;
    for (int tc = 1; tc <= tcs; tc++) {
        // cout << "Case " << tc << ": ";
        solve();
    }
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:20:18: error: 'mex' was not declared in this scope
   20 |         if (x == mex + 1) mex++;
      |                  ^~~
a.cc:23:14: error: 'mex' was not declared in this scope; did you mean 'timex'?
   23 |     cout << (mex ? n - mex : -1);
      |              ^~~
      |              timex
Language: C++

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

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

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

    if(counter==1){
        cout << -1 << endl;
    }else{
        cout << n-counter+1 << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:34: error: invalid types 'int[int]' for array subscript
   23 |     for(int i=0;i<n;i++) cin >> a[i];
      |                                  ^
a.cc:27:22: error: invalid types 'int[int]' for array subscript
   27 |         if(counter==a[i]) counter++;
      |                      ^
Language: Java

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

public class Main {

	
	public static void main(String[] args) {
		FastScanner in=new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
	//	int t=in.nextInt();
	//	while(t-->0)
		solve(in,out);
		out.close();
	}
    static long gcd(long a,long b){
        if(b==0) return a;
        else return gcd(b,a%b);
    }
    static void solve(FastScanner in,PrintWriter out){
      int n=in.nextInt();
      int a[]=new int[n]; a=in.readArray(n);
      int point=n-1;
      for(int i=n-1;i>0;i--){
          if(a[i-1]=a[i]-1) point=i-1; else break;
      }
      if(a[point]==1) {
          out.println(point);
      }
      else out.println(-1);
    }    
	


	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
}


Compiler output:
Main.java:24: error: incompatible types: int cannot be converted to boolean
          if(a[i-1]=a[i]-1) point=i-1; else break;
                   ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef pair<int,int> P;
typedef long long ll;
const int INF = 1001001001;
const ll INFL = 1e17;
const int MOD = 1e9+7;


int main(){
    int n;
    cin >> n;
    int now = 1;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        if(a==now){
            ans++;
            now++;
        }
    }
    cout << n-ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |             ans++;
      |             ^~~
      |             abs
a.cc:23:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |     cout << n-ans << endl;
      |               ^~~
      |               abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N; ciN>>N;
 vector<int> S(N);
  int checker=0;
  for(int i=0; i<N;i++){
    cin>>S.at(i);
    if(S.at(i)==1)
      checker++;
  }
  if(checker==0)
    cout<<-1<<endl;
  else{
   int Ans=0;
    int L=1;
    for(int i=0; i<N; i++){
      if(S.at(i)!=L)
        Ans++;
      else {
        L++;
      }
    }
    cout<<Ans<<endl;
  }
      
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:10: error: 'ciN' was not declared in this scope
    4 |   int N; ciN>>N;
      |          ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N; ciN>>N;
 vector<int> S(N);
  int checker=0;
  for(int i=0; i<N;i++){
    cin>>S.at(i);
    if(S.at(i)==1)
      checker++;
  }
  if(checker==0)
    cout<<-1<<endl;
  else{
   int Ans=0;
    int L=1;
    for(int i=0; i<N; i++){
      if(S.at(i)!=L)
        Ans++;
      else {
        L++;
      }
    }
    cout<<Ans<<endl;
  }
      

Compiler output:
a.cc: In function 'int main()':
a.cc:4:10: error: 'ciN' was not declared in this scope
    4 |   int N; ciN>>N;
      |          ^~~
a.cc:25:4: error: expected '}' at end of input
   25 |   }
      |    ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

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

int main(){
  int n;
  vector<int>arr(n);
  for(int i=0; i<n; i++) cin>>arr[i];
  int curr = 0;
  for(int i=0; i<n; i++){
    if(arr[i]==curr+1) curr++;
  }
  cout<<n-counter;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'counter' was not declared in this scope
   12 |   cout<<n-counter;
      |           ^~~~~~~
Language: Java

import java.util.*;
import java.io.*;
public class test 
{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader (System.in));
		int n = Integer.parseInt(br.readLine());
		String[] arr = br.readLine().split(" ");
		int current_number = 1;
		for (int i = 0; i < n; i++) {
			int current_value = Integer.parseInt(arr[i]);
			if (current_number == current_value) {
				current_number++;
			}
		}
		if (current_number == 1) System.out.println(-1);
		else System.out.println(n - (current_number - 1));
	}
}


Compiler output:
Main.java:3: error: class test is public, should be declared in a file named test.java
public class test 
       ^
1 error
Language: Java

import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] a = new int[n];
		for(int i=0; i<a.length; ++i){
			a[i] = scn.nextInt();
		}
      	int count = 1;
      	for(int i=0; i<a.length; ++i){
			if(a[i]==count) count++;
		}
      	System.out.println(n+1-count)
	}
}

Compiler output:
Main.java:15: error: ';' expected
      	System.out.println(n+1-count)
      	                             ^
1 error
Language: C++




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

using namespace std;

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

#define access(i) a[i/3][i%3]
int gcd(int x, int y)
{
    if(y==0)
        return x;
    return gcd(y, x%y);
}

 long long numbers[500005];

//int a[100005];

 int main(){

 long long n; cin>>n;

 vector<long long>a(n+5);
 for(int i=0;i<n;i++)
    cin>>a[i];

  int searchs = 1,cnt=0;

  for(int i=0;i<n;i++){

    if(a[i] == searchs)
        searchs++;
    else
        cnt++;
  }

  if(search == 1 && cnt == 0)
    cout<<"-1"<<endl;
  else
    cout<<cnt<<endl;


return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:51:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator=='
   51 |   if(search == 1 && cnt == 0)
      |      ~~~~~~~^~~~
Language: C++

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

int main() {
  int N,A,X=1,Ans=0;
  cin>>N;
  rep(i,N){cin>>A;
          if(A==X){X++;}else{Ans++;}
          }
  if(Ans==N){cout<<-1<<endl;}else{cout<<Ans<<endl;}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: 'i' was not declared in this scope
    7 |   rep(i,N){cin>>A;
      |       ^
a.cc:7:3: error: 'rep' was not declared in this scope
    7 |   rep(i,N){cin>>A;
      |   ^~~
Language: C++

#include<algorithm>
#include<iostream>
#include<map>
#include <bits/stdc++.h>
#include<cmath>
#define mod 1000000007
#define ll long long 
using namespace std;

int main() {

  ll n;
  cin>>n;
  ll a[n];
  map<ll,ll> m;
  ll count=0;
  if(ll i=0;i<n;i++)
  {
  	cin>>a[i];
  	m[a[i]]++;
  	if(m[a[i]]>1)
  	{
  		count++;
  		m[a[i]]--;
	  }
  }
  if(count==0)
  {
  	cout<<0<<endl;
  }
  else
  {
  	if(abs(n-count)==0)
  	{
  		cout<<-1<<endl;
	  }
	  else
	  {
	  	cout<<n-count<<endl;
	  }
  }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: expected ')' before ';' token
   17 |   if(ll i=0;i<n;i++)
      |     ~          ^
      |                )
a.cc:17:17: error: 'i' was not declared in this scope
   17 |   if(ll i=0;i<n;i++)
      |                 ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  int index == 1;
  for (int i=0; i<n; i++) {
    int in;
    cin >> in;
    if(in == index){
      index++;
    }
  }
  int ans = n + 1 - index;
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: expected initializer before '==' token
    7 |   int index == 1;
      |             ^~
a.cc:11:11: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator=='
   11 |     if(in == index){
      |        ~~~^~~~~~~~
a.cc:12:12: error: no post-increment operator for type
   12 |       index++;
      |            ^~
a.cc:15:19: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator-'
   15 |   int ans = n + 1 - index;
      |             ~~~~~~^~~~~~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int b=1;
  for(int i=0;i<n,i++){
    cin >> a.at(n);
    if(a.at(i)==b){
      b++;
    }
  }
  if(b==1)
  cout << -1 << endl;
  else
  cout << n-b+1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: expected ';' before ')' token
   10 |   for(int i=0;i<n,i++){
      |                      ^
      |                      ;
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

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

int main() {
	string S;
	cin >> S;
	ll Q;
	cin >> Q;
	vector<int>q(Q);
	int f;
	char c;
	ll check = 1;
	ll check2 = 1;
	rep(i, Q) {
		cin >> q[i];
		if (q[i] == 1) {
			check2 *= -1;
		}
		else {
			cin>>f>>c;
			if (f == 2) {
				check = -1;
			}
			else {
				check = 1;
			}
			if (check*check2 == -1) {
				S = S + c;
			}
			else {
				S = c + S;
			}

		}

	}
	if (check2 == 1) {
		cout << S;
	}
	else {
	reverse(S.begin(), S.end());
		
			cout << S[i];
		
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:152:35: error: 'i' was not declared in this scope
  152 |                         cout << S[i];
      |                                   ^
Language: C++

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

int main() {
    int n;
    cin >> n;
    int a,st=0,ans=0,cnt=0;
    rep(i,n){
        cin >> a;
        if(st<1&&a==1){
            st = 1;
            cnt++;
        } if(i==st+1){
            cnt++;
            st++; 
        }
    }
    cout << (st==0?-1:n - k) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:27: error: 'k' was not declared in this scope
   23 |     cout << (st==0?-1:n - k) << endl;
      |                           ^
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> v(n);
	int ans = 0;
	int now = 0;
	rep(i, n)
	{
		cin >> v[i];
		if(v[i] == now+1){
			ans++;
			now++;
		}z
	}
	cout << (ans!=0 ? n - ans : -1) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: 'z' was not declared in this scope
   29 |                 }z
      |                  ^
Language: C++

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

int main(){ 
  int n;
  cin >> n;
  vector<int> A(n);
  
  rep(i,n) cin >> A[i];
  
  int ans, cnt = 1;
  
  rep(i,n) {
    if (A[i] == cnt) cnt++;
  }
  
  if (cnt == 1) ans = -1;
  else ans = N - (cnt - 1);
  
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: 'N' was not declared in this scope
   21 |   else ans = N - (cnt - 1);
      |              ^
Language: C++

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

int main(){ 
  int n;
  cin >> n;
  vector<int> A(n);
  
  rep(i,n) cin >> A[i];
  
  int ans, cnt = 1;
  
  rep(i,n) {
    if (A[i] == cnt) cnt++;
  }
  
  if (cnt == 1) ans = -1;
  else ans = N - (cnt - 1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: 'N' was not declared in this scope
   21 |   else ans = N - (cnt - 1);
      |              ^
Language: C++

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

int main(){
  int N;
  cin N;
  vector<int> A;
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  
  int s=1;
  int count=0;
  
  for(int i=0;i<N;i++){
    if(A[i]==s){
      count++;
      s=s+1;
    }
  }
  
  cout << N-s << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:6:6: error: expected ';' before 'N'
    6 |   cin N;
      |      ^~
      |      ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
int k=1;
int cnt=0;
for(int i=0;i<n;i++)
{
    cin>>a[i];
    if(a[i]==k)
    {
        k++;
        cnt++;
    }
}
if(cnt==0)cout<<-1;
else cout<<n-cnt;
 
 
 
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
int k=1;
int cnt=0;
for(int i=0;i<n;i++)
{
    cin>>a[i];
    if(a[i]==k)
    {
        k++;
        cnt++;
    }
}
if(cnt==0)cout<<-1;
else cout<<n-cnt;
 
 
 
}
Submission Info

Compiler output:
a.cc:27:5: error: redefinition of 'int main()'
   27 | int main()
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main()
      |     ^~~~
a.cc:49:1: error: 'Submission' does not name a type
   49 | Submission Info
      | ^~~~~~~~~~
Language: C

#include <stdio.h>

int main(void) {
	int n, a[200000], hakai = 0, num = 1;
	scanf_s("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf_s("%d", &a[i]);
		if (a[i] != num)
			hakai++;
		else
			num++;
	}

	if (num == 1)
		hakai = -1;

	printf("%d", hakai);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    5 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n);i++)
using ll = long long;
int main(){
    ll n,m,j=1;
    int f = 0;
    int k=0;
    vector<ll> a,b;
    cin >> n;

    rep(i,n){
        cin >> m;
        a.push_back(m);
        if(a.at(i)==j){
            j++;
            f++;
            k = i;
            b.push_back(k);
        }
    }
    


    if(f==0){
        cout << -1 << endl;
    }else{

        ll c = n - a.at(b.back);
        cout << c << endl;
        
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:24: error: no matching function for call to 'std::vector<long long int>::at(<unresolved overloaded function type>)'
   29 |         ll c = n - a.at(b.back);
      |                    ~~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 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/stl_vector.h:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&; size_type = long unsigned int]'
 1180 |       at(size_type __n)
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1180:20: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<long long int>::size_type' {aka 'long unsigned int'}
 1180 |       at(size_type __n)
      |          ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = long long int; _Alloc = std::allocator<long long int>; const_reference = const long long int&; size_type = long unsigned int]'
 1199 |       at(size_type __n) const
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1199:20: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<long long int>::size_type' {aka 'long unsigned int'}
 1199 |       at(size_type __n) const
      |          ~~~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n);i++)
using ll = long long;
ll main(){
    ll n,m,j=1;
    ll f = 0;
    ll k=0;
    vector<ll> a,b;
    cin >> n;

    rep(i,n){
        cin >> m;
        a.push_back(m);
        if(a.at(i)==j){
            j++;
            f++;
            k = i;
            b.push_back(k);
        }
    }
    


    if(f==0){
        cout << -1 << endl;
    }else{
        ll x=0;

        rep(i,b.size()){
            if(i==0){
                x = b[i];
            }
            x += b[i] - b[i - 1];
        }

        ll c = b.back() + 1 - a.at(b.back());
        cout << c << endl;
        
    }

}

Compiler output:
a.cc:5:1: error: '::main' must return 'int'
    5 | ll main(){
      | ^~
Language: C++

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

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

int main() {
  int N;
  cin >> N;
  int a[N];
  vector<int> dp(N+1);
  rep(i,N) {
    cin >> a[i];
    int j=0;
    if(a[i]==dp(i)+1) j++;
    dp(i+1)=dp(i)+j;
  }
  if(dp[N]) cout << N-dp[N] << endl;
  else cout << -1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: no match for call to '(std::vector<int>) (int&)'
   15 |     if(a[i]==dp(i)+1) j++;
      |              ~~^~~
a.cc:16:7: error: no match for call to '(std::vector<int>) (int)'
   16 |     dp(i+1)=dp(i)+j;
      |     ~~^~~~~
a.cc:16:15: error: no match for call to '(std::vector<int>) (int&)'
   16 |     dp(i+1)=dp(i)+j;
      |             ~~^~~
Language: C++

int main() {
int N;
cin >> N;
int vec[2000010];
for(int i = 0; i < N; i++){
cin >> vec[i];
}
int num = 1;
int bre = 0;
for(int i = 0; i < N; i++){
if(vec[i] != num) bre++;
else if(i == N-1 && num == 1 ) bre = -1;
else num++;
}
cout << bre << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:1: error: 'cin' was not declared in this scope
    3 | cin >> N;
      | ^~~
a.cc:15:1: error: 'cout' was not declared in this scope
   15 | cout << bre << endl;
      | ^~~~
a.cc:15:16: error: 'endl' was not declared in this scope
   15 | cout << bre << endl;
      |                ^~~~
Language: C++

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


int main() {
int N;
cin >> N;
int vec[2000010];
for(int i = 0; i < N; i++){
cin >> vec[i];
}
int num = 1;
int bre = 0;
for(int i = 0; i < N; i++){
if(vec[i] != num) bre++;
else if(i == N && num == 1 ) bre = -1
else num++;
}
cout << bre << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:38: error: expected ';' before 'else'
   17 | else if(i == N && num == 1 ) bre = -1
      |                                      ^
      |                                      ;
   18 | else num++;
      | ~~~~
Language: C

#include <cstdio>

int main(int argc, const char *argv[]) {
  int n;
  scanf("%d", &n);

  int a[20000];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }

  int ans = 0, cur = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] != cur) {
      ans++;
    } else {
      cur++;
    }
  }

  printf("%d\n", ans == n ? -1 : ans);
}

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;

int main(){
  int n;
  cin >> n;
  int cnt=1;
  int ans=0;
  int a[n]
  for(int i=0; i<n; i++){
    int x;
    cin >> x;
    a[i]=x;
  }
  for(int i=0; i<n; i++){
    if(a[i]!=cnt) ans++;
    else cnt++;
  }
  if(ans==0) ans--;
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected initializer before 'for'
   10 |   for(int i=0; i<n; i++){
      |   ^~~
a.cc:10:16: error: 'i' was not declared in this scope
   10 |   for(int i=0; i<n; i++){
      |                ^
a.cc:16:8: error: 'a' was not declared in this scope
   16 |     if(a[i]!=cnt) ans++;
      |        ^
Language: C++

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


int main() {
   int N;
   cin >> N;
   vector<int> a(N);
    int ans = 0;
   for(int i = 0; i < N; i++) cin >> a[i];
    int t = 1;
    int i = 0;
   while() {
       if(t == a[i]) t++;
       else ans++;

       if(i < N - 1) { i++; }
       else if(i == N - 1) { break; }
   }
    if(ans == N) { ans = 0; }
   cout << ans << endl;
    return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: expected primary-expression before ')' token
   14 |    while() {
      |          ^
Language: Java

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = sc.nextLong();
        }
        ans = 0;
        now = 1;
        for(int i = 0; i < n; i++){
            if(a[i] == now){
                now++;
            }else{
                ans++;
            }
        }
        if(ans == n){
            System.out.println(-1);
        }else{
            System.out.println(ans);
        }
    }
}



Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
            a[i] = sc.nextLong();
                              ^
Main.java:13: error: cannot find symbol
        ans = 0;
        ^
  symbol:   variable ans
  location: class Main
Main.java:14: error: cannot find symbol
        now = 1;
        ^
  symbol:   variable now
  location: class Main
Main.java:16: error: cannot find symbol
            if(a[i] == now){
                       ^
  symbol:   variable now
  location: class Main
Main.java:17: error: cannot find symbol
                now++;
                ^
  symbol:   variable now
  location: class Main
Main.java:19: error: cannot find symbol
                ans++;
                ^
  symbol:   variable ans
  location: class Main
Main.java:22: error: cannot find symbol
        if(ans == n){
           ^
  symbol:   variable ans
  location: class Main
Main.java:25: error: cannot find symbol
            System.out.println(ans);
                               ^
  symbol:   variable ans
  location: class Main
8 errors
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++){
    cin >> arr.at(i);
  }
  int count = 0; tmp = 0;
  for (int x: arr){
    if ((tmp + 1) == x){
      tmp = 1;
      count += 1;
    }
  }
  if (tmp == 0)
    cout << -1 << endl;
  else
    cout << count << endl;
  
    
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   11 |   int count = 0; tmp = 0;
      |                  ^~~
      |                  tm
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++){
    cin >> arr.at(i);
  }
  int count = 0, tmp = 0;
  for (int x: arr){
    if ((tmp + 1) == x){
      tmp = 1;
      count += 1;
    }
  }
  if (tmp == 0)
    cout << -1 << endl;
  else
    cout << count << endl;
  
    
  }
}


Compiler output:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++){
    cin >> arr.at(i);
  }
  int count = 0; tmp = 0;
  for (int x: arr){
    if ((tmp + 1) == x){
      tmp = 1;
      count += 1;
    }
  }
  if (tmp == 0)
    cout << -1 << endl;
  else
    cout << count << endl;
  
    
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   11 |   int count = 0; tmp = 0;
      |                  ^~~
      |                  tm
a.cc: At global scope:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

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

int main( void )
{
    ll n;
    cin >> n;
    
    ll a[n];
    for ( ll i = 0; i < n; i++ )
        cin >> a[i];
    
    ll ans = 0,crush = 1;
    
    for ( ll i = 0; i < n; i++ )
    {
        if ( a[i] == count)
            crush++;
        else
            ans++;
    }
    
    if ( ans == n )
        ans = -1;
        
        cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator=='
   18 |         if ( a[i] == count)
      |              ~~~~~^~~~~~~~
Language: C++

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

int main( void )
{
    ll n;
    cin >> n;
    ll a[n];
    rep(i,n)
        cin >> a[i];
    
    ll x = 1,ans = 0;
    rep(i,n)
    {
        if ( a[i] == x )
        {
            x++;
        }
        else
            ans++;
    }
    
    if ( x < 1 )
        cout << -1 << endl;
    else
        cout << ans << endl;
}

Compiler output:
a.cc:3:9: error: 'Long' does not name a type; did you mean 'long'?
    3 | typedef Long Long ll;
      |         ^~~~
      |         long
a.cc: In function 'int main()':
a.cc:8:5: error: 'll' was not declared in this scope
    8 |     ll n;
      |     ^~
a.cc:9:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    9 |     cin >> n;
      |            ^
      |            yn
a.cc:10:7: error: expected ';' before 'a'
   10 |     ll a[n];
      |       ^~
      |       ;
a.cc:12:16: error: 'a' was not declared in this scope
   12 |         cin >> a[i];
      |                ^
a.cc:14:7: error: expected ';' before 'x'
   14 |     ll x = 1,ans = 0;
      |       ^~
      |       ;
a.cc:17:14: error: 'a' was not declared in this scope
   17 |         if ( a[i] == x )
      |              ^
a.cc:17:22: error: 'x' was not declared in this scope
   17 |         if ( a[i] == x )
      |                      ^
a.cc:22:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |             ans++;
      |             ^~~
      |             abs
a.cc:25:10: error: 'x' was not declared in this scope
   25 |     if ( x < 1 )
      |          ^
a.cc:28:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);

    for(int i=0;i<n;i++){
        cin >> a.at(i);
    }
    int nxt=1, ans=0;
    for(int i=0;i<n;i++){
        if(a.at(i)==nxt){
            nxt++
        }else{
            ans++;
        }
    }
    if(ans==n){
        cout << "-1" << endl;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:18: error: expected ';' before '}' token
   15 |             nxt++
      |                  ^
      |                  ;
   16 |         }else{
      |         ~
Language: C++

#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int n;
  cin>>n;
  vector<int>a(n);
    int x=0;
    rep(i,n){
      rep(j,n){
      if (a[j]=i+1) x++
      }
    }
int ans=n-x;
  if(x==0)  ans=-1;
  cout<<ans<<endl;
        }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: expected ';' before '}' token
   13 |       if (a[j]=i+1) x++
      |                        ^
      |                        ;
   14 |       }
      |       ~                 
a.cc: At global scope:
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int n;
  cin>>n;
  vector<int>a(n);
    int x=0;
    rep(i,n){
      rep(j,n){
      if (a[j]=i+1) x++
      }
    }
int ans=n-x;
  if(x==0) ans=-1;
  cout<<ans<<endl;
        }


Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: expected ';' before '}' token
   13 |       if (a[j]=i+1) x++
      |                        ^
      |                        ;
   14 |       }
      |       ~
Language: C++

#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int n;
  cin>>n;
  vector<int>a(n)
    int x=0;
    rep(i,n){
      rep(j,n){
      if (a[j]=i+1) x++
      }
    }
int ans=n-x;
  if(x==0) ans=-1;
  cout<<ans<<endl;
        }


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: expected ',' or ';' before 'int'
   10 |     int x=0;
      |     ^~~
a.cc:13:21: error: 'x' was not declared in this scope
   13 |       if (a[j]=i+1) x++
      |                     ^
a.cc:16:11: error: 'x' was not declared in this scope
   16 | int ans=n-x;
      |           ^
Language: Java

import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int c = 0;
		
		for (int i=0; i<N; i++) {
			if (sc.nextInt() == c+1) {
				c++;
			}
		}
		System.out.println(c==0 ? -1 : n-c);
	}
}


Compiler output:
Main.java:14: error: cannot find symbol
		System.out.println(c==0 ? -1 : n-c);
		                               ^
  symbol:   variable n
  location: class Main
1 error
Language: Java

import java.util.*;

class Main {
	public static void main(string[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int c = 0;
		
		for (int i=0; i<N; i++) {
			if (sc.nextInt() == c+1) {
				c++;
			}
		}
		System.out.println(c==0 ? -1 : n-c);
	}
}


Compiler output:
Main.java:4: error: cannot find symbol
	public static void main(string[] args) {
	                        ^
  symbol:   class string
  location: class Main
Main.java:14: error: cannot find symbol
		System.out.println(c==0 ? -1 : n-c);
		                               ^
  symbol:   variable n
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i=0; i<N; i++){
      cin >> vec[i];
    }
    int k = 0;
    for(int i=0; i<N; i++){
        if(vec[i] == 1){
            k++;
        }
    }
    if(k == 0){
        cout << -1;
    }
    else{
        int p = 1;
        int count = 0;
        for(int i=0; i<N; i++){
            if(vec[i] != p){
                count++;
            }
            else{
                p++
            }
        }
        cout << count;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:20: error: expected ';' before '}' token
   27 |                 p++
      |                    ^
      |                    ;
   28 |             }
      |             ~
Language: C++

#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<n; ++i)
#define all(x) begin(perm),end(perm)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n; cin>>n;
    vint array(n); rep(i,n)cin>>array[i];
    int need = 1; int ans = 0;
    rep(i,n){
        if(array[i] == need)need++;
        else ++ans;
    }
    cout<<((ans == n)?-1,ans) <<endl; return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:29: error: expected ':' before ')' token
   34 |     cout<<((ans == n)?-1,ans) <<endl; return 0;
      |                             ^
      |                             :
a.cc:34:29: error: expected primary-expression before ')' token