# STABLEMP STABLEMP

hola amigos,
i could not find out wts the problem with this code for stable marriage problem which is pretty straight forward.any help will be appreciated.
#include
#include
#include
#include
#include<stdlib.h>

using namespace std;

int n;

bool preferw(int w,int m,int m1,int n,int* wo)
{
for(int i=1;i<n;i++)
{
if(((wo+w(n-1) + i))==m)return true;
if(((wo+w(n-1) + i))==m1)return false;
}
return false;
}

bool preferm(int m,int w,int w1,int n,int* me)
{
for(int i=1;i<n;i++)
{
if(((me+m(n-1) + i))==w)return true;
if(((me+m(n-1) + i))==w1)return false;
}
return false;
}

int main() {
int tn=0;
cin>>tn;
while (tnâ€“) {
int i,j=0;
cin>>n;int x;
int wo[n+1][n+1];int me[n+1][n+1];
for(i=1;i<=n;i++)
{ cin>>x;
for(j=1;j<=n;j++)cin>>wo[i][j];
}

``````for(i=1;i<=n;i++)
{	cin>>x;
for(j=1;j<=n;j++)cin>>me[i][j];
}
int husbandof[n+1]={1};
int wifeof[n+1]={1};
int w,m=1;int a=0;
for(w=1;w<=n;w++)
{
for(m=1;m<=n;m++)
{
if(preferw(w,m,husbandof[w],n+1,(int* )wo)==true && preferm(m,w,wifeof[m],n+1,(int* )me)== true)
husbandof[w]=m;wifeof[m]=w;cout<<a++<<endl;
}
}
for(m=1;m<=n;m++)cout << " " << m << " "<<wifeof[m] << endl;
}
return 0;
``````

}