How to make make my code memory efficient?

My logic are very clear and i implement them well but the problem arises of complexity so i am not able to secure good rank. Any tips to improve upon it??

What complexity? Time complexity? Memory complexity?

Assuming it to be memory related issues, codechef is quite lenient w.r.t. memory. If your array size is getting over 10^8, you are more likely to suffer a TLE if memory limit is removed.

Regarding making it efficient, it depends on and varies from question to question.

//