Language: C++

import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N=sc.nextInt();
		int M=sc.nextInt();
		int[] kosu=new int[100001];
		long[][] aa=new long[M][3];
		for(int i=0; i<=100000; i++) {
			kosu[i]=0;
		}
		for(int i=0; i<M; i++) {
			long a=sc.nextLong();
			long b=sc.nextLong();
			kosu[(int)a]++;
			aa[i][0]=a*10000000000L+b;
			aa[i][1]=i;
		}
		for(int i=1; i<=100000; i++) {
			kosu[i]=kosu[i-1]+kosu[i];
		}
		quick_sort(aa,0,M-1);
		for(int i=0; i<M; i++) {
			aa[i][2]=i+1;
		}
		long[][] ansss=new long[M+1][2];
		for(int i=0; i<M; i++) {
			ansss[(int)aa[i][1]][0]=aa[i][0];
			long ban=aa[i][0]/10000000000L;
			ansss[(int)aa[i][1]][1]=aa[i][2]-kosu[(int)ban-1];
		}
		String unti="";
		String buri="";
		for(int i=0; i<M; i++) {
			long aaaa=ansss[i][0]/10000000000L;
			unti=String.format("%06d", (int)(aaaa));
			buri=String.format("%06d", (int)(ansss[i][1]));
			System.out.println(unti+buri);
		}
	}
	static void quick_sort(long[][] d, int left, int right) {
		if (left>=right) {
			return;
		}
		long p = d[(left+right)/2][0];
		int l = left, r = right;
		long tmp,tmp1,tmp2;
		while(l<=r) {
			while(d[l][0] < p) { l++; }
			while(d[r][0] > p) { r--; }
			if (l<=r) {
				tmp = d[l][0]; d[l][0] = d[r][0]; d[r][0] = tmp;
				tmp1=d[l][1]; tmp2=d[r][1]; d[l][1]=tmp2; d[r][1]=tmp1;
				l++; r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
  
  
  class FastScanner {

	private final InputStream in = System.in;

	private final byte[] buffer = new byte[1024];

	private int ptr = 0;
	private int buflen = 0;
 
	private boolean hasNextByte() {
		if (ptr < buflen) return true;
		else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) return false;
		}
		return true;
	}
 
	private byte readByte() {
		if (hasNextByte()) return buffer[ptr++];
		return -1;
	}
 
	private boolean isPrintableChar(byte c) {
		return '!' <= c && c <= '~';
	}
 
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}
 
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
 
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		byte b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
 
	public int nextInt() {
		if (!hasNext()) throw new NoSuchElementException();
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
 
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:15: error: expected ':' before 'static'
    3 |         public static void main(String[] args) {
      |               ^~~~~~~
      |               :
a.cc:3:33: error: 'String' has not been declared
    3 |         public static void main(String[] args) {
      |                                 ^~~~~~
a.cc:3:42: error: expected ',' or '...' before 'args'
    3 |         public static void main(String[] args) {
      |                                          ^~~~
a.cc:41:39: error: multidimensional array must have bounds for all dimensions except the first
   41 |         static void quick_sort(long[][] d, int left, int right) {
      |                                       ^
a.cc:41:41: error: expected ',' or '...' before 'd'
   41 |         static void quick_sort(long[][] d, int left, int right) {
      |                                         ^
a.cc:64:16: error: expected ':' before 'final'
   64 |         private final InputStream in = System.in;
      |                ^~~~~~
      |                :
a.cc:64:17: error: 'final' does not name a type
   64 |         private final InputStream in = System.in;
      |                 ^~~~~
a.cc:66:16: error: expected ':' before 'final'
   66 |         private final byte[] buffer = new byte[1024];
      |                ^~~~~~
      |                :
a.cc:66:17: error: 'final' does not name a type
   66 |         private final byte[] buffer = new byte[1024];
      |                 ^~~~~
a.cc:68:16: error: expected ':' before 'int'
   68 |         private int ptr = 0;
      |                ^~~~
      |                :
a.cc:69:16: error: expected ':' before 'int'
   69 |         private int buflen = 0;
      |                ^~~~
      |                :
a.cc:71:16: error: expected ':' before 'boolean'
   71 |         private boolean hasNextByte() {
      |                ^~~~~~~~
      |                :
a.cc:71:17: error: 'boolean' does not name a type; did you mean 'bool'?
   71 |         private boolean hasNextByte() {
      |                 ^~~~~~~
      |                 bool
a.cc:85:16: error: expected ':' before 'byte'
   85 |         private byte readByte() {
      |                ^~~~~
      |                :
a.cc:85:17: error: 'byte' does not name a type
   85 |         private byte readByte() {
      |                 ^~~~
a.cc:90:16: error: expected ':' before 'boolean'
   90 |         private boolean isPrintableChar(byte c) {
      |                ^~~~~~~~
      |                :
a.cc:90:17: error: 'boolean' does not name a type; did you mean 'bool'?
   90 |         private boolean isPrintableChar(byte c) {
      |                 ^~~~~~~
      |                 bool
a.cc:94:16: error: expected ':' before 'void'
   94 |         private void skipUnprintable() {
      |                ^~~~~
      |                :
a.cc:100:15: error: expected ':' before 'boolean'
  100 |         public boolean hasNext() {
      |               ^~~~~~~~
      |               :
a.cc:100:16: error: 'boolean' does not name a type; did you mean 'bool'?
  100 |         public boolean hasNext() {
      |                ^~~~~~~
      |                bool
a.cc:105:15: error: expected ':' before 'String'
  105 |         public String next() {
      |               ^~~~~~~
      |               :
a.cc:105:16: error: 'String' does not name a type
  105 |         public String next() {
      |                ^~~~~~
a.cc:116:15: error: expected ':' before 'int'
  116 |         public int nextInt() {
      |               ^~~~
      |               :
a.cc:139:15: error: expected ':' before 'long'
  139 |         public long nextLong() {
      |               ^~~~~
      |               :
a.cc:161:2: error: expected ';' after class definition
  161 | }
      |  ^
      |  ;
a.cc:162:2: error: expected ';' after class definition
  162 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:4:34: error: conversion from 'Main::FastScanner*' to non-scalar type 'Main::FastScanner' requested
    4 |                 FastScanner sc = new FastScanner();
      |                                  ^~~~~~~~~~~~~~~~~
a.cc:7:20: error: structured binding declaration cannot have type 'int'
    7 |                 int[] kosu=new int[100001];
      |                    ^~
a.cc:7:20: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:7:20: error: empty structured binding declaration
a.cc:7:23: error: expected initializer before 'kosu'
    7 |                 int[] kosu=new int[100001];
      |                       ^~~~
a.cc:8:21: error: structured binding declaration cannot have type 'long int'
    8 |                 long[][] aa=new long[M][3];
      |                     ^~
a.cc:8:21: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:8:21: error: empty structured binding declaration
a.cc:8:23: error: expected initializer before '[' token
    8 |                 long[][] aa=new long[M][3];
      |                       ^
a.cc:10:25: error: 'kosu' was not declared in this scope
   10 |                         kosu[i]=0;
      |                         ^~~~
a.cc:15:25: error: 'kosu' was not declared in this scope
   15 |                         kosu[(int)a]++;
      |                         ^~~~
a.cc:16:25: error: 'aa' was not declared in this scope; did you mean 'a'?
   16 |                         aa[i][0]=a*10000000000L+b;
      |                         ^~
      |                         a
a.cc:20:25: error: 'kosu' was not declared in this scope
   20 |                         kosu[i]=kosu[i-1]+kosu[i];
      |                         ^~~~
a.cc:22:28: error: 'aa' was not declared in this scope
   22 |                 quick_sort(aa,0,M-1);
      |                            ^~
a.cc:26:21: error: structured binding declaration cannot have type 'long int'
   26 |                 long[][] ansss=new long[M+1][2];
      |                     ^~
a.cc:26:21: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:26:21: error: empty structured binding declaration
a.cc:26:23: error: expected initializer before '[' token
   26 |                 long[][] ansss=new long[M+1][2];
      |                       ^
a.cc:28:25: error: 'ansss' was not declared in this scope
   28 |                         ansss[(int)aa[i][1]][0]=aa[i][0];
      |                         ^~~~~
a.cc:30:58: error: 'kosu' was not declared in this scope
   30 |                         ansss[(int)aa[i][1]][1]=aa[i][2]-kosu[(int)ban-1];
      |                                                          ^~~~
a.cc:32:17: error: 'String' was not declared in this scope
   32 |                 String unti="";
      |                 ^~~~~~
a.cc:33:24: error: expected ';' before 'buri'
   33 |                 String buri="";
      |                        ^~~~
a.cc:35:35: error: 'ansss' was not declared in this scope
   35 |                         long aaaa=ansss[i][0]/10000000000L;
      |                                   ^~~~~
a.cc:36:25: error: 'unti' was not declared in this scope
   36 |                         unti=String.format("%06d", (int)(aaaa));
      |                         ^~~~
a.cc:37:25: error: 'buri' was not declared in this scope
   37 |                         buri=String.format("%06d", (int)(ansss[i][1]));
      |                         ^~~~
a.cc:38:25: error: 'System' was not declared in this scope
   38 |                         System.out.println(unti+buri);
      |                         ^~~~~~
a.cc: In static member function 'static void Main::quick_sort(...)':
a.cc:42:21: error: 'left' was not declared in this scope
   42 |                 if (left>=right) {
      |                     ^~~~
a.cc:42:27: error: 'right' was not declared in this scope
   42 |                 if (left>=right) {
      |                           ^~~~~
a.cc:45:26: error: 'd' was not declared in this scope
   45 |                 long p = d[(left+right)/2][0];
      |                          ^
a.cc:45:29: error: 'left' was not declared in this scope
   45 |                 long p = d[(left+right)/2][0];
      |                             ^~~~
a.cc:45:34: error: 'right' was not declared in this scope
   45 |                 long p = d[(left+right)/2][0];
      |                                  ^~~~~
a.cc: In member function 'void Main::FastScanner::skipUnprintable()':
a.cc:95:24: error: 'hasNextByte' was not declared in this scope
   95 |                 while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      |                        ^~~~~~~~~~~
a.cc:95:58: error: 'buffer' was not declared in this scope; did you mean 'buflen'?
   95 |                 while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      |                                                          ^~~~~~
      |                                                          buflen
a.cc:95:42: error: 'isPrintableChar' was not declared in this scope
   95 |                 while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      |                                          ^~~~~~~~~~~~~~~
a.cc: In member function 'int Main::FastScanner::nextInt()':
a.cc:117:22: error: 'hasNext' was not declared in this scope
  117 |                 if (!hasNext()) throw new NoSuchElementException();
      |                      ^~~~~~~
a.cc:117:43: error: expected type-specifier before 'NoSuchElementException'
  117 |                 if (!hasNext()) throw new NoSuchElementException();
      |                                           ^~~~~~~~~~~~~~~~~~~~~~
a.cc:119:17: error: 'boolean' was not declared in this scope; did you mean 'bool'?
  119 |                 boolean minus = false;
      |                 ^~~~~~~
      |                 bool
a.cc:120:17: error: 'byte' was not declared in this scope
  120 |                 byte b = readByte();
      |                 ^~~~
a.cc:121:21: error: 'b' was not declared in this scope
  121 |                 if (b == '-') {
      |                     ^
a.cc:122:25: error: 'minu