For checking the transcript: https://www.buzzsprout.com/2379282
Think on your feet
To think on your feet means to react quickly and make decisions in a difficult or unexpected situation.
Examples:
1- During the debate, she had to think on her feet when faced with unexpected questions.
2- The actor forgot his lines but thought on his feet and improvised a new scene.