Limits 2s, 512 MB
J's uncle Mr. M is obsessed with statistics. Wherever he finds data he likes to apply statistical analysis on that. J being his nephew M expects him to be good on statistical analysis as well. Today he's come to J with a 2D matrix of numbers from GOD knows where. Now he's choosing a rectangular portion from that matrix and asking J to calculate the variance of that portion. J is not that bad at statistics as well but needs your help to double check the answer before telling it to uncle M. Are you up for helping J?
This is a companion discussion topic for the original entry at https://toph.co/p/uncle-m