#include
#include
#include<unordered_map>
using namespace std;
int main()
{
int n,target;
cin>>n;
long long a[n];
unordered_map<int,int>ans;
for(int i=0;i<n;i++)
{
cin>>a[i];
ans[a[i]]++;
}
cin>>target;
sort(a,a+n);
for(int i=0;i<n;i++)
{
int x=target-a[i];
if(ans[x]>0 && ans[a[i]]>0)
{
ans[x]--;
ans[a[i]]--;
if(a[i]<=x)
cout<<a[i]<<" and "<<x<<endl;
else
cout<<x<<" and "<<a[i]<<endl;
}
}
return 0;
}
for the third case it is giving wrong answer
please tell where i am making mistake in this code.