How to compute time-lagged correlation between two variables with many examples at each time t?
An application of a specific correlation formula depends on the data-type (continuous or rank data etc). Given that your data is continuous, you can apply  Karl Pearson formula. However, if you're interested  interested in cause and effect relationship, you may prefer to use simple regression  model.