6th test case failing:BIRTHDAY PARADOX

problem: https://hack.codingblocks.com/contests/c/255/827
my solution https://ide.codingblocks.com/#/s/25758

Take care of case when p=1.