Is Dumbledore Really the Greatest Wizard at this Time? Is Hogwarts Truly the Safest Place on Earth?

I just finished book number two, so whatever I’m saying here is based on books one and two. If you want to engage in a debate, base yourself on these 2 books without giving spoilers about the others. There's something that confuses me: People keep saying that Hogwarts is the safest place on earth and Dumbledore is the greatest wizard, but it doesn’t make sense to me reading books number one and two. For example, in Harry Potter and the Chamber of Secrets, it blows my mind that Dumbledore was not able to solve the mystery behind the Chamber of Secrets, knowing that Tom Riddle opened that chamber 50 years before when Dumbledore was still a teacher, so he had 50 years to solve that mystery that Harry Potter and his two friends, who are only 12 years old at the time, were able to solve in just one school year. Also, how can people say that Hogwarts is the safest place on earth when students were being petrified here and there, and Dumbledore was able to do nothing to stop it? If it wasn’t for Harry, Ron, and Hermione, Ginnie Weasley would’ve been dead. And maybe many other students. I don’t know if you guys understand what I want to say, but they were able to solve a mystery in just one school year when Dumbledore knew about that chamber of secrets for 50 years. Harry had to face the ghost of Riddle alone, only 12 years old and knowing about magic for just one year. Also, the same for Harry Potter and the Sorcerer's Stone because how could Dumbledore, being the smarter greatest wizard of all time, have let a bad professor come into his school for the whole school year, plotting with Voldemort without him noticing? It was Harry, being 11 years old at the time, who had to go and confront him. It just blows my mind that a child has to do that. And talking about professors, can we talk about Gilderoy Lockhart? How could Dumbledore be fooled by such a crook? I mean, I don’t know, man. I think it doesn’t add up, and I’m willing to get into a deep discussion about that.