The U.S. House of Representatives has approved a $ 516 billion budget measure that funds American troops in Afghanistan and all federal agencies except the Pentagon .