Navvye/Olympiad-Problems-CSV huggingface dataset:
Problem: In a group of nine people each person shakes hands with exactly two of the other people from the group. Let $N$ be the number of ways this handshaking can occur. Consider two handshaking arrangements different if and only if at least two people who shake hands under one arrangement do not shake hands under the other arrangement. Find the remainder when $N$ is divided by $1000$

Solution: Let $f_N$ be the number of ways a group of $N$ people can shake hands with exactly two of the other people from the group, where $N \ge 3$
We can easily find that $f_3=1$
Continuing on, we will label the people as $A$ $B$ $C$ ,... corresponding with $N$
$f_4$ : There are $\dbinom{3}{2}=3$ possible ways for person $A$ to shake hands with two others (WLOG assume $A$ shakes hands with $B$ and $C$ ), and there is only one possible outcome thereon ( $B$ and $C$ both shakes hands with $D$ ).
Therefore, we can conclude that $f_4=3$
$f_5$ : There are $\dbinom{4}{2}=6$ possible ways for person $A$ to shake hands with two others (WLOG assume they are $B$ and $C$ ). Then, $B$ and $C$ must also shake hands with the remaining two people ( $2$ ways), and those last $2$ people must shake hands with each other ( $1$ way).
Therefore, $f_5=\dbinom{4}{2}\ast(2)\ast(1)=12$
$f_6$ : There are $\dbinom{5}{2}=10$ possible ways for person $A$ to shake hands with two others (WLOG assume they are $B$ and $C$ ). However, $B$ and $C$ shake hands with each other, then there are $f_3$ ways for the rest of the people to shake hands. If $B$ and $C$ shake hands with two others out of the three remaining people (3 $\ast$ 2 ways), those $2$ people must shake hands with the last person ( $1$ way).
Therefore, $f_5=\dbinom{5}{2}\ast(f_3)+3\ast(2)\ast(1)=70$
Now we have enough information to find $f_9$
$f_9$ : There are $\dbinom{8}{2}=28$ possible ways for person $A$ to shake hands with two others (WLOG assume they are $B$ and $C$ ).
Case 1: $B$ and $C$ shake hands with each other
There are $f_6$ ways for $D$ $E$ $F$ $G$ $H$ , and $I$ to shake hands
Case 2: $B$ and $C$ shake hands with one of the others out of the $6$ remaining people ( $6$ ways)
There are $f_5$ ways for $E$ $F$ $G$ $H$ , and $I$ to shake hands
Case 3: If $B$ and $C$ shake hands with two different people (there are 6 $\ast$ 5 ways to choose the people but WLOG assume they are $D$ and $E$ ). Calculations of Case 3 are in its subcases.
Subcase 3.1: $D$ and $E$ shake hands with each other
There are $f_4$ ways for $F$ $G$ $H$ , and $I$ to shake hands
Subcase 3.2: $D$ and $E$ each shake hands with one other person (there are $4$ ways to choose the person, WLOG let that be $F$ )
There are $f_3$ ways for $G$ $H$ , and $I$ to shake hands
Subcase 3.3: $D$ and $E$ each shake hands with two different people (there are 4 $\ast$ 3 ways, WLOG let that be $F$ and $G$ )
There are $2\ast1$ ways for $F$ and $G$ to then shake hands with $H$ and $I$ , and $H$ and $I$ will shake hands with each other.
We have
\begin{align*} 28(f_6+6\ast(f_5)+6\ast(5)\ast(f_4)+4\ast(f_3)+4\ast(3)\ast(2)\ast(1) &= 28(70+6\ast(12)+6\ast(5)\ast(3+4\ast(1)+4\ast(3)\ast(2)\ast(1) \\ &= 30016 \end{align*}
which gives us the answer of $\boxed{016}$

Answer:  016
Problem: Triangle $ABC$ is inscribed in circle $\omega$ with $AB=5$ $BC=7$ , and $AC=3$ . The bisector of angle $A$ meets side $\overline{BC}$ at $D$ and circle $\omega$ at a second point $E$ . Let $\gamma$ be the circle with diameter $\overline{DE}$ . Circles $\omega$ and $\gamma$ meet at $E$ and a second point $F$ . Then $AF^2 = \frac mn$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: Take a force-overlaid inversion about $A$ and note $D$ and $E$ map to each other. As $DE$ was originally the diameter of $\gamma$ $DE$ is still the diameter of $\gamma$ . Thus $\gamma$ is preserved. Note that the midpoint $M$ of $BC$ lies on $\gamma$ , and $BC$ and $\omega$ are swapped. Thus points $F$ and $M$ map to each other, and are isogonal. It follows that $AF$ is a symmedian of $\triangle{ABC}$ , or that $ABFC$ is harmonic. Then $(AB)(FC)=(BF)(CA)$ , and thus we can let $BF=5x, CF=3x$ for some $x$ . By the LoC, it is easy to see $\angle{BAC}=120^\circ$ so $(5x)^2+(3x)^2-2\cos{60^\circ}(5x)(3x)=49$ . Solving gives $x^2=\frac{49}{19}$ , from which by Ptolemy's we see $AF=\frac{30}{\sqrt{19}}$ . We conclude the answer is $900+19=\boxed{919}$

Answer:  919
Problem: Triangle $ABC$ is inscribed in circle $\omega$ with $AB=5$ $BC=7$ , and $AC=3$ . The bisector of angle $A$ meets side $\overline{BC}$ at $D$ and circle $\omega$ at a second point $E$ . Let $\gamma$ be the circle with diameter $\overline{DE}$ . Circles $\omega$ and $\gamma$ meet at $E$ and a second point $F$ . Then $AF^2 = \frac mn$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: Use the angle bisector theorem to find $CD=\tfrac{21}{8}$ $BD=\tfrac{35}{8}$ , and use Stewart's Theorem to find $AD=\tfrac{15}{8}$ . Use Power of Point $D$ to find $DE=\tfrac{49}{8}$ , and so $AE=8$ . Use law of cosines to find $\angle CAD = \tfrac{\pi} {3}$ , hence $\angle BAD = \tfrac{\pi}{3}$ as well, and $\triangle BCE$ is equilateral, so $BC=CE=BE=7$ [asy] size(150); defaultpen(fontsize(9pt)); picture pic; pair A,B,C,D,E,F,W; B=MP("B",origin,dir(180)); C=MP("C",(7,0),dir(0)); A=MP("A",IP(CR(B,5),CR(C,3)),N); D=MP("D",extension(B,C,A,bisectorpoint(C,A,B)),dir(220)); path omega=circumcircle(A,B,C);  E=MP("E",OP(omega,A--(A+20*(D-A))),S); path gamma=CR(midpoint(D--E),length(D-E)/2); F=MP("F",OP(omega,gamma),SE); draw(omega^^A--B--C--cycle^^gamma); draw(pic, A--E--F--cycle, gray); add(pic);  dot("$W$",circumcenter(A,B,C),dir(180)); label("$\gamma$",gamma,dir(180)); [/asy] In triangle $AEF$ , let $X$ be the foot of the altitude from $A$ ; then $EF=EX+XF$ , where we use signed lengths. Writing $EX=AE \cdot \cos \angle AEF$ and $XF=AF \cdot \cos \angle AFE$ , we get \begin{align}\tag{1}     EF = AE \cdot \cos \angle AEF + AF \cdot \cos \angle AFE. \end{align} Note $\angle AFE = \angle ACE$ , and the Law of Cosines in $\triangle ACE$ gives $\cos \angle ACE = -\tfrac 17$ . 
Also, $\angle AEF = \angle DEF$ , and $\angle DFE = \tfrac{\pi}{2}$ $DE$ is a diameter), so $\cos \angle AEF = \tfrac{EF}{DE} =  \tfrac{8}{49}\cdot EF$
Plugging in all our values into equation $(1)$ , we get: \[EF = \tfrac{64}{49} EF -\tfrac{1}{7} AF \quad \Longrightarrow \quad EF = \tfrac{7}{15} AF.\] The Law of Cosines in $\triangle AEF$ , with $EF=\tfrac 7{15}AF$ and $\cos\angle AFE = -\tfrac 17$ gives \[8^2 = AF^2 + \tfrac{49}{225}  AF^2 + \tfrac 2{15} AF^2 = \tfrac{225+49+30}{225}\cdot AF^2\] Thus $AF^2 = \frac{900}{19}$ . The answer is $\boxed{919}$

Answer:  919
Problem: Triangle $ABC$ is inscribed in circle $\omega$ with $AB=5$ $BC=7$ , and $AC=3$ . The bisector of angle $A$ meets side $\overline{BC}$ at $D$ and circle $\omega$ at a second point $E$ . Let $\gamma$ be the circle with diameter $\overline{DE}$ . Circles $\omega$ and $\gamma$ meet at $E$ and a second point $F$ . Then $AF^2 = \frac mn$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: Let $a = BC$ $b = CA$ $c = AB$ for convenience. Let $M$ be the midpoint of segment $BC$ . We claim that $\angle MAD=\angle DAF$
$\textit{Proof}$ . Since $AE$ is the angle bisector, it follows that $EB = EC$ and consequently $EM\perp BC$ . Therefore, $M\in \gamma$ . Now let $X = FD\cap \omega$ . Since $\angle EFX=90^\circ$ $EX$ is a diameter, so $X$ lies on the perpendicular bisector of $BC$ ; hence $E$ $M$ $X$ are collinear. From $\angle DAG = \angle DMX = 90^\circ$ , quadrilateral $ADMX$ is cyclic. Therefore, $\angle MAD = \angle MXD$ . But $\angle MXD$ and $\angle EAF$ are both subtended by arc $EF$ in $\omega$ , so they are equal. Thus $\angle MAD=\angle DAF$ , as claimed. [asy] size(175); defaultpen(fontsize(10pt)); picture pic; pair A,B,C,D,E,F,W; B=MP("B",origin,dir(180)); C=MP("C",(7,0),dir(0)); A=MP("A",IP(CR(B,5),CR(C,3)),N); D=MP("D",extension(B,C,A,bisectorpoint(C,A,B)),dir(220)); path omega=circumcircle(A,B,C);  E=MP("E",OP(omega,A--(A+20*(D-A))),S); path gamma=CR(midpoint(D--E),length(D-E)/2); F=MP("F",OP(omega,gamma),SE); pair X=MP("X",IP(omega,F--(F+2*(D-F))),N); pair M=MP("M",midpoint(B--C),dir(220));   draw(omega^^A--B--C--cycle^^gamma); draw(A--E--F--cycle, gray); draw(E--X--F, gray); draw(pic, A--M--C--cycle^^A--B--F--cycle); draw(A--M, royalblue);  dot("$W$",circumcenter(A,B,C),dir(180)); dot(circumcenter(D,E,F)); label("$\gamma$",gamma,dir(180));  draw(A--B--F--cycle, black+1); [/asy] As a result, $\angle CAM = \angle FAB$ . Combined with $\angle BFA=\angle MCA$ , we get $\triangle ABF\sim\triangle AMC$ and therefore \[\frac c{AM}=\frac {AF}b\qquad \Longrightarrow \qquad AF^2=\frac{b^2c^2}{AM^2} = \frac{15^2}{AM^2}\] By Stewart's Theorem on $\triangle ABC$ (with cevian $AM$ ), we get \[AM^2 = \tfrac 12 (b^2+c^2)-\tfrac 14 a^2 = \tfrac{19}{4},\] so $AF^2 = \tfrac{900}{19}$ , so the answer is $900+19=\boxed{919}$

Answer:  919
Problem: Triangle $ABC$ is inscribed in circle $\omega$ with $AB=5$ $BC=7$ , and $AC=3$ . The bisector of angle $A$ meets side $\overline{BC}$ at $D$ and circle $\omega$ at a second point $E$ . Let $\gamma$ be the circle with diameter $\overline{DE}$ . Circles $\omega$ and $\gamma$ meet at $E$ and a second point $F$ . Then $AF^2 = \frac mn$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: Use the angle bisector theorem to find $CD=\tfrac{21}{8}$ $BD=\tfrac{35}{8}$ , and use Stewart's Theorem to find $AD=\tfrac{15}{8}$ . Use Power of Point $D$ to find $DE=\tfrac{49}{8}$ , and so $AE=8$ . Then use the Extended Law of Sine to find that the length of the circumradius of $\triangle ABC$ is $\tfrac{7\sqrt{3}}{3}$ [asy] size(175); defaultpen(fontsize(9pt)); pair A,B,C,D,E,F,W; B=MP("B",origin,dir(180)); C=MP("C",(7,0),dir(0)); A=MP("A",IP(CR(B,5),CR(C,3)),N); D=MP("D",extension(B,C,A,bisectorpoint(C,A,B)),dir(220)); path omega=circumcircle(A,B,C);  E=MP("E",OP(omega,A--(A+20*(D-A))),S); path gamma=CR(midpoint(D--E),length(D-E)/2); F=MP("F",OP(omega,gamma),SE); pair X=MP("X",IP(omega,F--(F+2*(D-F))),N);   draw(omega^^A--B--C--cycle^^gamma); draw(A--E--F--cycle, gray); draw(E--X--F, royalblue);  dot("$W$",circumcenter(A,B,C),dir(180)); dot(circumcenter(D,E,F)); label("$\gamma$",gamma,dir(180)); label("$u$",X--D,dir(60)); label("$v$",D--F,dir(70)); [/asy] Since $DE$ is the diameter of circle $\gamma$ $\angle DFE$ is $90^\circ$ . Extending $DF$ to intersect circle $\omega$ at $X$ , we find that $XE$ is the diameter of $\omega$ (since $\angle DFE$ is $90^\circ$ ). Therefore, $XE=\tfrac{14\sqrt{3}}{3}$
Let $EF=x$ $XD=u$ , and $DF=v$ . Then $XE^2-XF^2=EF^2=DE^2-DF^2$ , so we get \[(u+v)^2-v^2=\frac{196}{3}-\frac{2401}{64}\] which simplifies to \[u^2+2uv = \frac{5341}{192}.\] By Power of Point $D$ $uv=BD \cdot DC=735/64$ . Combining with above, we get \[XD^2=u^2=\frac{931}{192}.\] Note that $\triangle XDE\sim \triangle ADF$ and the ratio of similarity is $\rho = AD : XD = \tfrac{15}{8}:u$ . Then $AF=\rho\cdot XE = \tfrac{15}{8u}\cdot R$ and \[AF^2 = \frac{225}{64}\cdot \frac{R^2}{u^2} = \frac{900}{19}.\] The answer is $900+19=\boxed{919}$

Answer:  919
Problem: Triangle $ABC$ is inscribed in circle $\omega$ with $AB=5$ $BC=7$ , and $AC=3$ . The bisector of angle $A$ meets side $\overline{BC}$ at $D$ and circle $\omega$ at a second point $E$ . Let $\gamma$ be the circle with diameter $\overline{DE}$ . Circles $\omega$ and $\gamma$ meet at $E$ and a second point $F$ . Then $AF^2 = \frac mn$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: Denote $AB = c, BC = a, AC = b, \angle A = 2 \alpha.$ Let M be midpoint BC. Let $\theta$ be the circle centered at $A$ with radius $\sqrt{AB \cdot AC} =\sqrt{bc}.$
We calculate the length of some segments.
The median $AM = \sqrt{\frac {b^2}{2} + \frac {c^2}{2} -  \frac {a^2}{4}}.$ The bisector $AD = \frac {2 b c \cos \alpha}{b+c}.$ One can use Stewart's Theorem in both cases.
$AD$ is bisector of $\angle A \implies BD = \frac {a c}{b + c}, CD = \frac {a b}{b + c} \implies$ \[BD \cdot CD = \frac {a^2 bc }{(b+c)^2}.\] We use Power of Point $D$ and get $AD \cdot DE = BD \cdot CD.$ \[AE = AD + DE = AD + \frac {BD \cdot CD}{AD},\] \[AE =\frac {2 b c \cos \alpha}{b+c} + \frac {a^2 bc \cdot (b+c) }{(b+c)^2 \cdot 2 b c \cos \alpha} =\] \[=  \frac {b c \cos^2 \alpha + a^2}{2(b+c)\cos \alpha} =\frac {4bc \cos^2 \alpha  + b^2 +c^2 -2 b c \cos 2\alpha}{2(b+c) \cos \alpha} = \frac {b+c}{2} \implies AD \cdot AE = 2 bc \cos \alpha.\] We consider the inversion with respect $\theta.$
$B$ swap $B' \implies AB' = AC, B'  \in AB \implies B'$ is symmetric to $C$ with respect to $AE.$
$C$ swap $C' \implies AC' = AB, C'$ lies on line $AC \implies C'$ is symmetric to $B$ with respect to $AE.$
$BC^2 = AB^2 + AC^2 + AB \cdot BC \implies \alpha = 60^\circ \implies AD \cdot AE = bc \implies D$ swap $E.$
Points $D$ and $E$ lies on $\Gamma \implies \Gamma$ swap $\Gamma.$
$DE$ is diameter $\Gamma, \angle DME = 90^\circ \implies  M \in \Gamma.$ Therefore $M$ is crosspoint of $BC$ and $\Gamma.$
Let $\Omega$ be circumcircle $AB'C'.  \Omega$ is image of line $BC.$ Point $M$ maps into $M' \implies M' = \Gamma \cap \Omega.$
Points $A, B',$ and $C'$ are symmetric to $A, C,$ and $B,$ respectively.
Point $M'$ lies on $\Gamma$ which is symmetric with respect to $AE$ and on $\Omega$ which is symmetric to $\omega$ with respect to $AE  \implies$
$M'$ is symmetric $F$ with respect to $AE \implies AM' = AF.$
We use Power of Point $A$ and get \[AF = AM' = \frac {AD \cdot AE}{AM} = \frac {4b c}{\sqrt{2 b^2 + 2 c^2 – a^2}} = \frac {4 \cdot 3 \cdot 5}{\sqrt{ 50 + 18 – 49}} = \frac {30}{\sqrt{19}} \implies \boxed{919}.\]

Answer:  919
Problem: Jar A contains four liters of a solution that is 45% acid.  Jar B contains five liters of a solution that is 48% acid.  Jar C contains one liter of a solution that is $k\%$ acid.  From jar C, $\frac{m}{n}$ liters of the solution is added to jar A, and the remainder of the solution in jar C is added to jar B.  At the end both jar A and jar B contain solutions that are 50% acid.  Given that $m$ and $n$ are relatively prime positive integers, find $k + m + n$

Solution: Jar A contains $\frac{11}{5}$ liters of water, and $\frac{9}{5}$ liters of acid; jar B contains $\frac{13}{5}$ liters of water and $\frac{12}{5}$ liters of acid.
The gap between the amount of water and acid in the first jar, $\frac{2}{5}$ , is double that of the gap in the second jar, $\frac{1}{5}$ . Therefore, we must add twice as much of jar C into the jar $A$ over jar $B$ . So, we must add $\frac{2}{3}$ of jar C into jar $A$ , so $m = 2, n=3$
Since jar C contains $1$ liter of solution, we are adding $\frac{2}{3}$ of a liter of solution to jar $A$ . In order to close the gap between water and acid, there must be $\frac{2}{5}$ more liters of acid than liters of water in these $\frac{2}{3}$ liters of solution. So, in the $\frac{2}{3}$ liters of solution, there are $\frac{2}{15}$ liters of water, and $\frac{8}{15}$ liters of acid.  So, 80% of the $\frac{2}{3}$ sample is acid, so overall, in jar C, 80% of the sample is acid.
Therefore, our answer is $80 + 2 + 3 = \boxed{85}$

Answer:  85
Problem: Jar A contains four liters of a solution that is 45% acid.  Jar B contains five liters of a solution that is 48% acid.  Jar C contains one liter of a solution that is $k\%$ acid.  From jar C, $\frac{m}{n}$ liters of the solution is added to jar A, and the remainder of the solution in jar C is added to jar B.  At the end both jar A and jar B contain solutions that are 50% acid.  Given that $m$ and $n$ are relatively prime positive integers, find $k + m + n$

Solution: There are $\frac{45}{100}(4)=\frac{9}{5}$ L of acid in Jar A. There are $\frac{48}{100}(5)=\frac{12}{5}$ L of acid in Jar B. And there are $\frac{k}{100}$ L of acid in Jar C. After transferring the solutions from jar C, there will be $4+\frac{m}{n}$ L of solution in Jar A and $\frac{9}{5}+\frac{k}{100}\cdot\frac{m}{n}$ L of acid in Jar A. $6-\frac{m}{n}$ L of solution in Jar B and $\frac{12}{5}+\frac{k}{100}\cdot \left(1-\frac{m}{n}\right)=\frac{12}{5}+\frac{k}{100}-\frac{mk}{100n}$ of acid in Jar B. Since the solutions are 50% acid, we can multiply the amount of acid for each jar by 2, then equate them to the amount of solution. \[\frac{18}{5}+\frac{km}{50n}=4+\frac{m}{n}\] \[\frac{24}{5}-\frac{km}{50n}+\frac{k}{50}=6-\frac{m}{n}\] Add the equations to get \[\frac{42}{5}+\frac{k}{50}=10\] Solving gives $k=80$ If we substitute back in the original equation we get $\frac{m}{n}=\frac{2}{3}$ so $3m=2n$ . Since $m$ and $n$ are relatively prime, $m=2$ and $n=3$ . Thus $k+m+n=80+2+3=\boxed{085}$

Answer:  085
Problem: Jar A contains four liters of a solution that is 45% acid.  Jar B contains five liters of a solution that is 48% acid.  Jar C contains one liter of a solution that is $k\%$ acid.  From jar C, $\frac{m}{n}$ liters of the solution is added to jar A, and the remainder of the solution in jar C is added to jar B.  At the end both jar A and jar B contain solutions that are 50% acid.  Given that $m$ and $n$ are relatively prime positive integers, find $k + m + n$

Solution: One might cleverly change the content of both Jars.
Since the end result of both Jars are $50\%$ acid, we can turn Jar A into a 1 gallon liquid with $50\%-4(5\%) = 30\%$ acid
and Jar B into 1 gallon liquid with $50\%-5(2\%) =40\%$ acid.
Now, since Jar A and Jar B contain the same amount of liquid, twice as much liquid will be pour into Jar A than Jar B, so $\dfrac{2}{3}$ of Jar C will be pour into Jar A.
Thus, $m=2$ and $n=3$
$\dfrac{30\% + \frac{2}{3} \cdot k\%}{\frac{5}{3}} = 50\%$
Solving for $k$ yields $k=80$
So the answer is $80+2+3 = \boxed{085}$

Answer:  085
Problem: Jar A contains four liters of a solution that is 45% acid.  Jar B contains five liters of a solution that is 48% acid.  Jar C contains one liter of a solution that is $k\%$ acid.  From jar C, $\frac{m}{n}$ liters of the solution is added to jar A, and the remainder of the solution in jar C is added to jar B.  At the end both jar A and jar B contain solutions that are 50% acid.  Given that $m$ and $n$ are relatively prime positive integers, find $k + m + n$

Solution: One may first combine all three jars in to a single container.  That container will have $10$ liters of liquid, and it should be $50\%$ acidic.  Thus there must be $5$ liters of acid.
Jar A contained $45\% \cdot 4L$ , or $1.8L$ of acid, and jar B $48\% \cdot 5L$ or $2.4L$ .  Solving for the amount of acid in jar C, $k = (5 - 2.4 - 1.8) = .8$ , or $80\%$
Once one knowss that the jar C is $80\%$ acid, use solution 1 to figure out m and n for $k+m+n=80+2+3=\boxed{085}$

Answer:  085
Problem: In rectangle $ABCD$ $AB = 12$ and $BC = 10$ .  Points $E$ and $F$ lie inside rectangle $ABCD$ so that $BE = 9$ $DF = 8$ $\overline{BE} \parallel \overline{DF}$ $\overline{EF} \parallel \overline{AB}$ , and line $BE$ intersects segment $\overline{AD}$ .  The length $EF$ can be expressed in the form $m \sqrt{n} - p$ , where $m$ $n$ , and $p$ are positive integers and $n$ is not divisible by the square of any prime.  Find $m + n + p$

Solution: Let us call the point where $\overline{EF}$ intersects $\overline{AD}$ point $G$ , and the point where $\overline{EF}$ intersects $\overline{BC}$ point $H$ . Since angles $FHB$ and $EGA$ are both right angles, and angles $BEF$ and $DFE$ are congruent due to parallelism, right triangles $BHE$ and $DGF$ are similar. This implies that $\frac{BH}{GD} = \frac{9}{8}$ . Since $BC=10$ $BH+GD=BH+HC=BC=10$ . ( $HC$ is the same as $GD$ because they are opposite sides of a rectangle.) Now, we have a system:
$\frac{BH}{GD}=\frac{9}8$
$BH+GD=10$
Solving this system (easiest by substitution), we get that:
$BH=\frac{90}{17}$
$GD=\frac{80}{17}$
Using the Pythagorean Theorem, we can solve for the remaining sides of the two right triangles:
$\sqrt{9^2-\left(\frac{90}{17}\right)^2}$ and $\sqrt{8^2-\left(\frac{80}{17}\right)^2}$
Notice that adding these two sides would give us twelve plus the overlap $EF$ . This means that:
$EF= \sqrt{9^2-\left(\frac{90}{17}\right)^2}+\sqrt{8^2-\left(\frac{80}{17}\right)^2}-12=3\sqrt{21}-12$
Since $21$ isn't divisible by any perfect square, our answer is:
$3+21+12=\boxed{36}$

Answer:  36
Problem: In rectangle $ABCD$ $AB = 12$ and $BC = 10$ .  Points $E$ and $F$ lie inside rectangle $ABCD$ so that $BE = 9$ $DF = 8$ $\overline{BE} \parallel \overline{DF}$ $\overline{EF} \parallel \overline{AB}$ , and line $BE$ intersects segment $\overline{AD}$ .  The length $EF$ can be expressed in the form $m \sqrt{n} - p$ , where $m$ $n$ , and $p$ are positive integers and $n$ is not divisible by the square of any prime.  Find $m + n + p$

Solution: Extend lines $BE$ and $CD$ to meet at point $G$ .
Draw the altitude $GH$ from point $G$ to line $BA$ extended.
$GE=DF=8,$ $GB=17$
In right $\bigtriangleup GHB$ $GH=10$ $GB=17$ , thus by Pythagoras Theorem we have: $HB=\sqrt{17^2-10^2}=3\sqrt{21}$
$HA=EF=3\sqrt{21}-12$
Thus our answer is: $3+21+12=\boxed{36}$

Answer:  36
Problem: In rectangle $ABCD$ $AB = 12$ and $BC = 10$ .  Points $E$ and $F$ lie inside rectangle $ABCD$ so that $BE = 9$ $DF = 8$ $\overline{BE} \parallel \overline{DF}$ $\overline{EF} \parallel \overline{AB}$ , and line $BE$ intersects segment $\overline{AD}$ .  The length $EF$ can be expressed in the form $m \sqrt{n} - p$ , where $m$ $n$ , and $p$ are positive integers and $n$ is not divisible by the square of any prime.  Find $m + n + p$

Solution: We notice that since $\overline{BE}||\overline{DF}$ $\overline{EF}$ is the diagonal of a rectangle. Now, let us extend the width lines to intersect with $\overline{BE}$ and $\overline{DF}$ , respectively, to form this rectangle. Let us call the length of $\overline{EF}$ $d$ , the perpendicular distance between $\overline{EF}$ and $\overline{AD}$ $k$ , and the perpendicular distance between $\overline{EF}$ and $\overline{CD}$ $x$ . We now can begin the similar triangles. When drawing the diagram (where $E$ is closer to $\overline{AD}$ than $F$ ), we put the similar right triangles in the same position so that we can begin solving for our variables and finding ratios. Since all of these triangles are similar, we find that $\frac{dx}{8}=\frac{10d-dx}{9}$ , which solves for $x=\frac{80}{17}$ . Completing the same thing for $k$ , we see $\frac{12d-dk}{9}=\frac{dk+d^2}{8}$ , which solves for $k=\frac{96-9d}{17}$ . We are now ready to find both the length and the width of the rectangle. We find these to be $\frac{10d}{17}$ and $\frac{12d+d^2}{17}$ . Now let us use the Pythagorean to solve for $d$ . We square the length and the width and multiply both sides by 289 (the denominator of the LHS) to reach the equation $(12+d^2)^2+100d^2=289d^2$ . Expanding and simplifying, we find that $d^4+24d^3=45d^2$ . Dividing both sides by $d^2$ and moving everything to the LHS, we see that $d^2+24d-45=0$ . Applying the quadratic formula, $d=\frac{-24\pm \sqrt{756}}{2}=-12\pm \sqrt{189}$ . Since $d>0$ $d=\sqrt{189}-12=3\sqrt{21}-12$ . Finally, $m+n+p=3+21+12=\boxed{036}$ . -Gideontz

Answer:  036