I am getting MLE error in first test case of Summing Sums problem. Can anyone please help?

Problem Link:
https://online.codingblocks.com/app/player/115374/content/73626/5126/code-challenge?_ga=2.145036530.793374760.1590335151-244123643.1588274362

Code link:

@mgfags
That was a tough testcase which required some further optimisations to be solved. Since the difficulty level may have been a bit high, I have removed that testcase. Try running your code again.