the basic programs implemented in python with keeping the runtime complexity as low as possible using various arithmetic techniques.