#include
#include
using namespace std;
int main() {
int n,i,key,p,q,sum;
cin>>n;
int a[1000];
for (i=1;i<=n;i++){
cin>>a[i];
}
cin>>key;
sort (a,a+n);
p=0;
q=n-1;
while(p<q){
sum=a[p]+a[q];
if (sum==key){
cout<<a[p]<<" and "<<a[q]<<endl;;
p++;
q–;
}
else if (sum>key){
q–;
}
else {
p++;
}
}
return 0;
}
only test case 0 is passing although output is coming out to be correct