#include <bits/stdc++.h>
usingnamespace std;
typedef map<int,int>::iterator it;
int main(int argc, char** argv) {
vector <int>y;//main
map<int,int>first;
int f,s;//f is the length of the first array
//s is the length of the second array
int total=0;
int num;
cin>>f;
cin>>s;
for(int i = 0; i < f;i++){
cin>>num;
first[num]++;//used to increment the value ... will be used later to speed up the process
}
for(int i=0; i < s;i++){
cin>>num;
y.push_back(num);
}
for(int i=0;i<s;i++){
for(it j=first.begin();j!=first.end();j++){
if(y[i] < (j->first) || y[i] == j->first){
total++;
}
cout<<total<<" ";
total=0;
}
cout<<endl;
return 0;
}
is there a problem with comparing if(y[i] < (j->first) || y[i] == j->first) because the total comes back to me wrong.