Time complexity

time limit exceding…!! please provide a hint

i am able to do the program but it is exceeding the time limit…!!