The code is wrong

For the following test case the code is giving wrong answer.

4 4

0 1 3

0 3 5

1 2 1

2 3 8

@omkarkhodwe hey, which code is givng wrong answer?

This is the exact code as in the video.I also tried copy pasting the code from graph notes.Same problem.So, mostly likely the video has the wrong code.

I am assuming source to be 0.

@omkarkhodwe hey logic is correct please check the output format of question.

@rishabhmahajan546

No, i am just asking you ti check for the testcase that I have asked.
4 4

0 1 3

0 3 5

1 2 1

2 3 8