#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vbool vector<bool>
#define pairll pair<ll, ll>
#define pb push_back
#define fi first
#define sc second
std::vector<int> find_subset(int L, int U, std::vector<int> W) {
ll l = L, u = U;
ll n = W.size();
vector<pairll> w(n);
for(ll i = 0; i < n; i++) w[i] = {W[i], i};
sort(w.begin(), w.end());
ll tot = 0;
vector<int> emp;
vector<int> res, res2;
for(ll i = n-1; i >= 0; i--){
tot += w[i].fi;
res.pb(w[i].sc);
res2.pb(i);
if(l <= tot && tot <= u){
return res;
}
if(tot > u){
for(ll j = 0; j < i && j < res.size(); j++){
tot -= w[res2[i]].fi;
tot += w[j].fi;
res[j] = w[j].sc;
if(l <= tot && tot <= u){
return res;
}
}
return emp;
}
}
return emp;
}