#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>n; string s; cin>>s; vector as(n); for(Int i=0;i>as[i]; vector cnt(n+1,0); for(Int i=0;i sm(n+1,0); for(Int i=0;i dp(n+1,INT_MAX); for(Int r=0;r<=n;r++) for(Int l=0;l>q; for(Int i=0;i>k; Int ans=0; for(Int j=0;j<=n;j++) if(dp[j]<=k) ans=j; cout<