Segmentation fault in 2 test cases

I don’t understand how there can be a segmentation fault for 2 cases while other four print correct output