I read that "a good programmer is worth 5 or 10 bad programmers". I find that likely. Solutions to programming problems very often differ in orders of magnitude. I don't know if I'm a good programmer or not. I'd guess probably average. But how can you really tell if someone is a good programmer or bad?
There are things that scream "I'm a bad programmer!" of course. Copy/pasted code. A constant brute force approach to every problem. Reinvention of various wheels. But what screams "I'm a good programmer"?
I don't think you can judge just by looking at whether a program works or not. It's possible to write something that works, but has horrible source code. Though pretty source code that doesn't work is just as worthless. You can't always judge by how quickly a programmer solves a problem either. Sometimes it's better to take your time and do things right the first time; a wise investment of time now will save you more time in the long run. But a programmer who never ever finishes their program is actually in many ways worse than not having any programmer at all. (For example, if you're paying the programmer.)
The answer I suppose is that it depends on what your goals are. A good programmer is someone who can satisfy whatever goals you currently have to the best extent. Such an unsatisfying answer though. I'd rather there was some objective standard. Programmers should be assigned a numerical value to indicate their degree of mastery. Someone needs to get working on that.