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

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

int f(int x, int a);

int main()
{
    int N, M;
    bool f = false;
    cin >> N >> M;
    int ans = f(10, N) - 1;
    int count = ans;
    vector<int> s(M), c(M);
    for (int i = count; i >= f(10, N - 1); i--)
    {
        for (int j = 0; j < M; j++)
        {
            if (count / f(10, s.at(j) - 1) != c.at(j))
            {
                break;
            }
            if (j == M - 1 && ans >= i)
            {
                f = true;
                ans = i;
            }
        }
    }
    if (f)
    {
        cout << ans << endl;
    }
    else
    {
        cout << "-1" << endl;
    }
}

int f(int x, int a)
{
    if (a == 0)
    {
        return 1;
    }
    return x * f(x, a - 1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: 'f' cannot be used as a function
   14 |     int ans = f(10, N) - 1;
      |               ~^~~~~~~
a.cc:17:31: error: 'f' cannot be used as a function
   17 |     for (int i = count; i >= f(10, N - 1); i--)
      |                              ~^~~~~~~~~~~
a.cc:21:26: error: 'f' cannot be used as a function
   21 |             if (count / f(10, s.at(j) - 1) != c.at(j))
      |                         ~^~~~~~~~~~~~~~~~~
Language: C++


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

int main()
{
  int N, M;
  cin >> N >> M;
  int ans = -1;

  if (M == 0) {
    if (N == 1) {
      cout << 0;
    }
    else {
      cout << pow(10 ,N);
    }
    return 0;
  }

  int s, c;
  int d[N];
  for (int i = 0; i < N; i++) {
    d[i] = -1; //cがとりえない値を入れる
  }
  for (int i = 0; i < M; i++) {
    cin >> s >> c;
    if (s > N) { // 桁数オーバーをチェック
      cout << ans;
      return 0;
    }

    if (d[s - 1] != -1 && d[s - 1] != c) { //既に入っている情報をチェック
      cout << ans;
      return 0;
    }

    if (N != 1 && s == 1 && c == 0) { //先頭ゼロをチェック
      cout << ans;
      return 0;
    }

    d[s - 1] = c;
  }

  for (int i = 0; i < N; i++) {
    if (d[i] == -1) {
      d[i] = 0;
    }
  }
 
  if (N == 3 && d[0] == 0) {
    d[0] = 1;
  }
  if (N == 2 && d[0] == 0 && d[1] == 0) {
    d[1] = 1;
    return 0;
  }
  
  ans = d[0] * 100 + d[1] * 10 + d[2];



  cout << ans;
  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:15: error: 'pow' was not declared in this scope
   17 |       cout << pow(10 ,N);
      |               ^~~
Language: Java

import java.util.Scanner;

public class C_GuessTheNumber {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int m = scanner.nextInt();

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

        for (int i = 0; i < m; i++) {
            int s = scanner.nextInt();
            int c = scanner.nextInt();

            if (result[s - 1] == -1) {
                result[s - 1] = c;
            } else if (result[s - 1] != c) {
                System.out.println(-1);
                return;
            }
        }

        if (n > 1 && result[0] == 0) {
            System.out.println(-1);
            return;
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.append(result[i] == -1 ? 0 : result[i]);
        }
        System.out.println(Integer.parseInt(sb.toString()));
    }
}


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

#include <math.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define ld long double
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL); clock_t beg = clock()
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int N = 3e5+7 ;
const int INF = 1e18 ;
const int MOD = 1e9 + 7 ;
string s ;

void solve(){
	int n , k ;
	cin >> n >> k ;
	vi ans(n,-1) ;
	for(int i = 0 ; i < k ; i++){
		int x,y ;
		cin >> x >> y ;
		--x ;
		if(ans[x] == -1){
			ans[x] = y ;
		}
		else if(ans[x] != -1){
			if(ans[x] == y){

			}
			else{
				cout << -1 << endl ;
				return ;
			}
		}
	}	
	if(ans.size() > 1 && ans[0] == 0){
		cout << -1 << endl ;
		return ;
	}
	for(int i = 0 ; i < n ; i++){
		if(ans[i] == -1) ans[i]++ ;
	}
	bool all = 0 ;
	for(int i = 0 ; i < n ; i++){
		if(ans[i] > 0){
			all =  1 ;
			break ;
		}
	}
	if(all == 0){
		a[0]++ ;
	}
	for(auto x : ans) cout << x ;
	cout << endl ;
	
}


int32_t main(){
	FAST_IO ;
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:73:17: error: 'a' was not declared in this scope
   73 |                 a[0]++ ;
      |                 ^
Language: C++

#include <iostream>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int s[m], c[m], a[n];
  for(int i = 0; i < m; i++) {
    cin >> s[i] >> c[i];
  }
  for(int i = 0; i < n; i++) {
    a[i] = 10;
  }
  for(int i = 0; i < m; i++) {
    if(a[s[i] - 1 != 10) {
      cout << -1;
      return 0;
    }
    a[s[i] - 1] = c[i];
  }
  
  for(int i = 0; i < n; i++) {
    if(a[i] == 10) {
      a[i] = 0;
      if(i == 0) {
        a[i] = 1;
      }
    }
  }
  if(a[0] == 0 || n != 1) {
    cout << -1;
  } else {
    for(int i = 0; i < n; i++) {
      cout << a[i];
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: expected ']' before ')' token
   14 |     if(a[s[i] - 1 != 10) {
      |                        ^
      |                        ]
Language: C

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


int main(void){
    int n, m;
    scanf("%d %d", &n, &m);
    int i, x[n];
    for(i = 0 ; i < n ; i++){
        x[i] = 10;
    }
    int xxx, s, c;
    xxx = 1;
    for(i = 0 ; i < m ; i++){
        scanf("%d %d", &s, &c);
        if(x[s-1] != 10){
            xxx = 0;
        }
        else{
            x[s-1] = c;
        }
    }
    if(n != 1 && x[0] == 0){
        xxx = 0;
    }
    if(xxx == 1){
        if(x[0] == 10){
            x[0] = 1;
        }
        for(i = 1 ; i < n ; i++){
            if(x[i] == 10){
                x[i] = 0;
            }
        }
        double x = 0.0;
        for(i = 0 ; i < n ; i++){
            x += (double)x[i] * pow(10, n - i - 1);
        }
        int xx = (int)x;
        printf("%d\n", xx);
    }
    else{
        printf("-1\n");
    }

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:37:27: error: subscripted value is neither array nor pointer nor vector
   37 |             x += (double)x[i] * pow(10, n - i - 1);
      |                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
int main(){
    int a, b;
    cin>>a>>b;
    int tar[3]={-1, -1, -1};
    int x, y;
    if (b==0){
        int hi=0;
        if (a==2) hi=10;
        if (a==3) hi=100;
        cout<<hi<<endl;
        return 0;
    }
    for (int i=0; i<b; i++){
        cin>>x>>y;
        if (tar[x-1+(3-a)]==-1 || tar[x-1+(3-a)]==y) tar[x-1+(3-a)]=y;
        else {
            cout<<-1<<endl;
            return 0;
        }
    }
    for (int i=0; i<a; i++){
        if (tar[i]!=-1){
            if (3-i>a){
                cout<<-1<<endl;
                return 0;
            }
            int diff=-1;
            if (3-i<a){
                diff=a-(3-i);
                cout<<1, diff--;
                while (diff!=0){
                    cout<<0, diff--;
                }
            }
            if (diff==-1 && tar[i]==0) tar[i]=1; 
            for (int j=i; j<3; j++){
                if (tar[j]==-1) cout<<0;
                else cout<<tar[j];
            }
            cout<<endl;
            return 0;
        }
    }
    else cout<<-1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:5: error: 'else' without a previous 'if'
   49 |     else cout<<-1<<endl;
      |     ^~~~
Language: C++

v// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}

#define trace(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma=strchr(names+1,',');
    cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1,args...);
}

int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

int n,m;
int x[4];
map<int,int> mp;

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    rep(i,1,m+1){
        int a,b;
        cin >> a >> b;
        if(mp[a] && x[a]!=b){
            cout << -1;
            return 0;
        }
        else{
            x[a]=b;
            mp[a]++;
        }
    }
    if(x[1]==0 && n!=1 && mp[1]){
        cout << -1;
        return 0;
    }
    if(x[1]==0) x[1]=1;
    for(int i=1; i<=n; i++) cout << x[i];
    return 0;
}

Compiler output:
a.cc:1:1: error: 'v' does not name a type
    1 | v// --------------------<optimizations>--------------------
      | ^
Language: Java

import java.util.*;

public class Main2 {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		int s[] = new int[m], c[] = new int[m];
		Map<Integer, Integer> map = new TreeMap<Integer, Integer>();
		int ans = -1;
		boolean isexist = true;
		for (int i = 0; i < m; ++i) {
			s[i] = sc.nextInt();
			c[i] = sc.nextInt();
			if (map.containsKey(s[i])) {
				if (map.get(s[i]) != c[i])
					isexist = false;
			}
			if (n > 1) {
				if (s[i] == 1 && c[i] == 0)
					isexist = false;
			}
			map.put(s[i], c[i]);
		}
		sc.close();
		if (isexist) {
			StringBuffer tmp = new StringBuffer();
			if (n > 1)
				tmp.append("1");
			else
				tmp.append("0");
			for (int i = 1; i < n; ++i) {
				tmp.append("0");
			}
			for (int key : map.keySet()) {
				int value = map.get(key);
				tmp.replace(key - 1, key, String.valueOf(value));
			}
			ans = Integer.parseInt(tmp.toString());
		}
		System.out.println(ans);
	}
}


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

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] s = new int[M];
    int[] c = new int[M];
    for(int i=0; i<M; i++){
      s[i] = sc.nextInt();
      c[i] = sc.nextInt();
    }
    int[] num = new int[N];
    for(int i=0; i<N; i++){
    	num[i] = 0;
    }
    int ans = 0;
    int numInt = 0;
    boolean isTrue = true;
    for(int i=0; i<M; i++){
      int keta = s[i] - 1; //いじる桁 0-2 配列走査するので-1
      if(num[keta] != 0 && num[keta] != c[i]){
          isTrue = false;
          break;
      } else{
        num[keta] = c[i];
      }
    }
     if(num[0] == 0) isTrue = false;
     
     if(isTrue == false) {ans = -1;}
     else{
       for(int i=0; i<N; i++){
         for(int i=N-1; i>=0; i--){
         num[i] = num[i] *10; 
         numInt += num[i]; 
      	 }
       } 
    	ans = numInt;
     }
 
    System.out.println(ans); 
  }
}


Compiler output:
Main.java:34: error: variable i is already defined in method main(String[])
         for(int i=N-1; i>=0; i--){
                 ^
1 error
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] s = new int[M];
    int[] c = new int[M];
    for(int i=0; i<M; i++){
      s[i] = sc.nextInt();
      c[i] = sc.nextint();
    }
    int[] num = new int[N];
    for(int i=0; i<N; i++){
    	num[i] = 0;
    }
    int ans = 0;
    int numInt = 0;
    boolean isTrue = true;
    for(int i=0; i<M; i++){
      int keta = s[i] - 1; //いじる桁 0-2 配列走査するので-1
      if(num[keta] != 0 && num[keta] != c[i]){
          isTrue = false;
          break;
      } else{
        num[keta] = c[i];
      }
    }
     if(num[0] == 0) isTrue = false;
     
     if(isTrue == false) {ans = -1;}
     else{
       for(int i=0; i<N; i++){
         for(int i=N-1; i>=0; i--){
         num[i] = num[i] *10; 
         numInt += num[i]; 
      	 }
       } 
    	ans = numInt;
     }
 
    System.out.println(ans); 
  }
}


Compiler output:
Main.java:11: error: cannot find symbol
      c[i] = sc.nextint();
               ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:34: error: variable i is already defined in method main(String[])
         for(int i=N-1; i>=0; i--){
                 ^
2 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] s = new int[M];
    int[] c = new int[M];
    for(int i=0; i<M; i++){
      s[i] = sc.nextInt();
      c[i] = sc.nextint();
    }
    int[] num = new int[N];
    for(int i=0; i<N; i++){
    	num[i] = 0;
    }
    int ans = 0;
    int numInt = 0;
    boolean isTrue = true;
    for(int i=0; i<M; i++){
      int keta = s[i] - 1; //いじる桁 0-2 配列走査するので-1
      if(num[keta] != 0 && num[keta] != c[i]){
          isTrue = false;
          break;
      } else{
        num[keta] = c[i];
      }
    }
     if(num[0] == 0) isTrue = false;
     
     if(isTrue == false) {ans == -1;}
     else{
       for(int i=0; i<N; i++){
         for(int i=N-1; i>=0; i--){
         num[i] = num[i] *10; 
         numInt += num[i]; 
      	 }
       } 
    	ans = numInt;
     }
 
    System.out.println(ans); 
  }
}


Compiler output:
Main.java:31: error: not a statement
     if(isTrue == false) {ans == -1;}
                              ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int n,m,ans;
  ans=0;
  cin>>n>>m;
  long long int num[3];
  num[0]=num[1]=num[2]=10;

  for(int i=0;i<m;i++){
  	int tmp,tmp2;
  	cin>>tmp>>tmp2;
  	tmp=tmp-1;
  	if(num[tmp]==10){
  	  num[tmp]=tmp2;
  	}else if(num[tmp]!=tmp2){
  	  cout<<-1<<endl;
  	  return 0;
  	}
  }
  if(num[0]==10&&n==3){
  	num[0]=1;
  }else{
  	num[0]=0;
  }
  if(num[1]==10&&n==2){
  	num[1]=1;
  }else{
  	num[1]=0;
  }
  if(num[2]==10&&n==1){
  	num[2]=1;
  }else{
  	num[2]=0;
  }    
  if(num[0]==0&&n==3){
  	cout<<-1<<endl;
  	return 0;
  }else{
  	ans+=num[0]*100+num[1]*10+num[2];
  }else if(num[1]==0&&n==2){
  	cout<<-1<<endl;
  	return 0;
  }else{
  	ans+=num[1]*10+num[2];
  }else if(num[2]==0&&n==1){
  	cout<<-1<<endl;
  	return 0;
  }else{
  	ans+=num[2];
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:4: error: 'else' without a previous 'if'
   41 |   }else if(num[1]==0&&n==2){
      |    ^~~~
a.cc:46:4: error: 'else' without a previous 'if'
   46 |   }else if(num[2]==0&&n==1){
      |    ^~~~
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] s = new int[M];
    int[] c = new int[M];
    for(int i=0; i<M; i++){
      s[i] = sc.nextInt();
      c[i] = sc.nextint();
    }
    int[] num = new int[N];
    for(int i=0; i<N; i++){
    	num[i] = 0;
    }
    int ans = 0;
    int numInt = 0;
    boolean isTrue = true;
    if(int i=0; i<M; i++){
      int keta = s[i] - 1; //いじる桁 0-2 配列走査するので-1
      if(num[keta] != 0 && num[keta] != c[i]){
          isTrue = false;
          break;
      } else{
        num[keta] = c[i];
      }
    }
     if(num[0] == 0) isTrue = false;
     
     if(isTrue == false) {ans == -1;}
     else{
       for(int i=0; i<N; i++){
         for(int i=N-1; i>=0; i--){
         num[i] = num[i] *10; 
         numInt += num[i]; 
      	 }
       } 
    	ans = numInt;
     }
 
    System.out.println(ans); 
  }
}


Compiler output:
Main.java:20: error: '.class' expected
    if(int i=0; i<M; i++){
           ^
Main.java:20: error: > or ',' expected
    if(int i=0; i<M; i++){
                   ^
Main.java:20: error: not a statement
    if(int i=0; i<M; i++){
                 ^
Main.java:20: error: ';' expected
    if(int i=0; i<M; i++){
                        ^
Main.java:31: error: not a statement
     if(isTrue == false) {ans == -1;}
                              ^
5 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] s = new int[M];
    int[] c = new int[M];
    for(int i=0; i<M; i++{
      s[i] = sc.nextInt();
      c[i] = sc.nextint();
    }
    int[] num = new int[N];
    for(int =0; i<N; i++){
    	num[i] = 0;
    }
    int ans = 0;
    int numInt = 0;
    boolean isTrue = true;
    if(int i=0; i<M; i++){
      int keta = s[i] - 1; //いじる桁 0-2 配列走査するので-1
      if(num[keta] != 0 && num[keta] != c[i]){
          isTrue = false;
          break;
      } else{
        num[keta] = c[i];
      }
    }
     if(num[0] == 0) isTrue = false;
     
     if(isTrue == false) {ans == -1;}
     else{
       for(int i=0; i<N; i++){
         for(int i=N-1; i>=0; i--){
         num[i] = num[i] *10; 
         numInt += num[i]; 
      	 }
       } 
    	ans = numInt;
     }
 
    System.out.println(ans); 
  }
}

Compiler output:
Main.java:9: error: ')' expected
    for(int i=0; i<M; i++{
                         ^
Main.java:14: error: not a statement
    for(int =0; i<N; i++){
        ^
Main.java:14: error: ';' expected
    for(int =0; i<N; i++){
           ^
Main.java:14: error: illegal start of expression
    for(int =0; i<N; i++){
            ^
Main.java:14: error: not a statement
    for(int =0; i<N; i++){
                 ^
Main.java:14: error: ')' expected
    for(int =0; i<N; i++){
                   ^
Main.java:14: error: ';' expected
    for(int =0; i<N; i++){
                        ^
Main.java:20: error: '.class' expected
    if(int i=0; i<M; i++){
           ^
Main.java:20: error: > or ',' expected
    if(int i=0; i<M; i++){
                   ^
Main.java:20: error: not a statement
    if(int i=0; i<M; i++){
                 ^
Main.java:20: error: ';' expected
    if(int i=0; i<M; i++){
                        ^
Main.java:31: error: not a statement
     if(isTrue == false) {ans == -1;}
                              ^
12 errors
Language: Java

import java.util.*;

public class Main2 {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		int s[] = new int[m], c[] = new int[m];
		Map<Integer, Integer> map = new TreeMap<Integer, Integer>();
		int ans = -1;
		boolean isexist = true;
		for (int i = 0; i < m; ++i) {
			s[i] = sc.nextInt();
			c[i] = sc.nextInt();
			if (map.containsKey(s[i])) {
				if (map.get(s[i]) != c[i])
					isexist = false;
			}
			if (n > 1) {
				if (s[i] == 1 && c[i] == 0)
					isexist = false;
			}
			map.put(s[i], c[i]);
		}
		sc.close();
		if (isexist) {
			StringBuffer tmp = new StringBuffer();
			tmp.append("1");
			for (int i = 1; i < n; ++i) {
				tmp.append("0");
			}
			for (int key : map.keySet()) {
				int value = map.get(key);
				tmp.replace(key - 1, key, String.valueOf(value));
			}
			ans = Integer.parseInt(tmp.toString());
		}
		System.out.println(ans);
	}
}


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

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

int main(){
    int n,m;
    scanf(" %d %d",&n,&m);
    string ans = "";
    for(int i = 0; i < n;++i)
        ans +=  '*';
    bool posi = 1;
    while(m--){
        int s,v;
        scanf(" %d %d",&s,&v);
        --s;
        if(ans[s] != '*' && ('0'+v) != ans[s]){
            posi = 0;continue;
        }
        ans[s] = '0' + v;
    }
    if(!posi){puts("-1");return 0;}
    for(int i = 0; i < n;++i){
        if(ans[i] != '*') continue;
        else ans[i] = (i == 0? '1':'0');
    }
    //if(ans[0] == '0' && n > 1) puts("-1");
    else cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'else' without a previous 'if'
   26 |     else cout << ans << endl;
      |     ^~~~
Language: C

#include <stdio.h>

int main(void){
  int n, m;
  int s[5], c[5];
  
  scanf("%d %d", &n, &m);
  for(int i; i<m; i++){
    scanf("%d %d", &s[i], &c[i]);
  }
  if(n==1){
    for(int i=0; i<3; i++){
      if(s[i] == 1){
        printf("%d", c[i]);
      }else{
        printf("%d", -1);
      }
    }
  }else if(n==2){
    int a = 0;
    int b = 0;
    int flag = 0;
    for(int i=0; i<3; i++){
      if(s[i] == 1){
        b = c[i];
        flag ++;
      }else if(s[i] == 2){
        a = c[i];
        flag++;
      }
    }
    if(flag == 2){
      printf("%d%d", a, b);
    }else{
      printf("%d", -1);
    }
  }else if(n==3){
    int a = 0;
    int b = 0;
    int c = 0;
    int flag = 0;
    for(int i=0; i<3; i++){
      if(s[i] == 1){
        c = c[i];
        flag ++;
      }else if(s[i] == 2){
        b = c[i];
        flag++;
      }else if(s[i] == 3){
        a = c[i];
        flag++;
      }
    }
    if(flag == 3){
      printf("%d%d%d", a, b, c);
    }else{
      printf("%d", -1);
    }
  }else{
    printf("%d", -1);
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:44:14: error: subscripted value is neither array nor pointer nor vector
   44 |         c = c[i];
      |              ^
main.c:47:14: error: subscripted value is neither array nor pointer nor vector
   47 |         b = c[i];
      |              ^
main.c:50:14: error: subscripted value is neither array nor pointer nor vector
   50 |         a = c[i];
      |              ^
Language: C++

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

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

    vector<int> s(m);
    vector<int> c(m);
    for(int i=0; i<m; i++){
        cin >> s.at(i) >> c.at(i);
    }

    vector<int> res(n, -1);
    for(int i=0; i<m; ++i){
        if(n-s.at(i) < 0 || n-s.at(i) > n-1){
            cout << -1;
            return;
        }
        if(res.at(n-s.at(i) != -1 && res.at(n-s.at(i) != c.at(i)))){
            cout << -1;
            return 0;
        }

        res.at(n-s.at(i)) = c.at(i);
        if(s.at(i) == 1 && c.at(i) == 0){
            cout << -1;
            return 0;
        }
    }
    
    for(int i=pow(10, n-1); i<pow(10, n); i++){
        bool flag = true;
        int ii = i;
        for(int j=0; j<n; j++){
            int d = ii%10;
            if(!(res.at(j) == -1 || res.at(j) == d)){
                flag = false;
                break;
            }

            ii /= 10;
        }

        if(flag){
        cout << i;
        return 0;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
   18 |             return;
      |             ^~~~~~
Language: C

#include <stdio.h>

int main(void){
  int n, m;
  int s[5], c[5];
  
  scanf("%d %d", &n, &m);
  for(int i; i<m; i++){
    scanf("%d %d", &s[i], &c[i]);
  }
  if(n==1){
    for(int i=0; i<3; i++){
      if(s[i] == 1){
        printf("%d", c[i]);
      }else{
        printf("%d", -1);
      }
    }
  }else if(n==2){
    int a = b = 0;
    int flag = 0;
    for(int i=0; i<3; i++){
      if(s[i] == 1){
        b = c[i];
        flag ++;
      }else if(s[i] == 2){
        a = c[i];
        flag++;
      }
    }
    if(flag == 2){
      printf("%d%d", a, b);
    }else{
      printf("%d", -1);
    }
  }else if(n==3){
    int a = b = c = 0;
    int flag = 0;
    for(int i=0; i<3; i++){
      if(s[i] == 1){
        c = c[i];
        flag ++;
      }else if(s[i] == 2){
        b = c[i];
        flag++;
      }else if(s[i] == 3){
        a = c[i];
        flag++;
      }
    }
    if(flag == 3){
      printf("%d%d%d", a, b, c);
    }else{
      printf("%d", -1);
    }
  }else{
    printf("%d", -1);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:20:13: error: 'b' undeclared (first use in this function)
   20 |     int a = b = 0;
      |             ^
main.c:20:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:37:19: error: assignment to expression with array type
   37 |     int a = b = c = 0;
      |                   ^
main.c:41:11: error: assignment to expression with array type
   41 |         c = c[i];
      |           ^
Language: C++

/*
N M
s1 c1

⋮

sM cM


*/

#include<iostream>
#include<string>
using namespace std;
 
int main(void) {
  	int N, M;
  	cin >> N >> M;
  	int s[M];
  	char c[M];
  	vector<int> v;
  
  	for (int m = 0; m < M; m++){ cin >> s[m] >> c[m]; }
  	
  	startnum = 1;
  	for (int n = 1; n < N; n++){
      startnum *= 10;
    }
  	int endnum = startnum*10 - 1;
  	
  	for (int i = 0; i < M; i++){
      for (int n = startnum; n <= endnum; n++){
        int kirisute = n;
		for (int count = 0; count < N - s[i]; count++){
          kirisute /= 10;
        }
        if (kirisute % 10 == c[i]) {cout << n << endl; return 0;}
      }
    }
  	cout << -1 << endl;
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'vector' was not declared in this scope
   21 |         vector<int> v;
      |         ^~~~~~
a.cc:13:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
   12 | #include<iostream>
  +++ |+#include <vector>
   13 | #include<string>
a.cc:21:16: error: expected primary-expression before 'int'
   21 |         vector<int> v;
      |                ^~~
a.cc:25:9: error: 'startnum' was not declared in this scope
   25 |         startnum = 1;
      |         ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,a[5],b[5];
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int s,c;
		cin>>s>>c;
		if (!b[s])
		{
			a[s]=c;
			b[s]=1;
		}
		else
		{
			if (a[s]!=c)
			{
				cout<<-1<<endl;
				return 0; 
			}
		}
	}
	bool flag=false;
	for(int i=1;i<=n;i++)
	{
		if (a[i]!=0)
			flag=true;
		if (a[i]==0&&!flag)
		{
			cout<<-1;
			return 0;
		}
		if (flag)
			cout<<a[i];
	}
	if (!flag)
	{
		cout<<-1;
	} 
	cout<<endl;
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:43:18: error: expected '}' at end of input
   43 |         return 0;
      |                  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
//#define x first
//#define y second

using namespace std;
int m,n,s,c;
map<int,int>a;
int main()
{
	cin>>n>>m;
	rep(i,m)
	{
		cin>>s>>c;
		if(s>n||(a.count(s)&&a[s]!=c))
		{
			cout<<-1<<endl;
			return 0;
		}
		a[s]=c;
	}
	if(n==1&&!a.count(1)) cout<<0<<endl;
	if(n!=1&&a.count(1)&&a[1]==0)
	{
		cout<<-1<<endl;
		return 0;
	}
	else
	{
		if(a.count(1)) cout<<a[i];else cout<<1;
		rep2(i,2,n+1) if(a.count(i)) cout<<a[i];else cout<<0;
		cout<<endl;
	}
	return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:40: error: 'i' was not declared in this scope
   37 |                 if(a.count(1)) cout<<a[i];else cout<<1;
      |                                        ^
Language: C++

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

int main(){
  int N,M;
  bool s=false;
  cin>>N>>M;
  vector<int> a={1,0,0};
  vector<bool> b(3,false);
  for(int i=0;i<M;i++){
    int A,B;
    cin>>A>>B;
    if(!b[A-1]){a[A-1]=B;b[A-1]=true;}
    if(b[A-1]&&a[A-1]!=B){cout<<-1;s=true;break;}
    if(a[0]==0){cout<<-1;s=true;break;}
  }
  if(!s&&N==3){cout<<a[0]<<a[1]<<a[2];}
  else if(!s&&N==2){cout<<a[0]<<a[1];}
  else if(!s&&N==1&&M=0){cout<<0;}
  else if(!s&&N==1){cout<<a[0];}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:19: error: lvalue required as left operand of assignment
   20 |   else if(!s&&N==1&&M=0){cout<<0;}
      |           ~~~~~~~~^~~
Language: C++

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

int compNum(int oldNum, int newNum) {
    if(oldNum == 0) return newNum;
    return min(oldNum, newNum);
} 

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> result(N);
    int res = 0;
    vector<int> s(M);
    vector<int> c(M);
    rep(i, M) {
        cin >> s[i] >> c[i];
        result[s[i]-1] = compNum(result[s[i]-1], c[i]);
    }
    if (result.size() > 1 && result[0] == 0) {
        cout << -1 << endl;
        return 0;
    }
    rep(i, N) {
        res += result[N - i - 1] * pow(10, i);
    }
    cout << res << endl;
}

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

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

int main() {
  int kinshi=0;
  int N,M;
  cin>>N>>M;
  vector<int>keta(N,0);
  vector<int>ketakanri(N,0);
  keta[0]=1;
  for(int i=0;i<M;i++){
    int s,c;
    cin>>s>>c;
    s--;
    if(ketakanri[s]){
      if(keta[s]!=c){
        kinshi++;
      }
    }
    keta[s]=c;
    ketakanri[s]=1;
  }
  if(N!=1){
  if(keta[0]==0) kinshi++;
  }
  if(N==1 and M=0){
    cout<<0;
    return 0;
  }
  if(kinshi) cout<<-1;
  else{
    rep(i,N) cout<<keta[i];
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:11: error: lvalue required as left operand of assignment
   27 |   if(N==1 and M=0){
      |      ~~~~~^~~~~
Language: C++

#include <vector>
#include <map>
#include <iostream>

#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int mod = 1000000007;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> ans(n, -1);

  for (int i = 0; i < m; i++) {
    int s, c;
    cin >> s >> c;
    s--;
    if (ans[s] == -1) {
      ans[s] = c;
    } else {
      if (ans[s] != c) {
        cout << -1 << endl;
        return 0;
      }
    }
  }

  if (n != 1 && ans[0] == 0) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (ans[i] == -1 && i == 0) {
      cout << 1;
    } else if (ans[i] == -1) {
      cout << 0;
    else {
      cout << ans[i];
    }
  }
  cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:5: error: expected '}' before 'else'
   45 |     else {
      |     ^~~~
a.cc:43:30: note: to match this '{'
   43 |     } else if (ans[i] == -1) {
      |                              ^
Language: C++

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

int main() {
    int N, M;
    cin >> N >> M;
    int s[M], c[M];
    for (int i = 0; i < M; i++) {
        cin >> s[i] >> c[i];
    }

    if (N == 1) {
        bool ok = true;
        for (int i = 1; i < M; i++) {
            if (c[i] != c[i-1]) ok = false; 
        }
        if (ok) cout << c[0] << endl;
        else cout << -1 << endl;
    }

    else if (N == 2) {
        for (int i = 10; i < 100; i++) {
            bool ok = true;
            for (int j = 0; j < M; j++) {
                if (s[j] == 1) {
                    if (i / 10 != c[j]) ok = false;
                }
                else if (s[j] == 2) {
                    if (i % 10 != c[j]) ok = false;
                }
            }
            if (ok) {
                cout << i << endl;
                break;
            }
          　if (i == 99) cout << -1 << endl;
        }
    }

    else if (N == 3) {
        for (int i = 100; i < 1000; i++) {
            bool ok = true;
            for (int j = 0; j < M; j++) {
                if (s[j] == 1) {
                    if (i / 100 != c[j]) ok = false;
                }
                else if (s[j] == 3) {
                    if (i % 10 != c[j]) ok = false;
                }

                else if (s[j] == 2) {
                    if ((i / 10) % 10 != c[j]) ok = false;
                }
            }
            if (ok) {
                cout << i << endl;
                break;
            }
            if (i == 999) cout << -1 << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc:37:11: error: extended character 　 is not valid in an identifier
   37 |           　if (i == 99) cout << -1 << endl;
      |           ^
a.cc: In function 'int main()':
a.cc:37:11: error: '\U00003000if' was not declared in this scope
   37 |           　if (i == 99) cout << -1 << endl;
      |           ^~~~
Language: C++


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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> num(n,0);
  bool flag = true;
  for (int i = 0; i < m; i++)
  {
    int s,c;
    cin >> s >> c;
    if (num[s-1] == 0 || num[s-1] == c) num[s-1] = c;
    else flag = false;

  }

  int ans = 0;
  if (flag == true)
  {
    for (int i = 0; i < n - 1; i++)
    {
      if (num[i] == 0)
      {
        if (n == 2) {
          flag = false;
          break;
        }
        else if (n == 3)
        {
          if (num[i - 1] == 0)
          {
            flag = false;
            break;
          }
        }
      }
    }
  }

  if (flag == false) cout << -1 << endl;
  else
  {
    for (int i = 0; i < n; i++)  ans += num[i] * pow(10, n - i - 1);
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:50: error: 'pow' was not declared in this scope
   47 |     for (int i = 0; i < n; i++)  ans += num[i] * pow(10, n - i - 1);
      |                                                  ^~~
Language: C++

#include <stdio.h>
int main(void){
    // Your code here!
    int n;
    int m;
    int s[5];
    int c[5];
    int d[3];
    
    scanf("%d %d", &n, &m);
    
    for(int i=0; i<m; i++){
        d[i]=-1;
    }
    
    for(int i=0; i<m; i++){
        scanf("%d %d", &s[i], &c[i]);
        if(d[s[i]-1]!=-1 && c[i]!=d[s[i]-1]){
            printf("-1");
            return 0;
        }
        d[s[i]-1]=c[i];
    }
    if(d[0]==0 && n!=1){
            printf("-1");
            return 0;
    }
    
    
    if(d[0]==-1) d[i]=1;
    if(d[1]==-1) d[i]=0;
    if(d[2]==-1) d[i]=0;
    
    if(n==3) printf("%d", d[0]*100+d[1]*10+d[2]);
    else if(n==2) printf("%d", d[0]*10+d[1]);
    else if(n==1) printf("%d", d[0]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: 'i' was not declared in this scope
   30 |     if(d[0]==-1) d[i]=1;
      |                    ^
a.cc:31:20: error: 'i' was not declared in this scope
   31 |     if(d[1]==-1) d[i]=0;
      |                    ^
a.cc:32:20: error: 'i' was not declared in this scope
   32 |     if(d[2]==-1) d[i]=0;
      |                    ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
//#define x first
//#define y second

using namespace std;
int m,n,s,c;
map<int,int>a;
int main()
{
	cin>>n>>m;
	rep(i,m)
	{
		cin>>s>>c;
		if(s>n||(a.count(s)&&a[s]!=c))
		{
			cout<<-1<<endl;
			return 0;
		}
		a[s]=c;
	}
	if(n==1&&!a.count(1)) cout<<0<<endl;
	if(n!=1&&a.count(1)&&a[1]==0)
	{
		cout<<-1<<endl;
		return 0;
	}
	else
	{
		if(a.count(i)) cout<<a[i];else cout<<1;
		rep2(i,2,n+1) if(a.count(i)) cout<<a[i];else cout<<0;
		cout<<endl;
	}
	return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:28: error: 'i' was not declared in this scope
   37 |                 if(a.count(i)) cout<<a[i];else cout<<1;
      |                            ^
Language: Java

import java.util.*;

class Main{
public static void main(String[] args ){
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
int M=sc.nextInt();
int[] num=new int[3];

for(int i=0;i<3;i++){
num[i]=-1;
}

for(int j=0;j<M;j++){
 int k=sc.nextInt();
 int l=sc.nextInt();
if(num[k-1]!=-1&&num[k-1]!=l){
System.out.print(-1);
return;
}
num[k-1]=l;
}

for(int j=3;j>=0;j—){
if(num[j]==-1) num[j]=0;
}

int Ans=num[0]*100+num[1]*10+num[2];
System.out.print(Ans);
}
}

Compiler output:
Main.java:24: error: illegal character: '\u2014'
for(int j=3;j>=0;j?){
                  ^
Main.java:24: error: not a statement
for(int j=3;j>=0;j?){
                 ^
2 errors
Language: C

#include <stdio.h>

struct point{
	int s;
	int c;
};

int main(){
	int i, j, n, m,checker;
	scanf("%d%d",&n,&m);
	struct point d[m],p;
	for(i=0;i<m;i++){
		scanf("%d%d",&d[i].s,&d[i].c);
		if((d[i].s==1)&&(d[i].c==0)) checker = 1;
	}
	for(i=0;i<m-1;i++){
		for(j=i+1;j<m;j++){
			if(d[i].s>d[j].s){
				p=d[i];
				d[i]=d[j];
				d[j]=p;
			}
		}
	}
	
	int ans[n];
	for(i=0;i<n;i++) ans[i]=0;
	ans[0]=1;

	for(i=0;i<m-1;i++){
		for(j=i+1;j<m;j++){
			if((d[i].s==d[j].s)&&(d[i].c!=d[j].c)) {
				checker = 1;
				break;
		}
	}
	if(checker==1) printf("-1");
	else {
		for(i=0;i<m;i++) ans[d[i].s - 1] = d[i].c;
		for(i=0;i<n;i++) printf("%d",ans[i]);
	}
}
	

Compiler output:
main.c: In function 'main':
main.c:42:1: error: expected declaration or statement at end of input
   42 | }
      | ^
Language: C++

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


//vector<vector<int>> z(n,vector<int>(2));

int main(){
int n,m;
cin>>n>>m;
vector<int> used(n,0);
vector<int> S(n,0);
int ans=0;
//cout<<used[0]<<'c';
rep(i,m){
  int s,c;
  cin>>s>>c;
  s--;
  if (s+c==0 & n>1)ans=-1;
  if (used[s]==0){
    S[s]=c;
  }
  else {
    if (S[s]!=c) ans=-1;
  }
  used[s]=1;

}
//  cout<<S[0]<<'n'<<S[1]<<'n'<<S[2]<<'n'<<endl;
//if (S[0]==0 & n>1)ans=-1;
if (S[0]==0 & n>1) S[0]=1;3
if (ans==0){
  ans+=S[0]*100+S[1]*10+S[2];
}

cout<<ans;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:28: error: expected ';' before 'if'
   34 | if (S[0]==0 & n>1) S[0]=1;3
      |                            ^
      |                            ;
   35 | if (ans==0){
      | ~~
Language: C++

#include <iostream>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int s[m], c[m], a[n];
  for(int i = 0; i < m; i++) {
    cin >> s[i] >> c[i];
  }
  for(int i = 0; i < n; i++) {
    a[i] = 10;
  }
  for(int i = 0; i < m; i++) {
    a[s[i]] = c[i];
  }
  
  for(int i = 0; i < n; i++) {
    if(a[i] == 10) {
      a[i] = 0;
      if(i == 0) {
        a[i] = 1;
    }
  }
  if(a[0] == 0) {
    cout << -1;
  } else {
    for(int i = 0; i < n; i++) {
      cout << a[i];
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

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

int main(){
    int n, m;
    bool judge = true;
    cin >> n;
    cin >> m;
    int ans[n];
    memset(ans, -1, sizeof(ans));
    int s[m], c[m];
    REP(i,m){
        cin >> s[i] >> c[i];
        if(ans[s[i]-1]!=-1 && ans[s[i]-1] != c[i]){
            judge = false;
        }
        ans[s[i]-1] = c[i];
    }
    REP(i,n){
        if(ans[i] == -1)
         ans[i] = 1;
    }
    if(n != 1 && ans[0] == 0)
        judge = false;
    if(judge){
        REP(i,n){
            cout << ans[i];
        }
        cout << endl;
    }
    else{
        cout << -1 << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'memset' was not declared in this scope
   11 |     memset(ans, -1, sizeof(ans));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

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



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

	vector<int> d(n, -1);

	rep(i, m) {
		int s, c;
		cin >> s >> c;
		s--;
		if (d[s] == -1) {
			d[s] = c;
		} else if (d[s] != c) {
			cout << -1 << endl;
			return 0; 
		}
	}
	if (d[0] == 0) {
		cout << -1 << endl;
		return 0;
	}
	if (d[0] == -1) {
		d[0] = 1; 
	}
	if (all_zero) {
		cout << -1 << endl;
		return 0;
	}
	
	int ans = 0;
	rep(i, n) {
		ans *= 10;
		if (d[i] != -1) {
			ans += d[i];
		}
		//cout << "i:" << i << ":" << ans << endl;
	}
	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:13: error: 'all_zero' was not declared in this scope
   46 |         if (all_zero) {
      |             ^~~~~~~~
Language: C++

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

int main(){
  int N,M;
  bool s=false;
  cin>>N>>M;
  if(N==3||N==2){
  vector<int> a={1,0,0};
  }else{vector<int> a={0,0,0};}
  vector<bool> b(3,false);
  for(int i=0;i<M;i++){
    int A,B;
    cin>>A>>B;
    if(!b[A-1]){a[A-1]=B;b[A-1]=true;}
    if(b[A-1]&&a[A-1]!=B){cout<<-1;s=true;break;}
    if(a[0]==0){cout<<-1;s=true;break;}
  }
  if(!s&&N==3){cout<<a[0]<<a[1]<<a[2];}
  else if(!s&&N==2){cout<<a[0]<<a[1];}
  else if(!s&&N==1){cout<<a[0];}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'a' was not declared in this scope
   16 |     if(!b[A-1]){a[A-1]=B;b[A-1]=true;}
      |                 ^
a.cc:17:16: error: 'a' was not declared in this scope
   17 |     if(b[A-1]&&a[A-1]!=B){cout<<-1;s=true;break;}
      |                ^
a.cc:18:8: error: 'a' was not declared in this scope
   18 |     if(a[0]==0){cout<<-1;s=true;break;}
      |        ^
a.cc:20:22: error: 'a' was not declared in this scope
   20 |   if(!s&&N==3){cout<<a[0]<<a[1]<<a[2];}
      |                      ^
a.cc:21:27: error: 'a' was not declared in this scope
   21 |   else if(!s&&N==2){cout<<a[0]<<a[1];}
      |                           ^
a.cc:22:27: error: 'a' was not declared in this scope
   22 |   else if(!s&&N==1){cout<<a[0];}
      |                           ^
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    
    int[] s = new int[M];
    int[] c = new int[M];
    
    for(int i=0;i<M;i++){
      s[i] = sc.nextInt();
      c[i] = sc.nestInt();
    }
    
    int[] a = new int[N];
    for(int i=0;i<N;i++){
      a[i] = -1;
    }
    
    for(int i=0;i<M;i++){
      if(a[s[i]] == -1){
        a[s[i]] = a[c[i]];
      }
      else{
        print(-1);
        return;
      }
      
      if(a[N]== -1){
      	print(-1);
        return;
      }
      
      int ans = 0;
      for(int i=0;i<N;i++){
      	ans += a[i] * Math.pow(10,i);
      }
      
      print(ans);
      return;
      
    }
  }
    
    
}

Compiler output:
Main.java:13: error: cannot find symbol
      c[i] = sc.nestInt();
               ^
  symbol:   method nestInt()
  location: variable sc of type Scanner
Main.java:26: error: cannot find symbol
        print(-1);
        ^
  symbol:   method print(int)
  location: class Main
Main.java:31: error: cannot find symbol
      	print(-1);
      	^
  symbol:   method print(int)
  location: class Main
Main.java:36: error: variable i is already defined in method main(String[])
      for(int i=0;i<N;i++){
              ^
Main.java:40: error: cannot find symbol
      print(ans);
      ^
  symbol:   method print(int)
  location: class Main
5 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[4];
int main()
{
	int n,m;
	cin>>n>>m;
	if(n==1&&m==0)
	{
		cout<<"0\n";
		return 0;
	}
	for(int i=1;i<=m;i++)
	{
		int c,d;
		cin>>c>>d;
		if(a[c]!=0&&a[c]!=d)
		{
			cout<<"-1\n";
			return 0;
			break;
		}
		a[c]=d;
		if(c==1&&d==0&&n!=1)
		{
			cout<<"-1\n";
			return 0;	
			break;
		} 
	}
	if(n==1&&m==1&&c==1&&d==0)
	{
			cout<<"0"<<endl;
			return 0;}
	for(int i=1;i<=n;i++)
	{
		if(a[1]==0)
			a[1]=1;
		cout<<a[i];
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:24: error: 'c' was not declared in this scope
   31 |         if(n==1&&m==1&&c==1&&d==0)
      |                        ^
a.cc:31:30: error: 'd' was not declared in this scope
   31 |         if(n==1&&m==1&&c==1&&d==0)
      |                              ^