@(x,y)find((v=((z=cumsum(x.^2))(y:end)-[0,z(1:end-y)]))==max(v),1)-1
Standard input is empty
ans = @(x, y) find ((v = ((z = cumsum (x .^ 2)) (y:end) - [0, z(1:end - y)])) == max (v), 1) - 1
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!