Upsc cms while doing postgraduation

Can we write upsc cms while doing first year postgraduation?If we get selected then will there be the facility to take leave and continue pg?