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);
    bool j=true;//存在するか判定
    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&&n!=1) ans[0]=1;//一番左が分からない場合
    if(j) rep(i,n) cout<<ans[i];
    else cout<<-1;
}

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:11:14: error: 's' was not declared in this scope
   11 |         cin>>s[i]>>c[i];
      |              ^
a.cc:11:20: error: 'c' was not declared in this scope
   11 |         cin>>s[i]>>c[i];
      |                    ^
a.cc:13:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 |             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:18:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   18 |                 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:22:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |         ans[s[i]-1]=c[i];
      |         ^~~
      |         abs
a.cc:24:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |     if(ans[0]==0&&n!=1) ans[0]=1;//一番左が分からない場合
      |        ^~~
      |        abs
a.cc:25:20: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   25 |     if(j) 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:25:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |     if(j) rep(i,n) cout<<ans[i];
      |                          ^~~
      |                          abs
a.cc:26:10: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |     else cout<<-1;
      |          ^~~~
      |          std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~