Its showing test cases are not passes

#include
using namespace std;

int main()
{
int N;
cin>>N;
int a [N];
for(int i=0;i<N;i++){
cin>>a[i];
}

int k;
cin>>k;
for(int i=0;i<N;i++){
int left=i;
int right=left+1;
while(right<N){
    if(a[left]+a[right]==k){
        cout<<a[left]<<"and"<< a[right]<<"\n";
    }
    right++;
}
    
}

return 0;

}

i have corrected your code and added comments please check,