Problem: Given $\triangle ABC$ and a point $P$ on one of its sides, call line $\ell$ the $\textit{splitting line}$ of $\triangle ABC$ through $P$ if $\ell$ passes through $P$ and divides $\triangle ABC$ into two polygons of equal perimeter. Let $\triangle ABC$ be a triangle where $BC = 219$ and $AB$ and $AC$ are positive integers. Let $M$ and $N$ be the midpoints of $\overline{AB}$ and $\overline{AC},$ respectively, and suppose that the splitting lines of $\triangle ABC$ through $M$ and $N$ intersect at $30^\circ.$ Find the perimeter of $\triangle ABC.$

Solution: Denote $BC = a$ $CA = b$ $AB = c$
Let the splitting line of $\triangle ABC$ through $M$ (resp. $N$ ) crosses $\triangle ABC$ at another point $X$ (resp. $Y$ ).
WLOG, we assume $c \leq b$
$\textbf{Case 1}$ $a \leq c \leq b$
We extend segment $AB$ to $D$ , such that $BD = a$ .
We extend segment $AC$ to $E$ , such that $CE = a$
In this case, $X$ is the midpoint of $AE$ , and $Y$ is the midpoint of $AD$
Because $M$ and $X$ are the midpoints of $AB$ and $AE$ , respectively, $MX \parallel BE$ .
Because $N$ and $Y$ are the midpoints of $AC$ and $AD$ , respectively, $NY \parallel CD$
Because $CB = CE$ $\angle CBE =\angle CEB = \frac{\angle ACB}{2}$ .
Because $BC = BD$ $\angle BCD = \angle BDC = \frac{\angle ABC}{2}$
Let $BE$ and $CD$ intersect at $O$ .
Because $MX \parallel BE$ and $NY \parallel CD$ , the angle formed between lines $MX$ and $NY$ is congruent to $\angle BOD$ . Hence, $\angle BOD = 30^\circ$ or $150^\circ$
We have \begin{align*} \angle BOD & = \angle CBE + \angle BCD \\ & = \frac{\angle ACB}{2} + \frac{\angle ABC}{2} \\ & = 90^\circ - \frac{\angle A}{2} . \end{align*}
Hence, we must have $\angle BOD = 30^\circ$ , not $150^\circ$ .
Hence, $\angle A = 120^\circ$
This implies $a > b$ and $a >c$ . This contradicts the condition specified for this case.
Therefore, this case is infeasible.
$\textbf{Case 2}$ $c \leq a \leq b$
We extend segment $CB$ to $D$ , such that $BD = c$ .
We extend segment $AC$ to $E$ , such that $CE = a$
In this case, $X$ is the midpoint of $AE$ , and $Y$ is the midpoint of $CD$
Because $M$ and $X$ are the midpoints of $AB$ and $AE$ , respectively, $MX \parallel BE$ .
Because $N$ and $Y$ are the midpoints of $AC$ and $CD$ , respectively, $NY \parallel AD$
Because $CB = CE$ $\angle CBE =\angle CEB = \frac{\angle ACB}{2}$ .
Because $BA = BD$ $\angle BAD = \angle BDA = \frac{\angle ABC}{2}$
Let $O$ be a point of $AC$ , such that $BO \parallel AD$ .
Hence, $\angle OBC = \angle BDA = \frac{B}{2}$
Because $MX \parallel BE$ and $NY \parallel AD$ and $AD \parallel BO$ , the angle formed between lines $MX$ and $NY$ is congruent to $\angle OBE$ . Hence, $\angle OBE = 30^\circ$ or $150^\circ$
We have \begin{align*} \angle OBE & = \angle OBC + \angle CBE \\ & = \frac{\angle ABC}{2} + \frac{\angle ACB}{2} \\ & = 90^\circ - \frac{\angle A}{2} . \end{align*}
Hence, we must have $\angle OBE = 30^\circ$ , not $150^\circ$ .
Hence, $\angle A = 120^\circ$
This implies $a > b$ and $a >c$ . This contradicts the condition specified for this case.
Therefore, this case is infeasible.
$\textbf{Case 3}$ $c \leq b \leq a$
We extend segment $CB$ to $D$ , such that $BD = c$ .
We extend segment $BC$ to $E$ , such that $CE = b$
In this case, $X$ is the midpoint of $BE$ , and $Y$ is the midpoint of $CD$
Because $M$ and $X$ are the midpoints of $AB$ and $BE$ , respectively, $MX \parallel AE$ .
Because $N$ and $Y$ are the midpoints of $AC$ and $CD$ , respectively, $NY \parallel AD$
Because $CA = CE$ $\angle CAE =\angle CEB = \frac{\angle ACB}{2}$ .
Because $BA = BD$ $\angle BAD = \angle BDA = \frac{\angle ABC}{2}$
Because $MX \parallel AE$ and $NY \parallel AD$ , the angle formed between lines $MX$ and $NY$ is congruent to $\angle DAE$ . Hence, $\angle DAE = 30^\circ$ or $150^\circ$
We have \begin{align*} \angle DAE & = \angle BAD + \angle CAE + \angle BAC \\ & = \frac{\angle ABC}{2} + \frac{\angle ACB}{2} + \angle BAC \\ & = 90^\circ + \frac{\angle BAC}{2} . \end{align*}
Hence, we must have $\angle OBE = 150^\circ$ , not $30^\circ$ .
Hence, $\angle BAC = 120^\circ$
In $\triangle ABC$ , by applying the law of cosines, we have \begin{align*} a^2 & = b^2 + c^2 - 2bc \cos \angle BAC\\ & =  b^2 + c^2 - 2bc \cos 120^\circ \\ & = b^2 + c^2 + bc . \end{align*}
Because $a = 219$ , we have \[ b^2 + c^2 + bc  = 219^2 . \]
Now, we find integer solution(s) of this equation with $c \leq b$
Multiplying this equation by 4, we get \[ \left( 2 c + b \right)^2 + 3 b^2 = 438^2 . \hspace{1cm} (1) \]
Denote $d = 2 c + b$ . Because $c \leq b$ $b < d \leq 3 b$
Because $438^2 - 3 b^2 \equiv 0 \pmod{3}$ $d^2 \equiv 0 \pmod{3}$ .
Thus, $d \equiv 0 \pmod{3}$ .
This implies $d^2 \equiv 0 \pmod{9}$
We also have $438^2 \equiv 0 \pmod{9}$ .
Hence, $3 b^2 \equiv 0 \pmod{9}$ .
This implies $b \equiv 0 \pmod{3}$
Denote $b = 3 p$ and $d = 3 q$ . Hence, $p < q \leq 3 p$ .
Hence, Equation (1) can be written as \[ q^2 + 3 p^2 = 146^2 . \hspace{1cm} (2) \]
Now, we solve this equation.
First, we find an upper bound of $q$
We have $q^2 + 3 p^2 \geq q^2 + 3 \left( \frac{q}{3} \right)^2 = \frac{4 q^2}{3}$ .
Hence, $\frac{4 q^2}{3} \leq 146^2$ .
Hence, $q \leq 73 \sqrt{3} < 73 \cdot 1.8 = 131.4$ .
Because $q$ is an integer, we must have $q \leq 131$
Second, we find a lower bound of $q$
We have $q^2 + 3 p^2 < q^2 + 3 q^2 = 4 q^2$ .
Hence, $4 q^2 > 146^2$ .
Hence, $q > 73$ .
Because $q$ is an integer, we must have $q \geq 74$
Now, we find the integer solutions of $p$ and $q$ that satisfy Equation (2) with $74 \leq q \leq 131$
First, modulo 9, \begin{align*} q^2 & \equiv 146^2 - 3 p^2 \\ & \equiv 4 - 3 \cdot ( 0 \mbox{ or } 1 ) \\ & \equiv 4 \mbox{ or } 1 . \end{align*}
Hence $q \equiv \pm 1, \pm 2 \pmod{9}$
Second, modulo 5, \begin{align*} q^2 & \equiv 146^2 - 3 p^2 \\ & \equiv 1 + 2 p^2 \\ & \equiv 1 + 2 \cdot ( 0 \mbox{ or } 1 \mbox{ or } -1 ) \\ & \equiv 1 \mbox{ or } 3 \mbox{ or } - 1 . \end{align*}
Because $q^2 \equiv 0 \mbox{ or } 1 \mbox{ or } - 1$ , we must have $q^2 \equiv 1 \mbox{ or } - 1$ .
Hence, $5 \nmid q$
Third, modulo 7, \begin{align*} q^2 & \equiv 146^2 - 3 p^2 \\ & \equiv 1 - 3 \cdot ( 0 \mbox{ or } 1 \mbox{ or } 5 \mbox{ or } 2 ) \\ & \equiv 1 \mbox{ or } 2 \mbox{ or } 3 \mbox{ or } 5 . \end{align*}
Because $q^2 \equiv 0 \mbox{ or } 1 \mbox{ or } 2 \mbox{ or } 4 \pmod{ 7 }$ , we must have $q^2 \equiv 1 \mbox{ or } 2 \pmod{7}$ .
Hence, $q \equiv 1, 3, 4, 6 \pmod{7}$
Given all conditions above, the possible $q$ are 74, 83, 88, 92, 97, 101, 106, 109, 116, 118, 127.
By testing all these numbers, we find that the only solution is $q = 97$ .
This implies $p = 63$
Hence, $b = 3p = 189$ and $d = 3q = 291$ .
Hence, $c = \frac{d - b}{2} = 51$
Therefore, the perimeter of $\triangle ABC$ is $b + c + a = 189 + 51 + 219 = \boxed{459}$

Answer:  459