S&P 500 dips after US inflation data, ending weak third quarter