A few years ago, someone asked me the ratio of time spent between writing code and debugging. At my level at the time, the ratio of debugging was still quite large.
I wrote a complex logic code today, but I didn't expect it to be done in one go, and it passed in one go.