Friends pairing problem

Wrong asnwer giving

code is correct only change you have to done is
use long long int instead of int
because ans limit can exceed the range of int
for n=30 ans is 606917269909048576

which will definitely overflow int

if you want to ask something about this feel free to ask
i hope this helps
if yes show your response with :heart: and don’t forgot to mark doubt as resolved