Policy based data structures (PBDS)
Implement set with the ability to know index of item --> data structure order statistics tree, (unfortunately only available for the GNU C++) g++ compiler supports some data structures that are not part of standard C++ library ---> such structures are called policy-based data structures #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace __gnu_pbds ; template < typename Key , // Key type typename Mapped , // Mapped-policy --> USE null_type for sets (bcz no mapping) typename Cmp_Fn = less < Key >, // Key comparison functor typename Tag = rb_tree_tag , // Specifies which underlying data structure to use class Node_Update = null_node_update , // A policy for updating node invariants > Node_Update — class denotes policy for updating node invariants. By default, set to null_node_update , i.e, a...