#include #include #include #include #include #include using namespace std; using ll=long long; struct Queries{ ll T,X,Y; }; class Mode{ private: unordered_map place; vector count; vector> S; multiset max_S; public: Mode(ll M,unordered_map& um,vector& A){ place=um; S.resize(um.size()); count.resize(M,0); for(ll i=0;i>N>>M; vector a(M); for(ll i=0;i>a.at(i); } vector b=a; ll Q; cin>>Q; vector query(Q); for(ll i=0;i>query.at(i).T>>query.at(i).X>>query.at(i).Y; if(query.at(i).T==1){ b.push_back(b.at(query.at(i).X-1)); b.at(query.at(i).X-1)+=query.at(i).Y; }else if(query.at(i).T==2){ b.push_back(b.at(query.at(i).X-1)); b.at(query.at(i).X-1)-=query.at(i).Y; } } b.push_back(0); sort(b.begin(),b.end()); unordered_map place; place.insert(make_pair(b.at(0),0)); ll cnt=1; for(ll i=1;i