Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int length;
    int temp;
    int min;
    cin >> length;
    vector<int> inp;
    for(int i=0;i<length;i++){
    	
        cin >> temp;
        inp.push_back(temp);
    	
      
    }
    //int dp[(int)inp.size()][(int)inp.size()];
    vector<int> dp[(int)inp.size()*(int)inp.size()];
    int counter_1=0;
    int counter_2 = 0;
    int counter = 0;
    while(counter<(int)inp.size()){
    	if(counter_1==counter_2) dp[counter_1*(int)inp.size()+counter_2]=0;
        if(counter_2-counter_1==1) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
        if(counter_2-counter_1==2){
            if(dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2]>abs(inp[counter_2]-inp[counter_1])) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
            else dp[counter_1*(int)inp.size()+counter_2] = dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2];
        	
            
        }
        if(counter_2-counter_1>2){
        	min = INT_MAX;
            for(int i=counter_1+1;i<counter_2;i++){
            	temp = dp[counter_1*(int)inp.size()+i]+dp[(i)*(int)inp.size()+counter_2];
                if(temp<min) min = temp;
            }
            dp[counter_1*(int)inp.size()+counter_2] = min;
        }
        if(counter_2==((int)inp.size()-1)){
        	counter++;
            counter_1 = 0;
            counter_2 = counter;
            continue;
        }
        counter_1++;
        counter_2++;
    }
    cout << dp[0*(int)inp.size()+inp.size()-1];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:74: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
   22 |         if(counter_1==counter_2) dp[counter_1*(int)inp.size()+counter_2]=0;
      |                                                                          ^
In file included from /usr/include/c++/14/vector:72,
                 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/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:23:109: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
   23 |         if(counter_2-counter_1==1) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
      |                                                                                                             ^
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:25:57: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'std::vector<int>')
   25 |             if(dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2]>abs(inp[counter_2]-inp[counter_1])) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                        |                                           |
      |                                                        vector<[...]>                               vector<[...]>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
  627 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note:   template argument deduction/substitution failed:
a.cc:25:100: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   25 |             if(dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2]>abs(inp[counter_2]-inp[counter_1])) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
      |                                                                                                    ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
 1798 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note:   template argument deduction/substitution failed:
a.cc:25:100: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
   25 |             if(dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2]>abs(inp[counter_2]-inp[counter_1])) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
      |                                                                                                    ^
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3598 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note:   template argument deduction/substitution failed:
a.cc:25:100: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   25 |             if(dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2]>abs(inp[counter_2]-inp[counter_1])) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
      |                                                                                                    ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3616 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note:   template argument deduction/substitution failed:
a.cc:25:100: note:   mismatched types 'const _CharT*' and 'std::vector<int>'
   25 |             if(dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2]>abs(inp[counter_2]-inp[counter_1])) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
      |                                                                                                    ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 3635 |     operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note:   template argument deduction/substitution failed:
a.cc:25:100: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   25 |             if(dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1)*(int)inp.size()+counter_2]>abs(inp[counter_2]-inp[counter_1])) dp[counter_1*(int)inp.size()+counter_2]=abs(inp[counter_2]-inp[counter_1]);
      |                                                                                                    ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 3652 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note:   template argument deduction/substitution failed:
a.cc:25:100: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   25 |             if(dp[counter_1*(int)inp.size()+counter_2-1]+dp[(counter_2-1