Language: C++

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

///////////////////////////////////////////
const long long int INF = INT64_MAX;
//const long long int INF = 1000000;
const long long int Mod = 1000000007;
using ll = long long int;
using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
///////////////////////////////////////////////////////////////////////////////////
ll n,m;
ll p[100001]={0};
ll y[100001]={0};
matrix mx(100001);
int main(){
    cin>>n>>m;
    rep(i,m){
        cin>>p[i]>>y[i];
        mx[p[i]].pb(y[i]);
    }//input
    string f,b;
    rep(i,n)sort(all(mx[i+1]));
    rep(i,m){
        rep(j,mx[p[i]].size()){
            if(mx[p[i]][j]==y[i]){
                f=to_string(p[i]);
                b=to_string(j+1);
                while(f.size()<6){f="0"+f;}
                while(b.size()<6){b="0"+b;}
                cout<<f+b<<endl;
                f.clear();b.clear();
                break;
            }
        }
    }
    return 0;
}#include <bits/stdc++.h>
using namespace std;

///////////////////////////////////////////
const long long int INF = INT64_MAX;
//const long long int INF = 1000000;
const long long int Mod = 1000000007;
using ll = long long int;
using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
///////////////////////////////////////////////////////////////////////////////////
ll n,m;
ll p[100001]={0};
ll y[100001]={0};
matrix mx(100001);
int main(){
    cin>>n>>m;
    rep(i,m){
        cin>>p[i]>>y[i];
        mx[p[i]].pb(y[i]);
    }//input
    string f,b;
    rep(i,n)sort(all(mx[i+1]));
    rep(i,m){
        rep(j,mx[p[i]].size()){
            if(mx[p[i]][j]==y[i]){
                f=to_string(p[i]);
                b=to_string(j+1);
                while(f.size()<6){f="0"+f;}
                while(b.size()<6){b="0"+b;}
                cout<<f+b<<endl;
                f.clear();b.clear();
                break;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc:50:2: error: stray '#' in program
   50 | }#include <bits/stdc++.h>
      |  ^
a.cc:16:10: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   16 | auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
      |          ^~~~
a.cc:16:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   16 | auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
      |                 ^~~~
a.cc:17:10: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   17 | auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
      |          ^~~~
a.cc:17:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   17 | auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
      |                 ^~~~
a.cc:50:3: error: 'include' does not name a type
   50 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:54:21: error: redefinition of 'const long long int INF'
   54 | const long long int INF = INT64_MAX;
      |                     ^~~
a.cc:5:21: note: 'const long long int INF' previously defined here
    5 | const long long int INF = INT64_MAX;
      |                     ^~~
a.cc:56:21: error: redefinition of 'const long long int Mod'
   56 | const long long int Mod = 1000000007;
      |                     ^~~
a.cc:7:21: note: 'const long long int Mod' previously defined here
    7 | const long long int Mod = 1000000007;
      |                     ^~~
a.cc:65:10: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   65 | auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
      |          ^~~~
a.cc:65:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   65 | auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
      |                 ^~~~
a.cc:65:6: error: redefinition of 'template<class auto:32, class auto:33> auto max(auto:32, auto:33)'
   65 | auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
      |      ^~~
a.cc:16:6: note: 'template<class auto:28, class auto:29> auto max(auto:28, auto:29)' previously declared here
   16 | auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
      |      ^~~
a.cc:66:10: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   66 | auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
      |          ^~~~
a.cc:66:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   66 | auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
      |                 ^~~~
a.cc:66:6: error: redefinition of 'template<class auto:34, class auto:35> auto min(auto:34, auto:35)'
   66 | auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
      |      ^~~
a.cc:17:6: note: 'template<class auto:30, class auto:31> auto min(auto:30, auto:31)' previously declared here
   17 | auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
      |      ^~~
a.cc:67:23: error: redefinition of 'template<class T> bool chmax(T&, const T&)'
   67 | template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
      |                       ^~~~~
a.cc:18:23: note: 'template<class T> bool chmax(T&, const T&)' previously declared here
   18 | template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
      |                       ^~~~~
a.cc:68:23: error: redefinition of 'template<class T> bool chmin(T&, const T&)'
   68 | template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
      |                       ^~~~~
a.cc:19:23: note: 'template<class T> bool chmin(T&, const T&)' previously declared here
   19 | template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
      |                       ^~~~~
a.cc:69:20: error: redefinition of 'template<class T> T sqar(T)'
   69 | template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
      |                    ^~~~
a.cc:20:20: note: 'template<class T> T sqar(T)' previously declared here
   20 | template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
      |                    ^~~~
a.cc:73:4: error: redefinition of 'll n'
   73 | ll n,m;
      |    ^
a.cc:24:4: note: 'll n' previously declared here
   24 | ll n,m;
      |    ^
a.cc:73:6: error: redefinition of 'll m'
   73 | ll n,m;
      |      ^
a.cc:24:6: note: 'll m' previously declared here
   24 | ll n,m;
      |      ^
a.cc:74:4: error: redefinition of 'll p [100001]'
   74 | ll p[100001]={0};
      |    ^
a.cc:25:4: note: 'll p [100001]' previously defined here
   25 | ll p[100001]={0};
      |    ^
a.cc:75:4: error: redefinition of 'll y [100001]'
   75 | ll y[100001]={0};
      |    ^
a.cc:26:4: note: 'll y [100001]' previously defined here
   26 | ll y[100001]={0};
      |    ^
a.cc:76:8: error: redefinition of 'matrix mx'
   76 | matrix mx(100001);
      |        ^~
a.cc:27:8: note: 'matrix mx' previously declared here
   27 | matrix mx(100001);
      |        ^~
a.cc:77:5: error: redefinition of 'int main()'
   77 | int main(){
      |     ^~~~
a.cc:28:5: note: 'int main()' previously defined here
   28 | int main(){
      |     ^~~~