A square contains 1004 points, 4 of which are on the vertices, such that no 3 of these points are collinear. Segments are drawn between some of the points so that the square is subdivided into triangles.

Determine the number of triangles and the number of edges.
Let $T$ be the number of triangles. We count the sum $s$ of the angles of the triangles in two ways. On one hand, $s=180 T$. On the other hand, each interior vertex contributes $360^{\circ}$, while the four vertices of the square contribute a total of $360^{\circ}$, so $180 T=360 \times 1001$. From this, we deduce that there are 2002 triangles.

Let $A$ be the number of edges. There are $A-4$ interior edges.

Let $X$ be the number of pairs $(a, t)$ where $a$ is an edge of $t$. We have $|X|=3 T=6006$. On the other hand, if $a$ is an interior edge, it belongs to 2 triangles, otherwise it belongs to 1 triangle. Therefore, $|X|=2(A-4)+4=2 A-4$, so $A=3005$.