Language: C++

#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <numeric>
#include <utility>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <stack>
#include <functional>
#include<iterator>
#include <ctime>
#include <queue>
#include <string>
#include <map>
#include <sstream>
#include <ios>
#include <iomanip>
#define MAX_U   10
#define MIN_U   0
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define form(i,a,b) for(int i=(a);i<(b);i++)
#define sz(x) ((int)(x).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<char> vc;
typedef vector<string> vs;
typedef queue<int> qi;
const int INF=numeric_limits<int>::infinity();
void printa(){cout<<"\n";}
template<class T, class... A>void printa(const T&first,const A&... rest){cout<<first;printa(rest...);}
template<class... A>void printa(const A&... rest){printa(rest...);}
void prints(){cout<<" ";}
template<class T, class... A>void prints(const T&first,const A&... rest){cout<<first;prints(rest...);}
template<class... A>void prints(const A&... rest){prints(rest...);}
template<typename T>struct norm : std::binary_function<T,T,T> {  T operator()(T x, T y) const { return std::max(x-y,y-x); }};
template<typename T>struct norm_less : std::binary_function<T,T,bool> {
  T value_;norm_less(T v) : value_(v) {} bool operator()(T x, T y) const { norm<T> f; return f(x,value_) < f(y,value_); }};
int factorial(int x){int f=1;for(int i=1;i<x+1;i++)f=f*i;return f;}
int sigma(int x){int s;for(int i=1;i<x+1;i++)s=s+i;return s;}
int middle(int x){if(x%2==0)return x/2;else return x/2+1;}
double heron(int a,int b,int c){double s;s=(a+b+c)/2;return sqrt(s*(s-a)*(s-b)*(s-c));}
double trapezium(int a,int b,int h){return (a+b)*h/2;}
double triangle(int a,int h){return a*h/2;}
void sorm(vector<int> vec){sort(vec.begin(),vec.end());}
void sorm_s(vector<string> vec){sort(vec.begin(),vec.end());}
void sorg(vector<int> vec){sort(vec.begin(),vec.end(),greater<int>());}
//int cmp( const void *p, const void *q ) {if( ＊(double＊)p > ＊(double＊)q ) return 1;if( ＊(double＊)p < ＊(double＊)q ) return -1;return 0;}

int main(void){
   cin.tie(0);
   ios::sync_with_stdio(false);
   unsigned long a,b,c,d,e=100000,g;
   unsigned long f=1;
   vector<pair<int,pair<int,int>>> pti,ptib;
   int flag=0,nfl,ta,tb;
   std::cin>>a>>b;
   for(flag=0;flag<b;flag++){
        std::cin>>c>>d;
        pti.push_back(make_pair(d,make_pair(c,flag+1)));
   }
   sort(pti.begin(),pti.end());
   vector<int> veci(a,0);
   for(flag=0;flag<b;flag++){
       for(X=0;X<a;X++){
           if(pti[flag].second.first==X+1){
           ptib.push_back(make_pair(pti[flag].second.second,make_pair(pti[flag].second.first,veci[X]+1)));
           veci[X]+=1;
       }
        }
   }
   sort(ptib.begin(),ptib.end());
   for(flag=0;flag<b;flag++){
       cout<<setfill('0')<<right<<setw(6)<<ptib[flag].second.first;
       cout<<setfill('0')<<right<<setw(6)<<ptib[flag].second.second<<"\n";
   }
   return 0;
}


Compiler output:
a.cc:44:40: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
   44 | template<typename T>struct norm : std::binary_function<T,T,T> {  T operator()(T x, T y) const { return std::max(x-y,y-x); }};
      |                                        ^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~
a.cc:45:45: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
   45 | template<typename T>struct norm_less : std::binary_function<T,T,bool> {
      |                                             ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:73:12: error: 'X' was not declared in this scope
   73 |        for(X=0;X<a;X++){
      |            ^