I submitted this
(http://www.codechef.com/viewsolution/993482) for the [Stable Marriage Problem](http://www.codechef.com/problems/STABLEMP), but I am getting WA. I am unable to figure out the problem with the logic. Some helpful points about the code: 1. The matrix **w** contains the preferences of the women. An entry w[i][j] stores the preference number of the ith woman for jth man. 2. The matrix **m** contains the preferences of men, but in a different way. An entry m[i][j] stores the number of the woman that the ith man prefers at jth position in his preference list, i.e, if m=5, then the 5th woman is the 1st man's 2nd choice. 3. The array **wom** contains the list of men that the women are married to. wom[i] contains the number of the man that the ith woman is married to. 4. The aray **man** contains the list of womean that the men are married to, but in a different way. If man=4, then that means the 3rd man is married to the woman who is his 4th preference.