Project Euler 78: Counting Partitions
I'll just comment on the cleanliness/readability aspect:


In spite of the given comments, you should give g and p better names.  It'll also allow you to remove those comments, which is good because they shouldn't need to be used as such.
This kind of initialization isn't really necessary:


vector&lt;int&gt; g = vector&lt;int&gt;({1, 2});



It could just be this:

vector&lt;int&gt; g = { 1, 2 };


If you're using C++11, you can also omit the =.
This loop statement may be a little hard to read:


for (int n = 1; n ; n++)



It's understood that having n alone means the loop will continue as long as it's nonzero, but you can still make that clear here anyway.  It's otherwise hard to read this statement at a glance.
This calculation is unclear as written:


g.push_back(k*(3*k - 1)/2);



You also reuse it, so consider making it a constant in terms of k.
Try to add more blank lines between code sections, such as the loops.  Having everything together like this can make it harder for the brain to parse out different sections easily.
The number 1000000 here is a "magic number" (ambiguous hard-coded number).  As such, it should be assigned to a constant with a relevant name.  This will also allow you to change this number in just one place.