Write a Python 3.11 module with exactly these public functions. Use only the
standard library. Return code only. Do not read files, use the network,
launch processes, or change global state. Do not mutate input collections.

parse_usd(text) -> int
Accept a string containing a nonnegative dollar amount with optional leading
and trailing whitespace, optional leading $, digits, and optional decimal
point followed by one or two digits. Examples: '$12.30' -> 1230, '0.5' -> 50.
Require digits before the decimal point. Reject negatives, commas, exponents,
NaN, infinity, empty strings, and more than two decimal places with ValueError.
Use exact decimal arithmetic or string parsing, never binary float rounding.

apply_vote(score, previous, clicked) -> (new_score, new_vote)
previous is -1, 0, or 1. clicked is -1 or 1. score already includes previous.
Clicking the same vote again removes it. Clicking the other direction changes
it. Reject invalid values with ValueError. Example: (10, -1, 1) -> (12, 1).

merge_pages(pages) -> list[dict]
pages is a list of lists of dictionaries. Each dictionary has an integer 'id'.
Return one new list of independent shallow copies, preserving first appearance
order by id. Keep the first record when IDs repeat, including across pages.
An empty input returns an empty list. Do not sort and do not modify inputs.
