Birthday paradox problem

sir my code is failing in one test case please tell me whats wrong with my code
below is my code link

https://online.codingblocks.com/player/3066/content/323

Provide ur code with proper Qn. link .

question link : https://online.codingblocks.com/player/3066/content/323

my code link :
https://ide.codingblocks.com/#/s/14316

Hey Aditya ! your code is giving wrong output for p=0 and p=1 , so just fix this .