U.S. stocks ended higher Tuesday, erasing an early loss, as traders hoped for progress in talks in Europe on how to keep Greece in the euro. The gains were led by utilities stocks and makers of consumer staples, safe-play sectors investors tend to favor when they're fearful of market swings. Materials stocks fell as prices for metals dropped.