I am trying to make a RBB Arduino based project and I only need 3 pins. In the future I may use one to two more. I wanted to use an ATtiny85 however my code is 13,270 bytes and it would not fit. So I decided to use an ATtiny84 but it also would not fit, it will fit on an ATmega328p but I do not want to use one because i want to keep the project relatively small and I for sure do not need that many pins. Does anyone know of a chip that has a lot of memory but not many pins, or some other solution. Thank you, any help is appreciated.
AFAIK, 8 KiB of flash is the most you can have on an AVR in a DIP package with less than 28 pins. If you do not mind soldering surface-mount parts, the 328P is available in TQFP and VQFN packages, significantly smaller than the DIP version.
Otherwise you could try to optimize your program to fit in 8 KiB. The Arduino libraries are often inefficient size-wise, and in many instances you can save quite a lot by rewriting the parts that you need on top of just avr-libc. Note that this libc is always linked to your program by the Arduino IDE.
There are a few ways to optimize your code and reduce the size. Have a look on this document from Atmel. I've used some tips to reduce the size of my bootloader once.
For the AVR family I'm not familiar with any option. You could use a small QFN package for the atmega328p as well... You might find some small ARM with much more memory and small size.