TLE and WA giving

Giving timelimit exceed in 2 cases and tle in 2 case
code ide is - https://ide.codingblocks.com/s/230734

Hey @souravmunjal2000,

Your code is in JAVA and i am the TA for C++ Batch.

Though, I can provide you a Solution in C++ laguage.

If find any problem related to it.
Let me know,