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

import java.util.Scanner;

class Main{

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        String[] s = new String[m];
        String[] c = new String[m];
        for(int i=0; i<m; i++){
            s[i] = scanner.next();
            c[i] = scanner.next();
        }
        scanner.close();
        String[] result = new String[n];
        //初期化
        for(int i=0; i<n; i++){
            result[i] = "";
        }
        for(int i=0; i<m; i++){
            // 2桁以上かつ1桁目が0指定はNG
            if(n>1 && s[i].equals("1") && c[i].equals("0")){
                System.out.println("-1");
                return;
            }
            // 重複はNG
            if(!result[Integer.parseInt(s[i])-1].equals("") && !result[Integer.parseInt(s[i])-1].equals(c[i])){
                System.out.println("-1");
                return;
            }
             result[Integer.parseInt(s[i])-1] = c[i];    
        }
        if(result[0].equals("")){
            result[0]="1";
        }
        if(result[0].equals("") && n=1){
            result[0]="0";
        }
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++){
            if(result[i].equals("")){
                result[i]="0";
            }
            sb.append(result[i]);
        }
        System.out.println(sb.toString());

    }
}

Compiler output:
Main.java:39: error: bad operand types for binary operator '&&'
        if(result[0].equals("") && n=1){
                                ^
  first type:  boolean
  second type: int
1 error
Language: C++

#include <cstdio>
#include <iostream>
using namespace std;
int s[10], c[10];
bool check1(int x)
{
  for(int i = 1; i <= M; i++)
  {
    if(c[i] != x)
      return false;
  }
  return true;
}

bool check2(int x)
{
  int d[3];
  d[1] = x / 10;
  d[2] = x % 10;
  for(int i = 1; i <= M; i++)
  {
    if(d[s[i]] != c[i])
      return false;
  }
  return true;
}

bool check3(int x)
{
  int d[4];
  d[1] = x / 100;
  d[2] = x / 10 % 10;
  d[3] = x % 10;
  for(int i = 1; i <= M; i++)
  {
    if(d[s[i]] != c[i])
      return false;
  }
  return true;
}

int main()
{
  int N, M, i, ans;
  cin >> N >> M;
  for(i = 1; i <= M; i++)
  {
    cin >> s[i] >> c[i];
  }
  if(N==1)
  {
    for(ans = 0; ans <= 9; ans++)
    {
      if(check1(ans))
      {
        cout << ans;
        return 0;
      }
    }
    cout << -1;
    return 0;
  }
  else if(N == 2)
  {
    for(ans = 10; ans <= 99; ans++)
    {
      if(check2(ans))
      {
        cout << ans;
        return 0;
      }
    }
    cout << -1;
    return 0;
  }
  else
  {
    for(ans = 100; ans <= 999; ans++)
    {
      if(check3(ans))
      {
        cout << ans;
        return 0;
      }
    }
    cout << -1;
    return 0;
  }
  return 0;
}

Compiler output:
a.cc: In function 'bool check1(int)':
a.cc:7:23: error: 'M' was not declared in this scope
    7 |   for(int i = 1; i <= M; i++)
      |                       ^
a.cc: In function 'bool check2(int)':
a.cc:20:23: error: 'M' was not declared in this scope
   20 |   for(int i = 1; i <= M; i++)
      |                       ^
a.cc: In function 'bool check3(int)':
a.cc:34:23: error: 'M' was not declared in this scope
   34 |   for(int i = 1; i <= M; i++)
      |                       ^
Language: C++

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

int main()
{
  int n,m;
  cin >> n >> m;
  int arr[n+1];
  for(int i=0;i<=n;i++) arr[i] = -1;
  bool hit = true;
  for(int i=0;i<m;i++)
  {
    int x , c;
    cin >> x >> c;
    if(arr[x] == -1)
    {
      arr[x] = c;
    }
    else 
    {
      hit = false;
      break;
    }
    
  }
  if(hit)
  {
    if(arr[1] == -1) arr[i] = 1;
    for(int i=1;i<=n;i++)
    {
      if(arr[i] == -1) cout << 0;
      else cout << arr[i];
    }
    
  }
  else cout << -1;
  
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: 'i' was not declared in this scope
   28 |     if(arr[1] == -1) arr[i] = 1;
      |                          ^
Language: C++

#include<bits/stdc++.h>

using namespace std;


int main(){
    int s[3] = {0,0,0};
    bool flag = true;
    int n,m ,x ,y ,num = 0;

    cin >> n >> m;

    for (int i = 0; i < m; i++){
        cin >> x >> y;

        if(s[x-1]!=0 && s[x-1]!=y)
            flag = false;
        
        s[x-1] = y;
        
    }
    for (int i = 0; i < n; i++)
    {
        num+= (int)pow(10,i)*s[n-i-1];
        
    }
    if(num == 0 || s[0] == 0{
        flag = false;
    }
    if(flag){
        cout<< num << "\n";
    }
    else{
        cout<< "-1" << "\n";
    }
    
   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:29: error: expected ')' before '{' token
   27 |     if(num == 0 || s[0] == 0{
      |       ~                     ^
      |                             )
a.cc:38:1: error: expected primary-expression before '}' token
   38 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
    int N,M;
    cin >> N >> M;
    vector<int> S(N+1, -1);
    int tmp;
    int tmps;
    int flag=0;//-1を出力しなきゃ！
    //暫定の桁ごとの数字
    for (int i = 1; i <=M; i++) {
        cin >> tmp;
        cin >> tmps;
        if (S[tmp]!=-1 and S[tmp] != tmps){
            flag = 1;
        }
        S[tmp] = tmps;
    }
    int zf = 0;//0フラグ
    int pzf = 0;
    for (int i = 1; i <=N; i++) {
      pzf = 0 ;
      if (S[i] == 0) {
       /* if (zf == 0) {
           S[i] =1;
           zf = 1;
        }
        */
        flag =1;
      } else {
          pzf = zf;
          zf=1;
      }
      if (S[i] == -1) {
        if (pzf == 0) {
              S[i] = 1;
              zf=0
        } else {
          S[i] = 0;
        }
      }
    }
    if (flag == 0){
        for (int i = 1; i <= N; i++) {
            cout << S[i];
        }
    } else {
        cout << -1;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:19: error: expected ';' before '}' token
   38 |               zf=0
      |                   ^
      |                   ;
   39 |         } else {
      |         ~
Language: C++

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

int main(){
	ios::sync_with_stdio(0);
	cout << setprecision(10) << fixed;
	int n, m;
	cin >> n >> m;
	vector<int> ans(n, -1);
	bool flag = true;
	for (int i = 0; i < m; ++i){
		int s, c;
		cin >> s >> c;
		if (ans[s - 1] != -1 && ans[s - 1] != c){
			flag = false;
		}
		else{
			ans[s - 1] = c;
		}
	}
	if (!flag || (ans[0] == 0 && n > 1)){
		cout << -1;
		return 0;
	}
	for (int i = 0; i < n; ++i){
		if (ans[i] != -1) cout << ans[i];
		else if (i == 0) cout << 1;
		else cout << 0；
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:28:30: error: unable to find numeric literal operator 'operator""\U0000ff1b'
   28 |                 else cout << 0；
      |                              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin >> N;
  int M;
  cin >> M;
  
  int count;
  count = 0;
  int s[M-1],c[M-1];
  while(count < M){
    cin >> s[count] >> c[count];
    count++;
  }
  int answer;
  int x,y,z;
  x = 0;
  y = 0;
  z = 0;
  for(int i = 0; i < M; i++){
    s[i] = N-s[i]+1;
    if (s[i] == 1)
      z = c[i];
    else if(s[i] == 2)
      y = c[i];
    else if(s[i] ==3)
      x = c[i];
  }
    for(int i =0; i < M; i++){
    for(int j = 0; j < M; j++){ 
      if((s[i] == s[j]){
        if(s[i] == 1)
          z = min(c[i],c[j]) ;
        else if(s[i] == 2)
          y = min(c[i],c[j]) ;
        else if(s[i] == 3)
          x = min(c[i],c[j]);
      }
         
    }
  }
  
  
  answer = x*100 + y*10 + z; 
  for(int i = 0; i < M ; i++){
	if((s[i] == 1) && (c[i] == 0))
      answer = -1;
  }
  for(int i =0; i < M; i++){
    for(int j = 0; j < M; j++){ 
      if((s[i] == s[j]) && (c[i] != c[j]))
         answer = -1;
    }
  }        
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:24: error: expected ')' before '{' token
   33 |       if((s[i] == s[j]){
      |         ~              ^
      |                        )
a.cc:42:5: error: expected primary-expression before '}' token
   42 |     }
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin >> N;
  int M;
  cin >> M;
  
  int count;
  count = 0;
  int s[M-1],c[M-1];
  while(count < M){
    cin >> s[count] >> c[count];
    count++;
  }
  int answer;
  int x,y,z;
  x = 0;
  y = 0;
  z = 0;
  for(int i = 0; i < M; i++){
    s[i] = N-s[i]+1;
    if (s[i] == 1)
      z = c[i];
    else if(s[i] == 2)
      y = c[i];
    else if(s[i] ==3)
      x = c[i];
  }
    for(int i =0; i < M; i++){
    for(int j = 0; j < M; j++){ 
      if((s[i] == s[j]){
        if(s[i] == 1)
          z = min(c[i],c[j]) ;
        else if(s[i] == 2)
          y = min(c[i],c[j]) ;
        else if(s[i] == 3)
          x = min(c[i],c[j]);
      }
         
    }
  }
  
  
  answer = x*100 + y*10 + z; 
  for(int i = 0; i < M ; i+;){
	if((s[i] == 1) && (c[i] == 0))
      answer = -1;
  }
  for(int i =0; i < M; i++){
    for(int j = 0; j < M; j++){ 
      if((s[i] == s[j]) && (c[i] != c[j]))
         answer = -1;
    }
  }        
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:24: error: expected ')' before '{' token
   33 |       if((s[i] == s[j]){
      |         ~              ^
      |                        )
a.cc:42:5: error: expected primary-expression before '}' token
   42 |     }
      |     ^
a.cc:47:28: error: expected primary-expression before ';' token
   47 |   for(int i = 0; i < M ; i+;){
      |                            ^
a.cc:47:28: error: expected ')' before ';' token
   47 |   for(int i = 0; i < M ; i+;){
      |      ~                     ^
      |                            )
a.cc:47:29: error: expected primary-expression before ')' token
   47 |   for(int i = 0; i < M ; i+;){
      |                             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define ALL(x) (x).begin(),(x).end()

int n, m;
string s;

void main() {
	char s;
	cin >> n >> m;
	string ans = "0";
	rep(i, n - 1)ans += "0";
	vector<bool> f(n, false);
	rep(i, m) {
		cin >> k >> s;
		k--;
		if (f[k] == 0) {
			ans[k] = s;
			f[k] = 1;
		}
		else {
			if (ans[k] == s)continue;
			else {
				cout << -1;
				return;
			}
		}
	}

	if (n > 1 && f[0] == true && ans[0] == '0') {
		ans = "-1";
		cout << ans;
		return;
	}
	else if (n > 1 && f[0] == false && ans[0] == '0')ans[0] = '1';
	cout << stoi(ans);
}



Compiler output:
a.cc:9:1: error: '::main' must return 'int'
    9 | void main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:13:13: error: 'i' was not declared in this scope
   13 |         rep(i, n - 1)ans += "0";
      |             ^
a.cc:3:23: note: in definition of macro 'rep'
    3 | #define rep(i,n) repi(i,0,n)
      |                       ^
a.cc:3:18: error: 'repi' was not declared in this scope; did you mean 'rep'?
    3 | #define rep(i,n) repi(i,0,n)
      |                  ^~~~
a.cc:13:9: note: in expansion of macro 'rep'
   13 |         rep(i, n - 1)ans += "0";
      |         ^~~
a.cc:34:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   34 |                 return;
      |                 ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using long long ll;
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:
a.cc:4:7: error: expected nested-name-specifier before 'long'
    4 | using long long ll;
      |       ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using long long ll;
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:
a.cc:4:7: error: expected nested-name-specifier before 'long'
    4 | using long long ll;
      |       ^~~~
a.cc: In function 'int main()':
a.cc:25:39: error: expected ']' before ')' token
   25 |       if(d[p[i].first-1 != p[i].second) ok = false;
      |                                       ^
      |                                       ]
Language: C++

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
struct node{
	int s,c;
}s[10];
bool cmp(node x,node y){
	return x.s<=y.s;
}
int main(){
	int m,n,v[10];
	memset(v,0,sizeof(v));
	cin>>n>>m;
	for(int i=0;i<m;i++) cin>>s[i].s>>s[i].c;
	bool f=true;
	sort(s,s+m,cmp);
	for(int i=1;i<m;i++){
		if(s[i].s==s[i-1].s&&s[i].c!=s[i-1].c){
			f=false;break;
		}
	}
	if(s[0].s==1&&s[0].c==0&&n!=1) f=false;
	int ans=0,t;
	if(s[i].s!=1) ans=ans+1*pow(10,n-1);
	for(int i=1;i<m;i++){
		if(s[i].s==s[i-1].s) v[i]=1;
	}
	for(int i=0;i<m;i++){
		if(v[i]==1) continue;
		t=n-s[i].s;
		ans=ans+s[i].c*pow(10,t);
	}
	if(f) cout<<ans;
	else cout<<-1;
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: 'i' was not declared in this scope
   26 |         if(s[i].s!=1) ans=ans+1*pow(10,n-1);
      |              ^
Language: C++

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

using namespace std;


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

    int wrong = -1
    int keta[3];
    rep(i,3) keta[i] = -1;
    rep(i,m) {
        rep(j,n) {
            if ((c[i] != keta[s[i]-1]) && (keta[s[i]-1] > -1)) {
                cout << wrong << endl;
                return 0;
            }
        }
        keta[s[i]-1] = c[i];
    }

    // cout << keta[0] << keta[1] << keta[2] << endl;
    
    if (keta[n-1] < 0) {
        cout << wrong << endl;
        return 0;
    }
    
    
    rep(i,n) {
        if (keta[i]<0) {
            keta[i] = 0;
        }
    }
    
    int res = keta[0]*100 + 10*keta[1] + keta[2];
    
    cout << res << endl;
    
    
    
    
    
    return 0;
    
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: expected ',' or ';' before 'int'
   14 |     int keta[3];
      |     ^~~
a.cc:15:14: error: 'keta' was not declared in this scope
   15 |     rep(i,3) keta[i] = -1;
      |              ^~~~
a.cc:18:26: error: 'keta' was not declared in this scope
   18 |             if ((c[i] != keta[s[i]-1]) && (keta[s[i]-1] > -1)) {
      |                          ^~~~
a.cc:23:9: error: 'keta' was not declared in this scope
   23 |         keta[s[i]-1] = c[i];
      |         ^~~~
a.cc:28:9: error: 'keta' was not declared in this scope
   28 |     if (keta[n-1] < 0) {
      |         ^~~~
a.cc:35:13: error: 'keta' was not declared in this scope
   35 |         if (keta[i]<0) {
      |             ^~~~
a.cc:40:15: error: 'keta' was not declared in this scope
   40 |     int res = keta[0]*100 + 10*keta[1] + keta[2];
      |               ^~~~
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int flg = 0;
    if(N == 1 && M == 0){
        System.out.println("0");
        flg = 1;
    }
    int[] n = new int[N];
    int[] flg = new int[N];
    for(int i = 0; i < M; i++){
      int s = sc.nextInt();
      int c = sc.nextInt();
      if(N == 1 && M == 1){
        System.out.println(c);
        flg = 1;
        break;
      } else if(s == 1 && c == 0){
        System.out.println("-1");
        flg = 1;
        break;
      } else if(n[s - 1] == 0 || n[s - 1] == c || flg[s - 1] == 0){
        n[s - 1] = c;
        flg[s - 1] = 1;
      } else {
        System.out.println("-1");
        flg = 1;
        break;
      }
    }
    if(N != 1 && n[0] == 0){
      n[0] = 1;
    }
    if(flg == 0){
      for(int i = 0; i < N; i++){
        System.out.print(n[i]);
      }
    }
  }
}
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int flg = 0;
    if(N == 1 && M == 0){
        System.out.println("0");
        flg = 1;
    }
    int[] n = new int[N];
    int[] flg2 = new int[N];
    for(int i = 0; i < M; i++){
      int s = sc.nextInt();
      int c = sc.nextInt();
      if(N == 1 && M == 1){
        System.out.println(c);
        flg = 1;
        break;
      } else if(s == 1 && c == 0){
        System.out.println("-1");
        flg = 1;
        break;
      } else if(n[s - 1] == 0 || n[s - 1] == c || flg2[s - 1] == 0){
        n[s - 1] = c;
        flg2[s - 1] = 1;
      } else {
        System.out.println("-1");
        flg = 1;
        break;
      }
    }
    if(N != 1 && n[0] == 0){
      n[0] = 1;
    }
    if(flg == 0){
      for(int i = 0; i < N; i++){
        System.out.print(n[i]);
      }
    }
  }
}


Compiler output:
Main.java:44: error: class, interface, enum, or record expected
import java.util.*;
^
1 error
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int flg = 0;
    if(N == 1 && M == 0){
        System.out.println("0");
        flg = 1;
    }
    int[] n = new int[N];
    int[] flg = new int[N];
    for(int i = 0; i < M; i++){
      int s = sc.nextInt();
      int c = sc.nextInt();
      if(N == 1 && M == 1){
        System.out.println(c);
        flg = 1;
        break;
      } else if(s == 1 && c == 0){
        System.out.println("-1");
        flg = 1;
        break;
      } else if(n[s - 1] == 0 || n[s - 1] == c || flg[s - 1] == 0){
        n[s - 1] = c;
        flg[s - 1] = 1;
      } else {
        System.out.println("-1");
        flg = 1;
        break;
      }
    }
    if(N != 1 && n[0] == 0){
      n[0] = 1;
    }
    if(flg == 0){
      for(int i = 0; i < N; i++){
        System.out.print(n[i]);
      }
    }
  }
}


Compiler output:
Main.java:13: error: variable flg is already defined in method main(String[])
    int[] flg = new int[N];
          ^
Main.java:19: error: incompatible types: int cannot be converted to int[]
        flg = 1;
              ^
Main.java:23: error: incompatible types: int cannot be converted to int[]
        flg = 1;
              ^
Main.java:30: error: incompatible types: int cannot be converted to int[]
        flg = 1;
              ^
Main.java:37: error: bad operand types for binary operator '=='
    if(flg == 0){
           ^
  first type:  int[]
  second type: int
5 errors
Language: C++

N, M = map(int, input().split())
ans = [0] * N
for _ in range(M):
	s, v = map(int, input().split())
	i = s - 1
	if N != 1 and i == 0 and v == 0:
		print(-1)
		break
	elif ans[i] and ans[i] != v:
		print(-1)
		break
	ans[i] = v
else:
	if ans[0] == 0:
		ans[0] = 1
	print(*ans, sep='')


Compiler output:
a.cc:16:25: error: empty character constant
   16 |         print(*ans, sep='')
      |                         ^~
a.cc:1:1: error: 'N' does not name a type
    1 | N, M = map(int, input().split())
      | ^
Language: C++

//abc157-3
//date 03/05
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

int main(void)
{
  int N   = 0;          //N
  int M   = 0;          //M
  int ans = 0;          //最小値
  int cal = 1;          //作業用
  bool flag = true;     //矛盾がないか確認
  int s[5]    = {0};    //s[i]
  int c[5]    = {0};    //c[i]
  int rank[3] = {-1};   //各桁の値

  //値の読み込み
  scanf("%d %d",&N,&M );
  for (size_t i = 0; i < M; i++) {
    scanf("%d %d", &s[i], &c[i]);
  }

  //存在しない
  if (M == 0 && N != 1) {
    flag = false;
  }

  for (size_t i = 0; i < M; i++) {
    //左端の位の値が0となる場合
    if (s[i] == 1 && c[i] == 0 && N>=2) {
      flag = false;
    }
    //同じ位を表しているのに、異なる数値が表されている場合
    for (size_t j = i; j < M; j++){
      if (s[i] == s[j] && c[i] != c[j]) {
        flag = false;
      }
    }
    //左からs[i]番目の数値をrank[s[i]-1]に格納
    rank[s[i]-1] = c[i];
  }

  //出力部
  //存在しない
  if (flag == false) {
    printf("-1\n" );
  }
  //存在する
  else{
    if (rank[0] == -1　&& N >= 2) {
      if (N >= 2) {
        rank[0] = 1;
      }else rank[0] = 0;
    }
    for (size_t i = 0; i < N; i++) {
      cal = 1;
      //printf("rank[%d] = %d\n",i,rank[i] );
      if (rank[i] != -1) {
        //calに10^(N-1-i)を格納
        for (size_t j = i; j < N-1; j++) {
          cal*=10;
        }
        //足し合わせ
        ans += rank[i] * cal;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}


Compiler output:
a.cc:51:21: error: extended character 　 is not valid in an identifier
   51 |     if (rank[0] == -1　&& N >= 2) {
      |                     ^
a.cc: In function 'int main()':
a.cc:51:21: error: unable to find numeric literal operator 'operator""\U00003000'
   51 |     if (rank[0] == -1　&& N >= 2) {
      |                     ^~~
Language: C++

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

int main() {
	vector<pair<int, int>> x(100), y(100);
	int i;
	int n, m, o, t, h;
	o = t = h = 10;
	cin >> n >> m;
	vector<int> s(m), c(m);
	for(i = 0; i < m; ++i) {
		cin >> s.at(i) >> c.at(i);
		if(n == 1 && c.at(i) == 0) {
			cout << 0 << endl;
			return 0;
		}
		(s.at(i) == 1 ? o = min(o, c.at(i)) : 
			(s.at(i) == 2 ? t = min(t, c.at(i)) : h = min(h, c.at(i))));
		x.at(s.at(i)).first += 1;
		if(x.at(s.at(i)).first > 0 && c.at(i) == x.at(s.at(i)).second) {
			x.at(s.at(i)).first -= 1;
			x.at(s.at(i)).second = c.at(i);
		}
		if(x.at(s.at(i)).second == 0)
			x.at(s.at(i)).second = c.at(i);
		else if(x.at(s.at(i)).second != c.at(i)) {
			cout << "-1" << endl;
			return 0;
		}
		if(x.at(s.at(i)).second == c.at(i))
			x.at(s.at(i)).first = 1;
			cout << "-1" << endl;
			return 0;
		}
		if(x.at(s.at(i)).first != 0)
			if(x.at(s.at(i)).second != c.at(i)) {
				cout << "-1" << endl;
				return 0;
			}
	}
	if(o == 10)
		o = 1;
	if(t == 10)
		t = 0;
	if(h == 10)
		h = 0;
	cout << o;
	if(n == 2)
		cout << t;
	if(n == 3)
		cout << t << h;
	cout << endl;

}


Compiler output:
a.cc:43:9: error: expected unqualified-id before 'if'
   43 |         if(o == 10)
      |         ^~
a.cc:45:9: error: expected unqualified-id before 'if'
   45 |         if(t == 10)
      |         ^~
a.cc:47:9: error: expected unqualified-id before 'if'
   47 |         if(h == 10)
      |         ^~
a.cc:49:9: error: 'cout' does not name a type
   49 |         cout << o;
      |         ^~~~
a.cc:50:9: error: expected unqualified-id before 'if'
   50 |         if(n == 2)
      |         ^~
a.cc:52:9: error: expected unqualified-id before 'if'
   52 |         if(n == 3)
      |         ^~
a.cc:54:9: error: 'cout' does not name a type
   54 |         cout << endl;
      |         ^~~~
a.cc:56:1: error: expected declaration before '}' token
   56 | }
      | ^
Language: C++

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

int main() {
	vector<pair<int, int>> x(100), y(100);
	int n, m, o, t, h;
	o = t = h = 10;
	cin >> n >> m;
	vector<int> s(m), c(m);
	for(int i = 0; i < m; ++i) {
		cin >> s.at(i) >> c.at(i);
		if(n == 1 && c.at(i) == 0) {
			cout << 0 << endl;
			return 0;
		}
		(s.at(i) == 1 ? o = min(o, c.at(i)) : 
			(s.at(i) == 2 ? t = min(t, c.at(i)) : h = min(h, c.at(i))));
		x.at(s.at(i)).first += 1;
		if(x.at(s.at(i)).first > 0 && c.at(i) == x.at(s.at(i)).second) {
			x.at(s.at(i)).first -= 1;
			x.at(s.at(i)).second = c.at(i);
		}
		if(x.at(s.at(i)).second == 0)
			x.at(s.at(i)).second = c.at(i);
		else if(x.at(s.at(i)).second != c.at(i)) {
			cout << "-1" << endl;
			return 0;
		}
		if(x.at(s.at(i)).second == c.at(i))
			x.at(s.at(i)).first = 1;
			cout << "-1" << endl;
			return 0;
		}
		if(x.at(s.at(i)).first != 0)
			if(x.at(s.at(i)).second != c.at(i)) {
				cout << "-1" << endl;
				return 0;
			}
	}
	if(o == 10) {
		o = 1;
		if(n == 1)
			o = 0;
	}
	if(t == 10) {
		t = 0;
	}
	if(h == 10)
		h = 0;

	cout << o;
	if(n == 2)
		cout << t;
	if(n == 3)
		cout << t << h;
	cout << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:30: error: 'i' was not declared in this scope
   36 |                 if(x.at(s.at(i)).first != 0)
      |                              ^
a.cc: At global scope:
a.cc:42:9: error: expected unqualified-id before 'if'
   42 |         if(o == 10) {
      |         ^~
a.cc:47:9: error: expected unqualified-id before 'if'
   47 |         if(t == 10) {
      |         ^~
a.cc:50:9: error: expected unqualified-id before 'if'
   50 |         if(h == 10)
      |         ^~
a.cc:53:9: error: 'cout' does not name a type
   53 |         cout << o;
      |         ^~~~
a.cc:54:9: error: expected unqualified-id before 'if'
   54 |         if(n == 2)
      |         ^~
a.cc:56:9: error: expected unqualified-id before 'if'
   56 |         if(n == 3)
      |         ^~
a.cc:58:9: error: 'cout' does not name a type
   58 |         cout << endl;
      |         ^~~~
a.cc:60:1: error: expected declaration before '}' token
   60 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

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

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

	int res = 0;
	for (int i = 0; i < M; i++) {
		int _keta = 0; 
		if (3 - s[i] == 2) { _keta = 100; }
		if (3 - s[i] == 1) { _keta = 10; }
		if (3 - s[i] == 0) { _keta = 1; }
		res += (c[i] * _keta);
	}

	if (to_string(res).length != N) {
		if (N == 3) {res += 100;}
		if (N == 2) {res += 10;}
	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:36:28: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   36 |         if (to_string(res).length != N) {
      |             ~~~~~~~~~~~~~~~^~~~~~
      |                                  ()
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:
a.cc: In function 'int main()':
a.cc:25:18: error: expected ',' before '[' token
   25 |             if([d[p[i].first-1] != p[i].second) ok = false;
      |                  ^
      |                  ,
a.cc:25:18: error: expected identifier before '[' token
a.cc:25:48: error: expected ']' before 'ok'
   25 |             if([d[p[i].first-1] != p[i].second) ok = false;
      |                                                ^~~
      |                                                ]
a.cc: In lambda function:
a.cc:25:49: error: expected '{' before 'ok'
   25 |             if([d[p[i].first-1] != p[i].second) ok = false;
      |                                                 ^~
a.cc: In function 'int main()':
a.cc:25:48: error: expected ')' before 'ok'
   25 |             if([d[p[i].first-1] != p[i].second) ok = false;
      |               ~                                ^~~
      |                                                )
a.cc:25:16: error: could not convert '<lambda closure object>main()::<lambda()>{std::vector<int>(d)}' from 'main()::<lambda()>' to 'bool'
   25 |             if([d[p[i].first-1] != p[i].second) ok = false;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                |
      |                main()::<lambda()>
Language: C++

#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) x.begin(), x.end()
#define inf 1e9
#define INF 1e15
#define fastio ios::sync_with_stdio(false);cin.tie(0);
#define endl '\n'
#define for_n(i,n) for(int i=0;i<n;i++)

////////////////////////////////////////////////////////////
using namespace std;
 
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<ii> vii;

int di[5];
int main() {
	int n, m; cin >> n >> m;
	fill(di,di+5, -1);
	bool sh = false;
	for_n(i,m) {
		int s, c; cin >> s >> c;
		s--;
		if(di[s] == -1)
			di[s] = c;
		else sh = true;
	}
	if(di[0] == 0 && n > 1) sh = true;
	if(di[0] == -1) di[0] = 1;
	for(int i=1;i<n;i++) {
		if(di[i] == -1) di[i] = 0;
	}
	if(sh) {
		cout << -1;
		return;
	}
	for_n(i,m) cout << di[i];
}

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

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

int main(void){
    
    int i,j,k,N,M,temp;
    scanf("%d %d",&N,&M);
    if(M == 0){
        if(N==1){
        printf("%d",0);
        exit(0);
        }
        else if(N==2){
            print("%d",10);
            exit(0);
        }
        else if(N==3){
            printf("%d",100);
            exit(0);
        }
    }
    int sarr[M],carr[M],ans[N];
    for(i=0 ;i<M ;i++){
        scanf("%d %d",&sarr[i],&carr[i]);
    }
    for(i=0 ;i<M ; i++){
        if((sarr[i]==1 && carr[i]==0) && N !=1) {
            printf("%d",-1);
            exit(0);
        }
    }
    for(i=0 ;i<M ; i++){
        for(j=i+1 ; j<M ;j++){
                if(sarr[i] == sarr[j]){
                    if(carr[i] != carr[j]) {
                        printf("%d",-1);
                        exit(0);
                    }
                }
        }
    }
    for(j=1;j<N+1;j++){
        for(i=0 ;i<M ; i++){
            if(sarr[i]==j){
                ans[j-1]= carr[i];
                break;
            }
            else{
                if(i == M-1){
                    if(j == 1){
                        if(N == 1){
                            ans[j-1] =0;
                        }
                        else{
                            ans[j-1] =1;
                        }
                    }
                    else{
                        ans[j-1] =0;
                    }
                }
            }
        }
    }
    temp =0;
    for(i=0;i<N;i++){
        k=1;
        for(j=0; j<N-i-1;j++){
            k *= 10;
        }
        temp += ans[i] * k;
    }
    printf("%d",temp); 
    return 0;   
}



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

int main(){
    int Flg = 0;

    int N, M;
    cin >> N >> M;

    int range_1 = pow(10, N-1);
    int range_2 = pow(10, N);
    
    int s[M];
    int c[M];

    for (int i=0;i<M;i++){
        cin >> s[i] >> c[i];
    }
    for (int i=range_1-1; i < range_2; i++){
        int x = i;
        int num[3] = {-1,-1,-1};
        int count = 0;

        while(true){
            int r = x % 10;//余り
            int q = x / 10;//商

            num[count] = r;

            x = q;
            if(q==0) break;
            ++count;
        }

        int a = num[0];
        num[0] = num[2];
        num[2] = a;

        for (int i=0;i<M;i++){
            if (num[s[i]-1] == c[i]) Flg = 1;
            else {
                Flg = 2;
                break;
            }
        }

        if(Flg == 1){
            cout << i;
            break;
        }
    }
    if(Flg == 2){
        cout << -1;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> N >> M;
      |     ^~~
a.cc:7:19: error: 'pow' was not declared in this scope
    7 |     int range_1 = pow(10, N-1);
      |                   ^~~
a.cc:45:13: error: 'cout' was not declared in this scope; did you mean 'count'?
   45 |             cout << i;
      |             ^~~~
      |             count
a.cc:50:9: error: 'cout' was not declared in this scope
   50 |         cout << -1;
      |         ^~~~
Language: C++

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

int ans[10];
int n,m;
int main(){
	cin>>n>>m;	
	for(int i=1;i<=m;i++){
		int s,c;
		cin>>s>>c;
		if(s==1&&c==0&&n>1){ cout<<-1;return 0;}
		else if(ans[s-1]==0|| ans[s-1]==c) ans[s-1]=c;
		else { cout<<-1;return 0;}
	}
	if(n==1) cout<<ans[i];
	else 
	{
		if(ans[0])cout<<ans[0];
		else cout<<1;
		for(int i=1;i<n;i++) cout<<ans[i];
	}
}

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

//
//  main.cpp
//  ABC157C3
//
#include <iostream>
#include<vector> // vectorを使う
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using P=pair<int,int>;
int main(int argc, const char * argv[]) {
    int N,M;
    cin>>N>>M;
    vector<P>t(M);
    rep(i,M){
        cin>>t[i].first>>t[i].second;
    }
    // 0から999まで試してみる
    rep(x,1000){
        int nx=x;
        vector<int>d(1);
        d[0]=nx%10;
        nx=nx/10;
        while(nx){
            d.push_back(nx%10);
            nx=nx/10;
        }
        if(d.size()!=N){
            continue;
        }
        reverse(d.begin(), d.end());
        bool ok=true;
        rep(i,M){
            if (d[t[i].first-1]!=t[i].second) {
                ok=false;
            }
        }
        if(ok){
            cout<<x<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:30:9: error: 'reverse' was not declared in this scope
   30 |         reverse(d.begin(), d.end());
      |         ^~~~~~~
Language: C++

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

int main(){
    int n,m;
    int s[3];
    cin  >> n >> m;
    int t1,t2;
    s[0]=-1;
    s[1]=-1;
    s[2]=-1;
    bool flag = 0;
    for(int i=0;i<m;i++){
        cin >> t1 >> t2;
        if(s[t1-1] == -1)s[t1-1] = t2;
        else if(s[t1-1] != t2)flag = 1;
    }

    if(n == 1){
        if(s[1] != -1 || s[2] != -1)flag = 1;
        if(flag){
            cout << -1 << endl;
            return 0;
        }
        if(s[0] == -1)s[0] = 0;
        cout << s[0] <<endl;
        return 0;
    }

    if(n == 2){
        if(s[2] != -1 || s[0] == 0)flag = 1;
        if(s[0] == -1)s[0]=1;
        if(s[1] == -1)s[1]=0;
        
        if(flag){
            cout << -1 << endl;
            return 0;
        }
        cout << s[0]*10+s[1] << endl;
        return 0;
    }

    if(n == 3){
        if(s[0] == 0)flag=1;
        if(flag){
            cout <<-1 << endl;
            return 0;
        }
            if(s[0] == -1)s[0]=1;
            if(s[1] == -1)s[1]=0;
            if(s[2] == -1)s[2]=0;
            cout << s[0]*100+s[1]*10+s[2] <<endl;
            return 0;
        
       
}

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

#include<bits/stdc++.h>
using namespace std;
string sm="";
int a[6],b[6];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>a[i]>>b[i];
		b[i]+=48;
		a[i]--;
	}
	int o=1;
	for(int i=0;i<n;i++)
	{
		o*=10;
	}
	for(int i=o/10;i<o;i++)
	{
		int u=1;
		for(int c=10;c<=i;c*=10)
		{
			u=c/10;
			int t=i%c;
			t/=u;
			char p=t+48;
			sm.push_back(p);
		}
//		都反过来，Don't reverse(sm.begin(),sm.end());
		for(int x=0;x<m;x++)
		{
			if(sm[a[x]]!=b)
			{
				continue;
			}
		}
		reverse(sm.begin(),sm.end());
		if(sm[0]=='0')
		{
			continue;
		}
		cout<<sm;
		return 0;
	}
	cout<<"-1"; 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |                         if(sm[a[x]]!=b)
Language: C++

#include <iostream>
#include <string>
#include <cmath>
using namespace std;
typedef long long llint;
llint n,m;
llint a[5];

void solve(){
  cin >> n >> m;
  llint s, c;
  for(int i = 1; i <= n; i++) a[i] = -1;
  for(int i = 1; i <= m; i++){
    cin >> s >> c;
    if(a[s] != -1 && a[s] != c){
      cout << -1 << endl;
      exit();
    }
    a[s] = c;
  }

  if(n == 1){
    if(a[1] <= 0){
      cout << 0 << endl;
      exit();
    }
  }

  if(a[1] == 0){
    cout << -1 << endl;
    exit();
  }
  if(a[1] == -1) a[1] = 1;
  for(int i = 2; i <= n; i++){
    if(a[i] == -1) a[i] = 0;
  }

  for(int i = 1; i<= n; i++)  cout << a[i]; cout << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:17:11: error: too few arguments to function 'void exit(int)'
   17 |       exit();
      |       ~~~~^~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
a.cc:25:11: error: too few arguments to function 'void exit(int)'
   25 |       exit();
      |       ~~~~^~
/usr/include/stdlib.h:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
a.cc:31:9: error: too few arguments to function 'void exit(int)'
   31 |     exit();
      |     ~~~~^~
/usr/include/stdlib.h:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
Language: C++

#include <iostream>
#include <string>
#include <cmath>
using namespace std;
typedef long long llint;
llint n,m;
llint a[5];

void solve(){
  cin >> n >> m;
  llint s, c;
  for(int i = 1; i <= n; i++) a[i] = -1;
  for(int i = 1; i <= m; i++){
    cin >> s >> c;
    if(a[s] != -1 && a[s] != c){
      cout << -1 << endl;
      return 0;
    }
    a[s] = c;
  }

  if(n == 1){
    if(a[1] <= 0){
      cout << 0 << endl;
      return 0;
    }
  }

  if(a[1] == 0){
    cout << -1 << endl;
    return 0;
  }
  if(a[1] == -1) a[1] = 1;
  for(int i = 2; i <= n; i++){
    if(a[i] == -1) a[i] = 0;
  }

  for(int i = 1; i<= n; i++)  cout << a[i]; cout << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:17:14: error: return-statement with a value, in function returning 'void' [-fpermissive]
   17 |       return 0;
      |              ^
a.cc:25:14: error: return-statement with a value, in function returning 'void' [-fpermissive]
   25 |       return 0;
      |              ^
a.cc:31:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   31 |     return 0;
      |            ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
using LLint = long long int;

const int mod = 1000000007;
int main(){
	int N,M;
	int S[6];
	int C[6];
	cin>>N>>M;
	for(int i=0;i<M;++i) cin>>S[i]>>C[i];
	
	map<int,int> mp;
	mp[1]=0;
	N==2?mp[2]=1:mp[2]=0;
	N==3?mp[3]=1:mp[3]=0;
	
	bool check=true;
	for(int i=0;i<M;++i)
	{
		for(int j=i+1;j<M;++j)
		{
			if(S[i]==S[j]&&C[i]!=C[j])
			{
				check=false;
				break;
			}
		}
		mp[N-S[i]+1]=C[i];
	}
	if(mp[N]==0&&N!=1)check=false;
	int ans=100*mp[3]+10*mp[2]+mp[1];
	check?cout<<ans<<endl:cout<<-1<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'map' was not declared in this scope
   16 |         map<int,int> mp;
      |         ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    3 | #include <algorithm>
  +++ |+#include <map>
    4 | 
a.cc:16:13: error: expected primary-expression before 'int'
   16 |         map<int,int> mp;
      |             ^~~
a.cc:17:9: error: 'mp' was not declared in this scope
   17 |         mp[1]=0;
      |         ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int, int> P;
 
int main(){
  int n, m;
  cin >> n >> m;
  
  vector<int> s(m);
  vector<int> c(m);
  rep(i, m){
    cin >> s.at(i) >> c.at(i);
  }

  vector<int> t(m);
  rep(i, n) t[i]=-1;
  
  rep(i, m){
    if(t[s[j]-1]==-1) t[s[j]-1] = c[j];
    else cout << -1 << endl; return 0;
  }
  
  if(n==1) t[0]=max(t[0], 0);
  else     t[0]=max(t[0], 1);

  for(int i=1; i<n; i++){
    if(t[i]==-1) t[i]=0;
  }
  
  int ans=0;
  int v;
  
  for(int i=0; i<n; i++){
    v = (int)pow(10,n-i-1);
    ans += t[i]*v;
//    cout << t[i] << " " << v << endl;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: 'j' was not declared in this scope
   21 |     if(t[s[j]-1]==-1) t[s[j]-1] = c[j];
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
char sm[4];
string out(int n)
{
	if(sm[0]=='-')
	{
		return "-1";
	}	
	string ans="";
	for(int i=0;i<n;i++)
	{
		ans+=sm[i];
	}
	reverse(ans.begin(),ans.end());
	if(ans[0]=='0')
	{
		return "-1";
	}
	else
	{
		return ans;
	}
}
int main()
{
	int m,n;
	cin>>m>>n;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;
		b+=48;
		if(sm[0]!='-')
		{
			if(sm[a]!='')
			{
				if(sm[a]!=b)
				{
					sm[0]='-';
					sm[1]='1';
				}
			}
			else
			{
				sm[a]=b;
			}
		}
	}
	if(sm[n-1]=='')
	{
		sm[n-1]='1';
	}
	for(int i=0;i<n-1;i++)
	{
		if(sm[i]=='')
		{
			sm[i]='0';
		}
	}
	string ans=out(n);
	cout << ans;
	return 0;
}

Compiler output:
a.cc:37:35: error: empty character constant
   37 |                         if(sm[a]!='')
      |                                   ^~
a.cc:51:21: error: empty character constant
   51 |         if(sm[n-1]=='')
      |                     ^~
a.cc:57:27: error: empty character constant
   57 |                 if(sm[i]=='')
      |                           ^~
Language: C++

#include <iostream>
using namespace std;

int N, M;
int s[3], c[5];
int num=0;

int main(){
  cin >> N >> M;
  for(int i=0;i<M;++i) cin >> s[i] >> c[i];
  
  for(int i=0;i<M;++i){
    for(int j=0;j<M;++j){
      if(s[i] == s[j]){
        if(c[i] >= c[j]) num += c[i] * pow(10, s[i]);
      }
    }
  }
  
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:40: error: 'pow' was not declared in this scope
   15 |         if(c[i] >= c[j]) num += c[i] * pow(10, s[i]);
      |                                        ^~~
Language: Java

import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		if(N > 3 || M > 5){
			flg2 = 1;
		}else if(N < 1 || M < 0){
			flg2 = 1;
		}
		int[] c = new int[N];
		int[] flg = new int[N];
		int[] bufn = new int[N];
		int i,s,j,dust;
		int buf;
		int ans = -1;
		int flg2 = 0;
		for(i = 0;i < M;i++){
			s = sc.nextInt();
			c[s-1] = sc.nextInt();
			if(flg[s-1] == 0){
				bufn[s-1] = c[s-1];
				flg[s-1] = 1;
			}else if(bufn[s-1] != c[s-1]){
				flg2 = 1;
			}
			if(flg[0] == 1 && c[0] == 0){
				flg2 = 1;
			}
		}
		if(flg2 == 0){
			ans = 0;
			for(i = 0;i < N;i++){
				buf = 1;
				for(j = 0;j < i;j++){
					buf *= 10;
				}
				ans += (c[N-1-i] * buf);
				if(i == (N-1) && c[0] == 0){
					ans += buf;
				}
			}
		}
		System.out.println(ans);
	}
}

Compiler output:
Main.java:8: error: cannot find symbol
			flg2 = 1;
			^
  symbol:   variable flg2
  location: class Main
Main.java:10: error: cannot find symbol
			flg2 = 1;
			^
  symbol:   variable flg2
  location: class Main
2 errors
Language: Java

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

Compiler output:
Main.java:23: error: incompatible types: int cannot be converted to int[]
				flg = 0;
				      ^
1 error
Language: Java

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

Compiler output:
Main.java:23: error: not a statement
				flg == 0;
				    ^
1 error
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string.h>
using namespace std;
int digit[4];
int main(){
	int n,m;
	cin>>n>>m;
	int fac=0;
	memset(digit,-1,sizeof(digit));
	while(m--){
		int a,b;  cin>>a>>b;
		if(a==1&&b==0) fac=1;
		else if(digit[a]!=-1digit[a]!=b) fac=1;
		else digit[a]=b;
	}
	if(fac) cout<<-1<<endl;
	else{
		int ans=0;
		if(digit[1]==-1) ans+=pow(10,n-1);
		else ans+=digit[1]*pow(10,n-1);
		if(digit[2]!=-1) ans+=digit[2]*pow(10,n-2);
		if(digit[3]!=-1) ans+=digit[3]*pow(10,n-3);
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:36: error: unable to find numeric literal operator 'operator""digit'
   15 |                 else if(digit[a]!=-1digit[a]!=b) fac=1;
      |                                    ^~~~~~
Language: C++

#include<iostream>
#include<vector>
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];
  }
  vector<int> num(N,0);
  
  for (int i = 0; i < M; i++){
    num[s[i]-1] = c[i];
  }
  bool notzero = false;
  for (int i = 0; i < N; i++){
    if (num[i] != 0) notzero = true;
    if(notezero) cout << num[i];
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: 'notezero' was not declared in this scope; did you mean 'notzero'?
   20 |     if(notezero) cout << num[i];
      |        ^~~~~~~~
      |        notzero