Problem in executing program in sublime text

I was solving Google Kickstarter-codejam question, where we need to take input file and produce output file. For small input file my sublime text editor was producing correct output which got accepted, but when I was trying to execute long input file which consists of about 26000 lines of input, it produced pop-up window saying program.exe has stopped working. Why did it occur? Is something wrong in my code or
something wrong with editor or compiler? How can I avoid this?

I couldn’t find any fault in my code which could possibly give Runtime error. Could you have a look on my code. This is my code for this question

The problem is that you are declaring a large array inside the function main() i.e. stack memory

1 <= R <= 3000, 1 <= C <= 3000

So, an array[R][C] of size as big as 9000000 elements should declared globally i.e. heap memory.

Your code works fine if you declare the arrays a[r][c] and dp[r+1][c+1] globally.

You can read about this in the following link.


Pls, provide the sufficient data, so that users can generate the same error.I think that’s the one way of solving your problem.

I have provided my code and the question’s link below in the comment. Have a look.


Oh!! I didn’t think of that. Thanks !! It worked.

How can i run large input files of google code jam in sublime text ,should i copy all the large input and paste them in my input.txt or their is any way that i will directly open my input file just we do in ternimal