Language: C++

#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define sc second
#define ve vector
#define tos to_string
#define len length
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define ea(i, n) for(auto&& i: n)
#define so(n) sort(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// abs 絶対値, rtsq ルート, pow(a, n) aのn乗

int main() {
  int N, M;
  ci(N, M);
  ve<int> s(M), c(M);
  rep(i, M){
    ci(s.at(i), c.at(i));
  }
  rep(i, 1000){
    int A = 0;
    rep(j, M){
      if(tos(i).len == 1){
        if(s.at(j) == 3 && i % 10 == c.at(j)){
          A++;
        }
      }
      if(tos(i).len == 2){
        if(s.at(j) == 3 && i % 10 == c.at(j)){
          A++;
        }
        else if(s.at(j) == 2 && (i % 100) / 10 == c.at(j)){
          A++;
        }
      }
      if(tos(i).len == 3){
        if(s.at(j) == 3 && i % 10 == c.at(j)){
          A++;
        }
        else if(s.at(j) == 2 && (i % 100) / 10 == c.at(j)){
          A++;
        }
        else if(s.at(j) == 1 && i / 100 == c.at(j)){
          A++;
        }
      }
    }
    if(A == M && tos(i).len() == N){
      co(i);
      return 0;
    }
  }
  co(-1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:13: 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 '()' ?)
   35 | #define len length
      |             ^
a.cc:55:17: note: in expansion of macro 'len'
   55 |       if(tos(i).len == 1){
      |                 ^~~
a.cc:35:13: 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 '()' ?)
   35 | #define len length
      |             ^
a.cc:60:17: note: in expansion of macro 'len'
   60 |       if(tos(i).len == 2){
      |                 ^~~
a.cc:35:13: 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 '()' ?)
   35 | #define len length
      |             ^
a.cc:68:17: note: in expansion of macro 'len'
   68 |       if(tos(i).len == 3){
      |                 ^~~