Language: C++

import java.util.*;

class Prime2 {
    public static void main(String[] args) {
      
        Scanner scan = new Scanner(System.in);
        int[] x = new int[30];
        int t=0,j,count=0;
        
        
        while(scan.hasNextInt()){
        	count = 0;
			int lim = scan.nextInt();
        	int ptr = 0; //?????????????´???°?????°
        	int[] prime = new int[500000]; //?´???°???????´?????????????
        	
        	if(lim >= 2){
        		prime[ptr++] = 2; 
        		count++;
        	}
        	if(lim >= 3){
				prime[ptr++] = 3; 
				count++;
			}
			
        	for (int n = 5; n <= lim; n += 2) { 
        	    boolean wflag = false; 
        	    for (int i = 1; prime[i] * prime[i] <= n; i++) {
              
            	    if (0 == n % prime[i]) {
                    	wflag = true;
                    	break;
                	}
            	}
            	if (!wflag) { 
                	prime[ptr++] = n; 
                	count++; 
            	}
        	}
        	x[t] = count;
        	t++;
        	
		}
        	for (int i : x)  
            	System.out.println(i);
    }
}

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:4:11: error: expected ':' before 'static'
    4 |     public static void main(String[] args) {
      |           ^~~~~~~
      |           :
a.cc:4:29: error: 'String' has not been declared
    4 |     public static void main(String[] args) {
      |                             ^~~~~~
a.cc:4:38: error: expected ',' or '...' before 'args'
    4 |     public static void main(String[] args) {
      |                                      ^~~~
a.cc:47:2: error: expected ';' after class definition
   47 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Prime2::main(int*)':
a.cc:6:9: error: 'Scanner' was not declared in this scope
    6 |         Scanner scan = new Scanner(System.in);
      |         ^~~~~~~
a.cc:7:12: error: structured binding declaration cannot have type 'int'
    7 |         int[] x = new int[30];
      |            ^~
a.cc:7:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:7:12: error: empty structured binding declaration
a.cc:7:15: error: expected initializer before 'x'
    7 |         int[] x = new int[30];
      |               ^
a.cc:11:15: error: 'scan' was not declared in this scope
   11 |         while(scan.hasNextInt()){
      |               ^~~~
a.cc:15:20: error: structured binding declaration cannot have type 'int'
   15 |                 int[] prime = new int[500000]; //?´???°???????´?????????????
      |                    ^~
a.cc:15:20: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:15:20: error: empty structured binding declaration
a.cc:15:23: error: expected initializer before 'prime'
   15 |                 int[] prime = new int[500000]; //?´???°???????´?????????????
      |                       ^~~~~
a.cc:18:25: error: 'prime' was not declared in this scope; did you mean 'Prime2'?
   18 |                         prime[ptr++] = 2;
      |                         ^~~~~
      |                         Prime2
a.cc:22:33: error: 'prime' was not declared in this scope; did you mean 'Prime2'?
   22 |                                 prime[ptr++] = 3;
      |                                 ^~~~~
      |                                 Prime2
a.cc:27:21: error: 'boolean' was not declared in this scope; did you mean 'bool'?
   27 |                     boolean wflag = false;
      |                     ^~~~~~~
      |                     bool
a.cc:28:37: error: 'prime' was not declared in this scope; did you mean 'Prime2'?
   28 |                     for (int i = 1; prime[i] * prime[i] <= n; i++) {
      |                                     ^~~~~
      |                                     Prime2
a.cc:31:25: error: 'wflag' was not declared in this scope
   31 |                         wflag = true;
      |                         ^~~~~
a.cc:35:22: error: 'wflag' was not declared in this scope
   35 |                 if (!wflag) {
      |                      ^~~~~
a.cc:36:25: error: 'prime' was not declared in this scope; did you mean 'Prime2'?
   36 |                         prime[ptr++] = n;
      |                         ^~~~~
      |                         Prime2
a.cc:40:17: error: 'x' was not declared in this scope
   40 |                 x[t] = count;
      |                 ^
a.cc:44:30: error: 'x' was not declared in this scope
   44 |                 for (int i : x)
      |                              ^
a.cc:45:17: error: 'System' was not declared in this scope
   45 |                 System.out.println(i);
      |                 ^~~~~~