Yahoo has agreed to pay $50 million in damages and provide two years of free credit-monitoring services to about 200 million people in the U.S. and Israel whose email addresses and other personal information were stolen as part of the biggest security breach in history.