Problem p03066 - Generation 2

Orig Description

Score : 800 points
Problem StatementFind the number, modulo 998244353, of sequences of length N consisting of 0, 1 and 2 such that none of their contiguous subsequences totals to X.
Constraints
1 \leq N \leq 3000
1 \leq X \leq 2N
N and X are integers.
InputInput is given from Standard Input in the following format:
N X
OutputPrint the number, modulo 998244353, of sequences that satisfy the condition.
Sample Input 13 3
Sample Output 114
14 sequences satisfy the condition: (0,0,0),(0,0,1),(0,0,2),(0,1,0),(0,1,1),(0,2,0),(0,2,2),(1,0,0),(1,0,1),(1,1,0),(2,0,0),(2,0,2),(2,2,0) and (2,2,2).
Sample Input 28 6
Sample Output 21179
Sample Input 310 1
Sample Output 31024
Sample Input 49 13
Sample Output 418402
Sample Input 5314 159
Sample Output 5459765451

Extracted Specification

An integer N (1 ≤ N ≤ 3000), representing some quantity or size.
An integer X (1 ≤ X ≤ 2N).

### Example Input:

```
3 3
```

### Function Signature:
Write a function f(N, X) that takes in the input.
def f(N: int, X: int):
    ''' 
    N: an integer 
    X: an integer
    '''

Test Case Generator

Sure, I can help you write a test case generator for the given problem statement. Here is the Python function that will generate random test cases for the problem:

```python
import random

def tcgen():
    # Define constraints
    N = random.randint(1, 3000)
    X = random.randint(1, 2 * N)
    
    return N, X

# Function to print the generated test case in the required format
def print_test_case():
    N, X = tcgen()
    print(f"{N} {X}")

# Example usage
if __name__ == "__main__":
    print_test_case()
```

This function `tcgen` generates a random value for \( N \) within the range [1, 3000] and a random value for \( X \) within the range [1, 2*N], which satisfies the given constraints. The `print_test_case` function prints the generated test case in the expected input format. 

You can call `print_test_case` to generate and print a new test case each time you run the script.

Extract Arguments

def extract_arguments(fh):
    N, X = map(int, fh.readline().strip().split())
    return N, X