40 hours could be 16 hours of work followed by 8 hours of sleep and then another 16 hours of work. (I don't know if that's what he actually did.) That's essentially what you do in the last few months of an engineering program, except it's 5-7 days a week, instead of for 2 days.
1. I'm pretty sure he was suggesting, wake up right about the time the conversation starts.
2. work 20 hours.
3. get a good 8 hours sleep.
4. wake up, work till the end of the competition.
So, this is a brutal, impossible, long term kind of schedule to keep.
I think the grandparent's point was, you could schedule time before and after the event, to make the event itself bearable, perhaps even enjoyable. Code that's fun to write is just so effortless. 12 hours isn't a big deal, but 20 would be really pushing it for me.
Done occasionally, I don't think it's any problem at all. Kind of like eating 1/4 of the normal sustenance for one week out of a year is actually beneficial on many levels, despite the fact that doing it constantly will kill you.
That's really not good for your health.