Ledger window volume
Your task
A billing service keeps an append only ledger, so stamps holds the Unix second of each entry in nondecreasing order, and two entries can share a second. A support tool needs the volume inside a window before it renders anything. Given stamps, start_stamp and end_stamp, return how many entries fall in the half open window: an entry counts when its stamp is at or after start_stamp and strictly before end_stamp. An entry written exactly at start_stamp counts, one written exactly at end_stamp does not, and that convention is what lets neighbouring windows tile without double counting a single entry. Return 0 when the window is inverted or empty, meaning end_stamp is at or before start_stamp, and 0 for an empty ledger. The ledger holds years of history, so counting entries one at a time is too slow.
Examples
count_ledger_entries(stamps: list[int], start_stamp: int, end_stamp: int) -> intcount_ledger_entries([100, 200, 200, 300, 400], 200, 400)3count_ledger_entries([100, 200, 300], 300, 300)0count_ledger_entries([100, 200, 300], 0, 1000)3