TSMC beats revenue and profit expectations for third quarter