I was solving the problems under Edu section when I found that for this problem under Suffix Array lectures, my solution works fine for the second test case on VS Code.
But the same code gives runtime error on CF. I am also unable to decipher the diagnostic comment which came attached with my submission, On further inspection I found that for different versions of gcc compilers, my solution gave runtime error on different test cases.
I am completely perplexed and would be grateful if someone sheds some light on this behavior.
UPD1 : Attaching the error comment screenshot and removing link to my submission.