Language: C++

#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>

#define INT_MIN     (-2147483647 - 1)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(c) for(int i = 0; i <(c); ++i)
#define rrep(n) for(int i = (n) ; i >=0 ; --i)
#define fora(i, s, c) for(int i = (s); i < (c); ++i)
#define forr(i, s, c) for(int i = (s); i > (c); --i)
#define endl "\n"
#define ret(n) return n
#define pb push_back
#define eb emplace_back
#define ff first;
#define ss second;
#define mp make_pair;
#define all(p) p.begin(),p.end()
#define mid(s,e) (s+(e-s)/2)
//Typedefs
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef priority_queue<int> pqint;
typedef priority_queue<ll> pqll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

int mincost(vi& ht, int n, int idx)
{
	if (idx == n - 1)
		return 0; //reached

	if (idx + 2 < n)
	{
		int jump_one = abs(ht[idx + 1] - ht[idx]) + mincost(ht, n, idx + 1);

		int jump_two = abs(ht[idx + 2] - ht[idx]) + mincost(ht, n, idx + 2);

		return min(jump_one, jump_two);
	}
	else if (idx + 1 < n)
	{
		return abs(ht[idx + 1] - ht[idx]) + mincost(ht, n, idx + 1);
	}
	
}

int main()
{
	int n;
	cin >> n;
	vi ht(n);
	rep(n)
		cin >> ht[i];
	auto ans = mincost(ht, n, 0);
	cout << ans;
	ret(0);
}

Compiler output:
a.cc:26:9: error: 'vector' does not name a type
   26 | typedef vector<int> vi;
      |         ^~~~~~
a.cc:27:9: error: 'vector' does not name a type
   27 | typedef vector<vector<int> > vvi;
      |         ^~~~~~
a.cc:28:9: error: 'pair' does not name a type
   28 | typedef pair<ll, ll> pll;
      |         ^~~~
a.cc:29:9: error: 'pair' does not name a type
   29 | typedef pair<int, int> pii;
      |         ^~~~
a.cc:30:9: error: 'priority_queue' does not name a type
   30 | typedef priority_queue<int> pqint;
      |         ^~~~~~~~~~~~~~
a.cc:31:9: error: 'priority_queue' does not name a type
   31 | typedef priority_queue<ll> pqll;
      |         ^~~~~~~~~~~~~~
a.cc:32:9: error: 'vector' does not name a type
   32 | typedef vector<ll> vll;
      |         ^~~~~~
a.cc:33:9: error: 'vector' does not name a type
   33 | typedef vector<vector<ll>> vvll;
      |         ^~~~~~
a.cc:35:13: error: 'vi' was not declared in this scope; did you mean 'void'?
   35 | int mincost(vi& ht, int n, int idx)
      |             ^~
      |             void
a.cc:35:17: error: 'ht' was not declared in this scope
   35 | int mincost(vi& ht, int n, int idx)
      |                 ^~
a.cc:35:21: error: expected primary-expression before 'int'
   35 | int mincost(vi& ht, int n, int idx)
      |                     ^~~
a.cc:35:28: error: expected primary-expression before 'int'
   35 | int mincost(vi& ht, int n, int idx)
      |                            ^~~
a.cc:35:35: error: expression list treated as compound expression in initializer [-fpermissive]
   35 | int mincost(vi& ht, int n, int idx)
      |                                   ^
a.cc: In function 'int main()':
a.cc:58:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   58 |         cin >> n;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:59:9: error: 'vi' was not declared in this scope
   59 |         vi ht(n);
      |         ^~
a.cc:61:24: error: 'ht' was not declared in this scope
   61 |                 cin >> ht[i];
      |                        ^~
a.cc:62:28: error: 'ht' was not declared in this scope
   62 |         auto ans = mincost(ht, n, 0);
      |                            ^~
a.cc:62:27: error: 'mincost' cannot be used as a function
   62 |         auto ans = mincost(ht, n, 0);
      |                    ~~~~~~~^~~~~~~~~~
a.cc:63:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   63 |         cout << ans;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~