/**
 * A carpenter needs to calculate the total number of materials required based on the given lists.
 *
 * @param lumberList A list of pairs containing the length and width of each lumber piece in meters.
 * @param nailList A list of integers representing the quantity of nails required for each lumber piece.
 * @param toolList A list of strings representing the tools required for each lumber piece.
 *
 * @return A triple containing the total quantity of lumber, nails, and tools required.
 */
fun calculateMaterials(lumberList: List<Pair<Double, Double>>, nailList: List<Int>, toolList: List<String>): Triple<Double, Int, Set<String>> {

    var totalLumber = 0.0
    var totalNails = 0
    val totalTools = mutableSetOf<String>()

    for ((length, width) in lumberList) {
        // Calculate the total quantity of lumber by multiplying the length and width and adding it to 'totalLumber'
        totalLumber += length * width

        // Update 'totalNails' by adding the appropriate quantity of nails from nailList
        totalNails += nailList[lumberList.indexOf(Pair(length, width))]

        // Update 'totalTools' by adding the tools required for each lumber piece from toolList
        totalTools.addAll(toolList[lumberList.indexOf(Pair(length, width))].split(","))
    }

    return Triple(totalLumber, totalNails, totalTools)
}
/**
 * A carpenter needs to calculate the total number of materials required based on the given lists.
 *
 * @param lumberList A list of pairs containing the length and width of each lumber piece in meters.
 * @param nailList A list of integers representing the quantity of nails required for each lumber piece.
 * @param toolList A list of strings representing the tools required for each lumber piece.
 *
 * @return A triple containing the total quantity of lumber, nails, and tools required.
 */
fun calculateMaterials(lumberList: List<Pair<Double, Double>>, nailList: List<Int>, toolList: List<String>): Triple<Double, Int, Set<String>> {
/**
 * A carpenter needs to calculate the total number of materials required based on the given lists.
 *
 * @param lumberList A list of pairs containing the length and width of each lumber piece in meters.
 * @param nailList A list of integers representing the quantity of nails required for each lumber piece.
 * @param toolList A list of strings representing the tools required for each lumber piece.
 *
 * @return A triple containing the total quantity of lumber, nails, and tools required.
 */
fun calculateMaterials(lumberList: List<Pair<Double, Double>>, nailList: List<Int>, toolList: List<String>): Triple<Double, Int, Set<String>> {

    var totalLumber = 0.0
    var totalNails = 0
    val totalTools = mutableSetOf<String>()

    for ((length, width) in lumberList) {
        // Calculate the total quantity of lumber by multiplying the length and width and adding it to 'totalLumber'
        totalLumber += length * width

        // Update 'totalNails' by adding the appropriate quantity of nails from nailList
        totalNails += nailList[lumberList.indexOf(Pair(length, width))]

        // Update 'totalTools' by adding the tools required for each lumber piece from toolList
        totalTools.addAll(toolList[lumberList.indexOf(Pair(length, width))].split(","))
    }

    return Triple(totalLumber, totalNails, totalTools)
}