Timelimit exceeded

i am not able to understand where i am doing it wrong
please help - https://ide.codingblocks.com/s/571462

you have to use long long int
because constraints are large
image

Modified code

still the same error if i compile and test then the test cases are small but the error is same

check modified Code
it passed all testcase

i have done 2 changes

  1. use break if we got the element
  2. use long long int

i got it and it is working now thanks

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.

plz give your valuable feedback