Language: C++

v#include <bits/stdc++.h>
#define per(i,a,n) for(int i=a;i<=n;i++)
using namespace std;
typedef long long ll;
typedef vector<ll>vec;
typedef vector<vector<ll>> mat;
vector<int>a[1000];
int b[5];
int main()
{
  int n,m;
  cin>>n>>m;
  for(int i=0;i<=n;i++)a[i].clear();
  int s,c;
  per(i,1,m){
    cin>>s>>c;
    a[s].push_back(c);
  }
  for(int i=1;i<=n;i++)
  {
          if(i==1){
             if(a[1].size()){
                for(auto v:a[1])
                if(v!=a[1][0]){cout<<-1<<endl;return 0;}
                sort(a[1].begin(),a[1].end());
                if(a[1][0]==0)
                {
                    if(n==1){cout<<0<<endl;return 0;}
                    else {cout<<-1<<endl;return 0;}
                }
                b[1]=a[1][0];
             }
             else{
            if(n==1)b[1]=0;
            else b[1]=1;
             }
          }
          else{
            if(a[i].size()){
                for(auto v:a[i])
                if(v!=a[i][0]){cout<<-1<<endl;return 0;}
                sort(a[i].begin(),a[i].end());
                b[i]=a[i][0];
             }
             else
                b[i]=0;
          }
    }
    for(int i=1;i<=n;i++)
        cout<<b[i];
  return 0;
}



Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc:5:9: error: 'vector' does not name a type
    5 | typedef vector<ll>vec;
      |         ^~~~~~
a.cc:6:9: error: 'vector' does not name a type
    6 | typedef vector<vector<ll>> mat;
      |         ^~~~~~
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<int>a[1000];
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:12:3: error: 'cin' was not declared in this scope
   12 |   cin>>n>>m;
      |   ^~~
a.cc:13:24: error: 'a' was not declared in this scope
   13 |   for(int i=0;i<=n;i++)a[i].clear();
      |                        ^
a.cc:17:5: error: 'a' was not declared in this scope
   17 |     a[s].push_back(c);
      |     ^
a.cc:22:17: error: 'a' was not declared in this scope
   22 |              if(a[1].size()){
      |                 ^
a.cc:24:32: error: 'cout' was not declared in this scope
   24 |                 if(v!=a[1][0]){cout<<-1<<endl;return 0;}
      |                                ^~~~
a.cc:24:42: error: 'endl' was not declared in this scope
   24 |                 if(v!=a[1][0]){cout<<-1<<endl;return 0;}
      |                                          ^~~~
a.cc:25:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   25 |                 sort(a[1].begin(),a[1].end());
      |                 ^~~~
      |                 short
a.cc:28:30: error: 'cout' was not declared in this scope
   28 |                     if(n==1){cout<<0<<endl;return 0;}
      |                              ^~~~
a.cc:28:39: error: 'endl' was not declared in this scope
   28 |                     if(n==1){cout<<0<<endl;return 0;}
      |                                       ^~~~
a.cc:29:27: error: 'cout' was not declared in this scope
   29 |                     else {cout<<-1<<endl;return 0;}
      |                           ^~~~
a.cc:29:37: error: 'endl' was not declared in this scope
   29 |                     else {cout<<-1<<endl;return 0;}
      |                                     ^~~~
a.cc:39:16: error: 'a' was not declared in this scope
   39 |             if(a[i].size()){
      |                ^
a.cc:41:32: error: 'cout' was not declared in this scope
   41 |                 if(v!=a[i][0]){cout<<-1<<endl;return 0;}
      |                                ^~~~
a.cc:41:42: error: 'endl' was not declared in this scope
   41 |                 if(v!=a[i][0]){cout<<-1<<endl;return 0;}
      |                                          ^~~~
a.cc:42:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   42 |                 sort(a[i].begin(),a[i].end());
      |                 ^~~~
      |                 short
a.cc:50:9: error: 'cout' was not declared in this scope
   50 |         cout<<b[i];
      |         ^~~~