here i took average of all the cost and then found the element in the array{a[c]} that is near to average (in near function and then counted the costs that are greater than a[c]
multiplied with min*a[c]
where most of the solutions given right solution but not all
Please first provide a link to the question, then provide a link to your submission(i.e. dont copy paste the code provide a link to your codechef submission), shortly explain what your code does or what was your thinking going on because it is hard to read others code and then debug for you and mostly no one does.