Refactor imo_2025.json: Consolidate problem statements and remove markdown files for problems 1-6
Browse files- .gitignore +1 -0
- convert.py +49 -0
- imo_2025.json +1 -32
- markdown/{p1 → 2025/p1}/problem.md +0 -0
- markdown/{p2 → 2025/p2}/problem.md +0 -0
- markdown/{p3 → 2025/p3}/problem.md +0 -0
- markdown/{p4 → 2025/p4}/problem.md +0 -0
- markdown/{p5 → 2025/p5}/problem.md +0 -0
- markdown/{p6 → 2025/p6}/problem.md +0 -0
- requirements.txt +1 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.venv/
|
convert.py
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pathlib import Path
|
2 |
+
from pydantic import BaseModel
|
3 |
+
import json
|
4 |
+
|
5 |
+
MARKDOWN_DIR = Path("markdown")
|
6 |
+
|
7 |
+
class Problem(BaseModel):
|
8 |
+
year: str
|
9 |
+
problem_id: str
|
10 |
+
problem: str
|
11 |
+
solution: str | None
|
12 |
+
|
13 |
+
def to_dict(self):
|
14 |
+
return {
|
15 |
+
"id": f"{self.year}_imo_{self.problem_id}",
|
16 |
+
"problem": self.problem,
|
17 |
+
"solution": self.solution
|
18 |
+
}
|
19 |
+
|
20 |
+
def get_problem(year: str, problem_id: str, problem_dir: Path):
|
21 |
+
problem_file = problem_dir / "problem.md"
|
22 |
+
solution_file = problem_dir / "solution.md"
|
23 |
+
with open(problem_file, "r", encoding="utf-8") as f:
|
24 |
+
problem = f.read()
|
25 |
+
if solution_file.exists():
|
26 |
+
with open(solution_file, "r", encoding="utf-8") as f:
|
27 |
+
solution = f.read()
|
28 |
+
else:
|
29 |
+
solution = None
|
30 |
+
return Problem(year=year, problem_id=problem_id, problem=problem, solution=solution)
|
31 |
+
|
32 |
+
def convert_problems():
|
33 |
+
result = []
|
34 |
+
for year_dir in MARKDOWN_DIR.iterdir():
|
35 |
+
if not year_dir.is_dir():
|
36 |
+
continue
|
37 |
+
year = year_dir.name
|
38 |
+
for problem_dir in year_dir.iterdir():
|
39 |
+
if not problem_dir.is_dir():
|
40 |
+
continue
|
41 |
+
problem_number = problem_dir.name
|
42 |
+
result.append(get_problem(year, problem_number, problem_dir).to_dict())
|
43 |
+
result.sort(key=lambda x: x["id"])
|
44 |
+
return result
|
45 |
+
|
46 |
+
if __name__ == "__main__":
|
47 |
+
result = convert_problems()
|
48 |
+
with open("imo_2025.json", "w", encoding="utf-8") as f:
|
49 |
+
json.dump(result, f)
|
imo_2025.json
CHANGED
@@ -1,32 +1 @@
|
|
1 |
-
[
|
2 |
-
{
|
3 |
-
"url": "2025-imo-p1",
|
4 |
-
"problem": "A line in the plane is called *sunny* if it is not parallel to any of the $x$-axis, the $y$-axis, or the line $x+y=0$.\n\nLet $n\\geq 3$ be a given integer. Determine all nonnegative integers $k$ such that there exist $n$ distinct lines in the plane satisfying both of the following:\n\n(i) For all positive integers $a$ and $b$ with $a+b\\leq n+1$, the point $(a,b)$ lies on at least one of the lines; and\n\n(ii) Exactly $k$ of the $n$ lines are sunny.",
|
5 |
-
"answer": "N/A"
|
6 |
-
},
|
7 |
-
{
|
8 |
-
"url": "2025-imo-p2",
|
9 |
-
"problem": "Find all functions $f: \\mathbb{R} \\to \\mathbb{R}$ such that\n\n$$f(x^3 + y^3) = f(x + y)(x^2 - xy + y^2)$$\n\nfor all real numbers $x$ and $y$.",
|
10 |
-
"answer": "N/A"
|
11 |
-
},
|
12 |
-
{
|
13 |
-
"url": "2025-imo-p3",
|
14 |
-
"problem": "Find all positive integers $n$ such that there exist positive integers $a_1, a_2, \\ldots, a_n$ with the property that for any positive integers $b_1, b_2, \\ldots, b_n$, there exists an integer $k$ such that\n\n$$a_1b_1 + a_2b_2 + \\cdots + a_nb_n + k$$\n\nis a perfect square.",
|
15 |
-
"answer": "N/A"
|
16 |
-
},
|
17 |
-
{
|
18 |
-
"url": "2025-imo-p4",
|
19 |
-
"problem": "Penguins Ella, Distin, and Glara play a game on an infinite chessboard. Ella starts by placing a white stone at the origin $(0,0)$. On Distin's turn, Distin must move one stone from a cell $(a,b)$ to an adjacent cell sharing a side (possible moves: $(a\\pm 1, b)$ or $(a, b\\pm 1)$). After each of Distin's moves, if there is no stone at $(0,0)$, Glara immediately places a white stone at $(0,0)$. Otherwise, Glara places no stone. The game continues indefinitely: Distin moves on odd turns (turn $1, 3, 5, \\ldots$) and Glara places on even turns (turn $2, 4, 6, \\ldots$) if the conditions are met.\n\nShow that for each positive integer $d$, there is a moment after which there is always at least one white stone among the cells with Manhattan distance $d$ from the origin. (The Manhattan distance from $(0,0)$ to $(x,y)$ is $|x| + |y|$.)",
|
20 |
-
"answer": "N/A"
|
21 |
-
},
|
22 |
-
{
|
23 |
-
"url": "2025-imo-p5",
|
24 |
-
"problem": "A finite set $S$ of positive integers is called *primitive* if for every $s \\in S$, none of the proper divisors of $s$ belong to $S$.\n\nDetermine all positive integers $n$ for which there exists a primitive set $S$ with $|S| = n$ such that\n\n$$\\sum_{s \\in S} \\frac{1}{s} = 1.$$",
|
25 |
-
"answer": "N/A"
|
26 |
-
},
|
27 |
-
{
|
28 |
-
"url": "2025-imo-p6",
|
29 |
-
"problem": "Let $ABC$ be a triangle with incenter $I$ and incircle $\\omega$. Let $X$ be a point on the arc $BC$ of the circumcircle of triangle $ABC$ not containing $A$. Lines $XA$, $XB$, $XC$ meet $\\omega$ again at $D$, $E$, $F$ respectively. Prove that the circumcenter $O$ of triangle $DEF$ and the orthocenter $H$ of triangle $ABC$ are collinear with $I$.",
|
30 |
-
"answer": "N/A"
|
31 |
-
}
|
32 |
-
]
|
|
|
1 |
+
[{"id": "2025_imo_p1", "problem": "A line in the plane is called *sunny* if it is **not** parallel to any of the $x$-axis, the $y$-axis, and the line $x + y = 0$.\n\nLet $n \\geq 3$ be a given integer. Determine all nonnegative integers $k$ such that there exist $n$ distinct lines in the plane satisfying both of the following:\n\n* for all positive integers $a$ and $b$ with $a + b \\leq n + 1$, the point $(a, b)$ is on at least one of the lines; and\n* exactly $k$ of the $n$ lines are sunny.\n", "solution": null}, {"id": "2025_imo_p2", "problem": "Let $\\Omega$ and $\\Gamma$ be circles with centres $M$ and $N$, respectively, such that the radius of $\\Omega$ is less than the radius of $\\Gamma$. Suppose circles $\\Omega$ and $\\Gamma$ intersect at two distinct points $A$ and $B$. Line $MN$ intersects $\\Omega$ at $C$ and $\\Gamma$ at $D$, such that points $C, M, N$ and $D$ lie on the line in that order. Let $P$ be the circumcentre of triangle $ACD$. Line $AP$ intersects $\\Omega$ again at $E \\neq A$. Line $AP$ intersects $\\Gamma$ again at $F \\neq A$. Let $H$ be the orthocentre of triangle $PMN$.\n\nProve that the line through $H$ parallel to $AP$ is tangent to the circumcircle of triangle $BEF$.\n\n(The *orthocentre* of a triangle is the point of intersection of its altitudes.)\n", "solution": null}, {"id": "2025_imo_p3", "problem": "Let $\\mathbb{N}$ denote the set of positive integers. A function $f: \\mathbb{N} \\to \\mathbb{N}$ is said to be *bonza* if\n\n$$f(a) \\text{ divides } b^a - f(b)^{f(a)}$$\n\nfor all positive integers $a$ and $b$.\n\nDetermine the smallest real constant $c$ such that $f(n) \\leq cn$ for all bonza functions $f$ and all positive integers $n$.\n", "solution": null}, {"id": "2025_imo_p4", "problem": "A *proper divisor* of a positive integer $N$ is a positive divisor of $N$ other than $N$ itself.\n\nThe infinite sequence $a_1, a_2, \\ldots$ consists of positive integers, each of which has at least three proper divisors.\n\nFor each $n \\geq 1$, the integer $a_{n+1}$ is the sum of the three largest proper divisors of $a_n$.\n\nDetermine all possible values of $a_1$.\n", "solution": null}, {"id": "2025_imo_p5", "problem": "Alice and Bazza are playing the *inekoalaty game*, a two-player game whose rules depend on a positive real number $\\lambda$ which is known to both players. On the $n^{\\text{th}}$ turn of the game (starting with $n = 1$) the following happens:\n\n- If $n$ is odd, Alice chooses a nonnegative real number $x_n$ such that\n\n$$x_1 + x_2 + \\cdots + x_n \\leq \\lambda n.$$\n\n- If $n$ is even, Bazza chooses a nonnegative real number $x_n$ such that\n\n$$x_1^2 + x_2^2 + \\cdots + x_n^2 \\leq n.$$\n\nIf a player cannot choose a suitable number $x_n$, the game ends and the other player wins. If the game goes on forever, neither player wins. All chosen numbers are known to both players.\n\nDetermine all values of $\\lambda$ for which Alice has a winning strategy and all those for which Bazza has a winning strategy.\n", "solution": null}, {"id": "2025_imo_p6", "problem": "Consider a $2025 \\times 2025$ grid of unit squares. Matilda wishes to place on the grid some rectangular tiles, possibly of different sizes, such that each side of every tile lies on a grid line and every unit square is covered by at most one tile.\n\nDetermine the minimum number of tiles Matilda needs to place to satisfy these conditions.", "solution": null}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
markdown/{p1 → 2025/p1}/problem.md
RENAMED
File without changes
|
markdown/{p2 → 2025/p2}/problem.md
RENAMED
File without changes
|
markdown/{p3 → 2025/p3}/problem.md
RENAMED
File without changes
|
markdown/{p4 → 2025/p4}/problem.md
RENAMED
File without changes
|
markdown/{p5 → 2025/p5}/problem.md
RENAMED
File without changes
|
markdown/{p6 → 2025/p6}/problem.md
RENAMED
File without changes
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pydantic>=2.11.7
|