Search for the anomalous chiral effects via charge-dependent azimuthal correlations in proton-nucleus and nucleus-nucleus collisions at the LHC