Review: Year Ended December 31,
 2020 2021 2022
CASH, CASH EQUIV ALENTS, AND RESTRICTED CASH, BEGINNING OF PERIOD $ 36,410  $ 42,377  $ 36,477  
OPERA TING ACTIVITIES:
Net income (loss) 21,331  33,364  (2,722 )
Adjustments to reconcile net income (loss) to net cash from operating activities:
Depreciation and amortization of property and equipment and capitalized content costs, operating
lease assets, and other 25,180  34,433  41,921  
Stock-based compensation 9,208  12,757  19,621  
Other expense (income), net (2,582 ) (14,306 ) 16,966  
Deferred income taxes (554) (310) (8,148 )
Changes in operating assets and liabilities:
Inventories (2,849 ) (9,487 ) (2,592 )
Accounts receivable, net and other (8,169 ) (18,163 ) (21,897 )
Accounts payable 17,480  3,602  2,945  
Accrued expenses and other 5,754  2,123  (1,558 )
Unearned revenue 1,265  2,314  2,216  
Net cash provided by (used in) operating activities 66,064  46,327  46,752  
INVESTING ACTIVITIES:
Purchases of property and equipment (40,140 ) (61,053 ) (63,645 )
Proceeds from property and equipment sales and incentives 5,096  5,657  5,324  
Acquisitions, net of cash acquired, and other (2,325 ) (1,985 ) (8,316 )
Sales and maturities of marketable securities 50,237  59,384  31,601  
Purchases of marketable securities (72,479 ) (60,157 ) (2,565 )