Used 0/1 Knapsack similar approch, idea implementation is on idea.jpeg file.
Open any c++ editor and run solve.cpp file, make sure your folder contains mempool.csv file, which is used to read the data. Initiallt I have take first 100 entries of data. After compiling the result will be stored on the file block.txt.