I was solving this problem on cf . My c++ code got accepted but it is giving segmentation fault in my local computer. Why is it so? I also tried other online compilers like ideone , and it was working there too.
Same case with java. My java code got AC in cf but gives stackoverflow error in my computer.
My operating system is Ubuntu 20.04