Please help me in the problem ITS GETTING TLE

problem—>https://hack.codingblocks.com/app/practice/2/608/problem

MY SOLUTION->https://ide.codingblocks.com/s/236061

Hey @kailash_01
I checked your code and it was running fine
Where did you face the problem ?

in hackerblock when i compiled it was running fine but when i submit it in hackerblock then it is showing tle…

@kailash_01
Issue is due to line 21
When you have multiple test cases static retains value of previous testcase
Instead of static use a global variable

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.