Language: C++

#include <stdio.h>

using namespace std;

int main (void) {
  int N; cin << N;
  vector<int> h(N); for (int i = 0; i < N; i++) cin << h[i];
  
  vector<int> dp(N, 0);
  for (int i = 1; i < N; i++) dp[i] = 1<<30;
  
  for (int i = 0; i < N; i++) {
    if (i+1 < N) dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]), dp[i+1]);
    if (i+2 < N) dp[i+2] = min(dp[i]+abs(h[i+2]-h[i]), dp[i+2]);
  }
  cout << dp[N-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: 'cin' was not declared in this scope
    6 |   int N; cin << N;
      |          ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <stdio.h>
  +++ |+#include <iostream>
    2 | 
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> h(N); for (int i = 0; i < N; i++) cin << h[i];
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <stdio.h>
  +++ |+#include <vector>
    2 | 
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> h(N); for (int i = 0; i < N; i++) cin << h[i];
      |          ^~~
a.cc:7:56: error: 'h' was not declared in this scope
    7 |   vector<int> h(N); for (int i = 0; i < N; i++) cin << h[i];
      |                                                        ^
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> dp(N, 0);
      |          ^~~
a.cc:10:31: error: 'dp' was not declared in this scope
   10 |   for (int i = 1; i < N; i++) dp[i] = 1<<30;
      |                               ^~
a.cc:13:18: error: 'dp' was not declared in this scope
   13 |     if (i+1 < N) dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]), dp[i+1]);
      |                  ^~
a.cc:13:42: error: 'h' was not declared in this scope
   13 |     if (i+1 < N) dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]), dp[i+1]);
      |                                          ^
a.cc:13:38: error: 'abs' was not declared in this scope
   13 |     if (i+1 < N) dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]), dp[i+1]);
      |                                      ^~~
a.cc:13:28: error: 'min' was not declared in this scope; did you mean 'main'?
   13 |     if (i+1 < N) dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]), dp[i+1]);
      |                            ^~~
      |                            main
a.cc:14:18: error: 'dp' was not declared in this scope
   14 |     if (i+2 < N) dp[i+2] = min(dp[i]+abs(h[i+2]-h[i]), dp[i+2]);
      |                  ^~
a.cc:14:42: error: 'h' was not declared in this scope
   14 |     if (i+2 < N) dp[i+2] = min(dp[i]+abs(h[i+2]-h[i]), dp[i+2]);
      |                                          ^
a.cc:14:38: error: 'abs' was not declared in this scope
   14 |     if (i+2 < N) dp[i+2] = min(dp[i]+abs(h[i+2]-h[i]), dp[i+2]);
      |                                      ^~~
a.cc:14:28: error: 'min' was not declared in this scope; did you mean 'main'?
   14 |     if (i+2 < N) dp[i+2] = min(dp[i]+abs(h[i+2]-h[i]), dp[i+2]);
      |                            ^~~
      |                            main
a.cc:16:3: error: 'cout' was not declared in this scope
   16 |   cout << dp[N-1] << endl;
      |   ^~~~
a.cc:16:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:11: error: 'dp' was not declared in this scope
   16 |   cout << dp[N-1] << endl;
      |           ^~
a.cc:16:22: error: 'endl' was not declared in this scope
   16 |   cout << dp[N-1] << endl;
      |                      ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <stdio.h>
  +++ |+#include <ostream>
    2 |