description: A sequence of integers b_1, b_2, …, b_m is called good if max(b_1, b_2, …, b_m) ⋅ min(b_1, b_2, …, b_m) ≥ b_1 + b_2 + … + b_m.
  
  A sequence of integers a_1, a_2, …, a_n is called perfect if every non-empty subsequence of a is good.
  
  YouKn0wWho has two integers n and M, M is prime. Help him find the number, modulo M, of perfect sequences a_1, a_2, …, a_n such that 1 ≤ a_i ≤ n + 1 for each integer i from 1 to n.
  
  A sequence d is a subsequence of a sequence c if d can be obtained from c by deletion of several (possibly, zero or all) elements.
  
  Input
  
  The first and only line of the input contains two space-separated integers n and M (1 ≤ n ≤ 200; 10^8 ≤ M ≤ 10^9). It is guaranteed that M is prime.
  
  Output
  
  Print a single integer — the number of perfect sequences modulo M.
  
  Examples
  
  Input
  
  
  2 998244353
  
  
  Output
  
  
  4
  
  
  Input
  
  
  4 100000007
  
  
  Output
  
  
  32
  
  
  Input
  
  
  69 999999937
  
  
  Output
  
  
  456886663
  
  Note
  
  In the first test case, the perfect sequences are [2, 2], [2, 3], [3, 2] and [3, 3].
  
  In the second test case, some of the perfect sequences are [3, 4, 3, 5], [4, 5, 4, 4], [4, 5, 5, 5] etc. One example of a sequence which is not perfect is [2, 3, 3, 4], because, for example, the subsequence [2, 3, 4] is not an good as 2 ⋅ 4 < 2 + 3 + 4.
solution: #include <bits/stdc++.h>
  int min(int a, int b) { return a < b ? a : b; }
  int max(int a, int b) { return a > b ? a : b; }
  int vv[202 + 1], ff[202 + 1], gg[202 + 1];
  void init(int md) {
    int i;
    ff[0] = gg[0] = 1;
    for (i = 1; i <= 202; i++) {
      vv[i] = i == 1 ? 1 : (long long)vv[i - md % i] * (md / i + 1) % md;
      ff[i] = (long long)ff[i - 1] * i % md;
      gg[i] = (long long)gg[i - 1] * vv[i] % md;
    }
  }
  int main() {
    static int dp[202 + 1][202 + 1];
    int n, md, a, b, k, l, s, ans;
    scanf("%d%d", &n, &md), init(md);
    ans = 0;
    for (a = 1; a <= n + 1; a++) {
      for (k = 0; k <= n; k++) memset(dp[k], 0, (a + 1) * sizeof *dp[k]);
      dp[0][0] = 1;
      for (b = a; b <= n + 1; b++) {
        for (k = n; k >= 0; k--)
          for (s = 0; s + (n - k) * (b - a) <= a && s + k * a <= a * (b - 1);
               s++) {
            int x = dp[k][s], k_, s_, lower, upper;
            if (x == 0) continue;
            lower = max(1, s + (n - k) * (b + 1 - a) - a);
            upper = min(n - k, (a * b - s - k * a) / b);
            for (l = lower; l <= upper; l++) {
              k_ = k + l, s_ = s + l * (b - a);
              dp[k_][s_] = (dp[k_][s_] + (long long)dp[k][s] * gg[l]) % md;
            }
          }
        if (b == a) dp[0][0] = 0;
      }
      for (s = 0; s <= a; s++) ans = (ans + (long long)dp[n][s] * ff[n]) % md;
    }
    printf("%d\n", ans);
    return 0;
  }
  