Language: C++

import java.util.LinkedList;
import java.util.Scanner;

class Main {
	int a,b,c,d,e,f;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Main m = new Main(sc);
		m.solve();
		sc.close();
	}

	Main(Scanner sc) {
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		d = sc.nextInt();
		e = sc.nextInt();
		f = sc.nextInt();
	}

	void solve() {
		double max = 0;
		int water = 100 * a;
		int sugar = 0;
		LinkedList<String> memo = new LinkedList<String>();
		for(int i=1;100*a*i<=f;i++){
			for(int j=0;100*b*j+100*a*i<=f;j++){
				for(int k=0;k*c<=(b*j+a*i)*e&&100*b*j+100*a*i+k*c<=f;k++){
					int l = Math.min((f-(100*b*j+100*a*i+k*c))/d, ((b*j+a*i)*e-k*c)/d);
					if(!memo.contains(String.valueOf(100*b*j+100*a*i)+" "+String.valueOf(k*c+l*d))){
						double n = 100.0*(k*c+l*d) / (k*c+l*d+100*b*j+100*a*i);
						//System.out.printf("水:%d 砂糖：%d 濃度:%f\n",100*b*j+100*a*i,k*c+l*d,n);
						if(n > max){
							max = n;
							water = 100*b*j+100*a*i;
							sugar = k*c+l*d;
						}
						memo.add(String.valueOf(100*b*j+100*a*i)+" "+String.valueOf(k*c+l*d));
					}
				}
			}
		}
		System.out.println((sugar+water)+" "+sugar);
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.LinkedList;
      | ^~~~~~
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.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:15: error: expected ':' before 'static'
    7 |         public static void main(String[] args) {
      |               ^~~~~~~
      |               :
a.cc:7:33: error: 'String' has not been declared
    7 |         public static void main(String[] args) {
      |                                 ^~~~~~
a.cc:7:42: error: expected ',' or '...' before 'args'
    7 |         public static void main(String[] args) {
      |                                          ^~~~
a.cc:14:21: error: expected ')' before 'sc'
   14 |         Main(Scanner sc) {
      |             ~       ^~~
      |                     )
a.cc:47:2: error: expected ';' after class definition
   47 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:8:17: error: 'Scanner' was not declared in this scope
    8 |                 Scanner sc = new Scanner(System.in);
      |                 ^~~~~~~
a.cc:9:35: error: 'sc' was not declared in this scope; did you mean 'c'?
    9 |                 Main m = new Main(sc);
      |                                   ^~
      |                                   c
a.cc: In member function 'void Main::solve()':
a.cc:27:17: error: 'LinkedList' was not declared in this scope
   27 |                 LinkedList<String> memo = new LinkedList<String>();
      |                 ^~~~~~~~~~
a.cc:27:28: error: 'String' was not declared in this scope
   27 |                 LinkedList<String> memo = new LinkedList<String>();
      |                            ^~~~~~
a.cc:27:36: error: 'memo' was not declared in this scope
   27 |                 LinkedList<String> memo = new LinkedList<String>();
      |                                    ^~~~
a.cc:27:47: error: 'LinkedList' does not name a type
   27 |                 LinkedList<String> memo = new LinkedList<String>();
      |                                               ^~~~~~~~~~
a.cc:27:66: error: expected primary-expression before ')' token
   27 |                 LinkedList<String> memo = new LinkedList<String>();
      |                                                                  ^
a.cc:31:49: error: 'Math' was not declared in this scope
   31 |                                         int l = Math.min((f-(100*b*j+100*a*i+k*c))/d, ((b*j+a*i)*e-k*c)/d);
      |                                                 ^~~~
a.cc:45:17: error: 'System' was not declared in this scope
   45 |                 System.out.println((sugar+water)+" "+sugar);
      |                 ^~~~~~