so my current program uses two array variables, each of size 250x250, and I use the ofstream function to output the stuff on Notepad. When I first ran it with each array variable of size 50x50, I didn't have any problems and it didnt take too long to run. But when I increased the size of each of them to 250x250, I'm having all sorts of problems. When I ran the simulation (each simulation runs the program) too many times, the program crashed. I then tried eliminating one of the variables, and while the program runs, it takes ridiculously long to run. It would take 23 hours! to do the number of simulations I want, whereas I think it only took 10 minutes for the 50x50 case.

I attached the relevant part of the program in this message. The parts including:

if ((x_value)<0.25)
{x--;
LeftCount++;


For the left, right, down, and up cases are negligible since they don't affect the 'island[][]' array variable
So what can I possibly do to speed up the program? Do I have no choice but to use a smaller array size?