Life expectancy P12454


Statement
 

pdf   zip

thehtml

Good health and well-being is the third target of the United Nations Suistanable Development Goals (SDGs). One way to assess health in a population is by looking at mortality data. Life expectancy measures how many years, on average, a person is expected to live based on current age death rates.

Given the life expectancy of several countries in two different years y1 and y2, compute the country with best life expectancy on y1, the country with best life expectancy on y2, and the country with the best life expectancy improvement during the period.

Input

Input begins with two integer numbers y1 and y2, with 0 ≤ y1 < y2 ≤ 104. Follow data for several countries (at least one): a string with the country name (all different), and the country life expectancies of the two years. These are real numbers between 0.00 and 10000.00 with two digits after the decimal point.

Output

Print three lines with the required information. For the given test cases, there will always be a clear winner for the three queries.

In the first sample input, Sweden is the best of 1980 with 75.85, Spain is the best of 2019 with ‍83.56, and India has the best improvement: 69.66 − 53.81.

Public test cases
  • Input

    1980 2019
    France  74.20 82.65
    India   53.81 69.66
    Spain   75.33 83.56
    Italy   74.20 83.51
    Sweden  75.85 82.80
    

    Output

    Sweden has the best life expectancy of 1980.
    Spain has the best life expectancy of 2019.
    India has the best improvement.
    
  • Input

    3000 3001
    Borduria 60.00 59.00
    

    Output

    Borduria has the best life expectancy of 3000.
    Borduria has the best life expectancy of 3001.
    Borduria has the best improvement.
    
  • Information
    Author
    Jorge Castro
    Language
    English
    Other languages
    Catalan
    Official solutions
    C++ Python
    User solutions
    C++ Python