Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection