Rank with gaps
Your task
Implement SQL RANK() OVER (ORDER BY score DESC). Given a list of [name, score] rows, assign each a rank: the highest score gets rank 1, and ties share the same rank with the next distinct score skipping ranks (standard RANK, not DENSE_RANK). Return [name, rank] pairs sorted by rank ascending, then name ascending within the same rank. Scores are integers; up to 5000 rows.
Examples
rank_window(rows: list[list]) -> list[list]Example 1
Input
rank_window([["a", 90], ["b", 90], ["c", 80]])Output
[["a", 1], ["b", 1], ["c", 3]]