func_code_string: #include <bits/stdc++.h>   using namespace std;   constexpr int MAXWHITE = 20;   constexpr int MINBLACK = 40;   int64_t dp[110][MAXWHITE + 5][MINBLACK + 5];   int vis[110];   int par[110];   vector<vector<int>> adj;   int N, K;   int64_t MOD = (int64_t)1e9 + 7LL;   int64_t Get(int u, int max_white, int min_black) {     return dp[u][max_white + 1][min_black + 1];   }   void Set(int u, int max_white, int min_black, int64_t val) {     dp[u][max_white + 1][min_black + 1] = val;   }   void ClearTemp() {     for (int i = 0; i <= MAXWHITE + 1; ++i) {       for (int j = 0; j <= MINBLACK + 1; ++j) {         dp[109][i][j] = 0;       }     }   }   void SetTemp(int max_white, int min_black, int64_t val) {     Set(109, max_white, min_black, val);   }   int64_t GetTemp(int max_white, int min_black) {     return Get(109, max_white, min_black);   }   void Flush(int u) {     for (int i = 0; i <= MAXWHITE + 1; ++i) {       for (int j = 0; j <= MINBLACK + 1; ++j) {         dp[u][i][j] = dp[109][i][j];       }     }     ClearTemp();   }   void Update(int u) {     int first_one = true;     for (int i = 0; i < adj[u].size(); ++i) {       int v = adj[u][i];       if (par[u] == v) continue;       if (first_one) {         first_one = false;         for (int a = -1; a <= MAXWHITE; ++a) {           for (int b = -1; b <= MINBLACK; ++b) {             if (a == b && b == -1) continue;             if (a == -1) {               Set(u, (b + 1 <= K ? a : a + 1), b + 1, Get(v, a, b));             } else if (b == -1) {               Set(u, a + 1, b, Get(v, a, b));             } else {               Set(u, a + 1, b + 1, Get(v, a, b));             }           }         }         int64_t black_way = 0;         for (int a = -1; a <= MAXWHITE; ++a) {           if (a + 1 > K) continue;           for (int b = -1; b <= MINBLACK; ++b) {             black_way += Get(v, a, b);             black_way %= MOD;           }         }         Set(u, -1, 0, black_way);         continue;       }       for (int a = -1; a <= MAXWHITE; ++a) {         for (int b = -1; b <= MINBLACK; ++b) {           if (a == b && b == -1) continue;           for (int c = -1; c <= MAXWHITE; ++c) {             for (int d = -1; d <= MINBLACK; ++d) {               if (c == d && d == -1) continue;               int max_white = (a == -1 ? c + 1 : (c == -1 ? a : max(a, c + 1)));               int min_black = (b == -1 ? d + 1 : (d == -1 ? b : min(b, d + 1)));               if (a == c && c == -1) {                 max_white = -1;               }               if (b == d && d == -1) {                 min_black = -1;               }               if (max_white != -1 && min_black != -1) {                 if (min_black + max_white <= K) {                   max_white = -1;                 }               }               if (max_white <= MAXWHITE && min_black <= MINBLACK) {                 int64_t x = Get(u, a, b);                 int64_t y = Get(v, c, d);                 x = (x * y) % MOD;                 x = (x + GetTemp(max_white, min_black)) % MOD;                 SetTemp(max_white, min_black, x);               }             }           }         }       }       Flush(u);     }   }   void Dfs(int u) {     vis[u] = 1;     bool leaf = true;     for (int i = 0; i < adj[u].size(); ++i) {       int v = adj[u][i];       if (!vis[v]) {         leaf = false;         par[v] = u;         Dfs(v);       }     }     if (leaf) {       Set(u, -1, 0, 1);       Set(u, 0, -1, 1);       return;     }     Update(u);   }   int main() {     scanf( %d%d , &N, &K);     int u, v;     adj.resize(N);     for (int i = 0; i < N - 1; ++i) {       scanf( %d%d , &u, &v);       --u;       --v;       adj[u].push_back(v);       adj[v].push_back(u);     }     Dfs(0);     int64_t ans = 0;     for (int max_white = -1; max_white <= MAXWHITE; ++max_white) {       for (int min_black = -1; min_black <= MINBLACK; ++min_black) {         if ((max_white == -1 && min_black <= K) ||             (min_black != -1 && min_black + max_white <= K)) {           ans += Get(0, max_white, min_black);           ans %= MOD;         }       }     }     cout << ans << endl;     return 0;   }   