Cleaned up input, and increased performance of it.
Improved output speed by converting cout to printf.