#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>
#define endl '\n'
using namespace std;
vector<int> solution(vector<string> id_list, vector<string> report, int k) {
vector<int> answer;
sort(report.begin(), report.end());
report.erase(unique(report.begin(),report.end()),report.end());
vector<string> report_list[id_list.size()];
map<string, int> mymap;
map<string, vector<string>> reporting_list;
int id_cnt = id_list.size();
int *report_cnt = new int[id_cnt];
for(int i =0;i<id_cnt;i++){
mymap[id_list[i]] = 0;
}
//cout << report.size();
for(int i = 0;i<report.size();i++)
{
string str = report[i];
string user;
string reported;
int blankIdx = str.find(" ");
user = str.substr(0,blankIdx);
reported = str.substr(blankIdx+1);
mymap[reported]++;
reporting_list[user].push_back(reported);
}
for(int i =0;i<id_cnt;i++){
string user = id_list[i];
int reporting_cnt = reporting_list[user].size();
int result = 0;
for(int j = 0;j<reporting_cnt;j++)
{
if(mymap[reporting_list[user][j]]>=k)
result++;
}
answer.push_back(result);
}
return answer;
}