Getting wrong answer in BUY AND SELL problem

Can anybody help about what is wrong with the following code :

Problem link : Problem Link

Code Link