Language: C++

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	static int[] h;
	static int[] dp;
	
	static int solve(int start, int end)
	{
		//base case
		if(end-start<=0)
			return 0;
		if(end-start==1)
		    return Math.abs(h[end]-h[start]);	
		
		if(dp[start]==-1)
		{
		    int temp = Math.min(solve(start + 1, end) + Math.abs(h[start] - h[start + 1]), solve(start+2, end) + Math.abs(h[start] - h[start + 2]));
		    dp[start] = temp;
		    return temp;
		}
		else
    		return dp[start];
	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scn = new Scanner(System.in);
		
		int n = scn.nextInt();
		h = new int[n];
		dp = new int[n];
		Arrays.fill(dp, -1); 
		
		for(int i=0; i<n; i++)
			h[i] = scn.nextInt();
		
		System.out.println(solve(0, n-1));
		
		
		
	}
}

Compiler output:
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:4:1: error: 'import' does not name a type
    4 | import java.lang.*;
      | ^~~~~~
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.io.*;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:19: error: expected unqualified-id before '[' token
   10 |         static int[] h;
      |                   ^
a.cc:11:19: error: expected unqualified-id before '[' token
   11 |         static int[] dp;
      |                   ^
a.cc:31:15: error: expected ':' before 'static'
   31 |         public static void main (String[] args) throws java.lang.Exception
      |               ^~~~~~~
      |               :
a.cc:31:34: error: 'String' has not been declared
   31 |         public static void main (String[] args) throws java.lang.Exception
      |                                  ^~~~~~
a.cc:31:43: error: expected ',' or '...' before 'args'
   31 |         public static void main (String[] args) throws java.lang.Exception
      |                                           ^~~~
a.cc:31:47: error: expected ';' at end of member declaration
   31 |         public static void main (String[] args) throws java.lang.Exception
      |                                               ^
      |                                                ;
a.cc:31:49: error: 'throws' does not name a type
   31 |         public static void main (String[] args) throws java.lang.Exception
      |                                                 ^~~~~~
a.cc:48:2: error: expected ';' after class definition
   48 | }
      |  ^
      |  ;
a.cc: In static member function 'static int Ideone::solve(int, int)':
a.cc:19:28: error: 'Math' was not declared in this scope
   19 |                     return Math.abs(h[end]-h[start]);
      |                            ^~~~
a.cc:19:37: error: 'h' was not declared in this scope
   19 |                     return Math.abs(h[end]-h[start]);
      |                                     ^
a.cc:21:20: error: 'dp' was not declared in this scope
   21 |                 if(dp[start]==-1)
      |                    ^~
a.cc:23:32: error: 'Math' was not declared in this scope
   23 |                     int temp = Math.min(solve(start + 1, end) + Math.abs(h[start] - h[start + 1]), solve(start+2, end) + Math.abs(h[start] - h[start + 2]));
      |                                ^~~~
a.cc:23:74: error: 'h' was not declared in this scope
   23 |                     int temp = Math.min(solve(start + 1, end) + Math.abs(h[start] - h[start + 1]), solve(start+2, end) + Math.abs(h[start] - h[start + 2]));
      |                                                                          ^