Stocks rise as megacaps lead; inflation data, earnings eyed