Language: C++

#include<bits/stdc++.h>

#define ll              long long
#define mod             1000000007
#define inf             1e18

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int n;
    cin>>n;

    int a[n];
    for(int i=0; i<n; i++)  cin>>a[i];

    int dp[n];
    for(int i=1; i<n; i++)      dp[i] = mod;

    dp[0] = 0;

    for(int i=0; i<n; i++){
        int j;

        j = i+1;
        if(j < n)       dp[j] = min( dp[j], dp[i] + abs(a[i] - a[j]) );
        
        j = i+2;
        if(j < n)       dp[j] = min( dp[j], dp[i] + abs(a[i] - a[j]) );
        
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:8:5: error: 'ios_base' has not been declared
    8 |     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |     ^~~~~~~~
a.cc:8:35: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |                                   ^~~
      |                                   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:47: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |                                               ^~~~
      |                                               std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:25:33: error: 'min' was not declared in this scope; did you mean 'std::min'?
   25 |         if(j < n)       dp[j] = min( dp[j], dp[i] + abs(a[i] - a[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)
      |     ^~~
a.cc:28:33: error: 'min' was not declared in this scope; did you mean 'std::min'?
   28 |         if(j < n)       dp[j] = min( dp[j], dp[i] + abs(a[i] - a[j]) );
      |                                 ^~~
      |                                 std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:31:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   31 |     cout<<dp[n-1]<<endl;
      |                    ^~~~
      |                    std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~