Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (ll i = 0; i < (n); i++)
typedef pair<int, int> P;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

template<class T>
    bool chmin(T& a, T b) {
        if (a > b) {
            a = b;
            return true;
        }
        return false;
}
template<class T> 
    bool chmax(T& a, T b) {
        if (a < b) {
            a = b;
            return true;
        }
        return false;
}

const ll INF = 1e10;;

int main(){
    int n;
    cin >> n;
    vector<ll> h(n+5);
    rep(i,n) cin >> h[i];

    vector<ll> c(n+5,INF);
    c[0] = 0;
    rep(i,n){
        chmin(c[i+1],c[i]+abs(h[i]-h[i+1]));
        chmin(c[i+2],c[i]+abs(h[i]-h[i+2]));
    }
    // chmin(c[n-1], c[n-2]+abs(h[n-1]-h[n-2]));

    cout << c[n-1] << endl;

    return 0;
}#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (ll i = 0; i < (n); i++)
typedef pair<int, int> P;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

template<class T>
    bool chmin(T& a, T b) {
        if (a > b) {
            a = b;
            return true;
        }
        return false;
}
template<class T> 
    bool chmax(T& a, T b) {
        if (a < b) {
            a = b;
            return true;
        }
        return false;
}

const ll INF = 1e10;;

int main(){
    int n;
    cin >> n;
    vector<ll> h(n+5);
    rep(i,n) cin >> h[i];

    vector<ll> c(n+5,INF);
    c[0] = 0;
    rep(i,n){
        chmin(c[i+1],c[i]+abs(h[i]-h[i+1]));
        chmin(c[i+2],c[i]+abs(h[i]-h[i+2]));
    }
    // chmin(c[n-1], c[n-2]+abs(h[n-1]-h[n-2]));

    cout << c[n-1] << endl;

    return 0;
}

Compiler output:
a.cc:46:2: error: stray '#' in program
   46 | }#include <bits/stdc++.h>
      |  ^
a.cc:46:3: error: 'include' does not name a type
   46 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:52:4: error: redefinition of 'll gcd(ll, ll)'
   52 | ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
      |    ^~~
a.cc:7:4: note: 'll gcd(ll, ll)' previously defined here
    7 | ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
      |    ^~~
a.cc:53:4: error: redefinition of 'll lcm(ll, ll)'
   53 | ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
      |    ^~~
a.cc:8:4: note: 'll lcm(ll, ll)' previously defined here
    8 | ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
      |    ^~~
a.cc:56:10: error: redefinition of 'template<class T> bool chmin(T&, T)'
   56 |     bool chmin(T& a, T b) {
      |          ^~~~~
a.cc:11:10: note: 'template<class T> bool chmin(T&, T)' previously declared here
   11 |     bool chmin(T& a, T b) {
      |          ^~~~~
a.cc:64:10: error: redefinition of 'template<class T> bool chmax(T&, T)'
   64 |     bool chmax(T& a, T b) {
      |          ^~~~~
a.cc:19:10: note: 'template<class T> bool chmax(T&, T)' previously declared here
   19 |     bool chmax(T& a, T b) {
      |          ^~~~~
a.cc:72:10: error: redefinition of 'const ll INF'
   72 | const ll INF = 1e10;;
      |          ^~~
a.cc:27:10: note: 'const ll INF' previously defined here
   27 | const ll INF = 1e10;;
      |          ^~~
a.cc:74:5: error: redefinition of 'int main()'
   74 | int main(){
      |     ^~~~
a.cc:29:5: note: 'int main()' previously defined here
   29 | int main(){
      |     ^~~~