P8005 An Extra Requirement
Background
Since Codeforces [[1]](https://codeforces.com/contest/1610/problem/I) [[2]](https://codeforces.com/contest/1591/problem/F) can reuse problems from Atcoder [[1]](https://atcoder.jp/contests/agc017/tasks/agc017_d) [[2]](https://atcoder.jp/contests/arc115/tasks/arc115_e), the problem setter (also) reused a problem from Atcoder [[3]](https://atcoder.jp/contests/agc054/tasks/agc054_e).
Description
Given a permutation $P$ of length $N$, you may perform the following operation any number of times: choose three positions $x, y, z \ (x
Input Format
The first line contains a positive integer $T$, the number of test cases.
The next $T$ lines each contain two positive integers $N, A$, representing the length of the permutation $P$ and the first number of the permutation, respectively.
Output Format
Output $T$ lines, each containing one integer, the answer modulo $998244353$.
Explanation/Hint
**This problem uses bundled testdata.**
| Subtask ID | Score | Special Constraints |
| :----------: | :----------: | :----------: |
| $0$ | $10$ | $T,N\le 8$ |
| $1$ | $15$ | $T\le 5$,$N\le 100$ |
| $2$ | $10$ | $T\le 5$,$N\le 1000$ |
| $3$ | $15$ | $A=1$ |
| $4$ | $15$ | $T\le 5$,$N\le 5\times 10^4$ |
| $5$ | $15$ | $T\le 200$ |
| $6$ | $20$ | No special constraints. |
For all testdata, it is guaranteed that $1\le T\le 10^5$ and $1\le A\le N\le 10^5$.
Translated by ChatGPT 5