#!/usr/bin/env -S uv run python """Reconcile restricted cash, internal transfers, and currency effects.""" def money(amount: float) -> str: return f"(${abs(amount):,.0f})" if amount < 0 else f"${amount:,.0f}" def show(label: str, amount: float) -> None: print(f"{label:<48} {money(amount):>16}") print("CEDAR TRAIL — BEGINNING POPULATION BY LOCATION") opening_locations = { "Cash": 400_000, "Cash equivalents": 100_000, "Restricted cash": 50_000, } for name, amount in opening_locations.items(): show(name, amount) opening_population = sum(opening_locations.values()) show("Combined beginning population", opening_population) print("\nCEDAR TRAIL — CLASSIFIED ACTIVITY") operating_receipts = 700_000 operating_payments = 600_000 operating_cash_flow = operating_receipts - operating_payments investing_cash_flow = -70_000 financing_cash_flow = 30_000 net_change_before_exchange_effect = ( operating_cash_flow + investing_cash_flow + financing_cash_flow ) show("Operating receipts", operating_receipts) show("Operating payments", -operating_payments) show("Operating cash flow", operating_cash_flow) show("Investing cash flow", investing_cash_flow) show("Financing cash flow", financing_cash_flow) show("Net change before exchange effect", net_change_before_exchange_effect) print("\nCEDAR TRAIL — ENDING POPULATION BY LOCATION") ending_locations = { "Cash": 450_000, "Cash equivalents": 80_000, "Restricted cash": 90_000, } for name, amount in ending_locations.items(): show(name, amount) ending_population = sum(ending_locations.values()) show("Combined ending population", ending_population) # The exchange effect is derived only after supported translation of activity. exchange_rate_effect = ( ending_population - opening_population - net_change_before_exchange_effect ) show("Separate exchange-rate effect", exchange_rate_effect) # Both accounts are already in the combined population. The transfer has no # operating, investing, financing, or total-population effect. internal_transfer = -40_000 + 40_000 show("Internal restricted-cash transfer control", internal_transfer) # A foreign lease commencement changes assets and liabilities, not cash. noncash_lease_commencement = 25_000 show("Lease commencement disclosed as noncash", noncash_lease_commencement) expected_ending_population = ( opening_population + net_change_before_exchange_effect + exchange_rate_effect ) show("Expected ending population", expected_ending_population) show("Population difference", expected_ending_population - ending_population) assert opening_population == 550_000 assert operating_cash_flow == 100_000 assert net_change_before_exchange_effect == 60_000 assert exchange_rate_effect == 10_000 assert internal_transfer == 0 assert expected_ending_population == ending_population == 620_000 print("\nAll arithmetic controls pass. Restriction and rate judgments remain supplied.")