/**
 * Given a speed limit and a list of speeds, calculate the total distance travelled by a car.
 * If the speed exceeds the speed limit, skip that iteration and continue to the next speed.
 *
 * @param speedLimit The maximum speed limit in km/h.
 * @param speeds A list of speeds in km/h.
 * @return The total distance travelled in meters.
 */
fun calculateTotalDistance(speedLimit: Int, speeds: List<Int>): Int {

    var totalDistance = 0

    for (speed in speeds) {
        if (speed > speedLimit || speed < 0) {
            continue
        } else if (speed == 0) {
            totalDistance += 1
        } else {
            totalDistance += speed
        }
    }

    return totalDistance
}
/**
 * Given a speed limit and a list of speeds, calculate the total distance travelled by a car.
 * If the speed exceeds the speed limit, skip that iteration and continue to the next speed.
 *
 * @param speedLimit The maximum speed limit in km/h.
 * @param speeds A list of speeds in km/h.
 * @return The total distance travelled in meters.
 */
fun calculateTotalDistance(speedLimit: Int, speeds: List<Int>): Int {
/**
 * Given a speed limit and a list of speeds, calculate the total distance travelled by a car.
 * If the speed exceeds the speed limit, skip that iteration and continue to the next speed.
 *
 * @param speedLimit The maximum speed limit in km/h.
 * @param speeds A list of speeds in km/h.
 * @return The total distance travelled in meters.
 */
fun calculateTotalDistance(speedLimit: Int, speeds: List<Int>): Int {

    var totalDistance = 0

    for (speed in speeds) {
        if (speed > speedLimit || speed < 0) {
            continue
        } else if (speed == 0) {
            totalDistance += 1
        } else {
            totalDistance += speed
        }
    }

    return totalDistance
}