You are getting runtime error even for input as small as 5. And reason is not far to see. Roughly, the sum of all array sizes you are declaring is 1.2 x 10^8, and it is just too big!!
Most sites like hackerrank barely allow an array size over 10^7 (at times not even that). Codechef has a lenient memory policy, but I dont think geeksforgeeks has that. You are taking too much memory and hence getting RE:SIGSEV before even taking the input.