Rejection sucks, it's true. But one thing a lot of people don't know is that the chance of being accepted to YC goes up with repeated applications. I even think most founders who YC funds get rejected before they get accepted. (I may be wrong about most* but certainly it's a large chunk.)
The main thing is to demonstrate progress since your last application.
* Edit: I asked the team and got back: "most is true! for w24 companies, 58% had applied previously"