Shifted convolution sums, and applications