func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   const int N = 122231;   int n, k;   vector<int> g[N];   int used[N];   int done[150][150][150];   int memo[150][150][150];   vector<int> sons[N];   int max_dep[N];   void dfs(int v) {     used[v] = 1;     max_dep[v] = 0;     for (int i = 0; i < g[v].size(); i++) {       int to = g[v][i];       if (used[to]) continue;       sons[v].push_back(to);       dfs(to);       max_dep[v] = max(max_dep[v], max_dep[to] + 1);     }   }   int solve(int v, int top1, int covered_pref) {     if (done[v][top1][covered_pref]) return memo[v][top1][covered_pref];     done[v][top1][covered_pref] = 1;     if (top1 == 100) {       memo[v][top1][covered_pref] = (covered_pref > max_dep[v]);       return memo[v][top1][covered_pref];     }     if (top1 > k && covered_pref == 0) {       memo[v][top1][covered_pref] = 0;       return 0;     }     long long ways[2], nways[2];     ways[0] = ways[1] = nways[0] = nways[1] = 0;     if (top1 == 0) {       ways[1] = 1;     } else {       ways[0] = 1;     }     for (int i = 0; i < sons[v].size(); i++) {       int to = sons[v][i];       for (int j = 0; j < 2; j++) nways[j] = 0;       int new_pref = max(covered_pref - 1, k - top1);       if (new_pref < 0) new_pref = 0;       for (int dep_there = 0; dep_there <= 100; dep_there++) {         int is_ok_dep = 1;         if (dep_there + 1 < top1) is_ok_dep = 0;         if (dep_there == 100) {           if (new_pref <= max_dep[to]) is_ok_dep = 0;         } else {           int covered2 = dep_there - k;           if (covered2 > new_pref) is_ok_dep = 0;         }         if (is_ok_dep == 0) continue;         if (solve(to, dep_there, new_pref) == 0) continue;         for (int j = 0; j < 2; j++) {           nways[j | ((dep_there + 1) == top1)] =               1ll * nways[j | ((dep_there + 1) == top1)] +               1ll * ways[j] * solve(to, dep_there, new_pref) % 1000000007;           nways[j | ((dep_there + 1) == top1)] %= 1000000007;         }       }       for (int j = 0; j < 2; j++) {         ways[j] = nways[j];       }     }     memo[v][top1][covered_pref] = ways[1];     return memo[v][top1][covered_pref];   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> k;     for (int i = 1; i < n; i++) {       int a, b;       cin >> a >> b;       g[a].push_back(b);       g[b].push_back(a);     }     int root = 1;     dfs(root);     int res = 0;     for (int i = 0; i <= k; i++) {       res += solve(root, i, 0);       res %= 1000000007;     }     cout << res << endl;     cin.get();     cin.get();     return 0;   }   