#include using namespace std; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a struct SegmentTree{ // using F = function; Int n; F f; T ti; vector dat; SegmentTree(){} SegmentTree(F f,T ti):f(f),ti(ti){} void init(Int n_){ n=1; while(n &v){ Int n_=v.size(); init(n_); for(Int i=0;i>=1) dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]); } T query(Int a,Int b){ if(a>=b) return ti; T vl=ti,vr=ti; for(Int l=a+n,r=b+n;l>=1,r>>=1) { if(l&1) vl=f(vl,dat[l++]); if(r&1) vr=f(dat[--r],vr); } return f(vl,vr); } }; //INSERT ABOVE HERE const Int MAX = 3030; Int dp[MAX][MAX]; signed main(){ cin.tie(0); ios::sync_with_stdio(0); Int n,k,m; cin>>n>>k>>m; vector as(n); for(Int i=0;i>as[i]; vector sm(n+1,0); for(Int i=0;i(n+1,0)); seg2.build(vector(n+1,0)); // [0, i] for(Int i=0;i(n+1,0)); seg2.build(vector(n+1,0)); for(Int i=0;i