/**
 * This function takes a list of carpenters and their availability schedule
 * and returns a list of carpenters who are available on a given day.
 *
 * @param carpenters A list of carpenters
 * @param schedule A map containing the availability of carpenters
 * @return A list of carpenters who are available on a given day
 */
fun findCarpentersAvailability(carpenters: List<String>, schedule: Map<String, List<Boolean>>): List<String> {

    val availableCarpenters = mutableListOf<String>()

    for (carpenter in carpenters) {
        val availability = schedule[carpenter]
        if (availability != null && !availability.any { it }) {
            availableCarpenters.add(carpenter)
        } else {
            availability?.forEachIndexed { index, available ->
                if (!available) {
                    availableCarpenters.add(carpenter)
                    return@forEachIndexed
                }
            }
        }
    }

    return availableCarpenters
}

// Example usage
val carpenters = listOf("John", "Lisa", "Mike")
val schedule = mapOf(
    "John" to listOf(false, false, true, false, false),
    "Lisa" to listOf(true, true, true, true, false),
    "Mike" to listOf(true, true, true, true, true)
)
/**
 * This function takes a list of carpenters and their availability schedule
 * and returns a list of carpenters who are available on a given day.
 *
 * @param carpenters A list of carpenters
 * @param schedule A map containing the availability of carpenters
 * @return A list of carpenters who are available on a given day
 */
fun findCarpentersAvailability(carpenters: List<String>, schedule: Map<String, List<Boolean>>): List<String> {
/**
 * This function takes a list of carpenters and their availability schedule
 * and returns a list of carpenters who are available on a given day.
 *
 * @param carpenters A list of carpenters
 * @param schedule A map containing the availability of carpenters
 * @return A list of carpenters who are available on a given day
 */
fun findCarpentersAvailability(carpenters: List<String>, schedule: Map<String, List<Boolean>>): List<String> {

    val availableCarpenters = mutableListOf<String>()

    for (carpenter in carpenters) {
        val availability = schedule[carpenter]
        if (availability != null && !availability.any { it }) {
            availableCarpenters.add(carpenter)
        } else {
            availability?.forEachIndexed { index, available ->
                if (!available) {
                    availableCarpenters.add(carpenter)
                    return@forEachIndexed
                }
            }
        }
    }

    return availableCarpenters
}

// Example usage
val carpenters = listOf("John", "Lisa", "Mike")
val schedule = mapOf(
    "John" to listOf(false, false, true, false, false),
    "Lisa" to listOf(true, true, true, true, false),
    "Mike" to listOf(true, true, true, true, true)
)