Language: C++

import java.util.*;
import static java.lang.System.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int P[] = new int[M];
    int Y[] = new int[M];
    List<List> A = new ArrayList<List>(N);
    for(int i=0; i<N; i++){
      List<Integer> B = new ArrayList<Integer>();
      A.add(B);
    }      
    for(int i=0; i<M; i++){
      P[i] = sc.nextInt();
      Y[i] = sc.nextInt();
      A.get(P[i]-1).add(Y[i]);
    }
    for(int i=0; i<N; i++){
      Collections.sort(A.get(i));
    }
    for(int i=0; i<M; i++){
      int x = A.get(P[i]-1).indexOf(Y[i]) + 1;
      out.printf("%06d%06d\n",P[i],x);
    }
    
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
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 static java.lang.System.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:9: error: expected ':' before 'static'
    5 |   public static final int MOD = 1000000007;
      |         ^~~~~~~
      |         :
a.cc:5:17: error: 'final' does not name a type
    5 |   public static final int MOD = 1000000007;
      |                 ^~~~~
a.cc:6:9: error: expected ':' before 'static'
    6 |   public static final int INF = 1000000000;
      |         ^~~~~~~
      |         :
a.cc:6:17: error: 'final' does not name a type
    6 |   public static final int INF = 1000000000;
      |                 ^~~~~
a.cc:7:9: error: expected ':' before 'static'
    7 |   public static void main(String[] args) {
      |         ^~~~~~~
      |         :
a.cc:7:27: error: 'String' has not been declared
    7 |   public static void main(String[] args) {
      |                           ^~~~~~
a.cc:7:36: error: expected ',' or '...' before 'args'
    7 |   public static void main(String[] args) {
      |                                    ^~~~
a.cc:33:9: error: expected ':' before 'static'
   33 |   public static int gcd(int a, int b){
      |         ^~~~~~~
      |         :
a.cc:37:2: error: expected ';' after class definition
   37 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:8:5: error: 'Scanner' was not declared in this scope
    8 |     Scanner sc = new Scanner(in);
      |     ^~~~~~~
a.cc:9:13: error: 'sc' was not declared in this scope
    9 |     int N = sc.nextInt();
      |             ^~
a.cc:11:15: error: initializer fails to determine size of 'P'
   11 |     int P[] = new int[M];
      |               ^~~~~~~~~~
a.cc:11:15: error: array must be initialized with a brace-enclosed initializer
a.cc:12:15: error: initializer fails to determine size of 'Y'
   12 |     int Y[] = new int[M];
      |               ^~~~~~~~~~
a.cc:12:15: error: array must be initialized with a brace-enclosed initializer
a.cc:13:5: error: 'List' was not declared in this scope
   13 |     List<List> A = new ArrayList<List>(N);
      |     ^~~~
a.cc:13:16: error: 'A' was not declared in this scope
   13 |     List<List> A = new ArrayList<List>(N);
      |                ^
a.cc:13:24: error: 'ArrayList' does not name a type
   13 |     List<List> A = new ArrayList<List>(N);
      |                        ^~~~~~~~~
a.cc:15:12: error: 'Integer' was not declared in this scope
   15 |       List<Integer> B = new ArrayList<Integer>();
      |            ^~~~~~~
a.cc:15:21: error: 'B' was not declared in this scope
   15 |       List<Integer> B = new ArrayList<Integer>();
      |                     ^
a.cc:15:29: error: 'ArrayList' does not name a type
   15 |       List<Integer> B = new ArrayList<Integer>();
      |                             ^~~~~~~~~
a.cc:15:48: error: expected primary-expression before ')' token
   15 |       List<Integer> B = new ArrayList<Integer>();
      |                                                ^
a.cc:24:7: error: 'Collections' was not declared in this scope
   24 |       Collections.sort(A.get(i));
      |       ^~~~~~~~~~~
a.cc:28:7: error: 'out' was not declared in this scope
   28 |       out.printf("%06d%06d\n",P[i],x);
      |       ^~~