How to speed up code?
Backpack with the masses Set n objects of mass m1, m2, ..., mN and c1, c2, ..., cN respectively. They fill a backpack with a weight not exceeding m. Identify a set of items that can be carried in a backpack, which has the highest value. Incoming data The first line contains an integer m that does not exceed 10000. The second line contains n (n ≤ 100) positive integers m_i that do not exceed 100. The third line contains n positive integers c_i that do not exceed 100. Output data Display the item numbers (numbers 1 through n) that will be included in the highest value backpack. =================================== Input # 1 6 2 4 1 2 7 2 5 1 =================================== Output # 1 1 3 4 =================================== I have written code that can solve this problem, but something works very slowly and may even have errors. What you need to do to make the program run faster. My code: https://code.sololearn.com/cKS3aB8Lcv96/?ref=app