Rating:

There are 1024 variables and 2048 equations. 2047 of these equations have common errors.

So divide equations into two groups of size 1024. Solve the equations after removing the error. One of the solution is the original secret_key.

With the secret_key, we can recover the flag.