Hackathons, I believe, are not about winning/losing. They're about learning/picking up new things in a limited amount of time. Losing a hackathon does not mean you should stop programming -- but disliking programming itself means you should. I've lost a bunch of hackathons, but I still like programming and do it everyday. Do not let a competition get in the way of your whole career.
Hackathons are a fun way to demonstrate/test your talents. "Losing" one just means the subjective judges didn't get it. They have nothing to do with what you're capable of.
The only way you get to any kind of success is generally via a long string of failures, its not the people who never fail that make it its the people who are afraid to fail.