Language: C++

#include<bits/stdc++.h>

using naespace std ;
int main()
{
  int num,temp ;
  cin>>num ;
  vector<int> cost ;
  vector<int> dp ;
  cost.clear() ;
  for(int i=0;i<num;i++)
  {
    cin>>temp ;
    cost.push_back(temp) ;
  }
  dp.push_back(0) ;
  dp.push_back(abs(cost.at(0)-cost.at(1))) ;
  for(int i=2;i<num;i++)
  {
    cost1=abs(cost.at(i)-cost.at(i-1)) ;
    cost2=abs(cost.at(i)-cost.at(i-2)) ;
    dp1=cost1+dp.at(i-1) ;
    dp2=cost2+dp.at(i-2) ;
    cost_final=min(dp1,dp2) ;
    dp.push_back(cost_final) ;
  }
  cout<<dp.at(num-1)<<endl ;
                 
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'naespace'
    3 | using naespace std ;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin>>num ;
      |   ^~~
      |   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:3: error: 'vector' was not declared in this scope
    8 |   vector<int> cost ;
      |   ^~~~~~
a.cc:8: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:
/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:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> cost ;
      |          ^~~
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> dp ;
      |          ^~~
a.cc:10:3: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   10 |   cost.clear() ;
      |   ^~~~
      |   cosl
a.cc:16:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   16 |   dp.push_back(0) ;
      |   ^~
      |   dup
a.cc:20:5: error: 'cost1' was not declared in this scope
   20 |     cost1=abs(cost.at(i)-cost.at(i-1)) ;
      |     ^~~~~
a.cc:21:5: error: 'cost2' was not declared in this scope
   21 |     cost2=abs(cost.at(i)-cost.at(i-2)) ;
      |     ^~~~~
a.cc:22:5: error: 'dp1' was not declared in this scope
   22 |     dp1=cost1+dp.at(i-1) ;
      |     ^~~
a.cc:23:5: error: 'dp2' was not declared in this scope; did you mean 'dup2'?
   23 |     dp2=cost2+dp.at(i-2) ;
      |     ^~~
      |     dup2
a.cc:24:5: error: 'cost_final' was not declared in this scope
   24 |     cost_final=min(dp1,dp2) ;
      |     ^~~~~~~~~~
a.cc:24:16: error: 'min' was not declared in this scope; did you mean 'std::min'?
   24 |     cost_final=min(dp1,dp2) ;
      |                ^~~
      |                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:27:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |   cout<<dp.at(num-1)<<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:27:23: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   27 |   cout<<dp.at(num-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)
      |     ^~~~