Number of pairs
Easy
CPU usage time limit is 2.5 seconds
Runtime memory usage limit is 256 megabytes
Determine the number of vertex pairs that have a distance of exactly .
Note that pairs and are considered identical.
Input Format
The first line contains two integers and , representing the number of vertices and the specified distance, respectively.
Each of the following lines contains three integers , , and , which describe a road of length connecting cities and .
Output Format
Print the number of vertex pairs that have a distance of exactly .
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 24
Acceptance rate 42%