Problem in testing the sample test case

My code https://ide.codingblocks.com/s/229983 gives following error when tested on sample test case
4 2
10 20 30 40

/bin/run.sh: line 4: 19 Bus error (core dumped) ./exe

while on submission passed all test cases, is anything wrong in my code?

Your code is fine, you may remove c_p_c() as many online ide’s doesn’t support it (excluding codeforces!)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.