D. Exhausted
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
7 50
2 1 20
3 1 19
4 2 17
5 3 16
6 3 13
7 4 18
Output
2 6