/**
 * Given two lists of names and ages, return a list of names whose ages are even.
 *
 * @param names List of names.
 * @param ages List of ages.
 * @return List of names with even ages.
 */
fun intersectionIndexingTupleUnpacking(names: List<String>, ages: List<Int>): List<String> {

    // Initialize an empty list
    val result = mutableListOf<String>()

    // Iterate over the indices of the lists using indexing
    for (i in names.indices) {
        // Use tuple unpacking to get the name and age at the current index
        val name = names[i]
        val age = ages[i]

        // Check if the age is even
        if (age % 2 == 0) {
            // Append the name to the result list
            result.add(name)
        }
    }

    return result
}
/**
 * Given two lists of names and ages, return a list of names whose ages are even.
 *
 * @param names List of names.
 * @param ages List of ages.
 * @return List of names with even ages.
 */
fun intersectionIndexingTupleUnpacking(names: List<String>, ages: List<Int>): List<String> {
/**
 * Given two lists of names and ages, return a list of names whose ages are even.
 *
 * @param names List of names.
 * @param ages List of ages.
 * @return List of names with even ages.
 */
fun intersectionIndexingTupleUnpacking(names: List<String>, ages: List<Int>): List<String> {

    // Initialize an empty list
    val result = mutableListOf<String>()

    // Iterate over the indices of the lists using indexing
    for (i in names.indices) {
        // Use tuple unpacking to get the name and age at the current index
        val name = names[i]
        val age = ages[i]

        // Check if the age is even
        if (age % 2 == 0) {
            // Append the name to the result list
            result.add(name)
        }
    }

    return result
}