#include #include #include using namespace std; typedef pair,int> ppiii; int main(){ int N,B,R=0; scanf("%d%d",&N,&B); vector v(N); for(int i=0;i > z; for(int k=i;k<=j;k++)z.push_back(make_pair(v[k].first.second,v[k].second)); sort(z.begin(),z.end()); int start=0,end=0,point=0; for(;endB;)point-=z[start++].second; for(;end 3 */