As you have to spend all $\$200$, this means:
$2x + 2y + 10z = 200$
And because the total number of birds cannot be more than $200$, therefore:
$40x + 2y + 2z \le 200$
To optimize the solution, meaning than the total number of birds should be as close to $200$ as possible (but not more than $200$). We can first try exactly $200$ birds first:
$40x + 2y + 2z = 200$
Simplifying the first and third equations give $4z = 19x$. Note that all $x, y, z$ are non-negative integers. We shall try the smallest pair of non-negative integers $x$ and $z$ first (because if we choose a larger pair, $y$ will more likely become negative). Since $4$ and $19$ are relatively prime, hence we try $x = 4$ and $z = 19$. Solving the equations give $y = 1$.
In other words, there exists an optimal solution such that we can buy:
$40 \times 4 = 160$ pigeons for $\$8$
$2 \times 1 = 2$ parrots for $\$2$
$2 \times 19 = 38$ falcons for $\$190$
A total of $200$ birds for $\$200$.
In this question we are lucky to get the optimal answer at the first try. It is easy to spot that if we choose a larger pair of $x$ and $z$ (such as $x=8$ and $z=38$), $y$ becomes negative immediately so there won't be another optimal answer.
In the case if there are no solutions for $200$ birds, a way to continue is to reduce the number of birds $200$ to, for example, $198$, then $196$ and so on (we need not try odd numbers because we have to buy any type of birds in even number).