The hard part of coding is the design. A lot of programmers think as they code. They try something, get stuck, try something else, understand the problem better and so on. It's a kind of intellectual laziness which is not optimal.
I've been doing competitive algorithms for a while, and I learned that the best programmers don't start programming until they know exactly what their algorithm will be. And an other thing is that they rarely have bugs. Also testing/debugging is extremely time consuming: they think carefully that everything is right before testing. Which is unlike the lazy approach which is to have something working asap and go into debugging mode.
It takes a lot of discipline to be able to work like that, esp. under pressure.