Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0; i<long long(n); i++)
#define FOR(i,m,n) for(ll i=long long(m); i<long long(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;


int main() {
	int n;
	cin >> n;
	VI h(n);
	REP(i, n)cin >> h[i];
	VI dp(100010, 0);
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	FOR(i, 2, n) {
		dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
	}
	cout << dp[n-1] << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:32: error: expected primary-expression before 'long'
    5 | #define REP(i,n) for(ll i=0; i<long long(n); i++)
      |                                ^~~~
a.cc:29:9: note: in expansion of macro 'REP'
   29 |         REP(i, n)cin >> h[i];
      |         ^~~
a.cc:5:32: error: expected ';' before 'long'
    5 | #define REP(i,n) for(ll i=0; i<long long(n); i++)
      |                                ^~~~
a.cc:29:9: note: in expansion of macro 'REP'
   29 |         REP(i, n)cin >> h[i];
      |         ^~~
a.cc:5:32: error: expected primary-expression before 'long'
    5 | #define REP(i,n) for(ll i=0; i<long long(n); i++)
      |                                ^~~~
a.cc:29:9: note: in expansion of macro 'REP'
   29 |         REP(i, n)cin >> h[i];
      |         ^~~
a.cc:5:32: error: expected ')' before 'long'
    5 | #define REP(i,n) for(ll i=0; i<long long(n); i++)
      |                     ~          ^~~~
a.cc:29:9: note: in expansion of macro 'REP'
   29 |         REP(i, n)cin >> h[i];
      |         ^~~
a.cc:29:13: error: 'i' was not declared in this scope
   29 |         REP(i, n)cin >> h[i];
      |             ^
a.cc:5:46: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0; i<long long(n); i++)
      |                                              ^
a.cc:6:29: error: expected primary-expression before 'long'
    6 | #define FOR(i,m,n) for(ll i=long long(m); i<long long(n); i++)
      |                             ^~~~
a.cc:33:9: note: in expansion of macro 'FOR'
   33 |         FOR(i, 2, n) {
      |         ^~~
a.cc:6:45: error: expected primary-expression before 'long'
    6 | #define FOR(i,m,n) for(ll i=long long(m); i<long long(n); i++)
      |                                             ^~~~
a.cc:33:9: note: in expansion of macro 'FOR'
   33 |         FOR(i, 2, n) {
      |         ^~~
a.cc:6:45: error: expected ';' before 'long'
    6 | #define FOR(i,m,n) for(ll i=long long(m); i<long long(n); i++)
      |                                             ^~~~
a.cc:33:9: note: in expansion of macro 'FOR'
   33 |         FOR(i, 2, n) {
      |         ^~~
a.cc:6:45: error: expected primary-expression before 'long'
    6 | #define FOR(i,m,n) for(ll i=long long(m); i<long long(n); i++)
      |                                             ^~~~
a.cc:33:9: note: in expansion of macro 'FOR'
   33 |         FOR(i, 2, n) {
      |         ^~~
a.cc:6:45: error: expected ')' before 'long'
    6 | #define FOR(i,m,n) for(ll i=long long(m); i<long long(n); i++)
      |                       ~                     ^~~~
a.cc:33:9: note: in expansion of macro 'FOR'
   33 |         FOR(i, 2, n) {
      |         ^~~