I am not able to understand why I am getting the wrong answer on test case 9. Are there any edge cases I am missing. Ik I can see the editorial but this contest doesn't have one(Don't know why). Here is the link: https://mirror.codeforces.com/contest/747/submission/86296933
Actually there is an editorial. Though it isn't available in the "Contest materials" section, you can find it via google search.
here is the changed version of your code which got accepted https://mirror.codeforces.com/contest/747/submission/86302666 the thing u are doing wrong is u are updating the value of the task array without checking if there are enough servers available for use. i hope this help