In 2009, when Rio de Janeiro won the right to host the 2016 Olympic Games — beating out Madrid, Tokyo and Chicago — Brazil was flying high. Although it had not escaped the consequences of the 2008 financial crisis, it had suffered less economic damage, and come back more quickly, than other countries, including the United States. With the economy booming, the federal government felt so flush that its popular president, Luiz Inácio Lula da Silva, had instituted a series of expensive social programs that helped push millions of poor Brazilians toward a better life. The Economist magazine predicted that Brazil would soon be the world’s fifth-largest economy, leapfrogging Britain and France.