think on one's feet
React quickly, be mentally agile, as in Reporters bombarded him with difficult questions, but Bill was very good at thinking on his feet . This expression uses on one's feet in the sense of "wide awake, alertly." [First half of 1900s]