Doubt on code chef

Tell me following:
Q1. What’s segmentation/SIGSEGV and core dump? what’s diff. between them?

Q2. What’s the bug in code?

Q3. I ran my code on sublime configured with mingw , there it gave correct results…thus i came to know my logic 's though correct…I then submitted in python ! Why sublime not displayed SIGSEGV ?

https://www.codechef.com/COOK127C/problems/PAWRI

Hello @prerak_semwal
A SIGSEGV is an error(signal) caused by an invalid memory reference or a segmentation fault. You are probably trying to access an array element out of bounds or trying to use too much memory. Some of the other causes of a segmentation fault are : Using uninitialized pointers, dereference of NULL pointers, accessing memory that the program doesn’t own.

Whereas you will get core dump when you try to do something like writing on it but you can only read it.

@prerak_semwal the code which you have shared is not in python so you are facing problem in python code or c++ code?

@tusharaggarwal272
The code I shared i.e c++

@prerak_semwal check now: