Language: C++

import java.util.*;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int leng = sc.nextInt();boolean[] p = new boolean[leng]; 
			int t = sc.nextInt(), pleng = p.length;
			if(pleng==0 & t==0) break;
			Arrays.fill(p, true);
			int tcount = pleng, count = 0;
			while(tcount!=1){
				for(int i = 0;i < t;){
					count++;
					count = count%pleng;
					if(p[count])i++;
				}       
				p[count] = false;
				tcount--;
			}
			int ans = 0;
			while(p[ans] == false ) ans++;
			if(ans==0) ans = pleng;
			System.out.println(ans);
		}
	}

}

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: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:27:2: error: expected ';' after class definition
   27 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:4:17: error: 'Scanner' was not declared in this scope
    4 |                 Scanner sc = new Scanner(System.in);
      |                 ^~~~~~~
a.cc:5:23: error: 'sc' was not declared in this scope
    5 |                 while(sc.hasNext()){
      |                       ^~
a.cc:6:49: error: 'boolean' was not declared in this scope; did you mean 'bool'?
    6 |                         int leng = sc.nextInt();boolean[] p = new boolean[leng];
      |                                                 ^~~~~~~
      |                                                 bool
a.cc:6:57: error: expected primary-expression before ']' token
    6 |                         int leng = sc.nextInt();boolean[] p = new boolean[leng];
      |                                                         ^
a.cc:8:28: error: 'pleng' was not declared in this scope; did you mean 'leng'?
    8 |                         if(pleng==0 & t==0) break;
      |                            ^~~~~
      |                            leng
a.cc:9:25: error: 'Arrays' was not declared in this scope
    9 |                         Arrays.fill(p, true);
      |                         ^~~~~~
a.cc:9:37: error: 'p' was not declared in this scope
    9 |                         Arrays.fill(p, true);
      |                                     ^
a.cc:10:38: error: 'pleng' was not declared in this scope; did you mean 'leng'?
   10 |                         int tcount = pleng, count = 0;
      |                                      ^~~~~
      |                                      leng
a.cc:13:41: error: 'count' was not declared in this scope; did you mean 'tcount'?
   13 |                                         count++;
      |                                         ^~~~~
      |                                         tcount
a.cc:17:35: error: 'count' was not declared in this scope; did you mean 'tcount'?
   17 |                                 p[count] = false;
      |                                   ^~~~~
      |                                   tcount
a.cc:23:25: error: 'System' was not declared in this scope
   23 |                         System.out.println(ans);
      |                         ^~~~~~