<s>[INST] Find the maximum value that the quantity $2m+7n$ can have 
Find the maximum value that the quantity $2m+7n$ can have such that there exist distinct positive integers $x_i$ $(1 \leq i \leq m)$, $y_j$ $(1 \leq j \leq n)$ such that the $x_i$'s are even, the $y_j$'s are odd, and $\displaystyle \sum_{i = 1}^m x_i+\sum_{j=1}^n y_j = 1986$.

We see that $\displaystyle \sum_{i = 1}^m x_i \geq 2+4+\cdots+m = \dfrac{(m+2)\frac{m}{2}}{2} = \dfrac{(m+2)m}{4}$ and $\displaystyle \sum_{j=1}^n y_j \geq n^2$. What do we do from here to maximize $2m+7n$?
 [/INST] Alternatively, rewrite $m(m+1)+n^2\leq 1986$ as $(2m+1)^2+(2n)^2\leq 4\cdot 1986+1=7945$.  By the Cauchy-Schwarz Inequality,
$$\begin{align}
(2m+7n)+1=(2m+1)+\frac{7}{2}(2n)
&\leq \sqrt{1^2+\left(\frac{7}{2}\right)^2}\,\sqrt{(2m+1)^2+(2n)^2}
\\
&\leq\sqrt{\frac{53}{4}}\,\sqrt{7945}<325\,.
\end{align}$$
Thus, $$2m+7n<324\,.$$  The equality condition for equality case of the Cauchy-Schwarz Inequality is $\frac{2m+1}{1}=\frac{2n}{7/2}$ and $(2m+1)^2+(2n)^2=7945$, which gives
$$(m,n)=\frac{1}{106}\left(-53\pm 2\sqrt{421085},\pm7\sqrt{421085}\right)\,.$$
The closest positive-integer pair $(m,n)$ that obeys $(2m+1)^2+(2n)^2\leq 7945$ is $$(m,n)=(11,43)\,,$$ for which $2m+7n=323$.
</s>