Why is the following solution giving TLE?

even my solution to MAXPR of complexity O(200 * N) gets TLE … please look

@krooonal and @sansid - even my O(200n) solution gave TLE. But, O(100n) gets AC!

i think ,TLE because u are using mod function so many times…use mod function this way…

thank you @r4r313 for suggesting this method. the code finally ran

but i am really frustrated with this. Such strict time limits must not be there. My algo and execution was correct. The only thing that made the difference was MOD . I personally request codechef to go through all the solutions again and next time make sure that such strict time limits are taken care off.