Choose the most expensive laptop whose price is strictly less than its quality.
You are given laptops. Each laptop has two attributes: price and quality.
Find whether there exists a pair of laptops such that one laptop is cheaper than another but also has higher quality. If such a pair exists, print "Happy Alex". Otherwise, print "Poor Alex".
In other words, Alex is happy if there is at least one inversion between price and quality: a laptop with smaller price and larger quality than some other laptop.
The task is to detect whether the ordering by price is consistent with the ordering by quality. If any cheaper laptop is better in quality than a more expensive one, the answer is affirmative.
Print:
Happy Alex if there exists a pair of laptops where the cheaper one has higher quality.Poor Alex otherwise.Example 1
Input
3 100 10 200 5 150 7
Output
Happy Alex
Explanation
The laptop priced at 100 has quality 10, while the laptop priced at 200 has quality 5. A cheaper laptop has higher quality, so Alex is happy.
Example 2
Input
3 100 5 150 7 200 10
Output
Poor Alex
Explanation
Quality increases with price, so there is no cheaper laptop with higher quality than a more expensive one.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.