Max circles greedy


Giving the wrong output. What is the error?

while taking input u are doing n-- and in output u are printing n-res. But n is 0 this time hence, getting wrong output.