Code gives seg fault on submit for a test case, but if same test case run as custom test, gives correct output.
Check if you have any global variables that are not being cleared . If you are using adjacency list for storing graph and it is declared globally , make sure to clear the adjacency list in main function . Hope that helps .
There is some bug with their compiler when you use global variables it throws segmentation fault but it does run on custom test.