When I tried to run the program, it just crashes straight away. Could anyone please help me debug this?

int SimpleAlgo3 (int &n, int &d, vector< vector<float> > &point)
{
vector<bool> interest(n+10, false);
vector<bool> useless(n+10, false);
vector<bool> compare(n+10, false);
int count=0;
sort(point.begin(), point.end());
int k=0;
if(point[n][k]>point[n-1][k]) {
interest[n]=true;
}// if closed
else {

int i=n;
compare[i]=true;
for(int j=n-1; j>0; j--) {
if(point[i][k]==point[j][k]) {
compare[j]=true;
} //if closed
else
break;
} //for closed
if(d==1) {
for(int i=n; i>0; i--) {
if(compare[i])
count++;
else
break;
} //for closed
} //if closed
else {
for(int i=n-1; i>0; i--) {
if(compare[i]==false)
break;
for(int j=n-1; j>0; j--) {
if(compare[j]==false)
break;
bool worse_somewhere=false; // This variable will be true if p_i is worse than p_j in some coordinate; i.e., there is k such that p_i[k]<p_j[k]

for (int k=1; k<d; k++) {
if (point[i][k]<point[j][k]) {
worse_somewhere=true;
break;
} //if closed
}
// if point[i] is worse than point[j] at coordinate k then we set worse_somewhere to be true

bool not_better=true; // This variable will be true if p_i is note better than p_j in all coordinate; i.e., for all k, p_i[k]<=p_j[k]
for (int k=1; k<d; k++) {
if (point[i][k]>point[j][k]) {
not_better=false;
break;
} //if closed
}
// if point[i] is better than point[j], then not_better=true;

// if point[i] is not better than point[j] and point[i] is actually worse in some dimension, then point[i] is not the best
if (worse_somewhere && not_better) {
useless[i]=true;
compare[i]=false;
} //if closed

} //for closed
} //else closed
for(int i=0; i<n; i++) {
if(compare[i])
interest[i]=true;
} //for closed
vector<bool> compare(n+10, false); // resetting compare vector
} //for closed
} //else closed

if(d>1) {
for(int k=1; k<d; k++) { // finding max value of each dimension and putting them at one side for
int temp=-1; // comparing. if only 1 then it's interesting else compare to see which one is interesting
vector <int> maxvalue;
for(int i=0; i<n; i++) {
if(temp>point[i][k]) {
maxvalue.clear();
temp=point[i][k];
maxvalue.push_back(i);
}
else if(temp==point[i][k])
maxvalue.push_back(i);
}
if(maxvalue.size()==1) {
temp=maxvalue[0];
interest[temp]=true;
}
else {
for(int i=0; i<maxvalue.size(); i++) {
temp=maxvalue[i];
compare[temp]=true;
}
for(int i=0; i<n; i++) {
if(compare[i]) {
for(int j=0; j<n;j++) {
if(compare[j]) {

bool worse_somewhere=false;
for (int k=0; k<d; k++) {
if (point[i][k]<point[j][k]) {
worse_somewhere=true;
break;
}
}
bool not_better=true;
for (int k=0; k<d; k++) {
if (point[i][k]>point[j][k]) {
not_better=false;
break;
}
}

if (worse_somewhere && not_better) {
useless[i]=true;
compare[i]=false;
}
}
}
}
}
}
for(int i=0; i<n; i++) {
if(compare[i])
interest[i]=true;
}
vector<bool> compare(n+10, false); //resetting compare vector
}
} // up till now i have taken out all the max values of each column and identified them as intereesting
// now i will start to compare the remaining values that are unidentified with the interesting ones first
for(int i=0; i<n; i++) {
if(interest[i]==false && useless[i]==false) {
for(int j=0; j<n; j++) {
if(interest[j]==true) {

bool worse_somewhere=false;

for (int k=0; k<d; k++) {
if (point[i][k]<point[j][k]) {
worse_somewhere=true;
break;
}
}

bool not_better=true;
for (int k=0; k<d; k++) {
if (point[i][k]>point[j][k]) {
not_better=false;
break;
}
}
if (worse_somewhere && not_better) {
useless[i]=true;
break;
}
}
}
}
}
for(int i=0; i<n; i++) {
if(interest[i]==false && useless[i]==false) {
for(int j=0; j<n; j++) {
if((interest[j]==false) && (i!=j)) {
bool worse_somewhere=false;
for (int k=0; k<d; k++) {
if (point[i][k]<point[j][k]) {
worse_somewhere=true;
break;
}
}
bool not_better=true;
for (int k=0; k<d; k++) {
if (point[i][k]>point[j][k]) {
not_better=false;
break;
}
}
if (worse_somewhere && not_better) {
useless[i]=true;
break;
}
}
}
if(useless[i]==false)
interest[i]=true;
}
}
for(int i=0; i<n; i++) {
if(interest[i])
count++;
}
return count;
}