C++ Solution with Map and Set (beats 80.07% in time)
\nclass Solution {\npublic:\n    vector<vector<string>> displayTable(vector<vector<string>>& orders) {\n        vector<vector<string>> table;\n        \n       
```\nclass Solution {\npublic:\n    vector<vector<string>> displayTable(vector<vector<string>>& orders) {\n        vector<vector<string>> table;\n        \n        map<string, vector<int>> food;\n        \n        set<int> s;\n        \n        \n        for (int i = 0; i < orders.size(); ++i) {\n            s.insert(stoi(orders[i][1]));\n            food[orders[i][2]].push_back(stoi(orders[i][1]));\n        }\n        \n        vector<string> foods(food.size()+1);\n        foods[0] = "Table";\n        auto it = food.begin();\n        \n        int index = 1;\n        \n        while (it != food.end()) {\n            foods[index] = it->first;\n            it++;\n            index++;\n        }\n        \n        it = food.begin();\n        \n        sort(foods.begin() + 1, foods.end());\n        \n        table.push_back(foods);\n        \n        auto it2 = s.begin();\n        \n        index = 0;\n        \n        for (int i = 0; i < s.size(); ++i) {\n            vector<string> current_order(foods.size());\n            current_order[0] = to_string(*it2);\n            index = 1;\n            while (it != food.end()) {\n                int num_occurences = count(it->second.begin(), it->second.end(), *it2);\n                current_order[index] = to_string(num_occurences);\n                it++;\n                index++;\n            }\n            table.push_back(current_order);\n            it2++;\n            it = food.begin(); \n        }\n        return table;\n    }\n};\n```
[]