Not understanding why my solution is wrong

Friends pairing problem

please share your code though ide.codingblocks.com