/**
 * A biologist conducted an experiment to observe the division rate of a cell population over time.
 * The data collected is a list of pairs, where each pair contains the day of observation (integer)
 * and the number of observed cell divisions (integer).
 *
 * Your task is to write a function that calculates the total number of cell divisions observed
 * within a given range of days.
 *
 * Hint: Use destructuring declarations and the += operator to extract the day and division values
 * from each pair.
 *
 * @param data a list of pairs, where each pair contains the day of observation and the number of cell divisions
 * @param startDay the start day of the range
 * @param endDay the end day of the range
 * @return the total number of cell divisions observed within the range of days
 *
 * Example:
 * countObservedDivisions(listOf(1 to 5, 2 to 3, 3 to 8, 4 to 6, 5 to 7), 2, 4) returns 17
 */
fun countObservedDivisions(data: List<Pair<Int, Int>>, startDay: Int, endDay: Int): Int {

    var count = 0
    for ((day, div) in data) {
        if (day in startDay..endDay) {
            count += div
        }
    }
    return count
}
/**
 * A biologist conducted an experiment to observe the division rate of a cell population over time.
 * The data collected is a list of pairs, where each pair contains the day of observation (integer)
 * and the number of observed cell divisions (integer).
 *
 * Your task is to write a function that calculates the total number of cell divisions observed
 * within a given range of days.
 *
 * Hint: Use destructuring declarations and the += operator to extract the day and division values
 * from each pair.
 *
 * @param data a list of pairs, where each pair contains the day of observation and the number of cell divisions
 * @param startDay the start day of the range
 * @param endDay the end day of the range
 * @return the total number of cell divisions observed within the range of days
 *
 * Example:
 * countObservedDivisions(listOf(1 to 5, 2 to 3, 3 to 8, 4 to 6, 5 to 7), 2, 4) returns 17
 */
fun countObservedDivisions(data: List<Pair<Int, Int>>, startDay: Int, endDay: Int): Int {
/**
 * A biologist conducted an experiment to observe the division rate of a cell population over time.
 * The data collected is a list of pairs, where each pair contains the day of observation (integer)
 * and the number of observed cell divisions (integer).
 *
 * Your task is to write a function that calculates the total number of cell divisions observed
 * within a given range of days.
 *
 * Hint: Use destructuring declarations and the += operator to extract the day and division values
 * from each pair.
 *
 * @param data a list of pairs, where each pair contains the day of observation and the number of cell divisions
 * @param startDay the start day of the range
 * @param endDay the end day of the range
 * @return the total number of cell divisions observed within the range of days
 *
 * Example:
 * countObservedDivisions(listOf(1 to 5, 2 to 3, 3 to 8, 4 to 6, 5 to 7), 2, 4) returns 17
 */
fun countObservedDivisions(data: List<Pair<Int, Int>>, startDay: Int, endDay: Int): Int {

    var count = 0
    for ((day, div) in data) {
        if (day in startDay..endDay) {
            count += div
        }
    }
    return count
}