Liquidity and Capital Resources
Cash Flows
A summary of the sources and uses of cash, cash equivalents, restricted cash and restricted cash equivalents is as follows:
Operating Activities
Net cash used in operating activities for the year ended December 29, 2019 was $270.4 million and was primarily the result of: (i) $158.3 million mark-to-market gain on equity investments with readily determinable fair value; (ii) $143.4 million gain on business divestiture; (iii) $128.4 million increase in inventories to support the construction of our solar energy projects; (iv) $66.2 million increase in accounts receivable, primarily driven by billings in excess of collections; (v) $38.2 million increase in contract assets driven by construction activities; (vi) $25.2 million gain on sale of assets; (vii) $17.3 million gain on sale of equity investments without readily determinable fair value; (viii) $8.9 million decrease in operating lease liabilities; (ix) $8.8 million increase in prepaid expenses and other assets, primarily related to movements in prepaid inventory; (x) net loss of $7.7 million; and (xi) $2.2 million increase in project assets, primarily related to the construction of our commercial solar energy projects. This was offset by: (i) $80.1 million depreciation and amortization; (ii) $79.3 million increase in accounts payable and other accrued liabilities; (iii) $50.2 million increase in advances to suppliers; (iv) $33.8 million loss on sale and impairment of residential lease assets; (v) $27.5 million increase in contract liabilities driven by construction activities; (vi) stock-based compensation of $26.9 million; (vii) $9.5 million non-cash interest expense; (viii) $8.6 million decrease in operating lease right-of-use assets; (ix) $7.1 million loss in equity in earnings of unconsolidated investees; (x) $5.9 million non-cash restructuring charges; and (xi) $5.0 million net change in deferred income taxes; and (xii) impairment of long-lived assets of $0.8 million.
In December 2018 and May 2019, we entered into factoring arrangements with two separate third-party factor agencies related to our accounts receivable from customers in Europe. As a result of these factoring arrangements, title of certain accounts receivable balances was transferred to third-party vendors, and both arrangements were accounted for as a sale of financial assets given effective control over these financial assets has been surrendered. As a result, these financial assets have been excluded from our consolidated balance sheets. In connection with the factoring arrangements, we sold accounts receivable invoices amounting to $119.4 million and $26.3 million in fiscal 2019 and 2018, respectively. As of December 29, 2019 and December 30, 2018, total uncollected accounts receivable from end customers under both arrangements were $11.6 million and $21.0 million, respectively.
Net cash used in operating activities in fiscal 2018 was $543.4 million and was primarily the result of: (i) net loss of $917.5 million; (ii) $182.9 million increase in long-term financing receivables related to our net investment in sales-type leases; (iii) $127.3 million decrease in accounts payable and other accrued liabilities, primarily attributable to payments of accrued expenses; (iv) $59.3 million gain on business divestiture; (v) $54.2 million gain on the sale of equity investments; (vi) $43.5 million increase in contract assets driven by construction activities; (vii) $39.2 million increase in inventories due to the support of various construction projects; (viii) $30.5 million decrease in contract liabilities driven by construction activities; (ix) $6.9 million increase in deferred income taxes; (x) $6.8 million increase due to other various activities; and (xi) $0.2 million increase in accounts receivable, primarily driven by billings. This was partially offset by: (i) impairment of property, plant and equipment of $369.2 million; (ii) impairment of residential lease assets of $189.7 million; (iii) net non-cash charges of $162.1 million related to depreciation, stock-based compensation and other non-cash charges; (iv) loss on sale of residential lease assets of $62.2 million; (v) $44.4 million decrease in advance payments made to suppliers; (vi) $39.5 million decrease in project assets, primarily related to the construction of our Commercial solar energy projects; (vii) $22.8 million decrease in prepaid expenses and other assets, primarily related to the receipt of prepaid inventory; (viii) $17.8 million decrease in equity in earnings of unconsolidated investees; (ix) $6.9 million net change in income taxes; (x) $6.4 million unrealized loss on equity investments with readily determinable fair value; and (xi) $3.9 million dividend from equity method investees.
Net cash used in operating activities in fiscal 2017 was $267.4 million and was primarily the result of: (i) net loss of $1,170.9 million; (ii) $216.3 million decrease in accounts payable and other accrued liabilities, primarily attributable to payment of accrued expenses; (iii) $123.7 million increase in long-term financing receivables related to our net investment in sales-type leases; (iv) $38.2 million increase in inventories to support the construction of our solar energy projects; (vi) $25.9 million increase in equity in earnings of unconsolidated investees; (vii) $7.0 million net change in income taxes; (viii) $5.3 million gain on sale of equity method investment; and (ix) $1.2 million decrease in accounts receivable, primarily driven by collections; This was partially offset by: (i) $624.3 million impairment of residential lease assets; (ii) other net non-cash charges of $239.6 million related to depreciation, stock-based compensation and other non-cash charges; (iii) $145.2 million increase in contract liabilities driven by construction activities; (iv) $110.5 million decrease in prepaid expenses and other assets, primarily related to the receipt of prepaid inventory; (v) $89.6 million impairment of 8point3 Energy Partners investment balance; (vi) $68.8 million decrease in advance payments made to suppliers; (vii) $30.1 million dividend from 8point3 Energy Partners; (viii) $10.7 million decrease in contract assets driven by milestone billings; (ix) $2.3 million decrease in project assets, primarily related to the construction of our commercial and power plant solar energy projects
Investing Activities
Net cash provided by investing activities in the year ended December 29, 2019 was $21.4 million, which included (i) proceeds of $60.0 million from sale of property, plant, and equipment; (ii) $42.9 million proceeds from sale of investments; (iii) net proceeds of $40.5 million from business divestiture; and (iv) $2.0 million of proceeds resulting from realization of estimated receivables from a business divestiture. This was offset by (i) cash paid for solar power systems of $53.3 million; (ii) $47.4 million of purchases of property, plant and equipment; (iii) cash paid for investments in unconsolidated investees of $12.4 million; and (iv) $10.9 million of cash de-consolidated from the sale of residential lease assets.
Net cash provided by investing activities in fiscal 2018 was $274.9 million, which included (i) proceeds from the sale of investment in joint ventures and non-public companies of $420.3 million; (ii) proceeds of $23.3 million from business divestiture; and (iii) a $13.0 million dividend from equity method investees. This was partially offset by: (i) $167.0 million in capital expenditures primarily related to the expansion of our solar cell manufacturing capacity and costs associated with solar power systems, leased and to be leased; and (ii) $14.7 million paid for investments in consolidated and unconsolidated investees.
Net cash used in investing activities in fiscal 2017 was $293.1 million, which included (i) $283.0 million in capital expenditures primarily related to the expansion of our solar cell manufacturing capacity and costs associated with solar power systems, leased and to be leased; (ii) $18.6 million paid for investments in consolidated and unconsolidated investees; and (iii) $1.3 million purchase of marketable securities. This was partially offset by proceeds from the sale of investment in joint ventures of $6.0 million and a $3.8 million dividend from equity method investees.
Financing Activities
Net cash provided by financing activities in the year ended December 29, 2019 was $344.3 million, which included: (i) $171.9 million from the common stock offering; (ii) $110.9 million in net proceeds of bank loans and other debt; (iii) $69.2 million net proceeds from the issuance of non-recourse residential financing, net of issuance costs; (iv) $35.5 million of net contributions from noncontrolling interests and redeemable noncontrolling interests related to residential lease projects; (v) $3.0 million of proceeds from issuance of non-recourse power plant and commercial financing, net of issuance costs. This was partially offset by (i) $39.0 million of payment associated with prior business combination; (ii) $5.6 million in purchases of treasury stock for tax withholding obligations on vested restricted stock; and (iii) $1.6 million settlement of contingent consideration arrangement, net of cash received.
Net cash provided by financing activities in fiscal 2018 was $85.8 million, which included: (i) $174.9 million in net proceeds from the issuance of non-recourse residential financing, net of issuance costs; (ii) $129.3 million of net contributions from noncontrolling interests and redeemable noncontrolling interests related to residential lease projects; and (iii) $94.7 million in net proceeds from the issuance of non-recourse power plant and commercial financing, net of issuance costs. This was partially offset by: (i) $307.6 million in net repayments of 0.75% debentures due 2018, bank loans and other debt; and (ii) $5.5 million in purchases of treasury stock for tax withholding obligations on vested restricted stock.
Net cash provided by financing activities in fiscal 2017 was $589.9 million, which included: (i) $351.8 million in net proceeds from the issuance of non-recourse power plant and commercial financing, net of issuance costs; (ii) $179.2 million of net contributions from noncontrolling interests and redeemable noncontrolling interests primarily related to residential lease projects; and (iii) $82.7 million in net proceeds from the issuance of non-recourse residential financing, net of issuance costs. This was partially offset by: (i) 19.1 million in net repayments of bank loans and other debt; and (ii) $4.7 million in purchases of treasury stock for tax withholding obligations on vested restricted stock.
Table:
 |  | Fiscal Year Ended | 
(In thousands) | December 29, 2019 | December 30, 2018 | December 31, 2017
Net cash used in operating activities | $(270,413) | $(543,389) | $(267,412)
Net cash provided by (used in) investing activities | $21,366 | $274,900 | $(293,084)
Net cash provided by financing activities | $344,314 | $85,847 | $589,932


Question: Which year was the net cash used in operating activities the highest?
Answer: 2018
Calculation: $(267,412) > $(270,413) > $(543,389)