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

import java.util.*;
import java.lang.Math;

public class C{
	public static void main(String args[]){
		call();
	}

	public static void call(){
		Scanner sc = new Scanner(System.in);
		int keta = sc.nextInt();
		int numOfData = sc.nextInt();
		Map<Integer,Integer> map = new HashMap<>(numOfData);
		//mapに桁数と値を入れる
		//キーの値が更新されそうになったら、-1を出力して終了する
		for(int i = 0; i < numOfData; i++){
			int key = 0;
			int value = 0;
			key = sc.nextInt();
			value = sc.nextInt();
			if(map.containsKey(key) && map.get(key) != value){
				System.out.println(-1);
				return;
			}
			map.put(key,value);
		}
		//一桁目が0になる指定があれば、-1を出力して終了する
		int ans = 0;
		for(int key: map.keySet()){
			if(key == 1){
				if(map.get(key) == 0){
					System.out.println(-1);
					return;
				}
			}
			//指定された桁に値を代入する
			ans += map.get(key) * Math.pow(10, keta - key);
		}
		//答えが指定された桁数より小さければ、桁数を10の累乗を足すことで合わせる
		if(ans < Math.pow(10, keta -1)){
			ans += Math.pow(10, keta -1);
		}
		System.out.println(ans);
		return;
	}
}


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

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

int main() {
  int n, m;
  cin >> n >> m;
  
  vector<int> s(m);
  vector<int> c(m);
  rep(i,m) {
    int x;
    cin >> s[i] >> c[i];
  }
  
  int num_insert = 0;
  int ans = 0;
  vector<int> num(n, -1);
  rep(i, m) {
    if (num[s[i]-1] == -1) {
      num[s[i]-1] = c[i];
    }
    if (num[s[i]-1] != c[i]) {
      ans = -1;
      break;
    }
  }
  
  if (n == 1 && ans == 0) {
    if (num[0] == -1) {
      ans = 0;
    } else {
      ans = num[0];
    }
  } else if (ans == 0) {
    if (num[0] == 0) {
      ans = -1;
    } else {
      rep(i, n) {
        if (num[i] == -1) {
          if (i == 0) {
            num[i] = 1;
          } else {
            num[i] = 0;
          }
        }
      }
    }
    ans = 0;
    rep(i, n) {
      if 
      ans += pow(10, n-i-1) * num[i];
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:7: error: expected '(' before 'ans'
   53 |       ans += pow(10, n-i-1) * num[i];
      |       ^~~
      |       (
Language: C++

#include<cstdio>

int main(void) {
  int i, j, k;
  int *number;
  int *digits;
  int N, M;
  int s, c;
  int flag = 0;
  scanf("%d %d", &N, &M);
  number = new int[N];
  digits = new int[N];
  for(i = 0;i < N;i++) {
    digits[i] = 0;
    number[i] = 0;
  }
  for(i = 0;i < M;i++) {
    int s, c;
    scanf("%d %d", &s, &c);
    if(!flag) {
      if(number[s - 1] != c && digits[s - 1]) flag = 1;
      digits[s - 1] = 1;
      number[s - 1] = c;
    }
  }
  if(N != 1 && !digits[0] && number[0] == 0) number[0] = 1;
  if(flag || numeber[0] == 0) {
    puts("-1");
  } else {
    for(i = 0;i < N;i++) printf("%d", number[i]);
    puts("");
  }
  fflush(stdout);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: 'numeber' was not declared in this scope; did you mean 'number'?
   27 |   if(flag || numeber[0] == 0) {
      |              ^~~~~~~
      |              number
Language: C++

//include,namespace
 #include<bits/stdc++.h>
 #include<iostream> 
 #include <queue>
 #include <vector>
 #include <string>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;
////////////////いろいろあるよ//////////////////////////////////
 
int main(){
  	int N,M;
  	cin >> N >> M;
  	int data[N];
  	REP(i,N)data[i]=-1;
  	REP(i,M){
    	int A,B;
      	cin >> A;
      	cin >> B;
      	if(data[A-1]!=B && data[A-1]!=-1){
          cout << -1 << endl;
          return 0;
        }
      	data[A-1]=B;
    }
  	bool boolean=false;
  	if(N==0&&M==0){cout << 0 << endl;return 0}
  	REP(i,N){
    	if(boolean==false&&(data[i]!=-1 || data != 0)){
        	boolean = true;
          	int sum=0;
          	FOR(j,i,N){if(data[j]==-1)data[j]=0;sum+=data[j];}
          	if(sum==0){
              cout << -1 << endl;
              return 0;
            }
           cout << data[i];
        }else if(boolean==false){continue;
        }else{
          	
          	
        	cout << data[i];
        }
    }
  cout << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:50: error: expected ';' before '}' token
   38 |         if(N==0&&M==0){cout << 0 << endl;return 0}
      |                                                  ^
      |                                                  ;
Language: C++

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

string tostring(int n) {
   string s1;
   while(x!=0){
    	s1+=(char)(n%10+48);
    	n/=10;
	  }

  return s1;
}
int n,m,temp,x;
bool b;
int main() {
  cin >> n >> m;
  int s[m],c[m],temp=1;
  for(int i=0;i<m;++i) {
    cin >> s[i] >> c[i];
  }
  for(int i=1;i<n;++i) {
    temp*=10;
  }
  for(int i=temp;i<temp*10;++i) {
    b=true;
    string s=tostring(i); 
    for(int j=0;j<m;++j) 
      if(s[s[j]]!=c[j]) {
        b=false;
        break;
      }
    if(b) {
      cout << b;
      return 0; 
    }   
  }
  cout << -1;
  return 0;
}

Compiler output:
a.cc: In function 'std::string tostring(int)':
a.cc:6:10: error: 'x' was not declared in this scope
    6 |    while(x!=0){
      |          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int n=0,m=0;
  
  cin >> n >>m;
  int a[m],b[m],q[n],c[n]={900,900,900,900,900,900};
  
  if(n>m){
  cout << "-1";
  }
 
  
  
  for(int i=0;i<m;i++){
  	cin >>a[i]>>b[i]
  }
  
  
  
  for(int io=1;io<n+1;io++;){
  	for(int i=0;i<m;i++){
  		if(a[i]==io){
    		if(b[i]<c[i])
              c[i]=b[i]
    	}
  	}
  }
  for(i=0;i<N;i++){
  cout<<c[i];
  
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: expected ';' before '}' token
   18 |         cin >>a[i]>>b[i]
      |                         ^
      |                         ;
   19 |   }
      |   ~                      
a.cc:23:27: error: expected ')' before ';' token
   23 |   for(int io=1;io<n+1;io++;){
      |      ~                    ^
      |                           )
a.cc:23:28: error: expected primary-expression before ')' token
   23 |   for(int io=1;io<n+1;io++;){
      |                            ^
a.cc:31:7: error: 'i' was not declared in this scope
   31 |   for(i=0;i<N;i++){
      |       ^
a.cc:31:13: error: 'N' was not declared in this scope
   31 |   for(i=0;i<N;i++){
      |             ^
Language: C++

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

string to_string(int n) {
   string s1;
   while(x!=0){
    	s1+=(char)(n%10+48);
    	n/=10;
	  }


}
int n,m,temp;
bool b;
int main() {
  cin >> n >> m;
  int s[m],c[m],temp=1;
  for(int i=0;i<m;++i) {
    cin >> s[i] >> c[i];
  }
  for(int i=1;i<n;++i) {
    temp*=10;
  }
  for(int i=temp;i<temp*10;++i) {
    b=true;
    string s=to_string(i); 
    for(int j=0;j<m;++j) 
      if(s[s[j]]!=c[j]) {
        b=false;
        break;
      }
    if(b) {
      cout << b;
      return 0; 
    }   
  }
  cout << -1;
  return 0;
}

Compiler output:
a.cc: In function 'std::string to_string(int)':
a.cc:6:10: error: 'x' was not declared in this scope
    6 |    while(x!=0){
      |          ^
a.cc:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
   12 | }
      | ^
a.cc: In function 'int main()':
a.cc:26:23: error: call of overloaded 'to_string(int&)' is ambiguous
   26 |     string s=to_string(i);
      |              ~~~~~~~~~^~~
a.cc:4:8: note: candidate: 'std::string to_string(int)'
    4 | string to_string(int n) {
      |        ^~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4240:3: note: candidate: 'std::string std::__cxx11::to_string(int)'
 4240 |   to_string(int __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4259:3: note: candidate: 'std::string std::__cxx11::to_string(unsigned int)'
 4259 |   to_string(unsigned __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4275:3: note: candidate: 'std::string std::__cxx11::to_string(long int)'
 4275 |   to_string(long __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4294:3: note: candidate: 'std::string std::__cxx11::to_string(long unsigned int)'
 4294 |   to_string(unsigned long __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4310:3: note: candidate: 'std::string std::__cxx11::to_string(long long int)'
 4310 |   to_string(long long __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4327:3: note: candidate: 'std::string std::__cxx11::to_string(long long unsigned int)'
 4327 |   to_string(unsigned long long __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4401:3: note: candidate: 'std::string std::__cxx11::to_string(float)'
 4401 |   to_string(float __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4411:3: note: candidate: 'std::string std::__cxx11::to_string(double)'
 4411 |   to_string(double __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4421:3: note: candidate: 'std::string std::__cxx11::to_string(long double)'
 4421 |   to_string(long double __val)
      |   ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define INF (1LL << 60)

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> s(M), c(M), _s(M);
    REP(i,0,M) {
        cin >> s[i] >> c[i];
        _s[i] = s[i];
    }

    vector<ll> num(N, 0);

    ll D;
    sort(ALL(_s));
    D = _s[M-1];

    bool f = true;
    REP(i,1,M){
        REP(j,0,i){
            if(s[i] == s[j] && c[i] != c[j]){
                f = false;
            }
        }
    }
    REP(i,0,M){
        if(N != 1 && s[i] == 1 && c[i] == 0){
            f = false;
        }
    }

    if (f) {
        if(D > N) _PR("-1");
        else {
            REP(i,0,M) {
                num[N-s[i]] = c[i];
            }
            if(N != 1 && num[N-1] == 0) num[N-1] = 1;
            for(ll i=N-1; i>=0; --i;) cout << num[i];
            cout << endl;
        }
    }
    else _PR("-1");
    

    return 0;
}

/*



*/

Compiler output:
a.cc: In function 'int main()':
a.cc:55:36: error: expected ')' before ';' token
   55 |             for(ll i=N-1; i>=0; --i;) cout << num[i];
      |                ~                   ^
      |                                    )
a.cc:55:37: error: expected primary-expression before ')' token
   55 |             for(ll i=N-1; i>=0; --i;) cout << num[i];
      |                                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<int> v(m);
  vector<int> u(m);
  for (int i = 0; i < m; ++i)
  {
    cin >> v.at(i) >> u.at(i);
  }
  int count=0;
  if(n!=1){
  for(int j=0;j<m;j++){
    if(v.at(j)==1){
      if(u.at(j)==0){
        count++;
      }
  }
    }
    for(int k=0;k<m;k++){
      if(v.at(j)==v.at(k)){
        if(u.at(j)!=u.at(k)){
          count++;
        }

      }
    }

  }
  
  vector<int> h(n);

  if(count!=0){
      cout << -1 << endl;
    }
    else{
      for(int j=1;j<n+1;j++){
      for(int i=0;i<m;i++){
       if(v.at(i)==j){
         h.at(j-1)=u.at(i);
      }
      }
    
   

  }
  if(n!=1){
  if(h.at(0)==0){
  	h.at(0)=1;
  }
  }
   for (int i = 0; i < n; ++i)
      {
      	cout << h.at(i);
      }
}
    }
    

   

	


Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: 'j' was not declared in this scope
   22 |       if(v.at(j)==v.at(k)){
      |               ^
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] = 10;
    }
    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] != 10 && num[keta] != c[i]){
          isTrue = false;
          break;
      } else{
        num[keta] = c[i];
      }
    }
     if(N != 1 && num[0] == 0) isTrue = false;
     for(int i=0; i<N; i++){
        if(num[i] == 10) num[i] = 0; 
     }
     
     if(isTrue == false) {ans = -1;}
     else{
        if(num[0] == 0) num[0] = 1;
		if(N == 3){
          ans = num[0] * 100 + num[1] * 10 + num[2];
        } else (N == 2){
          ans = num[0] * 10 + num[1]; 
        } else ans = num[0];
     }
 
    System.out.println(ans); 
  }
}


Compiler output:
Main.java:39: error: not a statement
        } else (N == 2){
               ^
Main.java:39: error: ';' expected
        } else (N == 2){
                       ^
Main.java:41: error: 'else' without 'if'
        } else ans = num[0];
          ^
3 errors
Language: C

1){
      printf("-1");
      return 0;
    }
  }
 for(int i=0;i<M-1;i++){
   if(s[i]==s[i+1]&&c[i]!=c[i+1]){
     printf("-1");
  return 0;
}
 }
  
  int cc=0;
  for(int i=0;i<M;i++){
    cc+=c[i];
  }
  if(N==1&&cc==0){
    printf("0");
    return 0;
  }
  
  for(int i=0;i<M;i++){
ans[s[i]-1]=c[i];
  }
  int count=0;
  for(int i=0;i<M;i++){
    if(count==0&&ans[i]==0){continue;}
    else {count++;
         printf("%d",ans[i]);
         }
  }
  
 
  
  return 0;
}


Compiler output:
main.c:1:1: error: expected identifier or '(' before numeric constant
    1 | 1){
      | ^
main.c:5:3: error: expected identifier or '(' before '}' token
    5 |   }
      |   ^
main.c:6:2: error: expected identifier or '(' before 'for'
    6 |  for(int i=0;i<M-1;i++){
      |  ^~~
main.c:6:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    6 |  for(int i=0;i<M-1;i++){
      |               ^
main.c:6:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    6 |  for(int i=0;i<M-1;i++){
      |                     ^~
main.c:14:3: error: expected identifier or '(' before 'for'
   14 |   for(int i=0;i<M;i++){
      |   ^~~
main.c:14:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   14 |   for(int i=0;i<M;i++){
      |                ^
main.c:14:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   14 |   for(int i=0;i<M;i++){
      |                    ^~
main.c:17:3: error: expected identifier or '(' before 'if'
   17 |   if(N==1&&cc==0){
      |   ^~
main.c:22:3: error: expected identifier or '(' before 'for'
   22 |   for(int i=0;i<M;i++){
      |   ^~~
main.c:22:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   22 |   for(int i=0;i<M;i++){
      |                ^
main.c:22:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   22 |   for(int i=0;i<M;i++){
      |                    ^~
main.c:26:3: error: expected identifier or '(' before 'for'
   26 |   for(int i=0;i<M;i++){
      |   ^~~
main.c:26:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   26 |   for(int i=0;i<M;i++){
      |                ^
main.c:26:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   26 |   for(int i=0;i<M;i++){
      |                    ^~
main.c:35:3: error: expected identifier or '(' before 'return'
   35 |   return 0;
      |   ^~~~~~
main.c:36:1: error: expected identifier or '(' before '}' token
   36 | }
      | ^
Language: Java

import java.util.Scanner;

/**
 * TITLE : Guess The Number
 * URL : https://atcoder.jp/contests/abc157/tasks/abc157_c
 */
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] number = new int[N];
        for (int i = 0; i < N; i++) {
            number[i] = -1;
        }

        int M = sc.nextInt();
        for (int i = 0; i < M; i++) {
            int S = sc.nextInt();
            int C = sc.nextInt();
            if (number[S - 1] == -1 || number[S - 1] == C) {
                number[S - 1] = C;
            } else {
                System.out.println(-1);
                return;
            }
        }

        if (number[0] == 0 && number.length != 1) {
            System.out.println(-1);
            return;
        } else if (number[0] == 0 && number.length == 1) {
            System.out.println(0);
            return;
        } else if (number[0] == -1) {
            number[0] = 1;
        }

        String answer = "";
        for (int i = 0; i < N; i++) {
            if (number[i] == -1) {
                number[i] = 0;
            }
            answer += number[i];
        }

        System.out.println(answer);
        sc.close();
    }
}ｖ

Compiler output:
Main.java:49: error: reached end of file while parsing
}?
 ^
1 error
Language: C++

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

ll pow(ll a, int n) {
	ll tmp = 1;
	while (n) {
		tmp *= a;
		n--;
	}
	return tmp;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<bool> first(n, true);
	vector<int> keta(n, 0);
	for (int i = 0; i < m; i++) {
		int s, c;
		cin >> s >> c;
		if (s == 1 && c == 0) {
			cout << -1 << endl;
			return 0;
		}
		s--;
		if (!first.at(s)) {
			if (c != keta.at(s)) {
				cout << -1 << endl;
				return 0;
			}
		}
		else if (first.at(s)) {
			keta.at(s)= c;
			first.at(s) = false;
		}
	}
	int ans = 0;
	if (first.at(0)) ans += pow(10, n - i - 1);
	for (int i = 0; i < n; i++) {
		if (!first.at(i)) {
			ans += keta.at(i)*pow(10, n - i - 1);
		}
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:45: error: 'i' was not declared in this scope
   39 |         if (first.at(0)) ans += pow(10, n - i - 1);
      |                                             ^
Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <unordered_map>

using namespace std;

using ll = long long;
using ld = long double;

template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vector<T>>;

#define REP(i, s, e) for (ll i = s; i < e; ++i)

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

    int N, M; cin >> N >> M;
    vec<int> ns(N, -1);
    REP(i, 0, M)
    {
        int s, c; cin >> s >> c; --s;

        if (ns[s] != -1 && ns[s] != c)
        {
            cout << -1 << endl;
            return 0;
        }

        ns[s] = c;
    }

    if (N == 1)
    {
        cout << (ns[0] == -1 ? 0 : ns[0]) << endl;
        return;
    }

    bool topFilled = false;
    REP(i, 0, N)
    {
        if (!topFilled && ns[i] == 0)
        {
            cout << -1 << endl;
            return 0;
        }

        cout << (ns[i] == -1 ? (topFilled ? 0 : 1) : ns[i]);
        topFilled = true;
    }

    return 0;
}


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

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

int main() {
    int N, M;
    cin >> N >> M;
    int res=0;
    vector<int> c(N,0);
    for (int i=0;i<M;i++){
        int si,ci;
        cin >> si >> ci;
        if (c[si-1]==0){
            c[si-1]=ci;
        }else{
            if(c[si-1]!=ci){
                res=-1;
                break;
            }
        }
    }
    if(res==-1){
        cout << res;
    }else{
        bool flag=false;
        for (int i=0;i<M;i++){
            if (i==m-1){
                flag==true;
            }
            if (c[i]==0){
                if(flag==true){
                    cout<< c[i];
             }

            }else{
                flag=true;
                cout << c[i];
            }
        }
    }
    cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: 'm' was not declared in this scope
   26 |             if (i==m-1){
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	string ans="    ";
	cin>>a>>b;
	for (int i=0;i<b;i++)
	{
		int c;
		char d;
		cin>>c>>d;
		c--;
		if (ans[c]==' ')
			ans[c]=d;
	}
	if (ans=="    "&&a==1||ans=="0   "&&a==1)
	{
		cout<<"0"<<endl;
		return 0;
	}
	if (ans[0]=='0')
	{
		cout<<"0";
		return 0;
	}
	else
	{
		cout<<"-1"<<endl;
		return 0;
	}
	if (ans[0]==' '&&ans[0]!='0')
		ans[0]='1';
	else if (ans[0]=='0')
	{
		cout<<"-1";
		return 0;
	}	
	if (ans[1]==' '&&a-1=0)
		ans[1]='0';
	if (ans[2]==' '&&a-2=0)
		ans[2]='0';
	cout<<ans;
	return 0;				
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:24: error: lvalue required as left operand of assignment
   39 |         if (ans[1]==' '&&a-1=0)
a.cc:41:24: error: lvalue required as left operand of assignment
   41 |         if (ans[2]==' '&&a-2=0)
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String[] lines = sc.nextLine().split(" ");
        int N = Integer.parseInt(lines[0]);
        int M = Integer.parseInt(lines[1]);
      
        boolean oo = false;

        String[] sample = new String[N];
        for(int i = 0; i < N; i++){
            sample[i] = "a";
        }

        String result = "";

        for(int i = 0; i < M; i++){
            String[] line = sc.nextLine().split(" ");
            int s = Integer.parseInt(line[0]);
            String c = line[1];
            if(sample[s - 1] != "a"){
                result = "-1";
                oo = true;              
                break;
            }

            sample[s - 1] = c;
        }
        
        sc.close();
      
        if(!oo){

        StringBuilder sb = new StringBuilder();
        if(sample[0] == "0"){
            result = "-1";
        } else {
            if(sample[0] == "a"){
              sample[0] == "1";
            }
            for(int i = 0; i < N; i++){
                sb.append(sample[i]);
            }
        }

        result = sb.toString().replaceAll("a", "0");
        }
        
        System.out.println(result);
    }
}

Compiler output:
Main.java:42: error: not a statement
              sample[0] == "1";
                        ^
1 error
Language: Java

public class Main {

    static java.util.Scanner scan = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        boolean flg = false;
        int[] first = getLineInts();
        int[] keta = new int[first[0]];
        for(int i = 0;i<keta.length;i++){
            keta[i] = -1;
        }
        int[] var;
        for(int i=0;i<first[1];i++){
            var = getLineInts();
            if((keta[var[0]-1] == var[1]) || keta[var[0]-1] == -1){
                keta[var[0]-1] = var[1];
            }else{
                flg = true;
            }

        }
        if(flg){
            System.out.println("-1");
        }else {
            StringBuilder sb = new StringBuilder();
            boolean f = true;
            if(keta[0] == -1){
                keta[0] = 1;
            }
            for(int i = 0; i < keta.length;i++){
                sb.append(keta[i] == -1 ? 0 : keta[i]);
            }

            String finalValue = sb.toString() == "-1" ? "-1" : String.valueOf(new Integer(sb.toString()));
            if(!finalValue.equalsIgnoreCase("-1") && finalValue.length() == keta.length){
                System.out.println(finalValue);
            }else{
                System.out.println(-1);
            }
        }
    }

Compiler output:
Main.java:41: error: reached end of file while parsing
    }
     ^
1 error
Language: C

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


int main()
{
int n,m,i,j,k;
int a=10,b=10,c=10;
int z=0;
int s[10][2];

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

if(m!=0)
{
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&s[i][0],&s[i][1]);
    }
}

for(i=0;i<m;i++)
{

    if(s[i][0]==1)
    {
        if(s[i][1]==0&&n!=1)
        {
            printf("-1");
            return 0;
        }
        if(s[i][1]!=a)
        {
            printf("-1");
            return 0;
        }
        else if(z<100)
        {
            a=s[i][1];
            z = z + a*100;
        }

    }
    if(s[i][0]==2)
    {
        if(s[i][1]!=b)
        {
            printf("-1");
            return 0;
        }       
         else if(b!=10)
        {
        b=s[i][1];
        z = z + b*10;
        }
    }
    if(s[i][0]==3)
    {
        if(s[i][1]!=c)
        {
            printf("-1");
            return 0;
        }
        else if(c!=10)
        {
        c=s[i][1];
        z = z + c;
        }
    }
}

printf("%d",z);

return 0;

}

Compiler output:
main.c: In function 'main':
main.c:12:14: error: invalid operands to binary & (have 'char *' and 'int')
   12 | scanf("%d %d"&n,&m);
      |       ~~~~~~~^
      |       |
      |       char *
Language: C++

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

int main() {
  int N;
  int M;
  cin >> N >> M;
  vector<vector<int>> A(M,vector<int>(2));
  for(int i = 0; i < M; i++) {
    cin >> A.at(i).at(0) >> A.at(i).at(1);
  }
  
  bool y = false;
  int z = 1;
  for(int l = 0; l < N; l++){
    z *= 10;
  }
  
  for(int j = 1; j < z; j++) {
    for(int k = 0; k < M; k++){
      int x = 1;
      for(int l = 0; l < A.at(k).at(0); l++){
        x *= 10;
      }
      if(j % x == A.at(k).at(1)) {
        y = true;
      }
      else {
        y = false;
        break;
      }
    }
      if (y == true) {
        cout << x << endl;
        break;
      }
      else if (j == z-1) {
        cout << -1 << endl;
        break;
      }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'x' was not declared in this scope
   34 |         cout << x << endl;
      |                 ^
Language: Java

public class Main {

    static java.util.Scanner scan = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        boolean flg = false;
        int[] first = getLineInts();
        int[] keta = new int[first[0]];
        for(int i = 0;i<keta.length;i++){
            keta[i] = -1;
        }
        int[] var;
        for(int i=0;i<first[1];i++){
            var = getLineInts();
            if((keta[var[0]-1] == var[1]) || keta[var[0]-1] == -1){
                keta[var[0]-1] = var[1];
            }else{
                flg = true;
            }

        }
        if(flg){
            System.out.println("-1");
        }else {
            StringBuilder sb = new StringBuilder();
            boolean f = true;
            if(keta[0] == -1){
                keta[0] = 1;
            }
            for(int i = 0; i < keta.length;i++){
                sb.append(keta[i] == -1 ? 0 : keta[i]);
            }
            
            String finalValue = sb.toString() == "-1" ? "-1" : String.valueOf(new Integer(sb.toString()));
            if(finalValue.length() == keta.length){
                System.out.println(finalValue);
            }else{
                System.out.println(-1);
            }
        }
    }


Compiler output:
Main.java:41: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

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

int main()
{
	int N=0, M=0, s[10][2]; //, c[10], A100=0,A10=0,A1=0;
	cin >> N >> M;

	for (int i=0;i<10;i++) {
		s[i][0]=0;
        s[i][1]=0;
	}

  for (int i = 1;i < M + 1;i++) {
		cin >> s[i][0] >> s[i][1];
	}

	bool result = false;

	if (N == 1) {
        int resultAA = s[1][1];
		cout << resultAA << endl;
        return 0;
	}
	if (N == 2) {
      if(S[1][1]!=0){
        int resultAA = 10 * s[1][1] + 1 * s[2][1];
		cout << resultAA << endl;
        return 0;
      } else{
		cout << -1 << endl;
        return 0;
      }
	}
	if (N == 3) {
      if(S[1][1]!=0 && S[2][1]!=0){
        int resultAA = 100 * s[1][1] + 10 * s[2][1] + 1 * s[3][1];
		cout << resultAA << endl;
        return 0;
      } else{
		cout << -1 << endl;
        return 0;
      }
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:10: error: 'S' was not declared in this scope
   27 |       if(S[1][1]!=0){
      |          ^
a.cc:37:10: error: 'S' was not declared in this scope
   37 |       if(S[1][1]!=0 && S[2][1]!=0){
      |          ^
Language: C++

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

int main() {
  int N;
  int M;
  cin >> N >> M;
  vector<vector<int>> A(M,vector<int>(2));
  for(int i = 0; i < M; i++) {
    cin >> A.at(i).at(0) >> A.at(i).at(1);
  }
  
  bool y = false;
  int z = 1;
  for(int l = 0; l < N; l++){
    z *= 10;
  }
  
  for(int j = 1; j < z; j++) {
    for(int k = 0; k < M; k++){
      int x = 1;
      for(int l = 0; l < A.at(k).at(0); l++){
        x *= 10;
      }
      if(j % x == A.at(k).at(1)) {
        y = true;
      }
      else {
        y = false;
        break;
      }
    }
      if (y == true) {
        cout << x << endl;
        break;
      }
      else if (j == z-1) {
        cout << -1 << endl;
        break;
      }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'x' was not declared in this scope
   34 |         cout << x << endl;
      |                 ^
a.cc:41:2: error: expected '}' at end of input
   41 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
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++) {
            if (result[i] == -1) {
                if (i == 0 && n > 1) {
                    sb.append(1);
                } else {
                    sb.append(0);
                }
            } else {
                sb.append(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<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[i] >> c[i]; if(s[i] == 1 && c[i] == 0 && N != 1){ cout << -1; return 0;}

  for(int i = 0; i < M; i++){
    for(int j = 0; j < M; j++){
      if(s[i] == s[j] && c[i] != c[j]){ cout << -1; return 0; }

    }
  }
  vector<int> z(N);
  for(int i = 0; i < N; i++){
    z[i] = 0;
  }
  for(int i = 0; i < M; i++){
    z[s[i]] = c[i];
  }
  double ans = 0;
  for(int i = 1; i < N + 1; i++){
    ans += (double)z[i]*pow(10.0,(double)(N - i));
  }
  int t = (int) ans;
  int count = 0;
  for(int i = 0; i < N; i++){
    if(t != 0 && count != 0){t /= 10;
    count++;
    }
  }
  if(count != N){cout << -1; return 0;}

  cout << ans << endl;

  return 0;
}





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

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

int main()
{
	int N=0, M=0, s[10][2] //, c[10], A100=0,A10=0,A1=0;
	cin >> N >> M;

	for (int i=0;i<10;i++) {
		s[i][0]=0;
        s[i][1]=0;
	}

  for (int i = 1;i < M + 1;i++) {
		cin >> s[i][0] >> s[i][1];
	}

	bool result = false;

	if (N == 1) {
        int resultAA = s[1][1];
		cout << resultAA << endl;
        return 0;
	}
	if (N == 2) {
      if(S[1][1]!=0){
        int resultAA = 10 * s[1][1] + 1 * s[2][1];
		cout << resultAA << endl;
        return 0;
      } else{
		cout << -1 << endl;
        return 0;
      }
	}
	if (N == 3) {
      if(S[1][1]!=0 && S[2][1]!=0){
        int resultAA = 100 * s[1][1] + 10 * s[2][1] + 1 * s[3][1];
		cout << resultAA << endl;
        return 0;
      } else{
		cout << -1 << endl;
        return 0;
      }
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: expected initializer before 'cin'
    8 |         cin >> N >> M;
      |         ^~~
a.cc:11:17: error: 's' was not declared in this scope
   11 |                 s[i][0]=0;
      |                 ^
a.cc:16:24: error: 's' was not declared in this scope
   16 |                 cin >> s[i][0] >> s[i][1];
      |                        ^
a.cc:22:24: error: 's' was not declared in this scope
   22 |         int resultAA = s[1][1];
      |                        ^
a.cc:27:10: error: 'S' was not declared in this scope
   27 |       if(S[1][1]!=0){
      |          ^
a.cc:28:29: error: 's' was not declared in this scope
   28 |         int resultAA = 10 * s[1][1] + 1 * s[2][1];
      |                             ^
a.cc:37:10: error: 'S' was not declared in this scope
   37 |       if(S[1][1]!=0 && S[2][1]!=0){
      |          ^
a.cc:38:30: error: 's' was not declared in this scope
   38 |         int resultAA = 100 * s[1][1] + 10 * s[2][1] + 1 * s[3][1];
      |                              ^
Language: C++

#include<iostream>
#include<algorithm>//sort函数包含的头文件
using namespace std;
struct p{
	int s,c;
}a[10];
bool comparison(p a,p b){
    return a.s>b.s;
}
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>a[i].s>>a[i].c;
	} 
	sort(a+1,a+m,comparison);
	//cout<<a[1].s<<endl;
	if(a[1].s<n){
		cout<<-1<<endl;
	}
	else{
		int sum[10]={0};
		for(int i=m;i>=1;i--){
			
			sum[i]=a[i].c*pow(10,n-a[i].s);
		}
		sort(sum+1,sum+m);
		int ans=0;
		for(int i=1;i<=m;i++){
			if(sum[i]==sum[i+1]){
				continue;
			}
			ans+=sum[i];
		}
		cout<<ans<<endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:39: error: 'pow' was not declared in this scope
   25 |                         sum[i]=a[i].c*pow(10,n-a[i].s);
      |                                       ^~~
Language: C++

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

int main() {
  int N;
  int M;
  cin >> N >> M;
  vector<vector<int>> A(M,vector<int>(2));
  for(int i = 0; i < M; i++) {
    cin >> A.at(i).at(0) >> A.at(i).at(1);
  }
  
  bool y = false;
  int z = 1;
  for(int l = 0; l < N; l++){
    z *= 10;
  }
  
  for(int j = 1; j < z; j++) {
    for(int k = 0; k < M; k++){
      int x = 1;
      for(int l = 0; l < A.at(k).at(0); l++){
        x *= 10;
      }
      if(j % x == A.at(k).at(0)) {
        y = true;
      }
      else {
        y = false;
        break;
      }
    }
      if (y == true) {
        cout << x << endl;
        break;
      }
      else if (j == z-1) {
        cout << -1 << endl;
        break;
      }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'x' was not declared in this scope
   34 |         cout << x << endl;
      |                 ^
a.cc:41:2: error: expected '}' at end of input
   41 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main(){
    

    ll N, M;
    cin >> N >> M;
    vector<ll > v(N, INF);

    for(ll i = 0; i < M; i++){
        ll s, c; 
        cin >> s >> c;
        if(s == 1 && c == 0) continue;
        v[s-1] = c
    }

    // for(ll i = 0; i < N; i++){
    //     cout << v[i];
    // }
    // cout << endl;

    for(ll i = 0; i < N; i++){
        if(i == 0){
            if(v[i] == INF || v[i] == 0){
                cout << -1 << endl;
                return 0;
            }else{
                cout << v[0];
            }
        }else{
            if(v[i] == INF){
                cout << 0;
            }else{
                cout << v[i];
            }            
        }
    
    }
    cout << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:19: error: expected ';' before '}' token
   23 |         v[s-1] = c
      |                   ^
      |                   ;
   24 |     }
      |     ~
Language: C

#include <stdio.h>
#include <math.h>
int main(void){
  int n;
  int m;
  int s[5];
  int c[5];
  int a;
  int t;
  scanf("%d %d",&n,&m);
  for(int i=0; i<m; i++){
    scanf("%d %d",&s[i],&c[i]);
  }
  int k[n+1];
  for(int i=pow(10,n-1); i<pow(10,n); i++){
    a=0;
    t=i;
    for(int g=n; g>0; g--){
      k[g] = i%10;
      i/=10;
    }
    i=t;
    for(int j=0; j<m; j++){
    	if(k[s[i]]==c[i]){
          a++;
        }
        else{
          break;
        }
    }
    if(a==m){
      print("%d",i);
      break;
    }
  }
  if(a!=m){
    printf("-1");
  }
  return 0;
}
       

Compiler output:
main.c: In function 'main':
main.c:32:7: error: implicit declaration of function 'print'; did you mean 'lrint'? [-Wimplicit-function-declaration]
   32 |       print("%d",i);
      |       ^~~~~
      |       lrint
Language: C++

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

int main() {
  int N;
  int M;
  cin >> N >> M;
  vector<vector<int>> A(M,vector<int>(2));
  for(int i = 0; i < M; i++) {
    cin >> A.at(i).at(0) >> A.at(i).at(1);
  }
  
  bool y = false;
  int z = std::pow(10, N);
  
  for(int j = 1; j < z; j++) {
    for(int k = 0; k < M; k++){
      int x = std::pow(10, A.at(k).at(0));
      if(j % x == A.at(k).at(0)) {
        y = true;
      }
      else {
        y = false;
        break;
      }
    }
      if (y == true) {
        cout << x << endl;
        break;
      }
      else if (j == z-1) {
        cout << -1 << endl;
        break;
      }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: 'x' was not declared in this scope
   28 |         cout << x << endl;
      |                 ^
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

/*
我的心脏怦怦跳，监管者就在附近
name:
Algorithm:
writer:Lxs(cdx)
place:
nothing is impossible
*/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#include<string>
#include<iostream>
#include<cmath>
#include<set>
#include<stack>
#include<queue>
#include<unistd.h>
#include<stdio.h>
#include<cstring>
#define random(a,b) (rand()%(b-a+1)+a)
using namespace std;
bool prime(int x){
	 int i;
	 if(x<2) return 0;
	 for(i=2;i*i<=x;i++){
		if(x%i==0){return 0;}
	 }
	 return 1;
}
int a[1001],n,m,b[1001];
int c[1001];
int main()
{
	int i;
	cin>>n>>m;
	for(i=0;i<1001;i++) c[i]=-1;
	for(i=0;i<m;i++)
	{
		cin>>a[i]>>b[i];
		if(c[a[i]]!=-1){
			cout<<-1;return 0;
		}
		if(b[i]==0&&n==1) cout<<0;return 0;
		else if(b[i]==0&&n!=1) cout<<-1;return 0;
	}
	if(c[1]==-1){
		cout<<-1;return 0;
	}
	else{
	//	if(c[1]!=-1){
		for(i=1;i<=n;i++){
			cout<<c[i];
			}	
		}
		//else cout<<0;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:17: error: 'else' without a previous 'if'
   44 |                 else if(b[i]==0&&n!=1) cout<<-1;return 0;
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
#include<vector>
using namespace std;
  vector<vector<bool>>c(3,vector<bool>(3));
int main() {
    int n,b,c,d;
  cin>>n>>b;
  map<int,int>a;
  for(int i=0;i<3;i++){
      cin>>c>>d;
    if(a.count(c));
    else a.at(1)=1;
      if(a.at(c)==d);
      else{
      cout<<"-1";
      return 0;
      }
    }
    a[c]=d;
  }
  if(a.count(1));
  if(a.at(1)==0){
    cout<<"-1";
    return 0;
  }
  else {
    cout<<"-1";
    return 0;
  }
  for(int i=1;i<=n;i++){
    cout<<a[i];
  }
}

Compiler output:
a.cc:21:3: error: expected unqualified-id before 'if'
   21 |   if(a.count(1));
      |   ^~
a.cc:22:3: error: expected unqualified-id before 'if'
   22 |   if(a.at(1)==0){
      |   ^~
a.cc:26:3: error: expected unqualified-id before 'else'
   26 |   else {
      |   ^~~~
a.cc:30:3: error: expected unqualified-id before 'for'
   30 |   for(int i=1;i<=n;i++){
      |   ^~~
a.cc:30:15: error: 'i' does not name a type
   30 |   for(int i=1;i<=n;i++){
      |               ^
a.cc:30:20: error: 'i' does not name a type
   30 |   for(int i=1;i<=n;i++){
      |                    ^
a.cc:33:1: error: expected declaration before '}' token
   33 | }
      | ^
Language: C++

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<P> num(n);
  num[n-1].first = 1;
  rep(i,n-1) num[i].first = 0;
  rep(i,n) num[i].second = 0;
  int out=0;
  int s, c;
  rep(i,m) {
    cin >> s >> c;
    if ((s==1) && (c==0)) {out = 1; break;}
    if (num[n-s].second==0) {num[n-s].first = c; num[n-s].second = 1;}
#    else if ((num[n-s].second==1) && (num[n-s].first==c)){continue;}
    else {out=1;break;}
  }
  if (out==1) cout << -1 << endl;
  else {
    int ans = num[n-1].first;
    for (int j=n-2;j>=0;--j) ans = 10*ans + num[j].first;
    cout << ans << endl;
  }
}

Compiler output:
a.cc:20:6: error: #else without #if
   20 | #    else if ((num[n-s].second==1) && (num[n-s].first==c)){continue;}
      |      ^~~~
Language: C++

/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)     for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
/*---------------------------------------------------------------------*/
const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    int n,m;
    cin>>n>>m;
    if(n==1)
    {
        if(m==0)
        {
            cout<<-1<<nl;return 0;
        }
        int ans=20;
        while(m--)
        {
             int x,y;
            cin>>x>>y;
            ans=min(ans,y);
        }
        cout<<ans<<nl;return 0;
    }
    vector<int>gu;
    vector<int>aa(n+1,10);
    while(m--)
    {
        int a,b;
        cin>>a>>b;
        aa[a]=min(aa[a],b);
        if(a==1)
        {
            gu.PB(b);
        }
    }
    VSRT(gu);
    for(int i=0;i<SZ(gu);i++)
    {
        if(gu[i]>0)
        {
            aa[1]=gu[i];
            break;
        }
        else
        {
            aa[1]=10;
        }
    }
    if(aa[1]==10||a[1]==0)
    {
        cout<<-1<<nl;
        return 0;
    }
    for(int i=1;i<=n;i++)
    {
        if(aa[i]==10)
        {
            cout<<0;
        }
        else{
            cout<<aa[i];
        }
    }
    cout<<nl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:19: error: 'a' was not declared in this scope; did you mean 'aa'?
   72 |     if(aa[1]==10||a[1]==0)
      |                   ^
      |                   aa
Language: Java

import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int M = in.nextInt();
        int s[] = new int[M];
        int c[] = new int[M];
        for(int i=0; i<M; i++){
            s[i] = in.nextInt();
            c[i] = in.nextInt();
        }

        boolean flag = true;
        int num[] = new int[N];

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

        for(int i=0; i<M; i++){
            if(s[i]-1 > N){
                flag = false;
                break;
            }
            if(num[s[i]-1] == -1){
                num[s[i]-1] = c[i];
            }else{
                if(num[s[i]-1] != c[i]){
                    flag = false;
                    break;
                }
            }
        }

        //
        if(num[0] == 0 && N != 1) flag = false;
        
        if(flag){
            for(int i=0; i<num.length; i++){
                if(i==0){
                    if(num.length != 1 && num[i] == -1) System.out.print("1");
                    else System.out.printf("%d", num[i]);
                }else{
                    if(num[i] == -1) System.out.print("0");
                    else System.out.printf("%d", num[i])
                }     
            }
        }else{
            System.out.print("-1");
        }
    }
}

Compiler output:
Main.java:47: error: ';' expected
                    else System.out.printf("%d", num[i])
                                                        ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define ull     		unsigned long long int
#define ll      		long long int
#define loop(i,s,e)     for(ll i=(s);i<(e);i++)
#define rloop(i,s,e)    for(ll i=(s);i>=(e);i--)
#define scan(any)       for(auto &i:any) cin>>i;
#define print(any)      for(auto i:any) cout<<i<<" "; nl;
#define nl              cout<<'\n'
#define pi 3.141592654
#define hell 1000000007
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define IP(n) int n;cin>>n
#define IP2(a, b) int a,b;cin>>a>>b
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define pii pair<int,int>
#define piii pair<pair<int,int>,int>
#define all(v) (v).begin(), (v).end()
#define sz(x) (int)x.size()
#define set(a,n) memset(a,n,sizeof(a))
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
const int INF = 1<<29;
inline int two(int n) { return 1 << n; }
inline int last_bit(int n) { return n & (-n); }
inline int test(int n, int b) { return (n>>b)&1; }
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline void set_bit(int & n, int b) { n |= two(b); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
/////////////////////////////////////////////////////////////////////////////////
int main()
{
IP2(n,m);
vi s(m);
vi c(m);
int ans1=10,ans2=10,ans3=10;
loop(i,0,m){
cin>>s[i];
cin>>c[i];
if(s[i]==1 && c[i]!=0)
chmin(ans1,c[i]);
if(s[i]==2)
chmin(ans2,c[i]);
if(s[i]==3)
chmin(ans3,c[i]);
if(m==1 && n==1 && c[i]==0)
ans=0;
}
if(ans1==10)
cout<<-1;
else
{
cout<<ans1;
if(ans2==10)
ans2=0;
if(ans3==10)
ans3=0;
if(n>=2)
cout<<ans2;
if(n==3)
cout<<ans3;
}

return 0;
}	


Compiler output:
a.cc: In function 'int main()':
a.cc:59:1: error: 'ans' was not declared in this scope; did you mean 'ans3'?
   59 | ans=0;
      | ^~~
      | ans3