fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n,m; cin >> n >> m;
  6. string s,c,i;
  7. unordered_map<string,string> ser;
  8.  
  9. for(int j=0;j<n;j++){
  10. cin >> s >> i;
  11. ser.emplace(i+";",s);
  12. }
  13. for(int j=0;j<m;j++){
  14. cin >> c >> i;
  15. cout << c << " " << i << " #" << ser.find(i)->second << endl;
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 5280KB
stdin
3 5
google 8.8.8.8
codeforces 212.193.33.27
server 138.197.64.57
redirect 138.197.64.57;
block 8.8.8.8;
cf 212.193.33.27;
unblock 8.8.8.8;
check 138.197.64.57;
stdout
redirect 138.197.64.57; #server
block 8.8.8.8; #google
cf 212.193.33.27; #codeforces
unblock 8.8.8.8; #google
check 138.197.64.57; #server