Language: C++

#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    deque<ll> d;

    int n,k;
    cin>>n>>k;
    vector<ll> v(n);
   int sum=0;

    rep(i,n){
        cin>>v[i];
        d.push_back(v[i]);
        sum+=v[i];
    }

    int ans=-INF;
    int idou=0;
int lim=min(n,k);

    vector<ll> t1;
    for(int l=0;l<=lim;l++){

        if(l!=0) {
            t1.push_back(v[l - 1]);
            idou +=v[l-1];
        }
        int idou2=idou;
        vector<int> t2;
        t2=t1;

        for(int r=0;r<=lim-l;r++){
           if(r!=0) {
               t2.push_back(v[n - r]);
               idou2+=v[n-r];
           }

           sort(t2.begin(),t2.end());
           int kari=idou2;
           int a=lim-(l+r);
           int b=t2.size();

            for(int te=0;te<=min(a,b);te++){

                if(te!=0){kari-=t2[te-1];}
                //cout<<l<<" "<<r<<" "<<sum-kari<<" "<<endl;
                ans=max(kari,ans);

            }

        }
    }

    cout<<ans<<endl;



    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:12: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long int>')
   53 |         t2=t1;
      |            ^~
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/queue:63,
                 from a.cc:6:
/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 'std::vector<long long 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 'std::vector<long long 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 'std::vector<long long int>' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~