Language: C++

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

#define DEBUG

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;

const int MOD = 1000000007;
const double PI=acos(-1.0);

// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;

// 繰り返し
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep_(i,n) for(int i=0;i<(int)(n-1);i++)
#define rep__(i,n) for(int i=n-1;i>=0;i--)

// メモリ関連
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define MEMSET(v,h) memset((v),h,sizeof(h)

// 最大値と最小値を更新する
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;}

// 素数判定
bool isPrime(int n){if(n<2)return false;else if(n==2)return true;else if(n%2==0)return false;double sqrtNum=sqrt(n);for(int i=3;i<=sqrtNum;i+=2)if(n%i==0)return false;return true;}

// ソート
template<class T>vector<T>sortVector(vector<T>v,bool b=true){if(b)sort(v.begin(),v.end());else sort(v.begin(),v.end(),greater<T>());return v;}

// Z-Algorithm O(|S|)
vector<ulint>z_algorithm(string s){vector<ulint>a(s.length());a[0]=s.size();for(ulint i=1,j=0,k;i<s.size();){while(i+j<s.size()&&s[j]==s[i+j])++j;a[i]=j;k=!!j;while(i+k<s.size()&&k+a[k]<j)a[i+k]=a[k],++k;i+=k+!j;j-=k;}return a;}

int solve(int n, int m, vector<int> s, vector<int> c) {
    rep(i, m) {
        if(s[i] == 1 && c[i] == 0) return -1;
    }
    rep(i, m) {
        rep(j, m) {
            if(i != j && s[i] == s[j] && c[i] != c[j]) return -1;
            }
        }
    }
    int t[10] = { 0 };
    bool tb[10] = { false };
    rep(j, m) {
        t[s[j] - 1] = c[j];
        tb[s[j] - 1] = true;
    }
    int v[] = { 1, 10, 100 };
    int ans = 0;
    rep(i, n) {
        if(tb[i]) ans += t[i]*v[n-i-1];
    }
    if(tb[0] == false) ans += v[n-1];
    if(n == 1 && tb[0] == false) return 0;
    if(ans < 0) return -1;
    return ans;
}

int main(void) {
    int n, m;
    cin >> n >> m;
    vector<int>s(m), c(m);
    
    rep(i, m) {
        cin >> s[i] >> c[i];
    }
    
    cout << solve(n, m, s, c);
    
    return 0;
}


Compiler output:
a.cc:20:18: error: expected unqualified-id before 'for'
   20 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                  ^~~
a.cc:56:5: note: in expansion of macro 'rep'
   56 |     rep(j, m) {
      |     ^~~
a.cc:56:9: error: 'j' does not name a type
   56 |     rep(j, m) {
      |         ^
a.cc:20:30: note: in definition of macro 'rep'
   20 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                              ^
a.cc:56:9: error: 'j' does not name a type
   56 |     rep(j, m) {
      |         ^
a.cc:20:41: note: in definition of macro 'rep'
   20 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                                         ^
a.cc:20:18: error: expected unqualified-id before 'for'
   20 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                  ^~~
a.cc:62:5: note: in expansion of macro 'rep'
   62 |     rep(i, n) {
      |     ^~~
a.cc:62:9: error: 'i' does not name a type
   62 |     rep(i, n) {
      |         ^
a.cc:20:30: note: in definition of macro 'rep'
   20 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                              ^
a.cc:62:9: error: 'i' does not name a type
   62 |     rep(i, n) {
      |         ^
a.cc:20:41: note: in definition of macro 'rep'
   20 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                                         ^
a.cc:65:5: error: expected unqualified-id before 'if'
   65 |     if(tb[0] == false) ans += v[n-1];
      |     ^~
a.cc:66:5: error: expected unqualified-id before 'if'
   66 |     if(n == 1 && tb[0] == false) return 0;
      |     ^~
a.cc:67:5: error: expected unqualified-id before 'if'
   67 |     if(ans < 0) return -1;
      |     ^~
a.cc:68:5: error: expected unqualified-id before 'return'
   68 |     return ans;
      |     ^~~~~~
a.cc:69:1: error: expected declaration before '}' token
   69 | }
      | ^
a.cc: In function 'int solve(int, int, std::vector<int>, std::vector<int>)':
a.cc:53:5: warning: control reaches end of non-void function [-Wreturn-type]
   53 |     }
      |     ^