Although the question can be done many other ways and get AC, but it gives TLE if we intend doing it using list iterators.. STL. Is there a way of getting AC using STL(list , vectors gives AC)? http://ideone.com/xcvkBB
So, is it that iterator due to which tle is coming??