FifthView
Vala
Batman is a Mary Sue because he regularly does the blatantly impossible - like sneaking around Superman - with no explanation besides "because he's Batman," and it's a commonly accepted truth that he can beat literally any opponent given sufficient prep time. But Batman is also an example of a Mary Sue not necessarily being a bad thing - a lot of people enjoy him specifically BECAUSE of those qualities.
There's probably a disjunction between the different Batmans, as different writers and creators have done him differently. In TDK for instance, he failed to save the woman he loved, he was routinely outmaneuvered by the Joker–even at the end, capturing the Joker was less victory than draw given what the Joker had accomplished with Harvey Dent–and he was forced to retreat to the shadows and become the target of all of Gotham in the end just to save the possibility of a good outcome for Gotham.
But, again, the issue is whether a character must absolutely fail in resolving the main plot, end in tragedy, to avoid being called a Mary Sue. Genre fiction often isn't written with ordinary, mediocre characters as MCs; but extraordinary characters or characters doing extraordinary things are a staple of fiction. The fact that those characters are a-typical is what makes them interesting and the story worth telling.