Project Euler 14: Longest Collatz Sequence
An obvious improvement is to check n for being already solved on each iteration of for n loop. As coded, you still go all the way to 1, which might be quite long. Something along the lines of

for ( a = 2; a &lt; maxnum; ++a) {
    std::vector&lt;unsigned long long&gt;cache;
    for (n = a; n != 1 &amp;&amp; !cz[n].solved; ) {
        cache.push_back(n);
        n = (n%2 == 0)? n/2: 3*n+1;
    }
    // make cached data solved
    ...
}


If cz[1].solved is preset to true, the loop condition can be simplified to

for (n = a; !cz[n].solved; )