>>577
>What are the best cheap ARs and 9mm pistols?
Palmetto State Armory makes good ARs for cheap - see >>412
9mm pistols? PSA also offers the Dagger, which is a cheap glockalike, but any pistol from the common manufacturers is good - Glock, S&W, SIG, etc. You can often get these used for hundreds less than new price.
>How much ammo should I have for each
As much as possible.
>optimal magazine size and amount to have
Mission specific. You mentioned you may need to bug out into the woods. For that scenario a rifle takes priority. 4-6 loaded STANAG 30 rounders with more ammo in stripper clips should do it, but more or less may be called for depending on the situation. For pistol, 2 mags is probably max as long as you're bringing a rifle. If you're using a pistol in a rifle fight you are in deep shit and need to use those rounds to get out as fast as possible.
Take all this with a grain of salt, however. There are so many possible scenarios you could run into that trying to give such generalized advice borders on ignorant. If you end up traveling with a squad of guys who are fighting all the time, you may wish you'd packed a thousand rounds of ammo in dozens of mags. If you end up needing to cross over a suburban environment everyday you may wish you had invested more into your pistol because carrying a rifle is like carrying a billboard that says "I'm dangerous! Shoot me!" So again, this is generic. Carry shit that your average infantryman might. Aside from guns and ammo, remember to leave room for first aid, medicine, water, tools, extra clothing, etc.