use proconio::input; fn main() { input! { n:usize, m:usize, } let mut dp = vec![vec![0; n * n + 1]; n + 1]; dp[0][0] = 1; for i in 1..=n { let mut dp_next = vec![vec![0; n * n + 1]; n + 1]; for j in 0..=n { for k in 0..=n * n { if 0 < j { dp_next[j][k] = dp_next[j][k] + dp_next[j - 1][k]; dp_next[j][k] %= m; } if j < i && j <= k { dp_next[j][k] = dp_next[j][k] + dp[j][k - j]; dp_next[j][k] %= m; } } } dp = dp_next; } for i in 0..=n * n { println!("{}", dp[n][i]); } }