Measurement of the branching fraction and the CP-violating asymmetry for the decay B0→KS0π0