Language: C++

#include<bits/stdc++.h>
using namespace std;
using P=pair<int,int>;
using T=tuple<int,int,int>;
#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
	int n,m;cin>>n>>m;
	map<int,vector<P>> mp;
	vector<T>v;		
	rep(i,m){int x,y;cin>>x>>y;mp[x].push_back(make_pair(y,i));}
	for(auto&& u:mp)sort(begin(u.second),end(u.second));	
	for(auto&& u:mp)rep(i,u.second.size())v.push_back(tie(u.second[i].second,u.first,i+1));
	sort(begin(v),end(v));
	for(auto&& u:v)printf("06%d06%d",get<2>(u),get<3>(u));
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:91: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   13 |         for(auto&& u:mp)rep(i,u.second.size())v.push_back(tie(u.second[i].second,u.first,i+1));
      |                                                                                          ~^~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/tuple:2791:19: note:   initializing argument 3 of 'constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...) [with _Elements = {int, const int, int}]'
 2791 |     tie(_Elements&... __args) noexcept
      |         ~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/tuple: In instantiation of 'struct std::tuple_element<3, std::tuple<int, int, int> >':
/usr/include/c++/14/bits/utility.h:84:11:   required by substitution of 'template<long unsigned int __i, class _Tp> using std::__tuple_element_t = typename std::tuple_element::type [with long unsigned int __i = 3; _Tp = std::tuple<int, int, int>]'
   84 |     using __tuple_element_t = typename tuple_element<__i, _Tp>::type;
      |           ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2466:5:   required by substitution of 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const tuple<_Elements ...>&&) [with long unsigned int __i = 3; _Elements = {int, int, int}]'
 2466 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
a.cc:15:51:   required from here
   15 |         for(auto&& u:v)printf("06%d06%d",get<2>(u),get<3>(u));
      |                                                    ~~~~~~^~~
/usr/include/c++/14/tuple:2422:25: error: static assertion failed: tuple index must be in range
 2422 |       static_assert(__i < sizeof...(_Types), "tuple index must be in range");
      |                     ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2422:25: note: the comparison reduces to '(3 < 3)'
In file included from /usr/include/c++/14/bits/stl_pair.h:62,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/utility.h: In instantiation of 'struct std::_Nth_type<3, int, int, int>':
/usr/include/c++/14/tuple:2424:13:   required from 'struct std::tuple_element<3, std::tuple<int, int, int> >'
 2424 |       using type = typename _Nth_type<__i, _Types...>::type;
      |             ^~~~
/usr/include/c++/14/bits/utility.h:84:11:   required by substitution of 'template<long unsigned int __i, class _Tp> using std::__tuple_element_t = typename std::tuple_element::type [with long unsigned int __i = 3; _Tp = std::tuple<int, int, int>]'
   84 |     using __tuple_element_t = typename tuple_element<__i, _Tp>::type;
      |           ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2466:5:   required by substitution of 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const tuple<_Elements ...>&&) [with long unsigned int __i = 3; _Elements = {int, int, int}]'
 2466 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
a.cc:15:51:   required from here
   15 |         for(auto&& u:v)printf("06%d06%d",get<2>(u),get<3>(u));
      |                                                    ~~~~~~^~~
/usr/include/c++/14/bits/utility.h:237:13: error: '__type_pack_element' index is out of range
  237 |     { using type = __type_pack_element<_Np, _Types...>; };
      |             ^~~~
a.cc:15:58: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 3; _Elements = {int, int, int}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
   15 |         for(auto&& u:v)printf("06%d06%d",get<2>(u),get<3>(u));
      |                                                    ~~~~~~^~~
/usr/include/c++/14/tuple:2476:5: note: declared here
 2476 |     get(const tuple<_Elements...>&) = delete;
      |     ^~~
a.cc:15:58: note: use '-fdiagnostics-all-candidates' to display considered candidates
   15 |         for(auto&& u:v)printf("06%d06%d",get<2>(u),get<3>(u));
      |                                                    ~~~~~~^~~