runtime error

i have checked my code in and online ide it works there but when i submit my code it shows runtime error SIGSEGV…so whats wrong ??

SIGSEGV error means you are trying to access an invalid memory reference like you are trying to access an array element out of bound. There may other reasons like

1 - declaring too much memory like an array of size 10^8

2- using large stack memory like on some test cases , your solution causes an infinte recursion.