CF2125E Sets of Complementary Sums

Description

We call a set of integers $ Q $ a set of complementary sums if it can be obtained through the following actions: - choose an array $ a $ consisting of $ m $ positive integers ( $ m $ is any positive integer); - calculate the sum $ s $ of all elements in the array $ a $ ; - for each element $ a_{i} $ in the array, add the number $ s - a_{i} $ to the set, more formally the set $ Q = \{s - a_{i}\;|\; 1 \le i \le m\} $ . Note that $ Q $ is not a multiset, meaning each number in it is unique. For example, if the array $ a = [1, 3, 3, 7] $ was chosen, then $ s = 14 $ and $ Q = \{7, 11, 13\} $ . Your task is to count the number of distinct sets of complementary sums for which the following holds: - the set contains exactly $ n $ elements; - each element of the set is an integer from $ 1 $ to $ x $ . Two sets are considered different if there exists an element in the first set that is not included in the second set. Since the answer can be huge, output it modulo $ 998\,244\,353 $ .

Input Format

Each test consists of several test cases. The first line contains a single integer $ t $ ( $ 1 \le t \le 10^{4} $ ) — the number of test cases. The description of the test cases follows. The only line of each test case contains two integers $ n $ and $ x $ ( $ 1 \le n, x \le 2 \cdot 10^{5} $ ). Additional constraints on the input data: - the sum of $ n $ across all test cases does not exceed $ 2 \cdot 10^{5} $ ; - the sum of $ x $ across all test cases does not exceed $ 2 \cdot 10^{5} $ .

Output Format

For each test case, output a single integer — the answer to the problem modulo $ 998\,244\,353 $ .

Explanation/Hint

For the first test case, there are exactly $ 7 $ suitable sets: $ $$$\{1\}, \{2\}, \{3\}, \{4\}, \{5\}, \{6\}, \{7\} $ $

For the second test case, there are $ 10 $ suitable sets:

$ $ \{1, 2\}, \{1, 3\}, \{1, 4\}, \{1, 5\}, \{2, 3\}, \{2, 4\}, \{2, 5\}, \{3, 4\}, \{3, 5\}, \{4, 5\} $ $$$