Problem:
Score : 700 points

Problem Statement

Takahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable.
For each i=2,3,...,2K, find the following value modulo 998244353:

The number of combinations of N sides shown by the dice such that the sum of no two different sides is i.

Note that the dice are NOT distinguishable, that is, two combinations are considered different when there exists an integer k such that the number of dice showing k is different in those two.

Constraints

1 \leq K \leq 2000

2 \leq N \leq 2000

K and N are integers.

Input

Input is given from Standard Input in the following format:

K N

Output

Print 2K-1 integers. The t-th of them (1\leq t\leq 2K-1) should be the answer for i=t+1.

Sample Input 1

3 3

Sample Output 1

7
7
4
7
7

For i=2, the combinations (1,2,2),(1,2,3),(1,3,3),(2,2,2),(2,2,3),(2,3,3),(3,3,3) satisfy the condition, so the answer is 7.

For i=3, the combinations (1,1,1),(1,1,3),(1,3,3),(2,2,2),(2,2,3),(2,3,3),(3,3,3) satisfy the condition, so the answer is 7.

For i=4, the combinations (1,1,1),(1,1,2),(2,3,3),(3,3,3) satisfy the condition, so the answer is 4.

Sample Input 2

4 5

Sample Output 2

36
36
20
20
20
36
36

Sample Input 3

6 1000

Sample Output 3

149393349
149393349
668669001
668669001
4000002
4000002
4000002
668669001
668669001
149393349
149393349

Solution in Rust (1.42.0) (judge verdict: Accepted)

use proconio::input;

trait ModValue:
    std::ops::Add<Output = Self>
    + std::ops::Sub<Output = Self>
    + std::ops::Mul<Output = Self>
    + std::ops::Div<Output = Self>
    + std::ops::Rem<Output = Self>
    + std::ops::AddAssign
    + std::ops::SubAssign
    + std::ops::MulAssign
    + std::ops::DivAssign
    + std::ops::RemAssign
    + std::ops::Neg
    + std::cmp::Ord
    + Clone
    + Copy
    + std::fmt::Debug
    + Sized
{
    fn modulus() -> Self;
    fn zero() -> Self;
    fn one() -> Self;
}

#[derive(Clone, Copy, Debug)]
struct Modint<Value: ModValue>(Value);

impl<Value: ModValue> Modint<Value> {
    #[allow(dead_code)]
    pub fn with_value(x: Value) -> Self {
        Self(Self::normalize(x))
    }

    #[allow(dead_code)]
    pub fn with_value_unchecked(x: Value) -> Self {
        Self(x)
    }

    #[allow(dead_code)]
    pub fn validate(&self) -> &Self {
        assert!(Value::zero() <= self.0 && self.0 < Value::modulus());
        &self
    }

    fn normalize(x: Value) -> Value {
        let x = x % Value::modulus();
        if x < Value::zero() {
            x + Value::modulus()
        } else {
            x
        }
    }

    fn add_unchecked(x: Value, y: Value) -> Value {
        let z = x + y;
        if Value::modulus() <= z {
            z - Value::modulus()
        } else {
            z
        }
    }

    fn sub_unchecked(x: Value, y: Value) -> Value {
        let z = x - y;
        if x < Value::zero() {
            z + Value::modulus()
        } else {
            z
        }
    }

    fn neg_unchecked(x: Value) -> Value {
        if x == Value::zero() {
            Value::zero()
        } else {
            Value::modulus() - x
        }
    }

    fn mul_unchecked(x: Value, y: Value) -> Value {
        x * y % Value::modulus()
    }

    fn div_unchecked(x: Value, y: Value) -> Value {
        Self::mul_unchecked(x, Self::inv_unchecked(y))
    }

    fn inv_unchecked(mut x: Value) -> Value {
        let mut y: Value = Value::modulus();
        let mut u: Value = Value::one();
        let mut v: Value = Value::zero();
        while x != Value::zero() {
            let q = y / x;
            y -= x * q;
            v -= u * q;
            std::mem::swap(&mut x, &mut y);
            std::mem::swap(&mut u, &mut v);
        }
        if v < Value::zero() {
            v + Value::modulus()
        } else {
            v
        }
    }
}

macro_rules! impl_bop {
    (
        $(
            $bop_trait: ident::$bop_fn: ident, $bop_assign_trait: ident::$bop_assign_fn: ident, $impl: ident;
        )*
    ) => {
        $(
            impl<Value: ModValue> std::ops::$bop_trait for Modint<Value> {
                type Output = Self;
                fn $bop_fn(self, rhs: Self) -> Self::Output {
                    Modint(Self::$impl(self.0, rhs.0))
                }
            }
            impl<Value: ModValue> std::ops::$bop_assign_trait for Modint<Value> {
                fn $bop_assign_fn(&mut self, rhs: Self) {
                    use std::ops::$bop_trait;
                    *self = Modint::$bop_fn(*self, rhs)
                }
            }
        )*
    };
}

impl_bop! {
    Add::add, AddAssign::add_assign, add_unchecked;
    Sub::sub, SubAssign::sub_assign, sub_unchecked;
    Mul::mul, MulAssign::mul_assign, mul_unchecked;
    Div::div, DivAssign::div_assign, div_unchecked;
}

impl<Value: ModValue> std::ops::Neg for Modint<Value> {
    type Output = Self;
    fn neg(self) -> Self::Output {
        Modint(Self::neg_unchecked(self.0))
    }
}

impl<Value: ModValue> std::iter::Sum<Self> for Modint<Value> {
    fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
        iter.fold(Self::with_value(Value::zero()), std::ops::Add::add)
    }
}

impl<Value: ModValue> std::convert::From<Value> for Modint<Value> {
    fn from(x: Value) -> Self {
        Self::with_value(x)
    }
}

#[allow(unused_macros)]
macro_rules! modint {
    ($x: expr) => {
        Modint::with_value($x)
    };
}

#[allow(unused_macros)]
macro_rules! impl_modvalue {
    ($(const $mod_name: ident: $ty: ty = $mod_value: expr;)*) => {
        $(
            const $mod_name: $ty = $mod_value;
            impl ModValue for $ty {
                fn modulus() -> Self {
                    $mod_name
                }
                fn zero() -> Self {
                    0
                }
                fn one() -> Self {
                    1
                }
            }
        )*
    };
}

impl_modvalue! {const MOD: i64 = 998244353;}

fn main() {
    input!(k: usize, n: usize);
    let mut pow2 = vec![modint!(1); n + k + 1];
    let mut fact = vec![modint!(1); n + k + 1];
    (1..=n + k).for_each(|i| fact[i] = fact[i - 1] * modint!(i as i64));
    (1..=n + k).for_each(|i| pow2[i] = pow2[i - 1] * modint!(2));
    let binom = |n, k| fact[n] / (fact[k] * fact[n - k]);
    let cinom = |n: usize, k: usize| binom((n + k - 1) as usize, (k - 1) as usize);

    let cal = |a: usize, b: usize, n: usize| -> Modint<i64> {
        (0..=b.min(n))
            .filter(|&i| 0 < a + i)
            .map(|i| binom(b, i) * cinom(n - i, a + i) * pow2[i])
            .sum::<Modint<i64>>()
    };
    for i in 2..=2 * k {
        let a = if k + 1 <= i { i - (k + 1) } else { (k + 1) - i };
        let b = (k - a) / 2;
        let c = (k - a) % 2;
        // dbg!((i, a, b, c));
        println!(
            "{}",
            match c {
                0 => cal(a, b, n),
                1 => cal(a, b, n) + cal(a, b, n - 1),
                _ => panic!(),
            }
            .0
        );
    }
}