Even output is correct while running editor ,but runtime error arise while submitting.
Which problem/submission are you talking about?
Quick checks: Check for null pointer dereferences. That is almost always the case when a SIGSEGV is thrown. As far as arrays are concerned, there is a limit on memory (and hence, you cannot declare/allocate huge chunks of memory.) Also, try moving very large array declarations to the static-area/heap (by declaring it globally or by using runtime allocation) instead of in the stack (local variables are allocated memory on the stack, and this memory, is usually limited.)
Check this out - SIGSEGV Error
Provide more details other wise it is too ambiguous.