Wrote the code correctly but it is not accepting

for the problem Alice Potter And Dumbledore Army in feb cook off ,i wrote the optimal code but it is giving tle but for some other person it got accepted my solution id is 88708807…what should i do now…


Same problem

The same problem happened with me today I tried 4th question in too many different ways but couldn’t get it accepted. And after completion of the contest I checked some other submissions which were exactly same and they got accepted. Code is here CodeChef | Competitive Programming | Participate & Learn

Adding this line at starting of main fixes this

It still takes 1.47 sec

If you replace endl by “\n” , it will run in 0.24 sec . Thats too much reduction .