I'll explain the errors that crash vector code. Accessing v[10] when size is 5 corrupts memory silently. Use v.at(10) to get an exception instead. Calling pop_back(), front(), or back() on an empty vector triggers undefined behavior.
Check v.empty() first. Comparing vectors with == checks if all elements match, but comparing with < uses lexicographic order like dictionary sorting. Modifying a vector while iterating invalidates iterators and causes crashes.
If you push_back inside a range loop, the iterator breaks. Cache v.size() outside loops that don't modify the vector.