https://github.com/keshav57/ioi-training/blob/master/INOI%20Solutions/Train%20Ride.cpp
This code fails this testcase :
15 7
1 5
4 8
5 6
7 11
8 15
10 13
12 14
The code gives 3 as the answer but the correct answer is 6
Here is the corrected DP code : https://pastebin.com/J010es2J