Language: C++

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Collections;

import java.util.Comparator;

class Main{
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);

		int d[]={9,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9};

		int n = in.nextInt();
		for(int i = 0; i < n; i++){
			int s =in.nextInt(), e = in.nextInt();
			ArrayList<String> al = new ArrayList<String>();
			for(int j = 0; j < d.length; j++){
				StringBuilder sb = new StringBuilder();
				if(d[j] == s){
					for(int k = j; k < d.length; k++){
						if(k != j) sb.append(" ");
						sb.append((char)('0' + d[k]));
						if(d[k] == e){
							al.add(sb.toString());
							break;
						}
					}
				}
			}
			Collections.sort(al, new Comp());
			System.out.println(al.get(0));
		}
	}
}

class Comp implements Comparator<String>{
	public int compare(String a, String b){
		int l1 = a.length(), l2 = b.length();
		if(l1 > l2) return 1;
		else if (l1 == l2) return 0;
		else return -1;
	}
}

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:2:1: error: 'import' does not name a type
    2 | import java.util.ArrayList;
      | ^~~~~~
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 java.util.Iterator;
      | ^~~~~~
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 java.util.Collections;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.Comparator;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:15: error: expected ':' before 'static'
    9 |         public static void main(String args[]){
      |               ^~~~~~~
      |               :
a.cc:9:33: error: 'String' has not been declared
    9 |         public static void main(String args[]){
      |                                 ^~~~~~
a.cc:35:2: error: expected ';' after class definition
   35 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:10:17: error: 'Scanner' was not declared in this scope
   10 |                 Scanner in = new Scanner(System.in);
      |                 ^~~~~~~
a.cc:14:25: error: 'in' was not declared in this scope; did you mean 'int'?
   14 |                 int n = in.nextInt();
      |                         ^~
      |                         int
a.cc:17:25: error: 'ArrayList' was not declared in this scope
   17 |                         ArrayList<String> al = new ArrayList<String>();
      |                         ^~~~~~~~~
a.cc:17:35: error: 'String' was not declared in this scope
   17 |                         ArrayList<String> al = new ArrayList<String>();
      |                                   ^~~~~~
a.cc:17:43: error: 'al' was not declared in this scope
   17 |                         ArrayList<String> al = new ArrayList<String>();
      |                                           ^~
a.cc:17:52: error: 'ArrayList' does not name a type
   17 |                         ArrayList<String> al = new ArrayList<String>();
      |                                                    ^~~~~~~~~
a.cc:17:70: error: expected primary-expression before ')' token
   17 |                         ArrayList<String> al = new ArrayList<String>();
      |                                                                      ^
a.cc:18:46: error: request for member 'length' in 'd', which is of non-class type 'int [16]'
   18 |                         for(int j = 0; j < d.length; j++){
      |                                              ^~~~~~
a.cc:19:33: error: 'StringBuilder' was not declared in this scope
   19 |                                 StringBuilder sb = new StringBuilder();
      |                                 ^~~~~~~~~~~~~
a.cc:21:62: error: request for member 'length' in 'd', which is of non-class type 'int [16]'
   21 |                                         for(int k = j; k < d.length; k++){
      |                                                              ^~~~~~
a.cc:22:60: error: 'sb' was not declared in this scope; did you mean 's'?
   22 |                                                 if(k != j) sb.append(" ");
      |                                                            ^~
      |                                                            s
a.cc:23:49: error: 'sb' was not declared in this scope; did you mean 's'?
   23 |                                                 sb.append((char)('0' + d[k]));
      |                                                 ^~
      |                                                 s
a.cc:24:60: error: 'e' was not declared in this scope
   24 |                                                 if(d[k] == e){
      |                                                            ^
a.cc:31:25: error: 'Collections' was not declared in this scope
   31 |                         Collections.sort(al, new Comp());
      |                         ^~~~~~~~~~~
a.cc:31:50: error: expected type-specifier before 'Comp'
   31 |                         Collections.sort(al, new Comp());
      |                                                  ^~~~
a.cc:32:25: error: 'System' was not declared in this scope
   32 |                         System.out.println(al.get(0));
      |                         ^~~~~~
a.cc: At global scope:
a.cc:37:23: error: expected initializer before 'Comparator'
   37 | class Comp implements Comparator<String>{
      |                       ^~~~~~~~~~