# Vertices of a cyclic polygon have integer coordinates and sides. If odd $n$ divides the squares of the sides, it divides twice the area.

IMO 2016 Problem 3:

Let $$P = A_1 A_2 \cdots A_k$$ be a convex polygon in the plane. The vertices $$A_1, A_2, \ldots, A_k$$ have integral coordinates and lie on a circle. Let $$S$$ be the area of $$P$$. An odd positive integer $$n$$ is given such that the squares of the side lengths of $$P$$ are integers divisible by $$n$$. Prove that $$2S$$ is an integer divisible by $$n$$.

I tried using the formula for area of a polygon in cartesian plane, after assuming coordinates, but to no avail.

Since $P$ is convex, we can uniquely truncate $P$ with right-angled triangles with hypotenuses equal to the side lengths of $P$ and the remaining rectilinears inside.
Let reducible triangle be a right-angled triangle with Pythagorean triple $(a,b,c)$ where both $a$,$b$ and $c$ are divisible by $n$.
If all triangles above truncating $P$ is reducible triangles, area of each triangle and rectilinear is divisible by $n^2$. Thus, $2S$ must be divisible by $n$.
Please figure out the case with $P$ truncated by some non-reducible triangles.