Language: C++

import std.stdio;
import std.algorithm;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;

string my_readln() { return chomp(readln()); }

void main()
{
	auto tokens = split(my_readln());
	auto N = to!ulong(tokens[0]);
	auto M = to!ulong(tokens[1]);

	ulong[] P, Y;
	P.length = Y.length = N;
	ulong[][] county;
	county.length = N;
	foreach (i; 0..M)
	{
		auto tokens2 = split(my_readln());
		P[i] = to!ulong(tokens2[0]) - 1;
		Y[i] = to!ulong(tokens2[1]);
		county[P[$-1]] ~= cast(ulong)i;
	}

	foreach (ref e; county)
	{
		sort!((ulong a, ulong b){ return Y[a] < Y[b]; })(e);
	}

	ulong digit(ulong x)
	{
		ulong d;
		while (x)
		{
			x /= 10;
			++d;
		}
		return d;
	}

	string[] zero = ["000000", "00000", "0000", "000", "00", "0"];

	foreach (i, e; P)
	{
		string result;
		result ~= zero[digit(e+1)];
		result ~= to!string(e+1);

		auto c = county[e];
		auto pos = countUntil(c, i) + 1;
		result ~= zero[digit(pos)];
		result ~= to!string(pos);

		writeln(result);
	}

	stdout.flush();
}

Compiler output:
a.cc:21:21: error: too many decimal points in number
   21 |         foreach (i; 0..M)
      |                     ^~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import std.stdio;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import std.algorithm;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import std.conv;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import std.datetime;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import std.numeric;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import std.math;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
    7 | import std.string;
      | ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'string' does not name a type
    9 | string my_readln() { return chomp(readln()); }
      | ^~~~~~
a.cc:11:1: error: '::main' must return 'int'
   11 | void main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:13:29: error: 'my_readln' was not declared in this scope
   13 |         auto tokens = split(my_readln());
      |                             ^~~~~~~~~
a.cc:13:23: error: 'split' was not declared in this scope
   13 |         auto tokens = split(my_readln());
      |                       ^~~~~
a.cc:14:18: error: 'to' was not declared in this scope
   14 |         auto N = to!ulong(tokens[0]);
      |                  ^~
a.cc:15:20: error: expected ',' or ';' before '!' token
   15 |         auto M = to!ulong(tokens[1]);
      |                    ^
a.cc:17:9: error: 'ulong' was not declared in this scope; did you mean 'long'?
   17 |         ulong[] P, Y;
      |         ^~~~~
      |         long
a.cc:17:15: error: expected primary-expression before ']' token
   17 |         ulong[] P, Y;
      |               ^
a.cc:18:9: error: 'P' was not declared in this scope
   18 |         P.length = Y.length = N;
      |         ^
a.cc:18:20: error: 'Y' was not declared in this scope
   18 |         P.length = Y.length = N;
      |                    ^
a.cc:19:15: error: expected primary-expression before ']' token
   19 |         ulong[][] county;
      |               ^
a.cc:19:17: error: expected primary-expression before ']' token
   19 |         ulong[][] county;
      |                 ^
a.cc:20:9: error: 'county' was not declared in this scope
   20 |         county.length = N;
      |         ^~~~~~
a.cc:21:18: error: 'i' was not declared in this scope
   21 |         foreach (i; 0..M)
      |                  ^
a.cc:29:18: error: 'ref' was not declared in this scope
   29 |         foreach (ref e; county)
      |                  ^~~
a.cc:29:31: error: expected ';' before ')' token
   29 |         foreach (ref e; county)
      |                               ^
      |                               ;
a.cc:34:14: error: expected ';' before 'digit'
   34 |         ulong digit(ulong x)
      |              ^~~~~~
      |              ;
a.cc:45:9: error: 'string' was not declared in this scope
   45 |         string[] zero = ["000000", "00000", "0000", "000", "00", "0"];
      |         ^~~~~~
a.cc:45:16: error: expected primary-expression before ']' token
   45 |         string[] zero = ["000000", "00000", "0000", "000", "00", "0"];
      |                ^
a.cc:47:21: error: 'e' was not declared in this scope
   47 |         foreach (i, e; P)
      |                     ^
a.cc:47:25: error: expected ';' before ')' token
   47 |         foreach (i, e; P)
      |                         ^
      |                         ;
a.cc:61:9: error: 'stdout' was not declared in this scope
   61 |         stdout.flush();
      |         ^~~~~~
a.cc:1:1: note: 'stdout' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | import std.stdio;