MY CODE FOR DIAMETER IS NOT GIVING CORRECT ANSWER.PLS MARK MY MISTAKE

my code–>https://onlinegdb.com/ubNjkp3dd

see this

i have written the same but on gfg it is not accepting my solution .

pls reply to my doubt