Code not working

This code is not working for the input of -->

Size = 5
Students = 4
Pages = [1,2,3,1,1]

The output comes out as 2, whereas the answer should have been 3.

hello @rahulrana1998

pls save ur code at cb ide and share its link with me