how to find 2d vector length cpp

#include <iostream>
#include <vector>
#include <cmath>

double calculateDistance(const std::vector<std::vector<int>>& points) {
    if (points.empty() || points[0].empty()) return 0.0; // If the vector is empty, return 0

    int x1 = points[0][0]; // Extract x-coordinate of first point
    int y1 = points[0][1]; // Extract y-coordinate of first point

    int x2 = points[1][0]; // Extract x-coordinate of second point
    int y2 = points[1][1]; // Extract y-coordinate of second point

    double distance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)); // Calculate distance using distance formula

    return distance; // Return the calculated distance
}

int main() {
    // Example usage
    std::vector<std::vector<int>> points = {{1, 2}, {4, 6}}; // Example 2D points

    double length = calculateDistance(points); // Calculate the distance between two points
    std::cout << "Length between points: " << length << std::endl; // Output the calculated distance

    return 0;
}