fork download
  1. int duplicates(vector<string>name, vector<int>weight, vector<int>price){
  2. unordered_map<string,pair<int,int>m;
  3. unordered_map<string,int>freq;
  4. int count = 0;
  5. for(int i=0;i<name.size();i++){
  6. m[name[i]] = make_pair(weight[i], price[i]);
  7. if(m.find(name[i].first)!=m.end() && name[i].second)!=m.end()){
  8. freq[name[i]]++;
  9. }
  10. }
  11. for(auto p: freq){
  12. if(p.second>1){
  13. count++;
  14. }
  15. }
  16. return count;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:16: error: ‘vector’ was not declared in this scope
 int duplicates(vector<string>name, vector<int>weight, vector<int>price){
                ^~~~~~
prog.cpp:1:23: error: ‘string’ was not declared in this scope
 int duplicates(vector<string>name, vector<int>weight, vector<int>price){
                       ^~~~~~
prog.cpp:1:23: note: suggested alternative: ‘struct’
 int duplicates(vector<string>name, vector<int>weight, vector<int>price){
                       ^~~~~~
                       struct
prog.cpp:1:30: error: ‘name’ was not declared in this scope
 int duplicates(vector<string>name, vector<int>weight, vector<int>price){
                              ^~~~
prog.cpp:1:36: error: ‘vector’ was not declared in this scope
 int duplicates(vector<string>name, vector<int>weight, vector<int>price){
                                    ^~~~~~
prog.cpp:1:43: error: expected primary-expression before ‘int’
 int duplicates(vector<string>name, vector<int>weight, vector<int>price){
                                           ^~~
prog.cpp:1:55: error: ‘vector’ was not declared in this scope
 int duplicates(vector<string>name, vector<int>weight, vector<int>price){
                                                       ^~~~~~
prog.cpp:1:62: error: expected primary-expression before ‘int’
 int duplicates(vector<string>name, vector<int>weight, vector<int>price){
                                                              ^~~
prog.cpp:1:71: error: expression list treated as compound expression in initializer [-fpermissive]
 int duplicates(vector<string>name, vector<int>weight, vector<int>price){
                                                                       ^
stdout
Standard output is empty