Q: Context: "Yankee Doodle" is a well-known British-American song, the early versions of which date back to before the Seven Years' War and the American Revolution (1775 -- 83). It is often sung patriotically in the United States today and is the state anthem of Connecticut. Its Roud Folk Song Index number is 4501. The melody is thought to be much older than both the lyrics and the subject, going back to folk songs of Medieval Europe.

Question: where did the melody for yankee doodle come from? Let's give stream of consciousness first:
To answer this question, we should know that: The melody is thought to be much older than both the lyrics and the subject, going back to folk songs of Medieval Europe. Therefore, the final answer is folk songs of Medieval Europe.