Language: C++

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
class Main {
	class AOJ0504{
		void run(){
			Scanner sc=new Scanner(System.in);
			BigDecimal answer = new BigDecimal(1);
			BigDecimal one = new BigDecimal(1);
			int n = sc.nextInt();
			int k = sc.nextInt();
			int m = sc.nextInt();
			int r = sc.nextInt();
			if(n == 0) return ;
			if(m==1){
				for(int i = 1 ; i <= n-1 ; i++){
					//System.out.printf("%d\n",i);
					answer = answer.add(one.divide(new BigDecimal(i),10000,BigDecimal.ROUND_HALF_UP));
				}
			}
			answer = answer.divide(new BigDecimal(n),10000,BigDecimal.ROUND_HALF_UP);
			String s = answer.toPlainString();
			for(int i = 0 ; i < r+2 ; i++)
				System.out.printf("%c",s.charAt(i));
			System.out.printf("\n");
		}
	}
	public static void main(String[] args) {
		new Main().new AOJ0504().run();
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.math.BigDecimal;
      | ^~~~~~
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.math.BigInteger;
      | ^~~~~~
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.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:27:10: error: expected ';' after class definition
   27 |         }
      |          ^
      |          ;
a.cc:28:15: error: expected ':' before 'static'
   28 |         public static void main(String[] args) {
      |               ^~~~~~~
      |               :
a.cc:28:33: error: 'String' has not been declared
   28 |         public static void main(String[] args) {
      |                                 ^~~~~~
a.cc:28:42: error: expected ',' or '...' before 'args'
   28 |         public static void main(String[] args) {
      |                                          ^~~~
a.cc:31:2: error: expected ';' after class definition
   31 | }
      |  ^
      |  ;
a.cc: In member function 'void Main::AOJ0504::run()':
a.cc:7:25: error: 'Scanner' was not declared in this scope
    7 |                         Scanner sc=new Scanner(System.in);
      |                         ^~~~~~~
a.cc:8:25: error: 'BigDecimal' was not declared in this scope
    8 |                         BigDecimal answer = new BigDecimal(1);
      |                         ^~~~~~~~~~
a.cc:9:36: error: expected ';' before 'one'
    9 |                         BigDecimal one = new BigDecimal(1);
      |                                    ^~~
a.cc:10:33: error: 'sc' was not declared in this scope
   10 |                         int n = sc.nextInt();
      |                                 ^~
a.cc:18:41: error: 'answer' was not declared in this scope
   18 |                                         answer = answer.add(one.divide(new BigDecimal(i),10000,BigDecimal.ROUND_HALF_UP));
      |                                         ^~~~~~
a.cc:18:61: error: 'one' was not declared in this scope
   18 |                                         answer = answer.add(one.divide(new BigDecimal(i),10000,BigDecimal.ROUND_HALF_UP));
      |                                                             ^~~
a.cc:18:76: error: expected type-specifier before 'BigDecimal'
   18 |                                         answer = answer.add(one.divide(new BigDecimal(i),10000,BigDecimal.ROUND_HALF_UP));
      |                                                                            ^~~~~~~~~~
a.cc:21:25: error: 'answer' was not declared in this scope
   21 |                         answer = answer.divide(new BigDecimal(n),10000,BigDecimal.ROUND_HALF_UP);
      |                         ^~~~~~
a.cc:21:52: error: expected type-specifier before 'BigDecimal'
   21 |                         answer = answer.divide(new BigDecimal(n),10000,BigDecimal.ROUND_HALF_UP);
      |                                                    ^~~~~~~~~~
a.cc:22:25: error: 'String' was not declared in this scope
   22 |                         String s = answer.toPlainString();
      |                         ^~~~~~
a.cc:24:33: error: 'System' was not declared in this scope
   24 |                                 System.out.printf("%c",s.charAt(i));
      |                                 ^~~~~~
a.cc:24:56: error: 's' was not declared in this scope
   24 |                                 System.out.printf("%c",s.charAt(i));
      |                                                        ^
a.cc:25:25: error: 'System' was not declared in this scope
   25 |                         System.out.printf("\n");
      |                         ^~~~~~
a.cc: In static member function 'static void Main::main(int*)':
a.cc:29:27: error: expected ';' before '.' token
   29 |                 new Main().new AOJ0504().run();
      |                           ^