C++ 2-liner (count_if)
cpp\nint countMatches(vector<vector<string>>& items, string key, string val) {\n    int idx = key == "type" ? 0 : key == "color" ? 1 : 2;\n    return count_if(b
```cpp\nint countMatches(vector<vector<string>>& items, string key, string val) {\n    int idx = key == "type" ? 0 : key == "color" ? 1 : 2;\n    return count_if(begin(items), end(items), [&](const auto &i) { return i[idx] == val; });\n}\n```
[]