5. Vanya decided to give Masha a bouquet of an odd number of flowers for her birthday, consisting of yellow and red tulips, so that the number of flowers of one color differs from the number of flowers of the other by exactly one. Yellow tulips cost 50 rubles each, and red ones cost 31 rubles. What is the largest number of tulips he can buy for Masha's birthday, spending no more than 600 rubles?
Answer: 15.

A bouquet with one more red tulip than yellow ones is cheaper than a bouquet with the same total number of flowers but one more yellow tulip. Therefore, Vanya should buy a bouquet with one more red tulip. The remaining flowers can be paired into red and yellow tulips, with each pair costing 81 rubles. Let's find the number of pairs of different colored tulips in the bouquet: $600: 81=7$ (remainder 33). This means Vanya needs a bouquet with $7 * 2+1=15$ tulips.