For the problem MAXCOUNT, the code below gives Wrong answer. Kindly explain the error.

You have created an array(counter) of size 10000, you need to create it of 10000+1=10001 as the inputted number can be 10000 also. Also you need to run your loop till 10000 rather than less than 10000.

The suggestion given by @asimali246 is absolutely correct.
Check the link of the accepted solution below :

I have made the three changes to your solution 1st the array size to 10^5+1 , loop upto 10^5 and the last loop upto 10^5 as suggested by @asimali246 .