CHRL2 - Please help

Hi i have tried to solve the CHRL2 problem but my solution is running well for only subtask 1 and for subtask two i dont know what’s the problem. here is the link to my solution -

https://www.codechef.com/viewsolution/8597174

Please help thanks !

your initial value of min = 501 is too small, change it to something like 10^6

Thanks…solution accepted. i have not considered subtask 2 constraint.

//