heyy i m getting one test case as wrong answer. can you tell me which of the test inputs its not passing?
#include
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,m,left,right,i;
cin>>n;
int arr[n];
for(i=0;i<n;i++)
{
cin>>arr[i];
}
cin>>m;
sort(arr,arr+n);
i=0;
while(i<n-2)
{
left=i+1, right=n-1;
while(left<right)
{
if(arr[left]+arr[right]==m-arr[i])
{
cout<<arr[i]<<", "<<arr[left]<<" and "<<arr[right]<<endl;
left++;
right--;
}
else if(arr[left]+arr[right]>m-arr[i])
{
right--;
}
else
{
left++;
}
}
i++;
}
return 0;
}