Array Sum Triplets Doubt

Please tell what should I do in this problem as I am getting a tle.

you are getting TLE because once you find target sum, you are not updating l and r.
Also debug your code as left and right are not declared!

https://ide.codingblocks.com/s/229998 Now also I am getting an error .


here is corrected version, now think of removing duplicates!, you may refer to editorial as well.