One ownership rule
RAII means Resource Acquisition Is Initialization. Put the resource inside an object, acquire it in the constructor, and release it in the destructor.
The resource can be a file, socket, database handle, mutex lock, heap buffer, or any thing that must be closed, unlocked, or freed.
Why it matters
In hackathon code, crashes often come from cleanup being skipped after an early return or error. RAII makes cleanup happen when the object goes out of scope.
You already use RAII when you use std::string, std::vector, std::ifstream, and std::lock_guard. They clean themselves up without you calling free or close in many places.