Language: C++

#include<bits/stdc++.h>
 namespace std; 
#define io_ ios_base::sync_with_stdio(0); cin.tie(0);
int solve(vector<int> &stones, int &i){
if (i==stones.size()-1){return 0;}
int mi=1e7;
int aux=i, salto1=1e7,salto2=1e7;
aux++;
if ((i+1)<=stones.size()-1){
salto1=abs(stones[i]-stones[aux])+solve(stones,aux);
}
aux++;
if ((i+2)<=stones.size()-1){
salto2=abs(stones[i]-stones[aux])+solve(stones,aux);
}
return min(salto1,salto2);
}
int main (){
io_;
int n;
cin>>n;
vector<int> v(0);
for (int i=0,val;i<n;i++){
cin>>val;
v.push_back(val);
}
int i=0 ;
int suma=0;
suma=solve(v,i);
cout<<suma<<endl;
}


Compiler output:
a.cc:2:15: error: expected '{' before ';' token
    2 |  namespace std;
      |               ^
a.cc:4:11: error: 'vector' was not declared in this scope
    4 | int solve(vector<int> &stones, int &i){
      |           ^~~~~~
a.cc:4:11: 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:4:18: error: expected primary-expression before 'int'
    4 | int solve(vector<int> &stones, int &i){
      |                  ^~~
a.cc:4:32: error: expected primary-expression before 'int'
    4 | int solve(vector<int> &stones, int &i){
      |                                ^~~
a.cc:4:38: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | int solve(vector<int> &stones, int &i){
      |                                      ^
a.cc: In function 'int main()':
a.cc:3:13: error: 'ios_base' has not been declared
    3 | #define io_ ios_base::sync_with_stdio(0); cin.tie(0);
      |             ^~~~~~~~
a.cc:19:1: note: in expansion of macro 'io_'
   19 | io_;
      | ^~~
a.cc:3:43: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    3 | #define io_ ios_base::sync_with_stdio(0); cin.tie(0);
      |                                           ^~~
a.cc:19:1: note: in expansion of macro 'io_'
   19 | io_;
      | ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:22:1: error: 'vector' was not declared in this scope
   22 | vector<int> v(0);
      | ^~~~~~
a.cc:22:1: note: suggested alternatives:
/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:22:8: error: expected primary-expression before 'int'
   22 | vector<int> v(0);
      |        ^~~
a.cc:25:1: error: 'v' was not declared in this scope
   25 | v.push_back(val);
      | ^
a.cc:29:12: error: 'v' was not declared in this scope
   29 | suma=solve(v,i);
      |            ^
a.cc:29:11: error: 'solve' cannot be used as a function
   29 | suma=solve(v,i);
      |      ~~~~~^~~~~
a.cc:30:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   30 | cout<<suma<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:30:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   30 | cout<<suma<<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)
      |     ^~~~