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