Let's maybe also consider the role of e.g. US interference and sanctions in your two examples, before we decide capitalism good, socialism bad.
Or let's maybe not.
Cuba could, and did, trade with essentially every other nation on the planet, so blaming "U.S. sanctions" is not a realistic excuse for their failure.