/**
 * Given a list of patient heart rate measurements, find the patient(s) with the highest heart rate(s).
 *
 * @param patients A list of pairs containing patient ID and heart rate measurement.
 * @return A list of patient ID(s) with the highest heart rate(s).
 */
fun findPatientHeartRate(patients: List<Pair<Int, Int>>): List<Int> {

    var highestRate = 0
    val highestPatients = mutableListOf<Int>()

    for ((patientId, heartRate) in patients) {
        if (heartRate > highestRate) {
            highestRate = heartRate
            highestPatients.clear()
            highestPatients.add(patientId)
        } else if (heartRate == highestRate) {
            highestPatients.add(patientId)
        }
    }

    return highestPatients
}
/**
 * Given a list of patient heart rate measurements, find the patient(s) with the highest heart rate(s).
 *
 * @param patients A list of pairs containing patient ID and heart rate measurement.
 * @return A list of patient ID(s) with the highest heart rate(s).
 */
fun findPatientHeartRate(patients: List<Pair<Int, Int>>): List<Int> {
/**
 * Given a list of patient heart rate measurements, find the patient(s) with the highest heart rate(s).
 *
 * @param patients A list of pairs containing patient ID and heart rate measurement.
 * @return A list of patient ID(s) with the highest heart rate(s).
 */
fun findPatientHeartRate(patients: List<Pair<Int, Int>>): List<Int> {

    var highestRate = 0
    val highestPatients = mutableListOf<Int>()

    for ((patientId, heartRate) in patients) {
        if (heartRate > highestRate) {
            highestRate = heartRate
            highestPatients.clear()
            highestPatients.add(patientId)
        } else if (heartRate == highestRate) {
            highestPatients.add(patientId)
        }
    }

    return highestPatients
}