Unable to pass first two test cases

Following is the link to my code: https://paste.ubuntu.com/p/bTPjgkrHT8/

solve and getPrimes functions inside the Solver class are the main pieces of code. Other functions are for fast i/o during competitions. They can be safely ignored.

The code seems to produce the correct cumSum array but the solution is not accepted by hackerblocks. Can you please point out the error in the above code?

I also tried copy pasting python code for the same problem from GFG and that didn’t pass the first two test cases as well.