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?