Many people use
'\n' interchangeably without understanding the key difference between the functioning of the two.
endl in place of
'\n' can end up getting you a TLE which otherwise would have been an AC with the use of
So let's see what the difference is.
'\n' : It inserts a new line to the output stream.
endl : It inserts a new line and flushes the output stream.
is equivalent to using
endl in terms of speed (or time) when matter is related to new line only.
The problem which I solved and got TLE issue was Escape from Stones. Go and have a shot at it.