please help Ambiguous Permutations: runtime error segmentation falult

I tried on my laptop and it works fine! gives the correct answer for given test cases and I do think my logic is correct! but I don’t know why I am getting this runtime error …


this is my code!