// ── CREATE ───────────────────────────────────────────────────────
vector<int> v = {1, 2, 3, 4, 5};
vector<int> v(5, 0);                     // size 5, all zeros
 
// ── BEGIN / END ──────────────────────────────────────────────────
auto a = v.begin();                      // points to first
auto b = v.end();                        // points AFTER last
cout << *a << " " << *(b - 1);          // first and last element
 
// ── ITERATE (prefer auto &) ──────────────────────────────────────
for (auto &i : v)                        // & = reference → modifies original
    i++;
 
for (auto i : v)                         // copy → does NOT modify original
    i++;
 
// ── ITERATE with index ───────────────────────────────────────────
for (auto i = v.begin(); i != v.end(); i++)
    cout << *i << " ";                   // avoid this, prefer range-for
 
// ── COMMON OPERATIONS ────────────────────────────────────────────
v.push_back(6);                          // O(1) amortized
v.pop_back();                            // O(1)
v.size();                                // O(1)
v.front();  v.back();                    // first and last element
v[i];                                    // O(1) access, no bounds check
v.at(i);                                 // O(1) access, with bounds check
v.clear();                               // remove all elements