Language: C++

#include <iostream>
#include <vector>
#define int long long;
using namespace std;
int main()
{
  vector<int> v;
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
  {
      int a;
      cin>>a;
    v.push_back(a);
  }

  vector<int> b(n,INT_MAX);
  b[n-1]=0;
  for(int i=n-2;i>=0;i--)
  {
    if(i+1<n)
    {
      b[i]=min(b[i],(abs(v[i+1]-v[i])+b[i+1]));
    }
    if(i+2<n)
    {
      b[i]=min(b[i],(abs(v[i+2]-v[i])+b[i+2]));
    }
    
  }
  
    cout<<b[0];
    return 0;
}


Compiler output:
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:5:1: note: in expansion of macro 'int'
    5 | int main()
      | ^~~
a.cc:5:5: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | int main()
      |     ^~~~
a.cc: In function 'int main()':
a.cc:3:18: error: template argument 1 is invalid
    3 | #define int long long;
      |                  ^~~~
a.cc:7:10: note: in expansion of macro 'int'
    7 |   vector<int> v;
      |          ^~~
a.cc:3:18: error: template argument 2 is invalid
    3 | #define int long long;
      |                  ^~~~
a.cc:7:10: note: in expansion of macro 'int'
    7 |   vector<int> v;
      |          ^~~
a.cc:7:13: error: expected primary-expression before '>' token
    7 |   vector<int> v;
      |             ^
a.cc:7:15: error: 'v' was not declared in this scope
    7 |   vector<int> v;
      |               ^
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:8:3: note: in expansion of macro 'int'
    8 |   int n;
      |   ^~~
a.cc:8:7: error: 'n' was not declared in this scope
    8 |   int n;
      |       ^
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:10:7: note: in expansion of macro 'int'
   10 |   for(int i=0;i<n;i++)
      |       ^~~
a.cc:10:11: error: 'i' was not declared in this scope
   10 |   for(int i=0;i<n;i++)
      |           ^
a.cc:10:18: error: expected ')' before ';' token
   10 |   for(int i=0;i<n;i++)
      |      ~           ^
      |                  )
a.cc:10:19: error: 'i' was not declared in this scope
   10 |   for(int i=0;i<n;i++)
      |                   ^
a.cc:3:18: error: template argument 1 is invalid
    3 | #define int long long;
      |                  ^~~~
a.cc:17:10: note: in expansion of macro 'int'
   17 |   vector<int> b(n,INT_MAX);
      |          ^~~
a.cc:3:18: error: template argument 2 is invalid
    3 | #define int long long;
      |                  ^~~~
a.cc:17:10: note: in expansion of macro 'int'
   17 |   vector<int> b(n,INT_MAX);
      |          ^~~
a.cc:17:13: error: expected primary-expression before '>' token
   17 |   vector<int> b(n,INT_MAX);
      |             ^
a.cc:17:19: error: 'INT_MAX' was not declared in this scope
   17 |   vector<int> b(n,INT_MAX);
      |                   ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | #define int long long;
a.cc:17:15: error: 'b' was not declared in this scope
   17 |   vector<int> b(n,INT_MAX);
      |               ^
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | #define int long long;
      |                  ^~~~
a.cc:19:7: note: in expansion of macro 'int'
   19 |   for(int i=n-2;i>=0;i--)
      |       ^~~
a.cc:19:21: error: expected ')' before ';' token
   19 |   for(int i=n-2;i>=0;i--)
      |      ~              ^
      |                     )