I do not understand why the program 7630586 gets ML, but 7631291 passes same test.
(This is the same program as 7631291 with a small fix that gets accepted: 7649167)
The only difference between 7630586 and 7631291 is that
long board[][] = new long[n][n];
is changed to
int board[][] = new int[n][n];
For n = 2000, the difference should be 4*2000*2000 bytes (about 16 MB), but it turns out to be more than 100 MB.
Any thoughts?
UPD: the program 7630586 that gives ML on java 6,7 gets accepted on java 8: 7649266 So, next time I need to use java 8 when I am not sure about the memory limit and java 6 or 7 otherwise:)