For this Question: There are N places, numbered 1,2,…,N. For each i (1≤i≤N), the height of place i is hi.
There is a man who is initially on place 1. He will repeat the following action some number of times to reach place N:
If the man is currently at place i, he will go to place i+1 or place i+2 i.e. maximum 2 jumps allowed. Here, a cost of |hi−hj| is incurred, where j is the place where the man goes. Find the minimum possible total cost incurred before the man reaches place N.First line contains N size of array, second line contains elements of array.

Constraints
2 ≤ N ≤ 10^5
1 ≤ hi ≤ 10^4Print the minimum possible total cost incurred.Sample Input:
4
10 30 40 20

Sample Output: 
30

Explanation:
Testcase 1: If we follow the path 1→ 2→ 4, the total cost incurred would be |10−30|+|30−20|=30., I have written this Solution Code: 
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007
const int N = 3e5+5;

#define read(type) readInt<type>()
#define max1 100001
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
const double pi=acos(-1.0);

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<string> VS;

typedef vector<PII> VII;

typedef vector<VI> VVI;

typedef map<int,int> MPII;

typedef set<int> SETI;

typedef multiset<int> MSETI;

typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 998244353;
using vl = vector<ll>;

bool isPowerOfTwo (int x)
{
  /* First x in the below expression is
    for the case when x is 0 */
  return x && (!(x&(x-1)));
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}


int a[max1];
bool b[max1];
int dp[max1];

    int n,k;
ll solve(int i){
if(i+k>=n-1){return abs(a[i]-a[n-1]);}
else{
        ll ans=LONG_MAX;
        if(dp[i]==-1){
    for(int j=i+1;j<=i+k;j++){
    ans=min(solve(j)+abs(a[j]-a[i]),ans);
    }
    dp[i]=ans;
    }
    return dp[i];
}
}
int main()
{
    cin>>n;
    k=2;
    FOR(i,n){b[i]=false;dp[i]=-1;cin>>a[i];}
    cout<<solve(0);
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?