Y our Diffusion Model is Secretly a Noise Classifier and Benefits from Contrastive Training