Decompose rate matrix
Your task
A freight desk publishes a rate card as a rectangular table of whole cents, where rates[o][d] is the quoted price to move one pallet from origin depot o to destination depot d. The desk claims every quote is nothing more than an origin handling fee plus a destination handling fee, and an auditor wants that claim checked. Return a flat list holding the origin fees in order followed by the destination fees in order, pinning the split with the convention that destination 0 carries a fee of exactly 0 cents. Fees may come out negative, since a depot can be quoted at a discount. If no pair of fee lists reproduces the whole table, return an empty list. An empty table returns an empty list. Every row has the same length, and a table with at least one row has at least one column.
Examples
rate_card_fees(rates: list[list[int]]) -> list[int]rate_card_fees([[10, 14, 12], [30, 34, 32]])[10, 30, 0, 4, 2]rate_card_fees([[5, 6], [7, 9]])[]rate_card_fees([[100, 250, 175], [100, 250, 175], [40, 190, 115]])[100, 100, 40, 0, 150, 75]