/** MAP === Declaration ----------- map< KEY , VALUE > MAP Different type of possible variations of declaring MAP . 1. mapMAP1; 2. mapMAP2; 3. map >MAP3; There can be many many more ways of declaring maps Operations ---------- ALMOST identical to all the functions of STL SET. **/ /** Which of the favors of your Lord will you deny ? **/ #include using namespace std; #define LL long long #define PII pair #define PLL pair #define MP make_pair #define F first #define S second #define INF INT_MAX #define ALL(x) (x).begin(), (x).end() #define DBG(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << endl #define READ freopen("alu.txt", "r", stdin) #define WRITE freopen("vorta.txt", "w", stdout) #include #include using namespace __gnu_pbds; templateusing indexed_set = tree,rb_tree_tag, tree_order_statistics_node_update>; /** PBDS ------------------------------------------------- 1) insert(value) 2) erase(value) 3) order_of_key(value) // 0 based indexing 4) *find_by_order(position) // 0 based indexing **/ template ostream &operator <<(ostream &os, pair&p); template ostream &operator <<(ostream &os, vector&v); template ostream &operator <<(ostream &os, set&v); inline void optimizeIO() { ios_base::sync_with_stdio(false); cin.tie(NULL); } const int nmax = 2e5+7; const LL LINF = 1e17; template string to_str(T x) { stringstream ss; ss<MAP1; MAP1[10] = 5; MAP1[5] = 15; MAP1[2] = 45; for(auto x:MAP1) cout<MAP2; MAP2[ {10,5} ] = 5; MAP2[ {5,2} ] = 15; MAP2[ {2,12} ] = 45; for(auto x:MAP2) cout< >MAP3; MAP3["A"].push_back(15); MAP3["A"].push_back(5); MAP3["B"].push_back(10); MAP3["B"].push_back(2); for(auto x:MAP3) { cout< ostream &operator <<(ostream &os, pair&p) { os<<"{"< ostream &operator <<(ostream &os, vector&v) { os<<"[ "; for(int i=0; i ostream &operator <<(ostream &os, set&v) { os<<"[ "; for(T i:v) { os<