Language: C++

#include<bits/stdc++.h>
const int INF = 1e9 + 5;
int main(){
  int n;
  scanf("%d",&n);
  vector<int> h[n];
  for(int& : h) {
    scanf("%d",&x);
  }
  vector<int> dp(n,INF);
  dp[0]=0;
  for(int i=0;i<n;++i){
    for(int j : (i+1,i+2)){
      if(j = n) {
        dp[i] = min(dp[j],dp[i]+abs(h[i]-h[j]));
      }
    }
  }
  printf("%d\n",dp[n-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> h[n];
      |   ^~~~~~
a.cc:6:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> h[n];
      |          ^~~
a.cc:7:12: error: expected unqualified-id before ':' token
    7 |   for(int& : h) {
      |            ^
a.cc:7:14: error: 'h' was not declared in this scope
    7 |   for(int& : h) {
      |              ^
a.cc:8:17: error: 'x' was not declared in this scope
    8 |     scanf("%d",&x);
      |                 ^
a.cc:10:10: error: expected primary-expression before 'int'
   10 |   vector<int> dp(n,INF);
      |          ^~~
a.cc:11:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   11 |   dp[0]=0;
      |   ^~
      |   dup
a.cc:13:25: error: 'begin' was not declared in this scope
   13 |     for(int j : (i+1,i+2)){
      |                         ^
a.cc:13:25: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:13:25: error: 'end' was not declared in this scope
   13 |     for(int j : (i+1,i+2)){
      |                         ^
a.cc:13:25: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:15:37: error: 'h' was not declared in this scope
   15 |         dp[i] = min(dp[j],dp[i]+abs(h[i]-h[j]));
      |                                     ^
a.cc:15:17: error: 'min' was not declared in this scope; did you mean 'std::min'?
   15 |         dp[i] = min(dp[j],dp[i]+abs(h[i]-h[j]));
      |                 ^~~
      |                 std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~