PALO ALTO, California — Maryam Mirzakhani was best known for breaking the mold — and for doing it the hard way. As a high school student in her native Iran, Mirzakhani competed for the International Mathematical Olympiad in the 1990s — a competition in which girls seldom participated. Years later, she became the first woman to receive the prestigious Fields Medal for mathematics. On Saturday, colleagues mourned her. Mirzakhani, 40, a world-renowned mathematician and Stanford University professor, died Saturday. She had breast cancer. The Fields Medal, often described as the mathematician’s Nobel Prize, is given every four years to no more than four mathematicians, all of whom are 40 or younger.