Language: C++

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;

public class Main {
	
	public static void main(String[] args) throws IOException {
		new Main().exec();
	}
	
	int[] rc;
	int[][] min;

	public void exec() throws IOException {
		InputUtil in = new InputUtil();
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		rc = in.nextInt(new int[n*2]);
		min = new int[n][n];
		out.println(minCount(0,n-1));
		out.flush();
	}
	
	private int minCount(int from, int to) {
		int ans=Integer.MAX_VALUE;
		if(from==to) 
			ans = 0;
		else if(from+1==to) 
			ans = rc[from*2]*rc[to*2]*rc[to*2+1];
		else {
			for(int mid=from+1; mid<=to; mid++){
				ans = Math.min(ans, minCount(from,mid-1) + minCount(mid,to) + rc[from*2]*rc[mid*2]*rc[to*2+1]);
			}
		}
		return min[from][to] = ans;
	}
}

class InputUtil {
	//Static Fields
	private static final int BUFSIZ = 100000;
	
	//Fields
	protected InputStream in;
	private byte[] buf = null;
	private int ptr = 0;
	private int max = -1;
	private DataInputStream dis = null;
	//Constructors
	public InputUtil() {this(System.in,BUFSIZ);}
	public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	}
	
	//Methods
	//Initializer
	protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
	protected void initBuf(int bufsiz) {buf = new byte[bufsiz];}
	
	//buffer operation
	private void next() throws IOException {ptr++; readBuf();}
	private void readBuf() throws IOException {
		if(ptr >= max && dis.available()>0) {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		}
	}
	
	//Number Input Reader/Parser
	private boolean isNum(byte b) {return '0' <= b && b <= '9'; }
	private boolean isMinus(byte b) {return b=='-'; }

	private int _nextInt() throws IOException {
		int sign = 1;
		int res = 0;
		byte c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	}
	
	public int nextInt() throws IOException {
		readBuf();
		return _nextInt();
	}

	public int[] nextInt(int[] result) throws IOException {
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextInt();
		}
		return result;
	}
	
	//Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	}

}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.DataInputStream;
      | ^~~~~~
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.io.IOException;
      | ^~~~~~
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.io.InputStream;
      | ^~~~~~
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.io.PrintWriter;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Arrays;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main {
      | ^~~~~~
a.cc:43:16: error: expected ':' before 'static'
   43 |         private static final int BUFSIZ = 100000;
      |                ^~~~~~~
      |                :
a.cc:43:24: error: 'final' does not name a type
   43 |         private static final int BUFSIZ = 100000;
      |                        ^~~~~
a.cc:46:18: error: expected ':' before 'InputStream'
   46 |         protected InputStream in;
      |                  ^~~~~~~~~~~~
      |                  :
a.cc:46:19: error: 'InputStream' does not name a type
   46 |         protected InputStream in;
      |                   ^~~~~~~~~~~
a.cc:47:16: error: expected ':' before 'byte'
   47 |         private byte[] buf = null;
      |                ^~~~~
      |                :
a.cc:47:17: error: 'byte' does not name a type
   47 |         private byte[] buf = null;
      |                 ^~~~
a.cc:48:16: error: expected ':' before 'int'
   48 |         private int ptr = 0;
      |                ^~~~
      |                :
a.cc:49:16: error: expected ':' before 'int'
   49 |         private int max = -1;
      |                ^~~~
      |                :
a.cc:50:16: error: expected ':' before 'DataInputStream'
   50 |         private DataInputStream dis = null;
      |                ^~~~~~~~~~~~~~~~
      |                :
a.cc:50:17: error: 'DataInputStream' does not name a type
   50 |         private DataInputStream dis = null;
      |                 ^~~~~~~~~~~~~~~
a.cc:52:15: error: expected ':' before 'InputUtil'
   52 |         public InputUtil() {this(System.in,BUFSIZ);}
      |               ^~~~~~~~~~
      |               :
a.cc:53:15: error: expected ':' before 'InputUtil'
   53 |         public InputUtil(InputStream in, int bufsiz) {
      |               ^~~~~~~~~~
      |               :
a.cc:53:37: error: expected ')' before 'in'
   53 |         public InputUtil(InputStream in, int bufsiz) {
      |                         ~           ^~~
      |                                     )
a.cc:60:18: error: expected ':' before 'void'
   60 |         protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
      |                  ^~~~~
      |                  :
a.cc:60:31: error: 'InputStream' has not been declared
   60 |         protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
      |                               ^~~~~~~~~~~
a.cc:61:18: error: expected ':' before 'void'
   61 |         protected void initBuf(int bufsiz) {buf = new byte[bufsiz];}
      |                  ^~~~~
      |                  :
a.cc:64:16: error: expected ':' before 'void'
   64 |         private void next() throws IOException {ptr++; readBuf();}
      |                ^~~~~
      |                :
a.cc:64:27: error: expected ';' at end of member declaration
   64 |         private void next() throws IOException {ptr++; readBuf();}
      |                           ^
      |                            ;
a.cc:64:29: error: 'throws' does not name a type
   64 |         private void next() throws IOException {ptr++; readBuf();}
      |                             ^~~~~~
a.cc:65:16: error: expected ':' before 'void'
   65 |         private void readBuf() throws IOException {
      |                ^~~~~
      |                :
a.cc:65:30: error: expected ';' at end of member declaration
   65 |         private void readBuf() throws IOException {
      |                              ^
      |                               ;
a.cc:65:32: error: 'throws' does not name a type
   65 |         private void readBuf() throws IOException {
      |                                ^~~~~~
a.cc:74:16: error: expected ':' before 'boolean'
   74 |         private boolean isNum(byte b) {return '0' <= b && b <= '9'; }
      |                ^~~~~~~~
      |                :
a.cc:74:17: error: 'boolean' does not name a type; did you mean 'bool'?
   74 |         private boolean isNum(byte b) {return '0' <= b && b <= '9'; }
      |                 ^~~~~~~
      |                 bool
a.cc:75:16: error: expected ':' before 'boolean'
   75 |         private boolean isMinus(byte b) {return b=='-'; }
      |                ^~~~~~~~
      |                :
a.cc:75:17: error: 'boolean' does not name a type; did you mean 'bool'?
   75 |         private boolean isMinus(byte b) {return b=='-'; }
      |                 ^~~~~~~
      |                 bool
a.cc:77:16: error: expected ':' before 'int'
   77 |         private int _nextInt() throws IOException {
      |                ^~~~
      |                :
a.cc:77:30: error: expected ';' at end of member declaration
   77 |         private int _nextInt() throws IOException {
      |                              ^
      |                               ;
a.cc:77:32: error: 'throws' does not name a type
   77 |         private int _nextInt() throws IOException {
      |                                ^~~~~~
a.cc:96:15: error: expected ':' before 'int'
   96 |         public int nextInt() throws IOException {
      |               ^~~~
      |               :
a.cc:96:28: error: expected ';' at end of member declaration
   96 |         public int nextInt() throws IOException {
      |                            ^
      |                             ;
a.cc:96:30: error: 'throws' does not name a type
   96 |         public int nextInt() throws IOException {
      |                              ^~~~~~
a.cc:101:15: error: expected ':' before 'int'
  101 |         public int[] nextInt(int[] result) throws IOException {
      |               ^~~~
      |               :
a.cc:101:19: error: expected unqualified-id before '[' token
  101 |         public int[] nextInt(int[] result) throws IOException {
      |                   ^
a.cc:110:15: error: expected ':' before 'void'
  110 |         public void close() throws IOException {
      |               ^~~~~
      |               :
a.cc:110:27: error: expected ';' at end of member declaration
  110 |         public void close() throws IOException {
      |                           ^
      |                            ;
a.cc:110:29: error: 'throws' does not name a type
  110 |         public void close() throws IOException {
      |                             ^~~~~~
a.cc:115:2: error: expected ';' after class definition
  115 | }
      |  ^
      |  ;
a.cc: In constructor 'InputUtil::InputUtil()':
a.cc:52:34: error: 'System' was not declared in this scope
   52 |         public InputUtil() {this(System.in,BUFSIZ);}
      |                                  ^~~~~~
a.cc:52:44: error: 'BUFSIZ' was not declared in this scope
   52 |         public InputUtil() {this(System.in,BUFSIZ);}
      |                                            ^~~~~~
a.cc:1:1: note: 'BUFSIZ' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | import java.io.DataInputStream;
a.cc:52:50: error: expression cannot be used as a function
   52 |         public InputUtil() {this(System.in,BUFSIZ);}
      |                                                  ^
a.cc: In member function 'void InputUtil::initIn(int)':
a.cc:60:48: error: 'dis' was not declared in this scope
   60 |         protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
      |                                                ^~~
a.cc:60:58: error: expected type-specifier before 'DataInputStream'
   60 |         protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
      |                                                          ^~~~~~~~~~~~~~~
a.cc: In member function 'void InputUtil::initBuf(int)':
a.cc:61:45: error: 'buf' was not declared in this scope
   61 |         protected void initBuf(int bufsiz) {buf = new byte[bufsiz];}
      |                                             ^~~
a.cc:61:55: error: 'byte' does not name a type
   61 |         protected void initBuf(int bufsiz) {buf = new byte[bufsiz];}
      |                                                       ^~~~