Language: C++

#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>

#define rep(a,i,n) for(int i = (a) ; i< (n);i++)
#define ic(n) int (n); cin>>(n);
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;



typedef pair<int,int> P;




int main(){

  ic(n);ic(m);	vector<tuple<long long,long long,long long>> M(m);
  rep(0,i,m){
	ic(where);ic(when);
	M[i] = make_tuple(where,when,i+1);;
  }
  long long a, b ;
  long long c;
  SORT(M);
  vector<pair<long long,long long>> A(m);
  long long x,y;
  long long count = 1;
  long long p=0;
  rep(0,i,m){
	tie(x,y,a) =M[i];
	if(x==p){
	  count++;
	}
	else if(x!=p){
	  count=1;
	  p=x;
	}
	x*=pow(10,6);
	c = x+count;
	A[i] = make_pair(a,c);
  }
  SORT(A);
  rep(0,i,m){
	long long id;
	tie(ignore,id) = A[i];
	printf("%012lld\n",id);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:24: error: 'cin' was not declared in this scope
    6 | #define ic(n) int (n); cin>>(n);
      |                        ^~~
a.cc:21:3: note: in expansion of macro 'ic'
   21 |   ic(n);ic(m);  vector<tuple<long long,long long,long long>> M(m);
      |   ^~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <algorithm>
  +++ |+#include <iostream>
    4 | 
a.cc:21:17: error: 'vector' was not declared in this scope
   21 |   ic(n);ic(m);  vector<tuple<long long,long long,long long>> M(m);
      |                 ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | 
a.cc:21:59: error: expected primary-expression before '>' token
   21 |   ic(n);ic(m);  vector<tuple<long long,long long,long long>> M(m);
      |                                                           ^~
a.cc:21:62: error: 'M' was not declared in this scope
   21 |   ic(n);ic(m);  vector<tuple<long long,long long,long long>> M(m);
      |                                                              ^
a.cc:24:16: error: 'make_tuple' was not declared in this scope
   24 |         M[i] = make_tuple(where,when,i+1);;
      |                ^~~~~~~~~~
a.cc:4:1: note: 'std::make_tuple' is defined in header '<tuple>'; this is probably fixable by adding '#include <tuple>'
    3 | #include <algorithm>
  +++ |+#include <tuple>
    4 | 
a.cc:29:34: error: expected primary-expression before '>' token
   29 |   vector<pair<long long,long long>> A(m);
      |                                  ^~
a.cc:29:37: error: 'A' was not declared in this scope
   29 |   vector<pair<long long,long long>> A(m);
      |                                     ^
a.cc:34:9: error: 'tie' was not declared in this scope
   34 |         tie(x,y,a) =M[i];
      |         ^~~
a.cc:34:9: note: 'std::tie' is defined in header '<tuple>'; this is probably fixable by adding '#include <tuple>'
a.cc:49:13: error: 'ignore' was not declared in this scope
   49 |         tie(ignore,id) = A[i];
      |             ^~~~~~
a.cc:49:9: error: 'tie' was not declared in this scope
   49 |         tie(ignore,id) = A[i];
      |         ^~~
a.cc:49:9: note: 'std::tie' is defined in header '<tuple>'; this is probably fixable by adding '#include <tuple>'
a.cc:50:9: error: 'printf' was not declared in this scope
   50 |         printf("%012lld\n",id);
      |         ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    3 | #include <algorithm>
  +++ |+#include <cstdio>
    4 |