#include #include using namespace std; int main(void){ int n, k, q; cin >> n >> k >> q; int qnum; string s, t; int d; vector A, asa; int solt = 0; for (int i = 0; i < q; i++) { cin >> qnum; if (qnum == 1) { cin >> s; A.push_back(s); } else if (qnum == 2) { solt = 0; for (int a = 0; a < 6; a++) { int m = (int)A.size(); cin >> t >> d; for (int j = m-1; j >= m-n; j--) { if (A[j] == t) { solt += min(d, k); break; } else if (j == m-n) { solt += d; } } if (solt <= 60) { asa.push_back(t); } } cout << asa.size() << endl; copy(asa.begin(), asa.end(), back_inserter(A)); asa.clear(); } } }