I try to make my problems shorter, but even sometimes basic coded lines show TIME EXCEEDED. How do i improve the time performance of my algoritm. Please help

Its not that how short you write the code, more important is how good you write code. Basic TLE errors are due to taking inputs where we generally use cin and cout instead use scanf and printf.

Some of the points are well explained here and here

*EDIT:
In addition to these points head on to ProjectEuler and try solving the questions after solving you will get best way to program your just answered questions, It will help you in developing efficient algos be it in any Language *

licr said it all and explained the most common problemâ€¦ but sometimes (more often than we all would like to) the TLE error arises from having developed a not very efficient algorithmâ€¦ On that case you should focus more on the logic and mathematical formalisms of the problem instead of focusing on code issues

Itâ€™s all a matter of practice and earning experience!!

Bruno

While optimization of C++ code helps, Codechef made me think more in terms of asymptotic complexity.

So if a problem has a O(n log n) solution, O(n^2) is surely going to be TLE. And no amount of performance boost is going to work. And you will keep wondering, why TLE?

So if you get TLE, first check if your algorithm is appropriate. Can you lower its complexity? If it seems optimal, then look for optimization, like using faster I/O. But sometimes, people end up doing optimization, which is in fact slowing down the solution. So you should measure them as well.