Can anyone point out what’s wrong with my code:
#include <cstdio>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> inp,ins,p,q;
vector<int>::iterator mn;
int main(){
freopen(".in","r",stdin);
freopen(".out","w",stdout);
int n,k,m,l,c=0;
scanf("%d %d",&n,&k);
scanf("%d",&m);
for(int j=0;j<m;j++){
scanf("%d",&l);
p.push_back(l);
}
sort(p.begin(),p.end());
for(int i=1;i<n;i++){
scanf("%d",&m);
for(int j=0;j<m;j++){
scanf("%d",&l);
inp.push_back(l);
}
sort(inp.begin(),inp.end());
mn=set_intersection(inp.begin(),inp.end(),p.begin(),p.end(),ins.begin());
if((int)ins.size()>=k){
c++;
mn=set_union(p.begin(),p.end(),ins.begin(),ins.end(),q.begin());
p.assign(q.begin(),q.end());
sort(p.begin(),p.end());
}
ins.clear();
inp.clear();
q.clear();
}
printf("%d",c);
return 0;
}