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

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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){
	ll n,m = 0,i,a[5];
	a[1] = a[2] = a[3] = -1;
	cin >> n >> m;
	bool ok = 0;
	while(m--){
		ll x,y;
		cin >> x >> y;
		if(ok)continue;
		if(x == 1 && y == 0){
			ok = 1;
			continue;
		}
		if(a[x] != -1){
			if(a[x] != y){ok = 1 ;continue;}
		}
		a[x] = y;
	}
	if(!ok && n == 1){
		cout << max(a[1] , 0) << nl;
		return ;
	}
	if(ok) cout << -1 << nl;
	else {
		rep(i,1,n+1){
			if(i == 1){
				if(a[i] == -1)cout << 1;
				else cout << a[i];
				continue;
			}
			if(a[i] == -1)cout << 0;
			else cout << a[i];
		}
	}	
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output1.txt","w",stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t = 1;
	// cin >> t;
	for(ll i = 1; i <= t; i++){
		doit();
	}
}


Compiler output:
a.cc: In function 'void doit()':
a.cc:34:28: error: no matching function for call to 'max(long long int&, int)'
   34 |                 cout << max(a[1] , 0) << nl;
      |                         ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:34:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |                 cout << max(a[1] , 0) << nl;
      |                         ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:34:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |                 cout << max(a[1] , 0) << nl;
      |                         ~~~^~~~~~~~~~
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);
  string g;
  for(int i=0;i<N){
    g.push_back('0');
    i++;
  }
  bool can=true;
  int X=0;
  for(int i=0;i<M;i++){
    if(s.at(i)==1) X++;
    if(s.at(i)==1 && c.at(i)==0){
      can=false;
      break;
    }
  }
  int ans=0;
  int m=1;
  if(!can) cout<<-1<<endl;
  else if(X==0){
    g.at(0)='1';
    for(int i=0;i<M;i++) g.at(s.at(i))=c.at(i);
    reverse(g.begin(),g.end());
    for(int i=0;i<M;i++){
      ans +=g.at(i)*m;
      m *=10;
    }
    cout<<ans<<endl;
  }
  else{
    for(int i=0;i<M;i++) g.at(s.at(i))=c.at(i);
    for(int i=0;i<M;i++){
      ans +=g.at(i)*m;
      m *=10;
    }
    cout<<ans<<endl;
  }
    
}



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

#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <math.h>
#define ll long long 
#define PI 3.14159265358979323846
#define INF 10000000000
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;

int main() {
	ll N, M, ans = 0;
	cin >> N >> M;
	vector<ll> s(M), c(M);
	rep(x, M) cin >> s[x] >> c[x];
	vector<ll> keta(N);
	rep(j, M) {
		if (s[j] > N) {
			cout << "-1" << endl;
			return 0;
		}
		if (keta[N - s[j]] == 0 || keta[N - s[j]] == c[j]) {
			keta[N - s[j]] = c[j];
		}
		else{
			cout << "-1" << endl;
			return 0;
		}
	}
	if (N > 1 && keta[N - 1] == 0) {
		cout << "-1" << endl;
		return 0;
	}
	if (N > 2 && keta[0] == 0) keta = 1;
	ll J = 1;
	rep(i, N){
		ans += J * keta[i];
	    J *= 10;
    }
cout << ans << endl;

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:43: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'int')
   40 |         if (N > 2 && keta[0] == 0) keta = 1;
      |                                           ^
In file included from /usr/include/c++/14/vector:72,
                 from a.cc:4:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'int' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: Java

import java.util.*;

public class V{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int m = scan.nextInt();

    boolean [] a = new boolean[n];
    int [] g = new int[n];
    for (int t = 0;t<n;t++){
      a[t] = true;
      g[t] = 0;
    }

    for (int i=0; i<m; i++){
      int b = scan.nextInt();
      if (a[b-1] == false){
        int gg = scan.nextInt();
        if (gg != g[b-1]){
          System.out.println(-1);
          return;
        }
      }
      else{
        a[b-1] = false;
        int c = scan.nextInt();
        g[b-1] = c;
        if ((c == 0)&&(b == 1)&&(n != 1)){
          System.out.println(-1);
          return;
        }
      }
    }

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

    if (g[0] == 0){
      g[0] = 1;
    }

    for (int t = 0;t<n;t++){
      System.out.print(g[t]);
    }
    System.out.println("");
  }
}


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

#include <iostream>
using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> s(M), c(M);
  for (int i = 0; i < M; ++i)
    cin >> s[i] >> c[i];
  
  int first = 1;
  if (N >= 2) first *= 10;
  if (N >= 3) first *= 10;

  int last = 10;
  if (N >= 2) last *= 10;
  if (N >= 3) last *= 10;
  
  int ans = -1;
  for (int num = first; num < last; ++num)
  {
    string num_str = to_string(num);
    bool ok = true;
    for (int m = 0; ok && m < M; ++m)
    {
      if (num_str[s[m]-1] - '0' != c[m])
        ok = false;
    }
    if (ok)
    {
      ans = num;
      break;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> s(M), c(M);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> s(M), c(M);
      |          ^~~
a.cc:10:12: error: 's' was not declared in this scope
   10 |     cin >> s[i] >> c[i];
      |            ^
a.cc:10:20: error: 'c' was not declared in this scope
   10 |     cin >> s[i] >> c[i];
      |                    ^
a.cc:27:19: error: 's' was not declared in this scope
   27 |       if (num_str[s[m]-1] - '0' != c[m])
      |                   ^
a.cc:27:36: error: 'c' was not declared in this scope
   27 |       if (num_str[s[m]-1] - '0' != c[m])
      |                                    ^
Language: C++

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> A(N,0);
  for(int i=0;i<M;i++){
    int s,c;
    cin>>s>>c;
    s--;
    if((A[s]!=0 && A[s]!=c) || (s==0 && c==0)){
      cout<<-1<<endl;
      return 0;
    }
    A[s]=c;
  }
  if(A[0]==0)
    A[0]=1;
  for(int i:A)
    cout<<i;
  cout<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin>>N>>M;
      |   ^~~
a.cc:4:3: error: 'vector' was not declared in this scope
    4 |   vector<int> A(N,0);
      |   ^~~~~~
a.cc:4:10: error: expected primary-expression before 'int'
    4 |   vector<int> A(N,0);
      |          ^~~
a.cc:9:9: error: 'A' was not declared in this scope
    9 |     if((A[s]!=0 && A[s]!=c) || (s==0 && c==0)){
      |         ^
a.cc:10:7: error: 'cout' was not declared in this scope
   10 |       cout<<-1<<endl;
      |       ^~~~
a.cc:10:17: error: 'endl' was not declared in this scope
   10 |       cout<<-1<<endl;
      |                 ^~~~
a.cc:13:5: error: 'A' was not declared in this scope
   13 |     A[s]=c;
      |     ^
a.cc:15:6: error: 'A' was not declared in this scope
   15 |   if(A[0]==0)
      |      ^
a.cc:17:13: error: 'A' was not declared in this scope
   17 |   for(int i:A)
      |             ^
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout<<i;
      |     ^~~~
a.cc:19:3: error: 'cout' was not declared in this scope
   19 |   cout<<endl;
      |   ^~~~
a.cc:19:9: error: 'endl' was not declared in this scope
   19 |   cout<<endl;
      |         ^~~~
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> p(m);
  rep(i,m) cin >> p[i].first >> p[i].second;
  rep(x,1000) {
    int keta = 1;
    int nx = x/10;
    vector<int> d(1,x%10);
    while (nx) {
      keta++;
      d.push_back(nx%10);
      nx /= 10;
    }
    if (keta != n) continue;
    bool ok = true;
    reverse(d.begin(), d.end());
    rep(i,m) {
      if (d[p[i].first-1] != p[i].second) ok = false;
    }
    if (ok) {
      cout << x << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

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

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n, m; cin >> n >> m; 
    vector<int> s(m), c(m);
    rep(i, m) cin >> s[i] >> c[i]; s[i]--;

    int mn, mx;
    if(n==1)mn=0, mx=9;
    if(n==2)mn=10, mx=99;
    if(n==3)mn=100, mx=999;

    int res = -1;
    for(int i=mn; i<=mx; i++){
	bool fg = true;
        string num = to_string(i);
	rep(j, m){
	    if(c[j] != num[s[j]]){fg = false; break;}
	}
        if(fg){res = i; break;}
    }
    cout << res << ln;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:38: error: 'i' was not declared in this scope
   18 |     rep(i, m) cin >> s[i] >> c[i]; s[i]--;
      |                                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
bool flag=false; 
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
signed main()
{
  string ans="";
    LL n,m;
    cin >> n>>m;
      vector<pair<int,bool>> a(m); 
  REP(i,m)a[i]=make_pair(10000,false);
    REP(i,m){
      int t,s;
      cin >> t >>s;
    if(a[t].second==false||a[t].first==s){
      a[t].first=s;
      a[t].second=true;
    }else{
      cout << -1;
    return 0;
     }
    } 
if(a[i].first==0&&n=0){
  cout << 0;
  return 0;
}
  vector
  for(int i = 1; i<=n;i++){
    if(a[i].first!=0)flag=true;
      if(flag){
        if(a[i].first==10000)a[i].first=0;
        ans+=to_string(a[i].first);
      }
    }
   ans[0]=1;
  cout << ans;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:24:6: error: 'i' was not declared in this scope
   24 | if(a[i].first==0&&n=0){
      |      ^
a.cc:29:3: error: expected unqualified-id before 'for'
   29 |   for(int i = 1; i<=n;i++){
      |   ^~~
a.cc:29:18: error: 'i' was not declared in this scope
   29 |   for(int i = 1; i<=n;i++){
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  int s[M];
  string a[N],p[N],c[M];
  for(int i=0;i<M;i++){
    cin>>s[i]>>c[i];
  }
  for(int i=0;i<N;i++){
    a[i]="0";
    p[i]="No";
  }
  
  bool judge=true;
  
  for(int i=0;i<M;i++){
    if(p[s[i]-1]=="No"||a[s[i]-1]==c[i]){
      a[s[i]-1]=c[i];
      p[s[i]-1]="Yes";
    }
    else{
      judge=false;
    }
  }
  string ans;
  if(a[0]=="0"&&N!=1&&p[0]=="No"){
    a[0]="1";
  }
  else if(a[0]=="0"&&N!=1&&p[0]=="Yes"){
    judge=false;
    ]
  for(int i=0;i<N;i++){
    ans+=a[i];
  }
  
  
  if(judge){
    cout<<ans<<endl;
  }
  else{
    cout<<-1<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: expected primary-expression before ']' token
   33 |     ]
      |     ^
a.cc:34:15: error: 'i' was not declared in this scope
   34 |   for(int i=0;i<N;i++){
      |               ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

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

int main() {
  int keta,num;
  int tmp1, tmp2;
  
  cin >> keta >> num;
  
  map<int, int> m;
  vector<int> vec(10,0);
    
  for(int i = 0; i < num; i++){
    cin >> tmp1 >> tmp2;
    
    if(vec.at(tmp1) != 0 && m[tmp1] != tmp2){
      cout << -1;
      return 0;
    }
    
    vec.at(tmp1) += 1;
    m[tmp1] = tmp2;
  }
  
  for(int i = 1; i <= keta; i++){
    if(int i == 1 && m[i] == 0){
      cout << 1;
    }else{
      cout << m[i];
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: expected initializer before '==' token
   26 |     if(int i == 1 && m[i] == 0){
      |              ^~
a.cc:26:13: error: expected ')' before '==' token
   26 |     if(int i == 1 && m[i] == 0){
      |       ~     ^~~
      |             )
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<int> s(m);
  vector<string> c(m);
  for (int i = 0; i < n; i++) cin >> s[i] >> c[i];

  int ans = -1;
  bool exist = true;
  if (n==1) {
    for (int num = 0; num <= 9; num++) {
      string str = to_string(num);
      for (int i = 0; i < m; i++) {
        if (exist==true && string[s[i]-1] == c[i]) exist = true;
        else {
          exist = false;
          break;
        }
      }
      if (exist) {
        ans = num;
        break;
      }
    }
  } else if (n==2) {
    for (int num = 10; num <= 99; num++) {
      string str = to_string(num);
      for (int i = 0; i < m; i++) {
        if (exist==true && string[s[i]-1] == c[i]) exist = true;
        else {
          exist = false;
          break;
        }
      }
      if (exist) {
        ans = num;
        break;
      }
    }
  } else {
    for (int num = 100; num <= 999; num++) {
      string str = to_string(num);
      for (int i = 0; i < m; i++) {
        if (exist==true && string[s[i]-1] == c[i]) exist = true;
        else {
          exist = false;
          break;
        }
      }
      if (exist) {
        ans = num;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:34: error: expected primary-expression before '[' token
   22 |         if (exist==true && string[s[i]-1] == c[i]) exist = true;
      |                                  ^
a.cc:37:34: error: expected primary-expression before '[' token
   37 |         if (exist==true && string[s[i]-1] == c[i]) exist = true;
      |                                  ^
a.cc:52:34: error: expected primary-expression before '[' token
   52 |         if (exist==true && string[s[i]-1] == c[i]) exist = true;
      |                                  ^
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<int> s(m);
  vector<string> c(m);
  for (int i = 0; i < n; i++) cin >> s[i] >> c[i];

  int ans = -1;
  bool exist = true;
  if (n==1) {
    for (int num = 0; num <= 9; num++) {
      string str = to_string(num);
      for (int i = 0; i < m; i++) {
        if (exist==true && string[s[j]-1] == c[i]) exist = true;
        else {
          exist = false;
          break;
        }
      }
      if (exist) {
        ans = num;
        break;
      }
    }
  } else if (n==2) {
    for (int num = 10; num <= 99; num++) {
      string str = to_string(num);
      for (int i = 0; i < m; i++) {
        if (exist==true && string[s[j]-1] == c[i]) exist = true;
        else {
          exist = false;
          break;
        }
      }
      if (exist) {
        ans = num;
        break;
      }
    }
  } else {
    for (int num = 100; num <= 999; num++) {
      string str = to_string(num);
      for (int i = 0; i < m; i++) {
        if (exist==true && string[s[j]-1] == c[i]) exist = true;
        else {
          exist = false;
          break;
        }
      }
      if (exist) {
        ans = num;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:34: error: expected primary-expression before '[' token
   22 |         if (exist==true && string[s[j]-1] == c[i]) exist = true;
      |                                  ^
a.cc:22:37: error: 'j' was not declared in this scope
   22 |         if (exist==true && string[s[j]-1] == c[i]) exist = true;
      |                                     ^
a.cc:37:34: error: expected primary-expression before '[' token
   37 |         if (exist==true && string[s[j]-1] == c[i]) exist = true;
      |                                  ^
a.cc:37:37: error: 'j' was not declared in this scope
   37 |         if (exist==true && string[s[j]-1] == c[i]) exist = true;
      |                                     ^
a.cc:52:34: error: expected primary-expression before '[' token
   52 |         if (exist==true && string[s[j]-1] == c[i]) exist = true;
      |                                  ^
a.cc:52:37: error: 'j' was not declared in this scope
   52 |         if (exist==true && string[s[j]-1] == c[i]) exist = true;
      |                                     ^
Language: Java

import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] s = new int[N];
        int[] c = new int[N];

        Map<Integer, Integer> rules = new HashMap<>();
        for (int i = 0; i < M; i++) {
            s[i] = sc.nextInt();
            c[i] = sc.nextInt();
            //System.out.println(String.format("input: (%d, %d)", s[i], c[i]));
            if (rules.containsKey(s[i])) {
                int v = rules.get(s[i]);
                if (v == c[i]) {
                    // ok
                } else {
                    System.out.println("-1");
                    return;
                }
            } else {
                rules.put(s[i], c[i]);
            }
        }

        int ans = 0;
        for (Map.Entry e : rules.entrySet()) {
            int dig = (Integer)e.getKey();
            int val = (Integer)e.getValue();
            //System.out.println(String.format("(%d, %d)", val, dig));

            if (dig == N && N >= 2) {
                if (val >= 1 && val <= 9) {
                    ans += val * Math.pow(10, N - dig);
                } else {
                    ans = -1;
                    break;
                }
            } else  {
                ans += val * Math.pow(10, N - dig);
            }
        }

        System.out.println(ans);
        return;
    }


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

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<iomanip>
#include<cstring>
#include<string>
#include<set>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll = long long int;

const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(void) {
    int n, m; cin >> n >> m;
    vector<int> a(n);
    vector<bool> b(n);
    bool t = true;
    REP(i, m) {
        int s, c; cin >> s >> c;
        s--;
        if (n != 1 && s == 0 && c == 0) t = false;
        if (b[s] && a[s] != c) t = false;
        a[s] = c; b[s] = true;
    }
    if (t) {
        if (a[0] == 0) s[0] = 1;
        for (auto v : a) cout << v;
    }
    else cout << -1;
    cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:24: error: 's' was not declared in this scope
   36 |         if (a[0] == 0) s[0] = 1;
      |                        ^
Language: C++

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

int main(void) {
    int N, M;
    cin >> N >> M;

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

    for (int i=1; i<=M; i++) {
        if ((s[i] == 1) && (c[i] == 0) && (N == 3)) {
            cout << -1 << endl;
            return 0;
        }
        if ((s[i] == 2) && (c[i] == 0) && (N == 2)) {
            cout << -1 << endl;
            return 0;
        }
    }

    for (int i=1; i<=M; i++) {
        if ((N != 3) && (s[i] == 1)) {
            cout << -1 << endl;
            return 0;
        }
        if ((N != 3) && (N != 2) && (s[i] == 2)) {
            cout << -1 << endl;
            return 0;
        }
    }

    bool R[5] = {false};
    int  D[5] = {0};

    for (int i=1; i<=M; i++) {
        int r = s[i];
        int d = c[i];
        if (R[r] != true) {
            R[r] = true;
            D[r] = d;
            continue;
        }
        if (D[r] != d) {
            cout << -1 << endl;
            return 0;
        }
    }

    if ((N == 3) && (num[1] == 0)) num[1] = 1;
    if ((N == 2) && (num[2] == 0)) num[2] = 1;
    cout << D[1] * 100 + D[2]  * 10 + D[3] << endl;

//    if (N == 3) cout << D[1] * 100 + D[2]  * 10 + D[3] << endl;
//    if (N == 2) cout <<              D[1]  * 10 + D[2] << endl;
//    if (N == 1) cout <<                           D[1] << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:22: error: 'num' was not declared in this scope; did you mean 'enum'?
   53 |     if ((N == 3) && (num[1] == 0)) num[1] = 1;
      |                      ^~~
      |                      enum
a.cc:54:22: error: 'num' was not declared in this scope; did you mean 'enum'?
   54 |     if ((N == 2) && (num[2] == 0)) num[2] = 1;
      |                      ^~~
      |                      enum
Language: C++

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

#define rep(i,n) for (int i=0; i<(n); i++)
const int INF =1001001001;
const ll BIG = 1000000007;
const double PI = 3.141592653589793;

int main(){
    int n, m;
    cin >> n >> m;
    vector<bool> a(n, false);
    string str(n, 'a');
    if(n<m){
        cout << "-1" << endl;
        return 0:
    }
    rep(i,m){
        int s;
        char c;
        cin >> s >> c;
        if(str[s-1]=='a'){
            str.replace(s-1, 1, 1, c);
        }
        else if((int)str[s-1]>(int)c){
            str.replace(s-1, 1, 1, c);
        }
    }
    rep(i,n){
        if(str[i]=='a') str.replace(i, 1, 1, '0');
    }
    if(str[0]=='0'){
        cout << "-1" << endl;
        return 0;
    }
    cout << str << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: expected ';' before ':' token
   20 |         return 0:
      |                 ^
      |                 ;
a.cc:20:17: error: expected primary-expression before ':' token
Language: C++

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

int main() {
    int n,m,ans=1000;
    cin >> n >> m;
    int s,c;
    bool f = true;
    vector<int> l(3,-1);

    rep(i,m){
        cin >> s >> c;
        s--;
        if(l[s]==-1||l[s]==c){
            l[s] = c;
        } else if(l[s]!=c){
            f = false;
        } else {
            l[s] = c;
        }
    }
    string S;
    bool flag=true;
    if(n!=1&&l[0]==0) f = false;
    rep(i,pow(10,n)){
        S = to_string(i);
        rep(j,S.size()){
            if((s[j]!=to_string(l[j]))&&l[j]!=-1){
                flag = false;
            }
        }
        if(flag){
            ans = min(ans,i);
        }
        flag = true;
    }
    if(f&&ans!=1000){
        cout << ans << endl;
    } else cout << -1 <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:18: error: invalid types 'int[int]' for array subscript
   33 |             if((s[j]!=to_string(l[j]))&&l[j]!=-1){
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N,M;
    cin >> N >> M;
    vector<int>ans(N);
    vector<int>ok(N);
    vector<int>flag(N);
    for(int i = 0; i < M; i++) {
        int s,c;
        cin >> s >> c;
        if(s == 1 && c == 0) {
            cout << -1 << endl;
            return 0;
        }
        if(ok[s-1] == c || flag[s-1] == 0) {
            ans[s-1] = c;
            ok[s-1] = c;
            flag[s-1]++;
        }
        else {
            cout << -1 << endl;
            return 0;
        }
    }
    if(N == 1) {
        cout << ans[i];
    }
    else {
    for(int i = 0; i < N; i++) {
        if(i == 0) {
            if(ans[i] == 0 && flag[i] == 0) {
                cout << 1;
            }
            else {
                cout << ans[i];
            }
        }
        else {
            cout << ans[i];
        }
    }
    }
    cout << endl;
}

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

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

int  main()
{
	// ifstream in("in/02-random-00.txt");
	// cin.rdbuf(in.rdbuf());
	int n,m;
	cin >> n >> m;
	int s[m],c[m];
	vector<set<int> > st(n+1);
	int ans;
	st[0].insert(-1);
	rep(i, m)
	{
		cin >> s[i] >> c[i];
		st[s[i]].insert(c[i]);
		if (st[s[i]].size() > 1)
			ans = -1;
		if (n != 1 && s[i] == 1 && c[i] == 0)
			ans = -1;
	}
	if (ans == -1)
	{
		cout << -1 << endl;
		return 0;
	}
	int sum = 0;
	for(int i = 1;i <= n ; i++;)
	{
		if (!st[i].empty())
		{
			rep(j, 10)
			{
				if (st[i].count(j))
				{
					sum *= 10;
					sum += j;
					// cout << j;
					break;
				}
			}
		}
		else
		{
			if (i == 1 && n != 1)
			{
				sum *= 10;
				sum += 1;
				// cout << 1;
			}
			else
			{
				sum *= 10;
				sum += 0;
				// cout << 0;
			}
		}
	}
	cout << sum << endl;
	return (0);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:35: error: expected ')' before ';' token
   33 |         for(int i = 1;i <= n ; i++;)
      |            ~                      ^
      |                                   )
a.cc:33:36: error: expected primary-expression before ')' token
   33 |         for(int i = 1;i <= n ; i++;)
      |                                    ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
ll n,m,s,c,x,y,z,countx,county,countz;

x=-1;
y=-1;
z=-1;
countx=0;
county=0;
countz=0; 

cin >> n >> m;

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

  cin >> s >> c;
    
  if(s==1){
     countx+=1;
    if(countx==1){
      x=x+1;
      x+=c; 
      }else{
        if(c!=x){
          cout << "-1" << endl;
          return 0;
        }
      }
  }
  
  if(s==2){
     county+=1;
    if(county==1){
      y=y+1;
      y+=c; 
      }else{
        if(c!=y){
          cout << "-1" << endl;
          return 0;
        }
      }
  }
    
  if(s==3){
     countz+=1;
    if(countz==1){
      z=z+1;
      z+=c; 
      }else{
        if(c!=z){
          cout << "-1" << endl;
          return 0;
        }
      }
  }
}



if(n==1){
  if(x==-1){
    x=0;
    cout << x << endl;
    return 0;
  }else{
  cout << x << endl;
  return 0;
  }
 }

if(n==2 && ((x*10+y)!=0) && x!=0 ){
  if(x==-1){
    x=1;
    if(y==-1){
      y=0;
    }
    cout << x*10+y << endl;
    return 0;
  }else{
    if(y==-1){
      y=0
    }
  cout << x*10+y << endl;
  return 0;
  }
}
  

if(n==3 && ((x*100+y*10+z)!=0) && x!=0){
  if(x==-1){
    x=1;
    if(y==-1){
      y=0;
    }
     if(z==-1){
      z=0;
    }
    cout << x*100+y*10+z <<endl;
    return 0;
    }else{
      if(y==-1){
      y=0;
    }
     if(z==-1){
      z=0;
    }
  cout << x*100+y*10+z <<endl;
  return 0;
  } 
}

cout << "-1" << endl;

}






Compiler output:
a.cc: In function 'int main()':
a.cc:93:10: error: expected ';' before '}' token
   93 |       y=0
      |          ^
      |          ;
   94 |     }
      |     ~
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())で降順に、*max_element(all(変数))で最大値を獲得
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric>
// xとyのgcdは__gcd(x,y),xとyのlcmは(x*y)/__gcd、accumulate(all(変数),0)で要素の全加算
#include<queue>//priority_queue<型名> 変数
#include<set>
#include<stack>
#include<string>//変数.substr(どこから,いくつ)
#include<vector>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; 0<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
  int n,m;  cin >> n >> m;
  vector<set<int>> x(n);
  rep(i,m){
    int s,c; cin >> s >> c;
    s--;
    x[s].insert(c);
  }
  rep(i,n){
    if(x[i].empty()){
      if(i == 0)  x[i].insert(1);
      else x[i].insert(0);
    }else if(2 <= x[i].size()){
      cout << -1;
      return 0;
    }
  }

  int ans = 0;
  if(n == 1){
    ans += *x[i].begin();
  }else{
    rep(i,n){
      if(i == 0 and *x[i].begin() == 0){
        cout << -1;
        return 0;
      }
      ans *= 10;
      ans += *x[i].begin();
    }
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:15: error: 'i' was not declared in this scope
   47 |     ans += *x[i].begin();
      |               ^
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())で降順に、*max_element(all(変数))で最大値を獲得
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric>
// xとyのgcdは__gcd(x,y),xとyのlcmは(x*y)/__gcd、accumulate(all(変数),0)で要素の全加算
#include<queue>//priority_queue<型名> 変数
#include<set>
#include<stack>
#include<string>//変数.substr(どこから,いくつ)
#include<vector>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; 0<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
  int n,m;  cin >> n >> m;
  vector<vi> x(n);
  rep(i,m){
    int s,c; cin >> s >> c;
    s--;
    x[s].push_back(c);
  }
  rep(i,n){
    if(x[i].size() == 0){
      x[i].push_back(0);
    }
  }
  int ans = 0;
  if(n == 1){
    ans += *min_element(all(x[0]));
  }else{
    rep(i,n){
      if(i == 0){
        if(*max_element(all(x[i])) == 0){
          cout << -1;
          return 0;
        }else{
          sort(all(x[i]));
          int j = 0;
          while(x[i][j] != 0)j++;
          ans += x[j];
        }
      }else{
        ans *= 10;
        ans += *min_element(all(x[i]));
      }
    }
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:15: error: no match for 'operator+=' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'})
   53 |           ans += x[j];
Language: C

#include <stdio.h>
 
int main(void){
	char str[1000];
	int digit,check_times;
	int x = 0;
	int y = 0;
	int z = 0;
	int ans = 0;
	
	fgets(str,sizeof(str),stdin);
	sscanf(str,"%d %d",&digit,&check_times);
	
	for(int i = 0; i < check_times; i++){
		fgets(str,sizeof(str),stdin);
		sscanf(str,"%d %d",&check_digit,&check_num);
		switch(check_digit){
			case 1:
				if(x == 0){
					x = check_num;
				}else if(x != check_num){
					ans = -1
				}
				break;
			case 2:
				if(y == 0){
					y = check_num;
				}else if(y != check_num){
					ans = -1
				}
				break;
			case 3:
				if(z == 0){
					z = check_num;
				}else if(z != check_num){
					ans = -1
				}
				break;
			default:
				break;
		}
	}
	
	switch(digit){
		case 3:
			if(x == 0){
				ans = -1;
			}else{
				x = x * 100;
				y = y * 10;
				z = z;
			}
			break;
		case 2:
			if(x == 0){
				ans = -1;
			}else{
				x = x * 10;
				y = y;
			}
			break;
		case 1:
			x = x;
			break;
		default:
			break;
	}
	
	if(ans == 0){
		ans = x + y + z;
	}
	
	printf("%d\n",ans);
	
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:37: error: 'check_digit' undeclared (first use in this function)
   16 |                 sscanf(str,"%d %d",&check_digit,&check_num);
      |                                     ^~~~~~~~~~~
main.c:16:37: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:50: error: 'check_num' undeclared (first use in this function); did you mean 'check_times'?
   16 |                 sscanf(str,"%d %d",&check_digit,&check_num);
      |                                                  ^~~~~~~~~
      |                                                  check_times
main.c:22:49: error: expected ';' before '}' token
   22 |                                         ans = -1
      |                                                 ^
      |                                                 ;
   23 |                                 }
      |                                 ~                
main.c:29:49: error: expected ';' before '}' token
   29 |                                         ans = -1
      |                                                 ^
      |                                                 ;
   30 |                                 }
      |                                 ~                
main.c:36:49: error: expected ';' before '}' token
   36 |                                         ans = -1
      |                                                 ^
      |                                                 ;
   37 |                                 }
      |                                 ~
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())で降順に、*max_element(all(変数))で最大値を獲得
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric>
//xとyのgcdは__gcd(x,y),xとyのlcmは(x*y)/__gcd、accumulate(all(変数),0)で要素の全加算
#include<queue>//priority_queue<型名> 変数
#include<set>
#include<stack>
#include<string>//変数.substr(どこから,いくつ)
#include<vector>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; 0<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
  int n,m;  cin >> n >> m;
  vector<vi> x(n);
  rep(i,m){
    int s,c; cin >> s >> c;
    s--;
    x[s].push_back(c);
  }
  rep(i,x.size()){
    if(x[i].size() == 0){
      x[i].push_back(0);
    }
  }
  int ans = 0;
  if(n == 1){
    ans += *min_element(all(x[0]);
  }else{
    rep(i,n){
      if(i == 0 and *min_element(all(x[i])) == 0){
        cout << -1;
        return 0;
      }
      ans *= 10;
      ans += *min_element(all(x[i]));
    }
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:34: error: expected ')' before ';' token
   42 |     ans += *min_element(all(x[0]);
      |                        ~         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
//面倒くさいからやめた
string judge1(string X){
}
string judge2(char X[]){
}
string judge3(string X){

}
bool ifmax
int main() {
    int N, M;//Nは桁数、Mは条件の数
    cin >> N >> M;
    bool X = 0;//while文を抜け出すかどうか
    string data[M][2];//条件の桁数,数字
    string S[M];//答えを判定するための変数
    //条件をdataに代入
    for (int i = 0; i < M; i++){
        cin >> data[i][0] >> data[i][1];
    }
    while(1){
        X = 0;
        //Sに1を足す
        if(M ==1)judge1(S);
        if(M ==2)judge2(S);
        if(M ==3)judge3(S);

        for (int i = 0; i < M; i++){
            if(S[data[i][0]]) != data[i][1]){
                X = 1;
            break;
            }
        }
        if(!X)break;
        //Sが最大値に到達しているか
        ;
        ans++;
    }
    if(X)cout << "-1" << endl;
    else cout << "ans" << endl;
}

Compiler output:
a.cc: In function 'std::string judge1(std::string)':
a.cc:5:1: warning: no return statement in function returning non-void [-Wreturn-type]
    5 | }
      | ^
a.cc: In function 'std::string judge2(char*)':
a.cc:7:1: warning: no return statement in function returning non-void [-Wreturn-type]
    7 | }
      | ^
a.cc: In function 'std::string judge3(std::string)':
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
a.cc: At global scope:
a.cc:12:1: error: expected initializer before 'int'
   12 | int main() {
      | ^~~
Language: Java

import java.util.*;
class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int N = sc.nextInt();
        int M = sc.nextInt();
        int ans = 0;
        int[] c = new int[10];
        for(int i=0;i<10;i++) c[i]=100;
        for(int i=0;i<M;i++){
            int s = sc.nextInt();
            if(c[s]==100){
                c[s] = sc.nextInt();
                ans += c[s]*((int)(Math.pow(10,N-s)));
            }
            else if(c[s]!=sc.nextInt()){
                ans = -1;
                break;
            }
            else
              int j = sc.nextInt();
        }
        System.out.println(ans!=0 ? ans:-1);
    }
}

Compiler output:
Main.java:21: error: variable declaration not allowed here
              int j = sc.nextInt();
                  ^
1 error
Language: Java

import java.util.*;
class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int N = sc.nextInt();
        int M = sc.nextInt();
        int ans = 0;
        int[] c = new int[10];
        for(int i=0;i<10;i++) c[i]=100;
        for(int i=0;i<M;i++){
            int s = sc.nextInt();
            if(c[s]==100){
                c[s] = sc.nextInt();
                ans += c[s]*((int)(Math.pow(10,N-s)));
            }
            else if(c[s]!=sc.nextInt()){
                ans = -1;
                break;
            }
            else int j = sc.nextInt();
        }
        System.out.println(ans!=0 ? ans:-1);
    }
}

Compiler output:
Main.java:20: error: variable declaration not allowed here
            else int j = sc.nextInt();
                     ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}
    
const int MAXN = 15;
int n, m, a[MAXN];
bool decided[MAXN];
    
void solve() {
    sc(n); sc(m);
    fo1(i, n) {
        a[i] = 0;
        decided[i] = false;
    }
    int s, c;
    fo(i, n) {
        cin >> s >> c;
        if (decided[s] && a[s] != c) {
            pd(-1);
            return;
        }
        decided[s] = true;
        a[s] = c;
    }
    if (n > 1 && !a[1]) {
        if (decided[1]) {
            pd(-1)
            return;
        }
        a[1] = 1;
    } 
    fo1(i, n) cout << a[i];
}
    
int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:52:13: error: expected ';' before 'return'
   52 |             return;
      |             ^~~~~~
Language: C++

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

int main() {
	long n,m,y = 1;
  	cin >> n >> m;
  	vector<long> s(m);
  	vector<long> c(m);
  	for(long i = 0; i< m; i++){
      cin >> s[i];
      cin >> c[i];
    }
  	for(long i = 0; i< m;){
      if(s[i]==s[i+y)] && c[i]==c[i+1]){
        cout << -1 << endl;
        break;
      else{
        if(y<m){
          y++;
        }
        else{
          i++;
          m=m-1;
        }
      }
        
      }
      }
    }
}	

Compiler output:
a.cc: In function 'int main()':
a.cc:15:21: error: expected ']' before ')' token
   15 |       if(s[i]==s[i+y)] && c[i]==c[i+1]){
      |                     ^
      |                     ]
a.cc:15:22: error: expected primary-expression before ']' token
   15 |       if(s[i]==s[i+y)] && c[i]==c[i+1]){
      |                      ^
a.cc: At global scope:
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

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

int main() {
	long n,m,y = 1;
  	cin >> n >> m;
  	vector<long> s(n);
  	vector<long> c(i);
  	for(long i = 0; i< n; i++){
      cin >> s[i];
      cin >> c[i];
    }
  	for(long i = 0; i< n;){
      if(s[i]==s[i+y)] && c[i]==c[i+1]){
        cout << -1 << endl;
        break;
      else{
        if(y<n){
          y++;
        }
        else{
          i++;
          n=n-1;
        }
      }
        
      }
      }
    }
}	

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: 'i' was not declared in this scope
    9 |         vector<long> c(i);
      |                        ^
a.cc:15:21: error: expected ']' before ')' token
   15 |       if(s[i]==s[i+y)] && c[i]==c[i+1]){
      |                     ^
      |                     ]
a.cc:15:22: error: expected primary-expression before ']' token
   15 |       if(s[i]==s[i+y)] && c[i]==c[i+1]){
      |                      ^
a.cc: At global scope:
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;

int main()
{
    int n,m;
    cin >> n >> m;
    bool flag = true;
    vec<int> num(n,-1);
    int s,c;
    while(cin >> s >> c)
    {
        s--;
        if (num[s]!= -1 and num[s] != c)
        {
            flag = false;
            break;
        }
        else
        {
            num[s] = c;
        }
    }
    if (flag)
    {
        num[0] = max(num[0],1);
        for (auto &&e : num)
        {
            e = max(0,e);
        }
        auto sum = accumulate(num.begin(),num.end(),0,[](auto a,autob)
        {
            return a*10+b;
        })
        cout << sum << endl;
    }
    else
    {
        cout << -1 << endl;
    }
    
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:65: error: 'autob' has not been declared
   32 |         auto sum = accumulate(num.begin(),num.end(),0,[](auto a,autob)
      |                                                                 ^~~~~
a.cc: In lambda function:
a.cc:34:25: error: 'b' was not declared in this scope
   34 |             return a*10+b;
      |                         ^
a.cc: In function 'int main()':
a.cc:36:9: error: expected ',' or ';' before 'cout'
   36 |         cout << sum << endl;
      |         ^~~~