I am stuck on this following problem:
Given an undirected tree of n nodes and q queries of type (u,d), for each query you need find the number of simple paths starting from node u and having edge distance <=d.
Constraints:
1<=n,q,u,d<=100000
Any suggestion will be highly appreciated. Thanks.