For a value i=m such that 0<=m<=n
j ranges from 0 to m2;
The third loop is run when j=m,2m,3m,....m2 so total m times, and for remain m2-m iterations of j, third loop is not executed hence constant time for them.
Hence the first time the loop run for m iterations, then 2m, 3m,.....m2
Total: 1m+2m+3m+...+m2 + the remaining m2-m iterations of j which run for $\Theta$(1) = m[1+2+...+m]+m2=$\Theta$(m3)
When the algorithm is run for all values of i
We get 03+13+23+33+...n3
=$\Theta$(n4)