#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int lf = 0,rt = 0;
int n = w.size();
vector<pair<int,int>> a(n);
for(int i = 0;i<n;i++)a[i]={w[i],i};
sort(a.begin(),a.end());
int cs = w[0];
while(lf<n){
while(rt<n-1 && a[rt+1].first+cs<=u){
cs+=a[++rt].first;
}
if(cs>=l && cs<=u){
vi ans;
for(int i = lf;i<=rt;i++)ans.push_back(a[i].second);
return ans;
}
cs-=a[lf++].first;
if(lf>rt){
cs = a[lf].first;
rt = lf;
}
}return {};
}