Stocks gain, dollar stumbles as US averts default and Fed skip bets rise