Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
 
template<class T> inline bool change_min(T& a, T b) {
	if (a > b) {
    	a = b;
        return 1;
    } elae {
    	return 0;
    }
}
 
const long H_MAX = 9999999999;
int n = 100001;
 
int N;
long long h[n];
 
long long dp[n];
 
int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];
 
    for (int i = 0; i < 100010; i++) {
    	dp[i] = H_MAX;
    }
 
    dp[0] = 0;
 
    for (int i = 1; i < N; ++i) {
        change_min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1){
        	change_min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }
 
    cout << dp[N-1] << endl;
}
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
 
template<class T> inline bool change_min(T& a, T b) {
	if (a > b) {
    	a = b;
        return 1;
    } else {
    	return 0;
    }
}
 
const long H_MAX = 9999999999;
int n = 100001;
 
int N;
long long h[n];
 
long long dp[n];
 
int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];
 
    for (int i = 0; i < 100010; i++) {
    	dp[i] = H_MAX;
    }
 
    dp[0] = 0;
 
    for (int i = 1; i < N; ++i) {
        change_min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1){
        	change_min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }
 
    cout << dp[N-1] << endl;
}
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
 
template<class T> inline bool change_min(T& a, T b) {
	if (a > b) {
    	a = b;
        return 1;
    } elae {
    	return 0;
    }
}
 
const long H_MAX = 9999999999;
const int n = 100001;
 
int N;
long long h[n];
 
long long dp[n];
 
int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];
 
    for (int i = 0; i < n; i++) {
    	dp[i] = H_MAX;
    }
 
    dp[0] = 0;
 
    for (int i = 1; i < N; ++i) {
        change_min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1){
        	change_min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }
 
    cout << dp[N-1] << endl;
}

Compiler output:
a.cc: In function 'bool change_min(T&, T)':
a.cc:10:7: error: 'elae' was not declared in this scope
   10 |     } elae {
      |       ^~~~
a.cc: At global scope:
a.cc:19:13: error: size of array 'h' is not an integral constant-expression
   19 | long long h[n];
      |             ^
a.cc:21:14: error: size of array 'dp' is not an integral constant-expression
   21 | long long dp[n];
      |              ^
a.cc:47:31: error: redefinition of 'template<class T> bool change_min(T&, T)'
   47 | template<class T> inline bool change_min(T& a, T b) {
      |                               ^~~~~~~~~~
a.cc:6:31: note: 'template<class T> bool change_min(T&, T)' previously declared here
    6 | template<class T> inline bool change_min(T& a, T b) {
      |                               ^~~~~~~~~~
a.cc:56:12: error: redefinition of 'const long int H_MAX'
   56 | const long H_MAX = 9999999999;
      |            ^~~~~
a.cc:15:12: note: 'const long int H_MAX' previously defined here
   15 | const long H_MAX = 9999999999;
      |            ^~~~~
a.cc:57:5: error: redefinition of 'int n'
   57 | int n = 100001;
      |     ^
a.cc:16:5: note: 'int n' previously defined here
   16 | int n = 100001;
      |     ^
a.cc:59:5: error: redefinition of 'int N'
   59 | int N;
      |     ^
a.cc:18:5: note: 'int N' previously declared here
   18 | int N;
      |     ^
a.cc:60:13: error: size of array 'h' is not an integral constant-expression
   60 | long long h[n];
      |             ^
a.cc:60:11: error: redefinition of 'long long int h [1]'
   60 | long long h[n];
      |           ^
a.cc:19:11: note: 'long long int h [1]' previously declared here
   19 | long long h[n];
      |           ^
a.cc:62:14: error: size of array 'dp' is not an integral constant-expression
   62 | long long dp[n];
      |              ^
a.cc:62:11: error: redefinition of 'long long int dp [1]'
   62 | long long dp[n];
      |           ^~
a.cc:21:11: note: 'long long int dp [1]' previously declared here
   21 | long long dp[n];
      |           ^~
a.cc:64:5: error: redefinition of 'int main()'
   64 | int main() {
      |     ^~~~
a.cc:23:5: note: 'int main()' previously defined here
   23 | int main() {
      |     ^~~~
a.cc:88:31: error: redefinition of 'template<class T> bool change_min(T&, T)'
   88 | template<class T> inline bool change_min(T& a, T b) {
      |                               ^~~~~~~~~~
a.cc:6:31: note: 'template<class T> bool change_min(T&, T)' previously declared here
    6 | template<class T> inline bool change_min(T& a, T b) {
      |                               ^~~~~~~~~~
a.cc:97:12: error: redefinition of 'const long int H_MAX'
   97 | const long H_MAX = 9999999999;
      |            ^~~~~
a.cc:15:12: note: 'const long int H_MAX' previously defined here
   15 | const long H_MAX = 9999999999;
      |            ^~~~~
a.cc:98:11: error: conflicting declaration 'const int n'
   98 | const int n = 100001;
      |           ^
a.cc:16:5: note: previous declaration as 'int n'
   16 | int n = 100001;
      |     ^
a.cc:100:5: error: redefinition of 'int N'
  100 | int N;
      |     ^
a.cc:18:5: note: 'int N' previously declared here
   18 | int N;
      |     ^
a.cc:101:13: error: size of array 'h' is not an integral constant-expression
  101 | long long h[n];
      |             ^
a.cc:101:11: error: redefinition of 'long long int h [1]'
  101 | long long h[n];
      |           ^
a.cc:19:11: note: 'long long int h [1]' previously declared here
   19 | long long h[n];
      |           ^
a.cc:103:14: error: size of array 'dp' is not an integral constant-expression
  103 | long long dp[n];
      |              ^
a.cc:103:11: error: redefinition of 'long long int dp [1]'
  103 | long long dp[n];
      |           ^~
a.cc:21:11: note: 'long long int dp [1]' previously declared here
   21 | long long dp[n];
      |           ^~
a.cc:105:5: error: redefinition of 'int main()'
  105 | int main() {
      |     ^~~~
a.cc:23:5: note: 'int main()' previously defined here
   23 | int main() {
      |     ^~~~
a.cc: In function 'bool change_min(T&, T) [with T = long long int]':
a.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type]
   13 | }
      | ^