Why i am getting segmentation fault for printing tree in spiral form

It’s GFG practice question Link.
I used BFS algorithm and used a vector to store elements for each level and the printed it directly or in reverse order.
Well sample cases are passing.
But i couldn’t figure out why i am getting segmentation fault while submitting.