Navvye/Olympiad-Problems-CSV huggingface dataset:
Problem: Five towns are connected by a system of roads. There is exactly one road connecting each pair of towns. Find the number of ways there are to make all the roads one-way in such a way that it is still possible to get from any town to any other town using the roads (possibly passing through other towns on the way).

Solution: It is obvious that any configuration of one-way roads which contains a town whose roads all lead into it or lead out of it cannot satisfy the given. We claim that any configuration which does not have a town whose roads all lead into it or lead out of it does satisfy the given conditions. Now we show that a loop of $3$ or more towns exist. Pick a town, then choose a neighboring town to travel to $5$ times. Of these $6$ towns visited, at least two of them must be the same; therefore there must exist a loop of $3$ or more towns because a loop of $2$ towns cannot exist. We want to show that the loop can be reached from any town, and any town can be reached from the loop.
$\textbf{Case 1}$ . The loop has $5$ towns.
Clearly every town can be reached by going around the loop.
$\textbf{Case 2}$ . The loop has $4$ towns.
The town not on the loop must have a road leading to it. This road comes from a town on the loop. Therefore this town can be reached from the loop. This town not on the loop must also have a road leading out of it. This road leads to a town on the loop. Therefore the loop can be reached from the town.
$\textbf{Case 3}$ . The loop has $3$ towns.
There are two towns not on the loop; call them Town $A$ and Town $B$ . Without loss of generality assume $A$ leads to $B$ . Because a road must lead to $A$ , the town where this road comes from must be on the loop. Therefore $A$ and therefore $B$ can be reached from the loop. Because a road must lead out of $B$ , the town it leads to must be on the loop. Therefore the loop can be reached from $B$ and also $A$
The number of good configurations is the total number of configurations minus the number of bad configurations. There are $2^{{5\choose2}}$ total configurations. To find the number of bad configurations in which a town exists such that all roads lead to it, there are $5$ ways to choose this town and $2^6$ ways to assign the six other roads that do not connect to this town. The same logic is used to find the number of bad configurations in which a town exists such that all roads lead out of it. It might be tempting to conclude that there are $5 \cdot 2^6+5 \cdot 2^6$ bad configurations, but the configurations in which there exists a town such that all roads lead to it and a town such that all roads lead out of it are overcounted. There are $5$ ways to choose the town for which all roads lead to it, $4$ ways to choose the town for which all roads lead out of it, and $2^3$ ways to assign the remaining $3$ roads not connected to either of these towns. Therefore, the answer is $2^{{5\choose2}}-(5 \cdot 2^6+5 \cdot 2^6-5\cdot 4 \cdot 2^3)=\boxed{544}$

Answer:  544
Problem: Five towns are connected by a system of roads. There is exactly one road connecting each pair of towns. Find the number of ways there are to make all the roads one-way in such a way that it is still possible to get from any town to any other town using the roads (possibly passing through other towns on the way).

Solution: The only way a town does not meet the conditions in the question is if the town has either all roads leading towards it or all roads leading away from it. For example, if all roads lead away from Town $A$ , there is no way to reach the town starting from Towns $B$ $C$ $D$ , or $E$ . If all roads lead towards Town $A$ , there is no way to reach any other town starting from Town $A$ . Thus, we will count the ways this occurs. (To show this, first note that there must always be a directed path that visits every town once, say $A \rightarrow C \rightarrow B \rightarrow E \rightarrow D.$ (Redei's Theorem). Taking cases, it can be seen that if $A$ does not have all its roads leading, then $E$ must have its roads leading into it.)
$\textbf{Case 1}$ . WLOG, Town $A$ has all roads leading towards it.
In this case, the four roads leading to Town $A$ have already been determined. There are $6$ roads that have not been given directions. Each of these roads have $2$ options: it can lead towards one town or the other town. Thus, there are $2^6$ arrangements of roads.
However, we must consider the $5$ towns in which this scenario can occur: there are $5 \cdot 2^6=320$ arrangements.
$\textbf{Case 2}$ . WLOG, Town $A$ has all roads leading away.
Notice that this case is symmetrical to the first case. Thus, there are $320$ arrangements.
$\textbf{Case 3}$ . WLOG, Town $A$ has all roads leading towards it and Town $B$ has all roads leading away.
We must check for double-counted cases. Drawing a flow diagram, we see that this case determines $7$ roads. For the undetermined $3$ roads, there are $2^3=8$ arrangements. However, we must again consider the different ways that this case can occur. There are $5$ choices for towns with roads leading towards it $4$ choices for roads leading away. Thus, the total double-counted cases are $5 \cdot 4 \cdot 8=160$ arrangements.
We must subtract the cases we counted from the total. There are a total of $10$ roads with $2$ possible arrangements each.
Therefore the total number of cases is $2^{10} =1024$ , and the number of cases that meet the conditions is $1024 - (320+320-160) = \boxed{544}$ arrangements.

Answer:  544
Problem: Five towns are connected by a system of roads. There is exactly one road connecting each pair of towns. Find the number of ways there are to make all the roads one-way in such a way that it is still possible to get from any town to any other town using the roads (possibly passing through other towns on the way).

Solution: Assume the five towns are named A, B, C, D, and E. Draw roads that connect each of the five towns. First, figure out how many total roads there are with no restrictions. This would be $2^{10}$ , or $1024$ . Next, add together the number of restrictions (or incorrect cases) there are. One incorrect case happens if we can't get to one of the five towns. When that happens, any roads that connect that town with any of the other four towns must be one way. Four roads are invalidated (because they are one way) as, assuming we can't get to town A, roads AB, AC, AD, and AE would all be one way. Since there are ${{5\choose1}}$ ways of choosing which town to restrict, there are $5\cdot2^{10-4}$ , or $320$ restrictions in this case. The next case is when we can't get to two of the towns. Let's assume we don't want to get to towns A and B. Then, roads AC, AD, AE, BC, BD, and BE are all invalidated.  Since there are ${{5\choose2}}$ of choosing which two towns to restrict, there are $10\cdot2^{10-6}$ , or $160$ restrictions in this case. Notice that when we restrict three towns, it is the same thing as restricting two towns. For example, if we restricted entry to towns C, D, and E from towns A and B, it's the same thing as if we restricted entry to towns A and B from towns C, D, and E, as the exact same roads are invalidated in both cases. Thus, our final answer is $1024-(320+160) = \boxed{544}$ arrangements.

Answer:  544
Problem: Five towns are connected by a system of roads. There is exactly one road connecting each pair of towns. Find the number of ways there are to make all the roads one-way in such a way that it is still possible to get from any town to any other town using the roads (possibly passing through other towns on the way).

Solution: As noted before, you can see that there are 2 ways that the condition cannot be met; it either has all roads leading into one city, or all roads leading out of one city. We then use complementary counting to count these cases, with PIE. Obviously there are $2^5*2^5$ ways to make roads (just draw a pentagon with all of the diagonals and assume that they are roads, and count the sides and then the diagonals). Then, make all roads leading in to another city. There are 4 roads leading into that city, so there are $2^6$ ways to designate that. Given that there are 5 cities, and it can also be the ways to go out of the city, you get $10*2^6$ ways NOT to get into the city. However, this disregards the case that 2 cities are like this, which is the PIE case. Quick inspection shows that there are no cases where 3 are like that, and inspection with le pentagon can also show you that there are $\binom{5}{2}*2$ (because they can all lead in and all lead out) $*2^3$ (because there are 3 roads left to choose). In the end, this comes out to $2^5*2^5-(10*2^6-2*\binom{5}{2}*2^3)=1024-(640-160)=\boxed{544}$

Answer:  544
Problem: Circle $C_0$ has radius $1$ , and the point $A_0$ is a point on the circle. Circle $C_1$ has radius $r<1$ and is internally tangent to $C_0$ at point $A_0$ . Point $A_1$ lies on circle $C_1$ so that $A_1$ is located $90^{\circ}$ counterclockwise from $A_0$ on $C_1$ . Circle $C_2$ has radius $r^2$ and is internally tangent to $C_1$ at point $A_1$ . In this way a sequence of circles $C_1,C_2,C_3,\ldots$ and a sequence of points on the circles $A_1,A_2,A_3,\ldots$ are constructed, where circle $C_n$ has radius $r^n$ and is internally tangent to circle $C_{n-1}$ at point $A_{n-1}$ , and point $A_n$ lies on $C_n$ $90^{\circ}$ counterclockwise from point $A_{n-1}$ , as shown in the figure below. There is one point $B$ inside all of these circles. When $r = \frac{11}{60}$ , the distance from the center $C_0$ to $B$ is $\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$
[asy] draw(Circle((0,0),125)); draw(Circle((25,0),100)); draw(Circle((25,20),80)); draw(Circle((9,20),64)); dot((125,0)); label("$A_0$",(125,0),E); dot((25,100)); label("$A_1$",(25,100),SE); dot((-55,20)); label("$A_2$",(-55,20),E); [/asy]

Solution: Impose a coordinate system and let the center of $C_0$ be $(0,0)$ and $A_0$ be $(1,0)$ . Therefore $A_1=(1-r,r)$ $A_2=(1-r-r^2,r-r^2)$ $A_3=(1-r-r^2+r^3,r-r^2-r^3)$ $A_4=(1-r-r^2+r^3+r^4,r-r^2-r^3+r^4)$ , and so on, where the signs alternate in groups of $2$ . The limit of all these points is point $B$ . Using the sum of infinite geometric series formula on $B$ and reducing the expression: $(1-r)-(r^2-r^3)+(r^4-r^5)-...=\frac{1-r}{1+r^2}$ $(r-r^2)-(r^3-r^4)+(r^5-r^6)-...=\frac{r-r^2}{1+r^2}$ . Thus, we get $B=\left(\frac{1-r}{r^2+1},\frac{r-r^2}{r^2+1}\right)$ . The distance from $B$ to the origin is $\sqrt{\left(\frac{1-r}{r^2+1}\right)^2+\left(\frac{r-r^2}{r^2+1}\right)^2}=\frac{1-r}{\sqrt{r^2+1}}.$ Let $r=\frac{11}{60}$ , and the distance from the origin is $\frac{49}{61}$ $49+61=\boxed{110}$

Answer:  110
Problem: Circle $C_0$ has radius $1$ , and the point $A_0$ is a point on the circle. Circle $C_1$ has radius $r<1$ and is internally tangent to $C_0$ at point $A_0$ . Point $A_1$ lies on circle $C_1$ so that $A_1$ is located $90^{\circ}$ counterclockwise from $A_0$ on $C_1$ . Circle $C_2$ has radius $r^2$ and is internally tangent to $C_1$ at point $A_1$ . In this way a sequence of circles $C_1,C_2,C_3,\ldots$ and a sequence of points on the circles $A_1,A_2,A_3,\ldots$ are constructed, where circle $C_n$ has radius $r^n$ and is internally tangent to circle $C_{n-1}$ at point $A_{n-1}$ , and point $A_n$ lies on $C_n$ $90^{\circ}$ counterclockwise from point $A_{n-1}$ , as shown in the figure below. There is one point $B$ inside all of these circles. When $r = \frac{11}{60}$ , the distance from the center $C_0$ to $B$ is $\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$
[asy] draw(Circle((0,0),125)); draw(Circle((25,0),100)); draw(Circle((25,20),80)); draw(Circle((9,20),64)); dot((125,0)); label("$A_0$",(125,0),E); dot((25,100)); label("$A_1$",(25,100),SE); dot((-55,20)); label("$A_2$",(-55,20),E); [/asy]

Solution: Let the center of circle $C_i$ be $O_i$ . Note that $O_0BO_1$ is a right triangle, with right angle at $B$ . Also, $O_1B=\frac{11}{60}O_0B$ , or $O_0B = \frac{60}{61}O_0O_1$ . It is clear that $O_0O_1=1-r=\frac{49}{60}$ , so $O_0B=\frac{60}{61}\times\frac{49}{60}=\frac{49}{61}$ . Our answer is $49+61=\boxed{110}$

Answer:  110
Problem: Circle $C_0$ has radius $1$ , and the point $A_0$ is a point on the circle. Circle $C_1$ has radius $r<1$ and is internally tangent to $C_0$ at point $A_0$ . Point $A_1$ lies on circle $C_1$ so that $A_1$ is located $90^{\circ}$ counterclockwise from $A_0$ on $C_1$ . Circle $C_2$ has radius $r^2$ and is internally tangent to $C_1$ at point $A_1$ . In this way a sequence of circles $C_1,C_2,C_3,\ldots$ and a sequence of points on the circles $A_1,A_2,A_3,\ldots$ are constructed, where circle $C_n$ has radius $r^n$ and is internally tangent to circle $C_{n-1}$ at point $A_{n-1}$ , and point $A_n$ lies on $C_n$ $90^{\circ}$ counterclockwise from point $A_{n-1}$ , as shown in the figure below. There is one point $B$ inside all of these circles. When $r = \frac{11}{60}$ , the distance from the center $C_0$ to $B$ is $\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$
[asy] draw(Circle((0,0),125)); draw(Circle((25,0),100)); draw(Circle((25,20),80)); draw(Circle((9,20),64)); dot((125,0)); label("$A_0$",(125,0),E); dot((25,100)); label("$A_1$",(25,100),SE); dot((-55,20)); label("$A_2$",(-55,20),E); [/asy]

Solution: Note that there is an invariance, Consider the entire figure $\mathcal{F}$ . Perform a $90^\circ$ counterclockwise rotation, then scale by $r$ with respect to $(1, 0)$ . It is easy to see that the new figure $\mathcal{F}' \cup S^1 = \mathcal{F}$ , so $B$ is invariant.
Using the invariance, Let $B = (x,y)$ . Then rotating and scaling, $B = (1-r(1+y), rx)$ . Equating, we find $x = \frac{1-r}{r^2+1}, y = \frac{r-r^2}{r^2+1}$ . The distance is thus $\frac{49}{61}$ . Our answer is $49+61=\boxed{110}$

Answer:  110
Problem: Circle $C_0$ has radius $1$ , and the point $A_0$ is a point on the circle. Circle $C_1$ has radius $r<1$ and is internally tangent to $C_0$ at point $A_0$ . Point $A_1$ lies on circle $C_1$ so that $A_1$ is located $90^{\circ}$ counterclockwise from $A_0$ on $C_1$ . Circle $C_2$ has radius $r^2$ and is internally tangent to $C_1$ at point $A_1$ . In this way a sequence of circles $C_1,C_2,C_3,\ldots$ and a sequence of points on the circles $A_1,A_2,A_3,\ldots$ are constructed, where circle $C_n$ has radius $r^n$ and is internally tangent to circle $C_{n-1}$ at point $A_{n-1}$ , and point $A_n$ lies on $C_n$ $90^{\circ}$ counterclockwise from point $A_{n-1}$ , as shown in the figure below. There is one point $B$ inside all of these circles. When $r = \frac{11}{60}$ , the distance from the center $C_0$ to $B$ is $\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$
[asy] draw(Circle((0,0),125)); draw(Circle((25,0),100)); draw(Circle((25,20),80)); draw(Circle((9,20),64)); dot((125,0)); label("$A_0$",(125,0),E); dot((25,100)); label("$A_1$",(25,100),SE); dot((-55,20)); label("$A_2$",(-55,20),E); [/asy]

Solution: Using the invariance again as in Solution 3, assume $B$ is $d$ away from the origin. The locus of possible points is a circle with radius $d$ . Consider the following diagram. [asy] size(7cm); draw(circle((0,0), 49/61)); draw((0,0)--(0.790110185, 0.144853534)); draw((0,0)--(-0.144853534, 0.790110185)); draw((-0.144853534, 0.790110185)--(1,0)); draw((0,0)--(1,0)); draw(rightanglemark((-0.144853534, 0.790110185), (0,0), (0.790110185, 0.144853534), 3));  label("$O$", (0,0), SW); label("$(1,0)$", (1,0), E); label("$B$", (0.790110185, 0.144853534), NE); label("$B'$", (-0.144853534, 0.790110185), N); label("$d$", (0.5 * 49/61, 0), S);  [/asy]
Let the distance from $B$ to $(1,0)$ be $x$ . As $B$ is invariant, $x = r(BB' + x) \implies x = r\frac{d\sqrt{2}}{1-r}$ . Then by Power of a Point, $x(BB' + x) = (1-d)(1+d) \implies xr(BB' + x) = r(1-d)(1+d) \implies x^2 = r(1-d^2) \implies d^2 = \left(1 + \frac{2r}{(1-r)^2}\right)$ . Solving, $d = \frac{49}{61}$ . Our answer is $49+61=\boxed{110}$

Answer:  110
Problem: Circle $C_0$ has radius $1$ , and the point $A_0$ is a point on the circle. Circle $C_1$ has radius $r<1$ and is internally tangent to $C_0$ at point $A_0$ . Point $A_1$ lies on circle $C_1$ so that $A_1$ is located $90^{\circ}$ counterclockwise from $A_0$ on $C_1$ . Circle $C_2$ has radius $r^2$ and is internally tangent to $C_1$ at point $A_1$ . In this way a sequence of circles $C_1,C_2,C_3,\ldots$ and a sequence of points on the circles $A_1,A_2,A_3,\ldots$ are constructed, where circle $C_n$ has radius $r^n$ and is internally tangent to circle $C_{n-1}$ at point $A_{n-1}$ , and point $A_n$ lies on $C_n$ $90^{\circ}$ counterclockwise from point $A_{n-1}$ , as shown in the figure below. There is one point $B$ inside all of these circles. When $r = \frac{11}{60}$ , the distance from the center $C_0$ to $B$ is $\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$
[asy] draw(Circle((0,0),125)); draw(Circle((25,0),100)); draw(Circle((25,20),80)); draw(Circle((9,20),64)); dot((125,0)); label("$A_0$",(125,0),E); dot((25,100)); label("$A_1$",(25,100),SE); dot((-55,20)); label("$A_2$",(-55,20),E); [/asy]

Solution: Let $A_0$ be the origin. Now note that the ratio of lengths of consecutive line segments is constant and equal to $r$ . Now accounting for rotation by $\frac{\pi}{2}$ radians, we see that the common ratio is $ri$ . Thus since our first term is $A_1=-r+ri$ , the total sum (by geometric series formula) is $\frac{-r+ri}{1-ri}=\frac{-781+538i}{3721}$ . We need the distance from $C_0=-1$ so our distance is $|B-C_0|=\sqrt{\left(\frac{-781}{3721}-(-1)\right)^2+\left(\frac{538i}{3721}\right)^2}=\sqrt{\frac{2401}{3721}}=\frac{49}{61}$ . Our answer is $49+61=\boxed{110}$

Answer:  110
Problem: For each integer $n\geq3$ , let $f(n)$ be the number of $3$ -element subsets of the vertices of the regular $n$ -gon that are the vertices of an isosceles triangle (including equilateral triangles). Find the sum of all values of $n$ such that $f(n+1)=f(n)+78$

Solution: Considering $n \pmod{6}$ , we have the following formulas:
$n\equiv 0$ $\frac{n(n-4)}{2} + \frac{n}{3}$
$n\equiv 2, 4$ $\frac{n(n-2)}{2}$
$n\equiv 3$ $\frac{n(n-3)}{2} + \frac{n}{3}$
$n\equiv 1, 5$ $\frac{n(n-1)}{2}$
To derive these formulas, we note the following:
Any isosceles triangle formed by the vertices of our regular $n$ -sided polygon $P$ has its sides from the set of edges and diagonals of $P$ . Notably, as two sides of an isosceles triangle must be equal, it is important to use the property that same-lengthed edges and diagonals come in groups of $n$ , unless $n$ is even when one set of diagonals (those which bisect the polygon) comes in a group of $\frac{n}{2}$ . Three properties hold true of $f(n)$
When $n$ is odd there are $\frac{n(n-1)}{2}$ satisfactory subsets (This can be chosen with $n$ choices for the not-base vertex, and $\frac{n-1}{2}$ for the pair of equal sides as we have $n-1$ edges to choose from, and we must divide by 2 for over-count).*
When $n$ is even there are $\frac{n(n-2)}{2}$ satisfactory subsets (This can be chosen with $n$ choices for the not-base vertex, and $\frac{n-2}{2}$ for the pair of equal sides as we have $n-1$ edges to choose from, one of them which is not satisfactory (the bisecting edge), and we must divide by 2 for over-count).
When $n$ is a multiple of three we additionally over-count equilateral triangles, of which there are $\frac{n}{3}$ . As we count them three times, we are two times over, so we subtract $\frac{2n}{3}$
Considering the six possibilities $n \equiv 0,1,2,3,4,5 \pmod{6}$ and solving, we find that the only valid solutions are $n = 36, 52, 157$ , from which the answer is $36 + 52 + 157 = \boxed{245}$

Answer:  245
Problem: $10\times10\times10$ grid of points consists of all points in space of the form $(i,j,k)$ , where $i$ $j$ , and $k$ are integers between $1$ and $10$ , inclusive. Find the number of different lines that contain exactly $8$ of these points.

Solution: $Case \textrm{ } 1:$ The lines are not parallel to the faces
A line through the point $(a,b,c)$ must contain $(a \pm 1, b \pm 1, c \pm 1)$ on it as well, as otherwise, the line would not pass through more than 5 points. This corresponds to the 4 diagonals of the cube.
We look at the one from $(1,1,1)$ to $(10,10,10)$ . The lower endpoint of the desired lines must contain both a 1 and a 3, so it can be $(1,1,3), (1,2,3), (1,3,3)$ . If $\textrm{min} > 0$ then the point $(a-1,b-1,c-1)$ will also be on the line for example, 3 applies to the other end.
Accounting for permutations, there are $12$ ways, so there are $12 \cdot 4 = 48$ different lines for this case.
$Case \textrm{ } 2:$ The lines where the $x$ $y$ , or $z$ is the same for all the points on the line.
WLOG, let the $x$ value stay the same throughout. Let the line be parallel to the diagonal from $(1,1,1)$ to $(1,10,10)$ . For the line to have 8 points, the $y$ and $z$ must be 1 and 3 in either order, and the $x$ value can be any value from 1 to 10. In addition, this line can be parallel to 6 face diagonals. So we get $2 \cdot 10 \cdot 6 = 120$ possible lines for this case.
The answer is, therefore, $120 + 48 = \boxed{168}$

Answer:  168
Problem: $10\times10\times10$ grid of points consists of all points in space of the form $(i,j,k)$ , where $i$ $j$ , and $k$ are integers between $1$ and $10$ , inclusive. Find the number of different lines that contain exactly $8$ of these points.

Solution: Look at one pair of opposite faces of the cube. There are $4$ lines say $l_1, l_2, l_3, l_4$ with exactly $8$ collinear points on the top face. For each of these lines, draw a rectangular plane that consists of one of the $l_i$ for $1 \leq i \leq 4$ and perpendicular to the top face.
There are $16$ lines in total on this plane. $10$ of which are parallel to one of the edges of the rectangular plane and $6$ of which are diagonals. There are $3$ pairs of opposite faces. So $3 \cdot 4 \cdot 16=192$ lines.
But we are overcounting the lines of the diagonals of those rectangular planes twice. There are $4$ rectangular planes perpendicular to one pair of opposite faces. Thus $4 \cdot 6=24$ lines are overcounted.
So the answer is $192-24=\boxed{168}$

Answer:  168
Problem: $10\times10\times10$ grid of points consists of all points in space of the form $(i,j,k)$ , where $i$ $j$ , and $k$ are integers between $1$ and $10$ , inclusive. Find the number of different lines that contain exactly $8$ of these points.

Solution: Considered the cases $(1, 2, ..., 8), (2, 3, ...,9), (3, 4, ..., 10)$ and reverse. Also, consider the constant subsequences of length 8 $(1, 1, ..., 1), (2, 2, ..., 2), ..., (10, 10, ..., 10)$ . Of all the triplets that work they cannot be extended to form another point on the line in the $10 \times 10 \times 10$ grid but  we need to divide by 2 because reversing all the subsequences gives the same line. Thus the answer is \[\frac{16^3 - 14^3 - 14^3 + 12^3}{2} = \boxed{168}\]

Answer:  168