This question evaluates skills in grouping and aggregation of items and constrained selection to maximize a numeric objective, reflecting competency in data manipulation and combinatorial optimization.

A library runs a summer reading program. Each book a student reads earns a certain number of points, and each book belongs to a category.
A student may score points from at most 3 books, with the restriction that the selected books must be from distinct categories (i.e., no two selected books can share the same category).
Given a list of books the student read, compute the maximum total score the student can achieve.
books
: a list of tuples
(category: str, points: int)
points
are integers (typically non-negative).
def get_max_score(books: list[tuple[str, int]]) -> int:
...
test1 = [
("Adventure", 5),
("Adventure", 2),
("History", 3),
]
assert get_max_score(test1) == 8 # 5 (Adventure) + 3 (History)
test2 = [
("Adventure", 4),
("History", 3),
("Reference", 1),
("Fiction", 2),
]
assert get_max_score(test2) == 9 # 4 + 3 + 2
test3 = [
("Biography", 2),
("Biography", 4),
("Science", 3),
("Science", 1),
]
assert get_max_score(test3) == 7 # 4 + 3
test4 = []
assert get_max_score(test4) == 0