Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
int main() {
    int n,m;
    cin>>n>>m;
    vector<int> s(m),c(m),ans(n);
    rep(i,m){
        cin>>s[i]>>c[i];
        if(s[i]!=n&&c[i]==0){
            cout<<-1;
            return 0;
        }
        rep(k,i){
            if(s[i]==s[k]&&c[i]!=c[k]){
                cout<<-1;
                return 0;
            }
        }
        ans[s[i]-1]=c[i];
    }
    if(ans[0]==0) ans[0]=1;//一番左が分からない場合
    rep(i,n) cout<<ans[i];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |     cin>>n>>m;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int> s(m),c(m),ans(n);
      |     ^~~~~~
a.cc:8:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> s(m),c(m),ans(n);
      |            ^~~
a.cc:10:14: 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:12:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 |             cout<<-1;
      |             ^~~~
      |             std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |                 cout<<-1;
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:21:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |         ans[s[i]-1]=c[i];
      |         ^~~
      |         abs
a.cc:23:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |     if(ans[0]==0) ans[0]=1;//一番左が分からない場合
      |        ^~~
      |        abs
a.cc:24:14: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   24 |     rep(i,n) cout<<ans[i];
      |              ^~~~
      |              std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:24:20: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |     rep(i,n) cout<<ans[i];
      |                    ^~~
      |                    abs