{"problem":{"name":"Creative Splitting","description":{"content":"You are given integers $N$ and $K$. Let's call an integer array $a=[a_1, a_2, \\ldots, a_K]$ of length $K$ **good**, if $1 \\le a_i \\le i$ for all $1 \\le i \\le K$. Let's call an integer array $b=[b_1, b","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":4000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc055_f"},"statements":[{"statement_type":"Markdown","content":"You are given integers $N$ and $K$.\nLet's call an integer array $a=[a_1, a_2, \\ldots, a_K]$ of length $K$ **good**, if $1 \\le a_i \\le i$ for all $1 \\le i \\le K$.\nLet's call an integer array $b=[b_1, b_2, \\ldots, b_{NK}]$ of length $NK$ **amazing**, if it can be split into $N$ (not necessarily contiguous) subsequences of length $K$, each of which is good.\nLet's define $f(pos, val)$ as the number of amazing sequences $b$ such that $b_{pos}=val$.\nFind $f(pos, val)$ for all $1\\le pos \\le NK$, $1 \\le val \\le K$. As these numbers can be very big, output them modulo some prime $P$.\n\n## Constraints\n\n*   $1 \\le N \\le 20$.\n*   $1 \\le K \\le 20$.\n*   $10^8 \\le P \\le 10^9$\n*   $P$ is a prime.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $K$ $P$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc055_f","tags":[],"sample_group":[["2 2 965166677","6 0 \n4 2 \n4 2 \n3 3 \n\nThere exist $6$ amazing arrays:\n\n*   $[1, 1, 1, 1]$ ー can be split into $[b_1, b_2], [b_3, b_4]$.\n*   $[1, 1, 1, 2]$ ー can be split into $[b_1, b_2], [b_3, b_4]$.\n*   $[1, 2, 1, 1]$ ー can be split into $[b_1, b_2], [b_3, b_4]$.\n*   $[1, 2, 1, 2]$ ー can be split into $[b_1, b_2], [b_3, b_4]$.\n*   $[1, 1, 2, 1]$ ー can be split into $[b_1, b_3], [b_2, b_4]$.\n*   $[1, 1, 2, 2]$ ー can be split into $[b_1, b_3], [b_2, b_4]$."]],"created_at":"2026-03-03 11:01:14"}}