Some way to handle 2d matrix of high order

how to handle 2-d array of order 5000*10^9

That’s too large. Even a 1D array of size 10^9 cannot be declared. Do you really need such a large array? There could be a better way to solve your question.

Which problem are you solving ? Declaring that big an array is not possible. There will be a better method to your problem.

@sarvagya3943 and @sandy999
It’s a problem from jan long chalenge “cyclist” one.

@arpit728, stop discussing question from present contest. There are editorials for it after the contest. We can be fined rating points by codechef for discussing queries about recent contest.

You aren’t supposed to discuss questions from on-going contests. You could get banned for that.