Wiktionary
think on one's feet
vb. (context idiomatic English) When one is in the middle of a process, activity, or conversation, to adjust rapidly, effectively, and intelligently to new developments or changing circumstances.
Usage examples of "think on one's feet".
The art of persuasion, he held, depended mainly on a marshaling of facts, clarity, conviction, and the ability to think on one's feet.