#include #include using namespace std; using i64 = long long; constexpr int inf = 987654321; int n, p; vector> mat, dp; int main(void) { scanf("%d%d", &n, &p); mat.assign(3, vector(n)); for(int i=0; i(p+1, inf)); dp[0][0] = 0; for(int i=0; i