Target sum pairs problem

The code executed perfectly for two test cases but it seems to fail on the third one. I even checked it for the negative numbers. Please have a look at it and provide me a solution.
here’s the link to my code: