_Sam's submission of Stable market | CodeChef