In triangle $A B C$, the lengths of two sides are given: $A B=6, B C=16$. Additionally, it is known that the center of the circle passing through vertex $B$ and the midpoints of sides $A B$ and $A C$ lies on the bisector of angle $C$. Find $A C$.
Let $N$ and $M$ be the midpoints of sides $AB$ and $AC$ of triangle $ABC$, $O$ be the center of the circle passing through points $B$, $N$, and $M$, and $K$ be the point of intersection of this circle with side $BC$ other than $B$.

Since $MN$ is the midline of triangle $ABC$, chords $MN$ and $BK$ are parallel, therefore

$MK = NB = \frac{1}{2} AB = 3$. Note that $AC \neq BC$, otherwise the angle bisector of angle $C$ would lie on the perpendicular bisector of side $AB$ of triangle $ABC$, which is impossible since the point $O$ lying on this bisector belongs to the perpendicular bisector of segment $BN$, and the perpendicular bisectors of segments $AB$ and $BN$ are parallel. In triangles $OMC$ and $OKC$, it is known that $\angle OCM = \angle OCK$, $OM = OK$, and side $OC$ is common. Similarly for triangles $OMC$ and $OBC$. Therefore, triangle $OMC$ is congruent to either triangle $OKC$ or triangle $OBC$.

Consider the case when triangle $OMC$ is congruent to triangle $OKC$. Let $MC = CK = x$, $\angle C = \gamma$. From triangles $CKM$ and $ABC$ using the cosine rule, we find that

$\cos \gamma = \cos \angle MCK = \frac{MK^2 + CK^2 - MK^2}{2MC \cdot CK} = \frac{2x^2 - 9}{2x^2}$,

$\cos \gamma = \cos \angle C = \frac{AC^2 + CB^2 - AB^2}{2AC \cdot CB} = \frac{4x^2 + 220}{64x} = \frac{x^2 + 55}{16x}$.

Thus, $16x(2x^2 - 9) = 2x(x^2 + 55) \Leftrightarrow x^3 - 16x^2 + 55x + 72 = 0 \Leftrightarrow (x + 1)(x - 9)(x - 8) = 0$.

Clearly, $x$ cannot be negative. If $x = 8$, then $AC = 2x = 16 = BC$, which is impossible. Therefore, $x = 9$ and $AC = 2x = 18$.

Now suppose triangle $OMC$ is congruent to triangle $OBC$. Then $MC = BC = 16$, so $AC = 2MC = 32$, which is impossible since in this case

$AB + BC = 6 + 16 < 32 = AC$.

## Answer

18