#P5908. 猫猫和企鹅

猫猫和企鹅

Description

There are nn residential areas in the kingdom. They are connected by n1n - 1 roads, and it is guaranteed that from any residential area you can reach any other one. The length of each road is 11.

In every residential area except area 11, there lives a little penguin. One day, a cat starts from residential area 11 and wants to visit some penguins. However, the cat is very lazy and is only willing to visit penguins whose distance from it is at most dd.

Please tell the cat how many penguins it can visit.

Input Format

The first line contains two integers n,dn, d, with the meanings as described above.

Starting from the second line, there are n1n - 1 lines. Each line contains two integers u,vu, v, indicating that there is a road between residential areas uu and vv.

Output Format

Output one integer in a single line, indicating how many penguins the cat can visit.

5 1
1 2
1 3
2 4
3 5
2

Hint

For 100%100\% of the testdata, 1n,d1051 \le n, d \le 10^5. It is guaranteed that all residential areas are numbered starting from 11.

Translated by ChatGPT 5