As someone who's been turned down 4 times from YC without getting to the interview stage, I'd say
do reapply in 5 months. Don't fixate on it, definitely do stuff in the meantime, but I think you should treat it as just one more thing you can do to maximize the chance of success for your startup.
The big advantage of applying isn't so much that you'll get in (I've kinda given up hope of that happening unless a buyout is imminent, a la Fleaflicker, and at that point we wouldn't need them). It's that it gives you a regular point to check your progress and see how what you've done stacks up against what you said you'd do. My experience - with 3 consecutive application cycles - is that we're basically doing exactly what we said we'd do in the first application, just 60-80% slower than we anticipated. That's very useful data when we're planning future milestones.
It also gives you a chance to revisit your assumptions and make any necessary course corrections. For example, we had a founding-team issue that PG brought to our attention with the first application that we corrected between app 1 and app 2. Several of the competitors we were initially afraid of have not materialized. The market as a whole does not seem to be developing as quickly as we thought it would, though it does seem to be developing. That's very useful data when we're trying to budget finances and decide whether it's time to go for outside funding. We have the excuse to take another close look at our competitors and see what they're doing wrong and what they're doing right.
It's easy to go full steam ahead on coding and then miss fundamental changes in the environment that render all your coding useless. 6 months is just about the right period of time to revisit your assumptions and see if it's still worth doing. You should be doing this anyway as a business, but YC gives you an excuse and a deadline.