P7112 [Template] Determinant Evaluation
Background
This is a template problem, with no background.
Description
Given an $n$-order determinant $A$, find $|A|$. Output the result modulo $p$.
Input Format
The first line contains two positive integers $n$ and $p$.
Then follow $n$ lines. The $(i+1)$-th line contains $n$ positive integers, where the $j$-th number represents $A_{i,j}$.
Output Format
Output the smallest non-negative integer value of $|A|$ modulo $p$.
Explanation/Hint
For $100\%$ of the testdata, $1 \le n \le 600$, $1 \le a_{i,j} < 10^9 + 7$, $1 \le p \le 10^9 + 7$.
Translated by ChatGPT 5