/**
 * This function calculates the total harvest for each farmer
 * based on the number of crops they own and the type of crop.
 *
 * @param farmers A list of farmers.
 * @param crops A list of crops with the format (type, quantity).
 * @return A dictionary mapping each farmer to their total harvest.
 */
fun calculateHarvest(farmers: List<String>, crops: List<Pair<String, Int>>): Map<String, Int> {

    return farmers.associate { farmer ->
        farmer to crops.sumBy { (cropType, quantity) ->
            if (cropType == farmer) quantity else 0
        }
    }
}
/**
 * This function calculates the total harvest for each farmer
 * based on the number of crops they own and the type of crop.
 *
 * @param farmers A list of farmers.
 * @param crops A list of crops with the format (type, quantity).
 * @return A dictionary mapping each farmer to their total harvest.
 */
fun calculateHarvest(farmers: List<String>, crops: List<Pair<String, Int>>): Map<String, Int> {
/**
 * This function calculates the total harvest for each farmer
 * based on the number of crops they own and the type of crop.
 *
 * @param farmers A list of farmers.
 * @param crops A list of crops with the format (type, quantity).
 * @return A dictionary mapping each farmer to their total harvest.
 */
fun calculateHarvest(farmers: List<String>, crops: List<Pair<String, Int>>): Map<String, Int> {

    return farmers.associate { farmer ->
        farmer to crops.sumBy { (cropType, quantity) ->
            if (cropType == farmer) quantity else 0
        }
    }
}