I am doing 1066A - Vova and Train and I am using Gvim. Here is my source code below.
Code
It always says 'terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc shell returned 3
Need help! Thanks in advance! Don't know why the font is weird for my code.
Looks like it works when I run it through the sample test cases. Submission says Memory Limit Exceeded.