I've noticed in the last contest (Codeforces Round #632 (Div. 2)) many people including me had this issue in 1333D - Challenges in school №41 where our verdicts changed from TLE to AC by just changing every "endl" to '\n'. You can see for yourself if you want:
TLE Submission: 75902058
AC Submission: 75903554
I knew before that "endl" does some flushing business and this usually takes (Maybe I'm wrong) time but I knew also that the following lines disable this thing: (Maybe I'm also wrong)
ios::sync_with_stdio(0); cin.tie(0), cout.tie(0);
But I still got an issue using "endl" so can someone explain if possible how does endl work exactly and what do the lines above change about using cin/cout/endl?