@aibp-runners/cpp 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -2
- package/engine/clang-wasi/NOTICE +13 -0
- package/engine/clang-wasi/dist/clang.js +2 -0
- package/engine/clang-wasi/dist/clang.wasm +4 -0
- package/engine/clang-wasi/dist/include.json +1 -0
- package/engine/clang-wasi/dist/lld.js +2 -0
- package/engine/clang-wasi/dist/lld.wasm +0 -0
- package/engine/clang-wasi/dist/sysroot.tar +4 -0
- package/package.json +46 -3
- package/src/compile.ts +188 -0
- package/src/emscripten.d.ts +33 -0
- package/src/index.ts +193 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"files":{"include/bits/stdc++.h":"// libc++ 向け bits/stdc++.h(GCC の GNU 拡張は含めない)\n#include <algorithm>\n#include <array>\n#include <bitset>\n#include <cassert>\n#include <cctype>\n#include <cerrno>\n#include <cfloat>\n#include <climits>\n#include <clocale>\n#include <cmath>\n#include <complex>\n#include <cstdarg>\n#include <cstddef>\n#include <cstdint>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <ctime>\n#include <cwchar>\n#include <cwctype>\n#include <deque>\n#include <exception>\n#include <fstream>\n#include <functional>\n#include <iomanip>\n#include <ios>\n#include <iosfwd>\n#include <iostream>\n#include <istream>\n#include <iterator>\n#include <limits>\n#include <list>\n#include <locale>\n#include <map>\n#include <memory>\n#include <new>\n#include <numeric>\n#include <ostream>\n#include <queue>\n#include <random>\n#include <regex>\n#include <set>\n#include <sstream>\n#include <stack>\n#include <stdexcept>\n#include <streambuf>\n#include <string>\n#include <typeinfo>\n#include <utility>\n#include <valarray>\n#include <vector>\n\n#if __cplusplus >= 201103L\n#include <atomic>\n#include <chrono>\n#include <codecvt>\n#include <forward_list>\n#include <initializer_list>\n#include <ratio>\n#include <scoped_allocator>\n#include <system_error>\n#include <tuple>\n#include <type_traits>\n#include <typeindex>\n#include <unordered_map>\n#include <unordered_set>\n#if defined(__has_include)\n#if __has_include(<condition_variable>)\n#include <condition_variable>\n#endif\n#if __has_include(<future>)\n#include <future>\n#endif\n#if __has_include(<mutex>)\n#include <mutex>\n#endif\n#if __has_include(<thread>)\n#include <thread>\n#endif\n#endif\n#endif\n\n#if __cplusplus >= 201402L\n#if defined(__has_include)\n#if __has_include(<shared_mutex>)\n#include <shared_mutex>\n#endif\n#endif\n#endif\n\n#if __cplusplus >= 201703L\n#include <any>\n#include <charconv>\n#include <optional>\n#include <string_view>\n#include <variant>\n#if defined(__has_include)\n#if __has_include(<filesystem>)\n#include <filesystem>\n#endif\n#if __has_include(<memory_resource>)\n#include <memory_resource>\n#endif\n#endif\n#endif\n\n#if __cplusplus >= 202002L\n#if defined(__has_include)\n#if __has_include(<barrier>)\n#include <barrier>\n#endif\n#if __has_include(<bit>)\n#include <bit>\n#endif\n#if __has_include(<compare>)\n#include <compare>\n#endif\n#if __has_include(<concepts>)\n#include <concepts>\n#endif\n#if __has_include(<coroutine>)\n#include <coroutine>\n#endif\n#if __has_include(<format>)\n#include <format>\n#endif\n#if __has_include(<latch>)\n#include <latch>\n#endif\n#if __has_include(<numbers>)\n#include <numbers>\n#endif\n#if __has_include(<ranges>)\n#include <ranges>\n#endif\n#if __has_include(<semaphore>)\n#include <semaphore>\n#endif\n#if __has_include(<source_location>)\n#include <source_location>\n#endif\n#if __has_include(<span>)\n#include <span>\n#endif\n#if __has_include(<stop_token>)\n#include <stop_token>\n#endif\n#if __has_include(<syncstream>)\n#include <syncstream>\n#endif\n#if __has_include(<version>)\n#include <version>\n#endif\n#endif\n#endif\n\n#if __cplusplus >= 202302L\n#if defined(__has_include)\n#if __has_include(<expected>)\n#include <expected>\n#endif\n#if __has_include(<flat_map>)\n#include <flat_map>\n#endif\n#if __has_include(<flat_set>)\n#include <flat_set>\n#endif\n#if __has_include(<mdspan>)\n#include <mdspan>\n#endif\n#if __has_include(<print>)\n#include <print>\n#endif\n#if __has_include(<spanstream>)\n#include <spanstream>\n#endif\n#if __has_include(<stacktrace>)\n#include <stacktrace>\n#endif\n#if __has_include(<stdfloat>)\n#include <stdfloat>\n#endif\n#endif\n#endif\n","include/bits/extc++.h":"// libc++ 向け bits/extc++.h(stdc++.h + pb_ds。rope / slist 等の GNU 拡張は含めない)\n#include <bits/stdc++.h>\n#include <ext/pb_ds/assoc_container.hpp>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/hash_policy.hpp>\n#include <ext/pb_ds/list_update_policy.hpp>\n#include <ext/pb_ds/priority_queue.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/trie_policy.hpp>\n","include/bits/cpp_type_traits.h":"// The -*- C++ -*- type traits classes for internal use in libstdc++\n\n// Copyright (C) 2000-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 3, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n/** @file bits/cpp_type_traits.h\n * This is an internal header file, included by other library headers.\n * Do not attempt to use it directly. @headername{ext/type_traits.h}\n */\n\n// Written by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>\n\n#ifndef _CPP_TYPE_TRAITS_H\n#define _CPP_TYPE_TRAITS_H 1\n\n#ifdef _GLIBCXX_SYSHDR\n#pragma GCC system_header\n#endif\n\n#include <bits/c++config.h>\n#include <bits/version.h>\n#if __glibcxx_type_trait_variable_templates\n# include <type_traits> // is_same_v, is_integral_v\n#endif\n\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wlong-long\"\n\n//\n// This file provides some compile-time information about various types.\n// These representations were designed, on purpose, to be constant-expressions\n// and not types as found in <bits/type_traits.h>. In particular, they\n// can be used in control structures and the optimizer hopefully will do\n// the obvious thing.\n//\n// Why integral expressions, and not functions nor types?\n// Firstly, these compile-time entities are used as template-arguments\n// so function return values won't work: We need compile-time entities.\n// We're left with types and constant integral expressions.\n// Secondly, from the point of view of ease of use, type-based compile-time\n// information is -not- *that* convenient. One has to write lots of\n// overloaded functions and to hope that the compiler will select the right\n// one. As a net effect, the overall structure isn't very clear at first\n// glance.\n// Thirdly, partial ordering and overload resolution (of function templates)\n// is highly costly in terms of compiler-resource. It is a Good Thing to\n// keep these resource consumption as least as possible.\n//\n// See valarray_array.h for a case use.\n//\n// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06.\n//\n// Update 2005: types are also provided and <bits/type_traits.h> has been\n// removed.\n//\n\nextern \"C++\" {\n\nnamespace std _GLIBCXX_VISIBILITY(default)\n{\n_GLIBCXX_BEGIN_NAMESPACE_VERSION\n\n struct __true_type { };\n struct __false_type { };\n\n template<bool>\n struct __truth_type\n { typedef __false_type __type; };\n\n template<>\n struct __truth_type<true>\n { typedef __true_type __type; };\n\n // N.B. The conversions to bool are needed due to the issue\n // explained in c++/19404.\n template<class _Sp, class _Tp>\n struct __traitor\n {\n enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };\n typedef typename __truth_type<__value>::__type __type;\n };\n\n // Compare for equality of types.\n template<typename, typename>\n struct __are_same\n {\n enum { __value = 0 };\n typedef __false_type __type;\n };\n\n template<typename _Tp>\n struct __are_same<_Tp, _Tp>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n //\n // Integer types\n //\n template<typename _Tp>\n struct __is_integer\n {\n enum { __value = 0 };\n typedef __false_type __type;\n };\n\n // Explicit specializations for the standard integer types.\n // Up to four target-specific __int<N> types are supported as well.\n template<>\n struct __is_integer<bool>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<char>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<signed char>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<unsigned char>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n# ifdef __WCHAR_TYPE__\n template<>\n struct __is_integer<wchar_t>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n# endif\n\n#ifdef _GLIBCXX_USE_CHAR8_T\n template<>\n struct __is_integer<char8_t>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif\n\n#if __cplusplus >= 201103L\n template<>\n struct __is_integer<char16_t>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<char32_t>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif\n\n template<>\n struct __is_integer<short>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<unsigned short>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<int>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<unsigned int>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<long>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<unsigned long>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<long long>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_integer<unsigned long long>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n#define __INT_N(TYPE) \t\t\t\\\n __extension__\t\t\t\t\\\n template<>\t\t\t\t\\\n struct __is_integer<TYPE>\t\t\\\n {\t\t\t\t\t\\\n enum { __value = 1 };\t\t\\\n typedef __true_type __type;\t\\\n };\t\t\t\t\t\\\n __extension__\t\t\t\t\\\n template<>\t\t\t\t\\\n struct __is_integer<unsigned TYPE>\t\\\n {\t\t\t\t\t\\\n enum { __value = 1 };\t\t\\\n typedef __true_type __type;\t\\\n };\n\n#ifdef __GLIBCXX_TYPE_INT_N_0\n__INT_N(__GLIBCXX_TYPE_INT_N_0)\n#endif\n#ifdef __GLIBCXX_TYPE_INT_N_1\n__INT_N(__GLIBCXX_TYPE_INT_N_1)\n#endif\n#ifdef __GLIBCXX_TYPE_INT_N_2\n__INT_N(__GLIBCXX_TYPE_INT_N_2)\n#endif\n#ifdef __GLIBCXX_TYPE_INT_N_3\n__INT_N(__GLIBCXX_TYPE_INT_N_3)\n#endif\n\n#undef __INT_N\n\n //\n // Floating point types\n //\n template<typename _Tp>\n struct __is_floating\n {\n enum { __value = 0 };\n typedef __false_type __type;\n };\n\n // three specializations (float, double and 'long double')\n template<>\n struct __is_floating<float>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_floating<double>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_floating<long double>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n#ifdef __STDCPP_FLOAT16_T__\n template<>\n struct __is_floating<_Float16>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif\n\n#ifdef __STDCPP_FLOAT32_T__\n template<>\n struct __is_floating<_Float32>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif\n\n#ifdef __STDCPP_FLOAT64_T__\n template<>\n struct __is_floating<_Float64>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif\n\n#ifdef __STDCPP_FLOAT128_T__\n template<>\n struct __is_floating<_Float128>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif\n\n#ifdef __STDCPP_BFLOAT16_T__\n template<>\n struct __is_floating<__gnu_cxx::__bfloat16_t>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif\n\n //\n // An arithmetic type is an integer type or a floating point type\n //\n template<typename _Tp>\n struct __is_arithmetic\n : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >\n { };\n\n //\n // For use in std::copy and std::find overloads for streambuf iterators.\n //\n template<typename _Tp>\n struct __is_char\n {\n enum { __value = 0 };\n typedef __false_type __type;\n };\n\n template<>\n struct __is_char<char>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n#ifdef __WCHAR_TYPE__\n template<>\n struct __is_char<wchar_t>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif\n\n template<typename _Tp>\n struct __is_byte\n {\n enum { __value = 0 };\n typedef __false_type __type;\n };\n\n template<>\n struct __is_byte<char>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_byte<signed char>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n template<>\n struct __is_byte<unsigned char>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n\n#ifdef __glibcxx_byte // C++ >= 17\n enum class byte : unsigned char;\n\n template<>\n struct __is_byte<byte>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif // C++17\n\n#ifdef _GLIBCXX_USE_CHAR8_T\n template<>\n struct __is_byte<char8_t>\n {\n enum { __value = 1 };\n typedef __true_type __type;\n };\n#endif\n\n // A type that is safe for use with memcpy, memmove, memcmp etc.\n template<typename _Tp>\n struct __is_nonvolatile_trivially_copyable\n {\n enum { __value = __is_trivially_copyable(_Tp) };\n };\n\n // Cannot use memcpy/memmove/memcmp on volatile types even if they are\n // trivially copyable, so ensure __memcpyable<volatile int*, volatile int*>\n // and similar will be false.\n template<typename _Tp>\n struct __is_nonvolatile_trivially_copyable<volatile _Tp>\n {\n enum { __value = 0 };\n };\n\n // Whether two iterator types can be used with memcpy/memmove.\n template<typename _OutputIter, typename _InputIter>\n struct __memcpyable\n {\n enum { __value = 0 };\n };\n\n // Allow memcpy when source and destination are pointers to the same type.\n template<typename _Tp>\n struct __memcpyable<_Tp*, _Tp*>\n : __is_nonvolatile_trivially_copyable<_Tp>\n { };\n\n // Source pointer can be const.\n template<typename _Tp>\n struct __memcpyable<_Tp*, const _Tp*>\n : __is_nonvolatile_trivially_copyable<_Tp>\n { };\n\n template<typename _Tp> struct __memcpyable_integer;\n\n // For heterogeneous types, allow memcpy between equal-sized integers.\n // N.B. we cannot do the same for equal-sized enums, they're not assignable.\n // We cannot do it for pointers, because derived-to-base can adjust offset.\n template<typename _Tp, typename _Up>\n struct __memcpyable<_Tp*, _Up*>\n {\n enum {\n\t__value = __memcpyable_integer<_Tp>::__width != 0\n\t\t && ((int)__memcpyable_integer<_Tp>::__width\n\t\t\t == (int)__memcpyable_integer<_Up>::__width)\n };\n };\n\n // Specialization for const U* because __is_integer<const U> is never true.\n template<typename _Tp, typename _Up>\n struct __memcpyable<_Tp*, const _Up*>\n : __memcpyable<_Tp*, _Up*>\n { };\n\n template<typename _Tp>\n struct __memcpyable_integer\n {\n enum {\n\t__width = __is_integer<_Tp>::__value ? (sizeof(_Tp) * __CHAR_BIT__) : 0\n };\n };\n\n // Cannot memcpy volatile memory.\n template<typename _Tp>\n struct __memcpyable_integer<volatile _Tp>\n { enum { __width = 0 }; };\n\n // Specializations for __intNN types with padding bits.\n#if defined __GLIBCXX_TYPE_INT_N_0 && __GLIBCXX_BITSIZE_INT_N_0 % __CHAR_BIT__\n __extension__\n template<>\n struct __memcpyable_integer<__GLIBCXX_TYPE_INT_N_0>\n { enum { __width = __GLIBCXX_BITSIZE_INT_N_0 }; };\n __extension__\n template<>\n struct __memcpyable_integer<unsigned __GLIBCXX_TYPE_INT_N_0>\n { enum { __width = __GLIBCXX_BITSIZE_INT_N_0 }; };\n#endif\n#if defined __GLIBCXX_TYPE_INT_N_1 && __GLIBCXX_BITSIZE_INT_N_1 % __CHAR_BIT__\n __extension__\n template<>\n struct __memcpyable_integer<__GLIBCXX_TYPE_INT_N_1>\n { enum { __width = __GLIBCXX_BITSIZE_INT_N_1 }; };\n __extension__\n template<>\n struct __memcpyable_integer<unsigned __GLIBCXX_TYPE_INT_N_1>\n { enum { __width = __GLIBCXX_BITSIZE_INT_N_1 }; };\n#endif\n#if defined __GLIBCXX_TYPE_INT_N_2 && __GLIBCXX_BITSIZE_INT_N_2 % __CHAR_BIT__\n __extension__\n template<>\n struct __memcpyable_integer<__GLIBCXX_TYPE_INT_N_2>\n { enum { __width = __GLIBCXX_BITSIZE_INT_N_2 }; };\n __extension__\n template<>\n struct __memcpyable_integer<unsigned __GLIBCXX_TYPE_INT_N_2>\n { enum { __width = __GLIBCXX_BITSIZE_INT_N_2 }; };\n#endif\n#if defined __GLIBCXX_TYPE_INT_N_3 && __GLIBCXX_BITSIZE_INT_N_3 % __CHAR_BIT__\n __extension__\n template<>\n struct __memcpyable_integer<__GLIBCXX_TYPE_INT_N_3>\n { enum { __width = __GLIBCXX_BITSIZE_INT_N_3 }; };\n __extension__\n template<>\n struct __memcpyable_integer<unsigned __GLIBCXX_TYPE_INT_N_3>\n { enum { __width = __GLIBCXX_BITSIZE_INT_N_3 }; };\n#endif\n\n#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__\n // In strict modes __is_integer<__int128> is false,\n // but we want to allow memcpy between signed/unsigned __int128.\n __extension__\n template<>\n struct __memcpyable_integer<__int128> { enum { __width = 128 }; };\n __extension__\n template<>\n struct __memcpyable_integer<unsigned __int128> { enum { __width = 128 }; };\n#endif\n\n#if _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 && _GLIBCXX_LDOUBLE_IS_IEEE_BINARY64\n template<>\n struct __memcpyable<double*, long double*> { enum { __value = true }; };\n template<>\n struct __memcpyable<long double*, double*> { enum { __value = true }; };\n#endif\n\n#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)\n template<>\n struct __memcpyable<_Float32*, float*> { enum { __value = true }; };\n template<>\n struct __memcpyable<float*, _Float32*> { enum { __value = true }; };\n#endif\n\n#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)\n template<>\n struct __memcpyable<_Float64*, double*> { enum { __value = true }; };\n template<>\n struct __memcpyable<double*, _Float64*> { enum { __value = true }; };\n#endif\n\n#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)\n template<>\n struct __memcpyable<_Float128*, long double*> { enum { __value = true }; };\n template<>\n struct __memcpyable<long double*, _Float128*> { enum { __value = true }; };\n#endif\n\n // Whether two iterator types can be used with memcmp.\n // This trait only says it's well-formed to use memcmp, not that it\n // gives the right answer for a given algorithm. So for example, std::equal\n // needs to add additional checks that the types are integers or pointers,\n // because other trivially copyable types can overload operator==.\n template<typename _Iter1, typename _Iter2>\n struct __memcmpable\n {\n enum { __value = 0 };\n };\n\n // OK to use memcmp with pointers to trivially copyable types.\n template<typename _Tp>\n struct __memcmpable<_Tp*, _Tp*>\n : __is_nonvolatile_trivially_copyable<_Tp>\n { };\n\n template<typename _Tp>\n struct __memcmpable<const _Tp*, _Tp*>\n : __is_nonvolatile_trivially_copyable<_Tp>\n { };\n\n template<typename _Tp>\n struct __memcmpable<_Tp*, const _Tp*>\n : __is_nonvolatile_trivially_copyable<_Tp>\n { };\n\n // Whether memcmp can be used to determine ordering for a type\n // e.g. in std::lexicographical_compare or three-way comparisons.\n // True for unsigned integer-like types where comparing each byte in turn\n // as an unsigned char yields the right result. This is true for all\n // unsigned integers on big endian targets, but only unsigned narrow\n // character types (and std::byte) on little endian targets.\n template<typename _Tp, bool _TreatAsBytes =\n#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__\n\t__is_integer<_Tp>::__value\n#else\n\t__is_byte<_Tp>::__value\n#endif\n >\n struct __is_memcmp_ordered\n {\n static const bool __value = _Tp(-1) > _Tp(1); // is unsigned\n };\n\n template<typename _Tp>\n struct __is_memcmp_ordered<_Tp, false>\n {\n static const bool __value = false;\n };\n\n // Whether two types can be compared using memcmp.\n template<typename _Tp, typename _Up, bool = sizeof(_Tp) == sizeof(_Up)>\n struct __is_memcmp_ordered_with\n {\n static const bool __value = __is_memcmp_ordered<_Tp>::__value\n\t&& __is_memcmp_ordered<_Up>::__value;\n };\n\n template<typename _Tp, typename _Up>\n struct __is_memcmp_ordered_with<_Tp, _Up, false>\n {\n static const bool __value = false;\n };\n\n#if __cplusplus >= 201703L\n#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__\n // std::byte is not an integer, but it can be compared using memcmp.\n template<>\n struct __is_memcmp_ordered<std::byte, false>\n { static constexpr bool __value = true; };\n#endif\n\n // std::byte can only be compared to itself, not to other types.\n template<>\n struct __is_memcmp_ordered_with<std::byte, std::byte, true>\n { static constexpr bool __value = true; };\n\n template<typename _Tp, bool _SameSize>\n struct __is_memcmp_ordered_with<_Tp, std::byte, _SameSize>\n { static constexpr bool __value = false; };\n\n template<typename _Up, bool _SameSize>\n struct __is_memcmp_ordered_with<std::byte, _Up, _SameSize>\n { static constexpr bool __value = false; };\n#endif\n\n#if __glibcxx_type_trait_variable_templates\n template<typename _ValT, typename _Tp>\n constexpr bool __can_use_memchr_for_find\n // Can only use memchr to search for narrow characters and std::byte.\n = __is_byte<_ValT>::__value\n\t// And only if the value to find is an integer (or is also std::byte).\n\t && (is_same_v<_Tp, _ValT> || is_integral_v<_Tp>);\n#endif\n\n //\n // Move iterator type\n //\n template<typename _Tp>\n struct __is_move_iterator\n {\n enum { __value = 0 };\n typedef __false_type __type;\n };\n\n // Fallback implementation of the function in bits/stl_iterator.h used to\n // remove the move_iterator wrapper.\n template<typename _Iterator>\n _GLIBCXX20_CONSTEXPR\n inline _Iterator\n __miter_base(_Iterator __it)\n { return __it; }\n\n_GLIBCXX_END_NAMESPACE_VERSION\n} // namespace\n} // extern \"C++\"\n\n#pragma GCC diagnostic pop\n\n#endif //_CPP_TYPE_TRAITS_H\n","include/bits/version.h":"// Copyright (C) 2023-2025 Free Software Foundation, Inc.\n\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 3, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// DO NOT EDIT THIS FILE (version.h)\n//\n// It has been AutoGen-ed\n// From the definitions version.def\n// and the template file version.tpl\n\n/** @file bits/version.h\n * This is an internal header file, included by other library headers.\n * Do not attempt to use it directly. @headername{version}\n */\n\n// Usage guide:\n//\n// In your usual header, do something like:\n//\n// #define __glibcxx_want_ranges\n// #define __glibcxx_want_concepts\n// #include <bits/version.h>\n//\n// This will generate the FTMs you named, and let you use them in your code as\n// if it was user code. All macros are also exposed under __glibcxx_NAME even\n// if unwanted, to permit bits and other FTMs to depend on them for condtional\n// computation without exposing extra FTMs to user code.\n\n#ifdef _GLIBCXX_SYSHDR\n#pragma GCC system_header\n#endif\n\n#include <bits/c++config.h>\n\n#if !defined(__cpp_lib_incomplete_container_elements)\n# if _GLIBCXX_HOSTED\n# define __glibcxx_incomplete_container_elements 201505L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_incomplete_container_elements)\n# define __cpp_lib_incomplete_container_elements 201505L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_incomplete_container_elements) && defined(__glibcxx_want_incomplete_container_elements) */\n#undef __glibcxx_want_incomplete_container_elements\n\n#if !defined(__cpp_lib_uncaught_exceptions)\n# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 199711L))\n# define __glibcxx_uncaught_exceptions 201411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_uncaught_exceptions)\n# define __cpp_lib_uncaught_exceptions 201411L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_uncaught_exceptions) && defined(__glibcxx_want_uncaught_exceptions) */\n#undef __glibcxx_want_uncaught_exceptions\n\n#if !defined(__cpp_lib_allocator_traits_is_always_equal)\n# if (__cplusplus >= 201103L)\n# define __glibcxx_allocator_traits_is_always_equal 201411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_allocator_traits_is_always_equal)\n# define __cpp_lib_allocator_traits_is_always_equal 201411L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_allocator_traits_is_always_equal) && defined(__glibcxx_want_allocator_traits_is_always_equal) */\n#undef __glibcxx_want_allocator_traits_is_always_equal\n\n#if !defined(__cpp_lib_is_null_pointer)\n# if (__cplusplus >= 201103L)\n# define __glibcxx_is_null_pointer 201309L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_null_pointer)\n# define __cpp_lib_is_null_pointer 201309L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_null_pointer) && defined(__glibcxx_want_is_null_pointer) */\n#undef __glibcxx_want_is_null_pointer\n\n#if !defined(__cpp_lib_result_of_sfinae)\n# if (__cplusplus >= 201103L)\n# define __glibcxx_result_of_sfinae 201210L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_result_of_sfinae)\n# define __cpp_lib_result_of_sfinae 201210L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_result_of_sfinae) && defined(__glibcxx_want_result_of_sfinae) */\n#undef __glibcxx_want_result_of_sfinae\n\n#if !defined(__cpp_lib_shared_ptr_arrays)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_shared_ptr_arrays 201707L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_ptr_arrays)\n# define __cpp_lib_shared_ptr_arrays 201707L\n# endif\n# elif (__cplusplus >= 201103L) && _GLIBCXX_HOSTED\n# define __glibcxx_shared_ptr_arrays 201611L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_ptr_arrays)\n# define __cpp_lib_shared_ptr_arrays 201611L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_shared_ptr_arrays) && defined(__glibcxx_want_shared_ptr_arrays) */\n#undef __glibcxx_want_shared_ptr_arrays\n\n#if !defined(__cpp_lib_is_swappable)\n# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 201103L))\n# define __glibcxx_is_swappable 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_swappable)\n# define __cpp_lib_is_swappable 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_swappable) && defined(__glibcxx_want_is_swappable) */\n#undef __glibcxx_want_is_swappable\n\n#if !defined(__cpp_lib_void_t)\n# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 201103L))\n# define __glibcxx_void_t 201411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_void_t)\n# define __cpp_lib_void_t 201411L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_void_t) && defined(__glibcxx_want_void_t) */\n#undef __glibcxx_want_void_t\n\n#if !defined(__cpp_lib_enable_shared_from_this)\n# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 201103L)) && _GLIBCXX_HOSTED\n# define __glibcxx_enable_shared_from_this 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_enable_shared_from_this)\n# define __cpp_lib_enable_shared_from_this 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_enable_shared_from_this) && defined(__glibcxx_want_enable_shared_from_this) */\n#undef __glibcxx_want_enable_shared_from_this\n\n#if !defined(__cpp_lib_math_spec_funcs)\n# if (__cplusplus >= 201103L)\n# define __glibcxx_math_spec_funcs 201003L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_math_spec_funcs)\n# define __STDCPP_MATH_SPEC_FUNCS__ 201003L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_math_spec_funcs) && defined(__glibcxx_want_math_spec_funcs) */\n#undef __glibcxx_want_math_spec_funcs\n\n#if !defined(__cpp_lib_coroutine)\n# if (__cplusplus >= 201402L) && (__cpp_impl_coroutine)\n# define __glibcxx_coroutine 201902L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_coroutine)\n# define __cpp_lib_coroutine 201902L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_coroutine) && defined(__glibcxx_want_coroutine) */\n#undef __glibcxx_want_coroutine\n\n#if !defined(__cpp_lib_exchange_function)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_exchange_function 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_exchange_function)\n# define __cpp_lib_exchange_function 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_exchange_function) && defined(__glibcxx_want_exchange_function) */\n#undef __glibcxx_want_exchange_function\n\n#if !defined(__cpp_lib_integer_sequence)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_integer_sequence 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_integer_sequence)\n# define __cpp_lib_integer_sequence 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_integer_sequence) && defined(__glibcxx_want_integer_sequence) */\n#undef __glibcxx_want_integer_sequence\n\n#if !defined(__cpp_lib_integral_constant_callable)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_integral_constant_callable 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_integral_constant_callable)\n# define __cpp_lib_integral_constant_callable 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_integral_constant_callable) && defined(__glibcxx_want_integral_constant_callable) */\n#undef __glibcxx_want_integral_constant_callable\n\n#if !defined(__cpp_lib_is_final)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_is_final 201402L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_final)\n# define __cpp_lib_is_final 201402L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_final) && defined(__glibcxx_want_is_final) */\n#undef __glibcxx_want_is_final\n\n#if !defined(__cpp_lib_make_reverse_iterator)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_make_reverse_iterator 201402L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_reverse_iterator)\n# define __cpp_lib_make_reverse_iterator 201402L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_make_reverse_iterator) && defined(__glibcxx_want_make_reverse_iterator) */\n#undef __glibcxx_want_make_reverse_iterator\n\n#if !defined(__cpp_lib_null_iterators)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_null_iterators 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_null_iterators)\n# define __cpp_lib_null_iterators 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_null_iterators) && defined(__glibcxx_want_null_iterators) */\n#undef __glibcxx_want_null_iterators\n\n#if !defined(__cpp_lib_transformation_trait_aliases)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_transformation_trait_aliases 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_transformation_trait_aliases)\n# define __cpp_lib_transformation_trait_aliases 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_transformation_trait_aliases) && defined(__glibcxx_want_transformation_trait_aliases) */\n#undef __glibcxx_want_transformation_trait_aliases\n\n#if !defined(__cpp_lib_transparent_operators)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_transparent_operators 201510L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_transparent_operators)\n# define __cpp_lib_transparent_operators 201510L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_transparent_operators) && defined(__glibcxx_want_transparent_operators) */\n#undef __glibcxx_want_transparent_operators\n\n#if !defined(__cpp_lib_tuple_element_t)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_tuple_element_t 201402L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuple_element_t)\n# define __cpp_lib_tuple_element_t 201402L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_tuple_element_t) && defined(__glibcxx_want_tuple_element_t) */\n#undef __glibcxx_want_tuple_element_t\n\n#if !defined(__cpp_lib_tuples_by_type)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_tuples_by_type 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuples_by_type)\n# define __cpp_lib_tuples_by_type 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_tuples_by_type) && defined(__glibcxx_want_tuples_by_type) */\n#undef __glibcxx_want_tuples_by_type\n\n#if !defined(__cpp_lib_robust_nonmodifying_seq_ops)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_robust_nonmodifying_seq_ops 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_robust_nonmodifying_seq_ops)\n# define __cpp_lib_robust_nonmodifying_seq_ops 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_robust_nonmodifying_seq_ops) && defined(__glibcxx_want_robust_nonmodifying_seq_ops) */\n#undef __glibcxx_want_robust_nonmodifying_seq_ops\n\n#if !defined(__cpp_lib_to_chars)\n# if (__cplusplus > 202302L) && (_GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 && __SIZE_WIDTH__ >= 32)\n# define __glibcxx_to_chars 202306L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_chars)\n# define __cpp_lib_to_chars 202306L\n# endif\n# elif (__cplusplus >= 201402L) && (_GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 && __SIZE_WIDTH__ >= 32)\n# define __glibcxx_to_chars 201611L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_chars)\n# define __cpp_lib_to_chars 201611L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_to_chars) && defined(__glibcxx_want_to_chars) */\n#undef __glibcxx_want_to_chars\n\n#if !defined(__cpp_lib_chrono_udls)\n# if (__cplusplus >= 201402L)\n# define __glibcxx_chrono_udls 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono_udls)\n# define __cpp_lib_chrono_udls 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_chrono_udls) && defined(__glibcxx_want_chrono_udls) */\n#undef __glibcxx_want_chrono_udls\n\n#if !defined(__cpp_lib_complex_udls)\n# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED\n# define __glibcxx_complex_udls 201309L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_complex_udls)\n# define __cpp_lib_complex_udls 201309L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_complex_udls) && defined(__glibcxx_want_complex_udls) */\n#undef __glibcxx_want_complex_udls\n\n#if !defined(__cpp_lib_generic_associative_lookup)\n# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED\n# define __glibcxx_generic_associative_lookup 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_generic_associative_lookup)\n# define __cpp_lib_generic_associative_lookup 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_generic_associative_lookup) && defined(__glibcxx_want_generic_associative_lookup) */\n#undef __glibcxx_want_generic_associative_lookup\n\n#if !defined(__cpp_lib_make_unique)\n# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED\n# define __glibcxx_make_unique 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_unique)\n# define __cpp_lib_make_unique 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_make_unique) && defined(__glibcxx_want_make_unique) */\n#undef __glibcxx_want_make_unique\n\n#if !defined(__cpp_lib_quoted_string_io)\n# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED\n# define __glibcxx_quoted_string_io 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_quoted_string_io)\n# define __cpp_lib_quoted_string_io 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_quoted_string_io) && defined(__glibcxx_want_quoted_string_io) */\n#undef __glibcxx_want_quoted_string_io\n\n#if !defined(__cpp_lib_shared_timed_mutex)\n# if (__cplusplus >= 201402L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED\n# define __glibcxx_shared_timed_mutex 201402L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_timed_mutex)\n# define __cpp_lib_shared_timed_mutex 201402L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_shared_timed_mutex) && defined(__glibcxx_want_shared_timed_mutex) */\n#undef __glibcxx_want_shared_timed_mutex\n\n#if !defined(__cpp_lib_string_udls)\n# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED\n# define __glibcxx_string_udls 201304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_udls)\n# define __cpp_lib_string_udls 201304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_string_udls) && defined(__glibcxx_want_string_udls) */\n#undef __glibcxx_want_string_udls\n\n#if !defined(__cpp_lib_addressof_constexpr)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_addressof_constexpr 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_addressof_constexpr)\n# define __cpp_lib_addressof_constexpr 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_addressof_constexpr) && defined(__glibcxx_want_addressof_constexpr) */\n#undef __glibcxx_want_addressof_constexpr\n\n#if !defined(__cpp_lib_any)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_any 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_any)\n# define __cpp_lib_any 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_any) && defined(__glibcxx_want_any) */\n#undef __glibcxx_want_any\n\n#if !defined(__cpp_lib_apply)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_apply 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_apply)\n# define __cpp_lib_apply 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_apply) && defined(__glibcxx_want_apply) */\n#undef __glibcxx_want_apply\n\n#if !defined(__cpp_lib_as_const)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_as_const 201510L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_as_const)\n# define __cpp_lib_as_const 201510L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_as_const) && defined(__glibcxx_want_as_const) */\n#undef __glibcxx_want_as_const\n\n#if !defined(__cpp_lib_atomic_is_always_lock_free)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_atomic_is_always_lock_free 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_is_always_lock_free)\n# define __cpp_lib_atomic_is_always_lock_free 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_atomic_is_always_lock_free) && defined(__glibcxx_want_atomic_is_always_lock_free) */\n#undef __glibcxx_want_atomic_is_always_lock_free\n\n#if !defined(__cpp_lib_bool_constant)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_bool_constant 201505L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bool_constant)\n# define __cpp_lib_bool_constant 201505L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_bool_constant) && defined(__glibcxx_want_bool_constant) */\n#undef __glibcxx_want_bool_constant\n\n#if !defined(__cpp_lib_byte)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_byte 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_byte)\n# define __cpp_lib_byte 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_byte) && defined(__glibcxx_want_byte) */\n#undef __glibcxx_want_byte\n\n#if !defined(__cpp_lib_has_unique_object_representations)\n# if (__cplusplus >= 201703L) && (defined(_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP))\n# define __glibcxx_has_unique_object_representations 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_has_unique_object_representations)\n# define __cpp_lib_has_unique_object_representations 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_has_unique_object_representations) && defined(__glibcxx_want_has_unique_object_representations) */\n#undef __glibcxx_want_has_unique_object_representations\n\n#if !defined(__cpp_lib_hardware_interference_size)\n# if (__cplusplus >= 201703L) && (defined(__GCC_DESTRUCTIVE_SIZE))\n# define __glibcxx_hardware_interference_size 201703L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_hardware_interference_size)\n# define __cpp_lib_hardware_interference_size 201703L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_hardware_interference_size) && defined(__glibcxx_want_hardware_interference_size) */\n#undef __glibcxx_want_hardware_interference_size\n\n#if !defined(__cpp_lib_invoke)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_invoke 201411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_invoke)\n# define __cpp_lib_invoke 201411L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_invoke) && defined(__glibcxx_want_invoke) */\n#undef __glibcxx_want_invoke\n\n#if !defined(__cpp_lib_is_aggregate)\n# if (__cplusplus >= 201703L) && (defined(_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE))\n# define __glibcxx_is_aggregate 201703L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_aggregate)\n# define __cpp_lib_is_aggregate 201703L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_aggregate) && defined(__glibcxx_want_is_aggregate) */\n#undef __glibcxx_want_is_aggregate\n\n#if !defined(__cpp_lib_is_invocable)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_is_invocable 201703L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_invocable)\n# define __cpp_lib_is_invocable 201703L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_invocable) && defined(__glibcxx_want_is_invocable) */\n#undef __glibcxx_want_is_invocable\n\n#if !defined(__cpp_lib_launder)\n# if (__cplusplus >= 201703L) && (defined(_GLIBCXX_HAVE_BUILTIN_LAUNDER))\n# define __glibcxx_launder 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_launder)\n# define __cpp_lib_launder 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_launder) && defined(__glibcxx_want_launder) */\n#undef __glibcxx_want_launder\n\n#if !defined(__cpp_lib_logical_traits)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_logical_traits 201510L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_logical_traits)\n# define __cpp_lib_logical_traits 201510L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_logical_traits) && defined(__glibcxx_want_logical_traits) */\n#undef __glibcxx_want_logical_traits\n\n#if !defined(__cpp_lib_make_from_tuple)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_make_from_tuple 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_from_tuple)\n# define __cpp_lib_make_from_tuple 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_make_from_tuple) && defined(__glibcxx_want_make_from_tuple) */\n#undef __glibcxx_want_make_from_tuple\n\n#if !defined(__cpp_lib_not_fn)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_not_fn 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_not_fn)\n# define __cpp_lib_not_fn 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_not_fn) && defined(__glibcxx_want_not_fn) */\n#undef __glibcxx_want_not_fn\n\n#if !defined(__cpp_lib_type_trait_variable_templates)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_type_trait_variable_templates 201510L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_type_trait_variable_templates)\n# define __cpp_lib_type_trait_variable_templates 201510L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_type_trait_variable_templates) && defined(__glibcxx_want_type_trait_variable_templates) */\n#undef __glibcxx_want_type_trait_variable_templates\n\n#if !defined(__cpp_lib_variant)\n# if (__cplusplus > 202302L) && (__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L && __cpp_explicit_this_parameter)\n# define __glibcxx_variant 202306L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_variant)\n# define __cpp_lib_variant 202306L\n# endif\n# elif (__cplusplus >= 202002L) && (__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L)\n# define __glibcxx_variant 202106L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_variant)\n# define __cpp_lib_variant 202106L\n# endif\n# elif (__cplusplus >= 201703L)\n# define __glibcxx_variant 202102L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_variant)\n# define __cpp_lib_variant 202102L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_variant) && defined(__glibcxx_want_variant) */\n#undef __glibcxx_want_variant\n\n#if !defined(__cpp_lib_lcm)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_lcm 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_lcm)\n# define __cpp_lib_lcm 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_lcm) && defined(__glibcxx_want_lcm) */\n#undef __glibcxx_want_lcm\n\n#if !defined(__cpp_lib_gcd)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_gcd 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_gcd)\n# define __cpp_lib_gcd 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_gcd) && defined(__glibcxx_want_gcd) */\n#undef __glibcxx_want_gcd\n\n#if !defined(__cpp_lib_gcd_lcm)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_gcd_lcm 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_gcd_lcm)\n# define __cpp_lib_gcd_lcm 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_gcd_lcm) && defined(__glibcxx_want_gcd_lcm) */\n#undef __glibcxx_want_gcd_lcm\n\n#if !defined(__cpp_lib_raw_memory_algorithms)\n# if (__cplusplus > 202302L) && (__cpp_constexpr >= 202406L)\n# define __glibcxx_raw_memory_algorithms 202411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_raw_memory_algorithms)\n# define __cpp_lib_raw_memory_algorithms 202411L\n# endif\n# elif (__cplusplus >= 201703L)\n# define __glibcxx_raw_memory_algorithms 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_raw_memory_algorithms)\n# define __cpp_lib_raw_memory_algorithms 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_raw_memory_algorithms) && defined(__glibcxx_want_raw_memory_algorithms) */\n#undef __glibcxx_want_raw_memory_algorithms\n\n#if !defined(__cpp_lib_array_constexpr)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_array_constexpr 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_array_constexpr)\n# define __cpp_lib_array_constexpr 201811L\n# endif\n# elif (__cplusplus >= 201703L)\n# define __glibcxx_array_constexpr 201803L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_array_constexpr)\n# define __cpp_lib_array_constexpr 201803L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_array_constexpr) && defined(__glibcxx_want_array_constexpr) */\n#undef __glibcxx_want_array_constexpr\n\n#if !defined(__cpp_lib_nonmember_container_access)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_nonmember_container_access 201411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_nonmember_container_access)\n# define __cpp_lib_nonmember_container_access 201411L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_nonmember_container_access) && defined(__glibcxx_want_nonmember_container_access) */\n#undef __glibcxx_want_nonmember_container_access\n\n#if !defined(__cpp_lib_clamp)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_clamp 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_clamp)\n# define __cpp_lib_clamp 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_clamp) && defined(__glibcxx_want_clamp) */\n#undef __glibcxx_want_clamp\n\n#if !defined(__cpp_lib_sample)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_sample 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_sample)\n# define __cpp_lib_sample 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_sample) && defined(__glibcxx_want_sample) */\n#undef __glibcxx_want_sample\n\n#if !defined(__cpp_lib_boyer_moore_searcher)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_boyer_moore_searcher 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_boyer_moore_searcher)\n# define __cpp_lib_boyer_moore_searcher 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_boyer_moore_searcher) && defined(__glibcxx_want_boyer_moore_searcher) */\n#undef __glibcxx_want_boyer_moore_searcher\n\n#if !defined(__cpp_lib_chrono)\n# if (__cplusplus >= 202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED\n# define __glibcxx_chrono 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono)\n# define __cpp_lib_chrono 201907L\n# endif\n# elif (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_chrono 201611L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono)\n# define __cpp_lib_chrono 201611L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_chrono) && defined(__glibcxx_want_chrono) */\n#undef __glibcxx_want_chrono\n\n#if !defined(__cpp_lib_execution)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_execution 201902L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_execution)\n# define __cpp_lib_execution 201902L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_execution) && defined(__glibcxx_want_execution) */\n#undef __glibcxx_want_execution\n\n#if !defined(__cpp_lib_filesystem)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_filesystem 201703L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_filesystem)\n# define __cpp_lib_filesystem 201703L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_filesystem) && defined(__glibcxx_want_filesystem) */\n#undef __glibcxx_want_filesystem\n\n#if !defined(__cpp_lib_hypot)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_hypot 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_hypot)\n# define __cpp_lib_hypot 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_hypot) && defined(__glibcxx_want_hypot) */\n#undef __glibcxx_want_hypot\n\n#if !defined(__cpp_lib_map_try_emplace)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_map_try_emplace 201411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_map_try_emplace)\n# define __cpp_lib_map_try_emplace 201411L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_map_try_emplace) && defined(__glibcxx_want_map_try_emplace) */\n#undef __glibcxx_want_map_try_emplace\n\n#if !defined(__cpp_lib_math_special_functions)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_math_special_functions 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_math_special_functions)\n# define __cpp_lib_math_special_functions 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_math_special_functions) && defined(__glibcxx_want_math_special_functions) */\n#undef __glibcxx_want_math_special_functions\n\n#if !defined(__cpp_lib_memory_resource)\n# if (__cplusplus >= 201703L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED\n# define __glibcxx_memory_resource 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_memory_resource)\n# define __cpp_lib_memory_resource 201603L\n# endif\n# elif (__cplusplus >= 201703L) && !defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED\n# define __glibcxx_memory_resource 1L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_memory_resource)\n# define __cpp_lib_memory_resource 1L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_memory_resource) && defined(__glibcxx_want_memory_resource) */\n#undef __glibcxx_want_memory_resource\n\n#if !defined(__cpp_lib_node_extract)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_node_extract 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_node_extract)\n# define __cpp_lib_node_extract 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_node_extract) && defined(__glibcxx_want_node_extract) */\n#undef __glibcxx_want_node_extract\n\n#if !defined(__cpp_lib_parallel_algorithm)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_parallel_algorithm 201603L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_parallel_algorithm)\n# define __cpp_lib_parallel_algorithm 201603L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_parallel_algorithm) && defined(__glibcxx_want_parallel_algorithm) */\n#undef __glibcxx_want_parallel_algorithm\n\n#if !defined(__cpp_lib_scoped_lock)\n# if (__cplusplus >= 201703L)\n# define __glibcxx_scoped_lock 201703L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_scoped_lock)\n# define __cpp_lib_scoped_lock 201703L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_scoped_lock) && defined(__glibcxx_want_scoped_lock) */\n#undef __glibcxx_want_scoped_lock\n\n#if !defined(__cpp_lib_shared_mutex)\n# if (__cplusplus >= 201703L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED\n# define __glibcxx_shared_mutex 201505L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_mutex)\n# define __cpp_lib_shared_mutex 201505L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_shared_mutex) && defined(__glibcxx_want_shared_mutex) */\n#undef __glibcxx_want_shared_mutex\n\n#if !defined(__cpp_lib_shared_ptr_weak_type)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_shared_ptr_weak_type 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_ptr_weak_type)\n# define __cpp_lib_shared_ptr_weak_type 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_shared_ptr_weak_type) && defined(__glibcxx_want_shared_ptr_weak_type) */\n#undef __glibcxx_want_shared_ptr_weak_type\n\n#if !defined(__cpp_lib_string_view)\n# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED\n# define __glibcxx_string_view 202403L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_view)\n# define __cpp_lib_string_view 202403L\n# endif\n# elif (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_string_view 201803L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_view)\n# define __cpp_lib_string_view 201803L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_string_view) && defined(__glibcxx_want_string_view) */\n#undef __glibcxx_want_string_view\n\n#if !defined(__cpp_lib_unordered_map_try_emplace)\n# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED\n# define __glibcxx_unordered_map_try_emplace 201411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_unordered_map_try_emplace)\n# define __cpp_lib_unordered_map_try_emplace 201411L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_unordered_map_try_emplace) && defined(__glibcxx_want_unordered_map_try_emplace) */\n#undef __glibcxx_want_unordered_map_try_emplace\n\n#if !defined(__cpp_lib_assume_aligned)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_assume_aligned 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_assume_aligned)\n# define __cpp_lib_assume_aligned 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_assume_aligned) && defined(__glibcxx_want_assume_aligned) */\n#undef __glibcxx_want_assume_aligned\n\n#if !defined(__cpp_lib_atomic_flag_test)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_atomic_flag_test 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_flag_test)\n# define __cpp_lib_atomic_flag_test 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_atomic_flag_test) && defined(__glibcxx_want_atomic_flag_test) */\n#undef __glibcxx_want_atomic_flag_test\n\n#if !defined(__cpp_lib_atomic_float)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_atomic_float 201711L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_float)\n# define __cpp_lib_atomic_float 201711L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_atomic_float) && defined(__glibcxx_want_atomic_float) */\n#undef __glibcxx_want_atomic_float\n\n#if !defined(__cpp_lib_atomic_lock_free_type_aliases)\n# if (__cplusplus >= 202002L) && ((__GCC_ATOMIC_INT_LOCK_FREE | __GCC_ATOMIC_LONG_LOCK_FREE | __GCC_ATOMIC_CHAR_LOCK_FREE) & 2)\n# define __glibcxx_atomic_lock_free_type_aliases 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_lock_free_type_aliases)\n# define __cpp_lib_atomic_lock_free_type_aliases 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_atomic_lock_free_type_aliases) && defined(__glibcxx_want_atomic_lock_free_type_aliases) */\n#undef __glibcxx_want_atomic_lock_free_type_aliases\n\n#if !defined(__cpp_lib_atomic_ref)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_atomic_ref 201806L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_ref)\n# define __cpp_lib_atomic_ref 201806L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_atomic_ref) && defined(__glibcxx_want_atomic_ref) */\n#undef __glibcxx_want_atomic_ref\n\n#if !defined(__cpp_lib_atomic_value_initialization)\n# if (__cplusplus >= 202002L) && (__cpp_concepts >= 201907L)\n# define __glibcxx_atomic_value_initialization 201911L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_value_initialization)\n# define __cpp_lib_atomic_value_initialization 201911L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_atomic_value_initialization) && defined(__glibcxx_want_atomic_value_initialization) */\n#undef __glibcxx_want_atomic_value_initialization\n\n#if !defined(__cpp_lib_bind_front)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_bind_front 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bind_front)\n# define __cpp_lib_bind_front 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_bind_front) && defined(__glibcxx_want_bind_front) */\n#undef __glibcxx_want_bind_front\n\n#if !defined(__cpp_lib_bind_back)\n# if (__cplusplus >= 202100L) && (__cpp_explicit_this_parameter)\n# define __glibcxx_bind_back 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bind_back)\n# define __cpp_lib_bind_back 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_bind_back) && defined(__glibcxx_want_bind_back) */\n#undef __glibcxx_want_bind_back\n\n#if !defined(__cpp_lib_starts_ends_with)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_starts_ends_with 201711L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_starts_ends_with)\n# define __cpp_lib_starts_ends_with 201711L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_starts_ends_with) && defined(__glibcxx_want_starts_ends_with) */\n#undef __glibcxx_want_starts_ends_with\n\n#if !defined(__cpp_lib_bit_cast)\n# if (__cplusplus >= 202002L) && (__has_builtin(__builtin_bit_cast))\n# define __glibcxx_bit_cast 201806L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bit_cast)\n# define __cpp_lib_bit_cast 201806L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_bit_cast) && defined(__glibcxx_want_bit_cast) */\n#undef __glibcxx_want_bit_cast\n\n#if !defined(__cpp_lib_bitops)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_bitops 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bitops)\n# define __cpp_lib_bitops 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_bitops) && defined(__glibcxx_want_bitops) */\n#undef __glibcxx_want_bitops\n\n#if !defined(__cpp_lib_bounded_array_traits)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_bounded_array_traits 201902L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bounded_array_traits)\n# define __cpp_lib_bounded_array_traits 201902L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_bounded_array_traits) && defined(__glibcxx_want_bounded_array_traits) */\n#undef __glibcxx_want_bounded_array_traits\n\n#if !defined(__cpp_lib_concepts)\n# if (__cplusplus >= 202002L) && (__cpp_concepts >= 201907L)\n# define __glibcxx_concepts 202002L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_concepts)\n# define __cpp_lib_concepts 202002L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_concepts) && defined(__glibcxx_want_concepts) */\n#undef __glibcxx_want_concepts\n\n#if !defined(__cpp_lib_optional)\n# if (__cplusplus >= 202100L) && (__glibcxx_concepts)\n# define __glibcxx_optional 202110L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional)\n# define __cpp_lib_optional 202110L\n# endif\n# elif (__cplusplus >= 202002L)\n# define __glibcxx_optional 202106L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional)\n# define __cpp_lib_optional 202106L\n# endif\n# elif (__cplusplus >= 201703L)\n# define __glibcxx_optional 201606L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional)\n# define __cpp_lib_optional 201606L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_optional) && defined(__glibcxx_want_optional) */\n#undef __glibcxx_want_optional\n\n#if !defined(__cpp_lib_destroying_delete)\n# if (__cplusplus >= 202002L) && (__cpp_impl_destroying_delete)\n# define __glibcxx_destroying_delete 201806L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_destroying_delete)\n# define __cpp_lib_destroying_delete 201806L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_destroying_delete) && defined(__glibcxx_want_destroying_delete) */\n#undef __glibcxx_want_destroying_delete\n\n#if !defined(__cpp_lib_constexpr_string_view)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_constexpr_string_view 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string_view)\n# define __cpp_lib_constexpr_string_view 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_string_view) && defined(__glibcxx_want_constexpr_string_view) */\n#undef __glibcxx_want_constexpr_string_view\n\n#if !defined(__cpp_lib_endian)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_endian 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_endian)\n# define __cpp_lib_endian 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_endian) && defined(__glibcxx_want_endian) */\n#undef __glibcxx_want_endian\n\n#if !defined(__cpp_lib_int_pow2)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_int_pow2 202002L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_int_pow2)\n# define __cpp_lib_int_pow2 202002L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_int_pow2) && defined(__glibcxx_want_int_pow2) */\n#undef __glibcxx_want_int_pow2\n\n#if !defined(__cpp_lib_integer_comparison_functions)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_integer_comparison_functions 202002L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_integer_comparison_functions)\n# define __cpp_lib_integer_comparison_functions 202002L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_integer_comparison_functions) && defined(__glibcxx_want_integer_comparison_functions) */\n#undef __glibcxx_want_integer_comparison_functions\n\n#if !defined(__cpp_lib_is_constant_evaluated)\n# if (__cplusplus >= 202002L) && (defined(_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED))\n# define __glibcxx_is_constant_evaluated 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_constant_evaluated)\n# define __cpp_lib_is_constant_evaluated 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_constant_evaluated) && defined(__glibcxx_want_is_constant_evaluated) */\n#undef __glibcxx_want_is_constant_evaluated\n\n#if !defined(__cpp_lib_constexpr_char_traits)\n# if (__cplusplus >= 202002L) && (defined(__glibcxx_is_constant_evaluated))\n# define __glibcxx_constexpr_char_traits 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_char_traits)\n# define __cpp_lib_constexpr_char_traits 201811L\n# endif\n# elif (__cplusplus >= 201703L) && (_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED)\n# define __glibcxx_constexpr_char_traits 201611L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_char_traits)\n# define __cpp_lib_constexpr_char_traits 201611L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_char_traits) && defined(__glibcxx_want_constexpr_char_traits) */\n#undef __glibcxx_want_constexpr_char_traits\n\n#if !defined(__cpp_lib_is_layout_compatible)\n# if (__cplusplus >= 202002L) && (__has_builtin(__is_layout_compatible) && __has_builtin(__builtin_is_corresponding_member))\n# define __glibcxx_is_layout_compatible 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_layout_compatible)\n# define __cpp_lib_is_layout_compatible 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_layout_compatible) && defined(__glibcxx_want_is_layout_compatible) */\n#undef __glibcxx_want_is_layout_compatible\n\n#if !defined(__cpp_lib_is_nothrow_convertible)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_is_nothrow_convertible 201806L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_nothrow_convertible)\n# define __cpp_lib_is_nothrow_convertible 201806L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_nothrow_convertible) && defined(__glibcxx_want_is_nothrow_convertible) */\n#undef __glibcxx_want_is_nothrow_convertible\n\n#if !defined(__cpp_lib_is_pointer_interconvertible)\n# if (__cplusplus >= 202002L) && (__has_builtin(__is_pointer_interconvertible_base_of) && __has_builtin(__builtin_is_pointer_interconvertible_with_class))\n# define __glibcxx_is_pointer_interconvertible 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_pointer_interconvertible)\n# define __cpp_lib_is_pointer_interconvertible 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_pointer_interconvertible) && defined(__glibcxx_want_is_pointer_interconvertible) */\n#undef __glibcxx_want_is_pointer_interconvertible\n\n#if !defined(__cpp_lib_math_constants)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_math_constants 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_math_constants)\n# define __cpp_lib_math_constants 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_math_constants) && defined(__glibcxx_want_math_constants) */\n#undef __glibcxx_want_math_constants\n\n#if !defined(__cpp_lib_make_obj_using_allocator)\n# if (__cplusplus >= 202002L) && (__cpp_concepts)\n# define __glibcxx_make_obj_using_allocator 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_obj_using_allocator)\n# define __cpp_lib_make_obj_using_allocator 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_make_obj_using_allocator) && defined(__glibcxx_want_make_obj_using_allocator) */\n#undef __glibcxx_want_make_obj_using_allocator\n\n#if !defined(__cpp_lib_remove_cvref)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_remove_cvref 201711L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_remove_cvref)\n# define __cpp_lib_remove_cvref 201711L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_remove_cvref) && defined(__glibcxx_want_remove_cvref) */\n#undef __glibcxx_want_remove_cvref\n\n#if !defined(__cpp_lib_source_location)\n# if (__cplusplus >= 202002L) && (__has_builtin(__builtin_source_location))\n# define __glibcxx_source_location 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_source_location)\n# define __cpp_lib_source_location 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_source_location) && defined(__glibcxx_want_source_location) */\n#undef __glibcxx_want_source_location\n\n#if !defined(__cpp_lib_span)\n# if (__cplusplus > 202302L) && (__glibcxx_concepts)\n# define __glibcxx_span 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_span)\n# define __cpp_lib_span 202311L\n# endif\n# elif (__cplusplus >= 202002L) && (__glibcxx_concepts)\n# define __glibcxx_span 202002L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_span)\n# define __cpp_lib_span 202002L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_span) && defined(__glibcxx_want_span) */\n#undef __glibcxx_want_span\n\n#if !defined(__cpp_lib_ssize)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_ssize 201902L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ssize)\n# define __cpp_lib_ssize 201902L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ssize) && defined(__glibcxx_want_ssize) */\n#undef __glibcxx_want_ssize\n\n#if !defined(__cpp_lib_three_way_comparison)\n# if (__cplusplus >= 202002L) && (__cpp_impl_three_way_comparison >= 201907L && __glibcxx_concepts)\n# define __glibcxx_three_way_comparison 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_three_way_comparison)\n# define __cpp_lib_three_way_comparison 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_three_way_comparison) && defined(__glibcxx_want_three_way_comparison) */\n#undef __glibcxx_want_three_way_comparison\n\n#if !defined(__cpp_lib_to_address)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_to_address 201711L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_address)\n# define __cpp_lib_to_address 201711L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_to_address) && defined(__glibcxx_want_to_address) */\n#undef __glibcxx_want_to_address\n\n#if !defined(__cpp_lib_to_array)\n# if (__cplusplus >= 202002L) && (__cpp_generic_lambdas >= 201707L)\n# define __glibcxx_to_array 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_array)\n# define __cpp_lib_to_array 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_to_array) && defined(__glibcxx_want_to_array) */\n#undef __glibcxx_want_to_array\n\n#if !defined(__cpp_lib_type_identity)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_type_identity 201806L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_type_identity)\n# define __cpp_lib_type_identity 201806L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_type_identity) && defined(__glibcxx_want_type_identity) */\n#undef __glibcxx_want_type_identity\n\n#if !defined(__cpp_lib_unwrap_ref)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_unwrap_ref 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_unwrap_ref)\n# define __cpp_lib_unwrap_ref 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_unwrap_ref) && defined(__glibcxx_want_unwrap_ref) */\n#undef __glibcxx_want_unwrap_ref\n\n#if !defined(__cpp_lib_constexpr_iterator)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_constexpr_iterator 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_iterator)\n# define __cpp_lib_constexpr_iterator 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_iterator) && defined(__glibcxx_want_constexpr_iterator) */\n#undef __glibcxx_want_constexpr_iterator\n\n#if !defined(__cpp_lib_interpolate)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_interpolate 201902L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_interpolate)\n# define __cpp_lib_interpolate 201902L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_interpolate) && defined(__glibcxx_want_interpolate) */\n#undef __glibcxx_want_interpolate\n\n#if !defined(__cpp_lib_constexpr_utility)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_constexpr_utility 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_utility)\n# define __cpp_lib_constexpr_utility 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_utility) && defined(__glibcxx_want_constexpr_utility) */\n#undef __glibcxx_want_constexpr_utility\n\n#if !defined(__cpp_lib_shift)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_shift 201806L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shift)\n# define __cpp_lib_shift 201806L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_shift) && defined(__glibcxx_want_shift) */\n#undef __glibcxx_want_shift\n\n#if !defined(__cpp_lib_ranges)\n# if (__cplusplus > 202302L) && (__glibcxx_concepts)\n# define __glibcxx_ranges 202406L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges)\n# define __cpp_lib_ranges 202406L\n# endif\n# elif (__cplusplus >= 202100L) && (__glibcxx_concepts)\n# define __glibcxx_ranges 202302L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges)\n# define __cpp_lib_ranges 202302L\n# endif\n# elif (__cplusplus >= 202002L) && (__glibcxx_concepts)\n# define __glibcxx_ranges 202110L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges)\n# define __cpp_lib_ranges 202110L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges) && defined(__glibcxx_want_ranges) */\n#undef __glibcxx_want_ranges\n\n#if !defined(__cpp_lib_constexpr_numeric)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_constexpr_numeric 201911L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_numeric)\n# define __cpp_lib_constexpr_numeric 201911L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_numeric) && defined(__glibcxx_want_constexpr_numeric) */\n#undef __glibcxx_want_constexpr_numeric\n\n#if !defined(__cpp_lib_constexpr_functional)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_constexpr_functional 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_functional)\n# define __cpp_lib_constexpr_functional 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_functional) && defined(__glibcxx_want_constexpr_functional) */\n#undef __glibcxx_want_constexpr_functional\n\n#if !defined(__cpp_lib_constexpr_algorithms)\n# if (__cplusplus > 202302L)\n# define __glibcxx_constexpr_algorithms 202306L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_algorithms)\n# define __cpp_lib_constexpr_algorithms 202306L\n# endif\n# elif (__cplusplus >= 202002L)\n# define __glibcxx_constexpr_algorithms 201806L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_algorithms)\n# define __cpp_lib_constexpr_algorithms 201806L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_algorithms) && defined(__glibcxx_want_constexpr_algorithms) */\n#undef __glibcxx_want_constexpr_algorithms\n\n#if !defined(__cpp_lib_constexpr_tuple)\n# if (__cplusplus >= 202002L)\n# define __glibcxx_constexpr_tuple 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_tuple)\n# define __cpp_lib_constexpr_tuple 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_tuple) && defined(__glibcxx_want_constexpr_tuple) */\n#undef __glibcxx_want_constexpr_tuple\n\n#if !defined(__cpp_lib_constexpr_memory)\n# if (__cplusplus >= 202100L) && (__cpp_constexpr_dynamic_alloc)\n# define __glibcxx_constexpr_memory 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_memory)\n# define __cpp_lib_constexpr_memory 202202L\n# endif\n# elif (__cplusplus >= 202002L)\n# define __glibcxx_constexpr_memory 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_memory)\n# define __cpp_lib_constexpr_memory 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_memory) && defined(__glibcxx_want_constexpr_memory) */\n#undef __glibcxx_want_constexpr_memory\n\n#if !defined(__cpp_lib_atomic_shared_ptr)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_atomic_shared_ptr 201711L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_shared_ptr)\n# define __cpp_lib_atomic_shared_ptr 201711L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_atomic_shared_ptr) && defined(__glibcxx_want_atomic_shared_ptr) */\n#undef __glibcxx_want_atomic_shared_ptr\n\n#if !defined(__cpp_lib_atomic_wait)\n# if (__cplusplus >= 202002L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED\n# define __glibcxx_atomic_wait 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_wait)\n# define __cpp_lib_atomic_wait 201907L\n# endif\n# elif (__cplusplus >= 202002L) && !defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED && (defined(_GLIBCXX_HAVE_LINUX_FUTEX))\n# define __glibcxx_atomic_wait 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_wait)\n# define __cpp_lib_atomic_wait 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_atomic_wait) && defined(__glibcxx_want_atomic_wait) */\n#undef __glibcxx_want_atomic_wait\n\n#if !defined(__cpp_lib_barrier)\n# if (__cplusplus >= 202002L) && (__cpp_aligned_new && __glibcxx_atomic_wait)\n# define __glibcxx_barrier 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_barrier)\n# define __cpp_lib_barrier 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_barrier) && defined(__glibcxx_want_barrier) */\n#undef __glibcxx_want_barrier\n\n#if !defined(__cpp_lib_format)\n# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED\n# define __glibcxx_format 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format)\n# define __cpp_lib_format 202311L\n# endif\n# elif (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_format 202304L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format)\n# define __cpp_lib_format 202304L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_format) && defined(__glibcxx_want_format) */\n#undef __glibcxx_want_format\n\n#if !defined(__cpp_lib_format_uchar)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_format_uchar 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format_uchar)\n# define __cpp_lib_format_uchar 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_format_uchar) && defined(__glibcxx_want_format_uchar) */\n#undef __glibcxx_want_format_uchar\n\n#if !defined(__cpp_lib_constexpr_complex)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_constexpr_complex 201711L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_complex)\n# define __cpp_lib_constexpr_complex 201711L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_complex) && defined(__glibcxx_want_constexpr_complex) */\n#undef __glibcxx_want_constexpr_complex\n\n#if !defined(__cpp_lib_constexpr_dynamic_alloc)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_constexpr_dynamic_alloc 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_dynamic_alloc)\n# define __cpp_lib_constexpr_dynamic_alloc 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_dynamic_alloc) && defined(__glibcxx_want_constexpr_dynamic_alloc) */\n#undef __glibcxx_want_constexpr_dynamic_alloc\n\n#if !defined(__cpp_lib_constexpr_string)\n# if (__cplusplus >= 202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED && (defined(__glibcxx_is_constant_evaluated))\n# define __glibcxx_constexpr_string 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string)\n# define __cpp_lib_constexpr_string 201907L\n# endif\n# elif (__cplusplus >= 202002L) && !_GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED && (defined(__glibcxx_is_constant_evaluated))\n# define __glibcxx_constexpr_string 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string)\n# define __cpp_lib_constexpr_string 201811L\n# endif\n# elif (__cplusplus >= 201703L) && _GLIBCXX_HOSTED && (_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED)\n# define __glibcxx_constexpr_string 201611L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string)\n# define __cpp_lib_constexpr_string 201611L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_string) && defined(__glibcxx_want_constexpr_string) */\n#undef __glibcxx_want_constexpr_string\n\n#if !defined(__cpp_lib_constexpr_vector)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_constexpr_vector 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_vector)\n# define __cpp_lib_constexpr_vector 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_vector) && defined(__glibcxx_want_constexpr_vector) */\n#undef __glibcxx_want_constexpr_vector\n\n#if !defined(__cpp_lib_constrained_equality)\n# if (__cplusplus >= 202100L) && (__glibcxx_three_way_comparison)\n# define __glibcxx_constrained_equality 202411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constrained_equality)\n# define __cpp_lib_constrained_equality 202411L\n# endif\n# elif (__cplusplus >= 202002L) && (__glibcxx_three_way_comparison)\n# define __glibcxx_constrained_equality 202403L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constrained_equality)\n# define __cpp_lib_constrained_equality 202403L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constrained_equality) && defined(__glibcxx_want_constrained_equality) */\n#undef __glibcxx_want_constrained_equality\n\n#if !defined(__cpp_lib_erase_if)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_erase_if 202002L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_erase_if)\n# define __cpp_lib_erase_if 202002L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_erase_if) && defined(__glibcxx_want_erase_if) */\n#undef __glibcxx_want_erase_if\n\n#if !defined(__cpp_lib_generic_unordered_lookup)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_generic_unordered_lookup 201811L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_generic_unordered_lookup)\n# define __cpp_lib_generic_unordered_lookup 201811L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_generic_unordered_lookup) && defined(__glibcxx_want_generic_unordered_lookup) */\n#undef __glibcxx_want_generic_unordered_lookup\n\n#if !defined(__cpp_lib_jthread)\n# if (__cplusplus >= 202002L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED\n# define __glibcxx_jthread 201911L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_jthread)\n# define __cpp_lib_jthread 201911L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_jthread) && defined(__glibcxx_want_jthread) */\n#undef __glibcxx_want_jthread\n\n#if !defined(__cpp_lib_latch)\n# if (__cplusplus >= 202002L) && (__glibcxx_atomic_wait)\n# define __glibcxx_latch 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_latch)\n# define __cpp_lib_latch 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_latch) && defined(__glibcxx_want_latch) */\n#undef __glibcxx_want_latch\n\n#if !defined(__cpp_lib_list_remove_return_type)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_list_remove_return_type 201806L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_list_remove_return_type)\n# define __cpp_lib_list_remove_return_type 201806L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_list_remove_return_type) && defined(__glibcxx_want_list_remove_return_type) */\n#undef __glibcxx_want_list_remove_return_type\n\n#if !defined(__cpp_lib_polymorphic_allocator)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_polymorphic_allocator 201902L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_polymorphic_allocator)\n# define __cpp_lib_polymorphic_allocator 201902L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_polymorphic_allocator) && defined(__glibcxx_want_polymorphic_allocator) */\n#undef __glibcxx_want_polymorphic_allocator\n\n#if !defined(__cpp_lib_move_iterator_concept)\n# if (__cplusplus >= 202002L) && (__glibcxx_concepts)\n# define __glibcxx_move_iterator_concept 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_move_iterator_concept)\n# define __cpp_lib_move_iterator_concept 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_move_iterator_concept) && defined(__glibcxx_want_move_iterator_concept) */\n#undef __glibcxx_want_move_iterator_concept\n\n#if !defined(__cpp_lib_semaphore)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED && (__glibcxx_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE)\n# define __glibcxx_semaphore 201907L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_semaphore)\n# define __cpp_lib_semaphore 201907L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_semaphore) && defined(__glibcxx_want_semaphore) */\n#undef __glibcxx_want_semaphore\n\n#if !defined(__cpp_lib_smart_ptr_for_overwrite)\n# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED\n# define __glibcxx_smart_ptr_for_overwrite 202002L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_smart_ptr_for_overwrite)\n# define __cpp_lib_smart_ptr_for_overwrite 202002L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_smart_ptr_for_overwrite) && defined(__glibcxx_want_smart_ptr_for_overwrite) */\n#undef __glibcxx_want_smart_ptr_for_overwrite\n\n#if !defined(__cpp_lib_syncbuf)\n# if (__cplusplus >= 202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED\n# define __glibcxx_syncbuf 201803L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_syncbuf)\n# define __cpp_lib_syncbuf 201803L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_syncbuf) && defined(__glibcxx_want_syncbuf) */\n#undef __glibcxx_want_syncbuf\n\n#if !defined(__cpp_lib_byteswap)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_byteswap 202110L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_byteswap)\n# define __cpp_lib_byteswap 202110L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_byteswap) && defined(__glibcxx_want_byteswap) */\n#undef __glibcxx_want_byteswap\n\n#if !defined(__cpp_lib_constexpr_charconv)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_constexpr_charconv 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_charconv)\n# define __cpp_lib_constexpr_charconv 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_charconv) && defined(__glibcxx_want_constexpr_charconv) */\n#undef __glibcxx_want_constexpr_charconv\n\n#if !defined(__cpp_lib_constexpr_typeinfo)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_constexpr_typeinfo 202106L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_typeinfo)\n# define __cpp_lib_constexpr_typeinfo 202106L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_typeinfo) && defined(__glibcxx_want_constexpr_typeinfo) */\n#undef __glibcxx_want_constexpr_typeinfo\n\n#if !defined(__cpp_lib_expected)\n# if (__cplusplus >= 202100L) && (__cpp_concepts >= 202002L)\n# define __glibcxx_expected 202211L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_expected)\n# define __cpp_lib_expected 202211L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_expected) && defined(__glibcxx_want_expected) */\n#undef __glibcxx_want_expected\n\n#if !defined(__cpp_lib_format_ranges)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_format_ranges 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format_ranges)\n# define __cpp_lib_format_ranges 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_format_ranges) && defined(__glibcxx_want_format_ranges) */\n#undef __glibcxx_want_format_ranges\n\n#if !defined(__cpp_lib_freestanding_algorithm)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_freestanding_algorithm 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_algorithm)\n# define __cpp_lib_freestanding_algorithm 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_freestanding_algorithm) && defined(__glibcxx_want_freestanding_algorithm) */\n#undef __glibcxx_want_freestanding_algorithm\n\n#if !defined(__cpp_lib_freestanding_array)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_freestanding_array 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_array)\n# define __cpp_lib_freestanding_array 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_freestanding_array) && defined(__glibcxx_want_freestanding_array) */\n#undef __glibcxx_want_freestanding_array\n\n#if !defined(__cpp_lib_freestanding_cstring)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_freestanding_cstring 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_cstring)\n# define __cpp_lib_freestanding_cstring 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_freestanding_cstring) && defined(__glibcxx_want_freestanding_cstring) */\n#undef __glibcxx_want_freestanding_cstring\n\n#if !defined(__cpp_lib_freestanding_expected)\n# if (__cplusplus >= 202100L) && (__cpp_lib_expected)\n# define __glibcxx_freestanding_expected 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_expected)\n# define __cpp_lib_freestanding_expected 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_freestanding_expected) && defined(__glibcxx_want_freestanding_expected) */\n#undef __glibcxx_want_freestanding_expected\n\n#if !defined(__cpp_lib_freestanding_optional)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_freestanding_optional 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_optional)\n# define __cpp_lib_freestanding_optional 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_freestanding_optional) && defined(__glibcxx_want_freestanding_optional) */\n#undef __glibcxx_want_freestanding_optional\n\n#if !defined(__cpp_lib_freestanding_string_view)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_freestanding_string_view 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_string_view)\n# define __cpp_lib_freestanding_string_view 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_freestanding_string_view) && defined(__glibcxx_want_freestanding_string_view) */\n#undef __glibcxx_want_freestanding_string_view\n\n#if !defined(__cpp_lib_freestanding_variant)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_freestanding_variant 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_variant)\n# define __cpp_lib_freestanding_variant 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_freestanding_variant) && defined(__glibcxx_want_freestanding_variant) */\n#undef __glibcxx_want_freestanding_variant\n\n#if !defined(__cpp_lib_invoke_r)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_invoke_r 202106L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_invoke_r)\n# define __cpp_lib_invoke_r 202106L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_invoke_r) && defined(__glibcxx_want_invoke_r) */\n#undef __glibcxx_want_invoke_r\n\n#if !defined(__cpp_lib_is_scoped_enum)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_is_scoped_enum 202011L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_scoped_enum)\n# define __cpp_lib_is_scoped_enum 202011L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_scoped_enum) && defined(__glibcxx_want_is_scoped_enum) */\n#undef __glibcxx_want_is_scoped_enum\n\n#if !defined(__cpp_lib_reference_from_temporary)\n# if (__cplusplus >= 202100L) && (__has_builtin(__reference_constructs_from_temporary) && __has_builtin(__reference_converts_from_temporary))\n# define __glibcxx_reference_from_temporary 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_reference_from_temporary)\n# define __cpp_lib_reference_from_temporary 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_reference_from_temporary) && defined(__glibcxx_want_reference_from_temporary) */\n#undef __glibcxx_want_reference_from_temporary\n\n#if !defined(__cpp_lib_containers_ranges)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_containers_ranges 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_containers_ranges)\n# define __cpp_lib_containers_ranges 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_containers_ranges) && defined(__glibcxx_want_containers_ranges) */\n#undef __glibcxx_want_containers_ranges\n\n#if !defined(__cpp_lib_ranges_to_container)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_ranges_to_container 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_to_container)\n# define __cpp_lib_ranges_to_container 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_to_container) && defined(__glibcxx_want_ranges_to_container) */\n#undef __glibcxx_want_ranges_to_container\n\n#if !defined(__cpp_lib_ranges_zip)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_zip 202110L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_zip)\n# define __cpp_lib_ranges_zip 202110L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_zip) && defined(__glibcxx_want_ranges_zip) */\n#undef __glibcxx_want_ranges_zip\n\n#if !defined(__cpp_lib_ranges_chunk)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_chunk 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_chunk)\n# define __cpp_lib_ranges_chunk 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_chunk) && defined(__glibcxx_want_ranges_chunk) */\n#undef __glibcxx_want_ranges_chunk\n\n#if !defined(__cpp_lib_ranges_slide)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_slide 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_slide)\n# define __cpp_lib_ranges_slide 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_slide) && defined(__glibcxx_want_ranges_slide) */\n#undef __glibcxx_want_ranges_slide\n\n#if !defined(__cpp_lib_ranges_chunk_by)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_chunk_by 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_chunk_by)\n# define __cpp_lib_ranges_chunk_by 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_chunk_by) && defined(__glibcxx_want_ranges_chunk_by) */\n#undef __glibcxx_want_ranges_chunk_by\n\n#if !defined(__cpp_lib_ranges_join_with)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_join_with 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_join_with)\n# define __cpp_lib_ranges_join_with 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_join_with) && defined(__glibcxx_want_ranges_join_with) */\n#undef __glibcxx_want_ranges_join_with\n\n#if !defined(__cpp_lib_ranges_repeat)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_repeat 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_repeat)\n# define __cpp_lib_ranges_repeat 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_repeat) && defined(__glibcxx_want_ranges_repeat) */\n#undef __glibcxx_want_ranges_repeat\n\n#if !defined(__cpp_lib_ranges_stride)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_stride 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_stride)\n# define __cpp_lib_ranges_stride 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_stride) && defined(__glibcxx_want_ranges_stride) */\n#undef __glibcxx_want_ranges_stride\n\n#if !defined(__cpp_lib_ranges_cartesian_product)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_cartesian_product 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_cartesian_product)\n# define __cpp_lib_ranges_cartesian_product 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_cartesian_product) && defined(__glibcxx_want_ranges_cartesian_product) */\n#undef __glibcxx_want_ranges_cartesian_product\n\n#if !defined(__cpp_lib_ranges_as_rvalue)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_as_rvalue 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_as_rvalue)\n# define __cpp_lib_ranges_as_rvalue 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_as_rvalue) && defined(__glibcxx_want_ranges_as_rvalue) */\n#undef __glibcxx_want_ranges_as_rvalue\n\n#if !defined(__cpp_lib_ranges_as_const)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_as_const 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_as_const)\n# define __cpp_lib_ranges_as_const 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_as_const) && defined(__glibcxx_want_ranges_as_const) */\n#undef __glibcxx_want_ranges_as_const\n\n#if !defined(__cpp_lib_ranges_enumerate)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_enumerate 202302L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_enumerate)\n# define __cpp_lib_ranges_enumerate 202302L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_enumerate) && defined(__glibcxx_want_ranges_enumerate) */\n#undef __glibcxx_want_ranges_enumerate\n\n#if !defined(__cpp_lib_ranges_fold)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_fold 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_fold)\n# define __cpp_lib_ranges_fold 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_fold) && defined(__glibcxx_want_ranges_fold) */\n#undef __glibcxx_want_ranges_fold\n\n#if !defined(__cpp_lib_ranges_contains)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_contains 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_contains)\n# define __cpp_lib_ranges_contains 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_contains) && defined(__glibcxx_want_ranges_contains) */\n#undef __glibcxx_want_ranges_contains\n\n#if !defined(__cpp_lib_ranges_iota)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_iota 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_iota)\n# define __cpp_lib_ranges_iota 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_iota) && defined(__glibcxx_want_ranges_iota) */\n#undef __glibcxx_want_ranges_iota\n\n#if !defined(__cpp_lib_ranges_find_last)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_ranges_find_last 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_find_last)\n# define __cpp_lib_ranges_find_last 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_find_last) && defined(__glibcxx_want_ranges_find_last) */\n#undef __glibcxx_want_ranges_find_last\n\n#if !defined(__cpp_lib_constexpr_bitset)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED && (__cpp_constexpr_dynamic_alloc)\n# define __glibcxx_constexpr_bitset 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_bitset)\n# define __cpp_lib_constexpr_bitset 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_bitset) && defined(__glibcxx_want_constexpr_bitset) */\n#undef __glibcxx_want_constexpr_bitset\n\n#if !defined(__cpp_lib_stdatomic_h)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_stdatomic_h 202011L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_stdatomic_h)\n# define __cpp_lib_stdatomic_h 202011L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_stdatomic_h) && defined(__glibcxx_want_stdatomic_h) */\n#undef __glibcxx_want_stdatomic_h\n\n#if !defined(__cpp_lib_adaptor_iterator_pair_constructor)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_adaptor_iterator_pair_constructor 202106L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_adaptor_iterator_pair_constructor)\n# define __cpp_lib_adaptor_iterator_pair_constructor 202106L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_adaptor_iterator_pair_constructor) && defined(__glibcxx_want_adaptor_iterator_pair_constructor) */\n#undef __glibcxx_want_adaptor_iterator_pair_constructor\n\n#if !defined(__cpp_lib_flat_map)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_flat_map 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_flat_map)\n# define __cpp_lib_flat_map 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_flat_map) && defined(__glibcxx_want_flat_map) */\n#undef __glibcxx_want_flat_map\n\n#if !defined(__cpp_lib_flat_set)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_flat_set 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_flat_set)\n# define __cpp_lib_flat_set 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_flat_set) && defined(__glibcxx_want_flat_set) */\n#undef __glibcxx_want_flat_set\n\n#if !defined(__cpp_lib_formatters)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_formatters 202302L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_formatters)\n# define __cpp_lib_formatters 202302L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_formatters) && defined(__glibcxx_want_formatters) */\n#undef __glibcxx_want_formatters\n\n#if !defined(__cpp_lib_forward_like)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_forward_like 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_forward_like)\n# define __cpp_lib_forward_like 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_forward_like) && defined(__glibcxx_want_forward_like) */\n#undef __glibcxx_want_forward_like\n\n#if !defined(__cpp_lib_generator)\n# if (__cplusplus >= 202100L) && (__glibcxx_coroutine && __cpp_sized_deallocation)\n# define __glibcxx_generator 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_generator)\n# define __cpp_lib_generator 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_generator) && defined(__glibcxx_want_generator) */\n#undef __glibcxx_want_generator\n\n#if !defined(__cpp_lib_ios_noreplace)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_ios_noreplace 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ios_noreplace)\n# define __cpp_lib_ios_noreplace 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ios_noreplace) && defined(__glibcxx_want_ios_noreplace) */\n#undef __glibcxx_want_ios_noreplace\n\n#if !defined(__cpp_lib_move_only_function)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_move_only_function 202110L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_move_only_function)\n# define __cpp_lib_move_only_function 202110L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_move_only_function) && defined(__glibcxx_want_move_only_function) */\n#undef __glibcxx_want_move_only_function\n\n#if !defined(__cpp_lib_out_ptr)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_out_ptr 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_out_ptr)\n# define __cpp_lib_out_ptr 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_out_ptr) && defined(__glibcxx_want_out_ptr) */\n#undef __glibcxx_want_out_ptr\n\n#if !defined(__cpp_lib_print)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_print 202211L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_print)\n# define __cpp_lib_print 202211L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_print) && defined(__glibcxx_want_print) */\n#undef __glibcxx_want_print\n\n#if !defined(__cpp_lib_spanstream)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED && (__glibcxx_span)\n# define __glibcxx_spanstream 202106L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_spanstream)\n# define __cpp_lib_spanstream 202106L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_spanstream) && defined(__glibcxx_want_spanstream) */\n#undef __glibcxx_want_spanstream\n\n#if !defined(__cpp_lib_stacktrace)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED && (_GLIBCXX_HAVE_STACKTRACE)\n# define __glibcxx_stacktrace 202011L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_stacktrace)\n# define __cpp_lib_stacktrace 202011L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_stacktrace) && defined(__glibcxx_want_stacktrace) */\n#undef __glibcxx_want_stacktrace\n\n#if !defined(__cpp_lib_string_contains)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_string_contains 202011L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_contains)\n# define __cpp_lib_string_contains 202011L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_string_contains) && defined(__glibcxx_want_string_contains) */\n#undef __glibcxx_want_string_contains\n\n#if !defined(__cpp_lib_string_resize_and_overwrite)\n# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED\n# define __glibcxx_string_resize_and_overwrite 202110L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_resize_and_overwrite)\n# define __cpp_lib_string_resize_and_overwrite 202110L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_string_resize_and_overwrite) && defined(__glibcxx_want_string_resize_and_overwrite) */\n#undef __glibcxx_want_string_resize_and_overwrite\n\n#if !defined(__cpp_lib_to_underlying)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_to_underlying 202102L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_underlying)\n# define __cpp_lib_to_underlying 202102L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_to_underlying) && defined(__glibcxx_want_to_underlying) */\n#undef __glibcxx_want_to_underlying\n\n#if !defined(__cpp_lib_tuple_like)\n# if (__cplusplus > 202302L) && (__cpp_explicit_this_parameter >= 202110L)\n# define __glibcxx_tuple_like 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuple_like)\n# define __cpp_lib_tuple_like 202311L\n# endif\n# elif (__cplusplus >= 202100L)\n# define __glibcxx_tuple_like 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuple_like)\n# define __cpp_lib_tuple_like 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_tuple_like) && defined(__glibcxx_want_tuple_like) */\n#undef __glibcxx_want_tuple_like\n\n#if !defined(__cpp_lib_unreachable)\n# if (__cplusplus >= 202100L)\n# define __glibcxx_unreachable 202202L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_unreachable)\n# define __cpp_lib_unreachable 202202L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_unreachable) && defined(__glibcxx_want_unreachable) */\n#undef __glibcxx_want_unreachable\n\n#if !defined(__cpp_lib_algorithm_default_value_type)\n# if (__cplusplus > 202302L)\n# define __glibcxx_algorithm_default_value_type 202403L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_algorithm_default_value_type)\n# define __cpp_lib_algorithm_default_value_type 202403L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_algorithm_default_value_type) && defined(__glibcxx_want_algorithm_default_value_type) */\n#undef __glibcxx_want_algorithm_default_value_type\n\n#if !defined(__cpp_lib_constexpr_new)\n# if (__cplusplus > 202302L) && (__cpp_constexpr >= 202406L)\n# define __glibcxx_constexpr_new 202406L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_new)\n# define __cpp_lib_constexpr_new 202406L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_constexpr_new) && defined(__glibcxx_want_constexpr_new) */\n#undef __glibcxx_want_constexpr_new\n\n#if !defined(__cpp_lib_fstream_native_handle)\n# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED\n# define __glibcxx_fstream_native_handle 202306L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_fstream_native_handle)\n# define __cpp_lib_fstream_native_handle 202306L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_fstream_native_handle) && defined(__glibcxx_want_fstream_native_handle) */\n#undef __glibcxx_want_fstream_native_handle\n\n#if !defined(__cpp_lib_is_virtual_base_of)\n# if (__cplusplus > 202302L) && (__has_builtin(__builtin_is_virtual_base_of))\n# define __glibcxx_is_virtual_base_of 202406L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_virtual_base_of)\n# define __cpp_lib_is_virtual_base_of 202406L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_is_virtual_base_of) && defined(__glibcxx_want_is_virtual_base_of) */\n#undef __glibcxx_want_is_virtual_base_of\n\n#if !defined(__cpp_lib_ranges_cache_latest)\n# if (__cplusplus > 202302L)\n# define __glibcxx_ranges_cache_latest 202411L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_cache_latest)\n# define __cpp_lib_ranges_cache_latest 202411L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_cache_latest) && defined(__glibcxx_want_ranges_cache_latest) */\n#undef __glibcxx_want_ranges_cache_latest\n\n#if !defined(__cpp_lib_ranges_concat)\n# if (__cplusplus > 202302L) && (__cpp_pack_indexing)\n# define __glibcxx_ranges_concat 202403L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_concat)\n# define __cpp_lib_ranges_concat 202403L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_concat) && defined(__glibcxx_want_ranges_concat) */\n#undef __glibcxx_want_ranges_concat\n\n#if !defined(__cpp_lib_ratio)\n# if (__cplusplus > 202302L)\n# define __glibcxx_ratio 202306L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ratio)\n# define __cpp_lib_ratio 202306L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ratio) && defined(__glibcxx_want_ratio) */\n#undef __glibcxx_want_ratio\n\n#if !defined(__cpp_lib_reference_wrapper)\n# if (__cplusplus > 202302L)\n# define __glibcxx_reference_wrapper 202403L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_reference_wrapper)\n# define __cpp_lib_reference_wrapper 202403L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_reference_wrapper) && defined(__glibcxx_want_reference_wrapper) */\n#undef __glibcxx_want_reference_wrapper\n\n#if !defined(__cpp_lib_saturation_arithmetic)\n# if (__cplusplus > 202302L)\n# define __glibcxx_saturation_arithmetic 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_saturation_arithmetic)\n# define __cpp_lib_saturation_arithmetic 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_saturation_arithmetic) && defined(__glibcxx_want_saturation_arithmetic) */\n#undef __glibcxx_want_saturation_arithmetic\n\n#if !defined(__cpp_lib_span_initializer_list)\n# if (__cplusplus > 202302L)\n# define __glibcxx_span_initializer_list 202311L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_span_initializer_list)\n# define __cpp_lib_span_initializer_list 202311L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_span_initializer_list) && defined(__glibcxx_want_span_initializer_list) */\n#undef __glibcxx_want_span_initializer_list\n\n#if !defined(__cpp_lib_text_encoding)\n# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED && (_GLIBCXX_USE_NL_LANGINFO_L)\n# define __glibcxx_text_encoding 202306L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_text_encoding)\n# define __cpp_lib_text_encoding 202306L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_text_encoding) && defined(__glibcxx_want_text_encoding) */\n#undef __glibcxx_want_text_encoding\n\n#if !defined(__cpp_lib_ranges_to_input)\n# if (__cplusplus > 202302L)\n# define __glibcxx_ranges_to_input 202502L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_to_input)\n# define __cpp_lib_ranges_to_input 202502L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_ranges_to_input) && defined(__glibcxx_want_ranges_to_input) */\n#undef __glibcxx_want_ranges_to_input\n\n#if !defined(__cpp_lib_to_string)\n# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED && (__glibcxx_to_chars)\n# define __glibcxx_to_string 202306L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_string)\n# define __cpp_lib_to_string 202306L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_to_string) && defined(__glibcxx_want_to_string) */\n#undef __glibcxx_want_to_string\n\n#if !defined(__cpp_lib_modules)\n# if (__cplusplus >= 202002L) && (__cpp_modules)\n# define __glibcxx_modules 202207L\n# if defined(__glibcxx_want_all) || defined(__glibcxx_want_modules)\n# define __cpp_lib_modules 202207L\n# endif\n# endif\n#endif /* !defined(__cpp_lib_modules) && defined(__glibcxx_want_modules) */\n#undef __glibcxx_want_modules\n\n#undef __glibcxx_want_all\n","include/ext/numeric_traits.h":"// -*- C++ -*-\n\n// Copyright (C) 2007-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n/** @file ext/numeric_traits.h\n * This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _EXT_NUMERIC_TRAITS\n#define _EXT_NUMERIC_TRAITS 1\n\n#ifdef _GLIBCXX_SYSHDR\n#pragma GCC system_header\n#endif\n\n#include <bits/cpp_type_traits.h>\n#include <ext/type_traits.h>\n\nnamespace __gnu_cxx _GLIBCXX_VISIBILITY(default)\n{\n_GLIBCXX_BEGIN_NAMESPACE_VERSION\n\n // Compile time constants for builtin types.\n // In C++98 std::numeric_limits member functions are not constant expressions\n // (that changed in C++11 with the addition of 'constexpr').\n // Even for C++11, this header is smaller than <limits> and can be used\n // when only is_signed, digits, min, or max values are needed for integers,\n // or is_signed, digits10, max_digits10, or max_exponent10 for floats.\n\n // Unlike __is_integer (and std::is_integral) this trait is true for\n // non-standard built-in integer types such as __int128 and __int20.\n template<typename _Tp>\n struct __is_integer_nonstrict\n : public std::__is_integer<_Tp>\n {\n using std::__is_integer<_Tp>::__value;\n\n // The number of bits in the value representation.\n enum { __width = __value ? sizeof(_Tp) * __CHAR_BIT__ : 0 };\n };\n\n template<typename _Value>\n struct __numeric_traits_integer\n {\n#if __cplusplus >= 201103L\n static_assert(__is_integer_nonstrict<_Value>::__value,\n\t\t \"invalid specialization\");\n#endif\n\n // NB: these two are also available in std::numeric_limits as compile\n // time constants, but <limits> is big and we can avoid including it.\n static const bool __is_signed = (_Value)(-1) < 0;\n static const int __digits\n\t= __is_integer_nonstrict<_Value>::__width - __is_signed;\n\n // The initializers must be constants so that __max and __min are too.\n static const _Value __max = __is_signed\n\t? (((((_Value)1 << (__digits - 1)) - 1) << 1) + 1)\n\t: ~(_Value)0;\n static const _Value __min = __is_signed ? -__max - 1 : (_Value)0;\n };\n\n template<typename _Value>\n const _Value __numeric_traits_integer<_Value>::__min;\n\n template<typename _Value>\n const _Value __numeric_traits_integer<_Value>::__max;\n\n template<typename _Value>\n const bool __numeric_traits_integer<_Value>::__is_signed;\n\n template<typename _Value>\n const int __numeric_traits_integer<_Value>::__digits;\n\n // Enable __numeric_traits_integer for types where the __is_integer_nonstrict\n // primary template doesn't give the right answer.\n#define _GLIBCXX_INT_N_TRAITS(T, WIDTH)\t\t\t\\\n __extension__\t\t\t\t\t\t\\\n template<> struct __is_integer_nonstrict<T>\t\t\\\n {\t\t\t\t\t\t\t\\\n enum { __value = 1 };\t\t\t\t\\\n typedef std::__true_type __type;\t\t\t\\\n enum { __width = WIDTH };\t\t\t\t\\\n };\t\t\t\t\t\t\t\\\n __extension__\t\t\t\t\t\t\\\n template<> struct __is_integer_nonstrict<unsigned T>\t\\\n {\t\t\t\t\t\t\t\\\n enum { __value = 1 };\t\t\t\t\\\n typedef std::__true_type __type;\t\t\t\\\n enum { __width = WIDTH };\t\t\t\t\\\n };\n\n // We need to specify the width for some __intNN types because they\n // have padding bits, e.g. the object representation of __int20 has 32 bits,\n // but its width (number of bits in the value representation) is only 20.\n#if defined __GLIBCXX_TYPE_INT_N_0 && __GLIBCXX_BITSIZE_INT_N_0 % __CHAR_BIT__\n _GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0)\n#endif\n#if defined __GLIBCXX_TYPE_INT_N_1 && __GLIBCXX_BITSIZE_INT_N_1 % __CHAR_BIT__\n _GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1)\n#endif\n#if defined __GLIBCXX_TYPE_INT_N_2 && __GLIBCXX_BITSIZE_INT_N_2 % __CHAR_BIT__\n _GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2)\n#endif\n#if defined __GLIBCXX_TYPE_INT_N_3 && __GLIBCXX_BITSIZE_INT_N_3 % __CHAR_BIT__\n _GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3)\n#endif\n\n#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__\n // In strict modes __is_integer<__int128> is false,\n // but we still want to define __numeric_traits_integer<__int128>.\n _GLIBCXX_INT_N_TRAITS(__int128, 128)\n#endif\n\n#undef _GLIBCXX_INT_N_TRAITS\n\n#if __cplusplus >= 201103L\n /// Convenience alias for __numeric_traits<integer-type>.\n template<typename _Tp>\n using __int_traits = __numeric_traits_integer<_Tp>;\n#endif\n\n#define __glibcxx_floating(_Tp, _Fval, _Dval, _LDval) \\\n (std::__are_same<_Tp, float>::__value ? _Fval \\\n : std::__are_same<_Tp, double>::__value ? _Dval : _LDval)\n\n#define __glibcxx_max_digits10(_Tp) \\\n (2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \\\n\t\t\t __LDBL_MANT_DIG__) * 643L / 2136)\n\n#define __glibcxx_digits10(_Tp) \\\n __glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__)\n\n#define __glibcxx_max_exponent10(_Tp) \\\n __glibcxx_floating(_Tp, __FLT_MAX_10_EXP__, __DBL_MAX_10_EXP__, \\\n\t\t __LDBL_MAX_10_EXP__)\n\n // N.B. this only supports float, double and long double (no __float128 etc.)\n template<typename _Value>\n struct __numeric_traits_floating\n {\n // Only floating point types. See N1822.\n static const int __max_digits10 = __glibcxx_max_digits10(_Value);\n\n // See above comment...\n static const bool __is_signed = true;\n static const int __digits10 = __glibcxx_digits10(_Value);\n static const int __max_exponent10 = __glibcxx_max_exponent10(_Value);\n };\n\n template<typename _Value>\n const int __numeric_traits_floating<_Value>::__max_digits10;\n\n template<typename _Value>\n const bool __numeric_traits_floating<_Value>::__is_signed;\n\n template<typename _Value>\n const int __numeric_traits_floating<_Value>::__digits10;\n\n template<typename _Value>\n const int __numeric_traits_floating<_Value>::__max_exponent10;\n\n#undef __glibcxx_floating\n#undef __glibcxx_max_digits10\n#undef __glibcxx_digits10\n#undef __glibcxx_max_exponent10\n\n template<typename _Value>\n struct __numeric_traits\n : public __numeric_traits_integer<_Value>\n { };\n\n template<>\n struct __numeric_traits<float>\n : public __numeric_traits_floating<float>\n { };\n\n template<>\n struct __numeric_traits<double>\n : public __numeric_traits_floating<double>\n { };\n\n template<>\n struct __numeric_traits<long double>\n : public __numeric_traits_floating<long double>\n { };\n\n#ifdef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT\n# if defined __LONG_DOUBLE_IEEE128__\n // long double is __ieee128, define traits for __ibm128\n template<>\n struct __numeric_traits_floating<__ibm128>\n {\n static const int __max_digits10 = 33;\n static const bool __is_signed = true;\n static const int __digits10 = 31;\n static const int __max_exponent10 = 308;\n };\n template<>\n struct __numeric_traits<__ibm128>\n : public __numeric_traits_floating<__ibm128>\n { };\n# elif defined __LONG_DOUBLE_IBM128__\n // long double is __ibm128, define traits for __ieee128\n template<>\n struct __numeric_traits_floating<__ieee128>\n {\n static const int __max_digits10 = 36;\n static const bool __is_signed = true;\n static const int __digits10 = 33;\n static const int __max_exponent10 = 4932;\n };\n template<>\n struct __numeric_traits<__ieee128>\n : public __numeric_traits_floating<__ieee128>\n { };\n# endif\n#endif\n\n_GLIBCXX_END_NAMESPACE_VERSION\n} // namespace\n\n#endif\n","include/ext/pb_ds/assoc_container.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file assoc_container.hpp\n * Contains associative containers.\n */\n\n#ifndef PB_DS_ASSOC_CNTNR_HPP\n#define PB_DS_ASSOC_CNTNR_HPP\n\n#include <bits/c++config.h>\n#include <ext/typelist.h>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/standard_policies.hpp>\n#include <ext/pb_ds/detail/container_base_dispatch.hpp>\n#include <ext/pb_ds/detail/branch_policy/traits.hpp>\n\nnamespace __gnu_pbds\n{\n /**\n * @defgroup containers-pbds Containers\n * @ingroup pbds\n * @{\n */\n\n /**\n * @defgroup hash-based Hash-Based\n * @ingroup containers-pbds\n * @{\n */\n#define PB_DS_HASH_BASE \\\n detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, \\\n typename __gnu_cxx::typelist::append< \\\n typename __gnu_cxx::typelist::create4<Hash_Fn, Eq_Fn, Resize_Policy, \\\n detail::integral_constant<int, Store_Hash> >::type, Policy_Tl>::type>::type\n\n /**\n * @defgroup hash-detail Base and Policy Classes\n * @ingroup hash-based\n */\n\n /**\n * A hashed container abstraction.\n *\n * @tparam Key \t \tKey type.\n * @tparam Mapped \t \tMap type.\n * @tparam Hash_Fn\t \tHashing functor.\n * @tparam Eq_Fn\t \tEqual functor.\n * @tparam Resize_Policy \tResizes hash.\n * @tparam Store_Hash \tIndicates whether the hash value\n * will be stored along with each key.\n * @tparam Tag \t \tInstantiating data structure type,\n *\t\t\t \tsee container_tag.\n * @tparam Policy_TL\t \tPolicy typelist.\n * @tparam _Alloc \t \tAllocator type.\n *\n * Base is dispatched at compile time via Tag, from the following\n * choices: cc_hash_tag, gp_hash_tag, and descendants of basic_hash_tag.\n *\n * Base choices are: detail::cc_ht_map, detail::gp_ht_map\n */\n template<typename Key,\n\t typename Mapped,\n\t typename Hash_Fn,\n\t typename Eq_Fn,\n\t typename Resize_Policy,\n\t bool Store_Hash,\n\t typename Tag,\n\t typename Policy_Tl,\n\t typename _Alloc>\n class basic_hash_table : public PB_DS_HASH_BASE\n {\n private:\n typedef typename PB_DS_HASH_BASE \t\tbase_type;\n\n public:\n virtual\n ~basic_hash_table() { }\n\n protected:\n basic_hash_table() { }\n\n basic_hash_table(const basic_hash_table& other)\n : base_type((const base_type&)other) { }\n\n template<typename T0>\n basic_hash_table(T0 t0) : base_type(t0) { }\n\n template<typename T0, typename T1>\n basic_hash_table(T0 t0, T1 t1) : base_type(t0, t1) { }\n\n template<typename T0, typename T1, typename T2>\n basic_hash_table(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2) { }\n\n template<typename T0, typename T1, typename T2, typename T3>\n basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3)\n : base_type(t0, t1, t2, t3) { }\n\n template<typename T0, typename T1, typename T2, typename T3, typename T4>\n basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4)\n : base_type(t0, t1, t2, t3, t4) { }\n\n template<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5>\n basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)\n : base_type(t0, t1, t2, t3, t4, t5) { }\n\n template<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5, typename T6>\n basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)\n : base_type(t0, t1, t2, t3, t4, t5, t6) { }\n\n template<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5, typename T6, typename T7>\n basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)\n : base_type(t0, t1, t2, t3, t4, t5, t6, t7) { }\n\n template<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5, typename T6, typename T7, typename T8>\n basic_hash_table(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6,\n\t\t T7 t7, T8 t8)\n : base_type(t0, t1, t2, t3, t4, t5, t6, t7, t8)\n { }\n\n private:\n basic_hash_table&\n operator=(const base_type&);\n };\n\n#undef PB_DS_HASH_BASE\n\n\n#define PB_DS_CC_HASH_BASE \\\n basic_hash_table<Key, Mapped,\tHash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \\\n\t\t cc_hash_tag,\t\\\n\t typename __gnu_cxx::typelist::create1<Comb_Hash_Fn>::type, _Alloc>\n\n\n /**\n * A collision-chaining hash-based associative container.\n *\n * @tparam Key \t \tKey type.\n * @tparam Mapped \t \tMap type.\n * @tparam Hash_Fn\t \tHashing functor.\n * @tparam Eq_Fn\t \tEqual functor.\n * @tparam Comb_Hash_Fn\tCombining hash functor.\n * If Hash_Fn is not null_type, then this\n * is the ranged-hash functor; otherwise,\n * this is the range-hashing functor.\n * XXX(See Design::Hash-Based Containers::Hash Policies.)\n * @tparam Resize_Policy \tResizes hash.\n * @tparam Store_Hash \tIndicates whether the hash value\n * will be stored along with each key.\n * If Hash_Fn is null_type, then the\n * container will not compile if this\n * value is true\n * @tparam _Alloc \t \tAllocator type.\n *\n * Base tag choices are: \tcc_hash_tag.\n *\n * Base is basic_hash_table.\n */\n template<typename Key,\n\t typename Mapped,\n\t typename Hash_Fn = typename detail::default_hash_fn<Key>::type,\n\t typename Eq_Fn = typename detail::default_eq_fn<Key>::type,\n\t typename Comb_Hash_Fn = detail::default_comb_hash_fn::type,\n\t typename Resize_Policy = typename detail::default_resize_policy<Comb_Hash_Fn>::type,\n\t bool Store_Hash = detail::default_store_hash,\n\t typename _Alloc = std::allocator<char> >\n class cc_hash_table : public PB_DS_CC_HASH_BASE\n {\n private:\n typedef PB_DS_CC_HASH_BASE \t\t\tbase_type;\n\n public:\n typedef cc_hash_tag\t \t\t\tcontainer_category;\n typedef Hash_Fn \t\t\t\thash_fn;\n typedef Eq_Fn \t\t\t\teq_fn;\n typedef Resize_Policy \t\t\tresize_policy;\n typedef Comb_Hash_Fn \t\t\tcomb_hash_fn;\n\n /// Default constructor.\n cc_hash_table() { }\n\n /// Constructor taking some policy objects. r_hash_fn will be\n /// copied by the Hash_Fn object of the container object.\n cc_hash_table(const hash_fn& h)\n : base_type(h) { }\n\n /// Constructor taking some policy objects. r_hash_fn will be\n /// copied by the hash_fn object of the container object, and\n /// r_eq_fn will be copied by the eq_fn object of the container\n /// object.\n cc_hash_table(const hash_fn& h, const eq_fn& e)\n : base_type(h, e) { }\n\n /// Constructor taking some policy objects. r_hash_fn will be\n /// copied by the hash_fn object of the container object, r_eq_fn\n /// will be copied by the eq_fn object of the container object,\n /// and r_comb_hash_fn will be copied by the comb_hash_fn object\n /// of the container object.\n cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch)\n : base_type(h, e, ch) { }\n\n /// Constructor taking some policy objects. r_hash_fn will be\n /// copied by the hash_fn object of the container object, r_eq_fn\n /// will be copied by the eq_fn object of the container object,\n /// r_comb_hash_fn will be copied by the comb_hash_fn object of\n /// the container object, and r_resize_policy will be copied by\n /// the resize_policy object of the container object.\n cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch,\n\t\t const resize_policy& rp)\n : base_type(h, e, ch, rp) { }\n\n /// Constructor taking __iterators to a range of value_types. The\n /// value_types between first_it and last_it will be inserted into\n /// the container object.\n template<typename It>\n cc_hash_table(It first, It last)\n { base_type::copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects. The value_types between first_it and\n /// last_it will be inserted into the container object.\n template<typename It>\n cc_hash_table(It first, It last, const hash_fn& h)\n : base_type(h)\n { this->copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects The value_types between first_it and\n /// last_it will be inserted into the container object. r_hash_fn\n /// will be copied by the hash_fn object of the container object,\n /// and r_eq_fn will be copied by the eq_fn object of the\n /// container object.\n template<typename It>\n cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)\n : base_type(h, e)\n { this->copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects The value_types between first_it and\n /// last_it will be inserted into the container object. r_hash_fn\n /// will be copied by the hash_fn object of the container object,\n /// r_eq_fn will be copied by the eq_fn object of the container\n /// object, and r_comb_hash_fn will be copied by the comb_hash_fn\n /// object of the container object.\n template<typename It>\n cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,\n\t\t const comb_hash_fn& ch)\n : base_type(h, e, ch)\n { this->copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects The value_types between first_it and\n /// last_it will be inserted into the container object. r_hash_fn\n /// will be copied by the hash_fn object of the container object,\n /// r_eq_fn will be copied by the eq_fn object of the container\n /// object, r_comb_hash_fn will be copied by the comb_hash_fn\n /// object of the container object, and r_resize_policy will be\n /// copied by the resize_policy object of the container object.\n template<typename It>\n cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,\n\t\t const comb_hash_fn& ch, const resize_policy& rp)\n : base_type(h, e, ch, rp)\n { this->copy_from_range(first, last); }\n\n cc_hash_table(const cc_hash_table& other)\n : base_type((const base_type&)other)\n { }\n\n virtual\n ~cc_hash_table() { }\n\n cc_hash_table&\n operator=(const cc_hash_table& other)\n {\n if (this != &other)\n\t{\n\t cc_hash_table tmp(other);\n\t swap(tmp);\n\t}\n return *this;\n }\n\n void\n swap(cc_hash_table& other)\n { base_type::swap(other); }\n };\n\n#undef PB_DS_CC_HASH_BASE\n\n\n#define PB_DS_GP_HASH_BASE \\\n basic_hash_table<Key, Mapped,\tHash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \\\n\t\t gp_hash_tag, \\\n typename __gnu_cxx::typelist::create2<Comb_Probe_Fn, Probe_Fn>::type, _Alloc>\n\n\n /**\n * A general-probing hash-based associative container.\n *\n * @tparam Key \t \tKey type.\n * @tparam Mapped \t \tMap type.\n * @tparam Hash_Fn\t \tHashing functor.\n * @tparam Eq_Fn\t \tEqual functor.\n * @tparam Comb_Probe_Fn\tCombining probe functor.\n * If Hash_Fn is not null_type, then this\n * is the ranged-probe functor; otherwise,\n * this is the range-hashing functor.\n * XXX See Design::Hash-Based Containers::Hash Policies.\n * @tparam Probe_Fn\t\tProbe functor.\n * @tparam Resize_Policy \tResizes hash.\n * @tparam Store_Hash \tIndicates whether the hash value\n * will be stored along with each key.\n * If Hash_Fn is null_type, then the\n * container will not compile if this\n * value is true\n * @tparam _Alloc \t \tAllocator type.\n *\n * Base tag choices are: \tgp_hash_tag.\n *\n * Base is basic_hash_table.\n */\n template<typename Key,\n\t typename Mapped,\n\t typename Hash_Fn = typename detail::default_hash_fn<Key>::type,\n\t typename Eq_Fn = typename detail::default_eq_fn<Key>::type,\n\t typename Comb_Probe_Fn = detail::default_comb_hash_fn::type,\n\t typename Probe_Fn = typename detail::default_probe_fn<Comb_Probe_Fn>::type,\n\t typename Resize_Policy = typename detail::default_resize_policy<Comb_Probe_Fn>::type,\n\t bool Store_Hash = detail::default_store_hash,\n\t typename _Alloc = std::allocator<char> >\n class gp_hash_table : public PB_DS_GP_HASH_BASE\n {\n private:\n typedef PB_DS_GP_HASH_BASE \t\t\tbase_type;\n\n public:\n typedef gp_hash_tag\t \t\t\tcontainer_category;\n typedef Hash_Fn \t\t\t\thash_fn;\n typedef Eq_Fn \t\t\t\teq_fn;\n typedef Comb_Probe_Fn\t\t\tcomb_probe_fn;\n typedef Probe_Fn \t\t\t\tprobe_fn;\n typedef Resize_Policy \t\t\tresize_policy;\n\n /// Default constructor.\n gp_hash_table() { }\n\n /// Constructor taking some policy objects. r_hash_fn will be\n /// copied by the hash_fn object of the container object.\n gp_hash_table(const hash_fn& h)\n : base_type(h) { }\n\n /// Constructor taking some policy objects. r_hash_fn will be\n /// copied by the hash_fn object of the container object, and\n /// r_eq_fn will be copied by the eq_fn object of the container\n /// object.\n gp_hash_table(const hash_fn& h, const eq_fn& e)\n : base_type(h, e) { }\n\n /// Constructor taking some policy objects. r_hash_fn will be\n /// copied by the hash_fn object of the container object, r_eq_fn\n /// will be copied by the eq_fn object of the container object,\n /// and r_comb_probe_fn will be copied by the comb_probe_fn object\n /// of the container object.\n gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp)\n : base_type(h, e, cp) { }\n\n /// Constructor taking some policy objects. r_hash_fn will be\n /// copied by the hash_fn object of the container object, r_eq_fn\n /// will be copied by the eq_fn object of the container object,\n /// r_comb_probe_fn will be copied by the comb_probe_fn object of\n /// the container object, and r_probe_fn will be copied by the\n /// probe_fn object of the container object.\n gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp,\n\t\t const probe_fn& p)\n : base_type(h, e, cp, p) { }\n\n /// Constructor taking some policy objects. r_hash_fn will be\n /// copied by the hash_fn object of the container object, r_eq_fn\n /// will be copied by the eq_fn object of the container object,\n /// r_comb_probe_fn will be copied by the comb_probe_fn object of\n /// the container object, r_probe_fn will be copied by the\n /// probe_fn object of the container object, and r_resize_policy\n /// will be copied by the Resize_Policy object of the container\n /// object.\n gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp,\n\t\t const probe_fn& p, const resize_policy& rp)\n : base_type(h, e, cp, p, rp) { }\n\n /// Constructor taking __iterators to a range of value_types. The\n /// value_types between first_it and last_it will be inserted into\n /// the container object.\n template<typename It>\n gp_hash_table(It first, It last)\n { base_type::copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects. The value_types between first_it and\n /// last_it will be inserted into the container object. r_hash_fn\n /// will be copied by the hash_fn object of the container object.\n template<typename It>\n gp_hash_table(It first, It last, const hash_fn& h)\n : base_type(h)\n { base_type::copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects. The value_types between first_it and\n /// last_it will be inserted into the container object. r_hash_fn\n /// will be copied by the hash_fn object of the container object,\n /// and r_eq_fn will be copied by the eq_fn object of the\n /// container object.\n template<typename It>\n gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)\n : base_type(h, e)\n { base_type::copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects. The value_types between first_it and\n /// last_it will be inserted into the container object. r_hash_fn\n /// will be copied by the hash_fn object of the container object,\n /// r_eq_fn will be copied by the eq_fn object of the container\n /// object, and r_comb_probe_fn will be copied by the\n /// comb_probe_fn object of the container object.\n template<typename It>\n gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,\n\t\t const comb_probe_fn& cp)\n : base_type(h, e, cp)\n { base_type::copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects. The value_types between first_it and\n /// last_it will be inserted into the container object. r_hash_fn\n /// will be copied by the hash_fn object of the container object,\n /// r_eq_fn will be copied by the eq_fn object of the container\n /// object, r_comb_probe_fn will be copied by the comb_probe_fn\n /// object of the container object, and r_probe_fn will be copied\n /// by the probe_fn object of the container object.\n template<typename It>\n gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,\n\t\t const comb_probe_fn& cp, const probe_fn& p)\n : base_type(h, e, cp, p)\n { base_type::copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects. The value_types between first_it and\n /// last_it will be inserted into the container object. r_hash_fn\n /// will be copied by the hash_fn object of the container object,\n /// r_eq_fn will be copied by the eq_fn object of the container\n /// object, r_comb_probe_fn will be copied by the comb_probe_fn\n /// object of the container object, r_probe_fn will be copied by\n /// the probe_fn object of the container object, and\n /// r_resize_policy will be copied by the resize_policy object of\n /// the container object.\n template<typename It>\n gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,\n\t\t const comb_probe_fn& cp, const probe_fn& p,\n\t\t const resize_policy& rp)\n : base_type(h, e, cp, p, rp)\n { base_type::copy_from_range(first, last); }\n\n gp_hash_table(const gp_hash_table& other)\n : base_type((const base_type&)other)\n { }\n\n virtual\n ~gp_hash_table() { }\n\n gp_hash_table&\n operator=(const gp_hash_table& other)\n {\n if (this != &other)\n\t{\n\t gp_hash_table tmp(other);\n\t swap(tmp);\n\t}\n return *this;\n }\n\n void\n swap(gp_hash_table& other)\n { base_type::swap(other); }\n };\n ///@} hash-based\n#undef PB_DS_GP_HASH_BASE\n\n\n /**\n * @defgroup branch-based Branch-Based\n * @ingroup containers-pbds\n * @{\n */\n#define PB_DS_BRANCH_BASE \\\n detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, Policy_Tl>::type\n\n /**\n * @defgroup branch-detail Base and Policy Classes\n * @ingroup branch-based\n */\n\n /**\n * A branched, tree-like (tree, trie) container abstraction.\n *\n * @tparam Key \t \tKey type.\n * @tparam Mapped \t \tMap type.\n * @tparam Tag \t \tInstantiating data structure type,\n * see container_tag.\n * @tparam Node_Update \tUpdates nodes, restores invariants.\n * @tparam Policy_TL Policy typelist.\n * @tparam _Alloc \t \tAllocator type.\n *\n * Base is dispatched at compile time via Tag, from the following\n * choices: tree_tag, trie_tag, and their descendants.\n *\n * Base choices are: detail::ov_tree_map, detail::rb_tree_map,\n *\t\t \tdetail::splay_tree_map, and detail::pat_trie_map.\n */\n template<typename Key, typename Mapped, typename Tag,\n\t typename Node_Update, typename Policy_Tl, typename _Alloc>\n class basic_branch : public PB_DS_BRANCH_BASE\n {\n private:\n typedef typename PB_DS_BRANCH_BASE \t \tbase_type;\n\n public:\n typedef Node_Update \t\t\tnode_update;\n\n virtual\n ~basic_branch() { }\n\n protected:\n basic_branch() { }\n\n basic_branch(const basic_branch& other)\n : base_type((const base_type&)other) { }\n\n template<typename T0>\n basic_branch(T0 t0) : base_type(t0) { }\n\n template<typename T0, typename T1>\n basic_branch(T0 t0, T1 t1) : base_type(t0, t1) { }\n\n template<typename T0, typename T1, typename T2>\n basic_branch(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2) { }\n\n template<typename T0, typename T1, typename T2, typename T3>\n basic_branch(T0 t0, T1 t1, T2 t2, T3 t3)\n : base_type(t0, t1, t2, t3) { }\n\n template<typename T0, typename T1, typename T2, typename T3, typename T4>\n basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4)\n : base_type(t0, t1, t2, t3, t4) { }\n\n template<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5>\n basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)\n : base_type(t0, t1, t2, t3, t4, t5) { }\n\n template<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5, typename T6>\n basic_branch(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)\n : base_type(t0, t1, t2, t3, t4, t5, t6) { }\n };\n#undef PB_DS_BRANCH_BASE\n\n\n#define PB_DS_TREE_NODE_AND_IT_TRAITS \\\n detail::tree_traits<Key, Mapped,Cmp_Fn,Node_Update,Tag,_Alloc>\n\n#define PB_DS_TREE_BASE \\\n basic_branch<Key,Mapped, Tag, \\\n\t typename PB_DS_TREE_NODE_AND_IT_TRAITS::node_update, \\\n\t typename __gnu_cxx::typelist::create2<Cmp_Fn, \\\n\t PB_DS_TREE_NODE_AND_IT_TRAITS>::type, _Alloc>\n\n\n /**\n * A tree-based container.\n *\n * @tparam Key \t \tKey type.\n * @tparam Mapped \t \tMap type.\n * @tparam Cmp_Fn\t \tComparison functor.\n * @tparam Tag \t \tInstantiating data structure type,\n * see container_tag.\n * @tparam Node_Update \tUpdates tree internal-nodes,\n * restores invariants when invalidated.\n * XXX See design::tree-based-containers::node invariants.\n * @tparam _Alloc \t \tAllocator type.\n *\n * Base tag choices are: ov_tree_tag, rb_tree_tag, splay_tree_tag.\n *\n * Base is basic_branch.\n */\n template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,\n\t typename Tag = rb_tree_tag,\n\t template<typename Node_CItr, typename Node_Itr,\n\t\t typename Cmp_Fn_, typename _Alloc_>\n\t class Node_Update = null_node_update,\n\t typename _Alloc = std::allocator<char> >\n class tree : public PB_DS_TREE_BASE\n {\n private:\n typedef PB_DS_TREE_BASE \t\t\tbase_type;\n\n public:\n /// Comparison functor type.\n typedef Cmp_Fn \t\t\t\tcmp_fn;\n\n tree() { }\n\n /// Constructor taking some policy objects. r_cmp_fn will be\n /// copied by the Cmp_Fn object of the container object.\n tree(const cmp_fn& c)\n : base_type(c) { }\n\n /// Constructor taking __iterators to a range of value_types. The\n /// value_types between first_it and last_it will be inserted into\n /// the container object.\n template<typename It>\n tree(It first, It last)\n { base_type::copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects The value_types between first_it and\n /// last_it will be inserted into the container object. r_cmp_fn\n /// will be copied by the cmp_fn object of the container object.\n template<typename It>\n tree(It first, It last, const cmp_fn& c)\n : base_type(c)\n { base_type::copy_from_range(first, last); }\n\n tree(const tree& other)\n : base_type((const base_type&)other) { }\n\n virtual\n ~tree() { }\n\n tree&\n operator=(const tree& other)\n {\n if (this != &other)\n\t{\n\t tree tmp(other);\n\t swap(tmp);\n\t}\n return *this;\n }\n\n void\n swap(tree& other)\n { base_type::swap(other); }\n };\n\n#undef PB_DS_TREE_BASE\n#undef PB_DS_TREE_NODE_AND_IT_TRAITS\n\n\n#define PB_DS_TRIE_NODE_AND_IT_TRAITS \\\n detail::trie_traits<Key,Mapped,_ATraits,Node_Update,Tag,_Alloc>\n\n#define PB_DS_TRIE_BASE \\\n basic_branch<Key,Mapped,Tag, \\\n\t typename PB_DS_TRIE_NODE_AND_IT_TRAITS::node_update, \\\n\t typename __gnu_cxx::typelist::create2<_ATraits, \\\n\t PB_DS_TRIE_NODE_AND_IT_TRAITS >::type, _Alloc>\n\n\n /**\n * A trie-based container.\n *\n * @tparam Key \t \tKey type.\n * @tparam Mapped \t \tMap type.\n * @tparam _ATraits\t \tElement access traits.\n * @tparam Tag \t \tInstantiating data structure type,\n * see container_tag.\n * @tparam Node_Update \tUpdates trie internal-nodes,\n * restores invariants when invalidated.\n * XXX See design::tree-based-containers::node invariants.\n * @tparam _Alloc \t \tAllocator type.\n *\n * Base tag choice is pat_trie_tag.\n *\n * Base is basic_branch.\n */\n template<typename Key,\n\t typename Mapped,\n\t typename _ATraits = \\\n\t\t typename detail::default_trie_access_traits<Key>::type,\n\t typename Tag = pat_trie_tag,\n\t template<typename Node_CItr,\n\t\t typename Node_Itr,\n\t\t typename _ATraits_,\n\t\t typename _Alloc_>\n\t class Node_Update = null_node_update,\n\t typename _Alloc = std::allocator<char> >\n class trie : public PB_DS_TRIE_BASE\n {\n private:\n typedef PB_DS_TRIE_BASE\t\t\tbase_type;\n\n public:\n /// Element access traits type.\n typedef _ATraits \t\t\t\taccess_traits;\n\n trie() { }\n\n /// Constructor taking some policy objects. r_access_traits will\n /// be copied by the _ATraits object of the container object.\n trie(const access_traits& t)\n : base_type(t) { }\n\n /// Constructor taking __iterators to a range of value_types. The\n /// value_types between first_it and last_it will be inserted into\n /// the container object.\n template<typename It>\n trie(It first, It last)\n { base_type::copy_from_range(first, last); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects. The value_types between first_it and\n /// last_it will be inserted into the container object.\n template<typename It>\n trie(It first, It last, const access_traits& t)\n : base_type(t)\n { base_type::copy_from_range(first, last); }\n\n trie(const trie& other)\n : base_type((const base_type&)other) { }\n\n virtual\n ~trie() { }\n\n trie&\n operator=(const trie& other)\n {\n if (this != &other)\n\t{\n\t trie tmp(other);\n\t swap(tmp);\n\t}\n return *this;\n }\n\n void\n swap(trie& other)\n { base_type::swap(other); }\n };\n ///@} branch-based\n#undef PB_DS_TRIE_BASE\n#undef PB_DS_TRIE_NODE_AND_IT_TRAITS\n\n\n /**\n * @defgroup list-based List-Based\n * @ingroup containers-pbds\n * @{\n */\n#define PB_DS_LU_BASE \\\n detail::container_base_dispatch<Key, Mapped, _Alloc, list_update_tag,\t\\\n typename __gnu_cxx::typelist::create2<Eq_Fn, Update_Policy>::type>::type\n\n\n /**\n * A list-update based associative container.\n *\n * @tparam Key \t \tKey type.\n * @tparam Mapped \t \tMap type.\n * @tparam Eq_Fn\t \tEqual functor.\n * @tparam Update_Policy\tUpdate policy, determines when an element\n * will be moved to the front of the list.\n * @tparam _Alloc \t \tAllocator type.\n *\n * Base is detail::lu_map.\n */\n template<typename Key,\n\t typename Mapped,\n\t class Eq_Fn = typename detail::default_eq_fn<Key>::type,\n\t class Update_Policy = detail::default_update_policy::type,\n\t class _Alloc = std::allocator<char> >\n class list_update : public PB_DS_LU_BASE\n {\n private:\n typedef typename PB_DS_LU_BASE \t\tbase_type;\n\n public:\n typedef list_update_tag\t \t\tcontainer_category;\n typedef Eq_Fn \t\t\t\teq_fn;\n typedef Update_Policy \t\t\tupdate_policy;\n\n list_update() { }\n\n /// Constructor taking __iterators to a range of value_types. The\n /// value_types between first_it and last_it will be inserted into\n /// the container object.\n template<typename It>\n list_update(It first, It last)\n { base_type::copy_from_range(first, last); }\n\n list_update(const list_update& other)\n : base_type((const base_type&)other) { }\n\n virtual\n ~list_update() { }\n\n list_update&\n operator=(const list_update& other)\n {\n if (this !=& other)\n\t{\n\t list_update tmp(other);\n\t swap(tmp);\n\t}\n return *this;\n }\n\n void\n swap(list_update& other)\n { base_type::swap(other); }\n };\n ///@} list-based\n#undef PB_DS_LU_BASE\n\n /// @} group containers-pbds\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/bin_search_tree_.hpp\n * Contains an implementation class for binary search tree.\n */\n\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/tree_trace_base.hpp>\n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/debug_map_base.hpp>\n#endif\n#include <utility>\n#include <functional>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_BIN_TREE_NAME bin_search_tree_map\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_BIN_TREE_NAME bin_search_tree_set\n#endif\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Mapped, typename Cmp_Fn, \\\n\t typename Node_And_It_Traits, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n PB_DS_BIN_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>\n\n#define PB_DS_BIN_TREE_TRAITS_BASE \\\n types_traits<Key, Mapped, _Alloc, false>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_DEBUG_MAP_BASE_C_DEC \\\n debug_map_base<Key,\teq_by_less<Key, Cmp_Fn>, \\\n\t typename rebind_traits<_Alloc, Key>::const_reference>\n#endif\n\n#ifdef PB_DS_TREE_TRACE\n#define PB_DS_TREE_TRACE_BASE_C_DEC \\\n tree_trace_base<typename Node_And_It_Traits::node_const_iterator, \\\n\t\t typename Node_And_It_Traits::node_iterator,\t \\\n\t\t Cmp_Fn, true, _Alloc>\n#endif\n\n\n /*\n * @brief Binary search tree (BST).\n *\n * This implementation uses an idea from the SGI STL (using a @a\n * header node which is needed for efficient iteration).\n */\n template<typename Key, typename Mapped, typename Cmp_Fn,\n\t typename Node_And_It_Traits, typename _Alloc>\n class PB_DS_BIN_TREE_NAME :\n#ifdef _GLIBCXX_DEBUG\n public PB_DS_DEBUG_MAP_BASE_C_DEC,\n#endif\n#ifdef PB_DS_TREE_TRACE\n public PB_DS_TREE_TRACE_BASE_C_DEC,\n#endif\n public Cmp_Fn,\n public PB_DS_BIN_TREE_TRAITS_BASE,\n public Node_And_It_Traits::node_update\n {\n typedef Node_And_It_Traits \t\t\ttraits_type;\n typedef rebind_traits<_Alloc, typename traits_type::node>\n\tnode_alloc_traits;\n\n protected:\n typedef PB_DS_BIN_TREE_TRAITS_BASE \t \ttraits_base;\n\n typedef\n typename node_alloc_traits::allocator_type\tnode_allocator;\n\n typedef typename node_alloc_traits::value_type \tnode;\n typedef typename node_alloc_traits::pointer \tnode_pointer;\n\n typedef typename traits_type::null_node_update_pointer\n null_node_update_pointer;\n\n private:\n typedef cond_dealtor<node, _Alloc> \t\tcond_dealtor_t;\n\n#ifdef _GLIBCXX_DEBUG\n typedef PB_DS_DEBUG_MAP_BASE_C_DEC \t\tdebug_base;\n#endif\n\n public:\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \tdifference_type;\n typedef typename traits_base::key_type \t\tkey_type;\n typedef typename traits_base::key_pointer \tkey_pointer;\n typedef typename traits_base::key_const_pointer \tkey_const_pointer;\n typedef typename traits_base::key_reference \tkey_reference;\n typedef typename traits_base::key_const_reference key_const_reference;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n typedef typename traits_base::mapped_type \tmapped_type;\n typedef typename traits_base::mapped_pointer \tmapped_pointer;\n typedef typename traits_base::mapped_const_pointer mapped_const_pointer;\n typedef typename traits_base::mapped_reference \tmapped_reference;\n typedef typename traits_base::mapped_const_reference mapped_const_reference;\n#endif\n\n typedef typename traits_base::value_type \t\tvalue_type;\n typedef typename traits_base::pointer \t\tpointer;\n typedef typename traits_base::const_pointer \tconst_pointer;\n typedef typename traits_base::reference \t\treference;\n typedef typename traits_base::const_reference \tconst_reference;\n typedef typename traits_type::point_const_iterator point_const_iterator;\n\n typedef point_const_iterator \t\t\tconst_iterator;\n typedef typename traits_type::point_iterator \tpoint_iterator;\n typedef point_iterator \t\t\t\titerator;\n\n typedef typename traits_type::const_reverse_iterator const_reverse_iterator;\n\n typedef typename traits_type::reverse_iterator \treverse_iterator;\n typedef typename traits_type::node_const_iterator node_const_iterator;\n typedef typename traits_type::node_iterator \tnode_iterator;\n typedef typename traits_type::node_update \tnode_update;\n\n typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n typedef _Alloc \t\t\t\t\tallocator_type;\n\n PB_DS_BIN_TREE_NAME();\n\n PB_DS_BIN_TREE_NAME(const Cmp_Fn&);\n\n PB_DS_BIN_TREE_NAME(const Cmp_Fn&, const node_update&);\n\n PB_DS_BIN_TREE_NAME(const PB_DS_CLASS_C_DEC&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n ~PB_DS_BIN_TREE_NAME();\n\n inline bool\n empty() const;\n\n inline size_type\n size() const;\n\n inline size_type\n max_size() const;\n\n Cmp_Fn&\n get_cmp_fn();\n\n const Cmp_Fn&\n get_cmp_fn() const;\n\n inline point_iterator\n lower_bound(key_const_reference);\n\n inline point_const_iterator\n lower_bound(key_const_reference) const;\n\n inline point_iterator\n upper_bound(key_const_reference);\n\n inline point_const_iterator\n upper_bound(key_const_reference) const;\n\n inline point_iterator\n find(key_const_reference);\n\n inline point_const_iterator\n find(key_const_reference) const;\n\n inline iterator\n begin();\n\n inline const_iterator\n begin() const;\n\n inline iterator\n end();\n\n inline const_iterator\n end() const;\n\n inline reverse_iterator\n rbegin();\n\n inline const_reverse_iterator\n rbegin() const;\n\n inline reverse_iterator\n rend();\n\n inline const_reverse_iterator\n rend() const;\n\n /// Returns a const node_iterator corresponding to the node at the\n /// root of the tree.\n inline node_const_iterator\n node_begin() const;\n\n /// Returns a node_iterator corresponding to the node at the\n /// root of the tree.\n inline node_iterator\n node_begin();\n\n /// Returns a const node_iterator corresponding to a node just\n /// after a leaf of the tree.\n inline node_const_iterator\n node_end() const;\n\n /// Returns a node_iterator corresponding to a node just\n /// after a leaf of the tree.\n inline node_iterator\n node_end();\n\n void\n clear();\n\n protected:\n void\n value_swap(PB_DS_CLASS_C_DEC&);\n\n void\n initialize_min_max();\n\n inline iterator\n insert_imp_empty(const_reference);\n\n inline iterator\n insert_leaf_new(const_reference, node_pointer, bool);\n\n inline node_pointer\n get_new_node_for_leaf_insert(const_reference, false_type);\n\n inline node_pointer\n get_new_node_for_leaf_insert(const_reference, true_type);\n\n inline void\n actual_erase_node(node_pointer);\n\n inline std::pair<node_pointer, bool>\n erase(node_pointer);\n\n inline void\n update_min_max_for_erased_node(node_pointer);\n\n static void\n clear_imp(node_pointer);\n\n inline std::pair<point_iterator, bool>\n insert_leaf(const_reference);\n\n inline void\n rotate_left(node_pointer);\n\n inline void\n rotate_right(node_pointer);\n\n inline void\n rotate_parent(node_pointer);\n\n inline void\n apply_update(node_pointer, null_node_update_pointer);\n\n template<typename Node_Update_>\n\tinline void\n\tapply_update(node_pointer, Node_Update_*);\n\n inline void\n update_to_top(node_pointer, null_node_update_pointer);\n\n template<typename Node_Update_>\n\tinline void\n\tupdate_to_top(node_pointer, Node_Update_*);\n\n bool\n join_prep(PB_DS_CLASS_C_DEC&);\n\n void\n join_finish(PB_DS_CLASS_C_DEC&);\n\n bool\n split_prep(key_const_reference, PB_DS_CLASS_C_DEC&);\n\n void\n split_finish(PB_DS_CLASS_C_DEC&);\n\n size_type\n recursive_count(node_pointer) const;\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n\n void\n structure_only_assert_valid(const char*, int) const;\n\n void\n assert_node_consistent(const node_pointer, const char*, int) const;\n#endif\n\n private:\n#ifdef _GLIBCXX_DEBUG\n void\n assert_iterators(const char*, int) const;\n\n void\n assert_consistent_with_debug_base(const char*, int) const;\n\n void\n assert_node_consistent_with_left(const node_pointer,\n\t\t\t\t const char*, int) const;\n\n void\n assert_node_consistent_with_right(const node_pointer,\n\t\t\t\t\tconst char*, int) const;\n\n void\n assert_consistent_with_debug_base(const node_pointer,\n\t\t\t\t\tconst char*, int) const;\n\n void\n assert_min(const char*, int) const;\n\n void\n assert_min_imp(const node_pointer, const char*, int) const;\n\n void\n assert_max(const char*, int) const;\n\n void\n assert_max_imp(const node_pointer, const char*, int) const;\n\n void\n assert_size(const char*, int) const;\n\n typedef std::pair<const_pointer, const_pointer> node_consistent_t;\n\n node_consistent_t\n assert_node_consistent_(const node_pointer, const char*, int) const;\n#endif\n\n void\n initialize();\n\n node_pointer\n recursive_copy_node(const node_pointer);\n\n protected:\n node_pointer \t\tm_p_head;\n size_type \t\tm_size;\n static node_allocator \ts_node_allocator;\n };\n\n#define PB_DS_STRUCT_ONLY_ASSERT_VALID(X)\t\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(X.structure_only_assert_valid(__FILE__, __LINE__);)\n\n#define PB_DS_ASSERT_NODE_CONSISTENT(_Node)\t\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, __FILE__, __LINE__);)\n\n#include <ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp>\n\n#undef PB_DS_ASSERT_NODE_CONSISTENT\n#undef PB_DS_STRUCT_ONLY_ASSERT_VALID\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_BIN_TREE_NAME\n#undef PB_DS_BIN_TREE_TRAITS_BASE\n#undef PB_DS_DEBUG_MAP_BASE_C_DEC\n\n#ifdef PB_DS_TREE_TRACE\n#undef PB_DS_TREE_TRACE_BASE_C_DEC\n#endif\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/constructors_destructor_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_allocator\nPB_DS_CLASS_C_DEC::s_node_allocator;\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_BIN_TREE_NAME() : m_p_head(s_node_allocator.allocate(1)), m_size(0)\n{\n initialize();\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_BIN_TREE_NAME(const Cmp_Fn& r_cmp_fn) :\n Cmp_Fn(r_cmp_fn), m_p_head(s_node_allocator.allocate(1)), m_size(0)\n{\n initialize();\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_BIN_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :\n Cmp_Fn(r_cmp_fn),\n node_update(r_node_update),\n m_p_head(s_node_allocator.allocate(1)),\n m_size(0)\n{\n initialize();\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_BIN_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :\n#ifdef _GLIBCXX_DEBUG\n debug_base(other),\n#endif \n#ifdef PB_DS_TREE_TRACE\n PB_DS_TREE_TRACE_BASE_C_DEC(other),\n#endif \n Cmp_Fn(other),\n node_update(other),\n m_p_head(s_node_allocator.allocate(1)),\n m_size(0)\n{\n initialize();\n m_size = other.m_size;\n PB_DS_STRUCT_ONLY_ASSERT_VALID(other)\n\n __try\n {\n m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);\n if (m_p_head->m_p_parent != 0)\n\t m_p_head->m_p_parent->m_p_parent = m_p_head;\n m_size = other.m_size;\n initialize_min_max();\n }\n __catch(...)\n {\n _GLIBCXX_DEBUG_ONLY(debug_base::clear();)\n\ts_node_allocator.deallocate(m_p_head, 1);\n __throw_exception_again;\n }\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n PB_DS_STRUCT_ONLY_ASSERT_VALID(other)\n value_swap(other);\n std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n PB_DS_STRUCT_ONLY_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)\n std::swap(m_p_head, other.m_p_head);\n std::swap(m_size, other.m_size);\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_BIN_TREE_NAME()\n{\n clear();\n s_node_allocator.deallocate(m_p_head, 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{\n m_p_head->m_p_parent = 0;\n m_p_head->m_p_left = m_p_head;\n m_p_head->m_p_right = m_p_head;\n m_size = 0;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrecursive_copy_node(const node_pointer p_nd)\n{\n if (p_nd == 0)\n return (0);\n\n node_pointer p_ret = s_node_allocator.allocate(1);\n __try\n {\n new (p_ret) node(*p_nd);\n }\n __catch(...)\n {\n s_node_allocator.deallocate(p_ret, 1);\n __throw_exception_again;\n }\n\n p_ret->m_p_left = p_ret->m_p_right = 0;\n\n __try\n {\n p_ret->m_p_left = recursive_copy_node(p_nd->m_p_left);\n p_ret->m_p_right = recursive_copy_node(p_nd->m_p_right);\n }\n __catch(...)\n {\n clear_imp(p_ret);\n __throw_exception_again;\n }\n\n if (p_ret->m_p_left != 0)\n p_ret->m_p_left->m_p_parent = p_ret;\n\n if (p_ret->m_p_right != 0)\n p_ret->m_p_right->m_p_parent = p_ret;\n\n PB_DS_ASSERT_NODE_CONSISTENT(p_ret)\n return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize_min_max()\n{\n if (m_p_head->m_p_parent == 0)\n {\n m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;\n return;\n }\n\n {\n node_pointer p_min = m_p_head->m_p_parent;\n while (p_min->m_p_left != 0)\n p_min = p_min->m_p_left;\n m_p_head->m_p_left = p_min;\n }\n\n {\n node_pointer p_max = m_p_head->m_p_parent;\n while (p_max->m_p_right != 0)\n p_max = p_max->m_p_right;\n m_p_head->m_p_right = p_max;\n }\n}\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/debug_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n structure_only_assert_valid(__file, __line);\n assert_consistent_with_debug_base(__file, __line);\n assert_size(__file, __line);\n assert_iterators(__file, __line);\n if (m_p_head->m_p_parent == 0)\n {\n PB_DS_DEBUG_VERIFY(m_size == 0);\n }\n else\n {\n PB_DS_DEBUG_VERIFY(m_size > 0);\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nstructure_only_assert_valid(const char* __file, int __line) const\n{\n PB_DS_DEBUG_VERIFY(m_p_head != 0);\n if (m_p_head->m_p_parent == 0)\n {\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_left == m_p_head);\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_right == m_p_head);\n }\n else\n {\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_parent->m_p_parent == m_p_head);\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_left != m_p_head);\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_right != m_p_head);\n }\n\n if (m_p_head->m_p_parent != 0)\n assert_node_consistent(m_p_head->m_p_parent, __file, __line);\n assert_min(__file, __line);\n assert_max(__file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(const node_pointer p_nd,\n\t\t const char* __file, int __line) const\n{\n assert_node_consistent_(p_nd, __file, __line);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_consistent_t\nPB_DS_CLASS_C_DEC::\nassert_node_consistent_(const node_pointer p_nd,\n\t\t\tconst char* __file, int __line) const\n{\n if (p_nd == 0)\n return (std::make_pair((const_pointer)0,(const_pointer)0));\n\n assert_node_consistent_with_left(p_nd, __file, __line);\n assert_node_consistent_with_right(p_nd, __file, __line);\n\n const std::pair<const_pointer, const_pointer>\n l_range = assert_node_consistent_(p_nd->m_p_left, __file, __line);\n\n if (l_range.second != 0)\n PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*l_range.second),\n\t\t\t\t\t PB_DS_V2F(p_nd->m_value)));\n\n const std::pair<const_pointer, const_pointer>\n r_range = assert_node_consistent_(p_nd->m_p_right, __file, __line);\n\n if (r_range.first != 0)\n PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),\n\t\t\t\t\t PB_DS_V2F(*r_range.first)));\n\n return std::make_pair((l_range.first != 0) ? l_range.first : &p_nd->m_value,\n\t\t\t(r_range.second != 0)? r_range.second : &p_nd->m_value);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent_with_left(const node_pointer p_nd,\n\t\t\t\t const char* __file, int __line) const\n{\n if (p_nd->m_p_left == 0)\n return;\n PB_DS_DEBUG_VERIFY(p_nd->m_p_left->m_p_parent == p_nd);\n PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),\n\t\t\t\t\t PB_DS_V2F(p_nd->m_p_left->m_value)));\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent_with_right(const node_pointer p_nd,\n\t\t\t\t const char* __file, int __line) const\n{\n if (p_nd->m_p_right == 0)\n return;\n PB_DS_DEBUG_VERIFY(p_nd->m_p_right->m_p_parent == p_nd);\n PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_p_right->m_value),\n\t\t\t\t\t PB_DS_V2F(p_nd->m_value)));\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_min(const char* __file, int __line) const\n{\n assert_min_imp(m_p_head->m_p_parent, __file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_min_imp(const node_pointer p_nd, const char* __file, int __line) const\n{\n if (p_nd == 0)\n {\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_left == m_p_head);\n return;\n }\n\n if (p_nd->m_p_left == 0)\n {\n PB_DS_DEBUG_VERIFY(p_nd == m_p_head->m_p_left);\n return;\n }\n assert_min_imp(p_nd->m_p_left, __file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_max(const char* __file, int __line) const\n{\n assert_max_imp(m_p_head->m_p_parent, __file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_max_imp(const node_pointer p_nd,\n\t const char* __file, int __line) const\n{\n if (p_nd == 0)\n {\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_right == m_p_head);\n return;\n }\n\n if (p_nd->m_p_right == 0)\n {\n PB_DS_DEBUG_VERIFY(p_nd == m_p_head->m_p_right);\n return;\n }\n\n assert_max_imp(p_nd->m_p_right, __file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_iterators(const char* __file, int __line) const\n{\n size_type iterated_num = 0;\n const_iterator prev_it = end();\n for (const_iterator it = begin(); it != end(); ++it)\n {\n ++iterated_num;\n PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)).m_p_nd == it.m_p_nd);\n const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));\n --upper_bound_it;\n PB_DS_DEBUG_VERIFY(upper_bound_it.m_p_nd == it.m_p_nd);\n\n if (prev_it != end())\n\tPB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),\n\t\t\t\t\t PB_DS_V2F(*it)));\n prev_it = it;\n }\n\n PB_DS_DEBUG_VERIFY(iterated_num == m_size);\n size_type reverse_iterated_num = 0;\n const_reverse_iterator reverse_prev_it = rend();\n for (const_reverse_iterator reverse_it = rbegin(); reverse_it != rend();\n ++reverse_it)\n {\n ++reverse_iterated_num;\n PB_DS_DEBUG_VERIFY(lower_bound(\n\t\t\t\t PB_DS_V2F(*reverse_it)).m_p_nd == reverse_it.m_p_nd);\n\n const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*reverse_it));\n --upper_bound_it;\n PB_DS_DEBUG_VERIFY(upper_bound_it.m_p_nd == reverse_it.m_p_nd);\n if (reverse_prev_it != rend())\n\tPB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(*reverse_prev_it),\n\t\t\t\t\t PB_DS_V2F(*reverse_it)));\n reverse_prev_it = reverse_it;\n }\n PB_DS_DEBUG_VERIFY(reverse_iterated_num == m_size);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_consistent_with_debug_base(const char* __file, int __line) const\n{\n debug_base::check_size(m_size, __file, __line);\n assert_consistent_with_debug_base(m_p_head->m_p_parent, __file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_consistent_with_debug_base(const node_pointer p_nd,\n\t\t\t\t const char* __file, int __line) const\n{\n if (p_nd == 0)\n return;\n debug_base::check_key_exists(PB_DS_V2F(p_nd->m_value), __file, __line);\n assert_consistent_with_debug_base(p_nd->m_p_left, __file, __line);\n assert_consistent_with_debug_base(p_nd->m_p_right, __file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_size(const char* __file, int __line) const\n{ PB_DS_DEBUG_VERIFY(recursive_count(m_p_head->m_p_parent) == m_size); }\n\n#endif\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/erase_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_node(node_pointer p_z)\n{\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n --m_size;\n _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_z->m_value));)\n p_z->~node();\n s_node_allocator.deallocate(p_z, 1);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_erased_node(node_pointer p_z)\n{\n if (m_size == 1)\n {\n m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;\n return;\n }\n\n if (m_p_head->m_p_left == p_z)\n {\n iterator it(p_z);\n ++it;\n m_p_head->m_p_left = it.m_p_nd;\n }\n else if (m_p_head->m_p_right == p_z)\n {\n iterator it(p_z);\n --it;\n m_p_head->m_p_right = it.m_p_nd;\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n clear_imp(m_p_head->m_p_parent);\n m_size = 0;\n initialize();\n _GLIBCXX_DEBUG_ONLY(debug_base::clear();)\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n if (p_nd == 0)\n return;\n\n clear_imp(p_nd->m_p_left);\n clear_imp(p_nd->m_p_right);\n p_nd->~node();\n s_node_allocator.deallocate(p_nd, 1);\n}\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/find_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nlower_bound(key_const_reference r_key) const\n{\n node_pointer p_pot = m_p_head;\n node_pointer p_nd = m_p_head->m_p_parent;\n\n while (p_nd != 0)\n if (Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n p_nd = p_nd->m_p_right;\n else\n {\n\tp_pot = p_nd;\n\tp_nd = p_nd->m_p_left;\n }\n return iterator(p_pot);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nlower_bound(key_const_reference r_key)\n{\n node_pointer p_pot = m_p_head;\n node_pointer p_nd = m_p_head->m_p_parent;\n\n while (p_nd != 0)\n if (Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n p_nd = p_nd->m_p_right;\n else\n {\n\tp_pot = p_nd;\n\tp_nd = p_nd->m_p_left;\n }\n return iterator(p_pot);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nupper_bound(key_const_reference r_key) const\n{\n node_pointer p_pot = m_p_head;\n node_pointer p_nd = m_p_head->m_p_parent;\n\n while (p_nd != 0)\n if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))\n {\n\tp_pot = p_nd;\n\tp_nd = p_nd->m_p_left;\n }\n else\n p_nd = p_nd->m_p_right;\n return const_iterator(p_pot);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nupper_bound(key_const_reference r_key)\n{\n node_pointer p_pot = m_p_head;\n node_pointer p_nd = m_p_head->m_p_parent;\n\n while (p_nd != 0)\n if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))\n {\n\tp_pot = p_nd;\n\tp_nd = p_nd->m_p_left;\n }\n else\n p_nd = p_nd->m_p_right;\n return point_iterator(p_pot);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key)\n{\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n node_pointer p_pot = m_p_head;\n node_pointer p_nd = m_p_head->m_p_parent;\n\n while (p_nd != 0)\n if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n {\n\tp_pot = p_nd;\n\tp_nd = p_nd->m_p_left;\n }\n else\n p_nd = p_nd->m_p_right;\n\n node_pointer ret = p_pot;\n if (p_pot != m_p_head)\n {\n const bool __cmp = Cmp_Fn::operator()(r_key, PB_DS_V2F(p_pot->m_value));\n if (__cmp)\n\tret = m_p_head;\n }\n return point_iterator(ret);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key) const\n{\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n node_pointer p_pot = m_p_head;\n node_pointer p_nd = m_p_head->m_p_parent;\n\n while (p_nd != 0)\n if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n {\n\tp_pot = p_nd;\n\tp_nd = p_nd->m_p_left;\n }\n else\n p_nd = p_nd->m_p_right;\n\n node_pointer ret = p_pot;\n if (p_pot != m_p_head)\n {\n const bool __cmp = Cmp_Fn::operator()(r_key, PB_DS_V2F(p_pot->m_value));\n if (__cmp)\n\tret = m_p_head;\n }\n return point_const_iterator(ret);\n}\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/info_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\n_GLIBCXX_NODISCARD\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{\n return (m_size == 0);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{\n return (m_size);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{\n return (s_node_allocator.max_size());\n}\n\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/insert_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_leaf(const_reference r_value)\n{\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n\n if (m_size == 0)\n return std::make_pair(insert_imp_empty(r_value),\n\t\t\t true);\n\n node_pointer p_nd = m_p_head->m_p_parent;\n node_pointer p_pot = m_p_head;\n\n while (p_nd != 0)\n if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),\n\t\t\t PB_DS_V2F(r_value)))\n {\n\tp_pot = p_nd;\n\n\tp_nd = p_nd->m_p_left;\n }\n else\n p_nd = p_nd->m_p_right;\n\n if (p_pot == m_p_head)\n return std::make_pair(insert_leaf_new(r_value, m_p_head->m_p_right, false),\n\t\t\t true);\n\n if (!Cmp_Fn::operator()(PB_DS_V2F(r_value),\n\t\t\t PB_DS_V2F(p_pot->m_value)))\n {\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_value))\n return std::make_pair(p_pot, false);\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value))\n\n p_nd = p_pot->m_p_left;\n if (p_nd == 0)\n return std::make_pair(insert_leaf_new(r_value, p_pot, true),\n\t\t\t true);\n\n while (p_nd->m_p_right != 0)\n p_nd = p_nd->m_p_right;\n\n return std::make_pair(insert_leaf_new(r_value, p_nd, false),\n\t\t\ttrue);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\ninsert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)\n{\n node_pointer p_new_nd =\n get_new_node_for_leaf_insert(r_value,\n\t\t\t\t traits_base::m_no_throw_copies_indicator);\n\n if (left_nd)\n {\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == 0);\n _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(r_value),\n\t\t\t\t\t PB_DS_V2F(p_nd->m_value)));\n\n p_nd->m_p_left = p_new_nd;\n if (m_p_head->m_p_left == p_nd)\n\tm_p_head->m_p_left = p_new_nd;\n }\n else\n {\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right == 0);\n _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),\n\t\t\t\t\t PB_DS_V2F(r_value)));\n\n p_nd->m_p_right = p_new_nd;\n if (m_p_head->m_p_right == p_nd)\n\tm_p_head->m_p_right = p_new_nd;\n }\n\n p_new_nd->m_p_parent = p_nd;\n p_new_nd->m_p_left = p_new_nd->m_p_right = 0;\n PB_DS_ASSERT_NODE_CONSISTENT(p_nd)\n\n update_to_top(p_new_nd, (node_update* )this);\n _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));)\n return iterator(p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\ninsert_imp_empty(const_reference r_value)\n{\n node_pointer p_new_node =\n get_new_node_for_leaf_insert(r_value, traits_base::m_no_throw_copies_indicator);\n\n m_p_head->m_p_left = m_p_head->m_p_right =\n m_p_head->m_p_parent = p_new_node;\n\n p_new_node->m_p_parent = m_p_head;\n p_new_node->m_p_left = p_new_node->m_p_right = 0;\n _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));)\n\n update_to_top(m_p_head->m_p_parent, (node_update*)this);\n return iterator(p_new_node);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_leaf_insert(const_reference r_val, false_type)\n{\n node_pointer p_new_nd = s_node_allocator.allocate(1);\n cond_dealtor_t cond(p_new_nd);\n\n new (const_cast<void* >(static_cast<const void* >(&p_new_nd->m_value)))\n typename node::value_type(r_val);\n\n cond.set_no_action();\n p_new_nd->m_p_left = p_new_nd->m_p_right = 0;\n ++m_size;\n return p_new_nd;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_leaf_insert(const_reference r_val, true_type)\n{\n node_pointer p_new_nd = s_node_allocator.allocate(1);\n\n new (const_cast<void* >(static_cast<const void* >(&p_new_nd->m_value)))\n typename node::value_type(r_val);\n\n p_new_nd->m_p_left = p_new_nd->m_p_right = 0;\n ++m_size;\n return p_new_nd;\n}\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/iterators_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n return (iterator(m_p_head->m_p_left));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n return (const_iterator(m_p_head->m_p_left));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{\n return (iterator(m_p_head));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{\n return (const_iterator(m_p_head));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nrbegin() const\n{\n return (const_reverse_iterator(m_p_head->m_p_right));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nrbegin()\n{\n return (reverse_iterator(m_p_head->m_p_right));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nrend()\n{\n return (reverse_iterator(m_p_head));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nrend() const\n{\n return (const_reverse_iterator(m_p_head));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_const_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin() const\n{\n return (node_const_iterator(m_p_head->m_p_parent));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin()\n{\n return (node_iterator(m_p_head->m_p_parent));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_const_iterator\nPB_DS_CLASS_C_DEC::\nnode_end() const\n{\n return (node_const_iterator(0));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_end()\n{\n return (node_iterator(0));\n}\n\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/node_iterators.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP\n#define PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC \\\n bin_search_tree_const_node_it_<Node, Const_Iterator, Iterator, _Alloc>\n\n /// Const node iterator.\n template<typename Node,\n\t class Const_Iterator,\n\t class Iterator,\n\t typename _Alloc>\n class bin_search_tree_const_node_it_\n {\n private:\n typedef typename rebind_traits<_Alloc, Node>::pointer node_pointer;\n\n public:\n /// Category.\n typedef trivial_iterator_tag iterator_category;\n\n /// Difference type.\n typedef trivial_iterator_difference_type difference_type;\n\n /// Iterator's value type.\n typedef Const_Iterator value_type;\n\n /// Iterator's reference type.\n typedef Const_Iterator reference;\n\n /// Iterator's __const reference type.\n typedef Const_Iterator const_reference;\n\n /// Metadata type.\n typedef typename Node::metadata_type metadata_type;\n\n /// Const metadata reference type.\n typedef typename rebind_traits<_Alloc, metadata_type>::const_reference\n\tmetadata_const_reference;\n\n\n bin_search_tree_const_node_it_(const node_pointer p_nd = 0)\n : m_p_nd(const_cast<node_pointer>(p_nd))\n { }\n\n /// Access.\n const_reference\n operator*() const\n { return Const_Iterator(m_p_nd); }\n\n /// Metadata access.\n metadata_const_reference\n get_metadata() const\n { return m_p_nd->get_metadata(); }\n\n /// Returns the __const node iterator associated with the left node.\n PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC\n get_l_child() const\n { return PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_left); }\n\n /// Returns the __const node iterator associated with the right node.\n PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC\n get_r_child() const\n { return PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_right); }\n\n /// Compares to a different iterator object.\n bool\n operator==(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const\n { return m_p_nd == other.m_p_nd; }\n\n /// Compares (negatively) to a different iterator object.\n bool\n operator!=(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const\n { return m_p_nd != other.m_p_nd; }\n\n node_pointer m_p_nd;\n };\n\n#define PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC \\\n bin_search_tree_node_it_<Node, Const_Iterator, Iterator, _Alloc>\n\n /// Node iterator.\n template<typename Node,\n\t class Const_Iterator,\n\t class Iterator,\n\t typename _Alloc>\n class bin_search_tree_node_it_\n : public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC\n {\n private:\n typedef typename rebind_traits<_Alloc, Node>::pointer node_pointer;\n\n public:\n /// Iterator's value type.\n typedef Iterator value_type;\n\n /// Iterator's reference type.\n typedef Iterator reference;\n\n /// Iterator's __const reference type.\n typedef Iterator const_reference;\n\n inline\n bin_search_tree_node_it_(const node_pointer p_nd = 0)\n : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(const_cast<node_pointer>(p_nd))\n { }\n\n /// Access.\n Iterator\n operator*() const\n { return Iterator(PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd); }\n\n /// Returns the node iterator associated with the left node.\n PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC\n get_l_child() const\n {\n\treturn PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(\n\t\t\t\t\t\t PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_left);\n }\n\n /// Returns the node iterator associated with the right node.\n PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC\n get_r_child() const\n {\n\treturn PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(\n\t\t\t\t\t\t PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_right);\n }\n\n };\n\n#undef PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC\n#undef PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP\n","include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/point_iterators.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifndef PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP\n#define PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n\n#define PB_DS_TREE_CONST_IT_C_DEC\t\t\t\t\t\\\n bin_search_tree_const_it_<\t\t\t\t\t\t\\\n\t\t\t\t\t\tNode_Pointer,\t\t\\\n\t\t\t\t\t\tValue_Type,\t\t\\\n\t\t\t\t\t\tPointer,\t\t\\\n\t\t\t\t\t\tConst_Pointer,\t\t\\\n\t\t\t\t\t\tReference,\t\t\\\n\t\t\t\t\t\tConst_Reference,\t\\\n\t\t\t\t\t\tIs_Forward_Iterator,\t\\\n\t\t\t\t\t\t_Alloc>\n\n#define PB_DS_TREE_CONST_ODIR_IT_C_DEC\t\t\t\t\t\\\n bin_search_tree_const_it_<\t\t\t\t\t\t\\\n\t\t\t\t\t\tNode_Pointer,\t\t\\\n\t\t\t\t\t\tValue_Type,\t\t\\\n\t\t\t\t\t\tPointer,\t\t\\\n\t\t\t\t\t\tConst_Pointer,\t\t\\\n\t\t\t\t\t\tReference,\t\t\\\n\t\t\t\t\t\tConst_Reference,\t\\\n\t\t\t\t\t\t!Is_Forward_Iterator,\t\\\n\t\t\t\t\t\t_Alloc>\n\n#define PB_DS_TREE_IT_C_DEC\t\t\t\t\t\t\\\n bin_search_tree_it_<\t\t\t\t\t\t\\\n\t\t\t\t\t\tNode_Pointer,\t\t\\\n\t\t\t\t\t\tValue_Type,\t\t\\\n\t\t\t\t\t\tPointer,\t\t\\\n\t\t\t\t\t\tConst_Pointer,\t\t\\\n\t\t\t\t\t\tReference,\t\t\\\n\t\t\t\t\t\tConst_Reference,\t\\\n\t\t\t\t\t\tIs_Forward_Iterator,\t\\\n\t\t\t\t\t\t_Alloc>\n\n#define PB_DS_TREE_ODIR_IT_C_DEC\t\t\t\t\t\\\n bin_search_tree_it_<\t\t\t\t\t\t\\\n\t\t\t\t\t\t\tNode_Pointer,\t\\\n\t\t\t\t\t\t\tValue_Type,\t\\\n\t\t\t\t\t\t\tPointer,\t\\\n\t\t\t\t\t\t\tConst_Pointer,\t\\\n\t\t\t\t\t\t\tReference,\t\\\n\t\t\t\t\t\t\tConst_Reference, \\\n\t\t\t\t\t\t\t!Is_Forward_Iterator, \\\n\t\t\t\t\t\t\t_Alloc>\n\n /// Const iterator.\n template<typename Node_Pointer,\n\t typename Value_Type,\n\t typename Pointer,\n\t typename Const_Pointer,\n\t typename Reference,\n\t typename Const_Reference,\n\t bool Is_Forward_Iterator,\n\t typename _Alloc>\n class bin_search_tree_const_it_\n {\n public:\n typedef std::bidirectional_iterator_tag \t\titerator_category;\n typedef typename _Alloc::difference_type \tdifference_type;\n typedef Value_Type \t\t\t\tvalue_type;\n typedef Pointer \t\t\t\t\tpointer;\n typedef Const_Pointer \t\t\t\tconst_pointer;\n typedef Reference \t\t\t\treference;\n typedef Const_Reference \t\t\t\tconst_reference;\n\n inline\n bin_search_tree_const_it_(const Node_Pointer p_nd = 0) \n : m_p_nd(const_cast<Node_Pointer>(p_nd))\n { }\n\n inline\n bin_search_tree_const_it_(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other) \n : m_p_nd(other.m_p_nd)\n { }\n\n inline\n PB_DS_TREE_CONST_IT_C_DEC& \n operator=(const PB_DS_TREE_CONST_IT_C_DEC& other)\n {\n\tm_p_nd = other.m_p_nd;\n\treturn *this;\n }\n\n inline\n PB_DS_TREE_CONST_IT_C_DEC& \n operator=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other)\n {\n\tm_p_nd = other.m_p_nd;\n\treturn *this;\n }\n\n inline const_pointer\n operator->() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);\n\treturn &m_p_nd->m_value;\n }\n\n inline const_reference\n operator*() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);\n\treturn m_p_nd->m_value;\n }\n\n inline bool\n operator==(const PB_DS_TREE_CONST_IT_C_DEC & other) const\n { return m_p_nd == other.m_p_nd; }\n\n inline bool\n operator==(const PB_DS_TREE_CONST_ODIR_IT_C_DEC & other) const\n { return m_p_nd == other.m_p_nd; }\n\n inline bool\n operator!=(const PB_DS_TREE_CONST_IT_C_DEC& other) const\n { return m_p_nd != other.m_p_nd; }\n\n inline bool\n operator!=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other) const\n { return m_p_nd != other.m_p_nd; }\n\n inline PB_DS_TREE_CONST_IT_C_DEC& \n operator++()\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);\n\tinc(integral_constant<int,Is_Forward_Iterator>());\n\treturn *this;\n }\n\n inline PB_DS_TREE_CONST_IT_C_DEC\n operator++(int)\n {\n\tPB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);\n\toperator++();\n\treturn ret_it;\n }\n\n inline PB_DS_TREE_CONST_IT_C_DEC& \n operator--()\n {\n\tdec(integral_constant<int,Is_Forward_Iterator>());\n\treturn *this;\n }\n\n inline PB_DS_TREE_CONST_IT_C_DEC\n operator--(int)\n {\n\tPB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);\n\toperator--();\n\treturn ret_it;\n }\n\n protected:\n inline void\n inc(false_type)\n { dec(true_type()); }\n\n void\n inc(true_type)\n {\n\tif (m_p_nd->special()&& \n\t m_p_nd->m_p_parent->m_p_parent == m_p_nd)\n\t {\n\t m_p_nd = m_p_nd->m_p_left;\n\t return;\n\t }\n\n\tif (m_p_nd->m_p_right != 0)\n\t {\n\t m_p_nd = m_p_nd->m_p_right;\n\t while (m_p_nd->m_p_left != 0)\n\t m_p_nd = m_p_nd->m_p_left;\n\t return;\n\t }\n\n\tNode_Pointer p_y = m_p_nd->m_p_parent;\n\twhile (m_p_nd == p_y->m_p_right)\n\t {\n\t m_p_nd = p_y;\n\t p_y = p_y->m_p_parent;\n\t }\n\n\tif (m_p_nd->m_p_right != p_y)\n\t m_p_nd = p_y;\n }\n\n inline void\n dec(false_type)\n { inc(true_type()); }\n\n void\n dec(true_type)\n {\n\tif (m_p_nd->special() && m_p_nd->m_p_parent->m_p_parent == m_p_nd)\n\t {\n\t m_p_nd = m_p_nd->m_p_right;\n\t return;\n\t }\n\n\tif (m_p_nd->m_p_left != 0)\n\t {\n\t Node_Pointer p_y = m_p_nd->m_p_left;\n\t while (p_y->m_p_right != 0)\n\t p_y = p_y->m_p_right;\n\t m_p_nd = p_y;\n\t return;\n\t }\n\n\tNode_Pointer p_y = m_p_nd->m_p_parent;\n\twhile (m_p_nd == p_y->m_p_left)\n\t {\n\t m_p_nd = p_y;\n\t p_y = p_y->m_p_parent;\n\t }\n\tif (m_p_nd->m_p_left != p_y)\n\t m_p_nd = p_y;\n }\n\n public:\n Node_Pointer m_p_nd;\n };\n\n /// Iterator.\n template<typename Node_Pointer,\n\t typename Value_Type,\n\t typename Pointer,\n\t typename Const_Pointer,\n\t typename Reference,\n\t typename Const_Reference,\n\t bool Is_Forward_Iterator,\n\t typename _Alloc>\n class bin_search_tree_it_ : public PB_DS_TREE_CONST_IT_C_DEC\n {\n public:\n inline\n bin_search_tree_it_(const Node_Pointer p_nd = 0) \n : PB_DS_TREE_CONST_IT_C_DEC((Node_Pointer)p_nd)\n { }\n\n inline\n bin_search_tree_it_(const PB_DS_TREE_ODIR_IT_C_DEC& other) \n : PB_DS_TREE_CONST_IT_C_DEC(other.m_p_nd)\n { }\n\n inline\n PB_DS_TREE_IT_C_DEC& \n operator=(const PB_DS_TREE_IT_C_DEC& other)\n {\n\tbase_it_type::m_p_nd = other.m_p_nd;\n\treturn *this;\n }\n\n inline\n PB_DS_TREE_IT_C_DEC& \n operator=(const PB_DS_TREE_ODIR_IT_C_DEC& other)\n {\n\tbase_it_type::m_p_nd = other.m_p_nd;\n\treturn *this;\n }\n\n inline typename PB_DS_TREE_CONST_IT_C_DEC::pointer\n operator->() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0);\n\treturn &base_it_type::m_p_nd->m_value;\n }\n\n inline typename PB_DS_TREE_CONST_IT_C_DEC::reference\n operator*() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0);\n\treturn base_it_type::m_p_nd->m_value;\n }\n\n inline PB_DS_TREE_IT_C_DEC& \n operator++()\n {\n\tPB_DS_TREE_CONST_IT_C_DEC:: operator++();\n\treturn *this;\n }\n\n inline PB_DS_TREE_IT_C_DEC\n operator++(int)\n {\n\tPB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);\n\toperator++();\n\treturn ret_it;\n }\n\n inline PB_DS_TREE_IT_C_DEC& \n operator--()\n {\n\tPB_DS_TREE_CONST_IT_C_DEC:: operator--();\n\treturn *this;\n }\n\n inline PB_DS_TREE_IT_C_DEC\n operator--(int)\n {\n\tPB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);\n\toperator--();\n\treturn ret_it;\n }\n\n protected:\n typedef PB_DS_TREE_CONST_IT_C_DEC base_it_type;\n };\n\n#undef PB_DS_TREE_CONST_IT_C_DEC\n#undef PB_DS_TREE_CONST_ODIR_IT_C_DEC\n#undef PB_DS_TREE_IT_C_DEC\n#undef PB_DS_TREE_ODIR_IT_C_DEC\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/policy_access_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nCmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn()\n{ return (*this); }\n\nPB_DS_CLASS_T_DEC\nconst Cmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn() const\n{ return (*this); }\n\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/r_erase_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_node(node_pointer p_z)\n{\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n --m_size;\n _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value));)\n p_z->~node();\n s_node_allocator.deallocate(p_z, 1);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_erased_node(node_pointer p_z)\n{\n if (m_size == 1)\n {\n m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;\n return;\n }\n\n if (m_p_head->m_p_left == p_z)\n {\n iterator it(p_z);\n ++it;\n m_p_head->m_p_left = it.m_p_nd;\n }\n else if (m_p_head->m_p_right == p_z)\n {\n iterator it(p_z);\n --it;\n m_p_head->m_p_right = it.m_p_nd;\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n clear_imp(m_p_head->m_p_parent);\n m_size = 0;\n initialize();\n _GLIBCXX_DEBUG_ONLY(debug_base::clear();)\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n if (p_nd == 0)\n return;\n\n clear_imp(p_nd->m_p_left);\n clear_imp(p_nd->m_p_right);\n p_nd->~Node();\n s_node_allocator.deallocate(p_nd, 1);\n}\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/rotate_fn_imps.hpp\n * Contains imps for rotating nodes.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_left(node_pointer p_x)\n{\n node_pointer p_y = p_x->m_p_right;\n\n p_x->m_p_right = p_y->m_p_left;\n\n if (p_y->m_p_left != 0)\n p_y->m_p_left->m_p_parent = p_x;\n\n p_y->m_p_parent = p_x->m_p_parent;\n\n if (p_x == m_p_head->m_p_parent)\n m_p_head->m_p_parent = p_y;\n else if (p_x == p_x->m_p_parent->m_p_left)\n p_x->m_p_parent->m_p_left = p_y;\n else\n p_x->m_p_parent->m_p_right = p_y;\n\n p_y->m_p_left = p_x;\n p_x->m_p_parent = p_y;\n\n PB_DS_ASSERT_NODE_CONSISTENT(p_x)\n PB_DS_ASSERT_NODE_CONSISTENT(p_y)\n\n apply_update(p_x, (node_update* )this);\n apply_update(p_x->m_p_parent, (node_update* )this);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_right(node_pointer p_x)\n{\n node_pointer p_y = p_x->m_p_left;\n\n p_x->m_p_left = p_y->m_p_right;\n\n if (p_y->m_p_right != 0)\n p_y->m_p_right->m_p_parent = p_x;\n\n p_y->m_p_parent = p_x->m_p_parent;\n\n if (p_x == m_p_head->m_p_parent)\n m_p_head->m_p_parent = p_y;\n else if (p_x == p_x->m_p_parent->m_p_right)\n p_x->m_p_parent->m_p_right = p_y;\n else\n p_x->m_p_parent->m_p_left = p_y;\n\n p_y->m_p_right = p_x;\n p_x->m_p_parent = p_y;\n\n PB_DS_ASSERT_NODE_CONSISTENT(p_x)\n PB_DS_ASSERT_NODE_CONSISTENT(p_y)\n\n apply_update(p_x, (node_update* )this);\n apply_update(p_x->m_p_parent, (node_update* )this);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_parent(node_pointer p_nd)\n{\n node_pointer p_parent = p_nd->m_p_parent;\n\n if (p_nd == p_parent->m_p_left)\n rotate_right(p_parent);\n else\n rotate_left(p_parent);\n\n _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd);\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent ||\n\t\t p_nd->m_p_right == p_parent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer p_nd, Node_Update_* /*p_update*/)\n{\n node_update::operator()(node_iterator(p_nd),\n\t\t\t node_const_iterator(static_cast<node_pointer>(0)));\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_to_top(node_pointer p_nd, Node_Update_* p_update)\n{\n while (p_nd != m_p_head)\n {\n apply_update(p_nd, p_update);\n\n p_nd = p_nd->m_p_parent;\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_to_top(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/)\n{ }\n\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/split_join_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nbool\nPB_DS_CLASS_C_DEC::\njoin_prep(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n if (other.m_size == 0)\n return false;\n\n if (m_size == 0)\n {\n value_swap(other);\n return false;\n }\n\n const bool greater =\n Cmp_Fn::operator()(PB_DS_V2F(m_p_head->m_p_right->m_value),\n\t\t PB_DS_V2F(other.m_p_head->m_p_left->m_value));\n\n const bool lesser =\n Cmp_Fn::operator()(PB_DS_V2F(other.m_p_head->m_p_right->m_value),\n\t\t PB_DS_V2F(m_p_head->m_p_left->m_value));\n\n if (!greater && !lesser)\n __throw_join_error();\n\n if (lesser)\n value_swap(other);\n\n m_size += other.m_size;\n _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)\n return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\njoin_finish(PB_DS_CLASS_C_DEC& other)\n{\n initialize_min_max();\n other.initialize();\n}\n\nPB_DS_CLASS_T_DEC\nbool\nPB_DS_CLASS_C_DEC::\nsplit_prep(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n other.clear();\n\n if (m_size == 0)\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return false;\n }\n\n if (Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_left->m_value)))\n {\n value_swap(other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return false;\n }\n\n if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_right->m_value)))\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return false;\n }\n\n if (m_size == 1)\n {\n value_swap(other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return false;\n }\n\n _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(Cmp_Fn& )(*this), other);)\n return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit_finish(PB_DS_CLASS_C_DEC& other)\n{\n other.initialize_min_max();\n other.m_size = std::distance(other.begin(), other.end());\n m_size -= other.m_size;\n initialize_min_max();\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nrecursive_count(node_pointer p) const\n{\n if (p == 0)\n return 0;\n return 1 + recursive_count(p->m_p_left) + recursive_count(p->m_p_right);\n}\n\n#endif\n","include/ext/pb_ds/detail/bin_search_tree_/traits.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_/traits.hpp\n * Contains an implementation for bin_search_tree_.\n */\n\n#ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Binary search tree traits, primary template\n /// @ingroup traits\n template<typename Key,\n\t typename Mapped,\n\t class Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t class Node_Itr,\n\t\t class _Cmp_Fn,\n\t\t typename _Alloc>\n\t class Node_Update,\n\t class Node,\n\t typename _Alloc>\n struct bin_search_tree_traits\n {\n private:\n typedef types_traits<Key, Mapped, _Alloc, false> type_traits;\n typedef rebind_traits<_Alloc, Node> node_alloc_traits;\n\n public:\n typedef Node node;\n\n typedef\n bin_search_tree_const_it_<\n\ttypename node_alloc_traits::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\ttrue,\n\t_Alloc>\n point_const_iterator;\n\n typedef\n bin_search_tree_it_<\n\ttypename node_alloc_traits::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\ttrue,\n\t_Alloc>\n point_iterator;\n\n typedef\n bin_search_tree_const_it_<\n\ttypename node_alloc_traits::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\tfalse,\n\t_Alloc>\n const_reverse_iterator;\n\n typedef\n bin_search_tree_it_<\n\ttypename node_alloc_traits::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\tfalse,\n\t_Alloc>\n reverse_iterator;\n\n /// This is an iterator to an iterator: it iterates over nodes,\n /// and de-referencing it returns one of the tree's iterators.\n typedef\n bin_search_tree_const_node_it_<\n\tNode,\n\tpoint_const_iterator,\n\tpoint_iterator,\n\t_Alloc>\n node_const_iterator;\n\n typedef\n bin_search_tree_node_it_<\n\tNode,\n\tpoint_const_iterator,\n\tpoint_iterator,\n\t_Alloc>\n node_iterator;\n\n typedef\n Node_Update<\n\tnode_const_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\t_Alloc>\n node_update;\n\n typedef\n __gnu_pbds::null_node_update<\n\tnode_const_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\t_Alloc>* \n null_node_update_pointer;\n };\n\n /// Specialization.\n /// @ingroup traits\n template<typename Key,\n\t class Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t class Node_Itr,\n\t\t class _Cmp_Fn,\n\t\t typename _Alloc>\n\t class Node_Update,\n\t class Node,\n\t typename _Alloc>\n struct\n bin_search_tree_traits<Key, null_type, Cmp_Fn, Node_Update, Node, _Alloc>\n {\n private:\n typedef types_traits<Key, null_type, _Alloc, false> type_traits;\n typedef rebind_traits<_Alloc, Node> node_alloc_traits;\n\n public:\n typedef Node node;\n\n typedef\n bin_search_tree_const_it_<\n\ttypename node_alloc_traits::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\ttrue,\n\t_Alloc>\n point_const_iterator;\n\n typedef point_const_iterator point_iterator;\n\n typedef\n bin_search_tree_const_it_<\n\ttypename node_alloc_traits::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\tfalse,\n\t_Alloc>\n const_reverse_iterator;\n\n typedef const_reverse_iterator reverse_iterator;\n\n /// This is an iterator to an iterator: it iterates over nodes,\n /// and de-referencing it returns one of the tree's iterators.\n typedef\n bin_search_tree_const_node_it_<\n\tNode,\n\tpoint_const_iterator,\n\tpoint_iterator,\n\t_Alloc>\n node_const_iterator;\n\n typedef node_const_iterator node_iterator;\n\n typedef\n Node_Update<node_const_iterator, node_iterator, Cmp_Fn, _Alloc>\n node_update;\n\n typedef\n __gnu_pbds::null_node_update<\n\tnode_const_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\t_Alloc>* \n null_node_update_pointer;\n };\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP\n","include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/binary_heap_.hpp\n * Contains an implementation class for a binary heap.\n */\n\n#ifndef PB_DS_BINARY_HEAP_HPP\n#define PB_DS_BINARY_HEAP_HPP\n\n#include <queue>\n#include <algorithm>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/binary_heap_/entry_cmp.hpp>\n#include <ext/pb_ds/detail/binary_heap_/entry_pred.hpp>\n#include <ext/pb_ds/detail/binary_heap_/resize_policy.hpp>\n#include <ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp>\n#include <ext/pb_ds/detail/binary_heap_/const_iterator.hpp>\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n#include <iostream>\n#endif\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_CLASS_T_DEC \\\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n binary_heap<Value_Type, Cmp_Fn, _Alloc>\n\n#define PB_DS_ENTRY_CMP_DEC \\\n entry_cmp<Value_Type, Cmp_Fn, _Alloc, is_simple<Value_Type>::value>::type\n\n#define PB_DS_RESIZE_POLICY_DEC\t\\\n __gnu_pbds::detail::resize_policy<typename _Alloc::size_type>\n\n /**\n * Binary heaps composed of resize and compare policies.\n *\n * @ingroup heap-detail\n *\n * Based on CLRS.\n */\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n class binary_heap\n : public PB_DS_ENTRY_CMP_DEC, public PB_DS_RESIZE_POLICY_DEC\n {\n public:\n typedef Value_Type \t\t\t\tvalue_type;\n typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \t\tdifference_type;\n typedef typename PB_DS_ENTRY_CMP_DEC \t\tentry_cmp;\n typedef PB_DS_RESIZE_POLICY_DEC \t\t\tresize_policy;\n typedef cond_dealtor<value_type, _Alloc> \t\tcond_dealtor_t;\n\n private:\n enum\n\t{\n\t simple_value = is_simple<value_type>::value\n\t};\n\n typedef integral_constant<int, simple_value> \tno_throw_copies_t;\n\n typedef rebind_traits<_Alloc, value_type>\t\t__rebind_v;\n typedef typename __rebind_v::allocator_type \tvalue_allocator;\n\n public:\n typedef typename __rebind_v::pointer\t\tpointer;\n typedef typename __rebind_v::const_pointer\tconst_pointer;\n typedef typename __rebind_v::reference\treference;\n typedef typename __rebind_v::const_reference\tconst_reference;\n\n typedef typename __conditional_type<simple_value,\n\t\t\t\t\t value_type, pointer>::__type\n \t\t\t\t\t\t\tentry;\n\n typedef typename rebind_traits<_Alloc, entry>::allocator_type\n \t\t\t\t\t\t\tentry_allocator;\n\n typedef typename rebind_traits<_Alloc, entry>::pointer \tentry_pointer;\n\n typedef binary_heap_point_const_iterator_<value_type, entry,\n\t\t\t\t\t\tsimple_value, _Alloc>\n \t\t\t\t\t\t\tpoint_const_iterator;\n\n typedef point_const_iterator \t\t\tpoint_iterator;\n\n typedef binary_heap_const_iterator_<value_type, entry,\n\t\t\t\t\t simple_value, _Alloc>\n \t\t\t\t\t\t\tconst_iterator;\n\n typedef const_iterator \t\t\t\titerator;\n\n\n binary_heap();\n\n binary_heap(const cmp_fn&);\n\n binary_heap(const binary_heap&);\n\n void\n swap(binary_heap&);\n\n ~binary_heap();\n\n _GLIBCXX_NODISCARD inline bool\n empty() const;\n\n inline size_type\n size() const;\n\n inline size_type\n max_size() const;\n\n Cmp_Fn&\n get_cmp_fn();\n\n const Cmp_Fn&\n get_cmp_fn() const;\n\n inline point_iterator\n push(const_reference);\n\n void\n modify(point_iterator, const_reference);\n\n inline const_reference\n top() const;\n\n inline void\n pop();\n\n inline void\n erase(point_iterator);\n\n template<typename Pred>\n\tsize_type\n\terase_if(Pred);\n\n inline void\n erase_at(entry_pointer, size_type, false_type);\n\n inline void\n erase_at(entry_pointer, size_type, true_type);\n\n inline iterator\n begin();\n\n inline const_iterator\n begin() const;\n\n inline iterator\n end();\n\n inline const_iterator\n end() const;\n\n void\n clear();\n\n template<typename Pred>\n\tvoid\n\tsplit(Pred, binary_heap&);\n\n void\n join(binary_heap&);\n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n void\n trace() const;\n#endif\n\n protected:\n template<typename It>\n\tvoid\n\tcopy_from_range(It, It);\n\n private:\n void\n value_swap(binary_heap&);\n\n inline void\n insert_value(const_reference, false_type);\n\n inline void\n insert_value(value_type, true_type);\n\n inline void\n resize_for_insert_if_needed();\n\n inline void\n swap_value_imp(entry_pointer, value_type, true_type);\n\n inline void\n swap_value_imp(entry_pointer, const_reference, false_type);\n\n void\n fix(entry_pointer);\n\n inline const_reference\n top_imp(true_type) const;\n\n inline const_reference\n top_imp(false_type) const;\n\n inline static size_type\n left_child(size_type);\n\n inline static size_type\n right_child(size_type);\n\n inline static size_type\n parent(size_type);\n\n inline void\n resize_for_erase_if_needed();\n\n template<typename Pred>\n size_type\n partition(Pred);\n\n void\n make_heap()\n {\n\tconst entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);\n\tentry_pointer end = m_a_entries + m_size;\n\tstd::make_heap(m_a_entries, end, m_cmp);\n }\n\n void\n push_heap()\n {\n\tconst entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);\n\tentry_pointer end = m_a_entries + m_size;\n\tstd::push_heap(m_a_entries, end, m_cmp);\n }\n\n void\n pop_heap()\n {\n\tconst entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);\n\tentry_pointer end = m_a_entries + m_size;\n\tstd::pop_heap(m_a_entries, end, m_cmp);\n }\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n#endif\n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n void\n trace_entry(const entry&, false_type) const;\n\n void\n trace_entry(const entry&, true_type) const;\n#endif\n\n static entry_allocator \ts_entry_allocator;\n static value_allocator \ts_value_allocator;\n static no_throw_copies_t \ts_no_throw_copies_ind;\n\n size_type \t\tm_size;\n size_type \t\tm_actual_size;\n entry_pointer \t\tm_a_entries;\n };\n\n#define PB_DS_ASSERT_VALID(X) \\\n _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);)\n\n#define PB_DS_DEBUG_VERIFY(_Cond)\t\t\t\t\t\\\n _GLIBCXX_DEBUG_VERIFY_AT(_Cond,\t\t\t\t\t\\\n\t\t\t _M_message(#_Cond\" assertion from %1;:%2;\")\t\\\n\t\t\t ._M_string(__FILE__)._M_integer(__LINE__)\t\\\n\t\t\t ,__file,__line)\n\n#include <ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_ENTRY_CMP_DEC\n#undef PB_DS_RESIZE_POLICY_DEC\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/const_iterator.hpp\n * Contains an iterator class returned by the table's const find and insert\n * methods.\n */\n\n#ifndef PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP\n#define PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP\n\n#include <ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_BIN_HEAP_CIT_BASE \\\n binary_heap_point_const_iterator_<Value_Type, Entry, Simple, _Alloc>\n\n /// Const point-type iterator.\n template<typename Value_Type,\n\t typename Entry,\n\t bool Simple,\n\t typename _Alloc>\n class binary_heap_const_iterator_ : public PB_DS_BIN_HEAP_CIT_BASE\n {\n private:\n typedef PB_DS_BIN_HEAP_CIT_BASE \t\t \tbase_type;\n typedef typename base_type::entry_pointer \tentry_pointer;\n\n public:\n /// Category.\n typedef std::forward_iterator_tag \t\titerator_category;\n\n /// Difference type.\n typedef typename _Alloc::difference_type \t\tdifference_type;\n\n /// Iterator's value type.\n typedef typename base_type::value_type \t\tvalue_type;\n\n /// Iterator's pointer type.\n typedef typename base_type::pointer \t\tpointer;\n\n /// Iterator's const pointer type.\n typedef typename base_type::const_pointer \tconst_pointer;\n\n /// Iterator's reference type.\n typedef typename base_type::reference \t\treference;\n\n /// Iterator's const reference type.\n typedef typename base_type::const_reference \tconst_reference;\n\n inline\n binary_heap_const_iterator_(entry_pointer p_e) : base_type(p_e)\n { }\n\n /// Default constructor.\n inline\n binary_heap_const_iterator_()\n { }\n\n /// Copy constructor.\n inline\n binary_heap_const_iterator_(const binary_heap_const_iterator_& other) \n : base_type(other)\n { }\n\n /// Compares content to a different iterator object.\n inline bool\n operator==(const binary_heap_const_iterator_& other) const\n { return base_type::m_p_e == other.m_p_e; }\n\n /// Compares content (negatively) to a different iterator object.\n inline bool\n operator!=(const binary_heap_const_iterator_& other) const\n { return base_type::m_p_e != other.m_p_e; }\n\n inline binary_heap_const_iterator_& \n operator++()\n {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::m_p_e != 0);\n\tinc();\n\treturn *this;\n }\n\n inline binary_heap_const_iterator_\n operator++(int)\n {\n\tbinary_heap_const_iterator_ ret_it(base_type::m_p_e);\n\toperator++();\n\treturn ret_it;\n }\n\n private:\n void\n inc()\n { ++base_type::m_p_e; }\n };\n\n#undef PB_DS_BIN_HEAP_CIT_BASE\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/constructors_destructor_fn_imps.hpp\n * Contains an implementation class for binary_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_allocator\nPB_DS_CLASS_C_DEC::s_entry_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::value_allocator\nPB_DS_CLASS_C_DEC::s_value_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::no_throw_copies_t\nPB_DS_CLASS_C_DEC::s_no_throw_copies_ind;\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n {\n insert_value(*first_it, s_no_throw_copies_ind);\n ++first_it;\n }\n make_heap();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinary_heap()\n: m_size(0), m_actual_size(resize_policy::min_size),\n m_a_entries(s_entry_allocator.allocate(m_actual_size))\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinary_heap(const Cmp_Fn& r_cmp_fn)\n: entry_cmp(r_cmp_fn), m_size(0), m_actual_size(resize_policy::min_size),\n m_a_entries(s_entry_allocator.allocate(m_actual_size))\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinary_heap(const PB_DS_CLASS_C_DEC& other)\n: entry_cmp(other), resize_policy(other), m_size(0),\n m_actual_size(other.m_actual_size),\n m_a_entries(s_entry_allocator.allocate(m_actual_size))\n{\n PB_DS_ASSERT_VALID(other)\n _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);\n\n __try\n {\n copy_from_range(other.begin(), other.end());\n }\n __catch(...)\n {\n for (size_type i = 0; i < m_size; ++i)\n\terase_at(m_a_entries, i, s_no_throw_copies_ind);\n\n s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n __throw_exception_again;\n }\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);\n value_swap(other);\n std::swap((entry_cmp&)(*this), (entry_cmp&)other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n std::swap(m_a_entries, other.m_a_entries);\n std::swap(m_size, other.m_size);\n std::swap(m_actual_size, other.m_actual_size);\n static_cast<resize_policy*>(this)->swap(other);\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~binary_heap()\n{\n for (size_type i = 0; i < m_size; ++i)\n erase_at(m_a_entries, i, s_no_throw_copies_ind);\n s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n}\n#endif\n","include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/debug_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n#ifdef PB_DS_REGRESSION\n s_entry_allocator.check_allocated(m_a_entries, m_actual_size);\n#endif\n\n resize_policy::assert_valid(__file, __line);\n PB_DS_DEBUG_VERIFY(m_size <= m_actual_size);\n for (size_type i = 0; i < m_size; ++i)\n {\n#ifdef PB_DS_REGRESSION\n s_value_allocator.check_allocated(m_a_entries[i], 1);\n#endif\n\n if (left_child(i) < m_size)\n\tPB_DS_DEBUG_VERIFY(!entry_cmp::operator()(m_a_entries[i], m_a_entries[left_child(i)]));\n\n PB_DS_DEBUG_VERIFY(parent(left_child(i)) == i);\n\n if (right_child(i) < m_size)\n\tPB_DS_DEBUG_VERIFY(!entry_cmp::operator()(m_a_entries[i], m_a_entries[right_child(i)]));\n\n PB_DS_DEBUG_VERIFY(parent(right_child(i)) == i);\n }\n}\n\n#endif\n#endif\n","include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/entry_cmp.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifndef PB_DS_BINARY_HEAP_ENTRY_CMP_HPP\n#define PB_DS_BINARY_HEAP_ENTRY_CMP_HPP\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Entry compare, primary template.\n template<typename _VTp, typename Cmp_Fn, typename _Alloc, bool No_Throw>\n struct entry_cmp;\n\n /// Specialization, true.\n template<typename _VTp, typename Cmp_Fn, typename _Alloc>\n struct entry_cmp<_VTp, Cmp_Fn, _Alloc, true>\n {\n\t/// Compare.\n\ttypedef Cmp_Fn \t\t\t\t\t\ttype;\n };\n\n /// Specialization, false.\n template<typename _VTp, typename Cmp_Fn, typename _Alloc>\n struct entry_cmp<_VTp, Cmp_Fn, _Alloc, false>\n {\n private:\n\ttypedef rebind_traits<_Alloc, _VTp>\t\t__rebind_v;\n\n public:\n\ttypedef typename __rebind_v::const_pointer\tentry;\n\n\t/// Compare plus entry.\n\tstruct type : public Cmp_Fn\n\t{\n\t type() { }\n\n\t type(const Cmp_Fn& other) : Cmp_Fn(other) { }\n\n\t bool\n\t operator()(entry lhs, entry rhs) const\n\t { return Cmp_Fn::operator()(*lhs, *rhs); }\n\t};\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_BINARY_HEAP_ENTRY_CMP_HPP\n","include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/entry_pred.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifndef PB_DS_BINARY_HEAP_ENTRY_PRED_HPP\n#define PB_DS_BINARY_HEAP_ENTRY_PRED_HPP\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Entry predicate primary class template.\n template<typename _VTp, typename Pred, typename _Alloc, bool No_Throw>\n struct entry_pred;\n\n /// Specialization, true.\n template<typename _VTp, typename Pred, typename _Alloc>\n struct entry_pred<_VTp, Pred, _Alloc, true>\n {\n\ttypedef Pred \t\t\t\t\t\ttype;\n };\n\n /// Specialization, false.\n template<typename _VTp, typename Pred, typename _Alloc>\n struct entry_pred<_VTp, Pred, _Alloc, false>\n {\n private:\n\ttypedef rebind_traits<_Alloc, _VTp>\t\t__rebind_v;\n\n public:\n\ttypedef typename __rebind_v::const_pointer\tentry;\n\n\tstruct type : public Pred\n\t{\n\t inline\n\t type() { }\n\n\t inline\n\t type(const Pred& other) : Pred(other) { }\n\n\t inline bool\n\t operator()(entry p_v) const\n\t { return Pred::operator()(*p_v); }\n\t};\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_BINARY_HEAP_ENTRY_PRED_HPP\n","include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/erase_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n for (size_type i = 0; i < m_size; ++i)\n erase_at(m_a_entries, i, s_no_throw_copies_ind);\n\n __try\n {\n const size_type new_size = resize_policy::get_new_size_for_arbitrary(0);\n entry_pointer new_entries = s_entry_allocator.allocate(new_size);\n resize_policy::notify_arbitrary(new_size);\n s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n m_actual_size = new_size;\n m_a_entries = new_entries;\n }\n __catch(...)\n { }\n\n m_size = 0;\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_at(entry_pointer a_entries, size_type i, false_type)\n{\n a_entries[i]->~value_type();\n s_value_allocator.deallocate(a_entries[i], 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_at(entry_pointer, size_type, true_type)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\npop()\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!empty());\n\n pop_heap();\n erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);\n resize_for_erase_if_needed();\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n --m_size;\n\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n PB_DS_ASSERT_VALID((*this))\n\n typedef typename entry_pred<value_type, Pred, _Alloc, simple_value>::type\n pred_t;\n\n const size_type left = partition(pred_t(pred));\n _GLIBCXX_DEBUG_ASSERT(m_size >= left);\n const size_type ersd = m_size - left;\n for (size_type i = left; i < m_size; ++i)\n erase_at(m_a_entries, i, s_no_throw_copies_ind);\n\n __try\n {\n const size_type new_size =\n\tresize_policy::get_new_size_for_arbitrary(left);\n\n entry_pointer new_entries = s_entry_allocator.allocate(new_size);\n std::copy(m_a_entries, m_a_entries + left, new_entries);\n s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n m_actual_size = new_size;\n resize_policy::notify_arbitrary(m_actual_size);\n }\n __catch(...)\n { };\n\n m_size = left;\n make_heap();\n PB_DS_ASSERT_VALID((*this))\n return ersd;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!empty());\n\n const size_type fix_pos = it.m_p_e - m_a_entries;\n std::swap(*it.m_p_e, m_a_entries[m_size - 1]);\n erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);\n resize_for_erase_if_needed();\n\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n --m_size;\n _GLIBCXX_DEBUG_ASSERT(fix_pos <= m_size);\n\n if (fix_pos != m_size)\n fix(m_a_entries + fix_pos);\n\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nresize_for_erase_if_needed()\n{\n if (!resize_policy::resize_needed_for_shrink(m_size))\n return;\n\n __try\n {\n const size_type new_size = resize_policy::get_new_size_for_shrink();\n entry_pointer new_entries = s_entry_allocator.allocate(new_size);\n resize_policy::notify_shrink_resize();\n\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n std::copy(m_a_entries, m_a_entries + m_size - 1, new_entries);\n s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n m_actual_size = new_size;\n m_a_entries = new_entries;\n }\n __catch(...)\n { }\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\npartition(Pred pred)\n{\n size_type left = 0;\n size_type right = m_size - 1;\n\n while (right + 1 != left)\n {\n _GLIBCXX_DEBUG_ASSERT(left <= m_size);\n\n if (!pred(m_a_entries[left]))\n\t++left;\n else if (pred(m_a_entries[right]))\n\t--right;\n else\n\t{\n\t _GLIBCXX_DEBUG_ASSERT(left < right);\n\t std::swap(m_a_entries[left], m_a_entries[right]);\n\t ++left;\n\t --right;\n\t}\n }\n\n return left;\n}\n#endif\n","include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/find_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop() const\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!empty());\n return top_imp(s_no_throw_copies_ind);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop_imp(true_type) const\n{ return *m_a_entries; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop_imp(false_type) const\n{ return **m_a_entries; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nleft_child(size_type i)\n{ return i * 2 + 1; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nright_child(size_type i)\n{ return i * 2 + 2; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nparent(size_type i)\n{ return (i - 1) / 2; }\n#endif\n","include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/info_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\n_GLIBCXX_NODISCARD\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return m_size == 0; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return m_size; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_entry_allocator.max_size(); }\n\n#endif\n","include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/insert_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n PB_DS_ASSERT_VALID((*this))\n insert_value(r_val, s_no_throw_copies_ind);\n push_heap();\n PB_DS_ASSERT_VALID((*this))\n return point_iterator(m_a_entries);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninsert_value(value_type val, true_type)\n{\n resize_for_insert_if_needed();\n m_a_entries[m_size++] = val;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninsert_value(const_reference r_val, false_type)\n{\n resize_for_insert_if_needed();\n pointer p_new = s_value_allocator.allocate(1);\n cond_dealtor_t cond(p_new);\n new (p_new) value_type(r_val);\n cond.set_no_action();\n m_a_entries[m_size++] = p_new;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nresize_for_insert_if_needed()\n{\n if (!resize_policy::resize_needed_for_grow(m_size))\n {\n _GLIBCXX_DEBUG_ASSERT(m_size < m_actual_size);\n return;\n }\n\n const size_type new_size = resize_policy::get_new_size_for_grow();\n entry_pointer new_entries = s_entry_allocator.allocate(new_size);\n resize_policy::notify_grow_resize();\n\n std::copy(m_a_entries, m_a_entries + m_size, new_entries);\n s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n m_actual_size = new_size;\n m_a_entries = new_entries;\n make_heap();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n PB_DS_ASSERT_VALID((*this))\n swap_value_imp(it.m_p_e, r_new_val, s_no_throw_copies_ind);\n fix(it.m_p_e);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nfix(entry_pointer p_e)\n{\n size_type i = p_e - m_a_entries;\n if (i > 0 && entry_cmp::operator()(m_a_entries[parent(i)], m_a_entries[i]))\n {\n size_type parent_i = parent(i);\n while (i > 0\n\t && entry_cmp::operator()(m_a_entries[parent_i], m_a_entries[i]))\n\t{\n\t std::swap(m_a_entries[i], m_a_entries[parent_i]);\n\t i = parent_i;\n\t parent_i = parent(i);\n\t}\n\n PB_DS_ASSERT_VALID((*this))\n return;\n }\n\n while (i < m_size)\n {\n const size_type lchild_i = left_child(i);\n const size_type rchild_i = right_child(i);\n _GLIBCXX_DEBUG_ASSERT(rchild_i > lchild_i);\n\n const bool smaller_than_lchild = lchild_i < m_size &&\n\tentry_cmp::operator()(m_a_entries[i], m_a_entries[lchild_i]);\n\n const bool smaller_than_rchild = rchild_i < m_size &&\n\tentry_cmp::operator()(m_a_entries[i], m_a_entries[rchild_i]);\n\n const bool swap_with_rchild = smaller_than_rchild && (!smaller_than_lchild || entry_cmp::operator()(m_a_entries[lchild_i], m_a_entries[rchild_i]));\n\n const bool swap_with_lchild = !swap_with_rchild && smaller_than_lchild;\n\n if (swap_with_lchild)\n\t{\n\t std::swap(m_a_entries[i], m_a_entries[lchild_i]);\n\t i = lchild_i;\n\t}\n else if (swap_with_rchild)\n\t{\n\t std::swap(m_a_entries[i], m_a_entries[rchild_i]);\n\t i = rchild_i;\n\t}\n else\n\ti = m_size;\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap_value_imp(entry_pointer p_e, value_type new_val, true_type)\n{ *p_e = new_val; }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap_value_imp(entry_pointer p_e, const_reference r_new_val, false_type)\n{\n value_type tmp(r_new_val);\n (*p_e)->swap(tmp);\n}\n#endif\n","include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/iterators_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{ return iterator(m_a_entries); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{ return const_iterator(m_a_entries); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{ return iterator(m_a_entries + m_size); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{ return const_iterator(m_a_entries + m_size); }\n\n#endif\n","include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/point_const_iterator.hpp\n * Contains an iterator class returned by the table's const find and insert\n * methods.\n */\n\n#ifndef PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP\n#define PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Const point-type iterator.\n template<typename Value_Type, typename Entry, bool Simple, \n\t typename _Alloc>\n class binary_heap_point_const_iterator_\n {\n protected:\n typedef typename rebind_traits<_Alloc, Entry>::pointer entry_pointer;\n\n public:\n /// Category.\n typedef trivial_iterator_tag iterator_category;\n\n /// Difference type.\n typedef trivial_iterator_difference_type difference_type;\n\n /// Iterator's value type.\n typedef Value_Type value_type;\n\n /// Iterator's pointer type.\n typedef typename rebind_traits<_Alloc, value_type>::pointer pointer;\n\n /// Iterator's const pointer type.\n typedef typename rebind_traits<_Alloc, value_type>::const_pointer\n\tconst_pointer;\n\n /// Iterator's reference type.\n typedef typename rebind_traits<_Alloc, value_type>::reference\n\treference;\n\n /// Iterator's const reference type.\n typedef typename rebind_traits<_Alloc, value_type>::const_reference\n\tconst_reference;\n\n inline\n binary_heap_point_const_iterator_(entry_pointer p_e) : m_p_e(p_e)\n { }\n\n /// Default constructor.\n inline\n binary_heap_point_const_iterator_() : m_p_e(0) { }\n\n /// Copy constructor.\n inline\n binary_heap_point_const_iterator_(const binary_heap_point_const_iterator_& other)\n : m_p_e(other.m_p_e)\n { }\n\n /// Access.\n inline const_pointer\n operator->() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_e != 0);\n\treturn to_ptr(integral_constant<int, Simple>());\n }\n\n /// Access.\n inline const_reference\n operator*() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_e != 0);\n\treturn *to_ptr(integral_constant<int, Simple>());\n }\n\n /// Compares content to a different iterator object.\n inline bool\n operator==(const binary_heap_point_const_iterator_& other) const\n { return m_p_e == other.m_p_e; }\n\n /// Compares content (negatively) to a different iterator object.\n inline bool\n operator!=(const binary_heap_point_const_iterator_& other) const\n { return m_p_e != other.m_p_e; }\n\n private:\n inline const_pointer\n to_ptr(true_type) const\n { return m_p_e; }\n\n inline const_pointer\n to_ptr(false_type) const\n { return *m_p_e; }\n\n public:\n entry_pointer m_p_e;\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/policy_access_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nCmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn()\n{\n return (*this);\n}\n\nPB_DS_CLASS_T_DEC\nconst Cmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn() const\n{\n return (*this);\n}\n\n#endif\n","include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/resize_policy.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifndef PB_DS_BINARY_HEAP_RESIZE_POLICY_HPP\n#define PB_DS_BINARY_HEAP_RESIZE_POLICY_HPP\n\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Resize policy for binary heap.\n template<typename _Tp>\n class resize_policy\n {\n private:\n enum\n\t{\n\t ratio = 8,\n\t factor = 2\n\t};\n\n /// Next shrink size.\n _Tp \t\tm_shrink_size;\n\n /// Next grow size.\n _Tp \t\tm_grow_size;\n\n public:\n typedef _Tp\tsize_type;\n\n static const _Tp\tmin_size = 16;\n\n resize_policy() : m_shrink_size(0), m_grow_size(min_size)\n { PB_DS_ASSERT_VALID((*this)) }\n\n resize_policy(const resize_policy& other)\n : m_shrink_size(other.m_shrink_size), m_grow_size(other.m_grow_size)\n { PB_DS_ASSERT_VALID((*this)) }\n\n inline void\n swap(resize_policy<_Tp>&);\n\n inline bool\n resize_needed_for_grow(size_type) const;\n\n inline bool\n resize_needed_for_shrink(size_type) const;\n\n inline bool\n grow_needed(size_type) const;\n\n inline bool\n shrink_needed(size_type) const;\n\n inline size_type\n get_new_size_for_grow() const;\n\n inline size_type\n get_new_size_for_shrink() const;\n\n inline size_type\n get_new_size_for_arbitrary(size_type) const;\n\n inline void\n notify_grow_resize();\n\n inline void\n notify_shrink_resize();\n\n void\n notify_arbitrary(size_type);\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n#endif\n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n void\n trace() const;\n#endif\n };\n\n template<typename _Tp>\n const _Tp resize_policy<_Tp>::min_size;\n\n template<typename _Tp>\n inline void\n resize_policy<_Tp>::\n swap(resize_policy<_Tp>& other)\n {\n std::swap(m_shrink_size, other.m_shrink_size);\n std::swap(m_grow_size, other.m_grow_size);\n }\n\n template<typename _Tp>\n inline bool\n resize_policy<_Tp>::\n resize_needed_for_grow(size_type size) const\n {\n _GLIBCXX_DEBUG_ASSERT(size <= m_grow_size);\n return size == m_grow_size;\n }\n\n template<typename _Tp>\n inline bool\n resize_policy<_Tp>::\n resize_needed_for_shrink(size_type size) const\n {\n _GLIBCXX_DEBUG_ASSERT(size <= m_grow_size);\n return size == m_shrink_size;\n }\n\n template<typename _Tp>\n inline typename resize_policy<_Tp>::size_type\n resize_policy<_Tp>::\n get_new_size_for_grow() const\n { return m_grow_size * factor; }\n\n template<typename _Tp>\n inline typename resize_policy<_Tp>::size_type\n resize_policy<_Tp>::\n get_new_size_for_shrink() const\n {\n const size_type half_size = m_grow_size / factor;\n return std::max(min_size, half_size);\n }\n\n template<typename _Tp>\n inline typename resize_policy<_Tp>::size_type\n resize_policy<_Tp>::\n get_new_size_for_arbitrary(size_type size) const\n {\n size_type ret = min_size;\n while (ret < size)\n\tret *= factor;\n return ret;\n }\n\n template<typename _Tp>\n inline void\n resize_policy<_Tp>::\n notify_grow_resize()\n {\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(m_grow_size >= min_size);\n m_grow_size *= factor;\n m_shrink_size = m_grow_size / ratio;\n PB_DS_ASSERT_VALID((*this))\n }\n\n template<typename _Tp>\n inline void\n resize_policy<_Tp>::\n notify_shrink_resize()\n {\n PB_DS_ASSERT_VALID((*this))\n m_shrink_size /= factor;\n if (m_shrink_size == 1)\n\tm_shrink_size = 0;\n m_grow_size = std::max(m_grow_size / factor, min_size);\n PB_DS_ASSERT_VALID((*this))\n }\n\n template<typename _Tp>\n inline void\n resize_policy<_Tp>::\n notify_arbitrary(size_type actual_size)\n {\n m_grow_size = actual_size;\n m_shrink_size = m_grow_size / ratio;\n PB_DS_ASSERT_VALID((*this))\n }\n\n#ifdef _GLIBCXX_DEBUG\n template<typename _Tp>\n void\n resize_policy<_Tp>::\n assert_valid(const char* __file, int __line) const\n {\n PB_DS_DEBUG_VERIFY(m_shrink_size == 0\n\t\t\t || m_shrink_size * ratio == m_grow_size);\n PB_DS_DEBUG_VERIFY(m_grow_size >= min_size);\n }\n#endif\n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n template<typename _Tp>\n void\n resize_policy<_Tp>::\n trace() const\n {\n std::cerr << \"shrink = \" << m_shrink_size\n\t\t<< \" grow = \" << m_grow_size << std::endl;\n }\n#endif\n\n} // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/split_join_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n\n typedef\n typename entry_pred<value_type, Pred, _Alloc, simple_value>::type\n pred_t;\n\n const size_type left = partition(pred_t(pred));\n _GLIBCXX_DEBUG_ASSERT(m_size >= left);\n\n const size_type ersd = m_size - left;\n _GLIBCXX_DEBUG_ASSERT(m_size >= ersd);\n\n const size_type new_size = resize_policy::get_new_size_for_arbitrary(left);\n const size_type other_actual_size = other.get_new_size_for_arbitrary(ersd);\n\n entry_pointer a_entries = 0;\n entry_pointer a_other_entries = 0;\n\n __try\n {\n a_entries = s_entry_allocator.allocate(new_size);\n a_other_entries = s_entry_allocator.allocate(other_actual_size);\n }\n __catch(...)\n {\n if (a_entries != 0)\n\ts_entry_allocator.deallocate(a_entries, new_size);\n\n if (a_other_entries != 0)\n\ts_entry_allocator.deallocate(a_other_entries, other_actual_size);\n\n __throw_exception_again;\n };\n\n for (size_type i = 0; i < other.m_size; ++i)\n erase_at(other.m_a_entries, i, s_no_throw_copies_ind);\n\n _GLIBCXX_DEBUG_ASSERT(new_size >= left);\n std::copy(m_a_entries, m_a_entries + left, a_entries);\n std::copy(m_a_entries + left, m_a_entries + m_size, a_other_entries);\n\n s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);\n\n m_actual_size = new_size;\n other.m_actual_size = other_actual_size;\n\n m_size = left;\n other.m_size = ersd;\n\n m_a_entries = a_entries;\n other.m_a_entries = a_other_entries;\n\n make_heap();\n other.make_heap();\n\n resize_policy::notify_arbitrary(m_actual_size);\n other.notify_arbitrary(other.m_actual_size);\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n const size_type len = m_size + other.m_size;\n const size_type new_size = resize_policy::get_new_size_for_arbitrary(len);\n\n entry_pointer a_entries = 0;\n entry_pointer a_other_entries = 0;\n\n __try\n {\n a_entries = s_entry_allocator.allocate(new_size);\n a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);\n }\n __catch(...)\n {\n if (a_entries != 0)\n\ts_entry_allocator.deallocate(a_entries, new_size);\n\n if (a_other_entries != 0)\n\ts_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);\n\n __throw_exception_again;\n }\n\n std::copy(m_a_entries, m_a_entries + m_size, a_entries);\n std::copy(other.m_a_entries, other.m_a_entries + other.m_size,\n\t a_entries + m_size);\n\n s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n m_a_entries = a_entries;\n m_size = len;\n m_actual_size = new_size;\n resize_policy::notify_arbitrary(new_size);\n make_heap();\n\n s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);\n other.m_a_entries = a_other_entries;\n other.m_size = 0;\n other.m_actual_size = resize_policy::min_size;\n other.notify_arbitrary(resize_policy::min_size);\n other.make_heap();\n \n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n#endif\n","include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_/trace_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n std::cerr << this << std::endl;\n\n std::cerr << m_a_entries << std::endl;\n\n for (size_type i = 0; i < m_size; ++i)\n trace_entry(m_a_entries[i], s_no_throw_copies_ind);\n\n std::cerr << std::endl;\n\n std::cerr << \"size = \" << m_size << \" \" << \"actual_size = \" << m_actual_size << std::endl;\n\n resize_policy::trace();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_entry(const entry& r_e, false_type) const\n{\n std::cout << r_e << \" \" <<* r_e << std::endl;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_entry(const entry& r_e, true_type) const\n{\n std::cout << r_e << std::endl;\n}\n\n#endif // #ifdef PB_DS_BINARY_HEAP_TRACE_\n#endif\n","include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_.hpp\n * Contains an implementation class for a binomial heap.\n */\n\n/*\n * Binomial heap.\n * Vuillemin J is the mastah.\n * Modified from CLRS.\n */\n\n#include <debug/debug.h>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_CLASS_T_DEC \\\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n binomial_heap<Value_Type, Cmp_Fn, _Alloc>\n\n /**\n * Binomial heap.\n *\n * @ingroup heap-detail\n */\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n class binomial_heap\n : public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>\n {\n private:\n typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> \tbase_type;\n typedef typename base_type::node_pointer \t\tnode_pointer;\n typedef typename base_type::node_const_pointer \tnode_const_pointer;\n\n public:\n typedef Value_Type \t\t\t\tvalue_type;\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \t\tdifference_type;\n typedef typename base_type::pointer \t\tpointer;\n typedef typename base_type::const_pointer \tconst_pointer;\n typedef typename base_type::reference \t\treference;\n typedef typename base_type::const_reference \tconst_reference;\n typedef typename base_type::point_const_iterator \tpoint_const_iterator;\n typedef typename base_type::point_iterator \tpoint_iterator;\n typedef typename base_type::const_iterator \tconst_iterator;\n typedef typename base_type::iterator \t\titerator;\n typedef typename base_type::cmp_fn \t\tcmp_fn;\n typedef typename base_type::allocator_type \tallocator_type;\n\n binomial_heap();\n\n binomial_heap(const Cmp_Fn&);\n\n binomial_heap(const binomial_heap&);\n\n ~binomial_heap();\n\n protected:\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n#endif\n };\n\n#include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file detail/binomial_heap_/constructors_destructor_fn_imps.hpp\n * Contains an implementation for binomial_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap(const Cmp_Fn& r_cmp_fn)\n: base_type(r_cmp_fn)\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap(const PB_DS_CLASS_C_DEC& other)\n: base_type(other)\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~binomial_heap() { }\n#endif\n","include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file detail/binomial_heap_/debug_fn_imps.hpp\n * Contains an implementation for binomial_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{ base_type::assert_valid(true, __file, __line); }\n\n#endif \n#endif\n","include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_base_/binomial_heap_base_.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\n#ifndef PB_DS_BINOMIAL_HEAP_BASE_HPP\n#define PB_DS_BINOMIAL_HEAP_BASE_HPP\n\n/*\n * Binomial heap base.\n * Vuillemin J is the mastah.\n * Modified from CLRS.\n */\n\n#include <debug/debug.h>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_CLASS_T_DEC \\\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_B_HEAP_BASE \\\n left_child_next_sibling_heap<Value_Type, Cmp_Fn, \\\n\t\t\t\ttypename _Alloc::size_type, _Alloc, false>\n#else\n#define PB_DS_B_HEAP_BASE \\\n left_child_next_sibling_heap<Value_Type, Cmp_Fn, \\\n\t\t\t\ttypename _Alloc::size_type, _Alloc>\n#endif\n\n /// Base class for binomial heap.\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n class binomial_heap_base\n : public PB_DS_B_HEAP_BASE\n {\n private:\n typedef rebind_traits<_Alloc, Value_Type>\t\t__rebind_v;\n typedef PB_DS_B_HEAP_BASE\t \t\t\tbase_type;\n\n protected:\n typedef typename base_type::node \t\t\tnode;\n typedef typename base_type::node_pointer \t\tnode_pointer;\n typedef typename base_type::node_const_pointer \tnode_const_pointer;\n\n public:\n typedef Value_Type \t\t\t\tvalue_type;\n typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \t\tdifference_type;\n\n typedef typename __rebind_v::pointer \t\tpointer;\n typedef typename __rebind_v::const_pointer \tconst_pointer;\n typedef typename __rebind_v::reference \t\treference;\n typedef typename __rebind_v::const_reference \tconst_reference;\n\n typedef typename base_type::point_const_iterator \tpoint_const_iterator;\n typedef typename base_type::point_iterator \tpoint_iterator;\n typedef typename base_type::const_iterator \tconst_iterator;\n typedef typename base_type::iterator \t\titerator;\n\n public:\n\n inline point_iterator\n push(const_reference);\n\n void\n modify(point_iterator, const_reference);\n\n inline const_reference\n top() const;\n\n void\n pop();\n\n void\n erase(point_iterator);\n\n inline void\n clear();\n\n template<typename Pred>\n size_type\n erase_if(Pred);\n\n template<typename Pred>\n void\n split(Pred, PB_DS_CLASS_C_DEC&);\n\n void\n join(PB_DS_CLASS_C_DEC&);\n\n protected:\n\n binomial_heap_base();\n\n binomial_heap_base(const Cmp_Fn&);\n\n binomial_heap_base(const PB_DS_CLASS_C_DEC&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n ~binomial_heap_base();\n\n template<typename It>\n void\n copy_from_range(It, It);\n\n inline void\n find_max();\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(bool, const char*, int) const;\n\n void\n assert_max(const char*, int) const;\n#endif\n\n private:\n\n inline node_pointer\n fix(node_pointer) const;\n\n inline void\n insert_node(node_pointer);\n\n inline void\n remove_parentless_node(node_pointer);\n\n inline node_pointer\n join(node_pointer, node_pointer) const;\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_node_consistent(node_const_pointer, bool, bool,\n\t\t\t const char*, int) const;\n#endif\n\n protected:\n node_pointer \tm_p_max;\n };\n\n#define PB_DS_ASSERT_VALID_COND(X, _StrictlyBinomial)\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(X.assert_valid(_StrictlyBinomial,__FILE__, __LINE__);)\n\n#define PB_DS_ASSERT_BASE_NODE_CONSISTENT(_Node, _Bool)\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, _Bool,\t\\\n\t\t\t\t\t\t\t__FILE__, __LINE__);)\n\n#include <ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp>\n\n#undef PB_DS_ASSERT_BASE_NODE_CONSISTENT\n#undef PB_DS_ASSERT_VALID_COND\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_B_HEAP_BASE\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_base_/constructors_destructor_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n push(*(first_it++));\n PB_DS_ASSERT_VALID_COND((*this),false)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap_base() : m_p_max(0)\n{\n PB_DS_ASSERT_VALID_COND((*this),false)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap_base(const Cmp_Fn& r_cmp_fn)\n: base_type(r_cmp_fn), m_p_max(0)\n{ PB_DS_ASSERT_VALID_COND((*this),false) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap_base(const PB_DS_CLASS_C_DEC& other)\n: base_type(other), m_p_max(0)\n{ PB_DS_ASSERT_VALID_COND((*this),false) }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID_COND((*this),false)\n base_type::swap(other);\n std::swap(m_p_max, other.m_p_max);\n PB_DS_ASSERT_VALID_COND((*this),false)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~binomial_heap_base()\n{ }\n#endif\n","include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_base_/debug_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(bool strictly_binomial, const char* __file, int __line) const\n{\n base_type::assert_valid(__file, __line);\n assert_node_consistent(base_type::m_p_root, strictly_binomial, true,\n\t\t\t __file, __line);\n assert_max(__file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_max(const char* __file, int __line) const\n{\n if (m_p_max == 0)\n return;\n PB_DS_DEBUG_VERIFY(base_type::parent(m_p_max) == 0);\n for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)\n PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(m_p_max->m_value,\n\t\t\t\t\t it.m_p_nd->m_value));\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(node_const_pointer p_nd, bool strictly_binomial,\n\t\t bool increasing, const char* __file, int __line) const\n{\n PB_DS_DEBUG_VERIFY(increasing || strictly_binomial);\n base_type::assert_node_consistent(p_nd, false, __file, __line);\n if (p_nd == 0)\n return;\n PB_DS_DEBUG_VERIFY(p_nd->m_metadata == base_type::degree(p_nd));\n PB_DS_DEBUG_VERIFY(base_type::size_under_node(p_nd) ==\n\t\t static_cast<size_type>(1 << p_nd->m_metadata));\n assert_node_consistent(p_nd->m_p_next_sibling, strictly_binomial, increasing,\n\t\t\t __file, __line);\n assert_node_consistent(p_nd->m_p_l_child, true, false, __file, __line);\n if (p_nd->m_p_next_sibling != 0)\n {\n if (increasing)\n\t{\n\t if (strictly_binomial)\n\t PB_DS_DEBUG_VERIFY(p_nd->m_metadata\n\t\t\t\t < p_nd->m_p_next_sibling->m_metadata);\n\t else\n\t PB_DS_DEBUG_VERIFY(p_nd->m_metadata\n\t\t\t\t <= p_nd->m_p_next_sibling->m_metadata);\n\t}\n else\n\tPB_DS_DEBUG_VERIFY(p_nd->m_metadata\n\t\t\t > p_nd->m_p_next_sibling->m_metadata);\n }\n}\n\n#endif\n#endif\n","include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_base_/erase_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\npop()\n{\n PB_DS_ASSERT_VALID_COND((*this),true)\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n if (m_p_max == 0)\n find_max();\n\n _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);\n node_pointer p_nd = m_p_max;\n remove_parentless_node(m_p_max);\n base_type::actual_erase_node(p_nd);\n m_p_max = 0;\n PB_DS_ASSERT_VALID_COND((*this),true)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nremove_parentless_node(node_pointer p_nd)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n _GLIBCXX_DEBUG_ASSERT(base_type::parent(p_nd) == 0);\n\n node_pointer p_cur_root = p_nd == base_type::m_p_root?\n p_nd->m_p_next_sibling : base_type::m_p_root;\n\n if (p_cur_root != 0)\n p_cur_root->m_p_prev_or_parent = 0;\n\n if (p_nd->m_p_prev_or_parent != 0)\n p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;\n\n if (p_nd->m_p_next_sibling != 0)\n p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n\n node_pointer p_child = p_nd->m_p_l_child;\n if (p_child != 0)\n {\n p_child->m_p_prev_or_parent = 0;\n while (p_child->m_p_next_sibling != 0)\n\tp_child = p_child->m_p_next_sibling;\n }\n\n m_p_max = 0;\n base_type::m_p_root = join(p_cur_root, p_child);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nclear()\n{\n base_type::clear();\n m_p_max = 0;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n PB_DS_ASSERT_VALID_COND((*this),true)\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n base_type::bubble_to_top(it.m_p_nd);\n remove_parentless_node(it.m_p_nd);\n base_type::actual_erase_node(it.m_p_nd);\n m_p_max = 0;\n PB_DS_ASSERT_VALID_COND((*this),true)\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n PB_DS_ASSERT_VALID_COND((*this),true)\n\n if (base_type::empty())\n {\n PB_DS_ASSERT_VALID_COND((*this),true)\n return 0;\n }\n\n base_type::to_linked_list();\n node_pointer p_out = base_type::prune(pred);\n size_type ersd = 0;\n while (p_out != 0)\n {\n ++ersd;\n node_pointer p_next = p_out->m_p_next_sibling;\n base_type::actual_erase_node(p_out);\n p_out = p_next;\n }\n\n node_pointer p_cur = base_type::m_p_root;\n base_type::m_p_root = 0;\n while (p_cur != 0)\n {\n node_pointer p_next = p_cur->m_p_next_sibling;\n p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;\n p_cur->m_metadata = 0;\n p_cur->m_p_next_sibling = base_type::m_p_root;\n\n if (base_type::m_p_root != 0)\n\tbase_type::m_p_root->m_p_prev_or_parent = p_cur;\n\n base_type::m_p_root = p_cur;\n base_type::m_p_root = fix(base_type::m_p_root);\n p_cur = p_next;\n }\n\n m_p_max = 0;\n PB_DS_ASSERT_VALID_COND((*this),true)\n return ersd;\n}\n#endif\n","include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_base_/find_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop() const\n{\n PB_DS_ASSERT_VALID_COND((*this),false)\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n if (m_p_max == 0)\n const_cast<PB_DS_CLASS_C_DEC* >(this)->find_max();\n\n _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);\n return m_p_max->m_value;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nfind_max()\n{\n node_pointer p_cur = base_type::m_p_root;\n m_p_max = p_cur;\n while (p_cur != 0)\n {\n if (Cmp_Fn::operator()(m_p_max->m_value, p_cur->m_value))\n\tm_p_max = p_cur;\n p_cur = p_cur->m_p_next_sibling;\n }\n}\n\n#endif\n","include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_base_/insert_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n PB_DS_ASSERT_VALID_COND((*this),true)\n node_pointer p_nd = base_type::get_new_node_for_insert(r_val);\n insert_node(p_nd);\n m_p_max = 0;\n PB_DS_ASSERT_VALID_COND((*this),true)\n return point_iterator(p_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninsert_node(node_pointer p_nd)\n{\n if (base_type::m_p_root == 0)\n {\n p_nd->m_p_next_sibling = 0;\n p_nd->m_p_prev_or_parent = 0;\n p_nd->m_p_l_child = 0;\n p_nd->m_metadata = 0;\n base_type::m_p_root = p_nd;\n return;\n }\n\n if (base_type::m_p_root->m_metadata > 0)\n {\n p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0;\n p_nd->m_p_next_sibling = base_type::m_p_root;\n base_type::m_p_root->m_p_prev_or_parent = p_nd;\n base_type::m_p_root = p_nd;\n p_nd->m_metadata = 0;\n return;\n }\n\n if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))\n {\n p_nd->m_p_next_sibling = base_type::m_p_root->m_p_next_sibling;\n p_nd->m_p_prev_or_parent = 0;\n p_nd->m_metadata = 1;\n p_nd->m_p_l_child = base_type::m_p_root;\n base_type::m_p_root->m_p_prev_or_parent = p_nd;\n base_type::m_p_root->m_p_next_sibling = 0;\n base_type::m_p_root = p_nd;\n }\n else\n {\n p_nd->m_p_next_sibling = 0;\n p_nd->m_p_l_child = 0;\n p_nd->m_p_prev_or_parent = base_type::m_p_root;\n p_nd->m_metadata = 0;\n _GLIBCXX_DEBUG_ASSERT(base_type::m_p_root->m_p_l_child == 0);\n base_type::m_p_root->m_p_l_child = p_nd;\n base_type::m_p_root->m_metadata = 1;\n }\n\n base_type::m_p_root = fix(base_type::m_p_root);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nfix(node_pointer p_nd) const\n{\n while (p_nd->m_p_next_sibling != 0 &&\n\t p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata)\n {\n node_pointer p_next = p_nd->m_p_next_sibling;\n if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))\n\t{\n\t p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n\n\t if (p_nd->m_p_prev_or_parent != 0)\n\t p_nd->m_p_prev_or_parent->m_p_next_sibling = p_next;\n\n\t base_type::make_child_of(p_nd, p_next);\n\t ++p_next->m_metadata;\n\t p_nd = p_next;\n\t}\n else\n\t{\n\t p_nd->m_p_next_sibling = p_next->m_p_next_sibling;\n\n\t if (p_nd->m_p_next_sibling != 0)\n\t p_next->m_p_next_sibling = 0;\n\n\t base_type::make_child_of(p_next, p_nd);\n\t ++p_nd->m_metadata;\n\t}\n }\n\n if (p_nd->m_p_next_sibling != 0)\n p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;\n\n return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n PB_DS_ASSERT_VALID_COND((*this),true)\n node_pointer p_nd = it.m_p_nd;\n\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd, false)\n\n const bool bubble_up = Cmp_Fn::operator()(p_nd->m_value, r_new_val);\n p_nd->m_value = r_new_val;\n\n if (bubble_up)\n {\n node_pointer p_parent = base_type::parent(p_nd);\n while (p_parent != 0 &&\n\t Cmp_Fn::operator()(p_parent->m_value, p_nd->m_value))\n\t{\n\t base_type::swap_with_parent(p_nd, p_parent);\n\t p_parent = base_type::parent(p_nd);\n\t}\n\n if (p_nd->m_p_prev_or_parent == 0)\n\tbase_type::m_p_root = p_nd;\n\n m_p_max = 0;\n PB_DS_ASSERT_VALID_COND((*this),true)\n return;\n }\n\n base_type::bubble_to_top(p_nd);\n remove_parentless_node(p_nd);\n insert_node(p_nd);\n m_p_max = 0;\n PB_DS_ASSERT_VALID_COND((*this),true)\n}\n#endif\n","include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_base_/split_join_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID_COND((*this),true)\n PB_DS_ASSERT_VALID_COND(other,true)\n\n other.clear();\n if (base_type::empty())\n {\n PB_DS_ASSERT_VALID_COND((*this),true)\n PB_DS_ASSERT_VALID_COND(other,true)\n return;\n }\n\n base_type::to_linked_list();\n node_pointer p_out = base_type::prune(pred);\n while (p_out != 0)\n {\n _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);\n --base_type::m_size;\n ++other.m_size;\n\n node_pointer p_next = p_out->m_p_next_sibling;\n p_out->m_p_l_child = p_out->m_p_prev_or_parent = 0;\n p_out->m_metadata = 0;\n\n p_out->m_p_next_sibling = other.m_p_root;\n if (other.m_p_root != 0)\n\tother.m_p_root->m_p_prev_or_parent = p_out;\n\n other.m_p_root = p_out;\n other.m_p_root = other.fix(other.m_p_root);\n p_out = p_next;\n }\n\n PB_DS_ASSERT_VALID_COND(other,true)\n node_pointer p_cur = base_type::m_p_root;\n base_type::m_p_root = 0;\n\n while (p_cur != 0)\n {\n node_pointer p_next = p_cur->m_p_next_sibling;\n p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;\n p_cur->m_metadata = 0;\n p_cur->m_p_next_sibling = base_type::m_p_root;\n\n if (base_type::m_p_root != 0)\n\tbase_type::m_p_root->m_p_prev_or_parent = p_cur;\n\n base_type::m_p_root = p_cur;\n base_type::m_p_root = fix(base_type::m_p_root);\n p_cur = p_next;\n }\n\n m_p_max = 0;\n PB_DS_ASSERT_VALID_COND((*this),true)\n PB_DS_ASSERT_VALID_COND(other,true)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID_COND((*this),true)\n PB_DS_ASSERT_VALID_COND(other,true)\n\n node_pointer p_other = other.m_p_root;\n if (p_other != 0)\n do\n {\n\tnode_pointer p_next = p_other->m_p_next_sibling;\n\tstd::swap(p_other->m_p_next_sibling, p_other->m_p_prev_or_parent);\n\tp_other = p_next;\n }\n while (p_other != 0);\n\n base_type::m_p_root = join(base_type::m_p_root, other.m_p_root);\n base_type::m_size += other.m_size;\n m_p_max = 0;\n\n other.m_p_root = 0;\n other.m_size = 0;\n other.m_p_max = 0;\n\n PB_DS_ASSERT_VALID_COND((*this),true)\n PB_DS_ASSERT_VALID_COND(other,true)\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\njoin(node_pointer p_lhs, node_pointer p_rhs) const\n{\n node_pointer p_ret = 0;\n node_pointer p_cur = 0;\n\n while (p_lhs != 0 || p_rhs != 0)\n {\n if (p_rhs == 0)\n\t{\n\t if (p_cur == 0)\n\t p_ret = p_cur = p_lhs;\n\t else\n\t {\n\t p_cur->m_p_next_sibling = p_lhs;\n\t p_lhs->m_p_prev_or_parent = p_cur;\n\t }\n\t p_cur = p_lhs = 0;\n\t}\n else if (p_lhs == 0 || p_rhs->m_metadata < p_lhs->m_metadata)\n\t{\n\t if (p_cur == 0)\n\t {\n\t p_ret = p_cur = p_rhs;\n\t p_rhs = p_rhs->m_p_prev_or_parent;\n\t }\n\t else\n\t {\n\t p_cur->m_p_next_sibling = p_rhs;\n\t p_rhs = p_rhs->m_p_prev_or_parent;\n\t p_cur->m_p_next_sibling->m_p_prev_or_parent = p_cur;\n\t p_cur = p_cur->m_p_next_sibling;\n\t }\n\t}\n else if (p_lhs->m_metadata < p_rhs->m_metadata)\n\t{\n\t if (p_cur == 0)\n\t p_ret = p_cur = p_lhs;\n\t else\n\t {\n\t p_cur->m_p_next_sibling = p_lhs;\n\t p_lhs->m_p_prev_or_parent = p_cur;\n\t p_cur = p_cur->m_p_next_sibling;\n\t }\n\t p_lhs = p_cur->m_p_next_sibling;\n\t}\n else\n\t{\n\t node_pointer p_next_rhs = p_rhs->m_p_prev_or_parent;\n\t p_rhs->m_p_next_sibling = p_lhs;\n\t p_lhs = fix(p_rhs);\n\t p_rhs = p_next_rhs;\n\t}\n }\n\n if (p_cur != 0)\n p_cur->m_p_next_sibling = 0;\n\n if (p_ret != 0)\n p_ret->m_p_prev_or_parent = 0;\n\n return p_ret;\n}\n#endif\n","include/ext/pb_ds/detail/branch_policy/branch_policy.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file branch_policy/branch_policy.hpp\n * Contains a base class for branch policies.\n */\n\n#ifndef PB_DS_BRANCH_POLICY_BASE_HPP\n#define PB_DS_BRANCH_POLICY_BASE_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Primary template, base class for branch structure policies.\n template<typename Node_CItr, typename Node_Itr, typename _Alloc>\n struct branch_policy\n {\n protected:\n\ttypedef typename Node_Itr::value_type \t\tit_type;\n\ttypedef typename std::iterator_traits<it_type>::value_type value_type;\n\ttypedef typename value_type::first_type \tkey_type;\n\n\ttypedef typename remove_const<value_type>::type\trcvalue_type;\n\ttypedef typename remove_const<key_type>::type\trckey_type;\n\n\ttypedef rebind_traits<_Alloc, rcvalue_type>\trebind_v;\n\ttypedef rebind_traits<_Alloc, rckey_type>\trebind_k;\n\n\ttypedef\ttypename rebind_v::reference \t\treference;\n\ttypedef\ttypename rebind_v::const_reference \tconst_reference;\n\ttypedef\ttypename rebind_v::const_pointer\tconst_pointer;\n\n\ttypedef\ttypename rebind_k::const_reference \tkey_const_reference;\n\n\tstatic inline key_const_reference\n\textract_key(const_reference r_val)\n\t{ return r_val.first; }\n\n\tvirtual it_type\n\tend() = 0;\n\n\tit_type\n\tend_iterator() const\n\t{ return const_cast<branch_policy*>(this)->end(); }\n\n\tvirtual\n\t~branch_policy() { }\n };\n\n /// Specialization for const iterators.\n template<typename Node_CItr, typename _Alloc>\n struct branch_policy<Node_CItr, Node_CItr, _Alloc>\n {\n protected:\n\ttypedef typename Node_CItr::value_type \t\t it_type;\n \ttypedef typename std::iterator_traits<it_type>::value_type value_type;\n\ttypedef typename remove_const<value_type>::type\t\t rcvalue_type;\n\ttypedef rebind_traits<_Alloc, rcvalue_type>\trebind_v;\n\ttypedef\ttypename rebind_v::reference \t\treference;\n\ttypedef\ttypename rebind_v::const_reference \tconst_reference;\n\ttypedef\ttypename rebind_v::const_pointer\tconst_pointer;\n\n\ttypedef value_type \t\t\t\tkey_type;\n\ttypedef\ttypename rebind_v::const_reference \tkey_const_reference;\n\n\tstatic inline key_const_reference\n\textract_key(const_reference r_val)\n\t{ return r_val; }\n\n\tvirtual it_type\n\tend() const = 0;\n\n\tit_type\n\tend_iterator() const\n\t{ return end(); }\n\n\tvirtual\n\t~branch_policy() { }\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_BRANCH_POLICY_BASE_HPP\n","include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file branch_policy/null_node_metadata.hpp\n * Contains an implementation class for tree-like classes.\n */\n\n#ifndef PB_DS_0_NODE_METADATA_HPP\n#define PB_DS_0_NODE_METADATA_HPP\n\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Constant node iterator.\n template<typename Key, typename Data, typename _Alloc>\n struct dumnode_const_iterator\n {\n private:\n\ttypedef types_traits<Key, Data, _Alloc, false>\t__traits_type;\n\ttypedef typename __traits_type::pointer \tconst_iterator;\n\t\n public:\n\ttypedef const_iterator \t\t\t\tvalue_type;\n\ttypedef const_iterator \t\t\t\tconst_reference;\n\ttypedef const_reference \t \t\treference;\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/branch_policy/traits.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file branch_policy/traits.hpp\n * Contains an implementation class for tree-like classes.\n */\n\n#ifndef PB_DS_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/traits.hpp>\n#include <ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp>\n#include <ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp>\n\n#define PB_DS_DEBUG_VERIFY(_Cond)\t\t\t\t\t\\\n _GLIBCXX_DEBUG_VERIFY_AT(_Cond,\t\t\t\t\t\\\n\t\t\t _M_message(#_Cond\" assertion from %1;:%2;\")\t\\\n\t\t\t ._M_string(__FILE__)._M_integer(__LINE__)\t\\\n\t\t\t ,__file,__line)\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Tree traits class, primary template.\n template<typename Key,\n\t typename Data,\n\t typename Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t typename Node_Itr,\n\t\t typename Cmp_Fn_,\n\t\t typename _Alloc>\n\t class Node_Update,\n\t typename Tag,\n\t typename _Alloc>\n struct tree_traits;\n\n /// Trie traits class, primary template.\n template<typename Key,\n\t typename Data,\n\t typename _ATraits,\n\t template<typename Node_CItr,\n\t\t typename Node_Itr,\n\t\t typename _ATraits_,\n\t\t typename _Alloc>\n\t class Node_Update,\n\t typename Tag,\n\t typename _Alloc>\n struct trie_traits;\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#include <ext/pb_ds/detail/rb_tree_map_/traits.hpp>\n#include <ext/pb_ds/detail/splay_tree_/traits.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/traits.hpp>\n#include <ext/pb_ds/detail/pat_trie_/traits.hpp>\n\n#undef PB_DS_DEBUG_VERIFY\n\n#endif // #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP\n","include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/cc_ht_map_.hpp\n * Contains an implementation class for cc_ht_map_.\n */\n\n#include <utility>\n#include <iterator>\n#include <memory>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>\n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/debug_map_base.hpp>\n#endif\n#ifdef PB_DS_HT_MAP_TRACE_\n#include <iostream>\n#endif\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_CC_HASH_NAME cc_ht_map\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_CC_HASH_NAME cc_ht_set\n#endif\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Mapped, typename Hash_Fn, \\\n\t typename Eq_Fn, typename _Alloc, bool Store_Hash, \\\n\t typename Comb_Hash_Fn, typename Resize_Policy>\n\n#define PB_DS_CLASS_C_DEC \\\n PB_DS_CC_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc,\t\\\n\t\t Store_Hash, Comb_Hash_Fn, Resize_Policy>\n\n#define PB_DS_HASH_EQ_FN_C_DEC \\\n hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash>\n\n#define PB_DS_RANGED_HASH_FN_C_DEC \\\n ranged_hash_fn<Key,\tHash_Fn, _Alloc, Comb_Hash_Fn, Store_Hash>\n\n#define PB_DS_CC_HASH_TRAITS_BASE \\\n types_traits<Key, Mapped, _Alloc, Store_Hash>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_DEBUG_MAP_BASE_C_DEC \\\n debug_map_base<Key,\tEq_Fn, \\\n\t\t typename rebind_traits<_Alloc, Key>::const_reference>\n#endif\n\n\n /**\n * A collision-chaining hash-based container.\n *\n *\n * @ingroup hash-detail\n *\n * @tparam Key \t \tKey type.\n *\n * @tparam Mapped \t \tMap type.\n *\n * @tparam Hash_Fn\t \tHashing functor.\n * Default is __gnu_cxx::hash.\n *\n * @tparam Eq_Fn\t \tEqual functor.\n * Default std::equal_to<Key>\n *\n * @tparam _Alloc \t \tAllocator type.\n *\n * @tparam Store_Hash \tIf key type stores extra metadata.\n * Defaults to false.\n *\n * @tparam Comb_Hash_Fn\tCombining hash functor.\n * If Hash_Fn is not null_type, then this\n * is the ranged-hash functor; otherwise,\n * this is the range-hashing functor.\n * XXX(See Design::Hash-Based Containers::Hash Policies.)\n * Default direct_mask_range_hashing.\n *\n * @tparam Resize_Policy \tResizes hash.\n * Defaults to hash_standard_resize_policy,\n * using hash_exponential_size_policy and\n * hash_load_check_resize_trigger.\n *\n *\n * Bases are: detail::hash_eq_fn, Resize_Policy, detail::ranged_hash_fn,\n * detail::types_traits. (Optional: detail::debug_map_base.)\n */\n template<typename Key,\n\t typename Mapped,\n\t typename Hash_Fn,\n\t typename Eq_Fn,\n\t typename _Alloc,\n\t bool Store_Hash,\n\t typename Comb_Hash_Fn,\n\t typename Resize_Policy>\n class PB_DS_CC_HASH_NAME:\n#ifdef _GLIBCXX_DEBUG\n protected PB_DS_DEBUG_MAP_BASE_C_DEC,\n#endif\n public PB_DS_HASH_EQ_FN_C_DEC,\n public Resize_Policy,\n public PB_DS_RANGED_HASH_FN_C_DEC,\n public PB_DS_CC_HASH_TRAITS_BASE\n {\n private:\n typedef PB_DS_CC_HASH_TRAITS_BASE\t \ttraits_base;\n typedef typename traits_base::comp_hash \tcomp_hash;\n typedef typename traits_base::value_type \tvalue_type_;\n typedef typename traits_base::pointer \tpointer_;\n typedef typename traits_base::const_pointer const_pointer_;\n typedef typename traits_base::reference \treference_;\n typedef typename traits_base::const_reference const_reference_;\n\n struct entry : public traits_base::stored_data_type\n {\n\ttypename rebind_traits<_Alloc, entry>::pointer m_p_next;\n };\n\n typedef cond_dealtor<entry, _Alloc> \tcond_dealtor_t;\n\n typedef rebind_traits<_Alloc, entry> entry_traits;\n typedef typename entry_traits::allocator_type entry_allocator;\n typedef typename entry_traits::pointer entry_pointer;\n typedef typename entry_traits::const_pointer const_entry_pointer;\n typedef typename entry_traits::reference entry_reference;\n typedef typename entry_traits::const_reference const_entry_reference;\n\n typedef rebind_traits<_Alloc, entry_pointer> entry_pointer_traits;\n typedef typename entry_pointer_traits::allocator_type entry_pointer_allocator;\n typedef typename entry_pointer_traits::pointer entry_pointer_array;\n\n typedef PB_DS_RANGED_HASH_FN_C_DEC ranged_hash_fn_base;\n typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;\n typedef Resize_Policy resize_base;\n\n#ifdef _GLIBCXX_DEBUG\n typedef PB_DS_DEBUG_MAP_BASE_C_DEC \tdebug_base;\n#endif\n\n#define PB_DS_GEN_POS std::pair<entry_pointer, typename _Alloc::size_type>\n\n#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>\n\n#undef PB_DS_GEN_POS\n\n public:\n typedef _Alloc \t\t\t\tallocator_type;\n typedef typename _Alloc::size_type \tsize_type;\n typedef typename _Alloc::difference_type \tdifference_type;\n typedef Hash_Fn \t\t\t\thash_fn;\n typedef Eq_Fn \t\t\t\teq_fn;\n typedef Comb_Hash_Fn \t\t\tcomb_hash_fn;\n typedef Resize_Policy \t\t\tresize_policy;\n\n /// Value stores hash, true or false.\n enum\n\t{\n\t store_hash = Store_Hash\n\t};\n\n typedef typename traits_base::key_type key_type;\n typedef typename traits_base::key_pointer key_pointer;\n typedef typename traits_base::key_const_pointer key_const_pointer;\n typedef typename traits_base::key_reference key_reference;\n typedef typename traits_base::key_const_reference key_const_reference;\n typedef typename traits_base::mapped_type mapped_type;\n typedef typename traits_base::mapped_pointer mapped_pointer;\n typedef typename traits_base::mapped_const_pointer mapped_const_pointer;\n typedef typename traits_base::mapped_reference mapped_reference;\n typedef typename traits_base::mapped_const_reference mapped_const_reference;\n typedef typename traits_base::value_type \tvalue_type;\n typedef typename traits_base::pointer \tpointer;\n typedef typename traits_base::const_pointer const_pointer;\n typedef typename traits_base::reference \treference;\n typedef typename traits_base::const_reference const_reference;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n typedef point_iterator_ \t\t\tpoint_iterator;\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n typedef point_const_iterator_ \t\tpoint_iterator;\n#endif\n\n typedef point_const_iterator_ \t\tpoint_const_iterator;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n typedef iterator_ \t\t\titerator;\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n typedef const_iterator_ \t\t\titerator;\n#endif\n\n typedef const_iterator_ \t\t\tconst_iterator;\n\n PB_DS_CC_HASH_NAME();\n\n PB_DS_CC_HASH_NAME(const Hash_Fn&);\n\n PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&);\n\n PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&);\n\n PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&,\n\t\t const Resize_Policy&);\n\n PB_DS_CC_HASH_NAME(const PB_DS_CLASS_C_DEC&);\n\n virtual\n ~PB_DS_CC_HASH_NAME();\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n template<typename It>\n void\n copy_from_range(It, It);\n\n void\n initialize();\n\n inline size_type\n size() const;\n\n inline size_type\n max_size() const;\n\n /// True if size() == 0.\n _GLIBCXX_NODISCARD inline bool\n empty() const;\n\n /// Return current hash_fn.\n Hash_Fn&\n get_hash_fn();\n\n /// Return current const hash_fn.\n const Hash_Fn&\n get_hash_fn() const;\n\n /// Return current eq_fn.\n Eq_Fn&\n get_eq_fn();\n\n /// Return current const eq_fn.\n const Eq_Fn&\n get_eq_fn() const;\n\n /// Return current comb_hash_fn.\n Comb_Hash_Fn&\n get_comb_hash_fn();\n\n /// Return current const comb_hash_fn.\n const Comb_Hash_Fn&\n get_comb_hash_fn() const;\n\n /// Return current resize_policy.\n Resize_Policy&\n get_resize_policy();\n\n /// Return current const resize_policy.\n const Resize_Policy&\n get_resize_policy() const;\n\n inline std::pair<point_iterator, bool>\n insert(const_reference r_val)\n { return insert_imp(r_val, traits_base::m_store_extra_indicator); }\n\n inline mapped_reference\n operator[](key_const_reference r_key)\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\treturn (subscript_imp(r_key, traits_base::m_store_extra_indicator));\n#else\n\tinsert(r_key);\n\treturn traits_base::s_null_type;\n#endif\n }\n\n inline point_iterator\n find(key_const_reference);\n\n inline point_const_iterator\n find(key_const_reference) const;\n\n inline point_iterator\n find_end();\n\n inline point_const_iterator\n find_end() const;\n\n inline bool\n erase(key_const_reference);\n\n template<typename Pred>\n inline size_type\n erase_if(Pred);\n\n void\n clear();\n\n inline iterator\n begin();\n\n inline const_iterator\n begin() const;\n\n inline iterator\n end();\n\n inline const_iterator\n end() const;\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n#endif\n\n#ifdef PB_DS_HT_MAP_TRACE_\n void\n trace() const;\n#endif\n\n private:\n void\n deallocate_all();\n\n inline bool\n do_resize_if_needed();\n\n inline void\n do_resize_if_needed_no_throw();\n\n void\n resize_imp(size_type);\n\n void\n do_resize(size_type);\n\n void\n resize_imp_no_exceptions(size_type, entry_pointer_array, size_type);\n\n inline entry_pointer\n resize_imp_no_exceptions_reassign_pointer(entry_pointer,\n\t\t\t\t\t\tentry_pointer_array,\n\t\t\t\t\t\tfalse_type);\n\n inline entry_pointer\n resize_imp_no_exceptions_reassign_pointer(entry_pointer,\n\t\t\t\t\t\tentry_pointer_array,\n\t\t\t\t\t\ttrue_type);\n\n void\n deallocate_links_in_list(entry_pointer);\n\n inline entry_pointer\n get_entry(const_reference, false_type);\n\n inline entry_pointer\n get_entry(const_reference, true_type);\n\n inline void\n rels_entry(entry_pointer);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n inline mapped_reference\n subscript_imp(key_const_reference r_key, false_type)\n {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\tconst size_type pos = ranged_hash_fn_base::operator()(r_key);\n\tentry_pointer p_e = m_entries[pos];\n\tresize_base::notify_insert_search_start();\n\n\twhile (p_e != 0\n\t && !hash_eq_fn_base::operator()(p_e->m_value.first, r_key))\n\t {\n\t resize_base::notify_insert_search_collision();\n\t p_e = p_e->m_p_next;\n\t }\n\n\tresize_base::notify_insert_search_end();\n\tif (p_e != 0)\n\t {\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t return (p_e->m_value.second);\n\t }\n\n\tPB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\treturn insert_new_imp(value_type(r_key, mapped_type()), pos)->second;\n }\n\n inline mapped_reference\n subscript_imp(key_const_reference r_key, true_type)\n {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\tcomp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);\n\tentry_pointer p_e = m_entries[pos_hash_pair.first];\n\tresize_base::notify_insert_search_start();\n\twhile (p_e != 0 &&\n\t !hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash,\n\t\t\t\t\t r_key, pos_hash_pair.second))\n\t {\n\t resize_base::notify_insert_search_collision();\n\t p_e = p_e->m_p_next;\n\t }\n\n\tresize_base::notify_insert_search_end();\n\tif (p_e != 0)\n\t {\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t return p_e->m_value.second;\n\t }\n\n\tPB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\treturn insert_new_imp(value_type(r_key, mapped_type()),\n\t\t\t pos_hash_pair)->second;\n }\n#endif\n\n inline std::pair<point_iterator, bool>\n insert_imp(const_reference, false_type);\n\n inline std::pair<point_iterator, bool>\n insert_imp(const_reference, true_type);\n\n inline pointer\n insert_new_imp(const_reference r_val, size_type pos)\n {\n\tif (do_resize_if_needed())\n\t pos = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));\n\n\t// Following lines might throw an exception.\n\tentry_pointer p_e = get_entry(r_val,\n\t\t\t\t traits_base::m_no_throw_copies_indicator);\n\n\t// At this point no exceptions can be thrown.\n\tp_e->m_p_next = m_entries[pos];\n\tm_entries[pos] = p_e;\n\tresize_base::notify_inserted(++m_num_used_e);\n\n\t_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\treturn &p_e->m_value;\n }\n\n inline pointer\n insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)\n {\n\t// Following lines might throw an exception.\n\tif (do_resize_if_needed())\n\t r_pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));\n\n\tentry_pointer p_e = get_entry(r_val,\n\t\t\t\t traits_base::m_no_throw_copies_indicator);\n\n\t// At this point no exceptions can be thrown.\n\tp_e->m_hash = r_pos_hash_pair.second;\n\tp_e->m_p_next = m_entries[r_pos_hash_pair.first];\n\tm_entries[r_pos_hash_pair.first] = p_e;\n\tresize_base::notify_inserted(++m_num_used_e);\n\t_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\treturn &p_e->m_value;\n }\n\n inline pointer\n find_key_pointer(key_const_reference r_key, false_type)\n {\n\tentry_pointer p_e = m_entries[ranged_hash_fn_base::operator()(r_key)];\n\tresize_base::notify_find_search_start();\n\twhile (p_e != 0 &&\n\t !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))\n\t {\n\t resize_base::notify_find_search_collision();\n\t p_e = p_e->m_p_next;\n\t }\n\n\tresize_base::notify_find_search_end();\n\n\tif (p_e == 0)\n\t {\n\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\t return 0;\n\t }\n\telse\n\t {\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t return &p_e->m_value;\n\t }\n }\n\n inline pointer\n find_key_pointer(key_const_reference r_key, true_type)\n {\n\tcomp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);\n\tentry_pointer p_e = m_entries[pos_hash_pair.first];\n\tresize_base::notify_find_search_start();\n\twhile (p_e != 0 &&\n\t !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),\n\t\t\t\t\t p_e->m_hash,\n\t\t\t\t\t r_key, pos_hash_pair.second))\n\t {\n\t resize_base::notify_find_search_collision();\n\t p_e = p_e->m_p_next;\n\t }\n\n\tresize_base::notify_find_search_end();\n\n\tif (p_e == 0)\n\t {\n\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\t return 0;\n\t }\n\telse\n\t {\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t return &p_e->m_value;\n\t }\n }\n\n inline bool\n erase_in_pos_imp(key_const_reference, size_type);\n\n inline bool\n erase_in_pos_imp(key_const_reference, const comp_hash&);\n\n inline void\n erase_entry_pointer(entry_pointer&);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n void\n inc_it_state(pointer& r_p_value,\n\t\t std::pair<entry_pointer, size_type>& r_pos) const\n {\n\tinc_it_state((mapped_const_pointer& )r_p_value, r_pos);\n }\n#endif\n\n void\n inc_it_state(const_pointer& r_p_value,\n\t\t std::pair<entry_pointer, size_type>& r_pos) const\n {\n\t_GLIBCXX_DEBUG_ASSERT(r_p_value != 0);\n\tr_pos.first = r_pos.first->m_p_next;\n\tif (r_pos.first != 0)\n\t {\n\t r_p_value = &r_pos.first->m_value;\n\t return;\n\t }\n\n\tfor (++r_pos.second; r_pos.second < m_num_e; ++r_pos.second)\n\t if (m_entries[r_pos.second] != 0)\n\t {\n\t r_pos.first = m_entries[r_pos.second];\n\t r_p_value = &r_pos.first->m_value;\n\t return;\n\t }\n\tr_p_value = 0;\n }\n\n void\n get_start_it_state(pointer& r_p_value,\n\t\t\t std::pair<entry_pointer, size_type>& r_pos) const\n {\n\tfor (r_pos.second = 0; r_pos.second < m_num_e; ++r_pos.second)\n\t if (m_entries[r_pos.second] != 0)\n\t {\n\t r_pos.first = m_entries[r_pos.second];\n\t r_p_value = &r_pos.first->m_value;\n\t return;\n\t }\n\tr_p_value = 0;\n }\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_entry_pointer_array_valid(const entry_pointer_array,\n\t\t\t\t const char*, int) const;\n\n void\n assert_entry_pointer_valid(const entry_pointer, true_type,\n\t\t\t\t const char*, int) const;\n\n void\n assert_entry_pointer_valid(const entry_pointer, false_type,\n\t\t\t\t const char*, int) const;\n#endif\n\n#ifdef PB_DS_HT_MAP_TRACE_\n void\n trace_list(const_entry_pointer) const;\n#endif\n\n private:\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n friend class iterator_;\n#endif\n\n friend class const_iterator_;\n\n static entry_allocator \t\ts_entry_allocator;\n static entry_pointer_allocator \ts_entry_pointer_allocator;\n static iterator \t\t\ts_end_it;\n static const_iterator \t\ts_const_end_it;\n static point_iterator \t\ts_find_end_it;\n static point_const_iterator \ts_const_find_end_it;\n\n size_type \t\t\tm_num_e;\n size_type \t\t\tm_num_used_e;\n entry_pointer_array \t\tm_entries;\n\n enum\n\t{\n\t store_hash_ok = !Store_Hash\n\t\t\t || !is_same<Hash_Fn, __gnu_pbds::null_type>::value\n\t};\n\n PB_DS_STATIC_ASSERT(sth, store_hash_ok);\n };\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_HASH_EQ_FN_C_DEC\n#undef PB_DS_RANGED_HASH_FN_C_DEC\n#undef PB_DS_CC_HASH_TRAITS_BASE\n#undef PB_DS_DEBUG_MAP_BASE_C_DEC\n#undef PB_DS_CC_HASH_NAME\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/cmp_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s entire container comparison related\n * functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_HT_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\noperator==(const Other_HT_Map_Type& other) const\n{ return cmp_with_other(other); }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\ncmp_with_other(const Other_Map_Type& other) const\n{\n if (size() != other.size())\n return false;\n\n for (typename Other_Map_Type::const_iterator it = other.begin();\n it != other.end(); ++it)\n {\n key_const_reference r_key = key_const_reference(PB_DS_V2F(*it));\n\n mapped_const_pointer p_mapped_value =\n\tconst_cast<PB_DS_CLASS_C_DEC& >(*this).\n\tfind_key_pointer(r_key, traits_base::m_store_extra_indicator);\n\n if (p_mapped_value == 0)\n\treturn false;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n if (p_mapped_value->second != it->second)\n\treturn false;\n#endif\n }\n return true;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_HT_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\noperator!=(const Other_HT_Map_Type& other) const\n{ return !operator==(other); }\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp\n * Contains a conditional key destructor, used for exception handling.\n */\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Conditional dey destructor, cc_hash.\n template<typename HT_Map>\n class cond_dealtor\n {\n public:\n typedef typename HT_Map::entry \t\tentry;\n typedef typename HT_Map::entry_allocator \tentry_allocator;\n typedef typename HT_Map::key_type \tkey_type;\n\n cond_dealtor(entry_allocator* p_a, entry* p_e)\n : m_p_a(p_a), m_p_e(p_e), m_key_destruct(false),\n\tm_no_action_destructor(false)\n { }\n\n inline\n ~cond_dealtor();\n\n void\n set_key_destruct()\n { m_key_destruct = true; }\n\n void\n set_no_action_destructor()\n { m_no_action_destructor = true; }\n\n protected:\n entry_allocator* const \t\t\tm_p_a;\n entry* const \t\t\t\tm_p_e;\n\n bool \t\t\t\t\tm_key_destruct;\n bool \t\t\t\t\tm_no_action_destructor;\n };\n\n template<typename HT_Map>\n inline\n cond_dealtor<HT_Map>::\n ~cond_dealtor()\n {\n if (m_no_action_destructor)\n\treturn;\n if (m_key_destruct)\n\tm_p_e->m_value.first.~key_type();\n m_p_a->deallocate(m_p_e, 1);\n }\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/constructor_destructor_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s constructors, destructor,\n * and related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_allocator\nPB_DS_CLASS_C_DEC::s_entry_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_pointer_allocator\nPB_DS_CLASS_C_DEC::s_entry_pointer_allocator;\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CC_HASH_NAME() :\n ranged_hash_fn_base(resize_base::get_nearest_larger_size(1)),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn) :\n ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) :\n PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),\n ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n std::fill(m_entries, m_entries + m_num_e, (entry_pointer)0);\n Resize_Policy::notify_cleared();\n ranged_hash_fn_base::notify_resized(m_num_e);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, \n\t\t const Comb_Hash_Fn& r_comb_hash_fn) :\n PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),\n ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t r_hash_fn, r_comb_hash_fn),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, \n\t\t const Comb_Hash_Fn& r_comb_hash_fn, \n\t\t const Resize_Policy& r_resize_policy) :\n PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),\n Resize_Policy(r_resize_policy),\n ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t r_hash_fn, r_comb_hash_fn),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CC_HASH_NAME(const PB_DS_CLASS_C_DEC& other) :\n PB_DS_HASH_EQ_FN_C_DEC(other),\n resize_base(other), ranged_hash_fn_base(other),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n __try\n {\n\tcopy_from_range(other.begin(), other.end());\n }\n __catch(...)\n {\n\tdeallocate_all();\n\t__throw_exception_again;\n }\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_CC_HASH_NAME()\n{ deallocate_all(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n std::swap(m_entries, other.m_entries);\n std::swap(m_num_e, other.m_num_e);\n std::swap(m_num_used_e, other.m_num_used_e);\n ranged_hash_fn_base::swap(other);\n hash_eq_fn_base::swap(other);\n resize_base::swap(other);\n\n _GLIBCXX_DEBUG_ONLY(debug_base::swap(other));\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndeallocate_all()\n{\n clear();\n s_entry_pointer_allocator.deallocate(m_entries, m_num_e);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{\n std::fill(m_entries, m_entries + m_num_e, entry_pointer(0));\n Resize_Policy::notify_resized(m_num_e);\n Resize_Policy::notify_cleared();\n ranged_hash_fn_base::notify_resized(m_num_e);\n}\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s constructors, destructor,\n * and related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nconstructor_insert_new_imp(mapped_const_reference r_val, size_type pos, \n\t\t\t false_type)\n{\n // Following lines might throw an exception.\n entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator);\n\n // At this point no exceptions can be thrown.\n p->m_p_next = m_entries[pos];\n m_entries[pos] = p;\n _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)\n}\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s constructors, destructor,\n * and related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nconstructor_insert_new_imp(const_reference r_val, size_type pos, true_type)\n{\n // Following lines might throw an exception.\n entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator);\n\n // At this point no exceptions can be thrown.\n p->m_p_next = m_entries[pos];\n p->m_hash = ranged_hash_fn_base::operator()((key_const_reference)(PB_DS_V2F(p->m_value))).second;\n\n m_entries[pos] = p;\n _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)\n}\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/debug_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s debug-mode functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n debug_base::check_size(m_num_used_e, __file, __line);\n assert_entry_pointer_array_valid(m_entries, __file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_pointer_array_valid(const entry_pointer_array a_p_entries,\n\t\t\t\t const char* __file, int __line) const\n{\n size_type iterated_num_used_e = 0;\n for (size_type pos = 0; pos < m_num_e; ++pos)\n {\n entry_pointer p_e = a_p_entries[pos];\n while (p_e != 0)\n {\n\t ++iterated_num_used_e;\n\t assert_entry_pointer_valid(p_e, traits_base::m_store_extra_indicator,\n\t\t\t\t __file, __line);\n\t p_e = p_e->m_p_next;\n }\n }\n PB_DS_DEBUG_VERIFY(iterated_num_used_e == m_num_used_e);\n}\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp>\n\n#endif \n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s debug-mode functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_pointer_valid(const entry_pointer p, false_type,\n\t\t\t const char* __file, int __line) const\n{ debug_base::check_key_exists(PB_DS_V2F(p->m_value), __file, __line); }\n\n#endif\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/debug_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s debug-mode functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_pointer_valid(const entry_pointer p_e, true_type,\n\t\t\t const char* __file, int __line) const\n{\n debug_base::check_key_exists(PB_DS_V2F(p_e->m_value), __file, __line);\n comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));\n PB_DS_DEBUG_VERIFY(p_e->m_hash == pos_hash_pair.second);\n}\n\n#endif \n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/entry_list_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s entry-list related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndeallocate_links_in_list(entry_pointer p_e)\n{\n while (p_e != 0)\n {\n entry_pointer p_dealloc_e = p_e;\n p_e = p_e->m_p_next;\n s_entry_allocator.deallocate(p_dealloc_e, 1);\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nget_entry(const_reference r_val, true_type)\n{\n // Following line might throw an exception.\n entry_pointer p_e = s_entry_allocator.allocate(1);\n\n // Following lines* cannot* throw an exception.\n new (&p_e->m_value) value_type(r_val);\n return p_e;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nget_entry(const_reference r_val, false_type)\n{\n // Following line might throw an exception.\n entry_pointer p_e = s_entry_allocator.allocate(1);\n cond_dealtor_t cond(p_e);\n\n // Following lines might throw an exception.\n new (&p_e->m_value) value_type(r_val);\n cond.set_no_action();\n return p_e;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrels_entry(entry_pointer p_e)\n{\n // The following lines cannot throw exceptions (unless if key-data dtors do).\n p_e->m_value.~value_type();\n s_entry_allocator.deallocate(p_e, 1);\n}\n\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/erase_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s erase related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nerase_entry_pointer(entry_pointer& r_p_e)\n{\n _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(r_p_e->m_value)));\n\n entry_pointer p_e = r_p_e;\n r_p_e = r_p_e->m_p_next;\n rels_entry(p_e);\n _GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);\n resize_base::notify_erased(--m_num_used_e);\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n size_type num_ersd = 0;\n for (size_type pos = 0; pos < m_num_e; ++pos)\n {\n while (m_entries[pos] != 0 && pred(m_entries[pos]->m_value))\n {\n\t ++num_ersd;\n\t entry_pointer p_next_e = m_entries[pos]->m_p_next;\n\t erase_entry_pointer(m_entries[pos]);\n\t m_entries[pos] = p_next_e;\n }\n\n entry_pointer p_e = m_entries[pos];\n while (p_e != 0 && p_e->m_p_next != 0)\n {\n\t if (pred(p_e->m_p_next->m_value))\n {\n\t ++num_ersd;\n\t erase_entry_pointer(p_e->m_p_next);\n }\n\t else\n\t p_e = p_e->m_p_next;\n }\n }\n\n do_resize_if_needed_no_throw();\n return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n for (size_type pos = 0; pos < m_num_e; ++pos)\n while (m_entries[pos] != 0)\n erase_entry_pointer(m_entries[pos]);\n do_resize_if_needed_no_throw();\n resize_base::notify_cleared();\n}\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp>\n\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s erase related functions,\n * when the hash value is not stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(key_const_reference r_key)\n{\n PB_DS_ASSERT_VALID((*this))\n return erase_in_pos_imp(r_key, ranged_hash_fn_base::operator()(r_key));\n}\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase_in_pos_imp(key_const_reference r_key, size_type pos)\n{\n PB_DS_ASSERT_VALID((*this))\n entry_pointer p_e = m_entries[pos];\n resize_base::notify_erase_search_start();\n if (p_e == 0)\n {\n resize_base::notify_erase_search_end();\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n PB_DS_ASSERT_VALID((*this))\n return false;\n }\n\n if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))\n {\n resize_base::notify_erase_search_end();\n PB_DS_CHECK_KEY_EXISTS(r_key)\n erase_entry_pointer(m_entries[pos]);\n do_resize_if_needed_no_throw();\n PB_DS_ASSERT_VALID((*this))\n return true;\n }\n\n while (true)\n {\n entry_pointer p_next_e = p_e->m_p_next;\n if (p_next_e == 0)\n\t{\n\t resize_base::notify_erase_search_end();\n\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\t PB_DS_ASSERT_VALID((*this))\n\t return false;\n\t}\n\n if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), r_key))\n\t{\n\t resize_base::notify_erase_search_end();\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t erase_entry_pointer(p_e->m_p_next);\n\t do_resize_if_needed_no_throw();\n\t PB_DS_ASSERT_VALID((*this))\n\t return true;\n\t}\n resize_base::notify_erase_search_collision();\n p_e = p_next_e;\n }\n}\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/erase_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s erase related functions,\n * when the hash value is stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase_in_pos_imp(key_const_reference r_key, const comp_hash& r_pos_hash_pair)\n{\n PB_DS_ASSERT_VALID((*this))\n entry_pointer p_e = m_entries[r_pos_hash_pair.first];\n resize_base::notify_erase_search_start();\n if (p_e == 0)\n {\n resize_base::notify_erase_search_end();\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n PB_DS_ASSERT_VALID((*this))\n return false;\n }\n\n if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,\n\t\t\t\t r_key, r_pos_hash_pair.second))\n {\n resize_base::notify_erase_search_end();\n PB_DS_CHECK_KEY_EXISTS(r_key)\n erase_entry_pointer(m_entries[r_pos_hash_pair.first]);\n do_resize_if_needed_no_throw();\n PB_DS_ASSERT_VALID((*this))\n return true;\n }\n\n while (true)\n {\n entry_pointer p_next_e = p_e->m_p_next;\n if (p_next_e == 0)\n\t{\n\t resize_base::notify_erase_search_end();\n\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\t PB_DS_ASSERT_VALID((*this))\n\t return false;\n\t}\n\n if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value),\n\t\t\t\t p_next_e->m_hash, r_key,\n\t\t\t\t r_pos_hash_pair.second))\n\t{\n\t resize_base::notify_erase_search_end();\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t erase_entry_pointer(p_e->m_p_next);\n\t do_resize_if_needed_no_throw();\n\t PB_DS_ASSERT_VALID((*this))\n\t return true;\n\t}\n resize_base::notify_erase_search_collision();\n p_e = p_next_e;\n }\n}\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/find_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s find related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key)\n{\n PB_DS_ASSERT_VALID((*this))\n return find_key_pointer(r_key, traits_base::m_store_extra_indicator);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key) const\n{\n PB_DS_ASSERT_VALID((*this))\n return const_cast<PB_DS_CLASS_C_DEC& >(*this).find_key_pointer(r_key, \n\t\t\t\t\ttraits_base::m_store_extra_indicator);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind_end()\n{ return 0; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nfind_end() const\n{ return 0; }\n\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/find_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s find related functions,\n * when the hash value is stored.\n */\n\n","include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/info_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s entire container info related\n * functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return m_num_used_e; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return m_entry_allocator.max_size(); }\n\nPB_DS_CLASS_T_DEC\n_GLIBCXX_NODISCARD\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (size() == 0); }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_HT_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\noperator==(const Other_HT_Map_Type& other) const\n{ return cmp_with_other(other); }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\ncmp_with_other(const Other_Map_Type& other) const\n{\n if (size() != other.size())\n return false;\n\n for (typename Other_Map_Type::const_iterator it = other.begin();\n it != other.end(); ++it)\n {\n key_const_reference r_key =(key_const_reference)PB_DS_V2F(*it);\n mapped_const_pointer p_mapped_value =\n\tconst_cast<PB_DS_CLASS_C_DEC& >(*this).\n\tfind_key_pointer(r_key, traits_base::m_store_extra_indicator);\n\n if (p_mapped_value == 0)\n\treturn false;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n if (p_mapped_value->second != it->second)\n\treturn false;\n#endif \n }\n return true;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_HT_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\noperator!=(const Other_HT_Map_Type& other) const\n{ return !operator==(other); }\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/insert_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s insert related functions.\n */\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp>\n\n","include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s insert related functions,\n * when the hash value is not stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_imp(const_reference r_val, false_type)\n{\n PB_DS_ASSERT_VALID((*this))\n key_const_reference r_key = PB_DS_V2F(r_val);\n const size_type pos = ranged_hash_fn_base::operator()(r_key);\n entry_pointer p_e = m_entries[pos];\n resize_base::notify_insert_search_start();\n\n while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), \n\t\t\t\t\t\t r_key))\n {\n resize_base::notify_insert_search_collision();\n p_e = p_e->m_p_next;\n }\n\n resize_base::notify_insert_search_end();\n if (p_e != 0)\n {\n PB_DS_CHECK_KEY_EXISTS(r_key)\n return std::make_pair(&p_e->m_value, false);\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return std::make_pair(insert_new_imp(r_val, pos), true);\n}\n\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/insert_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s insert related functions,\n * when the hash value is stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_imp(const_reference r_val, true_type)\n{\n PB_DS_ASSERT_VALID((*this))\n key_const_reference key = PB_DS_V2F(r_val);\n comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(key);\n entry_pointer p_e = m_entries[pos_hash_pair.first];\n resize_base::notify_insert_search_start();\n\n while (p_e != 0 && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),\n\t\t\t\t\t\t p_e->m_hash,\n\t\t\t\t\t\t key, pos_hash_pair.second))\n {\n resize_base::notify_insert_search_collision();\n p_e = p_e->m_p_next;\n }\n\n resize_base::notify_insert_search_end();\n if (p_e != 0)\n {\n PB_DS_CHECK_KEY_EXISTS(key)\n return std::make_pair(&p_e->m_value, false);\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(key)\n return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);\n}\n\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/iterators_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s iterators related functions, e.g.,\n * begin().\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::s_end_it;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::s_const_end_it;\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n pointer p_value;\n std::pair<entry_pointer, size_type> pos;\n get_start_it_state(p_value, pos);\n return iterator(p_value, pos, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{ return s_end_it; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n pointer p_value;\n std::pair<entry_pointer, size_type> pos;\n get_start_it_state(p_value, pos);\n return const_iterator(p_value, pos, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{ return s_const_end_it; }\n\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/policy_access_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s policy access\n * functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nHash_Fn& \nPB_DS_CLASS_C_DEC::\nget_hash_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Hash_Fn& \nPB_DS_CLASS_C_DEC::\nget_hash_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nEq_Fn& \nPB_DS_CLASS_C_DEC::\nget_eq_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Eq_Fn& \nPB_DS_CLASS_C_DEC::\nget_eq_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nComb_Hash_Fn& \nPB_DS_CLASS_C_DEC::\nget_comb_hash_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Comb_Hash_Fn& \nPB_DS_CLASS_C_DEC::\nget_comb_hash_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nResize_Policy& \nPB_DS_CLASS_C_DEC::\nget_resize_policy()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Resize_Policy& \nPB_DS_CLASS_C_DEC::\nget_resize_policy() const\n{ return *this; }\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/resize_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s resize related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\ndo_resize_if_needed()\n{\n if (!resize_base::is_resize_needed())\n return false;\n resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));\n return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndo_resize(size_type len)\n{ resize_imp(resize_base::get_nearest_larger_size(len)); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ndo_resize_if_needed_no_throw()\n{\n if (!resize_base::is_resize_needed())\n return;\n\n __try\n {\n resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));\n }\n __catch(...)\n { }\n\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize_imp(size_type new_size)\n{\n PB_DS_ASSERT_VALID((*this))\n if (new_size == m_num_e)\n return;\n\n const size_type old_size = m_num_e;\n entry_pointer_array a_p_entries_resized;\n\n // Following line might throw an exception.\n ranged_hash_fn_base::notify_resized(new_size);\n\n __try\n {\n // Following line might throw an exception.\n a_p_entries_resized = s_entry_pointer_allocator.allocate(new_size);\n m_num_e = new_size;\n }\n __catch(...)\n {\n ranged_hash_fn_base::notify_resized(old_size);\n __throw_exception_again;\n }\n\n // At this point no exceptions can be thrown.\n resize_imp_no_exceptions(new_size, a_p_entries_resized, old_size);\n Resize_Policy::notify_resized(new_size);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize_imp_no_exceptions(size_type new_size, entry_pointer_array a_p_entries_resized, size_type old_size)\n{\n std::fill(a_p_entries_resized, a_p_entries_resized + m_num_e,\n\t entry_pointer(0));\n\n for (size_type pos = 0; pos < old_size; ++pos)\n {\n entry_pointer p_e = m_entries[pos];\n while (p_e != 0)\n\tp_e = resize_imp_no_exceptions_reassign_pointer(p_e, a_p_entries_resized, traits_base::m_store_extra_indicator);\n }\n\n m_num_e = new_size;\n _GLIBCXX_DEBUG_ONLY(assert_entry_pointer_array_valid(a_p_entries_resized,\n\t\t\t\t\t\t __FILE__, __LINE__);)\n s_entry_pointer_allocator.deallocate(m_entries, old_size);\n m_entries = a_p_entries_resized;\n PB_DS_ASSERT_VALID((*this))\n}\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp>\n\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s resize related functions, when the\n * hash value is not stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nresize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, false_type)\n{\n const size_type hash_pos =\n ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));\n\n entry_pointer const p_next_e = p_e->m_p_next;\n p_e->m_p_next = a_p_entries_resized[hash_pos];\n a_p_entries_resized[hash_pos] = p_e;\n return p_next_e;\n}\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/resize_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s resize related functions, when the\n * hash value is stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nresize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, true_type)\n{\n const comp_hash pos_hash_pair =\n ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash);\n\n entry_pointer const p_next_e = p_e->m_p_next;\n p_e->m_p_next = a_p_entries_resized[pos_hash_pair.first];\n a_p_entries_resized[pos_hash_pair.first] = p_e;\n return p_next_e;\n}\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/size_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s entire container size related\n * functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return m_num_used_e; }\n\nPB_DS_CLASS_T_DEC\n_GLIBCXX_NODISCARD\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (size() == 0); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_entry_allocator.max_size(); }\n\n#endif\n","include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_table_map_/trace_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s trace-mode functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef PB_DS_HT_MAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n std::cerr << static_cast<unsigned long>(m_num_e) << \" \" \n\t << static_cast<unsigned long>(m_num_used_e) << std::endl;\n\n for (size_type i = 0; i < m_num_e; ++i)\n {\n std::cerr << static_cast<unsigned long>(i) << \" \";\n trace_list(m_entries[i]);\n std::cerr << std::endl;\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_list(const_entry_pointer p_l) const\n{\n size_type iterated_num_used_e = 0;\n while (p_l != 0)\n {\n std::cerr << PB_DS_V2F(p_l->m_value) << \" \";\n p_l = p_l->m_p_next;\n }\n}\n\n#endif \n#endif\n","include/ext/pb_ds/detail/cond_dealtor.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file detail/cond_dealtor.hpp\n * Contains a conditional deallocator.\n */\n\n#ifndef PB_DS_COND_DEALTOR_HPP\n#define PB_DS_COND_DEALTOR_HPP\n\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Conditional deallocate constructor argument.\n template<typename Entry, typename _Alloc>\n class cond_dealtor\n {\n\ttypedef rebind_traits<_Alloc, Entry>\talloc_traits;\n\n public:\n\ttypedef typename alloc_traits::allocator_type entry_allocator;\n\ttypedef typename alloc_traits::pointer\t entry_pointer;\n\n\tcond_dealtor(entry_pointer p_e)\n\t: m_p_e(p_e), m_no_action_destructor(false) { }\n\n\t~cond_dealtor()\n\t{\n\t if (m_no_action_destructor)\n\t return;\n\t s_alloc.deallocate(m_p_e, 1);\n\t}\n\n\tvoid\n\tset_no_action()\n\t{ m_no_action_destructor = true; }\n\n private:\n\tentry_pointer \t\tm_p_e;\n\tbool \t\t\tm_no_action_destructor;\n\tstatic entry_allocator \ts_alloc;\n };\n\n template<typename Entry, class _Alloc>\n typename cond_dealtor<Entry, _Alloc>::entry_allocator\n cond_dealtor<Entry, _Alloc>::s_alloc;\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_COND_DEALTOR_HPP\n","include/ext/pb_ds/detail/container_base_dispatch.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file container_base_dispatch.hpp\n * Contains associative container dispatching.\n */\n\n#ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP\n#define PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP\n\n#include <ext/typelist.h>\n\n#define PB_DS_ASSERT_VALID(X)\t\t\t\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);)\n\n#define PB_DS_DEBUG_VERIFY(_Cond)\t\t\t\t\t\\\n _GLIBCXX_DEBUG_VERIFY_AT(_Cond,\t\t\t\t\t\\\n\t\t\t _M_message(#_Cond\" assertion from %1;:%2;\")\t\\\n\t\t\t ._M_string(__FILE__)._M_integer(__LINE__)\t\\\n\t\t\t ,__file,__line)\n\n#define PB_DS_CHECK_KEY_EXISTS(_Key)\t\t\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(_Key, __FILE__, __LINE__);)\n\n#define PB_DS_CHECK_KEY_DOES_NOT_EXIST(_Key)\t\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(_Key,\t\\\n\t\t\t\t\t\t\t __FILE__, __LINE__);)\n\n#define PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_V2F(X) (X).first\n#define PB_DS_V2S(X) (X).second\n#define PB_DS_EP2VP(X)& ((X)->m_value)\n#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>\n#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>\n#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>\n#undef PB_DS_DATA_TRUE_INDICATOR\n#undef PB_DS_V2F\n#undef PB_DS_V2S\n#undef PB_DS_EP2VP\n\n#define PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_V2F(X) (X)\n#define PB_DS_V2S(X) Mapped_Data()\n#define PB_DS_EP2VP(X)& ((X)->m_value.first)\n#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>\n#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>\n#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>\n#undef PB_DS_DATA_FALSE_INDICATOR\n#undef PB_DS_V2F\n#undef PB_DS_V2S\n#undef PB_DS_EP2VP\n\n#undef PB_DS_CHECK_KEY_DOES_NOT_EXIST\n#undef PB_DS_CHECK_KEY_EXISTS\n#undef PB_DS_DEBUG_VERIFY\n#undef PB_DS_ASSERT_VALID\n\nnamespace __gnu_pbds\n{\nnamespace detail\n{\n /// Specialization for list-update map.\n template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, Mapped, _Alloc, list_update_tag,\n\t\t\t\t Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n /// Dispatched type.\n typedef lu_map<Key, Mapped, at0t, _Alloc, at1t>\ttype;\n };\n\n /// Specialization for list-update set.\n template<typename Key, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, null_type, _Alloc, list_update_tag,\n\t\t\t\t Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n /// Dispatched type.\n typedef lu_set<Key, null_type, at0t, _Alloc, at1t> type;\n };\n\n /// Specialization for PATRICIA trie map.\n template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, Mapped, _Alloc, pat_trie_tag, Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n typedef pat_trie_map<Key, Mapped, at1t, _Alloc> \t\ttype;\n };\n\n /// Specialization for PATRICIA trie set.\n template<typename Key, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, null_type, _Alloc, pat_trie_tag,\n\t\t\t\t Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n /// Dispatched type.\n typedef pat_trie_set<Key, null_type, at1t, _Alloc> type;\n };\n\n /// Specialization for R-B tree map.\n template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, Mapped, _Alloc, rb_tree_tag, Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n /// Dispatched type.\n typedef rb_tree_map<Key, Mapped, at0t, at1t, _Alloc> \ttype;\n };\n\n /// Specialization for R-B tree set.\n template<typename Key, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, null_type, _Alloc, rb_tree_tag,\n\t\t\t\t Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n typedef rb_tree_set<Key, null_type, at0t, at1t, _Alloc> type;\n };\n\n /// Specialization splay tree map.\n template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, Mapped, _Alloc, splay_tree_tag,\n\t\t\t\t Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n /// Dispatched type.\n typedef splay_tree_map<Key, Mapped, at0t, at1t, _Alloc> \ttype;\n };\n\n /// Specialization splay tree set.\n template<typename Key, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, null_type, _Alloc, splay_tree_tag,\n\t\t\t\t Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n /// Dispatched type.\n typedef splay_tree_set<Key, null_type, at0t, at1t, _Alloc> type;\n };\n\n /// Specialization ordered-vector tree map.\n template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, Mapped, _Alloc, ov_tree_tag, Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n /// Dispatched type.\n typedef ov_tree_map<Key, Mapped, at0t, at1t, _Alloc> \ttype;\n };\n\n /// Specialization ordered-vector tree set.\n template<typename Key, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, null_type, _Alloc, ov_tree_tag,\n\t\t\t\t Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n\n public:\n /// Dispatched type.\n typedef ov_tree_set<Key, null_type, at0t, at1t, _Alloc> type;\n };\n\n /// Specialization colision-chaining hash map.\n template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, Mapped, _Alloc, cc_hash_tag, Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>\tat2;\n typedef typename at2::type\t\t\t \tat2t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>\tat3;\n typedef typename at3::type\t\t\t\tat3t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> \tat4;\n typedef typename at4::type\t\t\t \tat4t;\n\n public:\n /// Dispatched type.\n typedef cc_ht_map<Key, Mapped, at0t, at1t, _Alloc, \n\t\t\tat3t::value, at4t, at2t> \t \ttype;\n };\n\n /// Specialization colision-chaining hash set.\n template<typename Key, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, null_type, _Alloc, cc_hash_tag,\n\t\t\t\t Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>\tat2;\n typedef typename at2::type\t\t\t \tat2t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>\tat3;\n typedef typename at3::type\t\t\t\tat3t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> \tat4;\n typedef typename at4::type\t\t\t \tat4t;\n\n public:\n /// Dispatched type.\n typedef cc_ht_set<Key, null_type, at0t, at1t, _Alloc,\n\t\t\t\t at3t::value, at4t, at2t> \ttype;\n };\n\n /// Specialization general-probe hash map.\n template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, Mapped, _Alloc, gp_hash_tag, Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>\tat2;\n typedef typename at2::type\t\t\t \tat2t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>\tat3;\n typedef typename at3::type\t\t\t\tat3t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> \tat4;\n typedef typename at4::type\t\t\t \tat4t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> \tat5;\n typedef typename at5::type\t\t\t \tat5t;\n\n public:\n /// Dispatched type.\n typedef gp_ht_map<Key, Mapped, at0t, at1t, _Alloc, \n\t\t\tat3t::value, at4t, at5t, at2t> \t\ttype;\n };\n\n /// Specialization general-probe hash set.\n template<typename Key, typename _Alloc, typename Policy_Tl>\n struct container_base_dispatch<Key, null_type, _Alloc, gp_hash_tag,\n\t\t\t\t Policy_Tl>\n {\n private:\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n typedef typename at0::type\t\t\t \tat0t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n typedef typename at1::type\t\t\t \tat1t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>\tat2;\n typedef typename at2::type\t\t\t \tat2t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>\tat3;\n typedef typename at3::type\t\t\t\tat3t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> \tat4;\n typedef typename at4::type\t\t\t \tat4t;\n typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> \tat5;\n typedef typename at5::type\t\t\t \tat5t;\n\n public:\n /// Dispatched type.\n typedef gp_ht_set<Key, null_type, at0t, at1t, _Alloc,\n\t\t\tat3t::value, at4t, at5t, at2t>\t\ttype;\n };\n} // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/debug_map_base.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file detail/debug_map_base.hpp\n * Contains a debug-mode base for all maps.\n */\n\n#ifndef PB_DS_DEBUG_MAP_BASE_HPP\n#define PB_DS_DEBUG_MAP_BASE_HPP\n\n#ifdef _GLIBCXX_DEBUG\n\n#include <list>\n#include <utility>\n#include <cstdlib>\n#include <iostream>\n#include <ext/throw_allocator.h>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n // Need std::pair ostream extractor.\n template<typename _CharT, typename _Traits, typename _Tp1, typename _Tp2>\n inline std::basic_ostream<_CharT, _Traits>&\n operator<<(std::basic_ostream<_CharT, _Traits>& __out,\n\t const std::pair<_Tp1, _Tp2>& p)\n { return (__out << '(' << p.first << ',' << p.second << ')'); }\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Eq_Fn, typename Const_Key_Reference>\n\n#define PB_DS_CLASS_C_DEC \\\n debug_map_base<Key, Eq_Fn, Const_Key_Reference>\n\n /// Debug base class.\n template<typename Key, typename Eq_Fn, typename Const_Key_Reference>\n class debug_map_base\n {\n private:\n typedef Const_Key_Reference \t\t\tkey_const_reference;\n typedef std::_GLIBCXX_STD_C::list<Key> \t\tkey_repository;\n typedef typename key_repository::size_type \tsize_type;\n typedef typename key_repository::iterator\t \titerator;\n typedef typename key_repository::const_iterator \tconst_iterator;\n\n protected:\n debug_map_base();\n\n debug_map_base(const PB_DS_CLASS_C_DEC&);\n\n ~debug_map_base();\n\n inline void\n insert_new(key_const_reference);\n\n inline void\n erase_existing(key_const_reference);\n\n void\n clear();\n\n inline void\n check_key_exists(key_const_reference, const char*, int) const;\n\n inline void\n check_key_does_not_exist(key_const_reference, const char*, int) const;\n\n inline void\n check_size(size_type, const char*, int) const;\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n template<typename Cmp_Fn>\n void\n split(key_const_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);\n\n void\n join(PB_DS_CLASS_C_DEC&, bool with_cleanup = true);\n\n private:\n void\n assert_valid(const char*, int) const;\n\n const_iterator\n find(key_const_reference) const;\n\n iterator\n find(key_const_reference);\n\n key_repository \tm_keys;\n Eq_Fn \t\tm_eq;\n };\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n debug_map_base()\n { PB_DS_ASSERT_VALID((*this)) }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n debug_map_base(const PB_DS_CLASS_C_DEC& other)\n : m_keys(other.m_keys), m_eq(other.m_eq)\n { PB_DS_ASSERT_VALID((*this)) }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ~debug_map_base()\n { PB_DS_ASSERT_VALID((*this)) }\n\n PB_DS_CLASS_T_DEC\n inline void\n PB_DS_CLASS_C_DEC::\n insert_new(key_const_reference r_key)\n {\n PB_DS_ASSERT_VALID((*this))\n\n if (find(r_key) != m_keys.end())\n\t{\n\t std::cerr << \"insert_new key already present \" << r_key << std::endl;\n\t std::abort();\n\t}\n\n __try\n\t{\n\t m_keys.push_back(r_key);\n\t}\n __catch(...)\n\t{\n\t std::cerr << \"insert_new \" << r_key << std::endl;\n\t std::abort();\n\t}\n\n PB_DS_ASSERT_VALID((*this))\n }\n\n PB_DS_CLASS_T_DEC\n inline void\n PB_DS_CLASS_C_DEC::\n erase_existing(key_const_reference r_key)\n {\n PB_DS_ASSERT_VALID((*this))\n iterator it = find(r_key);\n if (it == m_keys.end())\n\t{\n\t std::cerr << \"erase_existing\" << r_key << std::endl;\n\t std::abort();\n\t}\n m_keys.erase(it);\n PB_DS_ASSERT_VALID((*this))\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n clear()\n {\n PB_DS_ASSERT_VALID((*this))\n m_keys.clear();\n PB_DS_ASSERT_VALID((*this))\n }\n\n PB_DS_CLASS_T_DEC\n inline void\n PB_DS_CLASS_C_DEC::\n check_key_exists(key_const_reference r_key,\n\t\t const char* __file, int __line) const\n {\n assert_valid(__file, __line);\n if (find(r_key) == m_keys.end())\n\t{\n\t std::cerr << __file << ':' << __line << \": check_key_exists \"\n\t\t << r_key << std::endl;\n\t std::abort();\n\t}\n }\n\n PB_DS_CLASS_T_DEC\n inline void\n PB_DS_CLASS_C_DEC::\n check_key_does_not_exist(key_const_reference r_key,\n\t\t\t const char* __file, int __line) const\n {\n assert_valid(__file, __line);\n if (find(r_key) != m_keys.end())\n\t{\n\t using std::cerr;\n\t using std::endl;\n\t cerr << __file << ':' << __line << \": check_key_does_not_exist \"\n\t << r_key << endl;\n\t std::abort();\n\t}\n }\n\n PB_DS_CLASS_T_DEC\n inline void\n PB_DS_CLASS_C_DEC::\n check_size(size_type size, const char* __file, int __line) const\n {\n assert_valid(__file, __line);\n const size_type keys_size = m_keys.size();\n if (size != keys_size)\n\t{\n\t std::cerr << __file << ':' << __line << \": check_size \"\n\t\t << size << \" != \" << keys_size << std::endl;\n\t std::abort();\n\t}\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n swap(PB_DS_CLASS_C_DEC& other)\n {\n PB_DS_ASSERT_VALID((*this))\n m_keys.swap(other.m_keys);\n std::swap(m_eq, other.m_eq);\n PB_DS_ASSERT_VALID((*this))\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::const_iterator\n PB_DS_CLASS_C_DEC::\n find(key_const_reference r_key) const\n {\n PB_DS_ASSERT_VALID((*this))\n typedef const_iterator iterator_type;\n for (iterator_type it = m_keys.begin(); it != m_keys.end(); ++it)\n\tif (m_eq(*it, r_key))\n\t return it;\n return m_keys.end();\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::iterator\n PB_DS_CLASS_C_DEC::\n find(key_const_reference r_key)\n {\n PB_DS_ASSERT_VALID((*this))\n iterator it = m_keys.begin();\n while (it != m_keys.end())\n\t{\n\t if (m_eq(*it, r_key))\n\t return it;\n\t ++it;\n\t}\n return it;\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n assert_valid(const char* __file, int __line) const\n {\n const_iterator prime_it = m_keys.begin();\n while (prime_it != m_keys.end())\n\t{\n\t const_iterator sec_it = prime_it;\n\t ++sec_it;\n\t while (sec_it != m_keys.end())\n\t {\n\t PB_DS_DEBUG_VERIFY(!m_eq(*sec_it, *prime_it));\n\t PB_DS_DEBUG_VERIFY(!m_eq(*prime_it, *sec_it));\n\t ++sec_it;\n\t }\n\t ++prime_it;\n\t}\n }\n\n PB_DS_CLASS_T_DEC\n template<typename Cmp_Fn>\n void\n PB_DS_CLASS_C_DEC::\n split(key_const_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)\n {\n other.clear();\n iterator it = m_keys.begin();\n while (it != m_keys.end())\n\tif (cmp_fn(r_key, *it))\n\t {\n\t other.insert_new(*it);\n\t it = m_keys.erase(it);\n\t }\n\telse\n\t ++it;\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n join(PB_DS_CLASS_C_DEC& other, bool with_cleanup)\n {\n iterator it = other.m_keys.begin();\n while (it != other.m_keys.end())\n\t{\n\t insert_new(*it);\n\t if (with_cleanup)\n\t it = other.m_keys.erase(it);\n\t else\n\t ++it;\n\t}\n _GLIBCXX_DEBUG_ASSERT(!with_cleanup || other.m_keys.empty());\n }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n} // namespace detail\n} // namespace __gnu_pbds\n\n\n#endif\n\n#endif\n","include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file eq_by_less.hpp\n * Contains an equivalence function.\n */\n\n#ifndef PB_DS_EQ_BY_LESS_HPP\n#define PB_DS_EQ_BY_LESS_HPP\n\n#include <utility>\n#include <functional>\n#include <vector>\n#include <assert.h>\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Equivalence function.\n template<typename Key, class Cmp_Fn>\n struct eq_by_less : private Cmp_Fn\n {\n bool\n operator()(const Key& r_lhs, const Key& r_rhs) const\n {\n\tconst bool l = Cmp_Fn::operator()(r_lhs, r_rhs);\n\tconst bool g = Cmp_Fn::operator()(r_rhs, r_lhs);\n\treturn !(l || g);\n }\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_EQ_BY_LESS_HPP\n","include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_eq_fn.hpp\n * Contains 2 equivalence functions, one employing a hash value,\n * and one ignoring it.\n */\n\n#ifndef PB_DS_HASH_EQ_FN_HPP\n#define PB_DS_HASH_EQ_FN_HPP\n\n#include <utility>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Primary template.\n template<typename Key, typename Eq_Fn, typename _Alloc, bool Store_Hash>\n struct hash_eq_fn;\n\n /// Specialization 1 - The client requests that hash values not be stored.\n template<typename Key, typename Eq_Fn, typename _Alloc>\n struct hash_eq_fn<Key, Eq_Fn, _Alloc, false> : public Eq_Fn\n {\n typedef Eq_Fn \t\t\t\t\t eq_fn_base;\n typedef typename rebind_traits<_Alloc, Key>::const_reference\n\tkey_const_reference;\n\n hash_eq_fn() { }\n\n hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }\n\n bool\n operator()(key_const_reference r_lhs_key, \n\t\t key_const_reference r_rhs_key) const\n { return eq_fn_base::operator()(r_lhs_key, r_rhs_key); }\n\n void\n swap(const hash_eq_fn& other)\n { std::swap((Eq_Fn&)(*this), (Eq_Fn&)other); }\n };\n\n\n /// Specialization 2 - The client requests that hash values be stored.\n template<typename Key, class Eq_Fn, class _Alloc>\n struct hash_eq_fn<Key, Eq_Fn, _Alloc, true> : public Eq_Fn\n {\n typedef typename _Alloc::size_type \t\t size_type;\n typedef Eq_Fn \t\t\t\t\t eq_fn_base;\n typedef typename rebind_traits<_Alloc, Key>::const_reference\n\tkey_const_reference;\n\n hash_eq_fn() { }\n\n hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }\n\n bool\n operator()(key_const_reference r_lhs_key, size_type lhs_hash, \n\t\t key_const_reference r_rhs_key, size_type rhs_hash) const\n {\n\t_GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key) \n\t\t\t || lhs_hash == rhs_hash);\n\n\treturn (lhs_hash == rhs_hash && \n\t\teq_fn_base::operator()(r_lhs_key, r_rhs_key));\n }\n\n void\n swap(const hash_eq_fn& other)\n { std::swap((Eq_Fn&)(*this), (Eq_Fn&)(other)); }\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/constructor_destructor_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s constructors, destructor,\n * and related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_allocator\nPB_DS_CLASS_C_DEC::s_entry_allocator;\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_GP_HASH_NAME() \n: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1)),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn) \n: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) \n: hash_eq_fn_base(r_eq_fn),\n ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, \n\t\t const Comb_Probe_Fn& r_comb_hash_fn) \n: hash_eq_fn_base(r_eq_fn),\n ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t r_hash_fn, r_comb_hash_fn),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, \n\t\t const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober) \n: hash_eq_fn_base(r_eq_fn),\n ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t r_hash_fn, comb_hash_fn, prober),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, \n\t\t const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober, \n\t\t const Resize_Policy& r_resize_policy) \n: hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy),\n ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t r_hash_fn, comb_hash_fn, prober),\n m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n m_entries(s_entry_allocator.allocate(m_num_e))\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_GP_HASH_NAME(const PB_DS_CLASS_C_DEC& other) :\n#ifdef _GLIBCXX_DEBUG\n debug_base(other),\n#endif \n hash_eq_fn_base(other),\n resize_base(other),\n ranged_probe_fn_base(other),\n m_num_e(other.m_num_e),\n m_num_used_e(other.m_num_used_e),\n m_entries(s_entry_allocator.allocate(m_num_e))\n{\n for (size_type i = 0; i < m_num_e; ++i)\n m_entries[i].m_stat = (entry_status)empty_entry_status;\n\n __try\n {\n for (size_type i = 0; i < m_num_e; ++i)\n {\n\t m_entries[i].m_stat = other.m_entries[i].m_stat;\n\t if (m_entries[i].m_stat == valid_entry_status)\n\t new (m_entries + i) entry(other.m_entries[i]);\n }\n }\n __catch(...)\n {\n deallocate_all();\n __throw_exception_again;\n }\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_GP_HASH_NAME()\n{ deallocate_all(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n std::swap(m_num_e, other.m_num_e);\n std::swap(m_num_used_e, other.m_num_used_e);\n std::swap(m_entries, other.m_entries);\n ranged_probe_fn_base::swap(other);\n hash_eq_fn_base::swap(other);\n resize_base::swap(other);\n _GLIBCXX_DEBUG_ONLY(debug_base::swap(other));\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndeallocate_all()\n{\n clear();\n erase_all_valid_entries(m_entries, m_num_e);\n s_entry_allocator.deallocate(m_entries, m_num_e);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_all_valid_entries(entry_array a_entries_resized, size_type len)\n{\n for (size_type pos = 0; pos < len; ++pos)\n {\n entry_pointer p_e = &a_entries_resized[pos];\n if (p_e->m_stat == valid_entry_status)\n\tp_e->m_value.~value_type();\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{\n Resize_Policy::notify_resized(m_num_e);\n Resize_Policy::notify_cleared();\n ranged_probe_fn_base::notify_resized(m_num_e);\n for (size_type i = 0; i < m_num_e; ++i)\n m_entries[i].m_stat = empty_entry_status;\n}\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s constructors, destructor,\n * and related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nconstructor_insert_new_imp(mapped_const_reference r_val, size_type pos, \n\t\t\t false_type)\n{\n _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status)k;\n entry* const p_e = m_entries + pos;\n new (&p_e->m_value) mapped_value_type(r_val);\n p_e->m_stat = valid_entry_status;\n _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);)\n}\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s constructors, destructor,\n * and related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nconstructor_insert_new_imp(mapped_const_reference r_val, size_type pos, \n\t\t\t true_type)\n{\n _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);\n entry* const p_e = m_entries + pos;\n new (&p_e->m_value) mapped_value_type(r_val);\n p_e->m_hash = ranged_probe_fn_base::operator()(PB_DS_V2F(r_val)).second;\n p_e->m_stat = valid_entry_status;\n _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);)\n}\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/debug_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s debug-mode functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n debug_base::check_size(m_num_used_e, __file, __line);\n assert_entry_array_valid(m_entries, traits_base::m_store_extra_indicator,\n\t\t\t __file, __line);\n}\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp>\n\n#endif \n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s debug-mode functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_array_valid(const entry_array a_entries, false_type,\n\t\t\t const char* __file, int __line) const\n{\n size_type iterated_num_used_e = 0;\n for (size_type pos = 0; pos < m_num_e; ++pos)\n {\n const_entry_pointer p_e = &a_entries[pos];\n switch(p_e->m_stat)\n {\n case empty_entry_status:\n case erased_entry_status:\n\t break;\n case valid_entry_status:\n\t {\n\t key_const_reference r_key = PB_DS_V2F(p_e->m_value);\n\t debug_base::check_key_exists(r_key, __file, __line);\n\t ++iterated_num_used_e;\n\t break;\n\t }\n default:\n\t PB_DS_DEBUG_VERIFY(0);\n };\n }\n PB_DS_DEBUG_VERIFY(iterated_num_used_e == m_num_used_e);\n}\n\n#endif \n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/debug_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s debug-mode functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_array_valid(const entry_array a_entries, true_type,\n\t\t\t const char* __file, int __line) const\n{\n size_type iterated_num_used_e = 0;\n\n for (size_type pos = 0; pos < m_num_e; ++pos)\n {\n const_entry_pointer p_e =& a_entries[pos];\n switch(p_e->m_stat)\n {\n case empty_entry_status:\n case erased_entry_status:\n\t break;\n case valid_entry_status:\n\t {\n\t key_const_reference r_key = PB_DS_V2F(p_e->m_value);\n\t debug_base::check_key_exists(r_key, __file, __line);\n\n\t const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);\n\n\t PB_DS_DEBUG_VERIFY(p_e->m_hash == pos_hash_pair.second);\n\t ++iterated_num_used_e;\n\t break;\n\t }\n default:\n\t PB_DS_DEBUG_VERIFY(0);\n };\n }\n\n PB_DS_DEBUG_VERIFY(iterated_num_used_e == m_num_used_e);\n}\n\n#endif \n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/erase_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s erase related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nerase_entry(entry_pointer p_e)\n{\n _GLIBCXX_DEBUG_ASSERT(p_e->m_stat = valid_entry_status);\n _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_e->m_value));)\n p_e->m_value.~value_type();\n p_e->m_stat = erased_entry_status;\n _GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);\n resize_base::notify_erased(--m_num_used_e);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n for (size_type pos = 0; pos < m_num_e; ++pos)\n {\n entry_pointer p_e = &m_entries[pos];\n if (p_e->m_stat == valid_entry_status)\n\terase_entry(p_e);\n }\n do_resize_if_needed_no_throw();\n resize_base::notify_cleared();\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n PB_DS_ASSERT_VALID((*this))\n size_type num_ersd = 0;\n for (size_type pos = 0; pos < m_num_e; ++pos)\n {\n entry_pointer p_e = &m_entries[pos];\n if (p_e->m_stat == valid_entry_status)\n\tif (pred(p_e->m_value))\n\t {\n\t ++num_ersd;\n\t erase_entry(p_e);\n\t }\n }\n\n do_resize_if_needed_no_throw();\n PB_DS_ASSERT_VALID((*this))\n return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(key_const_reference r_key)\n{ return erase_imp(r_key, traits_base::m_store_extra_indicator); }\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp>\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s erase related functions,\n * when the hash value is not stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase_imp(key_const_reference r_key, false_type)\n{\n PB_DS_ASSERT_VALID((*this))\n size_type hash = ranged_probe_fn_base::operator()(r_key);\n size_type i;\n resize_base::notify_erase_search_start();\n\n for (i = 0; i < m_num_e; ++i)\n {\n const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);\n entry* const p_e = m_entries + pos;\n switch(p_e->m_stat)\n {\n case empty_entry_status:\n\t {\n\t resize_base::notify_erase_search_end();\n\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\t return false;\n\t }\n\t break;\n case valid_entry_status:\n\t if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))\n {\n\t resize_base::notify_erase_search_end();\n\t erase_entry(p_e);\n\t do_resize_if_needed_no_throw();\n\t return true;\n }\n\t break;\n case erased_entry_status:\n\t break;\n default:\n\t _GLIBCXX_DEBUG_ASSERT(0);\n };\n resize_base::notify_erase_search_collision();\n }\n resize_base::notify_erase_search_end();\n return false;\n}\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/erase_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s erase related functions,\n * when the hash value is stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase_imp(key_const_reference r_key, true_type)\n{\n const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);\n size_type i;\n resize_base::notify_erase_search_start();\n for (i = 0; i < m_num_e; ++i)\n {\n const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i);\n\n entry* const p_e = m_entries + pos;\n switch(p_e->m_stat)\n {\n case empty_entry_status:\n\t {\n\t resize_base::notify_erase_search_end();\n\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\t return false;\n\t }\n\t break;\n case valid_entry_status:\n\t if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,\n\t\t\t\t\t r_key, pos_hash_pair.second))\n {\n\t resize_base::notify_erase_search_end();\n\t erase_entry(p_e);\n\t do_resize_if_needed_no_throw();\n\t return true;\n }\n\t break;\n case erased_entry_status:\n\t break;\n default:\n\t _GLIBCXX_DEBUG_ASSERT(0);\n };\n\n resize_base::notify_erase_search_collision();\n }\n resize_base::notify_erase_search_end();\n return false;\n}\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/find_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s find related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key)\n{\n PB_DS_ASSERT_VALID((*this))\n return find_key_pointer(r_key, traits_base::m_store_extra_indicator);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key) const\n{\n PB_DS_ASSERT_VALID((*this))\n return const_cast<PB_DS_CLASS_C_DEC&>(*this).find_key_pointer(r_key, traits_base::m_store_extra_indicator);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind_end()\n{ return 0; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nfind_end() const\n{ return 0; }\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/find_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s find related functions,\n * when the hash value is not stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::pointer\nPB_DS_CLASS_C_DEC::\nfind_key_pointer(key_const_reference r_key, false_type)\n\n","include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/find_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s insert related functions,\n * when the hash value is stored.\n */\n","include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/gp_ht_map_.hpp\n * Contains an implementation class for general probing hash.\n */\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>\n#include <utility>\n#ifdef PB_DS_HT_MAP_TRACE_\n#include <iostream>\n#endif\n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/debug_map_base.hpp>\n#endif\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_GP_HASH_NAME gp_ht_map\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_GP_HASH_NAME gp_ht_set\n#endif\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \\\n\t typename _Alloc, bool Store_Hash, typename Comb_Probe_Fn, \\\n\t typename Probe_Fn,\ttypename Resize_Policy>\n\n#define PB_DS_CLASS_C_DEC \\\n PB_DS_GP_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, \\\n\t\t Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>\n\n#define PB_DS_HASH_EQ_FN_C_DEC \\\n hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash>\n\n#define PB_DS_RANGED_PROBE_FN_C_DEC \\\n ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, Store_Hash>\n\n#define PB_DS_GP_HASH_TRAITS_BASE \\\n types_traits<Key, Mapped, _Alloc, Store_Hash>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_DEBUG_MAP_BASE_C_DEC \\\n debug_map_base<Key, Eq_Fn, \\\n\t\t typename rebind_traits<_Alloc, Key>::const_reference>\n#endif\n\n\n /**\n * A general-probing hash-based container.\n *\n *\n * @ingroup hash-detail\n *\n * @tparam Key \t \tKey type.\n *\n * @tparam Mapped \t \tMap type.\n *\n * @tparam Hash_Fn\t \tHashing functor.\n * Default is __gnu_cxx::hash.\n *\n * @tparam Eq_Fn\t \tEqual functor.\n * Default std::equal_to<Key>\n *\n * @tparam _Alloc \t \tAllocator type.\n *\n * @tparam Store_Hash \tIf key type stores extra metadata.\n * Defaults to false.\n *\n * @tparam Comb_Probe_Fn\tCombining probe functor.\n * If Hash_Fn is not null_type, then this\n * is the ranged-probe functor; otherwise,\n * this is the range-hashing functor.\n * XXX See Design::Hash-Based Containers::Hash Policies.\n * Default direct_mask_range_hashing.\n *\n * @tparam Probe_Fn \tProbe functor.\n * Defaults to linear_probe_fn,\n * also quadratic_probe_fn.\n *\n * @tparam Resize_Policy \tResizes hash.\n * Defaults to hash_standard_resize_policy,\n * using hash_exponential_size_policy and\n * hash_load_check_resize_trigger.\n *\n *\n * Bases are: detail::hash_eq_fn, Resize_Policy, detail::ranged_probe_fn,\n * detail::types_traits. (Optional: detail::debug_map_base.)\n */\n template<typename Key,\n\t typename Mapped,\n\t typename Hash_Fn,\n\t typename Eq_Fn,\n\t typename _Alloc,\n\t bool Store_Hash,\n\t typename Comb_Probe_Fn,\n\t typename Probe_Fn,\n\t typename Resize_Policy>\n class PB_DS_GP_HASH_NAME :\n#ifdef _GLIBCXX_DEBUG\n protected PB_DS_DEBUG_MAP_BASE_C_DEC,\n#endif\n public PB_DS_HASH_EQ_FN_C_DEC,\n public Resize_Policy,\n public PB_DS_RANGED_PROBE_FN_C_DEC,\n public PB_DS_GP_HASH_TRAITS_BASE\n {\n private:\n typedef PB_DS_GP_HASH_TRAITS_BASE\t \ttraits_base;\n typedef typename traits_base::value_type \tvalue_type_;\n typedef typename traits_base::pointer \tpointer_;\n typedef typename traits_base::const_pointer const_pointer_;\n typedef typename traits_base::reference \treference_;\n typedef typename traits_base::const_reference const_reference_;\n typedef typename traits_base::comp_hash\tcomp_hash;\n\n enum entry_status\n\t{\n\t empty_entry_status,\n\t valid_entry_status,\n\t erased_entry_status\n\t} __attribute__ ((__packed__));\n\n struct entry : public traits_base::stored_data_type\n {\n\tentry_status m_stat;\n };\n\n typedef rebind_traits<_Alloc, entry> entry_traits;\n typedef typename entry_traits::allocator_type entry_allocator;\n typedef typename entry_traits::pointer entry_pointer;\n typedef typename entry_traits::const_pointer const_entry_pointer;\n typedef typename entry_traits::reference entry_reference;\n typedef typename entry_traits::const_reference const_entry_reference;\n typedef typename entry_traits::pointer entry_array;\n\n typedef PB_DS_RANGED_PROBE_FN_C_DEC \tranged_probe_fn_base;\n\n#ifdef _GLIBCXX_DEBUG\n typedef PB_DS_DEBUG_MAP_BASE_C_DEC \tdebug_base;\n#endif\n\n typedef PB_DS_HASH_EQ_FN_C_DEC \t\thash_eq_fn_base;\n typedef Resize_Policy \t\t\tresize_base;\n\n#define PB_DS_GEN_POS typename _Alloc::size_type\n\n#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>\n\n#undef PB_DS_GEN_POS\n\n public:\n typedef _Alloc \t\t\t\tallocator_type;\n typedef typename _Alloc::size_type \tsize_type;\n typedef typename _Alloc::difference_type \tdifference_type;\n typedef Hash_Fn \t\t\t\thash_fn;\n typedef Eq_Fn \t\t\t\teq_fn;\n typedef Probe_Fn \t\t\t\tprobe_fn;\n typedef Comb_Probe_Fn \t\t\tcomb_probe_fn;\n typedef Resize_Policy \t\t\tresize_policy;\n\n /// Value stores hash, true or false.\n enum\n\t{\n\t store_hash = Store_Hash\n\t};\n\n typedef typename traits_base::key_type \tkey_type;\n typedef typename traits_base::key_pointer key_pointer;\n typedef typename traits_base::key_const_pointer key_const_pointer;\n typedef typename traits_base::key_reference key_reference;\n typedef typename traits_base::key_const_reference key_const_reference;\n typedef typename traits_base::mapped_type mapped_type;\n typedef typename traits_base::mapped_pointer mapped_pointer;\n typedef typename traits_base::mapped_const_pointer mapped_const_pointer;\n typedef typename traits_base::mapped_reference mapped_reference;\n typedef typename traits_base::mapped_const_reference mapped_const_reference;\n typedef typename traits_base::value_type value_type;\n typedef typename traits_base::pointer pointer;\n typedef typename traits_base::const_pointer const_pointer;\n typedef typename traits_base::reference reference;\n typedef typename traits_base::const_reference const_reference;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n typedef point_iterator_ \t\t\tpoint_iterator;\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n typedef point_const_iterator_ \t\tpoint_iterator;\n#endif\n\n typedef point_const_iterator_ \t\tpoint_const_iterator;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n typedef iterator_ \t\t\titerator;\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n typedef const_iterator_ \t\t\titerator;\n#endif\n\n typedef const_iterator_ \t\t\tconst_iterator;\n\n PB_DS_GP_HASH_NAME();\n\n PB_DS_GP_HASH_NAME(const PB_DS_CLASS_C_DEC&);\n\n PB_DS_GP_HASH_NAME(const Hash_Fn&);\n\n PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&);\n\n PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);\n\n PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,\n\t\t\t const Probe_Fn&);\n\n PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,\n\t\t\t const Probe_Fn&, const Resize_Policy&);\n\n template<typename It>\n void\n copy_from_range(It, It);\n\n virtual\n ~PB_DS_GP_HASH_NAME();\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n inline size_type\n size() const;\n\n inline size_type\n max_size() const;\n\n /// True if size() == 0.\n _GLIBCXX_NODISCARD inline bool\n empty() const;\n\n /// Return current hash_fn.\n Hash_Fn&\n get_hash_fn();\n\n /// Return current const hash_fn.\n const Hash_Fn&\n get_hash_fn() const;\n\n /// Return current eq_fn.\n Eq_Fn&\n get_eq_fn();\n\n /// Return current const eq_fn.\n const Eq_Fn&\n get_eq_fn() const;\n\n /// Return current probe_fn.\n Probe_Fn&\n get_probe_fn();\n\n /// Return current const probe_fn.\n const Probe_Fn&\n get_probe_fn() const;\n\n /// Return current comb_probe_fn.\n Comb_Probe_Fn&\n get_comb_probe_fn();\n\n /// Return current const comb_probe_fn.\n const Comb_Probe_Fn&\n get_comb_probe_fn() const;\n\n /// Return current resize_policy.\n Resize_Policy&\n get_resize_policy();\n\n /// Return current const resize_policy.\n const Resize_Policy&\n get_resize_policy() const;\n\n inline std::pair<point_iterator, bool>\n insert(const_reference r_val)\n {\n _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid(__FILE__, __LINE__);)\n\treturn insert_imp(r_val, traits_base::m_store_extra_indicator);\n }\n\n inline mapped_reference\n operator[](key_const_reference r_key)\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\treturn subscript_imp(r_key, traits_base::m_store_extra_indicator);\n#else\n\tinsert(r_key);\n\treturn traits_base::s_null_type;\n#endif\n }\n\n inline point_iterator\n find(key_const_reference);\n\n inline point_const_iterator\n find(key_const_reference) const;\n\n inline point_iterator\n find_end();\n\n inline point_const_iterator\n find_end() const;\n\n inline bool\n erase(key_const_reference);\n\n template<typename Pred>\n inline size_type\n erase_if(Pred);\n\n void\n clear();\n\n inline iterator\n begin();\n\n inline const_iterator\n begin() const;\n\n inline iterator\n end();\n \n inline const_iterator\n end() const;\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n#endif\n\n#ifdef PB_DS_HT_MAP_TRACE_\n void\n trace() const;\n#endif\n\n private:\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n friend class iterator_;\n#endif\n\n friend class const_iterator_;\n\n void\n deallocate_all();\n\n void\n initialize();\n\n void\n erase_all_valid_entries(entry_array, size_type);\n\n inline bool\n do_resize_if_needed();\n\n inline void\n do_resize_if_needed_no_throw();\n\n void\n resize_imp(size_type);\n\n virtual void\n do_resize(size_type);\n\n void\n resize_imp(entry_array, size_type);\n\n inline void\n resize_imp_reassign(entry_pointer, entry_array, false_type);\n\n inline void\n resize_imp_reassign(entry_pointer, entry_array, true_type);\n\n inline size_type\n find_ins_pos(key_const_reference, false_type);\n\n inline comp_hash\n find_ins_pos(key_const_reference, true_type);\n\n inline std::pair<point_iterator, bool>\n insert_imp(const_reference, false_type);\n\n inline std::pair<point_iterator, bool>\n insert_imp(const_reference, true_type);\n\n inline pointer\n insert_new_imp(const_reference r_val, size_type pos)\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);\n\n\tif (do_resize_if_needed())\n\t pos = find_ins_pos(PB_DS_V2F(r_val),\n\t\t\t traits_base::m_store_extra_indicator);\n\n\t_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);\n\tentry* const p_e = m_entries + pos;\n\tnew (&p_e->m_value) value_type(r_val);\n\tp_e->m_stat = valid_entry_status;\n\tresize_base::notify_inserted(++m_num_used_e);\n\n\t_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\treturn &p_e->m_value;\n }\n\n inline pointer\n insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=\n\t\t\t valid_entry_status);\n\n\tif (do_resize_if_needed())\n\t r_pos_hash_pair = find_ins_pos(PB_DS_V2F(r_val),\n\t\t\t\t\t traits_base::m_store_extra_indicator);\n\n\t_GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=\n\t\t\t valid_entry_status);\n\n\tentry* const p_e = m_entries + r_pos_hash_pair.first;\n\tnew (&p_e->m_value) value_type(r_val);\n\tp_e->m_hash = r_pos_hash_pair.second;\n\tp_e->m_stat = valid_entry_status;\n\n\tresize_base::notify_inserted(++m_num_used_e);\n\n\t_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\treturn &p_e->m_value;\n }\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n inline mapped_reference\n subscript_imp(key_const_reference key, false_type)\n {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\n\tconst size_type pos = find_ins_pos(key,\n\t\t\t\t\t traits_base::m_store_extra_indicator);\n\n\tentry_pointer p_e = &m_entries[pos];\n\tif (p_e->m_stat != valid_entry_status)\n\t return insert_new_imp(value_type(key, mapped_type()), pos)->second;\n\n\tPB_DS_CHECK_KEY_EXISTS(key)\n\treturn p_e->m_value.second;\n }\n\n inline mapped_reference\n subscript_imp(key_const_reference key, true_type)\n {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\n\tcomp_hash pos_hash_pair = find_ins_pos(key,\n\t\t\t\t\t traits_base::m_store_extra_indicator);\n\n\tif (m_entries[pos_hash_pair.first].m_stat != valid_entry_status)\n\t return insert_new_imp(value_type(key, mapped_type()),\n\t\t\t\t pos_hash_pair)->second;\n\n\tPB_DS_CHECK_KEY_EXISTS(key)\n\treturn (m_entries + pos_hash_pair.first)->m_value.second;\n }\n#endif\n\n inline pointer\n find_key_pointer(key_const_reference key, false_type)\n {\n\tconst size_type hash = ranged_probe_fn_base::operator()(key);\n\tresize_base::notify_find_search_start();\n\n\t// Loop until entry is found or until all possible entries accessed.\n\tfor (size_type i = 0; i < m_num_e; ++i)\n\t {\n\t const size_type pos = ranged_probe_fn_base::operator()(key,\n\t\t\t\t\t\t\t\t hash, i);\n\n\t entry* const p_e = m_entries + pos;\n\t switch (p_e->m_stat)\n\t {\n\t case empty_entry_status:\n\t\t{\n\t\t resize_base::notify_find_search_end();\n\t\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(key)\n\t\t return 0;\n\t\t}\n\t\tbreak;\n\t case valid_entry_status:\n\t\tif (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key))\n\t\t {\n\t\t resize_base::notify_find_search_end();\n\t\t PB_DS_CHECK_KEY_EXISTS(key)\n\t\t return pointer(&p_e->m_value);\n\t\t }\n\t\tbreak;\n\t case erased_entry_status:\n\t\tbreak;\n\t default:\n\t\t_GLIBCXX_DEBUG_ASSERT(0);\n\t };\n\n\t resize_base::notify_find_search_collision();\n\t }\n\n\tPB_DS_CHECK_KEY_DOES_NOT_EXIST(key)\n\tresize_base::notify_find_search_end();\n\treturn 0;\n }\n\n inline pointer\n find_key_pointer(key_const_reference key, true_type)\n {\n\tcomp_hash pos_hash_pair = ranged_probe_fn_base::operator()(key);\n\tresize_base::notify_find_search_start();\n\n\t// Loop until entry is found or until all possible entries accessed.\n\tfor (size_type i = 0; i < m_num_e; ++i)\n\t {\n\t const size_type pos =\n\t ranged_probe_fn_base::operator()(key, pos_hash_pair.second, i);\n\n\t entry* const p_e = m_entries + pos;\n\n\t switch(p_e->m_stat)\n\t {\n\t case empty_entry_status:\n\t\t{\n\t\t resize_base::notify_find_search_end();\n\t\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(key)\n\t\t return 0;\n\t\t}\n\t\tbreak;\n\t case valid_entry_status:\n\t\tif (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),\n\t\t\t\t\t\tp_e->m_hash,\n\t\t\t\t\t\tkey, pos_hash_pair.second))\n\t\t {\n\t\t resize_base::notify_find_search_end();\n\t\t PB_DS_CHECK_KEY_EXISTS(key)\n\t\t return pointer(&p_e->m_value);\n\t\t }\n\t\tbreak;\n\t case erased_entry_status:\n\t\tbreak;\n\t default:\n\t\t_GLIBCXX_DEBUG_ASSERT(0);\n\t };\n\n\t resize_base::notify_find_search_collision();\n\t }\n\n\tPB_DS_CHECK_KEY_DOES_NOT_EXIST(key)\n\tresize_base::notify_find_search_end();\n\treturn 0;\n }\n\n inline bool\n erase_imp(key_const_reference, true_type);\n\n inline bool\n erase_imp(key_const_reference, false_type);\n\n inline void\n erase_entry(entry_pointer);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n void\n inc_it_state(pointer& r_p_value, size_type& r_pos) const\n { inc_it_state((mapped_const_pointer& )r_p_value, r_pos); }\n#endif\n\n void\n inc_it_state(const_pointer& r_p_value, size_type& r_pos) const\n {\n\t_GLIBCXX_DEBUG_ASSERT(r_p_value != 0);\n\tfor (++r_pos; r_pos < m_num_e; ++r_pos)\n\t {\n\t const_entry_pointer p_e =& m_entries[r_pos];\n\t if (p_e->m_stat == valid_entry_status)\n\t {\n\t\tr_p_value =& p_e->m_value;\n\t\treturn;\n\t }\n\t }\n\tr_p_value = 0;\n }\n\n void\n get_start_it_state(const_pointer& r_p_value, size_type& r_pos) const\n {\n\tfor (r_pos = 0; r_pos < m_num_e; ++r_pos)\n\t {\n\t const_entry_pointer p_e = &m_entries[r_pos];\n\t if (p_e->m_stat == valid_entry_status)\n\t {\n\t\tr_p_value = &p_e->m_value;\n\t\treturn;\n\t }\n\t }\n\tr_p_value = 0;\n }\n\n void\n get_start_it_state(pointer& r_p_value, size_type& r_pos)\n {\n\tfor (r_pos = 0; r_pos < m_num_e; ++r_pos)\n\t {\n\t entry_pointer p_e = &m_entries[r_pos];\n\t if (p_e->m_stat == valid_entry_status)\n\t {\n\t\tr_p_value = &p_e->m_value;\n\t\treturn;\n\t }\n\t }\n\tr_p_value = 0;\n }\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_entry_array_valid(const entry_array, false_type,\n\t\t\t const char*, int) const;\n\n void\n assert_entry_array_valid(const entry_array, true_type,\n\t\t\t const char*, int) const;\n#endif\n\n static entry_allocator \ts_entry_allocator;\n static iterator \t\ts_end_it;\n static const_iterator \ts_const_end_it;\n\n size_type \t\tm_num_e;\n size_type \t\tm_num_used_e;\n entry_pointer \t\tm_entries;\n\n enum\n\t{\n\t store_hash_ok = !Store_Hash\n\t\t\t || !is_same<Hash_Fn, __gnu_pbds::null_type>::value\n\t};\n\n PB_DS_STATIC_ASSERT(sth, store_hash_ok);\n };\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_HASH_EQ_FN_C_DEC\n#undef PB_DS_RANGED_PROBE_FN_C_DEC\n#undef PB_DS_GP_HASH_TRAITS_BASE\n#undef PB_DS_DEBUG_MAP_BASE_C_DEC\n#undef PB_DS_GP_HASH_NAME\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/info_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s entire container info related\n * functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return m_num_used_e; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_entry_allocator.max_size(); }\n\nPB_DS_CLASS_T_DEC\n_GLIBCXX_NODISCARD\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (size() == 0); }\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/insert_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s insert related functions.\n */\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp>\n\n","include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s insert related functions,\n * when the hash value is not stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nfind_ins_pos(key_const_reference r_key, false_type)\n{\n size_type hash = ranged_probe_fn_base::operator()(r_key);\n size_type i;\n\n /* The insertion position is initted to a non-legal value to indicate\n * that it has not been initted yet.\n */\n size_type ins_pos = m_num_e;\n resize_base::notify_insert_search_start();\n for (i = 0; i < m_num_e; ++i)\n {\n const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);\n _GLIBCXX_DEBUG_ASSERT(pos < m_num_e);\n entry* const p_e = m_entries + pos;\n switch(p_e->m_stat)\n {\n case empty_entry_status:\n\t {\n resize_base::notify_insert_search_end();\n\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\t return (ins_pos == m_num_e) ? pos : ins_pos;\n\t }\n\t break;\n case erased_entry_status:\n\t if (ins_pos == m_num_e)\n\t ins_pos = pos;\n\t break;\n case valid_entry_status:\n\t if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))\n {\n\t resize_base::notify_insert_search_end();\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n return pos;\n }\n\t break;\n default:\n\t _GLIBCXX_DEBUG_ASSERT(0);\n };\n\n resize_base::notify_insert_search_collision();\n }\n resize_base::notify_insert_search_end();\n if (ins_pos == m_num_e)\n __throw_insert_error();\n return ins_pos;\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_imp(const_reference r_val, false_type)\n{\n key_const_reference r_key = PB_DS_V2F(r_val);\n const size_type pos = find_ins_pos(r_key, \n\t\t\t\t traits_base::m_store_extra_indicator);\n\n if (m_entries[pos].m_stat == valid_entry_status)\n {\n PB_DS_CHECK_KEY_EXISTS(r_key)\n return std::make_pair(&(m_entries + pos)->m_value, false);\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return std::make_pair(insert_new_imp(r_val, pos), true);\n}\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/insert_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s find related functions,\n * when the hash value is stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::comp_hash\nPB_DS_CLASS_C_DEC::\nfind_ins_pos(key_const_reference r_key, true_type)\n{\n PB_DS_ASSERT_VALID((*this))\n comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);\n\n size_type i;\n\n /* The insertion position is initted to a non-legal value to indicate\n * that it has not been initted yet.\n */\n size_type ins_pos = m_num_e;\n resize_base::notify_insert_search_start();\n for (i = 0; i < m_num_e; ++i)\n {\n const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i);\n\n entry* const p_e = m_entries + pos;\n switch(p_e->m_stat)\n {\n case empty_entry_status:\n\t {\n resize_base::notify_insert_search_end();\n\t PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\n\t return ((ins_pos == m_num_e) ?\n\t\t std::make_pair(pos, pos_hash_pair.second) :\n\t\t std::make_pair(ins_pos, pos_hash_pair.second));\n\t }\n\t break;\n case erased_entry_status:\n\t if (ins_pos == m_num_e)\n\t ins_pos = pos;\n\t break;\n case valid_entry_status:\n\t if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,\n\t\t\t\t\t r_key, pos_hash_pair.second))\n {\n\t resize_base::notify_insert_search_end();\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n return std::make_pair(pos, pos_hash_pair.second);\n }\n\t break;\n default:\n\t _GLIBCXX_DEBUG_ASSERT(0);\n };\n resize_base::notify_insert_search_collision();\n }\n resize_base::notify_insert_search_end();\n if (ins_pos == m_num_e)\n __throw_insert_error();\n return std::make_pair(ins_pos, pos_hash_pair.second);\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_imp(const_reference r_val, true_type)\n{\n key_const_reference r_key = PB_DS_V2F(r_val);\n comp_hash pos_hash_pair = find_ins_pos(r_key, \n\t\t\t\t\t traits_base::m_store_extra_indicator);\n\n _GLIBCXX_DEBUG_ASSERT(pos_hash_pair.first < m_num_e);\n entry_pointer p_e =& m_entries[pos_hash_pair.first];\n if (p_e->m_stat == valid_entry_status)\n {\n PB_DS_CHECK_KEY_EXISTS(r_key)\n return std::make_pair(&p_e->m_value, false);\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);\n}\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/iterator_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s iterators related functions, e.g.,\n * begin().\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::s_end_it;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::s_const_end_it;\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n pointer_ p_value;\n size_type pos;\n get_start_it_state(p_value, pos);\n return iterator(p_value, pos, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{ return s_end_it; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n const_pointer_ p_value;\n size_type pos;\n get_start_it_state(p_value, pos);\n return const_iterator(p_value, pos, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{ return s_const_end_it; }\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/policy_access_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s policy agpess\n * functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nHash_Fn& \nPB_DS_CLASS_C_DEC::\nget_hash_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Hash_Fn& \nPB_DS_CLASS_C_DEC::\nget_hash_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nEq_Fn& \nPB_DS_CLASS_C_DEC::\nget_eq_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Eq_Fn& \nPB_DS_CLASS_C_DEC::\nget_eq_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nProbe_Fn& \nPB_DS_CLASS_C_DEC::\nget_probe_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Probe_Fn& \nPB_DS_CLASS_C_DEC::\nget_probe_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nComb_Probe_Fn& \nPB_DS_CLASS_C_DEC::\nget_comb_probe_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Comb_Probe_Fn& \nPB_DS_CLASS_C_DEC::\nget_comb_probe_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nResize_Policy& \nPB_DS_CLASS_C_DEC::\nget_resize_policy()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Resize_Policy& \nPB_DS_CLASS_C_DEC::\nget_resize_policy() const\n{ return *this; }\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/resize_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s resize related functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\ndo_resize_if_needed()\n{\n if (!resize_base::is_resize_needed())\n return false;\n resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));\n return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndo_resize(size_type n)\n{ resize_imp(resize_base::get_nearest_larger_size(n)); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ndo_resize_if_needed_no_throw()\n{\n if (!resize_base::is_resize_needed())\n return;\n\n __try\n {\n resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));\n }\n __catch(...)\n { }\n\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize_imp(size_type new_size)\n{\n#ifdef PB_DS_REGRESSION\n typename _Alloc::group_adjustor adjust(m_num_e);\n#endif \n\n if (new_size == m_num_e)\n return;\n\n PB_DS_ASSERT_VALID((*this))\n const size_type old_size = m_num_e;\n entry_array a_entries_resized = 0;\n\n // Following line might throw an exception.\n a_entries_resized = s_entry_allocator.allocate(new_size);\n\n ranged_probe_fn_base::notify_resized(new_size);\n m_num_e = new_size;\n\n for (size_type i = 0; i < m_num_e; ++i)\n a_entries_resized[i].m_stat = empty_entry_status;\n\n __try\n {\n resize_imp(a_entries_resized, old_size);\n }\n __catch(...)\n {\n erase_all_valid_entries(a_entries_resized, new_size);\n m_num_e = old_size;\n s_entry_allocator.deallocate(a_entries_resized, new_size);\n ranged_probe_fn_base::notify_resized(old_size);\n __throw_exception_again;\n }\n\n // At this point no exceptions can be thrown.\n _GLIBCXX_DEBUG_ONLY(assert_entry_array_valid(a_entries_resized,\n\t\t\t\t\t traits_base::m_store_extra_indicator,\n\t\t\t\t\t __FILE__, __LINE__);)\n\n Resize_Policy::notify_resized(new_size);\n erase_all_valid_entries(m_entries, old_size);\n s_entry_allocator.deallocate(m_entries, old_size);\n m_entries = a_entries_resized;\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize_imp(entry_array a_entries_resized, size_type old_size)\n{\n for (size_type pos = 0; pos < old_size; ++pos)\n if (m_entries[pos].m_stat == valid_entry_status)\n resize_imp_reassign(m_entries + pos, a_entries_resized, \n\t\t\t traits_base::m_store_extra_indicator);\n}\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp>\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s resize related functions, when the\n * hash value is not stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nresize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized, \n\t\t false_type)\n{\n key_const_reference r_key = PB_DS_V2F(p_e->m_value);\n size_type hash = ranged_probe_fn_base::operator()(r_key);\n size_type i;\n for (i = 0; i < m_num_e; ++i)\n {\n const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);\n entry_pointer p_new_e = a_entries_resized + pos;\n switch(p_new_e->m_stat)\n {\n case empty_entry_status:\n\t new (&p_new_e->m_value) value_type(p_e->m_value);\n\t p_new_e->m_stat = valid_entry_status;\n\t return;\n case erased_entry_status:\n\t _GLIBCXX_DEBUG_ASSERT(0);\n\t break;\n case valid_entry_status:\n\t break;\n default:\n\t _GLIBCXX_DEBUG_ASSERT(0);\n };\n }\n __throw_insert_error();\n}\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/resize_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s resize related functions, when the\n * hash value is stored.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nresize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized, \n\t\t true_type)\n{\n key_const_reference r_key = PB_DS_V2F(p_e->m_value);\n size_type hash = ranged_probe_fn_base::operator()(r_key, p_e->m_hash);\n\n size_type i;\n for (i = 0; i < m_num_e; ++i)\n {\n const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);\n entry_pointer p_new_e = a_entries_resized + pos;\n switch(p_new_e->m_stat)\n {\n case empty_entry_status:\n\t new (&p_new_e->m_value) value_type(p_e->m_value);\n\t p_new_e->m_hash = hash;\n\t p_new_e->m_stat = valid_entry_status;\n\t return;\n case erased_entry_status:\n\t _GLIBCXX_DEBUG_ASSERT(0);\n\t break;\n case valid_entry_status:\n\t break;\n default:\n\t _GLIBCXX_DEBUG_ASSERT(0);\n };\n }\n __throw_insert_error();\n}\n\n#endif\n","include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_hash_table_map_/trace_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s trace-mode functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef PB_DS_HT_MAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n std::cerr << static_cast<unsigned long>(m_num_e) << \" \" <<\n static_cast<unsigned long>(m_num_used_e) << std::endl;\n\n for (size_type i = 0; i < m_num_e; ++i)\n {\n std::cerr << static_cast<unsigned long>(i) << \" \";\n\n switch(m_entries[i].m_stat)\n {\n\tcase empty_entry_status:\n\t std::cerr << \"<empty>\";\n\t break;\n\tcase erased_entry_status:\n\t std::cerr << \"<erased>\";\n\t break;\n\tcase valid_entry_status:\n\t std::cerr << PB_DS_V2F(m_entries[i].m_value);\n\t break;\n\tdefault:\n\t _GLIBCXX_DEBUG_ASSERT(0);\n\t};\n\n std::cerr << std::endl;\n }\n}\n\n#endif // #ifdef PB_DS_HT_MAP_TRACE_\n#endif\n","include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file direct_mask_range_hashing_imp.hpp\n * Contains a range-hashing policy implementation\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ mask_based_base::swap(other); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type size)\n{ mask_based_base::notify_resized(size); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\noperator()(size_type hash) const\n{ return mask_based_base::range_hash(hash); }\n\n#endif\n","include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file direct_mod_range_hashing_imp.hpp\n * Contains a range-hashing policy implementation\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ mod_based_base::swap(other); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type n)\n{ mod_based_base::notify_resized(n); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\noperator()(size_type hash) const\n{ return mod_based_base::range_hash(hash); }\n\n#endif\n","include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file linear_probe_fn_imp.hpp\n * Contains a probe policy implementation\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\noperator()(size_type i) const\n{\n return (i);\n}\n#endif\n","include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file mask_based_range_hashing.hpp\n * Contains a range hashing policy base.\n */\n\n#ifndef PB_DS_MASK_BASED_RANGE_HASHING_HPP\n#define PB_DS_MASK_BASED_RANGE_HASHING_HPP\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Range hashing policy.\n template<typename Size_Type>\n class mask_based_range_hashing\n {\n protected:\n typedef Size_Type \tsize_type;\n\n void\n swap(mask_based_range_hashing& other)\n { std::swap(m_mask, other.m_mask); }\n\n void\n notify_resized(size_type size);\n\n inline size_type\n range_hash(size_type hash) const\n { return size_type(hash & m_mask); }\n\n private:\n size_type \t\tm_mask;\n const static size_type \ts_num_bits_in_size_type;\n const static size_type \ts_highest_bit_1;\n };\n\n template<typename Size_Type>\n const typename mask_based_range_hashing<Size_Type>::size_type\n mask_based_range_hashing<Size_Type>::s_num_bits_in_size_type =\n sizeof(typename mask_based_range_hashing<Size_Type>::size_type) << 3;\n\n template<typename Size_Type>\n const typename mask_based_range_hashing<Size_Type>::size_type mask_based_range_hashing<Size_Type>::s_highest_bit_1 = static_cast<typename mask_based_range_hashing<Size_Type>::size_type>(1) << (s_num_bits_in_size_type - 1);\n\n \n template<typename Size_Type>\n void\n mask_based_range_hashing<Size_Type>::\n notify_resized(size_type size)\n {\n size_type i = 0;\n while (size ^ s_highest_bit_1)\n\t{\n\t size <<= 1;\n\t ++i;\n\t}\n\n m_mask = 1;\n i += 2;\n while (i++ < s_num_bits_in_size_type)\n m_mask = (m_mask << 1) ^ 1;\n }\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file mod_based_range_hashing.hpp\n * Contains a range hashing policy base.\n */\n\n#ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP\n#define PB_DS_MOD_BASED_RANGE_HASHING_HPP\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Mod based range hashing.\n template<typename Size_Type>\n class mod_based_range_hashing\n {\n protected:\n typedef Size_Type \tsize_type;\n\n void\n swap(mod_based_range_hashing& other)\n { std::swap(m_size, other.m_size); }\n\n void\n notify_resized(size_type s)\n { m_size = s; }\n\n inline size_type\n range_hash(size_type s) const\n { return s % m_size; }\n\n private:\n size_type m_size;\n };\n } // namespace detail\n\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP\n","include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file probe_fn_base.hpp\n * Contains a probe policy base.\n */\n\n#ifndef PB_DS_PROBE_FN_BASE_HPP\n#define PB_DS_PROBE_FN_BASE_HPP\n\n#include <functional>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Probe functor base.\n template<typename _Alloc>\n class probe_fn_base\n {\n protected:\n ~probe_fn_base() { }\n };\n} // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file quadratic_probe_fn_imp.hpp\n * Contains a probe policy implementation\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\noperator()(size_type i) const\n{\n return (i* i);\n}\n#endif\n","include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ranged_hash_fn.hpp\n * Contains a unified ranged hash functor, allowing the hash tables\n * to deal with a single class for ranged hashing.\n */\n\n#ifndef PB_DS_RANGED_HASH_FN_HPP\n#define PB_DS_RANGED_HASH_FN_HPP\n\n#include <utility>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Primary template.\n template<typename Key, typename Hash_Fn, typename _Alloc, \n\t typename Comb_Hash_Fn, bool Store_Hash>\n class ranged_hash_fn;\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Hash_Fn, typename _Alloc, \\\n\t typename Comb_Hash_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n ranged_hash_fn<Key,\tHash_Fn, _Alloc, Comb_Hash_Fn, false>\n\n /**\n * Specialization 1\n * The client supplies a hash function and a ranged hash function,\n * and requests that hash values not be stored.\n **/\n template<typename Key, typename Hash_Fn, typename _Alloc, \n\t typename Comb_Hash_Fn>\n class ranged_hash_fn< Key, Hash_Fn, _Alloc, Comb_Hash_Fn, false> \n : public Hash_Fn, public Comb_Hash_Fn\n {\n protected:\n typedef typename _Alloc::size_type size_type;\n typedef Hash_Fn hash_fn_base;\n typedef Comb_Hash_Fn comb_hash_fn_base;\n typedef typename rebind_traits<_Alloc, Key>::const_reference\n\tkey_const_reference;\n\n ranged_hash_fn(size_type);\n\n ranged_hash_fn(size_type, const Hash_Fn&);\n\n ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n void\n notify_resized(size_type);\n\n inline size_type\n operator()(key_const_reference) const;\n };\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size)\n { Comb_Hash_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) \n : Hash_Fn(r_hash_fn)\n { Comb_Hash_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t const Comb_Hash_Fn& r_comb_hash_fn) \n : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)\n { comb_hash_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n swap(PB_DS_CLASS_C_DEC& other)\n {\n comb_hash_fn_base::swap(other);\n std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n notify_resized(size_type size)\n { comb_hash_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::size_type\n PB_DS_CLASS_C_DEC::\n operator()(key_const_reference r_key) const\n { return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));}\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Hash_Fn, typename _Alloc, \\\n\t typename Comb_Hash_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n ranged_hash_fn<Key,Hash_Fn,\t_Alloc, Comb_Hash_Fn, true>\n\n /**\n * Specialization 2\n * The client supplies a hash function and a ranged hash function,\n * and requests that hash values be stored.\n **/\n template<typename Key, typename Hash_Fn, typename _Alloc,\n\t typename Comb_Hash_Fn>\n class ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, true> \n : public Hash_Fn, public Comb_Hash_Fn\n {\n protected:\n typedef typename _Alloc::size_type size_type;\n typedef std::pair<size_type, size_type> comp_hash;\n typedef Hash_Fn hash_fn_base;\n typedef Comb_Hash_Fn comb_hash_fn_base;\n typedef typename rebind_traits<_Alloc, Key>::const_reference\n\tkey_const_reference;\n\n ranged_hash_fn(size_type);\n\n ranged_hash_fn(size_type, const Hash_Fn&);\n\n ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n void\n notify_resized(size_type);\n\n inline comp_hash\n operator()(key_const_reference) const;\n\n inline comp_hash\n operator()(key_const_reference, size_type) const;\n };\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size)\n { Comb_Hash_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) :\n Hash_Fn(r_hash_fn)\n { Comb_Hash_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t const Comb_Hash_Fn& r_comb_hash_fn) \n : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)\n { comb_hash_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n swap(PB_DS_CLASS_C_DEC& other)\n {\n comb_hash_fn_base::swap(other);\n std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n notify_resized(size_type size)\n { comb_hash_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::comp_hash\n PB_DS_CLASS_C_DEC::\n operator()(key_const_reference r_key) const\n {\n const size_type hash = hash_fn_base::operator()(r_key);\n return std::make_pair(comb_hash_fn_base::operator()(hash), hash);\n }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::comp_hash\n PB_DS_CLASS_C_DEC::\n operator()\n#ifdef _GLIBCXX_DEBUG\n (key_const_reference r_key, size_type hash) const\n#else \n (key_const_reference /*r_key*/, size_type hash) const\n#endif\n {\n _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));\n return std::make_pair(comb_hash_fn_base::operator()(hash), hash);\n }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename _Alloc, typename Comb_Hash_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n ranged_hash_fn<Key,\tnull_type, _Alloc, Comb_Hash_Fn, false>\n\n /**\n * Specialization 3\n * The client does not supply a hash function (by specifying\n * null_type as the Hash_Fn parameter), and requests that hash\n * values not be stored.\n **/\n template<typename Key, typename _Alloc, typename Comb_Hash_Fn>\n class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, false> \n : public Comb_Hash_Fn\n {\n protected:\n typedef typename _Alloc::size_type size_type;\n typedef Comb_Hash_Fn comb_hash_fn_base;\n\n ranged_hash_fn(size_type);\n\n ranged_hash_fn(size_type, const Comb_Hash_Fn&);\n\n ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n };\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size)\n { Comb_Hash_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) :\n Comb_Hash_Fn(r_comb_hash_fn)\n { }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size, const null_type& r_null_type, \n\t\t const Comb_Hash_Fn& r_comb_hash_fn) \n : Comb_Hash_Fn(r_comb_hash_fn)\n { }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n swap(PB_DS_CLASS_C_DEC& other)\n { comb_hash_fn_base::swap(other); }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename _Alloc, typename Comb_Hash_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n ranged_hash_fn<Key,\tnull_type, _Alloc, Comb_Hash_Fn, true>\n\n /**\n * Specialization 4\n * The client does not supply a hash function (by specifying\n * null_type as the Hash_Fn parameter), and requests that hash\n * values be stored.\n **/\n template<typename Key, typename _Alloc, typename Comb_Hash_Fn>\n class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, true> \n : public Comb_Hash_Fn\n {\n protected:\n typedef typename _Alloc::size_type size_type;\n typedef Comb_Hash_Fn comb_hash_fn_base;\n\n ranged_hash_fn(size_type);\n\n ranged_hash_fn(size_type, const Comb_Hash_Fn&);\n\n ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n };\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size)\n { Comb_Hash_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) \n : Comb_Hash_Fn(r_comb_hash_fn)\n { }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_hash_fn(size_type size, const null_type& r_null_type, \n\t\t const Comb_Hash_Fn& r_comb_hash_fn) \n : Comb_Hash_Fn(r_comb_hash_fn)\n { }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n swap(PB_DS_CLASS_C_DEC& other)\n { comb_hash_fn_base::swap(other); }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ranged_probe_fn.hpp\n * Contains a unified ranged probe functor, allowing the probe tables to deal with\n * a single class for ranged probeing.\n */\n\n#ifndef PB_DS_RANGED_PROBE_FN_HPP\n#define PB_DS_RANGED_PROBE_FN_HPP\n\n#include <utility>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Primary template.\n template<typename Key, typename Hash_Fn, typename _Alloc,\n\t typename Comb_Probe_Fn, typename Probe_Fn, bool Store_Hash>\n class ranged_probe_fn;\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Hash_Fn, typename _Alloc, \\\n\t typename Comb_Probe_Fn, typename Probe_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, false>\n\n /**\n * Specialization 1 \n * The client supplies a probe function and a ranged probe\n * function, and requests that hash values not be stored.\n **/\n template<typename Key, typename Hash_Fn, typename _Alloc,\n\t typename Comb_Probe_Fn, typename Probe_Fn>\n class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn,\n\t\t\t Probe_Fn, false> \n : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn\n {\n protected:\n typedef typename _Alloc::size_type size_type;\n typedef Comb_Probe_Fn comb_probe_fn_base;\n typedef Hash_Fn hash_fn_base;\n typedef Probe_Fn probe_fn_base;\n typedef typename rebind_traits<_Alloc, Key>::const_reference\n\tkey_const_reference;\n\n ranged_probe_fn(size_type);\n\n ranged_probe_fn(size_type, const Hash_Fn&);\n\n ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&);\n\n ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&, \n\t\t const Probe_Fn&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n void\n notify_resized(size_type);\n\n inline size_type\n operator()(key_const_reference) const;\n\n inline size_type\n operator()(key_const_reference, size_type, size_type) const;\n };\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_probe_fn(size_type size)\n { Comb_Probe_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn) \n : Hash_Fn(r_hash_fn)\n { Comb_Probe_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t const Comb_Probe_Fn& r_comb_probe_fn) \n : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)\n { comb_probe_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t const Comb_Probe_Fn& r_comb_probe_fn, \n\t\t const Probe_Fn& r_probe_fn) \n : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)\n { comb_probe_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n swap(PB_DS_CLASS_C_DEC& other)\n {\n comb_probe_fn_base::swap(other);\n std::swap((Hash_Fn& )(*this), (Hash_Fn&)other);\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n notify_resized(size_type size)\n { comb_probe_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::size_type\n PB_DS_CLASS_C_DEC::\n operator()(key_const_reference r_key) const\n { return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::size_type\n PB_DS_CLASS_C_DEC::\n operator()(key_const_reference, size_type hash, size_type i) const\n {\n return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));\n }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Hash_Fn, typename _Alloc, \\\n\t typename Comb_Probe_Fn, typename Probe_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, true>\n\n /**\n * Specialization 2- The client supplies a probe function and a ranged\n * probe function, and requests that hash values not be stored.\n **/\n template<typename Key, typename Hash_Fn, typename _Alloc,\n\t typename Comb_Probe_Fn, typename Probe_Fn>\n class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, \n\t\t\t Probe_Fn, true> \n : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn\n {\n protected:\n typedef typename _Alloc::size_type size_type;\n typedef std::pair<size_type, size_type> comp_hash;\n typedef Comb_Probe_Fn comb_probe_fn_base;\n typedef Hash_Fn hash_fn_base;\n typedef Probe_Fn probe_fn_base;\n typedef typename rebind_traits<_Alloc, Key>::const_reference\n\tkey_const_reference;\n\n ranged_probe_fn(size_type);\n\n ranged_probe_fn(size_type, const Hash_Fn&);\n\n ranged_probe_fn(size_type, const Hash_Fn&, \n\t\t const Comb_Probe_Fn&);\n\n ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&, \n\t\t const Probe_Fn&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n void\n notify_resized(size_type);\n\n inline comp_hash\n operator()(key_const_reference) const;\n\n inline size_type\n operator()(key_const_reference, size_type, size_type) const;\n\n inline size_type\n operator()(key_const_reference, size_type) const;\n };\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_probe_fn(size_type size)\n { Comb_Probe_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn) \n : Hash_Fn(r_hash_fn)\n { Comb_Probe_Fn::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t const Comb_Probe_Fn& r_comb_probe_fn) \n : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)\n { comb_probe_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t const Comb_Probe_Fn& r_comb_probe_fn, \n\t\t const Probe_Fn& r_probe_fn) \n : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)\n { comb_probe_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n swap(PB_DS_CLASS_C_DEC& other)\n {\n comb_probe_fn_base::swap(other);\n std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n notify_resized(size_type size)\n { comb_probe_fn_base::notify_resized(size); }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::comp_hash\n PB_DS_CLASS_C_DEC::\n operator()(key_const_reference r_key) const\n {\n const size_type hash = hash_fn_base::operator()(r_key);\n return std::make_pair(comb_probe_fn_base::operator()(hash), hash);\n }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::size_type\n PB_DS_CLASS_C_DEC::\n operator()(key_const_reference, size_type hash, size_type i) const\n {\n return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));\n }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::size_type\n PB_DS_CLASS_C_DEC::\n operator()\n#ifdef _GLIBCXX_DEBUG\n (key_const_reference r_key, size_type hash) const\n#else \n (key_const_reference /*r_key*/, size_type hash) const\n#endif \n {\n _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));\n return hash;\n }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n /**\n * Specialization 3 and 4\n * The client does not supply a hash function or probe function,\n * and requests that hash values not be stored.\n **/\n template<typename Key, typename _Alloc, typename Comb_Probe_Fn>\n class ranged_probe_fn<Key, null_type, _Alloc, Comb_Probe_Fn, \n\t\t\t null_type, false> \n : public Comb_Probe_Fn\n {\n protected:\n typedef typename _Alloc::size_type size_type;\n typedef Comb_Probe_Fn comb_probe_fn_base;\n typedef typename rebind_traits<_Alloc, Key>::const_reference\n\tkey_const_reference;\n\n ranged_probe_fn(size_type size)\n { Comb_Probe_Fn::notify_resized(size); }\n\n ranged_probe_fn(size_type, const Comb_Probe_Fn& r_comb_probe_fn)\n : Comb_Probe_Fn(r_comb_probe_fn)\n { }\n\n ranged_probe_fn(size_type, const null_type&, \n\t\t const Comb_Probe_Fn& r_comb_probe_fn, \n\t\t const null_type&)\n : Comb_Probe_Fn(r_comb_probe_fn)\n { }\n\n void\n swap(ranged_probe_fn& other)\n { comb_probe_fn_base::swap(other); }\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n\n","include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_probe_fn.hpp\n * Contains a sample probe policy.\n */\n\n#ifndef PB_DS_SAMPLE_PROBE_FN_HPP\n#define PB_DS_SAMPLE_PROBE_FN_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample probe policy.\n class sample_probe_fn\n {\n public:\n typedef std::size_t size_type;\n\n /// Default constructor.\n sample_probe_fn();\n\n /// Copy constructor.\n sample_probe_fn(const sample_probe_fn&);\n\n /// Swaps content.\n inline void\n swap(sample_probe_fn&);\n\n protected:\n /// Returns the i-th offset from the hash value of some key r_key.\n inline size_type\n operator()(key_const_reference r_key, size_type i) const;\n };\n}\n#endif // #ifndef PB_DS_SAMPLE_PROBE_FN_HPP\n","include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_range_hashing.hpp\n * Contains a range hashing policy.\n */\n\n#ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP\n#define PB_DS_SAMPLE_RANGE_HASHING_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample range-hashing functor.\n class sample_range_hashing\n {\n public:\n /// Size type.\n typedef std::size_t size_type;\n\n /// Default constructor.\n sample_range_hashing();\n\n /// Copy constructor.\n sample_range_hashing(const sample_range_hashing& other);\n\n /// Swaps content.\n inline void\n swap(sample_range_hashing& other);\n\n protected:\n /// Notifies the policy object that the container's size has\n /// changed to argument's size.\n void\n notify_resized(size_type);\n\n /// Transforms the __hash value hash into a ranged-hash value.\n inline size_type\n operator()(size_type ) const;\n };\n}\n#endif // #ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP\n","include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_ranged_hash_fn.hpp\n * Contains a ranged hash policy.\n */\n\n#ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP\n#define PB_DS_SAMPLE_RANGED_HASH_FN_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample ranged-hash functor.\n class sample_ranged_hash_fn\n {\n public:\n typedef std::size_t size_type;\n\n /// Default constructor.\n sample_ranged_hash_fn();\n\n /// Copy constructor.\n sample_ranged_hash_fn(const sample_ranged_hash_fn&);\n\n /// Swaps content.\n inline void\n swap(sample_ranged_hash_fn&);\n\n protected:\n\n /// Notifies the policy object that the container's __size has\n /// changed to size.\n void\n notify_resized(size_type);\n\n /// Transforms key_const_reference into a position within the table.\n inline size_type\n operator()(key_const_reference) const;\n\n };\n}\n#endif // #ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP\n","include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_ranged_probe_fn.hpp\n * Contains a ranged probe policy.\n */\n\n#ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP\n#define PB_DS_SAMPLE_RANGED_PROBE_FN_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample ranged-probe functor.\n class sample_ranged_probe_fn\n {\n public:\n typedef std::size_t \tsize_type;\n\n // Default constructor.\n sample_ranged_probe_fn();\n\n // Copy constructor.\n sample_ranged_probe_fn(const sample_ranged_probe_fn&);\n\n // Swaps content.\n inline void\n swap(sample_ranged_probe_fn&);\n\n protected:\n\n // Notifies the policy object that the container's __size has\n // changed to size.\n void\n notify_resized(size_type);\n\n // Transforms the const key reference r_key into the i-th position\n // within the table. This method is called for each collision within\n // the probe sequence.\n inline size_type\n operator()(key_const_reference, std::size_t, size_type) const;\n\n };\n}\n#endif // #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/const_iterator.hpp\n * Contains an iterator class returned by the table's const find and insert\n * methods.\n */\n\n#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP\n#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP\n\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_CLASS_C_DEC \\\n left_child_next_sibling_heap_const_iterator_<Node, _Alloc>\n\n#define PB_DS_BASIC_HEAP_CIT_BASE \\\n left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc>\n\n /// Const point-type iterator.\n template<typename Node, typename _Alloc>\n class left_child_next_sibling_heap_const_iterator_\n : public PB_DS_BASIC_HEAP_CIT_BASE\n {\n private:\n typedef PB_DS_BASIC_HEAP_CIT_BASE \t \tbase_type;\n typedef typename base_type::node_pointer\t\tnode_pointer;\n\n public:\n /// Category.\n typedef std::forward_iterator_tag \t\titerator_category;\n\n /// Difference type.\n typedef typename _Alloc::difference_type \t\tdifference_type;\n\n /// Iterator's value type.\n typedef typename base_type::value_type \t\tvalue_type;\n\n /// Iterator's pointer type.\n typedef typename base_type::pointer \t\tpointer;\n\n /// Iterator's const pointer type.\n typedef typename base_type::const_pointer \tconst_pointer;\n\n /// Iterator's reference type.\n typedef typename base_type::reference \t\treference;\n\n /// Iterator's const reference type.\n typedef typename base_type::const_reference \tconst_reference;\n\n inline\n left_child_next_sibling_heap_const_iterator_(node_pointer p_nd)\n : base_type(p_nd)\n { }\n\n /// Default constructor.\n inline\n left_child_next_sibling_heap_const_iterator_()\n { }\n\n /// Copy constructor.\n inline\n left_child_next_sibling_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)\n { }\n\n /// Compares content to a different iterator object.\n bool\n operator==(const PB_DS_CLASS_C_DEC& other) const\n { return (base_type::m_p_nd == other.m_p_nd); }\n\n /// Compares content (negatively) to a different iterator object.\n bool\n operator!=(const PB_DS_CLASS_C_DEC& other) const\n { return (base_type::m_p_nd != other.m_p_nd); }\n\n PB_DS_CLASS_C_DEC&\n operator++()\n {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != 0);\n\tinc();\n\treturn (*this);\n }\n\n PB_DS_CLASS_C_DEC\n operator++(int)\n {\n\tPB_DS_CLASS_C_DEC ret_it(base_type::m_p_nd);\n\toperator++();\n\treturn (ret_it);\n }\n\n private:\n void\n inc()\n {\n\tif (base_type::m_p_nd->m_p_next_sibling != 0)\n\t {\n\t base_type::m_p_nd = base_type::m_p_nd->m_p_next_sibling;\n\t while (base_type::m_p_nd->m_p_l_child != 0)\n\t base_type::m_p_nd = base_type::m_p_nd->m_p_l_child;\n\t return;\n\t }\n\n\twhile (true)\n\t {\n\t node_pointer p_next = base_type::m_p_nd;\n\t base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent;\n\t if (base_type::m_p_nd == 0\n\t\t|| base_type::m_p_nd->m_p_l_child == p_next)\n\t return;\n\t }\n }\n };\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_BASIC_HEAP_CIT_BASE\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_allocator\nPB_DS_CLASS_C_DEC::s_node_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::no_throw_copies_t\nPB_DS_CLASS_C_DEC::s_no_throw_copies_ind;\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nleft_child_next_sibling_heap() :\n m_p_root(0),\n m_size(0)\n{\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nleft_child_next_sibling_heap(const Cmp_Fn& r_cmp_fn) :\n Cmp_Fn(r_cmp_fn),\n m_p_root(0),\n m_size(0)\n{\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nleft_child_next_sibling_heap(const PB_DS_CLASS_C_DEC& other) \n: Cmp_Fn(other), m_p_root(0), m_size(0)\n{\n m_size = other.m_size;\n PB_DS_ASSERT_VALID(other)\n m_p_root = recursive_copy_node(other.m_p_root);\n m_size = other.m_size;\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n value_swap(other);\n std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n std::swap(m_p_root, other.m_p_root);\n std::swap(m_size, other.m_size);\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~left_child_next_sibling_heap()\n{\n clear();\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrecursive_copy_node(node_const_pointer p_nd)\n{\n if (p_nd == 0)\n return (0);\n\n node_pointer p_ret = s_node_allocator.allocate(1);\n\n __try\n {\n new (p_ret) node(*p_nd);\n }\n __catch(...)\n {\n s_node_allocator.deallocate(p_ret, 1);\n __throw_exception_again;\n }\n\n p_ret->m_p_l_child = p_ret->m_p_next_sibling =\n p_ret->m_p_prev_or_parent = 0;\n\n __try\n {\n p_ret->m_p_l_child = recursive_copy_node(p_nd->m_p_l_child);\n p_ret->m_p_next_sibling = recursive_copy_node(p_nd->m_p_next_sibling);\n }\n __catch(...)\n {\n clear_imp(p_ret);\n __throw_exception_again;\n }\n\n if (p_ret->m_p_l_child != 0)\n p_ret->m_p_l_child->m_p_prev_or_parent = p_ret;\n\n if (p_ret->m_p_next_sibling != 0)\n p_ret->m_p_next_sibling->m_p_prev_or_parent =\n p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : 0;\n\n return p_ret;\n}\n\n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/debug_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n PB_DS_DEBUG_VERIFY(m_p_root == 0 || m_p_root->m_p_prev_or_parent == 0);\n\n if (m_p_root != 0)\n assert_node_consistent(m_p_root, Single_Link_Roots, __file, __line);\n assert_size(__file, __line);\n assert_iterators(__file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(node_const_pointer p_nd, bool single_link,\n\t\t const char* __file, int __line) const\n{\n if (p_nd == 0)\n return;\n\n assert_node_consistent(p_nd->m_p_l_child, false, __file, __line);\n assert_node_consistent(p_nd->m_p_next_sibling, single_link, __file, __line);\n\n if (single_link)\n PB_DS_DEBUG_VERIFY(p_nd->m_p_prev_or_parent == 0);\n else if (p_nd->m_p_next_sibling != 0)\n PB_DS_DEBUG_VERIFY(p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd);\n\n if (p_nd->m_p_l_child == 0)\n return;\n\n node_const_pointer p_child = p_nd->m_p_l_child;\n while (p_child != 0)\n {\n node_const_pointer p_next_child = p_child->m_p_next_sibling;\n PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(p_nd->m_value, p_child->m_value));\n p_child = p_next_child;\n }\n PB_DS_DEBUG_VERIFY(p_nd->m_p_l_child->m_p_prev_or_parent == p_nd);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_iterators(const char* __file, int __line) const\n{\n PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) == size());\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_size(const char* __file, int __line) const\n{\n PB_DS_DEBUG_VERIFY(size_from_node(m_p_root) == m_size);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize_under_node(node_const_pointer p_nd)\n{ return 1 + size_from_node(p_nd->m_p_l_child); }\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize_from_node(node_const_pointer p_nd)\n{\n size_type ret = 0;\n while (p_nd != 0)\n {\n ret += 1 + size_from_node(p_nd->m_p_l_child);\n p_nd = p_nd->m_p_next_sibling;\n }\n return ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\ndegree(node_const_pointer p_nd)\n{\n size_type ret = 0;\n node_const_pointer p_child = p_nd->m_p_l_child;\n while (p_child != 0)\n {\n ++ret;\n p_child = p_child->m_p_next_sibling;\n }\n return ret;\n}\n\n#endif \n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/erase_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n clear_imp(m_p_root);\n _GLIBCXX_DEBUG_ASSERT(m_size == 0);\n m_p_root = 0;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_node(node_pointer p_nd)\n{\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n --m_size;\n p_nd->~node();\n s_node_allocator.deallocate(p_nd, 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n while (p_nd != 0)\n {\n clear_imp(p_nd->m_p_l_child);\n node_pointer p_next = p_nd->m_p_next_sibling;\n actual_erase_node(p_nd);\n p_nd = p_next;\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nto_linked_list()\n{\n PB_DS_ASSERT_VALID((*this))\n node_pointer p_cur = m_p_root;\n while (p_cur != 0)\n if (p_cur->m_p_l_child != 0)\n {\n\tnode_pointer p_child_next = p_cur->m_p_l_child->m_p_next_sibling;\n\tp_cur->m_p_l_child->m_p_next_sibling = p_cur->m_p_next_sibling;\n\tp_cur->m_p_next_sibling = p_cur->m_p_l_child;\n\tp_cur->m_p_l_child = p_child_next;\n }\n else\n p_cur = p_cur->m_p_next_sibling;\n\n#ifdef _GLIBCXX_DEBUG\n node_const_pointer p_counter = m_p_root;\n size_type count = 0;\n while (p_counter != 0)\n {\n ++count;\n _GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == 0);\n p_counter = p_counter->m_p_next_sibling;\n }\n _GLIBCXX_DEBUG_ASSERT(count == m_size);\n#endif \n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nprune(Pred pred)\n{\n node_pointer p_cur = m_p_root;\n m_p_root = 0;\n node_pointer p_out = 0;\n while (p_cur != 0)\n {\n node_pointer p_next = p_cur->m_p_next_sibling;\n if (pred(p_cur->m_value))\n {\n\t p_cur->m_p_next_sibling = p_out;\n\t if (p_out != 0)\n\t p_out->m_p_prev_or_parent = p_cur;\n\t p_out = p_cur;\n }\n else\n {\n\t p_cur->m_p_next_sibling = m_p_root;\n\t if (m_p_root != 0)\n\t m_p_root->m_p_prev_or_parent = p_cur;\n\t m_p_root = p_cur;\n }\n p_cur = p_next;\n }\n return p_out;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nbubble_to_top(node_pointer p_nd)\n{\n node_pointer p_parent = parent(p_nd);\n while (p_parent != 0)\n {\n swap_with_parent(p_nd, p_parent);\n p_parent = parent(p_nd);\n }\n}\n\n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/info_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\n_GLIBCXX_NODISCARD\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{\n return (m_size == 0);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{\n return (m_size);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{\n return (s_node_allocator.max_size());\n}\n\n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/insert_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_insert(const_reference r_val)\n{\n return get_new_node_for_insert(r_val, s_no_throw_copies_ind);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_insert(const_reference r_val, false_type)\n{\n node_pointer p_new_nd = s_node_allocator.allocate(1);\n\n cond_dealtor_t cond(p_new_nd);\n\n new (const_cast<void* >(\n\t\t\t static_cast<const void* >(&p_new_nd->m_value)))\n typename node::value_type(r_val);\n\n cond.set_no_action();\n\n ++m_size;\n\n return (p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_insert(const_reference r_val, true_type)\n{\n node_pointer p_new_nd = s_node_allocator.allocate(1);\n\n new (const_cast<void* >(\n\t\t\t static_cast<const void* >(&p_new_nd->m_value)))\n typename node::value_type(r_val);\n\n ++m_size;\n\n return (p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_child_of(node_pointer p_nd, node_pointer p_new_parent)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n _GLIBCXX_DEBUG_ASSERT(p_new_parent != 0);\n\n p_nd->m_p_next_sibling = p_new_parent->m_p_l_child;\n\n if (p_new_parent->m_p_l_child != 0)\n p_new_parent->m_p_l_child->m_p_prev_or_parent = p_nd;\n\n p_nd->m_p_prev_or_parent = p_new_parent;\n\n p_new_parent->m_p_l_child = p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nparent(node_pointer p_nd)\n{\n while (true)\n {\n node_pointer p_pot = p_nd->m_p_prev_or_parent;\n\n if (p_pot == 0 || p_pot->m_p_l_child == p_nd)\n\treturn p_pot;\n\n p_nd = p_pot;\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap_with_parent(node_pointer p_nd, node_pointer p_parent)\n{\n if (p_parent == m_p_root)\n m_p_root = p_nd;\n\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n _GLIBCXX_DEBUG_ASSERT(p_parent != 0);\n _GLIBCXX_DEBUG_ASSERT(parent(p_nd) == p_parent);\n\n const bool nd_direct_child = p_parent->m_p_l_child == p_nd;\n const bool parent_root = p_parent->m_p_prev_or_parent == 0;\n const bool parent_direct_child =\n !parent_root&& p_parent->m_p_prev_or_parent->m_p_l_child == p_parent;\n\n std::swap(p_parent->m_p_prev_or_parent, p_nd->m_p_prev_or_parent);\n std::swap(p_parent->m_p_next_sibling, p_nd->m_p_next_sibling);\n std::swap(p_parent->m_p_l_child, p_nd->m_p_l_child);\n std::swap(p_parent->m_metadata, p_nd->m_metadata);\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child != 0);\n _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != 0);\n\n if (p_nd->m_p_next_sibling != 0)\n p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;\n\n if (p_parent->m_p_next_sibling != 0)\n p_parent->m_p_next_sibling->m_p_prev_or_parent = p_parent;\n\n if (p_parent->m_p_l_child != 0)\n p_parent->m_p_l_child->m_p_prev_or_parent = p_parent;\n\n if (parent_direct_child)\n p_nd->m_p_prev_or_parent->m_p_l_child = p_nd;\n else if (!parent_root)\n p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd;\n\n if (!nd_direct_child)\n {\n p_nd->m_p_l_child->m_p_prev_or_parent = p_nd;\n\n p_parent->m_p_prev_or_parent->m_p_next_sibling = p_parent;\n }\n else\n {\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child == p_nd);\n _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent == p_parent);\n\n p_nd->m_p_l_child = p_parent;\n p_parent->m_p_prev_or_parent = p_nd;\n }\n\n _GLIBCXX_DEBUG_ASSERT(parent(p_parent) == p_nd);\n}\n\n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/iterators_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n node_pointer p_nd = m_p_root;\n\n if (p_nd == 0)\n return (iterator(0));\n\n while (p_nd->m_p_l_child != 0)\n p_nd = p_nd->m_p_l_child;\n\n return (iterator(p_nd));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n node_pointer p_nd = m_p_root;\n\n if (p_nd == 0)\n return (const_iterator(0));\n\n while (p_nd->m_p_l_child != 0)\n p_nd = p_nd->m_p_l_child;\n\n return (const_iterator(p_nd));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{\n return (iterator(0));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{\n return (const_iterator(0));\n}\n\n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp\n * Contains an implementation class for a basic heap.\n */\n\n#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP\n#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP\n\n/*\n * Based on CLRS.\n */\n\n#include <iterator>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp>\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n#include <iostream>\n#endif\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_CLASS_T_DEC \\\n template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \\\n\t typename _Alloc, bool Single_Link_Roots>\n\n#define PB_DS_CLASS_C_DEC \\\n left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata,\t\\\n\t\t\t\t _Alloc, Single_Link_Roots>\n#else\n#define PB_DS_CLASS_T_DEC \\\n template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \\\n\t typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata, _Alloc>\n#endif\n\n /// Base class for a basic heap.\n template<typename Value_Type,\n\t typename Cmp_Fn,\n\t typename Node_Metadata,\n\t typename _Alloc\n#ifdef _GLIBCXX_DEBUG\n\t ,bool Single_Link_Roots>\n#else\n\t >\n#endif\n class left_child_next_sibling_heap : public Cmp_Fn\n {\n public:\n typedef\n\tleft_child_next_sibling_heap_node_<Value_Type, Node_Metadata, _Alloc>\n\tnode;\n\n private:\n typedef typename detail::rebind_traits<_Alloc, node> alloc_traits;\n\n protected:\n typedef typename alloc_traits::allocator_type node_allocator;\n\n typedef typename alloc_traits::pointer \t\tnode_pointer;\n typedef typename alloc_traits::const_pointer\tnode_const_pointer;\n typedef Node_Metadata node_metadata;\n typedef std::pair<node_pointer, node_pointer> \tnode_pointer_pair;\n\n private:\n typedef cond_dealtor< node, _Alloc> \t\tcond_dealtor_t;\n\n enum\n\t{\n\t simple_value = is_simple<Value_Type>::value\n\t};\n\n typedef integral_constant<int, simple_value> \tno_throw_copies_t;\n typedef rebind_traits<_Alloc, Value_Type>\t__rebind_v;\n\n public:\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \tdifference_type;\n typedef Value_Type \t\t\t\tvalue_type;\n\n typedef typename __rebind_v::pointer \tpointer;\n typedef typename __rebind_v::const_pointer const_pointer;\n typedef typename __rebind_v::reference\treference;\n typedef typename __rebind_v::const_reference const_reference;\n\n typedef left_child_next_sibling_heap_node_point_const_iterator_<node, _Alloc>\n point_const_iterator;\n\n typedef point_const_iterator \t\t\tpoint_iterator;\n\n typedef left_child_next_sibling_heap_const_iterator_<node, _Alloc>\n const_iterator;\n\n typedef const_iterator \t\t\t\titerator;\n typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n typedef _Alloc \t\t\t\t\tallocator_type;\n\n left_child_next_sibling_heap();\n left_child_next_sibling_heap(const Cmp_Fn&);\n left_child_next_sibling_heap(const left_child_next_sibling_heap&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n ~left_child_next_sibling_heap();\n\n _GLIBCXX_NODISCARD inline bool\n empty() const;\n\n inline size_type\n size() const;\n\n inline size_type\n max_size() const;\n\n Cmp_Fn&\n get_cmp_fn();\n\n const Cmp_Fn&\n get_cmp_fn() const;\n\n inline iterator\n begin();\n\n inline const_iterator\n begin() const;\n\n inline iterator\n end();\n\n inline const_iterator\n end() const;\n\n void\n clear();\n\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n void\n trace() const;\n#endif\n\n protected:\n inline node_pointer\n get_new_node_for_insert(const_reference);\n\n inline static void\n make_child_of(node_pointer, node_pointer);\n\n void\n value_swap(left_child_next_sibling_heap&);\n\n inline static node_pointer\n parent(node_pointer);\n\n inline void\n swap_with_parent(node_pointer, node_pointer);\n\n void\n bubble_to_top(node_pointer);\n\n inline void\n actual_erase_node(node_pointer);\n\n void\n clear_imp(node_pointer);\n\n void\n to_linked_list();\n\n template<typename Pred>\n node_pointer\n prune(Pred);\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n\n void\n assert_node_consistent(node_const_pointer, bool, const char*, int) const;\n\n static size_type\n size_under_node(node_const_pointer);\n\n static size_type\n degree(node_const_pointer);\n#endif\n\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n static void\n trace_node(node_const_pointer, size_type);\n#endif\n\n private:\n#ifdef _GLIBCXX_DEBUG\n void\n assert_iterators(const char*, int) const;\n\n void\n assert_size(const char*, int) const;\n\n static size_type\n size_from_node(node_const_pointer);\n#endif\n\n node_pointer\n recursive_copy_node(node_const_pointer);\n\n inline node_pointer\n get_new_node_for_insert(const_reference, false_type);\n\n inline node_pointer\n get_new_node_for_insert(const_reference, true_type);\n\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n template<typename Metadata_>\n static void\n trace_node_metadata(node_const_pointer, type_to_type<Metadata_>);\n\n static void\n trace_node_metadata(node_const_pointer, type_to_type<null_type>);\n#endif\n\n static node_allocator \ts_node_allocator;\n static no_throw_copies_t \ts_no_throw_copies_ind;\n\n protected:\n node_pointer \t\tm_p_root;\n size_type \t\tm_size;\n };\n\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/node.hpp\n * Contains an implementation struct for this type of heap's node.\n */\n\n#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP\n#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP\n\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Node.\n template<typename _Value, typename _Metadata, typename _Alloc>\n struct left_child_next_sibling_heap_node_\n {\n private:\n typedef left_child_next_sibling_heap_node_<_Value, _Metadata, _Alloc> this_type;\n\n public:\n typedef _Value \t\t\t\tvalue_type;\n typedef typename _Alloc::size_type \tsize_type;\n typedef _Metadata \t\t\tmetadata_type;\n\n typedef typename rebind_traits<_Alloc, this_type>::pointer node_pointer;\n\n value_type \tm_value;\n metadata_type \tm_metadata;\n node_pointer \tm_p_l_child;\n node_pointer \tm_p_next_sibling;\n node_pointer \tm_p_prev_or_parent;\n };\n\n template<typename _Value, typename _Alloc>\n struct left_child_next_sibling_heap_node_<_Value, null_type, _Alloc>\n {\n private:\n typedef left_child_next_sibling_heap_node_<_Value, null_type, _Alloc> this_type;\n\n public:\n typedef _Value \t\t\t\tvalue_type;\n typedef typename _Alloc::size_type \tsize_type;\n\n typedef typename rebind_traits<_Alloc, this_type>::pointer node_pointer;\n\n value_type \tm_value;\n node_pointer \tm_p_l_child;\n node_pointer \tm_p_next_sibling;\n node_pointer \tm_p_prev_or_parent;\n };\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/point_const_iterator.hpp\n * Contains an iterator class returned by the table's const find and insert\n * methods.\n */\n\n#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP\n#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n\n#define PB_DS_CLASS_T_DEC\t\t\t\\\n template<typename Node, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc>\n\n /// Const point-type iterator.\n template<typename Node, typename _Alloc>\n class left_child_next_sibling_heap_node_point_const_iterator_\n {\n protected:\n typedef typename rebind_traits<_Alloc, Node>::pointer node_pointer;\n\n public:\n /// Category.\n typedef trivial_iterator_tag iterator_category;\n\n /// Difference type.\n typedef trivial_iterator_difference_type difference_type;\n\n /// Iterator's value type.\n typedef typename Node::value_type value_type;\n\n /// Iterator's pointer type.\n typedef typename rebind_traits<_Alloc, value_type>::pointer pointer;\n\n /// Iterator's const pointer type.\n typedef typename rebind_traits<_Alloc, value_type>::const_pointer\n\tconst_pointer;\n\n /// Iterator's reference type.\n typedef typename rebind_traits<_Alloc, value_type>::reference reference;\n\n /// Iterator's const reference type.\n typedef typename rebind_traits<_Alloc, value_type>::const_reference\n\tconst_reference;\n\n inline\n left_child_next_sibling_heap_node_point_const_iterator_(node_pointer p_nd) : m_p_nd(p_nd)\n { }\n\n /// Default constructor.\n inline\n left_child_next_sibling_heap_node_point_const_iterator_() : m_p_nd(0)\n { }\n\n /// Copy constructor.\n inline\n left_child_next_sibling_heap_node_point_const_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)\n { }\n\n /// Access.\n const_pointer\n operator->() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);\n\treturn &m_p_nd->m_value;\n }\n\n /// Access.\n const_reference\n operator*() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);\n\treturn m_p_nd->m_value;\n }\n\n /// Compares content to a different iterator object.\n bool\n operator==(const PB_DS_CLASS_C_DEC& other) const\n { return m_p_nd == other.m_p_nd; }\n\n /// Compares content (negatively) to a different iterator object.\n bool\n operator!=(const PB_DS_CLASS_C_DEC& other) const\n { return m_p_nd != other.m_p_nd; }\n\n node_pointer m_p_nd;\n };\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/policy_access_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nCmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Cmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn() const\n{ return *this; }\n\n#endif\n","include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_/trace_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n std::cerr << std::endl;\n trace_node(m_p_root, 0);\n std::cerr << std::endl;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node(node_const_pointer p_nd, size_type level)\n{\n while (p_nd != 0)\n {\n for (size_type i = 0; i < level; ++i)\n\tstd::cerr << ' ';\n\n std::cerr << p_nd <<\n\t\" prev = \" << p_nd->m_p_prev_or_parent <<\n\t\" next \" << p_nd->m_p_next_sibling <<\n\t\" left = \" << p_nd->m_p_l_child << \" \";\n\n trace_node_metadata(p_nd, type_to_type<node_metadata>());\n std::cerr << p_nd->m_value << std::endl;\n trace_node(p_nd->m_p_l_child, level + 1);\n p_nd = p_nd->m_p_next_sibling;\n }\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Metadata_>\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>)\n{\n std::cerr << \"(\" << p_nd->m_metadata << \") \";\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node_metadata(node_const_pointer, type_to_type<null_type>)\n{ }\n\n#endif // #ifdef PB_DS_LC_NS_HEAP_TRACE_\n#endif\n","include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/constructor_destructor_fn_imps.hpp\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_allocator\nPB_DS_CLASS_C_DEC::s_entry_allocator;\n\nPB_DS_CLASS_T_DEC\nEq_Fn PB_DS_CLASS_C_DEC::s_eq_fn;\n\nPB_DS_CLASS_T_DEC\nnull_type PB_DS_CLASS_C_DEC::s_null_type;\n\nPB_DS_CLASS_T_DEC\nUpdate_Policy PB_DS_CLASS_C_DEC::s_update_policy;\n\nPB_DS_CLASS_T_DEC\ntype_to_type<\n typename PB_DS_CLASS_C_DEC::update_metadata> PB_DS_CLASS_C_DEC::s_metadata_type_indicator;\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_LU_NAME() : m_p_l(0)\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nPB_DS_CLASS_C_DEC::\nPB_DS_LU_NAME(It first_it, It last_it) : m_p_l(0)\n{\n copy_from_range(first_it, last_it);\n PB_DS_ASSERT_VALID((*this));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_LU_NAME(const PB_DS_CLASS_C_DEC& other) :\nm_p_l(0)\n{\n __try\n {\n for (const_iterator it = other.begin(); it != other.end(); ++it)\n\t{\n\t entry_pointer p_l = allocate_new_entry(*it,\n\t\t\t\t traits_base::m_no_throw_copies_indicator);\n\n\t p_l->m_p_next = m_p_l;\n\t m_p_l = p_l;\n\t}\n }\n __catch(...)\n {\n deallocate_all();\n __throw_exception_again;\n }\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)\n std::swap(m_p_l, other.m_p_l);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndeallocate_all()\n{\n entry_pointer p_l = m_p_l;\n while (p_l != 0)\n {\n entry_pointer p_next_l = p_l->m_p_next;\n actual_erase_entry(p_l);\n p_l = p_next_l;\n }\n m_p_l = 0;\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_LU_NAME()\n{ deallocate_all(); }\n#endif\n","include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/debug_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s debug-mode functions.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n size_type calc_size = 0;\n for (const_iterator it = begin(); it != end(); ++it)\n {\n debug_base::check_key_exists(PB_DS_V2F(*it), __file, __line);\n ++calc_size;\n }\n debug_base::check_size(calc_size, __file, __line);\n}\n\n#endif \n#endif\n","include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/entry_metadata_base.hpp\n * Contains an implementation for a list update map.\n */\n\n#ifndef PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP\n#define PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n template<typename Metadata>\n struct lu_map_entry_metadata_base\n {\n Metadata m_update_metadata;\n };\n \n template<>\n struct lu_map_entry_metadata_base<null_type>\n { }; \n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/erase_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(key_const_reference r_key)\n{\n PB_DS_ASSERT_VALID((*this))\n if (m_p_l == 0)\n return false;\n\n if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))\n {\n entry_pointer p_next = m_p_l->m_p_next;\n actual_erase_entry(m_p_l);\n m_p_l = p_next;\n return true;\n }\n\n entry_pointer p_l = m_p_l;\n while (p_l->m_p_next != 0)\n if (s_eq_fn(r_key, PB_DS_V2F(p_l->m_p_next->m_value)))\n {\n\terase_next(p_l);\n\treturn true;\n }\n else\n p_l = p_l->m_p_next;\n return false;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n deallocate_all();\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n PB_DS_ASSERT_VALID((*this))\n size_type num_ersd = 0;\n while (m_p_l != 0 && pred(m_p_l->m_value))\n {\n entry_pointer p_next = m_p_l->m_p_next;\n ++num_ersd;\n actual_erase_entry(m_p_l);\n m_p_l = p_next;\n }\n\n if (m_p_l == 0)\n return num_ersd;\n\n entry_pointer p_l = m_p_l;\n while (p_l->m_p_next != 0)\n {\n if (pred(p_l->m_p_next->m_value))\n {\n\t ++num_ersd;\n\t erase_next(p_l);\n }\n else\n\tp_l = p_l->m_p_next;\n }\n\n PB_DS_ASSERT_VALID((*this))\n return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_next(entry_pointer p_l)\n{\n _GLIBCXX_DEBUG_ASSERT(p_l != 0);\n _GLIBCXX_DEBUG_ASSERT(p_l->m_p_next != 0);\n entry_pointer p_next_l = p_l->m_p_next->m_p_next;\n actual_erase_entry(p_l->m_p_next);\n p_l->m_p_next = p_next_l;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nactual_erase_entry(entry_pointer p_l)\n{\n _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->m_value));)\n p_l->~entry();\n s_entry_allocator.deallocate(p_l, 1);\n}\n\n#endif\n","include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/find_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nfind_imp(key_const_reference r_key) const\n{\n if (m_p_l == 0)\n return 0;\n if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))\n {\n apply_update(m_p_l, s_metadata_type_indicator);\n PB_DS_CHECK_KEY_EXISTS(r_key)\n return m_p_l;\n }\n\n entry_pointer p_l = m_p_l;\n while (p_l->m_p_next != 0)\n {\n entry_pointer p_next = p_l->m_p_next;\n if (s_eq_fn(r_key, PB_DS_V2F(p_next->m_value)))\n {\n\t if (apply_update(p_next, s_metadata_type_indicator))\n {\n\t p_l->m_p_next = p_next->m_p_next;\n\t p_next->m_p_next = m_p_l;\n\t m_p_l = p_next;\n\t return m_p_l;\n }\n\t return p_next;\n }\n else\n\tp_l = p_next;\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return 0;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Metadata>\ninline bool\nPB_DS_CLASS_C_DEC::\napply_update(entry_pointer p_l, type_to_type<Metadata>)\n{ return s_update_policy(p_l->m_update_metadata); }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\napply_update(entry_pointer, type_to_type<null_type>)\n{ return s_update_policy(s_null_type); }\n\n#endif\n","include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/info_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return std::distance(begin(), end()); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_entry_allocator.max_size(); }\n\nPB_DS_CLASS_T_DEC\n_GLIBCXX_NODISCARD\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (m_p_l == 0); }\n#endif\n","include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/insert_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline std::pair<\n typename PB_DS_CLASS_C_DEC::point_iterator,\n bool>\nPB_DS_CLASS_C_DEC::\ninsert(const_reference r_val)\n{\n PB_DS_ASSERT_VALID((*this))\n entry_pointer p_l = find_imp(PB_DS_V2F(r_val));\n\n if (p_l != 0)\n {\n PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_val))\n return std::make_pair(point_iterator(&p_l->m_value), false);\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_val))\n\n p_l = allocate_new_entry(r_val, traits_base::m_no_throw_copies_indicator);\n p_l->m_p_next = m_p_l;\n m_p_l = p_l;\n PB_DS_ASSERT_VALID((*this))\n return std::make_pair(point_iterator(&p_l->m_value), true);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nallocate_new_entry(const_reference r_val, false_type)\n{\n entry_pointer p_l = s_entry_allocator.allocate(1);\n cond_dealtor_t cond(p_l);\n new (const_cast<void* >(static_cast<const void* >(&p_l->m_value)))\n value_type(r_val);\n\n cond.set_no_action();\n _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)\n init_entry_metadata(p_l, s_metadata_type_indicator);\n return p_l;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nallocate_new_entry(const_reference r_val, true_type)\n{\n entry_pointer p_l = s_entry_allocator.allocate(1);\n new (&p_l->m_value) value_type(r_val);\n _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)\n init_entry_metadata(p_l, s_metadata_type_indicator);\n return p_l;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Metadata>\ninline void\nPB_DS_CLASS_C_DEC::\ninit_entry_metadata(entry_pointer p_l, type_to_type<Metadata>)\n{ new (&p_l->m_update_metadata) Metadata(s_update_policy()); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninit_entry_metadata(entry_pointer, type_to_type<null_type>)\n{ }\n\n#endif\n","include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/iterators_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n if (m_p_l == 0)\n {\n _GLIBCXX_DEBUG_ASSERT(empty());\n return end();\n }\n return iterator(&m_p_l->m_value, m_p_l, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n if (m_p_l == 0)\n {\n _GLIBCXX_DEBUG_ASSERT(empty());\n return end();\n }\n return iterator(&m_p_l->m_value, m_p_l, const_cast<PB_DS_CLASS_C_DEC* >(this));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{ return iterator(0, 0, this); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{\n return const_iterator(0, 0, const_cast<PB_DS_CLASS_C_DEC*>(this));\n}\n\n#endif\n","include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/lu_map_.hpp\n * Contains a list update map.\n */\n\n#include <utility>\n#include <iterator>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp>\n#include <ext/pb_ds/exception.hpp>\n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/debug_map_base.hpp>\n#endif\n#ifdef PB_DS_LU_MAP_TRACE_\n#include <iostream>\n#endif\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_LU_NAME lu_map\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_LU_NAME lu_set\n#endif\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Mapped, typename Eq_Fn, \\\n\t typename _Alloc, typename Update_Policy>\n\n#define PB_DS_CLASS_C_DEC \\\n PB_DS_LU_NAME<Key, Mapped, Eq_Fn, _Alloc, Update_Policy>\n\n#define PB_DS_LU_TRAITS_BASE \\\n types_traits<Key, Mapped, _Alloc, false>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_DEBUG_MAP_BASE_C_DEC \\\n debug_map_base<Key, Eq_Fn, \\\n\t\t typename rebind_traits<_Alloc, Key>::const_reference>\n#endif\n\n /// list-based (with updates) associative container.\n /// Skip to the lu, my darling.\n template<typename Key,\n\t typename Mapped,\n\t typename Eq_Fn,\n\t typename _Alloc,\n\t typename Update_Policy>\n class PB_DS_LU_NAME :\n#ifdef _GLIBCXX_DEBUG\n protected PB_DS_DEBUG_MAP_BASE_C_DEC,\n#endif\n public PB_DS_LU_TRAITS_BASE\n {\n private:\n typedef PB_DS_LU_TRAITS_BASE \t \ttraits_base;\n\n struct entry\n : public lu_map_entry_metadata_base<typename Update_Policy::metadata_type>\n {\n\ttypename traits_base::value_type m_value;\n\ttypename rebind_traits<_Alloc, entry>::pointer m_p_next;\n };\n\n typedef rebind_traits<_Alloc, entry>\t\t entry_alloc_traits;\n typedef typename entry_alloc_traits::allocator_type entry_allocator;\n typedef typename entry_alloc_traits::pointer\t entry_pointer;\n typedef typename entry_alloc_traits::const_pointer const_entry_pointer;\n typedef typename entry_alloc_traits::reference\t entry_reference;\n typedef typename entry_alloc_traits::const_reference const_entry_reference;\n\n typedef rebind_traits<_Alloc, entry_pointer>\tentry_pointer_alloc_traits;\n typedef typename entry_pointer_alloc_traits::allocator_type entry_pointer_allocator;\n typedef typename entry_pointer_alloc_traits::pointer entry_pointer_array;\n\n typedef typename traits_base::value_type value_type_;\n typedef typename traits_base::pointer pointer_;\n typedef typename traits_base::const_pointer const_pointer_;\n typedef typename traits_base::reference reference_;\n typedef typename traits_base::const_reference const_reference_;\n\n#define PB_DS_GEN_POS entry_pointer\n\n#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>\n\n#undef PB_DS_GEN_POS\n\n\n#ifdef _GLIBCXX_DEBUG\n typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;\n#endif\n\n typedef cond_dealtor<entry, _Alloc> cond_dealtor_t;\n\n public:\n typedef _Alloc allocator_type;\n typedef typename _Alloc::size_type size_type;\n typedef typename _Alloc::difference_type difference_type;\n typedef Eq_Fn eq_fn;\n typedef Update_Policy update_policy;\n typedef typename Update_Policy::metadata_type update_metadata;\n typedef typename traits_base::key_type key_type;\n typedef typename traits_base::key_pointer key_pointer;\n typedef typename traits_base::key_const_pointer key_const_pointer;\n typedef typename traits_base::key_reference key_reference;\n typedef typename traits_base::key_const_reference key_const_reference;\n typedef typename traits_base::mapped_type mapped_type;\n typedef typename traits_base::mapped_pointer mapped_pointer;\n typedef typename traits_base::mapped_const_pointer mapped_const_pointer;\n typedef typename traits_base::mapped_reference mapped_reference;\n typedef typename traits_base::mapped_const_reference mapped_const_reference;\n typedef typename traits_base::value_type value_type;\n typedef typename traits_base::pointer pointer;\n typedef typename traits_base::const_pointer const_pointer;\n typedef typename traits_base::reference reference;\n typedef typename traits_base::const_reference const_reference;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n typedef point_iterator_ \t\t\tpoint_iterator;\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n typedef point_const_iterator_ \t\tpoint_iterator;\n#endif\n\n typedef point_const_iterator_ \t\tpoint_const_iterator;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n typedef iterator_ \t\t\titerator;\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n typedef const_iterator_ \t\t\titerator;\n#endif\n\n typedef const_iterator_ \t\t\tconst_iterator;\n\n public:\n PB_DS_LU_NAME();\n\n PB_DS_LU_NAME(const PB_DS_CLASS_C_DEC&);\n\n virtual\n ~PB_DS_LU_NAME();\n\n template<typename It>\n PB_DS_LU_NAME(It, It);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n inline size_type\n size() const;\n\n inline size_type\n max_size() const;\n\n _GLIBCXX_NODISCARD inline bool\n empty() const;\n\n inline mapped_reference\n operator[](key_const_reference r_key)\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\treturn insert(std::make_pair(r_key, mapped_type())).first->second;\n#else\n\tinsert(r_key);\n\treturn traits_base::s_null_type;\n#endif\n }\n\n inline std::pair<point_iterator, bool>\n insert(const_reference);\n\n inline point_iterator\n find(key_const_reference r_key)\n {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\tentry_pointer p_e = find_imp(r_key);\n\treturn point_iterator(p_e == 0 ? 0: &p_e->m_value);\n }\n\n inline point_const_iterator\n find(key_const_reference r_key) const\n {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\tentry_pointer p_e = find_imp(r_key);\n\treturn point_const_iterator(p_e == 0 ? 0: &p_e->m_value);\n }\n\n inline bool\n erase(key_const_reference);\n\n template<typename Pred>\n inline size_type\n erase_if(Pred);\n\n void\n clear();\n\n inline iterator\n begin();\n\n inline const_iterator\n begin() const;\n\n inline iterator\n end();\n\n inline const_iterator\n end() const;\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char* file, int line) const;\n#endif\n\n#ifdef PB_DS_LU_MAP_TRACE_\n void\n trace() const;\n#endif\n\n protected:\n\n template<typename It>\n void\n copy_from_range(It, It);\n\n private:\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n friend class iterator_;\n#endif\n\n friend class const_iterator_;\n\n inline entry_pointer\n allocate_new_entry(const_reference, false_type);\n\n inline entry_pointer\n allocate_new_entry(const_reference, true_type);\n\n template<typename Metadata>\n inline static void\n init_entry_metadata(entry_pointer, type_to_type<Metadata>);\n\n inline static void\n init_entry_metadata(entry_pointer, type_to_type<null_type>);\n\n void\n deallocate_all();\n\n void\n erase_next(entry_pointer);\n\n void\n actual_erase_entry(entry_pointer);\n\n void\n inc_it_state(const_pointer& r_p_value, entry_pointer& r_pos) const\n {\n\tr_pos = r_pos->m_p_next;\n\tr_p_value = (r_pos == 0) ? 0 : &r_pos->m_value;\n }\n\n template<typename Metadata>\n inline static bool\n apply_update(entry_pointer, type_to_type<Metadata>);\n\n inline static bool\n apply_update(entry_pointer, type_to_type<null_type>);\n\n inline entry_pointer\n find_imp(key_const_reference) const;\n\n static entry_allocator \t\t\ts_entry_allocator;\n static Eq_Fn \t\t\t\ts_eq_fn;\n static Update_Policy \t\t\ts_update_policy;\n static type_to_type<update_metadata> \ts_metadata_type_indicator;\n static null_type \t\t\t\ts_null_type;\n\n mutable entry_pointer \t\t\tm_p_l;\n };\n\n#include <ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_LU_TRAITS_BASE\n#undef PB_DS_DEBUG_MAP_BASE_C_DEC\n#undef PB_DS_LU_NAME\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_map_/trace_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef PB_DS_LU_MAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n std::cerr << m_p_l << std::endl << std::endl;\n const_entry_pointer p_l = m_p_l;\n while (p_l != 0)\n {\n std::cerr << PB_DS_V2F(p_l->m_value) << std::endl;\n p_l = p_l->m_p_next;\n }\n std::cerr << std::endl;\n}\n\n#endif \n\n#endif\n","include/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file lu_counter_metadata.hpp\n * Contains implementation of a lu counter policy's metadata.\n */\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n template<typename Size_Type>\n class lu_counter_policy_base;\n\n /// A list-update metadata type that moves elements to the front of\n /// the list based on the counter algorithm.\n template<typename Size_Type = std::size_t>\n class lu_counter_metadata\n {\n public:\n\ttypedef Size_Type \tsize_type;\n\n private:\n\tlu_counter_metadata(size_type init_count) : m_count(init_count)\n\t{ }\n\n\tfriend class lu_counter_policy_base<size_type>;\n\n\tmutable size_type \tm_count;\n };\n\n /// Base class for list-update counter policy.\n template<typename Size_Type>\n class lu_counter_policy_base\n {\n protected:\n\ttypedef Size_Type \tsize_type;\n\n\tlu_counter_metadata<size_type>\n\toperator()(size_type max_size) const\n\t{ return lu_counter_metadata<Size_Type>(std::rand() % max_size); }\n\n\ttemplate<typename Metadata_Reference>\n\tbool\n\toperator()(Metadata_Reference r_data, size_type m_max_count) const\n\t{\n\t if (++r_data.m_count != m_max_count)\n\t return false;\n\t r_data.m_count = 0;\n\t return true;\n\t}\n };\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_update_policy.hpp\n * Contains a sample policy for list update containers.\n */\n\n#ifndef PB_DS_SAMPLE_UPDATE_POLICY_HPP\n#define PB_DS_SAMPLE_UPDATE_POLICY_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample list-update policy.\n struct sample_update_policy\n {\n /// Default constructor.\n sample_update_policy();\n\n /// Copy constructor.\n sample_update_policy(const sample_update_policy&);\n\n /// Swaps content.\n inline void\n swap(sample_update_policy& other);\n\n protected:\n /// Metadata on which this functor operates.\n typedef some_metadata_type metadata_type;\n\n /// Creates a metadata object.\n metadata_type\n operator()() const;\n\n /// Decides whether a metadata object should be moved to the front\n /// of the list. A list-update based containers object will call\n /// this method to decide whether to move a node to the front of\n /// the list. The method shoule return true if the node should be\n /// moved to the front of the list.\n bool\n operator()(metadata_reference) const;\n };\n}\n#endif\n","include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/constructors_destructor_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::value_allocator\nPB_DS_CLASS_C_DEC::s_value_alloc;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::metadata_allocator\nPB_DS_CLASS_C_DEC::s_metadata_alloc;\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_OV_TREE_NAME() :\n m_a_values(0),\n m_a_metadata(0),\n m_end_it(0),\n m_size(0)\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn) :\n cmp_fn(r_cmp_fn),\n m_a_values(0),\n m_a_metadata(0),\n m_end_it(0),\n m_size(0)\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_nodeu) :\n cmp_fn(r_cmp_fn),\n node_update(r_nodeu),\n m_a_values(0),\n m_a_metadata(0),\n m_end_it(0),\n m_size(0)\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_OV_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :\n#ifdef PB_DS_TREE_TRACE\n trace_base(other),\n#endif\n cmp_fn(other),\n node_update(other),\n m_a_values(0),\n m_a_metadata(0),\n m_end_it(0),\n m_size(0)\n{\n copy_from_ordered_range(other.begin(), other.end());\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\ninline void\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n typedef std::map<key_type, mapped_type, Cmp_Fn,\n\t\t typename rebind_traits<_Alloc, value_type>::allocator_type>\n map_type;\n#else\n typedef std::set<key_type, Cmp_Fn,\n\t\t typename rebind_traits<_Alloc, Key>::allocator_type>\n map_type;\n#endif\n\n map_type m(first_it, last_it);\n copy_from_ordered_range(m.begin(), m.end());\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_ordered_range(It first_it, It last_it)\n{\n const size_type len = std::distance(first_it, last_it);\n if (len == 0)\n return;\n\n value_vector a_values = s_value_alloc.allocate(len);\n iterator target_it = a_values;\n It source_it = first_it;\n It source_end_it = last_it;\n\n cond_dtor<size_type> cd(a_values, target_it, len);\n while (source_it != source_end_it)\n {\n void* __v = const_cast<void*>(static_cast<const void*>(target_it));\n new (__v) value_type(*source_it++);\n ++target_it;\n }\n\n reallocate_metadata((node_update*)this, len);\n cd.set_no_action();\n m_a_values = a_values;\n m_size = len;\n m_end_it = m_a_values + m_size;\n update(PB_DS_node_begin_imp(), (node_update*)this);\n\n#ifdef _GLIBCXX_DEBUG\n for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)\n debug_base::insert_new(PB_DS_V2F(*dbg_it));\n#endif\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_ordered_range(It first_it, It last_it, It other_first_it,\n\t\t\tIt other_last_it)\n{\n clear();\n const size_type len = std::distance(first_it, last_it)\n \t\t\t + std::distance(other_first_it, other_last_it);\n\n value_vector a_values = s_value_alloc.allocate(len);\n\n iterator target_it = a_values;\n It source_it = first_it;\n It source_end_it = last_it;\n\n cond_dtor<size_type> cd(a_values, target_it, len);\n while (source_it != source_end_it)\n {\n new (const_cast<void* >(static_cast<const void* >(target_it)))\n\tvalue_type(*source_it++);\n ++target_it;\n }\n\n source_it = other_first_it;\n source_end_it = other_last_it;\n\n while (source_it != source_end_it)\n {\n new (const_cast<void* >(static_cast<const void* >(target_it)))\n\tvalue_type(*source_it++);\n ++target_it;\n }\n\n reallocate_metadata((node_update* )this, len);\n cd.set_no_action();\n m_a_values = a_values;\n m_size = len;\n m_end_it = m_a_values + m_size;\n update(PB_DS_node_begin_imp(), (node_update* )this);\n\n#ifdef _GLIBCXX_DEBUG\n for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)\n debug_base::insert_new(PB_DS_V2F(*dbg_it));\n#endif\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n value_swap(other);\n std::swap(static_cast<cmp_fn&>(*this),\n\t static_cast<cmp_fn&>(other));\n std::swap(static_cast<traits_base&>(*this),\n\t static_cast<traits_base&>(other));\n PB_DS_ASSERT_VALID(other)\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)\n std::swap(m_a_values, other.m_a_values);\n std::swap(m_a_metadata, other.m_a_metadata);\n std::swap(m_size, other.m_size);\n std::swap(m_end_it, other.m_end_it);\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_OV_TREE_NAME()\n{\n PB_DS_ASSERT_VALID((*this))\n cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);\n reallocate_metadata((node_update*)this, 0);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate(node_iterator, null_node_update_pointer)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update>\nvoid\nPB_DS_CLASS_C_DEC::\nupdate(node_iterator nd_it, Node_Update* p_update)\n{\n node_const_iterator end_it = PB_DS_node_end_imp();\n if (nd_it != end_it)\n {\n update(nd_it.get_l_child(), p_update);\n update(nd_it.get_r_child(), p_update);\n node_update::operator()(nd_it, end_it);\n }\n}\n#endif\n","include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/debug_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n if (m_a_values == 0 || m_end_it == 0 || m_size == 0)\n PB_DS_DEBUG_VERIFY(m_a_values == 0 && m_end_it == 0 && m_size == 0);\n\n assert_iterators(__file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_iterators(const char* __file, int __line) const\n{\n debug_base::check_size(m_size, __file, __line);\n size_type iterated_num = 0;\n const_iterator prev_it = end();\n PB_DS_DEBUG_VERIFY(m_end_it == m_a_values + m_size);\n for (const_iterator it = begin(); it != end(); ++it)\n {\n ++iterated_num;\n debug_base::check_key_exists(PB_DS_V2F(*it), __file, __line);\n PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)) == it);\n const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));\n --upper_bound_it;\n PB_DS_DEBUG_VERIFY(upper_bound_it == it);\n if (prev_it != end())\n\tPB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),\n\t\t\t\t\t PB_DS_V2F(*it)));\n prev_it = it;\n }\n PB_DS_DEBUG_VERIFY(iterated_num == m_size);\n}\n\n#endif\n#endif\n","include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/erase_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n PB_DS_ASSERT_VALID((*this))\n if (m_size == 0)\n {\n return;\n }\n else\n {\n reallocate_metadata((node_update* )this, 0);\n cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);\n }\n\n _GLIBCXX_DEBUG_ONLY(debug_base::clear();)\n m_a_values = 0;\n m_size = 0;\n m_end_it = m_a_values;\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n PB_DS_ASSERT_VALID((*this))\n\n#ifdef PB_DS_REGRESSION\n typename _Alloc::group_adjustor adjust(m_size);\n#endif\n\n size_type new_size = 0;\n size_type num_val_ersd = 0;\n\n for (iterator source_it = begin(); source_it != m_end_it; ++source_it)\n if (!pred(*source_it))\n ++new_size;\n else\n ++num_val_ersd;\n\n if (new_size == 0)\n {\n clear();\n return num_val_ersd;\n }\n\n value_vector a_new_values = s_value_alloc.allocate(new_size);\n iterator target_it = a_new_values;\n cond_dtor<size_type> cd(a_new_values, target_it, new_size);\n _GLIBCXX_DEBUG_ONLY(debug_base::clear());\n for (iterator source_it = begin(); source_it != m_end_it; ++source_it)\n {\n if (!pred(*source_it))\n\t{\n\t new (const_cast<void*>(static_cast<const void*>(target_it)))\n\t value_type(*source_it);\n\n\t _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(*source_it)));\n\t ++target_it;\n\t}\n }\n\n reallocate_metadata((node_update*)this, new_size);\n cd.set_no_action();\n\n {\n cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);\n }\n\n m_a_values = a_new_values;\n m_size = new_size;\n m_end_it = target_it;\n update(node_begin(), (node_update*)this);\n PB_DS_ASSERT_VALID((*this))\n return num_val_ersd;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nIt\nPB_DS_CLASS_C_DEC::\nerase_imp(It it)\n{\n PB_DS_ASSERT_VALID((*this))\n if (it == end())\n return end();\n\n PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(*it))\n\n#ifdef PB_DS_REGRESSION\n typename _Alloc::group_adjustor adjust(m_size);\n#endif\n\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n value_vector a_values = s_value_alloc.allocate(m_size - 1);\n iterator source_it = begin();\n iterator source_end_it = end();\n iterator target_it = a_values;\n iterator ret_it = end();\n\n cond_dtor<size_type> cd(a_values, target_it, m_size - 1);\n\n _GLIBCXX_DEBUG_ONLY(size_type cnt = 0;)\n\n while (source_it != source_end_it)\n {\n if (source_it != it)\n\t{\n\t _GLIBCXX_DEBUG_ONLY(++cnt;)\n\t _GLIBCXX_DEBUG_ASSERT(cnt != m_size);\n\t new (const_cast<void*>(static_cast<const void*>(target_it)))\n\t value_type(*source_it);\n\n\t ++target_it;\n\t}\n else\n\tret_it = target_it;\n ++source_it;\n }\n\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n reallocate_metadata((node_update*)this, m_size - 1);\n cd.set_no_action();\n _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(*it));)\n {\n cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);\n }\n\n m_a_values = a_values;\n --m_size;\n m_end_it = m_a_values + m_size;\n update(node_begin(), (node_update*)this);\n PB_DS_ASSERT_VALID((*this))\n return It(ret_it);\n}\n\nPB_DS_CLASS_T_DEC\nbool\nPB_DS_CLASS_C_DEC::\nerase(key_const_reference r_key)\n{\n point_iterator it = find(r_key);\n if (it == end())\n return false;\n erase(it);\n return true;\n}\n#endif\n","include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/info_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{\n PB_DS_ASSERT_VALID((*this))\n return m_size;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_value_alloc.max_size(); }\n\nPB_DS_CLASS_T_DEC\n_GLIBCXX_NODISCARD\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return size() == 0; }\n#endif\n","include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/insert_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nreallocate_metadata(null_node_update_pointer, size_type)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\nvoid\nPB_DS_CLASS_C_DEC::\nreallocate_metadata(Node_Update_* , size_type new_size)\n{\n metadata_pointer a_new_metadata_vec =(new_size == 0) ? 0 : s_metadata_alloc.allocate(new_size);\n\n if (m_a_metadata != 0)\n {\n for (size_type i = 0; i < m_size; ++i)\n\tm_a_metadata[i].~metadata_type();\n s_metadata_alloc.deallocate(m_a_metadata, m_size);\n }\n std::swap(m_a_metadata, a_new_metadata_vec);\n}\n\n#endif\n","include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/iterators_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_const_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin() const\n{ return PB_DS_node_begin_imp(); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_const_iterator\nPB_DS_CLASS_C_DEC::\nnode_end() const\n{ return PB_DS_node_end_imp(); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin()\n{ return PB_DS_node_begin_imp(); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_end()\n{ return PB_DS_node_end_imp(); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_const_iterator\nPB_DS_CLASS_C_DEC::\nPB_DS_node_begin_imp() const\n{\n return node_const_iterator(const_cast<pointer>(mid_pointer(begin(), end())),\n\t\t\t const_cast<pointer>(begin()),\n\t\t\t const_cast<pointer>(end()),(m_a_metadata == 0)?\n\t\t\t 0 :\n\t\t\t mid_pointer(m_a_metadata, m_a_metadata + m_size));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_const_iterator\nPB_DS_CLASS_C_DEC::\nPB_DS_node_end_imp() const\n{\n return node_const_iterator(end(), end(), end(),\n\t\t (m_a_metadata == 0) ? 0 : m_a_metadata + m_size);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nPB_DS_node_begin_imp()\n{\n return node_iterator(mid_pointer(begin(), end()), begin(), end(),\n\t\t (m_a_metadata == 0) ? 0 : mid_pointer(m_a_metadata, m_a_metadata + m_size));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nPB_DS_node_end_imp()\n{\n return node_iterator(end(), end(),\n\t\t end(),(m_a_metadata == 0) ? 0 : m_a_metadata + m_size);\n}\n\n#endif\n","include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/node_iterators.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifndef PB_DS_OV_TREE_NODE_ITERATORS_HPP\n#define PB_DS_OV_TREE_NODE_ITERATORS_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC\t\\\n ov_tree_node_const_it_<Value_Type, Metadata_Type, _Alloc>\n\n /// Const node reference.\n template<typename Value_Type, typename Metadata_Type, typename _Alloc>\n class ov_tree_node_const_it_\n {\n\n protected:\n typedef typename rebind_traits<_Alloc, Value_Type>::pointer\n\tpointer;\n\n typedef typename rebind_traits<_Alloc, Value_Type>::const_pointer\n\tconst_pointer;\n\n typedef typename rebind_traits<_Alloc, Metadata_Type>::const_pointer\n\tconst_metadata_pointer;\n\n typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC this_type;\n\n protected:\n\n template<typename Ptr>\n inline static Ptr\n mid_pointer(Ptr p_begin, Ptr p_end)\n {\n\t_GLIBCXX_DEBUG_ASSERT(p_end >= p_begin);\n\treturn (p_begin + (p_end - p_begin) / 2);\n }\n\n public:\n\n typedef trivial_iterator_tag iterator_category;\n\n typedef trivial_iterator_difference_type difference_type;\n\n typedef typename rebind_traits<_Alloc, Value_Type>::const_pointer\n\tvalue_type;\n\n typedef typename rebind_traits<_Alloc,\n\t typename remove_const<Value_Type>::type>::const_pointer\n\treference;\n\n typedef typename rebind_traits<_Alloc, \n\t typename remove_const<Value_Type>::type>::const_pointer\n\tconst_reference;\n\n typedef Metadata_Type metadata_type;\n\n typedef typename rebind_traits<_Alloc, metadata_type>::const_reference\n\tmetadata_const_reference;\n\n public:\n inline\n ov_tree_node_const_it_(const_pointer p_nd = 0,\n\t\t\t const_pointer p_begin_nd = 0,\n\t\t\t const_pointer p_end_nd = 0,\n\t\t\t const_metadata_pointer p_metadata = 0)\n : m_p_value(const_cast<pointer>(p_nd)),\n\tm_p_begin_value(const_cast<pointer>(p_begin_nd)),\n\tm_p_end_value(const_cast<pointer>(p_end_nd)),\n\tm_p_metadata(p_metadata)\n { }\n\n inline const_reference\n operator*() const\n { return m_p_value; }\n\n inline metadata_const_reference\n get_metadata() const\n {\n\tenum\n\t {\n\t has_metadata = !is_same<Metadata_Type, null_type>::value\n\t };\n\n\tPB_DS_STATIC_ASSERT(should_have_metadata, has_metadata);\n\t_GLIBCXX_DEBUG_ASSERT(m_p_metadata != 0);\n\treturn *m_p_metadata;\n }\n\n /// Returns the node iterator associated with the left node.\n inline this_type\n get_l_child() const\n {\n\tif (m_p_begin_value == m_p_value)\n\t return (this_type(m_p_begin_value, m_p_begin_value, m_p_begin_value));\n\n\tconst_metadata_pointer p_begin_metadata =\n\t m_p_metadata - (m_p_value - m_p_begin_value);\n\n\treturn (this_type(mid_pointer(m_p_begin_value, m_p_value),\n\t\t\t m_p_begin_value,\n\t\t\t m_p_value,\n\t\t\t mid_pointer(p_begin_metadata, m_p_metadata)));\n }\n\n /// Returns the node iterator associated with the right node.\n inline this_type\n get_r_child() const\n {\n\tif (m_p_value == m_p_end_value)\n\t return (this_type(m_p_end_value, m_p_end_value, m_p_end_value));\n\n\tconst_metadata_pointer p_end_metadata =\n\t m_p_metadata + (m_p_end_value - m_p_value);\n\n\treturn (this_type(mid_pointer(m_p_value + 1, m_p_end_value),\n\t\t\t m_p_value + 1,\n\t\t\t m_p_end_value,(m_p_metadata == 0) ?\n\t\t\t 0 : mid_pointer(m_p_metadata + 1, p_end_metadata)));\n }\n\n inline bool\n operator==(const this_type& other) const\n {\n\tconst bool is_end = m_p_begin_value == m_p_end_value;\n\tconst bool is_other_end = other.m_p_begin_value == other.m_p_end_value;\n\n\tif (is_end)\n\t return (is_other_end);\n\n\tif (is_other_end)\n\t return (is_end);\n\n\treturn m_p_value == other.m_p_value;\n }\n\n inline bool\n operator!=(const this_type& other) const\n { return !operator==(other); }\n\n public:\n pointer m_p_value;\n pointer m_p_begin_value;\n pointer m_p_end_value;\n\n const_metadata_pointer m_p_metadata;\n };\n\n#define PB_DS_OV_TREE_NODE_ITERATOR_C_DEC \\\n ov_tree_node_it_<Value_Type, Metadata_Type, _Alloc>\n\n /// Node reference.\n template<typename Value_Type, typename Metadata_Type, typename _Alloc>\n class ov_tree_node_it_ : public PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC\n {\n private:\n typedef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC this_type;\n\n typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC base_type;\n\n typedef typename base_type::pointer pointer;\n\n typedef typename base_type::const_pointer const_pointer;\n\n typedef\n typename base_type::const_metadata_pointer\n const_metadata_pointer;\n\n public:\n typedef trivial_iterator_tag iterator_category;\n\n typedef trivial_iterator_difference_type difference_type;\n\n typedef typename rebind_traits<_Alloc, Value_Type>::pointer\n\tvalue_type;\n\n typedef typename rebind_traits<_Alloc,\n\t typename remove_const<Value_Type>::type>::pointer\n\treference;\n\n typedef typename rebind_traits<_Alloc, \n\t typename remove_const<Value_Type>::type>::pointer\n\tconst_reference;\n\n inline\n ov_tree_node_it_(const_pointer p_nd = 0, const_pointer p_begin_nd = 0, const_pointer p_end_nd = 0, const_metadata_pointer p_metadata = 0) : base_type(p_nd, p_begin_nd, p_end_nd, p_metadata)\n { }\n\n /// Access.\n inline reference\n operator*() const\n { return reference(base_type::m_p_value); }\n\n /// Returns the node reference associated with the left node.\n inline ov_tree_node_it_\n get_l_child() const\n {\n\tif (base_type::m_p_begin_value == base_type::m_p_value)\n\t return (this_type(base_type::m_p_begin_value, base_type::m_p_begin_value, base_type::m_p_begin_value));\n\n\tconst_metadata_pointer p_begin_metadata =\n\t base_type::m_p_metadata - (base_type::m_p_value - base_type::m_p_begin_value);\n\n\treturn (this_type(base_type::mid_pointer(base_type::m_p_begin_value, base_type::m_p_value),\n\t\t\t base_type::m_p_begin_value,\n\t\t\t base_type::m_p_value,\n\t\t\t base_type::mid_pointer(p_begin_metadata, base_type::m_p_metadata)));\n }\n\n /// Returns the node reference associated with the right node.\n inline ov_tree_node_it_\n get_r_child() const\n {\n\tif (base_type::m_p_value == base_type::m_p_end_value)\n\t return this_type(base_type::m_p_end_value, base_type::m_p_end_value, \n\t\t\t base_type::m_p_end_value);\n\n\tconst_metadata_pointer p_end_metadata =\n\t base_type::m_p_metadata + (base_type::m_p_end_value - base_type::m_p_value);\n\n\treturn (this_type(base_type::mid_pointer(base_type::m_p_value + 1, base_type::m_p_end_value),\n\t\t\t base_type::m_p_value + 1,\n\t\t\t base_type::m_p_end_value,(base_type::m_p_metadata == 0)?\n\t\t\t 0 : base_type::mid_pointer(base_type::m_p_metadata + 1, p_end_metadata)));\n }\n\n };\n\n#undef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC\n#undef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC\n\n} // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/ov_tree_map_.hpp\n * Contains an implementation class for ov_tree.\n */\n\n#include <map>\n#include <set>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/tree_trace_base.hpp>\n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/debug_map_base.hpp>\n#endif\n#include <utility>\n#include <functional>\n#include <algorithm>\n#include <vector>\n#include <assert.h>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_OV_TREE_NAME ov_tree_map\n#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_map\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_OV_TREE_NAME ov_tree_set\n#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_set\n#endif\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Mapped, typename Cmp_Fn, \\\n\t typename Node_And_It_Traits, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n PB_DS_OV_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>\n\n#define PB_DS_OV_TREE_TRAITS_BASE \\\n types_traits<Key, Mapped, _Alloc, false>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_DEBUG_MAP_BASE_C_DEC \\\n debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \\\n\t\t typename rebind_traits<_Alloc, Key>::const_reference>\n#endif\n\n#ifdef PB_DS_TREE_TRACE\n#define PB_DS_TREE_TRACE_BASE_C_DEC \\\n tree_trace_base<typename Node_And_It_Traits::node_const_iterator,\t\\\n\t\t typename Node_And_It_Traits::node_iterator,\t\t\\\n\t\t Cmp_Fn, false, _Alloc>\n#endif\n\n#ifndef PB_DS_CHECK_KEY_EXISTS\n# error Missing definition\n#endif\n\n /**\n * @brief Ordered-vector tree associative-container.\n * @ingroup branch-detail\n */\n template<typename Key, typename Mapped, typename Cmp_Fn,\n\t typename Node_And_It_Traits, typename _Alloc>\n class PB_DS_OV_TREE_NAME :\n#ifdef _GLIBCXX_DEBUG\n protected PB_DS_DEBUG_MAP_BASE_C_DEC,\n#endif\n#ifdef PB_DS_TREE_TRACE\n public PB_DS_TREE_TRACE_BASE_C_DEC,\n#endif\n public Cmp_Fn,\n public Node_And_It_Traits::node_update,\n public PB_DS_OV_TREE_TRAITS_BASE\n {\n private:\n typedef PB_DS_OV_TREE_TRAITS_BASE\t \t\ttraits_base;\n typedef Node_And_It_Traits\t\t\ttraits_type;\n\n typedef typename remove_const<typename traits_base::value_type>::type non_const_value_type;\n\n typedef rebind_traits<_Alloc, non_const_value_type> value_alloc_traits;\n typedef typename value_alloc_traits::allocator_type value_allocator;\n typedef typename value_alloc_traits::pointer\t value_vector;\n\n#ifdef _GLIBCXX_DEBUG\n typedef PB_DS_DEBUG_MAP_BASE_C_DEC \t\tdebug_base;\n#endif\n\n#ifdef PB_DS_TREE_TRACE\n typedef PB_DS_TREE_TRACE_BASE_C_DEC \t\ttrace_base;\n#endif\n\n typedef typename traits_base::pointer \t\tmapped_pointer_;\n typedef typename traits_base::const_pointer \tmapped_const_pointer_;\n\n typedef typename traits_type::metadata_type \tmetadata_type;\n\n typedef rebind_traits<_Alloc, metadata_type>\tmetadata_alloc_traits;\n typedef typename metadata_alloc_traits::allocator_type metadata_allocator;\n typedef typename metadata_alloc_traits::pointer\tmetadata_pointer;\n typedef typename metadata_alloc_traits::const_reference metadata_const_reference;\n typedef typename metadata_alloc_traits::reference\tmetadata_reference;\n\n typedef typename traits_type::null_node_update_pointer\n null_node_update_pointer;\n\n public:\n typedef ov_tree_tag \t\t\t\tcontainer_category;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \t\tdifference_type;\n typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n\n typedef typename traits_base::key_type \t\tkey_type;\n typedef typename traits_base::key_pointer \tkey_pointer;\n typedef typename traits_base::key_const_pointer \tkey_const_pointer;\n typedef typename traits_base::key_reference \tkey_reference;\n typedef typename traits_base::key_const_reference key_const_reference;\n typedef typename traits_base::mapped_type \tmapped_type;\n typedef typename traits_base::mapped_pointer \tmapped_pointer;\n typedef typename traits_base::mapped_const_pointer mapped_const_pointer;\n typedef typename traits_base::mapped_reference \tmapped_reference;\n typedef typename traits_base::mapped_const_reference mapped_const_reference;\n typedef typename traits_base::value_type \t\tvalue_type;\n typedef typename traits_base::pointer \t\tpointer;\n typedef typename traits_base::const_pointer \tconst_pointer;\n typedef typename traits_base::reference \t\treference;\n typedef typename traits_base::const_reference \tconst_reference;\n\n typedef const_pointer \t\t\t\tpoint_const_iterator;\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n typedef pointer \t\t\t\t\tpoint_iterator;\n#else\n typedef point_const_iterator \t\t\tpoint_iterator;\n#endif\n\n typedef point_iterator \t\t\t\titerator;\n typedef point_const_iterator \t\t\tconst_iterator;\n\n /// Conditional destructor.\n template<typename Size_Type>\n class cond_dtor\n {\n\tpublic:\n\t cond_dtor(value_vector a_vec, iterator& r_last_it, \n\t\t Size_Type total_size) \n\t : m_a_vec(a_vec), m_r_last_it(r_last_it), m_max_size(total_size),\n\t m_no_action(false)\n\t { }\n\n\t ~cond_dtor()\n\t {\n\t if (m_no_action)\n\t return;\n\t iterator it = m_a_vec;\n\t while (it != m_r_last_it)\n\t {\n\t\tit->~value_type();\n\t\t++it;\n\t }\n\t \n\t if (m_max_size > 0)\n\t value_allocator().deallocate(m_a_vec, m_max_size);\n\t }\n\n\t inline void\n\t set_no_action()\n\t { m_no_action = true; }\n\t \n\tprotected:\n\t value_vector \t\tm_a_vec;\n\t iterator& \t\tm_r_last_it;\n\t const Size_Type \tm_max_size;\n\t bool \t\t\tm_no_action;\n };\n \n typedef typename traits_type::node_update \tnode_update;\n typedef typename traits_type::node_iterator \tnode_iterator;\n typedef typename traits_type::node_const_iterator\tnode_const_iterator;\n\n\n PB_DS_OV_TREE_NAME();\n\n PB_DS_OV_TREE_NAME(const Cmp_Fn&);\n\n PB_DS_OV_TREE_NAME(const Cmp_Fn&, const node_update&);\n\n PB_DS_OV_TREE_NAME(const PB_DS_CLASS_C_DEC&);\n\n ~PB_DS_OV_TREE_NAME();\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n template<typename It>\n void\n copy_from_range(It, It);\n\n inline size_type\n max_size() const;\n\n _GLIBCXX_NODISCARD inline bool\n empty() const;\n\n inline size_type\n size() const;\n\n Cmp_Fn&\n get_cmp_fn();\n\n const Cmp_Fn&\n get_cmp_fn() const;\n\n inline mapped_reference\n operator[](key_const_reference r_key)\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\tPB_DS_ASSERT_VALID((*this))\n\tpoint_iterator it = lower_bound(r_key);\n\tif (it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))\n\t {\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t PB_DS_ASSERT_VALID((*this))\n\t return it->second;\n\t }\n\treturn insert_new_val(it, std::make_pair(r_key, mapped_type()))->second;\n#else\n\tinsert(r_key);\n\treturn traits_base::s_null_type;\n#endif\n }\n\n inline std::pair<point_iterator, bool>\n insert(const_reference r_value)\n {\n\tPB_DS_ASSERT_VALID((*this))\n\tkey_const_reference r_key = PB_DS_V2F(r_value);\n\tpoint_iterator it = lower_bound(r_key);\n\n\tif (it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))\n\t {\n\t PB_DS_ASSERT_VALID((*this))\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t return std::make_pair(it, false);\n\t }\n\n\treturn std::make_pair(insert_new_val(it, r_value), true);\n }\n\n inline point_iterator\n lower_bound(key_const_reference r_key)\n {\n\tpointer it = m_a_values;\n\tpointer e_it = m_a_values + m_size;\n\twhile (it != e_it)\n\t {\n\t pointer mid_it = it + ((e_it - it) >> 1);\n\t if (cmp_fn::operator()(PB_DS_V2F(*mid_it), r_key))\n\t it = ++mid_it;\n\t else\n\t e_it = mid_it;\n\t }\n\treturn it;\n }\n\n inline point_const_iterator\n lower_bound(key_const_reference r_key) const\n { return const_cast<PB_DS_CLASS_C_DEC& >(*this).lower_bound(r_key); }\n\n inline point_iterator\n upper_bound(key_const_reference r_key)\n {\n\titerator pot_it = lower_bound(r_key);\n\tif (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))\n\t {\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t return ++pot_it;\n\t }\n\n\tPB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\treturn pot_it;\n }\n\n inline point_const_iterator\n upper_bound(key_const_reference r_key) const\n { return const_cast<PB_DS_CLASS_C_DEC&>(*this).upper_bound(r_key); }\n\n inline point_iterator\n find(key_const_reference r_key)\n {\n\tPB_DS_ASSERT_VALID((*this))\n\titerator pot_it = lower_bound(r_key);\n\tif (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))\n\t {\n\t PB_DS_CHECK_KEY_EXISTS(r_key)\n\t return pot_it;\n\t }\n\n\tPB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n\treturn end();\n }\n\n inline point_const_iterator\n find(key_const_reference r_key) const\n { return (const_cast<PB_DS_CLASS_C_DEC&>(*this).find(r_key)); }\n\n bool\n erase(key_const_reference);\n\n template<typename Pred>\n inline size_type\n erase_if(Pred);\n\n inline iterator\n erase(iterator it)\n { return erase_imp<iterator>(it); }\n\n void\n clear();\n\n void\n join(PB_DS_CLASS_C_DEC&);\n\n void\n split(key_const_reference, PB_DS_CLASS_C_DEC&);\n\n inline iterator\n begin()\n { return m_a_values; }\n\n inline const_iterator\n begin() const\n { return m_a_values; }\n\n inline iterator\n end()\n { return m_end_it; }\n\n inline const_iterator\n end() const\n { return m_end_it; }\n\n /// Returns a const node_iterator corresponding to the node at the\n /// root of the tree.\n inline node_const_iterator\n node_begin() const;\n\n /// Returns a node_iterator corresponding to the node at the\n /// root of the tree.\n inline node_iterator\n node_begin();\n\n /// Returns a const node_iterator corresponding to a node just\n /// after a leaf of the tree.\n inline node_const_iterator\n node_end() const;\n\n /// Returns a node_iterator corresponding to a node just\n /// after a leaf of the tree.\n inline node_iterator\n node_end();\n\n private:\n\n inline void\n update(node_iterator, null_node_update_pointer);\n\n template<typename Node_Update>\n void\n update(node_iterator, Node_Update*);\n\n void\n reallocate_metadata(null_node_update_pointer, size_type);\n\n template<typename Node_Update_>\n void\n reallocate_metadata(Node_Update_*, size_type);\n\n template<typename It>\n void\n copy_from_ordered_range(It, It);\n\n void\n value_swap(PB_DS_CLASS_C_DEC&);\n\n template<typename It>\n void\n copy_from_ordered_range(It, It, It, It);\n\n template<typename Ptr>\n inline static Ptr\n mid_pointer(Ptr p_begin, Ptr p_end)\n {\n\t_GLIBCXX_DEBUG_ASSERT(p_end >= p_begin);\n\treturn (p_begin + (p_end - p_begin) / 2);\n }\n\n inline iterator\n insert_new_val(iterator it, const_reference r_value)\n {\n#ifdef PB_DS_REGRESSION\n\ttypename _Alloc::group_adjustor adjust(m_size);\n#endif\n\n\tPB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value))\n\n\tvalue_vector a_values = s_value_alloc.allocate(m_size + 1);\n\n\titerator source_it = begin();\n\titerator source_end_it = end();\n\titerator target_it = a_values;\n\titerator ret_it;\n\n\tcond_dtor<size_type> cd(a_values, target_it, m_size + 1);\n\twhile (source_it != it)\n\t {\n\t new (const_cast<void*>(static_cast<const void*>(target_it)))\n\t value_type(*source_it++);\n\t ++target_it;\n\t }\n\n\tnew (const_cast<void*>(static_cast<const void*>(ret_it = target_it)))\n\t value_type(r_value);\n\t++target_it;\n\n\twhile (source_it != source_end_it)\n\t {\n\t new (const_cast<void*>(static_cast<const void*>(target_it)))\n\t value_type(*source_it++);\n\t ++target_it;\n\t }\n\n\treallocate_metadata((node_update*)this, m_size + 1);\n\tcd.set_no_action();\n\tif (m_size != 0)\n\t {\n\t cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);\n\t }\n\n\t++m_size;\n\tm_a_values = a_values;\n\tm_end_it = m_a_values + m_size;\n\t_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value)));\n\tupdate(node_begin(), (node_update* )this);\n\tPB_DS_ASSERT_VALID((*this))\n\treturn ret_it;\n }\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n\n void\n assert_iterators(const char*, int) const;\n#endif\n\n template<typename It>\n It\n erase_imp(It);\n\n inline node_const_iterator\n PB_DS_node_begin_imp() const;\n\n inline node_const_iterator\n PB_DS_node_end_imp() const;\n\n inline node_iterator\n PB_DS_node_begin_imp();\n\n inline node_iterator\n PB_DS_node_end_imp();\n\n private:\n static value_allocator \ts_value_alloc;\n static metadata_allocator s_metadata_alloc;\n\n value_vector \t\tm_a_values;\n metadata_pointer \t\tm_a_metadata;\n iterator \t\t\tm_end_it;\n size_type \t\tm_size;\n };\n\n#include <ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_OV_TREE_NAME\n#undef PB_DS_OV_TREE_TRAITS_BASE\n#undef PB_DS_DEBUG_MAP_BASE_C_DEC\n#ifdef PB_DS_TREE_TRACE\n#undef PB_DS_TREE_TRACE_BASE_C_DEC\n#endif\n#undef PB_DS_CONST_NODE_ITERATOR_NAME\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/policy_access_fn_imps.hpp\n * Contains an implementation class for ov_tree.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nCmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Cmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn() const\n{ return *this; }\n#endif\n","include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/split_join_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n if (m_size == 0)\n {\n other.clear();\n return;\n }\n\n if (Cmp_Fn::operator()(r_key, PB_DS_V2F(*begin())))\n {\n value_swap(other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(*(end() - 1))))\n {\n return;\n }\n\n if (m_size == 1)\n {\n value_swap(other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n iterator it = upper_bound(r_key);\n PB_DS_CLASS_C_DEC new_other(other, other);\n new_other.copy_from_ordered_range(it, end());\n PB_DS_CLASS_C_DEC new_this(*this, *this);\n new_this.copy_from_ordered_range(begin(), it);\n\n // No exceptions from this point.\n other.update(other.node_begin(), (node_update*)(&other));\n update(node_begin(), (node_update*)this);\n other.value_swap(new_other);\n value_swap(new_this);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n if (other.m_size == 0)\n return;\n\n if (m_size == 0)\n {\n value_swap(other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n const bool greater = Cmp_Fn::operator()(PB_DS_V2F(*(end() - 1)),\n\t\t\t\t\t PB_DS_V2F(*other.begin()));\n\n const bool lesser = Cmp_Fn::operator()(PB_DS_V2F(*(other.end() - 1)),\n\t\t\t\t\t PB_DS_V2F(*begin()));\n\n if (!greater && !lesser)\n __throw_join_error();\n\n PB_DS_CLASS_C_DEC new_this(*this, *this);\n\n if (greater)\n new_this.copy_from_ordered_range(begin(), end(),\n\t\t\t\t other.begin(), other.end());\n else\n new_this.copy_from_ordered_range(other.begin(), other.end(),\n\t\t\t\t begin(), end());\n\n // No exceptions from this point.\n value_swap(new_this);\n other.clear();\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n#endif\n","include/ext/pb_ds/detail/ov_tree_map_/traits.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_/traits.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Tree traits.\n /// @ingroup traits\n template<typename Key,\n\t typename Mapped,\n\t class Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t class Node_Itr,\n\t\t class Cmp_Fn_,\n\t\t typename _Alloc_>\n class Node_Update,\n\t typename _Alloc>\n struct tree_traits<\n Key,\n Mapped,\n Cmp_Fn,\n Node_Update,\n ov_tree_tag,\n _Alloc>\n {\n private:\n typedef\n typename types_traits<\n Key,\n Mapped,\n _Alloc,\n false>::value_type\n value_type;\n\n public:\n typedef\n typename tree_node_metadata_dispatch<\n Key,\n Mapped,\n Cmp_Fn,\n Node_Update,\n _Alloc>::type\n metadata_type;\n\n /// This is an iterator to an iterator: it iterates over nodes,\n /// and de-referencing it returns one of the tree's iterators.\n typedef\n ov_tree_node_const_it_<\n\tvalue_type,\n\tmetadata_type,\n\t_Alloc>\n node_const_iterator;\n\n typedef\n ov_tree_node_it_<\n\tvalue_type,\n\tmetadata_type,\n\t_Alloc>\n node_iterator;\n\n typedef\n Node_Update<\n\tnode_const_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\t_Alloc>\n node_update;\n\n typedef\n __gnu_pbds::null_node_update<\n\tnode_const_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\t_Alloc>* \n null_node_update_pointer;\n };\n\n\n /// Specialization.\n /// @ingroup traits\n template<typename Key,\n\t class Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t class Node_Itr,\n\t\t class Cmp_Fn_,\n\t\t typename _Alloc_>\n class Node_Update,\n\t typename _Alloc>\n struct tree_traits<\n Key,\n null_type,\n Cmp_Fn,\n Node_Update,\n ov_tree_tag,\n _Alloc>\n {\n private:\n typedef\n typename types_traits<\n Key,\n null_type,\n _Alloc,\n false>::value_type\n value_type;\n\n public:\n typedef\n typename tree_node_metadata_dispatch<\n Key,\n null_type,\n Cmp_Fn,\n Node_Update,\n _Alloc>::type\n metadata_type;\n\n /// This is an iterator to an iterator: it iterates over nodes,\n /// and de-referencing it returns one of the tree's iterators.\n typedef\n ov_tree_node_const_it_<\n\tvalue_type,\n\tmetadata_type,\n\t_Alloc>\n node_const_iterator;\n\n typedef node_const_iterator node_iterator;\n\n typedef\n Node_Update<\n\tnode_const_iterator,\n\tnode_const_iterator,\n\tCmp_Fn,\n\t_Alloc>\n node_update;\n\n typedef\n __gnu_pbds::null_node_update<\n\tnode_const_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\t_Alloc>* \n null_node_update_pointer;\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP\n\n","include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pairing_heap_/constructors_destructor_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n push(*(first_it++));\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\npairing_heap()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\npairing_heap(const Cmp_Fn& r_cmp_fn)\n: base_type(r_cmp_fn)\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\npairing_heap(const PB_DS_CLASS_C_DEC& other)\n: base_type(other)\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n base_type::swap(other);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~pairing_heap()\n{ }\n#endif\n","include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pairing_heap_/debug_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n PB_DS_DEBUG_VERIFY(base_type::m_p_root == 0 \n\t\t || base_type::m_p_root->m_p_next_sibling == 0);\n base_type::assert_valid(__file, __line);\n}\n\n#endif \n#endif\n","include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pairing_heap_/erase_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\npop()\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n node_pointer p_new_root = join_node_children(base_type::m_p_root);\n PB_DS_ASSERT_NODE_CONSISTENT(p_new_root, false)\n if (p_new_root != 0)\n p_new_root->m_p_prev_or_parent = 0;\n\n base_type::actual_erase_node(base_type::m_p_root);\n base_type::m_p_root = p_new_root;\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n remove_node(it.m_p_nd);\n base_type::actual_erase_node(it.m_p_nd);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nremove_node(node_pointer p_nd)\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n node_pointer p_new_child = join_node_children(p_nd);\n\n PB_DS_ASSERT_NODE_CONSISTENT(p_new_child, false)\n\n if (p_nd == base_type::m_p_root)\n {\n if (p_new_child != 0)\n\tp_new_child->m_p_prev_or_parent = 0;\n base_type::m_p_root = p_new_child;\n PB_DS_ASSERT_NODE_CONSISTENT(base_type::m_p_root, false)\n return;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent != 0);\n if (p_nd->m_p_prev_or_parent->m_p_l_child == p_nd)\n {\n if (p_new_child != 0)\n {\n\t p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n\t p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;\n\t if (p_new_child->m_p_next_sibling != 0)\n\t p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;\n\t p_nd->m_p_prev_or_parent->m_p_l_child = p_new_child;\n\t PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false)\n return;\n }\n\n p_nd->m_p_prev_or_parent->m_p_l_child = p_nd->m_p_next_sibling;\n if (p_nd->m_p_next_sibling != 0)\n\tp_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false)\n return;\n }\n\n if (p_new_child != 0)\n {\n p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;\n if (p_new_child->m_p_next_sibling != 0)\n\tp_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;\n p_new_child->m_p_prev_or_parent->m_p_next_sibling = p_new_child;\n PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false)\n return;\n }\n\n p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;\n if (p_nd->m_p_next_sibling != 0)\n p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n PB_DS_ASSERT_NODE_CONSISTENT(p_nd->m_p_prev_or_parent, false)\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\njoin_node_children(node_pointer p_nd)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n node_pointer p_ret = p_nd->m_p_l_child;\n if (p_ret == 0)\n return 0;\n while (p_ret->m_p_next_sibling != 0)\n p_ret = forward_join(p_ret, p_ret->m_p_next_sibling);\n while (p_ret->m_p_prev_or_parent != p_nd)\n p_ret = back_join(p_ret->m_p_prev_or_parent, p_ret);\n PB_DS_ASSERT_NODE_CONSISTENT(p_ret, false)\n return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nforward_join(node_pointer p_nd, node_pointer p_next)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == p_next);\n if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))\n {\n p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n base_type::make_child_of(p_nd, p_next);\n return p_next->m_p_next_sibling == 0 \n\t? p_next : p_next->m_p_next_sibling;\n }\n\n if (p_next->m_p_next_sibling != 0)\n {\n p_next->m_p_next_sibling->m_p_prev_or_parent = p_nd;\n p_nd->m_p_next_sibling = p_next->m_p_next_sibling;\n base_type::make_child_of(p_next, p_nd);\n return p_nd->m_p_next_sibling;\n }\n\n p_nd->m_p_next_sibling = 0;\n base_type::make_child_of(p_next, p_nd);\n PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false)\n return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nback_join(node_pointer p_nd, node_pointer p_next)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == 0);\n\n if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))\n {\n p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n base_type::make_child_of(p_nd, p_next);\n PB_DS_ASSERT_NODE_CONSISTENT(p_next, false)\n return p_next;\n }\n\n p_nd->m_p_next_sibling = 0;\n base_type::make_child_of(p_next, p_nd);\n PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false)\n return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n PB_DS_ASSERT_VALID((*this))\n if (base_type::empty())\n {\n PB_DS_ASSERT_VALID((*this))\n\treturn 0;\n }\n base_type::to_linked_list();\n node_pointer p_out = base_type::prune(pred);\n size_type ersd = 0;\n while (p_out != 0)\n {\n ++ersd;\n node_pointer p_next = p_out->m_p_next_sibling;\n base_type::actual_erase_node(p_out);\n p_out = p_next;\n }\n\n node_pointer p_cur = base_type::m_p_root;\n base_type::m_p_root = 0;\n while (p_cur != 0)\n {\n node_pointer p_next = p_cur->m_p_next_sibling;\n p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = 0;\n\n push_imp(p_cur);\n p_cur = p_next;\n }\n PB_DS_ASSERT_VALID((*this))\n return ersd;\n}\n\n#endif\n","include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pairing_heap_/find_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop() const\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n return base_type::m_p_root->m_value;\n}\n#endif\n","include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pairing_heap_/insert_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n PB_DS_ASSERT_VALID((*this))\n node_pointer p_new_nd = base_type::get_new_node_for_insert(r_val);\n push_imp(p_new_nd);\n PB_DS_ASSERT_VALID((*this))\n return point_iterator(p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\npush_imp(node_pointer p_nd)\n{\n p_nd->m_p_l_child = 0;\n if (base_type::m_p_root == 0)\n {\n p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0;\n base_type::m_p_root = p_nd;\n }\n else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))\n {\n p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0;\n base_type::make_child_of(base_type::m_p_root, p_nd);\n PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false)\n base_type::m_p_root = p_nd;\n }\n else\n {\n base_type::make_child_of(p_nd, base_type::m_p_root);\n PB_DS_ASSERT_NODE_CONSISTENT(base_type::m_p_root, false)\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n PB_DS_ASSERT_VALID((*this))\n remove_node(it.m_p_nd);\n it.m_p_nd->m_value = r_new_val;\n push_imp(it.m_p_nd);\n PB_DS_ASSERT_VALID((*this))\n}\n#endif\n","include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pairing_heap_/pairing_heap_.hpp\n * Contains an implementation class for a pairing heap.\n */\n\n/*\n * Pairing heap:\n * Michael L. Fredman, Robert Sedgewick, Daniel Dominic Sleator,\n * and Robert Endre Tarjan, The Pairing Heap:\n * A New Form of Self-Adjusting Heap, Algorithmica, 1(1):111-129, 1986.\n */\n\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_CLASS_T_DEC \\\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n pairing_heap<Value_Type, Cmp_Fn, _Alloc>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_P_HEAP_BASE \\\n left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc, false>\n#else\n#define PB_DS_P_HEAP_BASE \\\n left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc>\n#endif\n\n /**\n * Pairing heap.\n *\n * @ingroup heap-detail\n */\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n class pairing_heap : public PB_DS_P_HEAP_BASE\n {\n private:\n typedef PB_DS_P_HEAP_BASE\t\t\t\tbase_type;\n typedef typename base_type::node_pointer \t\tnode_pointer;\n\n typedef rebind_traits<_Alloc, Value_Type>\t\t__rebind_a;\n\n public:\n typedef Value_Type \t\t\t\tvalue_type;\n typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \t\tdifference_type;\n\n typedef typename __rebind_a::pointer \t\tpointer;\n typedef typename __rebind_a::const_pointer \tconst_pointer;\n typedef typename __rebind_a::reference\t\treference;\n typedef typename __rebind_a::const_reference \tconst_reference;\n\n typedef typename base_type::point_const_iterator\tpoint_const_iterator;\n typedef typename base_type::point_iterator \tpoint_iterator;\n typedef typename base_type::const_iterator \tconst_iterator;\n typedef typename base_type::iterator \t\titerator;\n\n pairing_heap();\n\n pairing_heap(const Cmp_Fn&);\n\n pairing_heap(const pairing_heap&);\n\n void\n swap(pairing_heap&);\n\n ~pairing_heap();\n\n inline point_iterator\n push(const_reference);\n\n void\n modify(point_iterator, const_reference);\n\n inline const_reference\n top() const;\n\n void\n pop();\n\n void\n erase(point_iterator);\n\n template<typename Pred>\n size_type\n erase_if(Pred);\n\n template<typename Pred>\n void\n split(Pred, pairing_heap&);\n\n void\n join(pairing_heap&);\n\n protected:\n\n template<typename It>\n void\n copy_from_range(It, It);\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n#endif\n\n private:\n\n inline void\n push_imp(node_pointer);\n\n node_pointer\n join_node_children(node_pointer);\n\n node_pointer\n forward_join(node_pointer, node_pointer);\n\n node_pointer\n back_join(node_pointer, node_pointer);\n\n void\n remove_node(node_pointer);\n };\n\n#define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool) \\\n _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, _Bool,\t\\\n\t\t\t\t\t\t __FILE__, __LINE__);)\n\n#include <ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp>\n\n#undef PB_DS_ASSERT_NODE_CONSISTENT\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_P_HEAP_BASE\n\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pairing_heap_/split_join_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n other.clear();\n\n if (base_type::empty())\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n base_type::to_linked_list();\n node_pointer p_out = base_type::prune(pred);\n while (p_out != 0)\n {\n _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);\n --base_type::m_size;\n ++other.m_size;\n node_pointer p_next = p_out->m_p_next_sibling;\n p_out->m_p_l_child = p_out->m_p_next_sibling = p_out->m_p_prev_or_parent = 0;\n\n other.push_imp(p_out);\n p_out = p_next;\n }\n\n PB_DS_ASSERT_VALID(other)\n node_pointer p_cur = base_type::m_p_root;\n base_type::m_p_root = 0;\n while (p_cur != 0)\n {\n node_pointer p_next = p_cur->m_p_next_sibling;\n p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = 0;\n\n push_imp(p_cur);\n p_cur = p_next;\n }\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n if (other.m_p_root == 0)\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n if (base_type::m_p_root == 0)\n base_type::m_p_root = other.m_p_root;\n else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, other.m_p_root->m_value))\n {\n base_type::make_child_of(base_type::m_p_root, other.m_p_root);\n PB_DS_ASSERT_NODE_CONSISTENT(other.m_p_root, false)\n base_type::m_p_root = other.m_p_root;\n }\n else\n {\n base_type::make_child_of(other.m_p_root, base_type::m_p_root);\n PB_DS_ASSERT_NODE_CONSISTENT(base_type::m_p_root, false)\n }\n\n base_type::m_size += other.m_size;\n other.m_p_root = 0;\n other.m_size = 0;\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n#endif\n","include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp":" // -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/constructors_destructor_fn_imps.hpp\n * Contains an implementation class for pat_trie.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::head_allocator\nPB_DS_CLASS_C_DEC::s_head_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::inode_allocator\nPB_DS_CLASS_C_DEC::s_inode_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::leaf_allocator\nPB_DS_CLASS_C_DEC::s_leaf_allocator;\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_PAT_TRIE_NAME() :\n m_p_head(s_head_allocator.allocate(1)),\n m_size(0)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_PAT_TRIE_NAME(const access_traits& r_access_traits) :\n synth_access_traits(r_access_traits),\n m_p_head(s_head_allocator.allocate(1)),\n m_size(0)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC& other) :\n#ifdef _GLIBCXX_DEBUG\n debug_base(other),\n#endif\n synth_access_traits(other),\n node_update(other),\n m_p_head(s_head_allocator.allocate(1)),\n m_size(0)\n{\n initialize();\n m_size = other.m_size;\n PB_DS_ASSERT_VALID(other)\n if (other.m_p_head->m_p_parent == 0)\n {\n\tPB_DS_ASSERT_VALID((*this))\n\treturn;\n }\n __try\n {\n m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);\n }\n __catch(...)\n {\n s_head_allocator.deallocate(m_p_head, 1);\n __throw_exception_again;\n }\n\n m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);\n m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);\n m_p_head->m_p_parent->m_p_parent = m_p_head;\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n value_swap(other);\n std::swap((access_traits& )(*this), (access_traits& )other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)\n std::swap(m_p_head, other.m_p_head);\n std::swap(m_size, other.m_size);\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_PAT_TRIE_NAME()\n{\n clear();\n s_head_allocator.deallocate(m_p_head, 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{\n new (m_p_head) head();\n m_p_head->m_p_parent = 0;\n m_p_head->m_p_min = m_p_head;\n m_p_head->m_p_max = m_p_head;\n m_size = 0;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrecursive_copy_node(node_const_pointer p_ncp)\n{\n _GLIBCXX_DEBUG_ASSERT(p_ncp != 0);\n if (p_ncp->m_type == leaf_node)\n {\n leaf_const_pointer p_other_lf = static_cast<leaf_const_pointer>(p_ncp);\n leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);\n cond_dealtor cond(p_new_lf);\n new (p_new_lf) leaf(p_other_lf->value());\n apply_update(p_new_lf, (node_update*)this);\n cond.set_no_action_dtor();\n return (p_new_lf);\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_ncp->m_type == i_node);\n node_pointer a_p_children[inode::arr_size];\n size_type child_i = 0;\n inode_const_pointer p_icp = static_cast<inode_const_pointer>(p_ncp);\n\n typename inode::const_iterator child_it = p_icp->begin();\n\n inode_pointer p_ret;\n __try\n {\n while (child_it != p_icp->end())\n\t{\n\t a_p_children[child_i] = recursive_copy_node(*(child_it));\n\t child_i++;\n\t child_it++;\n\t}\n p_ret = s_inode_allocator.allocate(1);\n }\n __catch(...)\n {\n while (child_i-- > 0)\n\tclear_imp(a_p_children[child_i]);\n __throw_exception_again;\n }\n\n new (p_ret) inode(p_icp->get_e_ind(), pref_begin(a_p_children[0]));\n\n --child_i;\n _GLIBCXX_DEBUG_ASSERT(child_i >= 1);\n do\n p_ret->add_child(a_p_children[child_i], pref_begin(a_p_children[child_i]),\n\t\t pref_end(a_p_children[child_i]), this);\n while (child_i-- > 0);\n apply_update(p_ret, (node_update*)this);\n return p_ret;\n}\n#endif\n","include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/debug_fn_imps.hpp\n * Contains an implementation class for pat_trie_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n if (m_p_head->m_p_parent != 0)\n m_p_head->m_p_parent->assert_valid(this, __file, __line);\n assert_iterators(__file, __line);\n assert_reverse_iterators(__file, __line);\n if (m_p_head->m_p_parent == 0)\n {\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_min == m_p_head);\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_max == m_p_head);\n PB_DS_DEBUG_VERIFY(empty());\n return;\n }\n\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_min->m_type == leaf_node);\n PB_DS_DEBUG_VERIFY(m_p_head->m_p_max->m_type == leaf_node);\n PB_DS_DEBUG_VERIFY(!empty());\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_iterators(const char* __file, int __line) const\n{\n size_type calc_size = 0;\n for (const_iterator it = begin(); it != end(); ++it)\n {\n ++calc_size;\n debug_base::check_key_exists(PB_DS_V2F(*it), __file, __line);\n PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)) == it);\n PB_DS_DEBUG_VERIFY(--upper_bound(PB_DS_V2F(*it)) == it);\n }\n PB_DS_DEBUG_VERIFY(calc_size == m_size);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_reverse_iterators(const char* __file, int __line) const\n{\n size_type calc_size = 0;\n for (const_reverse_iterator it = rbegin(); it != rend(); ++it)\n {\n ++calc_size;\n node_const_pointer p_nd =\n\tconst_cast<PB_DS_CLASS_C_DEC*>(this)->find_imp(PB_DS_V2F(*it));\n PB_DS_DEBUG_VERIFY(p_nd == it.m_p_nd);\n }\n PB_DS_DEBUG_VERIFY(calc_size == m_size);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nrecursive_count_leafs(node_const_pointer p_nd, const char* __file, int __line)\n{\n if (p_nd == 0)\n return (0);\n if (p_nd->m_type == leaf_node)\n return (1);\n PB_DS_DEBUG_VERIFY(p_nd->m_type == i_node);\n size_type ret = 0;\n for (typename inode::const_iterator it = static_cast<inode_const_pointer>(p_nd)->begin();\n it != static_cast<inode_const_pointer>(p_nd)->end();\n ++it)\n ret += recursive_count_leafs(*it, __file, __line);\n return ret;\n}\n\n#endif\n#endif\n","include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/erase_fn_imps.hpp\n * Contains an implementation class for pat_trie.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(key_const_reference r_key)\n{\n node_pointer p_nd = find_imp(r_key);\n if (p_nd == 0 || p_nd->m_type == i_node)\n {\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return false;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);\n if (!synth_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key))\n {\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return false;\n }\n\n PB_DS_CHECK_KEY_EXISTS(r_key)\n erase_leaf(static_cast<leaf_pointer>(p_nd));\n PB_DS_ASSERT_VALID((*this))\n return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_fixup(inode_pointer p_nd)\n{\n _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) >= 1);\n if (std::distance(p_nd->begin(), p_nd->end()) == 1)\n {\n node_pointer p_parent = p_nd->m_p_parent;\n if (p_parent == m_p_head)\n\tm_p_head->m_p_parent = *p_nd->begin();\n else\n\t{\n\t _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node);\n\t node_pointer p_new_child = *p_nd->begin();\n\n\t typedef inode_pointer inode_ptr;\n\t inode_ptr p_internal = static_cast<inode_ptr>(p_parent);\n\t p_internal->replace_child(p_new_child, pref_begin(p_new_child),\n\t\t\t\t pref_end(p_new_child), this);\n\t}\n (*p_nd->begin())->m_p_parent = p_nd->m_p_parent;\n p_nd->~inode();\n s_inode_allocator.deallocate(p_nd, 1);\n\n if (p_parent == m_p_head)\n\treturn;\n\n _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node);\n p_nd = static_cast<inode_pointer>(p_parent);\n }\n\n while (true)\n {\n _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) > 1);\n p_nd->update_prefixes(this);\n apply_update(p_nd, (node_update*)this);\n PB_DS_ASSERT_NODE_VALID(p_nd)\n if (p_nd->m_p_parent->m_type == head_node)\n\treturn;\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent->m_type == i_node);\n\n p_nd = static_cast<inode_pointer>(p_nd->m_p_parent);\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_leaf(leaf_pointer p_l)\n{\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n --m_size;\n _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->value())));\n p_l->~leaf();\n s_leaf_allocator.deallocate(p_l, 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n if (!empty())\n {\n clear_imp(m_p_head->m_p_parent);\n m_size = 0;\n initialize();\n _GLIBCXX_DEBUG_ONLY(debug_base::clear();)\n PB_DS_ASSERT_VALID((*this))\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n if (p_nd->m_type == i_node)\n {\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);\n for (typename inode::iterator it =\n\t static_cast<inode_pointer>(p_nd)->begin();\n\t it != static_cast<inode_pointer>(p_nd)->end();\n\t ++it)\n\t{\n\t node_pointer p_child =* it;\n\t clear_imp(p_child);\n\t}\n s_inode_allocator.deallocate(static_cast<inode_pointer>(p_nd), 1);\n return;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);\n static_cast<leaf_pointer>(p_nd)->~leaf();\n s_leaf_allocator.deallocate(static_cast<leaf_pointer>(p_nd), 1);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nerase(const_iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n\n if (it == end())\n return it;\n\n const_iterator ret_it = it;\n ++ret_it;\n _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);\n erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));\n PB_DS_ASSERT_VALID((*this))\n return ret_it;\n}\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nerase(iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n\n if (it == end())\n return it;\n iterator ret_it = it;\n ++ret_it;\n _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);\n erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));\n PB_DS_ASSERT_VALID((*this))\n return ret_it;\n}\n#endif // #ifdef PB_DS_DATA_TRUE_INDICATOR\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nerase(const_reverse_iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n\n if (it.m_p_nd == m_p_head)\n return it;\n const_reverse_iterator ret_it = it;\n ++ret_it;\n\n _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);\n erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));\n PB_DS_ASSERT_VALID((*this))\n return ret_it;\n}\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nerase(reverse_iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n\n if (it.m_p_nd == m_p_head)\n return it;\n reverse_iterator ret_it = it;\n ++ret_it;\n\n _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);\n erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));\n PB_DS_ASSERT_VALID((*this))\n return ret_it;\n}\n#endif // #ifdef PB_DS_DATA_TRUE_INDICATOR\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n size_type num_ersd = 0;\n PB_DS_ASSERT_VALID((*this))\n\n iterator it = begin();\n while (it != end())\n {\n PB_DS_ASSERT_VALID((*this))\n if (pred(*it))\n\t{\n\t ++num_ersd;\n\t it = erase(it);\n\t}\n else\n\t++it;\n }\n\n PB_DS_ASSERT_VALID((*this))\n return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_leaf(leaf_pointer p_l)\n{\n update_min_max_for_erased_leaf(p_l);\n if (p_l->m_p_parent->m_type == head_node)\n {\n _GLIBCXX_DEBUG_ASSERT(size() == 1);\n clear();\n return;\n }\n\n _GLIBCXX_DEBUG_ASSERT(size() > 1);\n _GLIBCXX_DEBUG_ASSERT(p_l->m_p_parent->m_type == i_node);\n\n inode_pointer p_parent = static_cast<inode_pointer>(p_l->m_p_parent);\n\n p_parent->remove_child(p_l);\n erase_fixup(p_parent);\n actual_erase_leaf(p_l);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_erased_leaf(leaf_pointer p_l)\n{\n if (m_size == 1)\n {\n m_p_head->m_p_min = m_p_head;\n m_p_head->m_p_max = m_p_head;\n return;\n }\n\n if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_min))\n {\n iterator it(p_l);\n ++it;\n m_p_head->m_p_min = it.m_p_nd;\n return;\n }\n\n if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_max))\n {\n iterator it(p_l);\n --it;\n m_p_head->m_p_max = it.m_p_nd;\n }\n}\n#endif\n","include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/find_fn_imps.hpp\n * Contains an implementation class for pat_trie.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key)\n{\n PB_DS_ASSERT_VALID((*this))\n node_pointer p_nd = find_imp(r_key);\n\n if (p_nd == 0 || p_nd->m_type != leaf_node)\n {\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return end();\n }\n\n if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))\n {\n PB_DS_CHECK_KEY_EXISTS(r_key)\n return iterator(p_nd);\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return end();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key) const\n{\n PB_DS_ASSERT_VALID((*this))\n\n node_const_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);\n\n if (p_nd == 0 || p_nd->m_type != leaf_node)\n {\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return end();\n }\n\n if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))\n {\n PB_DS_CHECK_KEY_EXISTS(r_key)\n return const_iterator(const_cast<node_pointer>(p_nd));\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)\n return end();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nfind_imp(key_const_reference r_key)\n{\n if (empty())\n return 0;\n\n typename synth_access_traits::const_iterator b_it =\n synth_access_traits::begin(r_key);\n typename synth_access_traits::const_iterator e_it =\n synth_access_traits::end(r_key);\n\n node_pointer p_nd = m_p_head->m_p_parent;\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n\n while (p_nd->m_type != leaf_node)\n {\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);\n node_pointer p_next_nd = static_cast<inode_pointer>(p_nd)->get_child_node(b_it, e_it, this);\n\n if (p_next_nd == 0)\n\treturn p_nd;\n p_nd = p_next_nd;\n }\n return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nlower_bound_imp(key_const_reference r_key)\n{\n if (empty())\n return (m_p_head);\n\n node_pointer p_nd = m_p_head->m_p_parent;\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n\n typename PB_DS_CLASS_C_DEC::a_const_iterator b_it =\n synth_access_traits::begin(r_key);\n\n typename PB_DS_CLASS_C_DEC::a_const_iterator e_it =\n synth_access_traits::end(r_key);\n\n size_type checked_ind = 0;\n while (true)\n {\n if (p_nd->m_type == leaf_node)\n {\n\t if (!synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))\n\t return p_nd;\n\t iterator it(p_nd);\n\t ++it;\n\t return it.m_p_nd;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);\n const size_type new_checked_ind =\n\tstatic_cast<inode_pointer>(p_nd)->get_e_ind();\n\n p_nd =\n\tstatic_cast<inode_pointer>(p_nd)->get_lower_bound_child_node( b_it, e_it, checked_ind, this);\n checked_ind = new_checked_ind;\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nlower_bound(key_const_reference r_key)\n{ return point_iterator(lower_bound_imp(r_key)); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nlower_bound(key_const_reference r_key) const\n{\n return point_const_iterator(const_cast<PB_DS_CLASS_C_DEC* >(this)->lower_bound_imp(r_key));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nupper_bound(key_const_reference r_key)\n{\n point_iterator l_bound_it = lower_bound(r_key);\n\n _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||\n\t\t !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),\n\t\t\t\t\t\t r_key));\n\n if (l_bound_it == end() ||\n synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))\n return l_bound_it;\n\n return ++l_bound_it;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nupper_bound(key_const_reference r_key) const\n{\n point_const_iterator l_bound_it = lower_bound(r_key);\n\n _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||\n\t\t !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),\n\t\t\t\t\t\t r_key));\n\n if (l_bound_it == end() ||\n synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))\n return l_bound_it;\n return ++l_bound_it;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::a_const_iterator\nPB_DS_CLASS_C_DEC::\npref_begin(node_const_pointer p_nd)\n{\n if (p_nd->m_type == leaf_node)\n return (synth_access_traits::begin(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value())));\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);\n return static_cast<inode_const_pointer>(p_nd)->pref_b_it();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::a_const_iterator\nPB_DS_CLASS_C_DEC::\npref_end(node_const_pointer p_nd)\n{\n if (p_nd->m_type == leaf_node)\n return (synth_access_traits::end(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value())));\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);\n return static_cast<inode_const_pointer>(p_nd)->pref_e_it();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::leaf_const_pointer\nPB_DS_CLASS_C_DEC::\nleftmost_descendant(node_const_pointer p_nd)\n{\n if (p_nd->m_type == leaf_node)\n return static_cast<leaf_const_pointer>(p_nd);\n return static_cast<inode_const_pointer>(p_nd)->leftmost_descendant();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::leaf_pointer\nPB_DS_CLASS_C_DEC::\nleftmost_descendant(node_pointer p_nd)\n{\n if (p_nd->m_type == leaf_node)\n return static_cast<leaf_pointer>(p_nd);\n return static_cast<inode_pointer>(p_nd)->leftmost_descendant();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::leaf_const_pointer\nPB_DS_CLASS_C_DEC::\nrightmost_descendant(node_const_pointer p_nd)\n{\n if (p_nd->m_type == leaf_node)\n return static_cast<leaf_const_pointer>(p_nd);\n return static_cast<inode_const_pointer>(p_nd)->rightmost_descendant();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::leaf_pointer\nPB_DS_CLASS_C_DEC::\nrightmost_descendant(node_pointer p_nd)\n{\n if (p_nd->m_type == leaf_node)\n return static_cast<leaf_pointer>(p_nd);\n return static_cast<inode_pointer>(p_nd)->rightmost_descendant();\n}\n\n#endif\n","include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/info_fn_imps.hpp\n * Contains an implementation class for pat_trie.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\n_GLIBCXX_NODISCARD\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (m_size == 0); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return m_size; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_inode_allocator.max_size(); }\n\n#endif\n","include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/insert_join_fn_imps.hpp\n * Contains an implementation class for pat_trie.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n branch_bag bag;\n if (!join_prep(other, bag))\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent,\n\t\t\t\t other.m_p_head->m_p_parent, 0, bag);\n\n m_p_head->m_p_parent->m_p_parent = m_p_head;\n m_size += other.m_size;\n other.initialize();\n PB_DS_ASSERT_VALID(other)\n m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);\n m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nbool\nPB_DS_CLASS_C_DEC::\njoin_prep(PB_DS_CLASS_C_DEC& other, branch_bag& r_bag)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n if (other.m_size == 0)\n return false;\n\n if (m_size == 0)\n {\n value_swap(other);\n return false;\n }\n\n const bool greater =\n synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()),\n\t\t\t\t PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_min)->value()));\n\n const bool lesser =\n synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_max)->value()),\n\t\t\t\t PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value()));\n\n if (!greater && !lesser)\n __throw_join_error();\n\n rec_join_prep(m_p_head->m_p_parent, other.m_p_head->m_p_parent, r_bag);\n _GLIBCXX_DEBUG_ONLY(debug_base::join(other, false);)\n return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(node_const_pointer p_l, node_const_pointer p_r, \n\t branch_bag& r_bag)\n{\n if (p_l->m_type == leaf_node)\n {\n if (p_r->m_type == leaf_node)\n\t{\n\t rec_join_prep(static_cast<leaf_const_pointer>(p_l),\n\t\t\tstatic_cast<leaf_const_pointer>(p_r), r_bag);\n\t return;\n\t}\n\n _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);\n rec_join_prep(static_cast<leaf_const_pointer>(p_l),\n\t\t static_cast<inode_const_pointer>(p_r), r_bag);\n return;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node);\n if (p_r->m_type == leaf_node)\n {\n rec_join_prep(static_cast<inode_const_pointer>(p_l),\n\t\t static_cast<leaf_const_pointer>(p_r), r_bag);\n return;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);\n\n rec_join_prep(static_cast<inode_const_pointer>(p_l),\n\t\tstatic_cast<inode_const_pointer>(p_r), r_bag);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(leaf_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/,\n\t branch_bag& r_bag)\n{ r_bag.add_branch(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(leaf_const_pointer /*p_l*/, inode_const_pointer /*p_r*/,\n\t branch_bag& r_bag)\n{ r_bag.add_branch(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(inode_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/,\n\t branch_bag& r_bag)\n{ r_bag.add_branch(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(inode_const_pointer p_l, inode_const_pointer p_r,\n\t branch_bag& r_bag)\n{\n if (p_l->get_e_ind() == p_r->get_e_ind() &&\n synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),\n\t\t\t\t\t p_r->pref_b_it(), p_r->pref_e_it()))\n {\n for (typename inode::const_iterator it = p_r->begin();\n\t it != p_r->end(); ++ it)\n\t{\n\t node_const_pointer p_l_join_child = p_l->get_join_child(*it, this);\n\t if (p_l_join_child != 0)\n\t rec_join_prep(p_l_join_child, * it, r_bag);\n\t}\n return;\n }\n\n if (p_r->get_e_ind() < p_l->get_e_ind() &&\n p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))\n {\n node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this);\n if (p_r_join_child != 0)\n\trec_join_prep(p_r_join_child, p_l, r_bag);\n return;\n }\n\n if (p_r->get_e_ind() < p_l->get_e_ind() &&\n p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))\n {\n node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this);\n if (p_r_join_child != 0)\n\trec_join_prep(p_r_join_child, p_l, r_bag);\n return;\n }\n r_bag.add_branch();\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind, \n\t branch_bag& r_bag)\n{\n _GLIBCXX_DEBUG_ASSERT(p_r != 0);\n if (p_l == 0)\n {\n apply_update(p_r, (node_update*)this);\n return (p_r);\n }\n\n if (p_l->m_type == leaf_node)\n {\n if (p_r->m_type == leaf_node)\n\t{\n\t node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),\n\t\t\t\t\tstatic_cast<leaf_pointer>(p_r), r_bag);\n\t apply_update(p_ret, (node_update*)this);\n\t return p_ret;\n\t}\n\n _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);\n node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),\n\t\t\t\t static_cast<inode_pointer>(p_r),\n\t\t\t\t checked_ind, r_bag);\n apply_update(p_ret, (node_update*)this);\n return p_ret;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node);\n if (p_r->m_type == leaf_node)\n {\n node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l),\n\t\t\t\t static_cast<leaf_pointer>(p_r),\n\t\t\t\t checked_ind, r_bag);\n apply_update(p_ret, (node_update*)this);\n return p_ret;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);\n node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l),\n\t\t\t\tstatic_cast<inode_pointer>(p_r),\n\t\t\t\tr_bag);\n\n apply_update(p_ret, (node_update*)this);\n return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(leaf_pointer p_l, leaf_pointer p_r, branch_bag& r_bag)\n{\n _GLIBCXX_DEBUG_ASSERT(p_r != 0);\n if (p_l == 0)\n return (p_r);\n node_pointer p_ret = insert_branch(p_l, p_r, r_bag);\n _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == 2);\n return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(leaf_pointer p_l, inode_pointer p_r, size_type checked_ind,\n\t branch_bag& r_bag)\n{\n#ifdef _GLIBCXX_DEBUG\n const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);\n const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);\n#endif\n\n _GLIBCXX_DEBUG_ASSERT(p_r != 0);\n node_pointer p_ret = rec_join(p_r, p_l, checked_ind, r_bag);\n _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == lhs_leafs + rhs_leafs);\n return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(inode_pointer p_l, leaf_pointer p_r, size_type checked_ind, branch_bag& r_bag)\n{\n _GLIBCXX_DEBUG_ASSERT(p_l != 0);\n _GLIBCXX_DEBUG_ASSERT(p_r != 0);\n\n#ifdef _GLIBCXX_DEBUG\n const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);\n const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);\n#endif\n\n if (!p_l->should_be_mine(pref_begin(p_r), pref_end(p_r), checked_ind, this))\n {\n node_pointer p_ret = insert_branch(p_l, p_r, r_bag);\n PB_DS_ASSERT_NODE_VALID(p_ret)\n _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) ==\n \t\t\t lhs_leafs + rhs_leafs);\n return p_ret;\n }\n\n node_pointer p_pot_child = p_l->add_child(p_r, pref_begin(p_r),\n\t\t\t\t\t pref_end(p_r), this);\n if (p_pot_child != p_r)\n {\n node_pointer p_new_child = rec_join(p_pot_child, p_r, p_l->get_e_ind(),\n\t\t\t\t\t r_bag);\n\n p_l->replace_child(p_new_child, pref_begin(p_new_child),\n\t\t\t pref_end(p_new_child), this);\n }\n\n PB_DS_ASSERT_NODE_VALID(p_l)\n _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_l) == lhs_leafs + rhs_leafs);\n return p_l;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(inode_pointer p_l, inode_pointer p_r, \n\t branch_bag& r_bag)\n{\n _GLIBCXX_DEBUG_ASSERT(p_l != 0);\n _GLIBCXX_DEBUG_ASSERT(p_r != 0);\n\n#ifdef _GLIBCXX_DEBUG\n const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);\n const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);\n#endif\n\n if (p_l->get_e_ind() == p_r->get_e_ind() &&\n synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),\n\t\t\t\t\t p_r->pref_b_it(), p_r->pref_e_it()))\n {\n for (typename inode::iterator it = p_r->begin();\n\t it != p_r->end(); ++ it)\n\t{\n\t node_pointer p_new_child = rec_join(p_l->get_join_child(*it, this),\n\t\t\t\t\t * it, 0, r_bag);\n\t p_l->replace_child(p_new_child, pref_begin(p_new_child),\n\t\t\t pref_end(p_new_child), this);\n\t}\n\n p_r->~inode();\n s_inode_allocator.deallocate(p_r, 1);\n PB_DS_ASSERT_NODE_VALID(p_l)\n _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_l) == lhs_leafs + rhs_leafs);\n return p_l;\n }\n\n if (p_l->get_e_ind() < p_r->get_e_ind() &&\n p_l->should_be_mine(p_r->pref_b_it(), p_r->pref_e_it(), 0, this))\n {\n node_pointer p_new_child = rec_join(p_l->get_join_child(p_r, this),\n\t\t\t\t\t p_r, 0, r_bag);\n p_l->replace_child(p_new_child, pref_begin(p_new_child),\n\t\t\t pref_end(p_new_child), this);\n PB_DS_ASSERT_NODE_VALID(p_l)\n return p_l;\n }\n\n if (p_r->get_e_ind() < p_l->get_e_ind() &&\n p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))\n {\n node_pointer p_new_child = rec_join(p_r->get_join_child(p_l, this), p_l,\n\t\t\t\t\t 0, r_bag);\n\n p_r->replace_child(p_new_child, pref_begin(p_new_child),\n\t\t\t pref_end(p_new_child), this);\n\n PB_DS_ASSERT_NODE_VALID(p_r)\n _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_r) == lhs_leafs + rhs_leafs);\n return p_r;\n }\n\n node_pointer p_ret = insert_branch(p_l, p_r, r_bag);\n PB_DS_ASSERT_NODE_VALID(p_ret)\n _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) == lhs_leafs + rhs_leafs);\n return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert(const_reference r_val)\n{\n node_pointer p_lf = find_imp(PB_DS_V2F(r_val));\n if (p_lf != 0 && p_lf->m_type == leaf_node &&\n synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))\n {\n PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_val))\n PB_DS_ASSERT_VALID((*this))\n return std::make_pair(iterator(p_lf), false);\n }\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_val))\n\n leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);\n cond_dealtor cond(p_new_lf);\n\n new (p_new_lf) leaf(r_val);\n apply_update(p_new_lf, (node_update*)this);\n cond.set_call_destructor();\n branch_bag bag;\n bag.add_branch();\n m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, p_new_lf, 0, bag);\n m_p_head->m_p_parent->m_p_parent = m_p_head;\n cond.set_no_action_dtor();\n ++m_size;\n update_min_max_for_inserted_leaf(p_new_lf);\n _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)\n PB_DS_ASSERT_VALID((*this))\n return std::make_pair(point_iterator(p_new_lf), true);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nkeys_diff_ind(typename access_traits::const_iterator b_l,\n\t typename access_traits::const_iterator e_l,\n\t typename access_traits::const_iterator b_r,\n\t typename access_traits::const_iterator e_r)\n{\n size_type diff_pos = 0;\n while (b_l != e_l)\n {\n if (b_r == e_r)\n\treturn (diff_pos);\n if (access_traits::e_pos(*b_l) != access_traits::e_pos(*b_r))\n\treturn (diff_pos);\n ++b_l;\n ++b_r;\n ++diff_pos;\n }\n _GLIBCXX_DEBUG_ASSERT(b_r != e_r);\n return diff_pos;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::inode_pointer\nPB_DS_CLASS_C_DEC::\ninsert_branch(node_pointer p_l, node_pointer p_r, branch_bag& r_bag)\n{\n typename synth_access_traits::const_iterator left_b_it = pref_begin(p_l);\n typename synth_access_traits::const_iterator left_e_it = pref_end(p_l);\n typename synth_access_traits::const_iterator right_b_it = pref_begin(p_r);\n typename synth_access_traits::const_iterator right_e_it = pref_end(p_r);\n\n const size_type diff_ind = keys_diff_ind(left_b_it, left_e_it,\n\t\t\t\t\t right_b_it, right_e_it);\n\n inode_pointer p_new_nd = r_bag.get_branch();\n new (p_new_nd) inode(diff_ind, left_b_it);\n p_new_nd->add_child(p_l, left_b_it, left_e_it, this);\n p_new_nd->add_child(p_r, right_b_it, right_e_it, this);\n p_l->m_p_parent = p_new_nd;\n p_r->m_p_parent = p_new_nd;\n PB_DS_ASSERT_NODE_VALID(p_new_nd)\n return (p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_inserted_leaf(leaf_pointer p_new_lf)\n{\n if (m_p_head->m_p_min == m_p_head ||\n synth_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()),\n\t\t\t\t PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value())))\n m_p_head->m_p_min = p_new_lf;\n\n if (m_p_head->m_p_max == m_p_head ||\n synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value())))\n m_p_head->m_p_max = p_new_lf;\n}\n#endif\n","include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/iterators_fn_imps.hpp\n * Contains an implementation class for pat_trie.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{ return iterator(m_p_head->m_p_min); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{ return const_iterator(m_p_head->m_p_min); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{ return iterator(m_p_head); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{ return const_iterator(m_p_head); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nrbegin() const\n{\n if (empty())\n return rend();\n return --end();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nrbegin()\n{\n if (empty())\n return rend();\n return --end();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nrend()\n{ return reverse_iterator(m_p_head); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nrend() const\n{ return const_reverse_iterator(m_p_head); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_const_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin() const\n{ return node_const_iterator(m_p_head->m_p_parent, this); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin()\n{ return node_iterator(m_p_head->m_p_parent, this); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_const_iterator\nPB_DS_CLASS_C_DEC::\nnode_end() const\n{ return node_const_iterator(0, this); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_end()\n{ return node_iterator(0, this); }\n\n#endif\n","include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/pat_trie_.hpp\n * Contains an implementation class for a patricia tree.\n */\n\n#include <iterator>\n#include <utility>\n#include <algorithm>\n#include <functional>\n#include <assert.h>\n#include <list>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>\n#include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp>\n#include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp>\n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/debug_map_base.hpp>\n#endif\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_PAT_TRIE_NAME pat_trie_map\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_PAT_TRIE_NAME pat_trie_set\n#endif\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Mapped, typename Node_And_It_Traits, \\\n\t typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n PB_DS_PAT_TRIE_NAME<Key, Mapped, Node_And_It_Traits, _Alloc>\n\n#define PB_DS_PAT_TRIE_TRAITS_BASE \\\n types_traits<Key, Mapped, _Alloc, false>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_DEBUG_MAP_BASE_C_DEC \\\n debug_map_base<Key,\teq_by_less<Key, std::less<Key> >, \\\n\t\t typename rebind_traits<_Alloc, Key>::const_reference>\n#endif\n\n\n /**\n * @brief PATRICIA trie.\n * @ingroup branch-detail\n *\n * This implementation loosely borrows ideas from:\n * 1) Fast Mergeable Integer Maps, Okasaki, Gill 1998\n * 2) Ptset: Sets of integers implemented as Patricia trees,\n * Jean-Christophe Filliatr, 2000\n */\n template<typename Key, typename Mapped, typename Node_And_It_Traits,\n\t typename _Alloc>\n class PB_DS_PAT_TRIE_NAME :\n#ifdef _GLIBCXX_DEBUG\n public PB_DS_DEBUG_MAP_BASE_C_DEC,\n#endif\n public Node_And_It_Traits::synth_access_traits,\n public Node_And_It_Traits::node_update,\n public PB_DS_PAT_TRIE_TRAITS_BASE,\n public pat_trie_base\n {\n private:\n typedef pat_trie_base\t\t\t\tbase_type;\n typedef PB_DS_PAT_TRIE_TRAITS_BASE \t\ttraits_base;\n typedef Node_And_It_Traits\t\t\ttraits_type;\n\n typedef typename traits_type::synth_access_traits synth_access_traits;\n typedef typename synth_access_traits::const_iterator a_const_iterator;\n\n typedef typename traits_type::node\t\tnode;\n typedef rebind_traits<_Alloc, node>\t\t__rebind_n;\n typedef typename __rebind_n::const_pointer\tnode_const_pointer;\n typedef typename __rebind_n::pointer\t\tnode_pointer;\n\n typedef typename traits_type::head\t\thead;\n typedef rebind_traits<_Alloc, head>\t\t__rebind_h;\n typedef typename __rebind_h::allocator_type \thead_allocator;\n typedef typename __rebind_h::pointer \t\thead_pointer;\n\n typedef typename traits_type::leaf\t\tleaf;\n typedef rebind_traits<_Alloc, leaf>\t\t__rebind_l;\n typedef typename __rebind_l::allocator_type\tleaf_allocator;\n typedef typename __rebind_l::pointer \t\tleaf_pointer;\n typedef typename __rebind_l::const_pointer\tleaf_const_pointer;\n\n typedef typename traits_type::inode\t\tinode;\n typedef typename inode::iterator \t\t\tinode_iterator;\n typedef rebind_traits<_Alloc, inode>\t\t__rebind_in;\n typedef typename __rebind_in::allocator_type\tinode_allocator;\n typedef typename __rebind_in::pointer \t\tinode_pointer;\n typedef typename __rebind_in::const_pointer\tinode_const_pointer;\n\n\n /// Conditional deallocator.\n class cond_dealtor\n {\n protected:\n\tleaf_pointer \t\tm_p_nd;\n\tbool \t\t\tm_no_action_dtor;\n\tbool \t\t\tm_call_destructor;\n\n public:\n\tcond_dealtor(leaf_pointer p_nd)\n\t: m_p_nd(p_nd), m_no_action_dtor(false), m_call_destructor(false)\n\t{ }\n\n\tvoid\n\tset_no_action_dtor()\n\t{ m_no_action_dtor = true; }\n\n\tvoid\n\tset_call_destructor()\n\t{ m_call_destructor = true; }\n\n\t~cond_dealtor()\n\t{\n\t if (m_no_action_dtor)\n\t return;\n\n\t if (m_call_destructor)\n\t m_p_nd->~leaf();\n\n\t s_leaf_allocator.deallocate(m_p_nd, 1);\n\t}\n };\n\n\n /// Branch bag, for split-join.\n class branch_bag\n {\n private:\n\ttypedef inode_pointer \t\t\t \t__inp;\n\ttypedef typename rebind_traits<_Alloc, __inp>::allocator_type\n\t __rebind_inp;\n\n#ifdef _GLIBCXX_DEBUG\n\ttypedef std::_GLIBCXX_STD_C::list<__inp, __rebind_inp> \tbag_type;\n#else\n\ttypedef std::list<__inp, __rebind_inp> \t\t\tbag_type;\n#endif\n\n\tbag_type \t\t\t\t\t\tm_bag;\n public:\n\tvoid\n\tadd_branch()\n\t{\n\t inode_pointer p_nd = s_inode_allocator.allocate(1);\n\t __try\n\t {\n\t m_bag.push_back(p_nd);\n\t }\n\t __catch(...)\n\t {\n\t s_inode_allocator.deallocate(p_nd, 1);\n\t __throw_exception_again;\n\t }\n\t}\n\n\tinode_pointer\n\tget_branch()\n\t{\n\t _GLIBCXX_DEBUG_ASSERT(!m_bag.empty());\n\t inode_pointer p_nd = *m_bag.begin();\n\t m_bag.pop_front();\n\t return p_nd;\n\t}\n\n\t~branch_bag()\n\t{\n\t while (!m_bag.empty())\n\t {\n\t inode_pointer p_nd = *m_bag.begin();\n\t s_inode_allocator.deallocate(p_nd, 1);\n\t m_bag.pop_front();\n\t }\n\t}\n\n\t_GLIBCXX_NODISCARD inline bool\n\tempty() const\n\t{ return m_bag.empty(); }\n };\n\n#ifdef _GLIBCXX_DEBUG\n typedef PB_DS_DEBUG_MAP_BASE_C_DEC \t\tdebug_base;\n#endif\n\n typedef typename traits_type::null_node_update_pointer null_node_update_pointer;\n\n public:\n typedef pat_trie_tag \t\t\t\tcontainer_category;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \t\tdifference_type;\n\n typedef typename traits_base::key_type \t\tkey_type;\n typedef typename traits_base::key_pointer \tkey_pointer;\n typedef typename traits_base::key_const_pointer \tkey_const_pointer;\n typedef typename traits_base::key_reference \tkey_reference;\n typedef typename traits_base::key_const_reference key_const_reference;\n typedef typename traits_base::mapped_type \tmapped_type;\n typedef typename traits_base::mapped_pointer \tmapped_pointer;\n typedef typename traits_base::mapped_const_pointer mapped_const_pointer;\n typedef typename traits_base::mapped_reference \tmapped_reference;\n typedef typename traits_base::mapped_const_reference mapped_const_reference;\n typedef typename traits_base::value_type \t\tvalue_type;\n typedef typename traits_base::pointer \t\tpointer;\n typedef typename traits_base::const_pointer \tconst_pointer;\n typedef typename traits_base::reference \t\treference;\n typedef typename traits_base::const_reference \tconst_reference;\n\n typedef typename traits_type::access_traits \taccess_traits;\n typedef typename traits_type::const_iterator \tpoint_const_iterator;\n typedef typename traits_type::iterator \t\tpoint_iterator;\n typedef point_const_iterator \t\t\tconst_iterator;\n typedef point_iterator \t\t\t\titerator;\n\n typedef typename traits_type::reverse_iterator \treverse_iterator;\n typedef typename traits_type::const_reverse_iterator const_reverse_iterator;\n typedef typename traits_type::node_const_iterator node_const_iterator;\n typedef typename traits_type::node_iterator \tnode_iterator;\n typedef typename traits_type::node_update \tnode_update;\n\n PB_DS_PAT_TRIE_NAME();\n\n PB_DS_PAT_TRIE_NAME(const access_traits&);\n\n PB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n ~PB_DS_PAT_TRIE_NAME();\n\n _GLIBCXX_NODISCARD inline bool\n empty() const;\n\n inline size_type\n size() const;\n\n inline size_type\n max_size() const;\n\n access_traits&\n get_access_traits();\n\n const access_traits&\n get_access_traits() const;\n\n node_update&\n get_node_update();\n\n const node_update&\n get_node_update() const;\n\n inline std::pair<point_iterator, bool>\n insert(const_reference);\n\n inline mapped_reference\n operator[](key_const_reference r_key)\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\treturn insert(std::make_pair(r_key, mapped_type())).first->second;\n#else\n\tinsert(r_key);\n\treturn traits_base::s_null_type;\n#endif\n }\n\n inline point_iterator\n find(key_const_reference);\n\n inline point_const_iterator\n find(key_const_reference) const;\n\n inline point_iterator\n lower_bound(key_const_reference);\n\n inline point_const_iterator\n lower_bound(key_const_reference) const;\n\n inline point_iterator\n upper_bound(key_const_reference);\n\n inline point_const_iterator\n upper_bound(key_const_reference) const;\n\n void\n clear();\n\n inline bool\n erase(key_const_reference);\n\n inline const_iterator\n erase(const_iterator);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n inline iterator\n erase(iterator);\n#endif\n\n inline const_reverse_iterator\n erase(const_reverse_iterator);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n inline reverse_iterator\n erase(reverse_iterator);\n#endif\n\n template<typename Pred>\n inline size_type\n erase_if(Pred);\n\n void\n join(PB_DS_CLASS_C_DEC&);\n\n void\n split(key_const_reference, PB_DS_CLASS_C_DEC&);\n\n inline iterator\n begin();\n\n inline const_iterator\n begin() const;\n\n inline iterator\n end();\n\n inline const_iterator\n end() const;\n\n inline reverse_iterator\n rbegin();\n\n inline const_reverse_iterator\n rbegin() const;\n\n inline reverse_iterator\n rend();\n\n inline const_reverse_iterator\n rend() const;\n\n /// Returns a const node_iterator corresponding to the node at the\n /// root of the tree.\n inline node_const_iterator\n node_begin() const;\n\n /// Returns a node_iterator corresponding to the node at the\n /// root of the tree.\n inline node_iterator\n node_begin();\n\n /// Returns a const node_iterator corresponding to a node just\n /// after a leaf of the tree.\n inline node_const_iterator\n node_end() const;\n\n /// Returns a node_iterator corresponding to a node just\n /// after a leaf of the tree.\n inline node_iterator\n node_end();\n\n#ifdef PB_DS_PAT_TRIE_TRACE_\n void\n trace() const;\n#endif\n\n protected:\n template<typename It>\n void\n copy_from_range(It, It);\n\n void\n value_swap(PB_DS_CLASS_C_DEC&);\n\n node_pointer\n recursive_copy_node(node_const_pointer);\n\n private:\n void\n initialize();\n\n inline void\n apply_update(node_pointer, null_node_update_pointer);\n\n template<typename Node_Update_>\n inline void\n apply_update(node_pointer, Node_Update_*);\n\n bool\n join_prep(PB_DS_CLASS_C_DEC&, branch_bag&);\n\n void\n rec_join_prep(node_const_pointer, node_const_pointer, branch_bag&);\n\n void\n rec_join_prep(leaf_const_pointer, leaf_const_pointer, branch_bag&);\n\n void\n rec_join_prep(leaf_const_pointer, inode_const_pointer, branch_bag&);\n\n void\n rec_join_prep(inode_const_pointer, leaf_const_pointer, branch_bag&);\n\n void\n rec_join_prep(inode_const_pointer, inode_const_pointer, branch_bag&);\n\n node_pointer\n rec_join(node_pointer, node_pointer, size_type, branch_bag&);\n\n node_pointer\n rec_join(leaf_pointer, leaf_pointer, branch_bag&);\n\n node_pointer\n rec_join(leaf_pointer, inode_pointer, size_type, branch_bag&);\n\n node_pointer\n rec_join(inode_pointer, leaf_pointer, size_type, branch_bag&);\n\n node_pointer\n rec_join(inode_pointer, inode_pointer, branch_bag&);\n\n size_type\n keys_diff_ind(typename access_traits::const_iterator,\n\t\t typename access_traits::const_iterator,\n\t\t typename access_traits::const_iterator,\n\t\t typename access_traits::const_iterator);\n\n inode_pointer\n insert_branch(node_pointer, node_pointer, branch_bag&);\n\n void\n update_min_max_for_inserted_leaf(leaf_pointer);\n\n void\n erase_leaf(leaf_pointer);\n\n inline void\n actual_erase_leaf(leaf_pointer);\n\n void\n clear_imp(node_pointer);\n\n void\n erase_fixup(inode_pointer);\n\n void\n update_min_max_for_erased_leaf(leaf_pointer);\n\n static inline a_const_iterator\n pref_begin(node_const_pointer);\n\n static inline a_const_iterator\n pref_end(node_const_pointer);\n\n inline node_pointer\n find_imp(key_const_reference);\n\n inline node_pointer\n lower_bound_imp(key_const_reference);\n\n inline node_pointer\n upper_bound_imp(key_const_reference);\n\n inline static leaf_const_pointer\n leftmost_descendant(node_const_pointer);\n\n inline static leaf_pointer\n leftmost_descendant(node_pointer);\n\n inline static leaf_const_pointer\n rightmost_descendant(node_const_pointer);\n\n inline static leaf_pointer\n rightmost_descendant(node_pointer);\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n\n void\n assert_iterators(const char*, int) const;\n\n void\n assert_reverse_iterators(const char*, int) const;\n\n static size_type\n recursive_count_leafs(node_const_pointer, const char*, int);\n#endif\n\n#ifdef PB_DS_PAT_TRIE_TRACE_\n static void\n trace_node(node_const_pointer, size_type);\n\n template<typename Metadata_>\n static void\n trace_node_metadata(node_const_pointer, type_to_type<Metadata_>);\n\n static void\n trace_node_metadata(node_const_pointer, type_to_type<null_type>);\n#endif\n\n leaf_pointer\n split_prep(key_const_reference, PB_DS_CLASS_C_DEC&, branch_bag&);\n\n node_pointer\n rec_split(node_pointer, a_const_iterator, a_const_iterator,\n\t\tPB_DS_CLASS_C_DEC&, branch_bag&);\n\n void\n split_insert_branch(size_type, a_const_iterator, inode_iterator,\n\t\t\t size_type, branch_bag&);\n\n static head_allocator \t\ts_head_allocator;\n static inode_allocator \t\ts_inode_allocator;\n static leaf_allocator \t\ts_leaf_allocator;\n\n head_pointer \t\t\tm_p_head;\n size_type \t\t\tm_size;\n };\n\n#define PB_DS_ASSERT_NODE_VALID(X) \\\n _GLIBCXX_DEBUG_ONLY(X->assert_valid(this, __FILE__, __LINE__);)\n\n#define PB_DS_RECURSIVE_COUNT_LEAFS(X) \\\n recursive_count_leafs(X, __FILE__, __LINE__)\n\n#include <ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp>\n\n#undef PB_DS_RECURSIVE_COUNT_LEAFS\n#undef PB_DS_ASSERT_NODE_VALID\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_PAT_TRIE_NAME\n#undef PB_DS_PAT_TRIE_TRAITS_BASE\n#undef PB_DS_DEBUG_MAP_BASE_C_DEC\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/pat_trie_base.hpp\n * Contains the base class for a patricia tree.\n */\n\n#ifndef PB_DS_PAT_TRIE_BASE\n#define PB_DS_PAT_TRIE_BASE\n\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Base type for PATRICIA trees.\n struct pat_trie_base\n {\n /**\n * @brief Three types of nodes.\n *\n * i_node is used by _Inode, leaf_node by _Leaf, and head_node by _Head.\n */\n enum node_type\n\t{\n\t i_node,\n\t leaf_node,\n\t head_node\n\t};\n\n /// Metadata base primary template.\n template<typename Metadata, typename _Alloc>\n\tstruct _Metadata\n\t{\n\t typedef Metadata \t\t\t\t\tmetadata_type;\n\t typedef _Alloc \t\t\t\t\tallocator_type;\n\t typedef typename detail::rebind_traits<_Alloc, Metadata>::const_reference\n\t const_reference;\n\n\t const_reference\n\t get_metadata() const\n\t { return m_metadata; }\n\n\t metadata_type \t\t\t\t\tm_metadata;\n\t};\n\n /// Specialization for null metadata.\n template<typename _Alloc>\n\tstruct _Metadata<null_type, _Alloc>\n\t{\n\t typedef null_type \t\t\t\t\tmetadata_type;\n\t typedef _Alloc \t\t\t\t\tallocator_type;\n\t};\n\n\n /// Node base.\n template<typename _ATraits, typename Metadata>\n struct _Node_base\n : public Metadata\n {\n private:\n\ttypedef typename Metadata::allocator_type\t\t_Alloc;\n\n public:\n\ttypedef _Alloc\t\t\t\t\t\tallocator_type;\n\ttypedef _ATraits\t\t\t\t\taccess_traits;\n\ttypedef typename _ATraits::type_traits\t\t\ttype_traits;\n\ttypedef typename detail::rebind_traits<_Alloc, _Node_base>::pointer\n\t node_pointer;\n\n\tnode_pointer \t\t\t\t\t\tm_p_parent;\n\tconst node_type \t \t\t\t\tm_type;\n\n\t_Node_base(node_type type) : m_type(type)\n\t{ }\n\n\ttypedef typename detail::rebind_traits<_Alloc, _ATraits>::const_pointer\n\t a_const_pointer;\n\ttypedef typename _ATraits::const_iterator\t a_const_iterator;\n\n#ifdef _GLIBCXX_DEBUG\n\ttypedef std::pair<a_const_iterator, a_const_iterator> node_debug_info;\n\n\tvoid\n\tassert_valid(a_const_pointer p_traits,\n\t\t const char* __file, int __line) const\n\t{ assert_valid_imp(p_traits, __file, __line); }\n\n\tvirtual node_debug_info\n\tassert_valid_imp(a_const_pointer, const char*, int) const = 0;\n#endif\n };\n\n\n /// Head node for PATRICIA tree.\n template<typename _ATraits, typename Metadata>\n struct _Head\n : public _Node_base<_ATraits, Metadata>\n {\n typedef _Node_base<_ATraits, Metadata> \t\t\tbase_type;\n typedef typename base_type::type_traits\t\t\ttype_traits;\n typedef typename base_type::node_pointer\t\t\tnode_pointer;\n\n node_pointer\t\t\t\t\t\tm_p_min;\n node_pointer\t\t\t\t\t\tm_p_max;\n\n _Head() : base_type(head_node) { }\n\n#ifdef _GLIBCXX_DEBUG\n typedef typename base_type::node_debug_info \t node_debug_info;\n typedef typename base_type::a_const_pointer \t a_const_pointer;\n\n virtual node_debug_info\n assert_valid_imp(a_const_pointer, const char* __file, int __line) const\n {\n\t_GLIBCXX_DEBUG_VERIFY_AT(false,\n\t\t\t\t _M_message(\"Assertion from %1;:%2;\")\n\t\t\t\t ._M_string(__FILE__)._M_integer(__LINE__),\n\t\t\t\t __file, __line);\n\treturn node_debug_info();\n }\n#endif\n };\n\n\n /// Leaf node for PATRICIA tree.\n template<typename _ATraits, typename Metadata>\n struct _Leaf\n : public _Node_base<_ATraits, Metadata>\n {\n typedef _Node_base<_ATraits, Metadata> \t \t \tbase_type;\n typedef typename base_type::type_traits\t\t\ttype_traits;\n typedef typename type_traits::value_type\t\t\tvalue_type;\n typedef typename type_traits::reference\t\t\treference;\n typedef typename type_traits::const_reference \t\tconst_reference;\n\n private:\n value_type\t\t\t\t\t\tm_value;\n\n _Leaf(const _Leaf&);\n\n public:\n _Leaf(const_reference other)\n : base_type(leaf_node), m_value(other) { }\n\n reference\n value()\n { return m_value; }\n\n const_reference\n value() const\n { return m_value; }\n\n#ifdef _GLIBCXX_DEBUG\n typedef typename base_type::node_debug_info \t\tnode_debug_info;\n typedef typename base_type::a_const_pointer \t\ta_const_pointer;\n\n virtual node_debug_info\n assert_valid_imp(a_const_pointer p_traits,\n\t\t const char* __file, int __line) const\n {\n\tPB_DS_DEBUG_VERIFY(base_type::m_type == leaf_node);\n\tnode_debug_info ret;\n\tconst_reference r_val = value();\n\treturn std::make_pair(p_traits->begin(p_traits->extract_key(r_val)),\n\t\t\t p_traits->end(p_traits->extract_key(r_val)));\n }\n\n virtual\n ~_Leaf() { }\n#endif\n };\n\n\n /// Internal node type, PATRICIA tree.\n template<typename _ATraits, typename Metadata>\n struct _Inode\n : public _Node_base<_ATraits, Metadata>\n {\n typedef _Node_base<_ATraits, Metadata>\t\tbase_type;\n typedef typename base_type::type_traits\t\ttype_traits;\n typedef typename base_type::access_traits\t\taccess_traits;\n typedef typename type_traits::value_type\t\tvalue_type;\n typedef typename base_type::allocator_type\t_Alloc;\n typedef _Alloc\t\t\t\t\tallocator_type;\n typedef typename _Alloc::size_type\t\tsize_type;\n\n private:\n typedef typename base_type::a_const_pointer\ta_const_pointer;\n typedef typename base_type::a_const_iterator\ta_const_iterator;\n\n typedef typename base_type::node_pointer\t\tnode_pointer;\n typedef typename detail::rebind_traits<_Alloc, base_type>::const_pointer\n\tnode_const_pointer;\n\n typedef _Leaf<_ATraits, Metadata>\t \t\tleaf;\n typedef typename detail::rebind_traits<_Alloc, leaf>\t__rebind_l;\n typedef typename __rebind_l::pointer \t\tleaf_pointer;\n typedef typename __rebind_l::const_pointer \tleaf_const_pointer;\n\n typedef detail::rebind_traits<_Alloc, _Inode>\t__rebind_in;\n typedef typename __rebind_in::pointer\t\tinode_pointer;\n typedef typename __rebind_in::const_pointer \tinode_const_pointer;\n\n inline size_type\n get_pref_pos(a_const_iterator, a_const_iterator, a_const_pointer) const;\n\n public:\n typedef detail::rebind_traits<_Alloc, node_pointer>\t__rebind_np;\n typedef typename __rebind_np::pointer \t\tnode_pointer_pointer;\n typedef typename __rebind_np::reference \t\tnode_pointer_reference;\n\n enum\n\t{\n\t arr_size = _ATraits::max_size + 1\n\t};\n PB_DS_STATIC_ASSERT(min_arr_size, arr_size >= 2);\n\n\n /// Constant child iterator.\n struct const_iterator\n {\n\tnode_pointer_pointer \t\t\t\tm_p_p_cur;\n\tnode_pointer_pointer \t\t\t\tm_p_p_end;\n\n\ttypedef std::forward_iterator_tag \t\titerator_category;\n\ttypedef typename _Alloc::difference_type \tdifference_type;\n\ttypedef node_pointer \t\t\t\tvalue_type;\n\ttypedef node_pointer_pointer \t\t\tpointer;\n\ttypedef node_pointer_reference \t\t\treference;\n\n\tconst_iterator(node_pointer_pointer p_p_cur = 0,\n\t\t node_pointer_pointer p_p_end = 0)\n\t: m_p_p_cur(p_p_cur), m_p_p_end(p_p_end)\n\t{ }\n\n\tbool\n\toperator==(const const_iterator& other) const\n\t{ return m_p_p_cur == other.m_p_p_cur; }\n\n\tbool\n\toperator!=(const const_iterator& other) const\n\t{ return m_p_p_cur != other.m_p_p_cur; }\n\n\tconst_iterator&\n\toperator++()\n\t{\n\t do\n\t ++m_p_p_cur;\n\t while (m_p_p_cur != m_p_p_end && *m_p_p_cur == 0);\n\t return *this;\n\t}\n\n\tconst_iterator\n\toperator++(int)\n\t{\n\t const_iterator ret_it(*this);\n\t operator++();\n\t return ret_it;\n\t}\n\n\tconst node_pointer_pointer\n\toperator->() const\n\t{\n\t _GLIBCXX_DEBUG_ONLY(assert_referencible();)\n\t return m_p_p_cur;\n\t}\n\n\tnode_const_pointer\n\toperator*() const\n\t{\n\t _GLIBCXX_DEBUG_ONLY(assert_referencible();)\n\t return *m_p_p_cur;\n\t}\n\n protected:\n#ifdef _GLIBCXX_DEBUG\n\tvoid\n\tassert_referencible() const\n\t{ _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end && *m_p_p_cur != 0); }\n#endif\n };\n\n\n /// Child iterator.\n struct iterator : public const_iterator\n {\n public:\n\ttypedef std::forward_iterator_tag \t\titerator_category;\n\ttypedef typename _Alloc::difference_type \tdifference_type;\n\ttypedef node_pointer \t\t\t\tvalue_type;\n\ttypedef node_pointer_pointer \t\t\tpointer;\n\ttypedef node_pointer_reference \t\t\treference;\n\n\tinline\n\titerator(node_pointer_pointer p_p_cur = 0,\n\t\t node_pointer_pointer p_p_end = 0)\n\t: const_iterator(p_p_cur, p_p_end) { }\n\n\tbool\n\toperator==(const iterator& other) const\n\t{ return const_iterator::m_p_p_cur == other.m_p_p_cur; }\n\n\tbool\n\toperator!=(const iterator& other) const\n\t{ return const_iterator::m_p_p_cur != other.m_p_p_cur; }\n\n\titerator&\n\toperator++()\n\t{\n\t const_iterator::operator++();\n\t return *this;\n\t}\n\n\titerator\n\toperator++(int)\n\t{\n\t iterator ret_it(*this);\n\t operator++();\n\t return ret_it;\n\t}\n\n\tnode_pointer_pointer\n\toperator->()\n\t{\n\t _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)\n\t return const_iterator::m_p_p_cur;\n\t}\n\n\tnode_pointer\n\toperator*()\n\t{\n\t _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)\n\t return *const_iterator::m_p_p_cur;\n\t}\n };\n\n\n _Inode(size_type, const a_const_iterator);\n\n void\n update_prefixes(a_const_pointer);\n\n const_iterator\n begin() const;\n\n iterator\n begin();\n\n const_iterator\n end() const;\n\n iterator\n end();\n\n inline node_pointer\n get_child_node(a_const_iterator, a_const_iterator, a_const_pointer);\n\n inline node_const_pointer\n get_child_node(a_const_iterator, a_const_iterator, a_const_pointer) const;\n\n inline iterator\n get_child_it(a_const_iterator, a_const_iterator, a_const_pointer);\n\n inline node_pointer\n get_lower_bound_child_node(a_const_iterator, a_const_iterator,\n\t\t\t\t size_type, a_const_pointer);\n\n inline node_pointer\n add_child(node_pointer, a_const_iterator, a_const_iterator,\n\t\ta_const_pointer);\n\n inline node_const_pointer\n get_join_child(node_const_pointer, a_const_pointer) const;\n\n inline node_pointer\n get_join_child(node_pointer, a_const_pointer);\n\n void\n remove_child(node_pointer);\n\n void\n remove_child(iterator);\n\n void\n replace_child(node_pointer, a_const_iterator, a_const_iterator,\n\t\t a_const_pointer);\n\n inline a_const_iterator\n pref_b_it() const;\n\n inline a_const_iterator\n pref_e_it() const;\n\n bool\n should_be_mine(a_const_iterator, a_const_iterator, size_type,\n\t\t a_const_pointer) const;\n\n leaf_pointer\n leftmost_descendant();\n\n leaf_const_pointer\n leftmost_descendant() const;\n\n leaf_pointer\n rightmost_descendant();\n\n leaf_const_pointer\n rightmost_descendant() const;\n\n#ifdef _GLIBCXX_DEBUG\n typedef typename base_type::node_debug_info \t node_debug_info;\n\n virtual node_debug_info\n assert_valid_imp(a_const_pointer, const char*, int) const;\n#endif\n\n size_type\n get_e_ind() const\n { return m_e_ind; }\n\n private:\n _Inode(const _Inode&);\n\n size_type\n get_begin_pos() const;\n\n static __rebind_l\t\t\ts_leaf_alloc;\n static __rebind_in \t\ts_inode_alloc;\n\n const size_type \t\t\tm_e_ind;\n a_const_iterator \t\t\tm_pref_b_it;\n a_const_iterator \t\t\tm_pref_e_it;\n node_pointer \t\t\tm_a_p_children[arr_size];\n };\n\n#define PB_DS_CONST_IT_C_DEC \\\n _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>\n\n#define PB_DS_CONST_ODIR_IT_C_DEC \\\n _CIter<Node, Leaf, Head, Inode, !Is_Forward_Iterator>\n\n#define PB_DS_IT_C_DEC \\\n _Iter<Node, Leaf, Head, Inode, Is_Forward_Iterator>\n\n#define PB_DS_ODIR_IT_C_DEC \\\n _Iter<Node, Leaf, Head, Inode, !Is_Forward_Iterator>\n\n\n /// Const iterator.\n template<typename Node, typename Leaf, typename Head, typename Inode,\n\t bool Is_Forward_Iterator>\n class _CIter\n {\n public:\n // These types are all the same for the first four template arguments.\n typedef typename Node::allocator_type\t\tallocator_type;\n typedef typename Node::type_traits\t\ttype_traits;\n\n typedef std::bidirectional_iterator_tag \t\titerator_category;\n typedef typename allocator_type::difference_type\tdifference_type;\n typedef typename type_traits::value_type\t\tvalue_type;\n typedef typename type_traits::pointer \t\tpointer;\n typedef typename type_traits::reference \t\treference;\n typedef typename type_traits::const_pointer \tconst_pointer;\n typedef typename type_traits::const_reference \tconst_reference;\n\n typedef allocator_type\t\t\t\t_Alloc;\n typedef typename rebind_traits<_Alloc, Node>::pointer\tnode_pointer;\n typedef typename rebind_traits<_Alloc, Leaf>::pointer\tleaf_pointer;\n typedef typename rebind_traits<_Alloc, Leaf>::const_pointer\tleaf_const_pointer;\n typedef typename rebind_traits<_Alloc, Head>::pointer\thead_pointer;\n\n typedef typename rebind_traits<_Alloc, Inode>::pointer \tinode_pointer;\n typedef typename Inode::iterator\t\t\tinode_iterator;\n\n node_pointer \t\t\t\t\tm_p_nd;\n\n _CIter(node_pointer p_nd = 0) : m_p_nd(p_nd)\n { }\n\n _CIter(const PB_DS_CONST_ODIR_IT_C_DEC& other)\n : m_p_nd(other.m_p_nd)\n { }\n\n _CIter&\n operator=(const _CIter& other)\n {\n\tm_p_nd = other.m_p_nd;\n\treturn *this;\n }\n\n _CIter&\n operator=(const PB_DS_CONST_ODIR_IT_C_DEC& other)\n {\n\tm_p_nd = other.m_p_nd;\n\treturn *this;\n }\n\n const_pointer\n operator->() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node);\n\treturn &static_cast<leaf_pointer>(m_p_nd)->value();\n }\n\n const_reference\n operator*() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node);\n\treturn static_cast<leaf_pointer>(m_p_nd)->value();\n }\n\n bool\n operator==(const _CIter& other) const\n { return m_p_nd == other.m_p_nd; }\n\n bool\n operator==(const PB_DS_CONST_ODIR_IT_C_DEC& other) const\n { return m_p_nd == other.m_p_nd; }\n\n bool\n operator!=(const _CIter& other) const\n { return m_p_nd != other.m_p_nd; }\n\n bool\n operator!=(const PB_DS_CONST_ODIR_IT_C_DEC& other) const\n { return m_p_nd != other.m_p_nd; }\n\n _CIter&\n operator++()\n {\n\tinc(integral_constant<int, Is_Forward_Iterator>());\n\treturn *this;\n }\n\n _CIter\n operator++(int)\n {\n\t_CIter ret_it(m_p_nd);\n\toperator++();\n\treturn ret_it;\n }\n\n _CIter&\n operator--()\n {\n\tdec(integral_constant<int, Is_Forward_Iterator>());\n\treturn *this;\n }\n\n _CIter\n operator--(int)\n {\n\t_CIter ret_it(m_p_nd);\n\toperator--();\n\treturn ret_it;\n }\n\n protected:\n void\n inc(false_type)\n { dec(true_type()); }\n\n void\n inc(true_type)\n {\n\tif (m_p_nd->m_type == head_node)\n\t {\n\t m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_min;\n\t return;\n\t }\n\n\tnode_pointer p_y = m_p_nd->m_p_parent;\n\twhile (p_y->m_type != head_node && get_larger_sibling(m_p_nd) == 0)\n\t {\n\t m_p_nd = p_y;\n\t p_y = p_y->m_p_parent;\n\t }\n\n\tif (p_y->m_type == head_node)\n\t {\n\t m_p_nd = p_y;\n\t return;\n\t }\n\tm_p_nd = leftmost_descendant(get_larger_sibling(m_p_nd));\n }\n\n void\n dec(false_type)\n { inc(true_type()); }\n\n void\n dec(true_type)\n {\n\tif (m_p_nd->m_type == head_node)\n\t {\n\t m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_max;\n\t return;\n\t }\n\n\tnode_pointer p_y = m_p_nd->m_p_parent;\n\twhile (p_y->m_type != head_node && get_smaller_sibling(m_p_nd) == 0)\n\t {\n\t m_p_nd = p_y;\n\t p_y = p_y->m_p_parent;\n\t }\n\n\tif (p_y->m_type == head_node)\n\t {\n\t m_p_nd = p_y;\n\t return;\n\t }\n\tm_p_nd = rightmost_descendant(get_smaller_sibling(m_p_nd));\n }\n\n static node_pointer\n get_larger_sibling(node_pointer p_nd)\n {\n\tinode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent);\n\n\tinode_iterator it = p_parent->begin();\n\twhile (*it != p_nd)\n\t ++it;\n\n\tinode_iterator next_it = it;\n\t++next_it;\n\treturn (next_it == p_parent->end())? 0 : *next_it;\n }\n\n static node_pointer\n get_smaller_sibling(node_pointer p_nd)\n {\n\tinode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent);\n\n\tinode_iterator it = p_parent->begin();\n\tif (*it == p_nd)\n\t return 0;\n\n\tinode_iterator prev_it;\n\tdo\n\t {\n\t prev_it = it;\n\t ++it;\n\t if (*it == p_nd)\n\t return *prev_it;\n\t }\n\twhile (true);\n\n\t_GLIBCXX_DEBUG_ASSERT(false);\n\treturn 0;\n }\n\n static leaf_pointer\n leftmost_descendant(node_pointer p_nd)\n {\n\tif (p_nd->m_type == leaf_node)\n\t return static_cast<leaf_pointer>(p_nd);\n\treturn static_cast<inode_pointer>(p_nd)->leftmost_descendant();\n }\n\n static leaf_pointer\n rightmost_descendant(node_pointer p_nd)\n {\n\tif (p_nd->m_type == leaf_node)\n\t return static_cast<leaf_pointer>(p_nd);\n\treturn static_cast<inode_pointer>(p_nd)->rightmost_descendant();\n }\n };\n\n\n /// Iterator.\n template<typename Node, typename Leaf, typename Head, typename Inode,\n\t bool Is_Forward_Iterator>\n class _Iter\n : public _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>\n {\n public:\n typedef _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>\n \t\t\t\t\t\t\tbase_type;\n typedef typename base_type::allocator_type\tallocator_type;\n typedef typename base_type::type_traits\t\ttype_traits;\n typedef typename type_traits::value_type\t\tvalue_type;\n typedef typename type_traits::pointer \t\tpointer;\n typedef typename type_traits::reference \t\treference;\n\n typedef typename base_type::node_pointer\t\tnode_pointer;\n typedef typename base_type::leaf_pointer\t\tleaf_pointer;\n typedef typename base_type::leaf_const_pointer\tleaf_const_pointer;\n typedef typename base_type::head_pointer\t\thead_pointer;\n typedef typename base_type::inode_pointer \tinode_pointer;\n\n _Iter(node_pointer p_nd = 0)\n : base_type(p_nd) { }\n\n _Iter(const PB_DS_ODIR_IT_C_DEC& other)\n : base_type(other.m_p_nd) { }\n\n _Iter&\n operator=(const _Iter& other)\n {\n\tbase_type::m_p_nd = other.m_p_nd;\n\treturn *this;\n }\n\n _Iter&\n operator=(const PB_DS_ODIR_IT_C_DEC& other)\n {\n\tbase_type::m_p_nd = other.m_p_nd;\n\treturn *this;\n }\n\n pointer\n operator->() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node);\n\treturn &static_cast<leaf_pointer>(base_type::m_p_nd)->value();\n }\n\n reference\n operator*() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node);\n\treturn static_cast<leaf_pointer>(base_type::m_p_nd)->value();\n }\n\n _Iter&\n operator++()\n {\n\tbase_type::operator++();\n\treturn *this;\n }\n\n _Iter\n operator++(int)\n {\n\t_Iter ret(base_type::m_p_nd);\n\toperator++();\n\treturn ret;\n }\n\n _Iter&\n operator--()\n {\n\tbase_type::operator--();\n\treturn *this;\n }\n\n _Iter\n operator--(int)\n {\n\t_Iter ret(base_type::m_p_nd);\n\toperator--();\n\treturn ret;\n }\n };\n\n#undef PB_DS_CONST_ODIR_IT_C_DEC\n#undef PB_DS_ODIR_IT_C_DEC\n\n\n#define PB_DS_PAT_TRIE_NODE_CONST_ITERATOR_C_DEC \\\n _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc>\n\n#define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC \\\n _Node_iter<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc>\n\n /// Node const iterator.\n template<typename Node,\n\t typename Leaf,\n\t typename Head,\n\t typename Inode,\n\t typename _CIterator,\n\t typename Iterator,\n\t typename _Alloc>\n class _Node_citer\n {\n protected:\n typedef typename rebind_traits<_Alloc, Node>::pointer\tnode_pointer;\n\n typedef typename rebind_traits<_Alloc, Leaf>::pointer\tleaf_pointer;\n typedef typename rebind_traits<_Alloc, Leaf>::const_pointer\tleaf_const_pointer;\n\n typedef typename rebind_traits<_Alloc, Inode>::pointer \tinode_pointer;\n typedef typename rebind_traits<_Alloc, Inode>::const_pointer inode_const_pointer;\n\n typedef typename Node::a_const_pointer\t\ta_const_pointer;\n typedef typename Node::a_const_iterator\t\ta_const_iterator;\n\n private:\n a_const_iterator\n pref_begin() const\n {\n\tif (m_p_nd->m_type == leaf_node)\n\t {\n\t leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd);\n\t return m_p_traits->begin(m_p_traits->extract_key(lcp->value()));\n\t }\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);\n\treturn static_cast<inode_const_pointer>(m_p_nd)->pref_b_it();\n }\n\n a_const_iterator\n pref_end() const\n {\n\tif (m_p_nd->m_type == leaf_node)\n\t {\n\t leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd);\n\t return m_p_traits->end(m_p_traits->extract_key(lcp->value()));\n\t }\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);\n\treturn static_cast<inode_const_pointer>(m_p_nd)->pref_e_it();\n }\n\n public:\n typedef trivial_iterator_tag \t\t\titerator_category;\n typedef trivial_iterator_difference_type \t\tdifference_type;\n typedef typename _Alloc::size_type \t\tsize_type;\n\n typedef _CIterator \t\t \t\tvalue_type;\n typedef value_type \t\t\t\treference;\n typedef value_type \t\t\t\tconst_reference;\n\n /// Metadata type.\n typedef typename Node::metadata_type \t\tmetadata_type;\n\n /// Const metadata reference type.\n typedef typename rebind_traits<_Alloc, metadata_type>::const_reference metadata_const_reference;\n\n inline\n _Node_citer(node_pointer p_nd = 0, a_const_pointer p_traits = 0)\n : m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)\n { }\n\n /// Subtree valid prefix.\n std::pair<a_const_iterator, a_const_iterator>\n valid_prefix() const\n { return std::make_pair(pref_begin(), pref_end()); }\n\n /// Const access; returns the __const iterator* associated with\n /// the current leaf.\n const_reference\n operator*() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(num_children() == 0);\n\treturn _CIterator(m_p_nd);\n }\n\n /// Metadata access.\n metadata_const_reference\n get_metadata() const\n { return m_p_nd->get_metadata(); }\n\n /// Returns the number of children in the corresponding node.\n size_type\n num_children() const\n {\n\tif (m_p_nd->m_type == leaf_node)\n\t return 0;\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);\n\tinode_pointer inp = static_cast<inode_pointer>(m_p_nd);\n\treturn std::distance(inp->begin(), inp->end());\n }\n\n /// Returns a __const node __iterator to the corresponding node's\n /// i-th child.\n _Node_citer\n get_child(size_type i) const\n {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);\n\tinode_pointer inp = static_cast<inode_pointer>(m_p_nd);\n\ttypename Inode::iterator it = inp->begin();\n\tstd::advance(it, i);\n\treturn _Node_citer(*it, m_p_traits);\n }\n\n /// Compares content to a different iterator object.\n bool\n operator==(const _Node_citer& other) const\n { return m_p_nd == other.m_p_nd; }\n\n /// Compares content (negatively) to a different iterator object.\n bool\n operator!=(const _Node_citer& other) const\n { return m_p_nd != other.m_p_nd; }\n\n node_pointer \t\t\tm_p_nd;\n a_const_pointer \t\t\tm_p_traits;\n };\n\n\n /// Node iterator.\n template<typename Node,\n\t typename Leaf,\n\t typename Head,\n\t typename Inode,\n\t typename _CIterator,\n\t typename Iterator,\n\t typename _Alloc>\n class _Node_iter\n : public _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _Alloc>\n {\n private:\n typedef _Node_citer<Node, Leaf, Head, Inode,\n\t\t\t _CIterator, Iterator, _Alloc>\tbase_type;\n typedef typename rebind_traits<_Alloc, Node>::pointer\tnode_pointer;\n typedef typename base_type::inode_pointer \tinode_pointer;\n typedef typename base_type::a_const_pointer \ta_const_pointer;\n typedef Iterator \t\t\t\t\titerator;\n\n public:\n typedef typename base_type::size_type \t\tsize_type;\n\n typedef Iterator \t\t\t\t\tvalue_type;\n typedef value_type \t\t\t\treference;\n typedef value_type \t\t\t\tconst_reference;\n\n _Node_iter(node_pointer p_nd = 0, a_const_pointer p_traits = 0)\n : base_type(p_nd, p_traits)\n { }\n\n /// Access; returns the iterator* associated with the current leaf.\n reference\n operator*() const\n {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::num_children() == 0);\n\treturn iterator(base_type::m_p_nd);\n }\n\n /// Returns a node __iterator to the corresponding node's i-th child.\n _Node_iter\n get_child(size_type i) const\n {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == i_node);\n\n\ttypename Inode::iterator it =\n\t static_cast<inode_pointer>(base_type::m_p_nd)->begin();\n\n\tstd::advance(it, i);\n\treturn _Node_iter(*it, base_type::m_p_traits);\n }\n };\n };\n\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename _ATraits, typename Metadata>\n\n#define PB_DS_CLASS_C_DEC \\\n pat_trie_base::_Inode<_ATraits, Metadata>\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::__rebind_l\n PB_DS_CLASS_C_DEC::s_leaf_alloc;\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::__rebind_in\n PB_DS_CLASS_C_DEC::s_inode_alloc;\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::size_type\n PB_DS_CLASS_C_DEC::\n get_pref_pos(a_const_iterator b_it, a_const_iterator e_it,\n\t\t a_const_pointer p_traits) const\n {\n if (static_cast<std::size_t>(std::distance(b_it, e_it)) <= m_e_ind)\n\treturn 0;\n std::advance(b_it, m_e_ind);\n return 1 + p_traits->e_pos(*b_it);\n }\n\n PB_DS_CLASS_T_DEC\n PB_DS_CLASS_C_DEC::\n _Inode(size_type len, const a_const_iterator it)\n : base_type(i_node), m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it)\n {\n std::advance(m_pref_e_it, m_e_ind);\n std::fill(m_a_p_children, m_a_p_children + arr_size,\n\t\tstatic_cast<node_pointer>(0));\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n update_prefixes(a_const_pointer p_traits)\n {\n node_pointer p_first = *begin();\n if (p_first->m_type == leaf_node)\n\t{\n\t leaf_const_pointer p = static_cast<leaf_const_pointer>(p_first);\n\t m_pref_b_it = p_traits->begin(access_traits::extract_key(p->value()));\n\t}\n else\n\t{\n\t inode_pointer p = static_cast<inode_pointer>(p_first);\n\t _GLIBCXX_DEBUG_ASSERT(p_first->m_type == i_node);\n\t m_pref_b_it = p->pref_b_it();\n\t}\n m_pref_e_it = m_pref_b_it;\n std::advance(m_pref_e_it, m_e_ind);\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::const_iterator\n PB_DS_CLASS_C_DEC::\n begin() const\n {\n typedef node_pointer_pointer pointer_type;\n pointer_type p = const_cast<pointer_type>(m_a_p_children);\n return const_iterator(p + get_begin_pos(), p + arr_size);\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::iterator\n PB_DS_CLASS_C_DEC::\n begin()\n {\n return iterator(m_a_p_children + get_begin_pos(),\n\t\t m_a_p_children + arr_size);\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::const_iterator\n PB_DS_CLASS_C_DEC::\n end() const\n {\n typedef node_pointer_pointer pointer_type;\n pointer_type p = const_cast<pointer_type>(m_a_p_children) + arr_size;\n return const_iterator(p, p);\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::iterator\n PB_DS_CLASS_C_DEC::\n end()\n { return iterator(m_a_p_children + arr_size, m_a_p_children + arr_size); }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::node_pointer\n PB_DS_CLASS_C_DEC::\n get_child_node(a_const_iterator b_it, a_const_iterator e_it,\n\t\t a_const_pointer p_traits)\n {\n const size_type i = get_pref_pos(b_it, e_it, p_traits);\n _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n return m_a_p_children[i];\n }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::iterator\n PB_DS_CLASS_C_DEC::\n get_child_it(a_const_iterator b_it, a_const_iterator e_it,\n\t\t a_const_pointer p_traits)\n {\n const size_type i = get_pref_pos(b_it, e_it, p_traits);\n _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != 0);\n return iterator(m_a_p_children + i, m_a_p_children + i);\n }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::node_const_pointer\n PB_DS_CLASS_C_DEC::\n get_child_node(a_const_iterator b_it, a_const_iterator e_it,\n\t\t a_const_pointer p_traits) const\n { return const_cast<node_pointer>(get_child_node(b_it, e_it, p_traits)); }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::node_pointer\n PB_DS_CLASS_C_DEC::\n get_lower_bound_child_node(a_const_iterator b_it, a_const_iterator e_it,\n\t\t\t size_type checked_ind,\n\t\t\t a_const_pointer p_traits)\n {\n if (!should_be_mine(b_it, e_it, checked_ind, p_traits))\n\t{\n\t if (p_traits->cmp_prefixes(b_it, e_it, m_pref_b_it,\n\t\t\t\t m_pref_e_it, true))\n\t return leftmost_descendant();\n\t return rightmost_descendant();\n\t}\n\n size_type i = get_pref_pos(b_it, e_it, p_traits);\n _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n\n if (m_a_p_children[i] != 0)\n\treturn m_a_p_children[i];\n\n while (++i < arr_size)\n\tif (m_a_p_children[i] != 0)\n\t {\n\t const node_type& __nt = m_a_p_children[i]->m_type;\n\t node_pointer ret = m_a_p_children[i];\n\n\t if (__nt == leaf_node)\n\t return ret;\n\n\t _GLIBCXX_DEBUG_ASSERT(__nt == i_node);\n\t inode_pointer inp = static_cast<inode_pointer>(ret);\n\t return inp->leftmost_descendant();\n\t }\n\n return rightmost_descendant();\n }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::node_pointer\n PB_DS_CLASS_C_DEC::\n add_child(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it,\n\t a_const_pointer p_traits)\n {\n const size_type i = get_pref_pos(b_it, e_it, p_traits);\n _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n if (m_a_p_children[i] == 0)\n\t{\n\t m_a_p_children[i] = p_nd;\n\t p_nd->m_p_parent = this;\n\t return p_nd;\n\t}\n return m_a_p_children[i];\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::node_const_pointer\n PB_DS_CLASS_C_DEC::\n get_join_child(node_const_pointer p_nd,\n\t\t a_const_pointer p_tr) const\n {\n node_pointer p = const_cast<node_pointer>(p_nd);\n return const_cast<inode_pointer>(this)->get_join_child(p, p_tr);\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::node_pointer\n PB_DS_CLASS_C_DEC::\n get_join_child(node_pointer p_nd, a_const_pointer p_traits)\n {\n size_type i;\n a_const_iterator b_it;\n a_const_iterator e_it;\n if (p_nd->m_type == leaf_node)\n\t{\n\t leaf_const_pointer p = static_cast<leaf_const_pointer>(p_nd);\n\n\t typedef typename type_traits::key_const_reference kcr;\n\t kcr r_key = access_traits::extract_key(p->value());\n\t b_it = p_traits->begin(r_key);\n\t e_it = p_traits->end(r_key);\n\t}\n else\n\t{\n\t b_it = static_cast<inode_pointer>(p_nd)->pref_b_it();\n\t e_it = static_cast<inode_pointer>(p_nd)->pref_e_it();\n\t}\n i = get_pref_pos(b_it, e_it, p_traits);\n _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n return m_a_p_children[i];\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n remove_child(node_pointer p_nd)\n {\n size_type i = 0;\n for (; i < arr_size; ++i)\n\tif (m_a_p_children[i] == p_nd)\n\t {\n\t m_a_p_children[i] = 0;\n\t return;\n\t }\n _GLIBCXX_DEBUG_ASSERT(i != arr_size);\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n remove_child(iterator it)\n { *it.m_p_p_cur = 0; }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n replace_child(node_pointer p_nd, a_const_iterator b_it,\n\t\t a_const_iterator e_it,\n\t\t a_const_pointer p_traits)\n {\n const size_type i = get_pref_pos(b_it, e_it, p_traits);\n _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n m_a_p_children[i] = p_nd;\n p_nd->m_p_parent = this;\n }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::a_const_iterator\n PB_DS_CLASS_C_DEC::\n pref_b_it() const\n { return m_pref_b_it; }\n\n PB_DS_CLASS_T_DEC\n inline typename PB_DS_CLASS_C_DEC::a_const_iterator\n PB_DS_CLASS_C_DEC::\n pref_e_it() const\n { return m_pref_e_it; }\n\n PB_DS_CLASS_T_DEC\n bool\n PB_DS_CLASS_C_DEC::\n should_be_mine(a_const_iterator b_it, a_const_iterator e_it,\n\t\t size_type checked_ind,\n\t\t a_const_pointer p_traits) const\n {\n if (m_e_ind == 0)\n\treturn true;\n\n const size_type num_es = std::distance(b_it, e_it);\n if (num_es < m_e_ind)\n\treturn false;\n\n a_const_iterator key_b_it = b_it;\n std::advance(key_b_it, checked_ind);\n a_const_iterator key_e_it = b_it;\n std::advance(key_e_it, m_e_ind);\n\n a_const_iterator value_b_it = m_pref_b_it;\n std::advance(value_b_it, checked_ind);\n a_const_iterator value_e_it = m_pref_b_it;\n std::advance(value_e_it, m_e_ind);\n\n return p_traits->equal_prefixes(key_b_it, key_e_it, value_b_it,\n\t\t\t\t value_e_it);\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::leaf_pointer\n PB_DS_CLASS_C_DEC::\n leftmost_descendant()\n {\n node_pointer p_pot = *begin();\n if (p_pot->m_type == leaf_node)\n\treturn (static_cast<leaf_pointer>(p_pot));\n _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node);\n return static_cast<inode_pointer>(p_pot)->leftmost_descendant();\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::leaf_const_pointer\n PB_DS_CLASS_C_DEC::\n leftmost_descendant() const\n { return const_cast<inode_pointer>(this)->leftmost_descendant(); }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::leaf_pointer\n PB_DS_CLASS_C_DEC::\n rightmost_descendant()\n {\n const size_type num_children = std::distance(begin(), end());\n _GLIBCXX_DEBUG_ASSERT(num_children >= 2);\n\n iterator it = begin();\n std::advance(it, num_children - 1);\n node_pointer p_pot =* it;\n if (p_pot->m_type == leaf_node)\n\treturn static_cast<leaf_pointer>(p_pot);\n _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node);\n return static_cast<inode_pointer>(p_pot)->rightmost_descendant();\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::leaf_const_pointer\n PB_DS_CLASS_C_DEC::\n rightmost_descendant() const\n { return const_cast<inode_pointer>(this)->rightmost_descendant(); }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::size_type\n PB_DS_CLASS_C_DEC::\n get_begin_pos() const\n {\n size_type i = 0;\n for (; i < arr_size && m_a_p_children[i] == 0; ++i)\n\t;\n return i;\n }\n\n#ifdef _GLIBCXX_DEBUG\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::node_debug_info\n PB_DS_CLASS_C_DEC::\n assert_valid_imp(a_const_pointer p_traits,\n\t\t const char* __file, int __line) const\n {\n PB_DS_DEBUG_VERIFY(base_type::m_type == i_node);\n PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(pref_b_it(), pref_e_it())) == m_e_ind);\n PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) >= 2);\n\n for (typename _Inode::const_iterator it = begin(); it != end(); ++it)\n\t{\n\t node_const_pointer p_nd = *it;\n\t PB_DS_DEBUG_VERIFY(p_nd->m_p_parent == this);\n\t node_debug_info child_ret = p_nd->assert_valid_imp(p_traits,\n\t\t\t\t\t\t\t __file, __line);\n\n\t PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(child_ret.first, child_ret.second)) >= m_e_ind);\n\t PB_DS_DEBUG_VERIFY(should_be_mine(child_ret.first, child_ret.second, 0, p_traits));\n\t PB_DS_DEBUG_VERIFY(get_pref_pos(child_ret.first, child_ret.second, p_traits) == static_cast<size_type>(it.m_p_p_cur - m_a_p_children));\n\t}\n return std::make_pair(pref_b_it(), pref_e_it());\n }\n#endif\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/policy_access_fn_imps.hpp\n * Contains an implementation class for pat_trie.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::access_traits& \nPB_DS_CLASS_C_DEC::\nget_access_traits()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst typename PB_DS_CLASS_C_DEC::access_traits& \nPB_DS_CLASS_C_DEC::\nget_access_traits() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_update& \nPB_DS_CLASS_C_DEC::\nget_node_update()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst typename PB_DS_CLASS_C_DEC::node_update& \nPB_DS_CLASS_C_DEC::\nget_node_update() const\n{ return *this; }\n#endif\n","include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/r_erase_fn_imps.hpp\n * Contains an implementation class for pat_trie.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_node(node_pointer p_z)\n{\n _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n --m_size;\n _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_z->m_value)));\n p_z->~node();\n s_node_allocator.deallocate(p_z, 1);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_erased_node(node_pointer p_z)\n{\n if (m_size == 1)\n {\n m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;\n return;\n }\n\n if (m_p_head->m_p_left == p_z)\n {\n iterator it(p_z);\n ++it;\n m_p_head->m_p_left = it.m_p_nd;\n }\n else if (m_p_head->m_p_right == p_z)\n {\n iterator it(p_z);\n --it;\n m_p_head->m_p_right = it.m_p_nd;\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n _GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)\n clear_imp(m_p_head->m_p_parent);\n m_size = 0;\n initialize();\n _GLIBCXX_DEBUG_ONLY(debug_base::clear();)\n _GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n if (p_nd == 0)\n return;\n clear_imp(p_nd->m_p_left);\n clear_imp(p_nd->m_p_right);\n p_nd->~Node();\n s_node_allocator.deallocate(p_nd, 1);\n}\n\n#endif\n","include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/rotate_fn_imps.hpp\n * Contains imps for rotating nodes.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_left(node_pointer p_x)\n{\n node_pointer p_y = p_x->m_p_right;\n p_x->m_p_right = p_y->m_p_left;\n\n if (p_y->m_p_left != 0)\n p_y->m_p_left->m_p_parent = p_x;\n\n p_y->m_p_parent = p_x->m_p_parent;\n if (p_x == m_p_head->m_p_parent)\n m_p_head->m_p_parent = p_y;\n else if (p_x == p_x->m_p_parent->m_p_left)\n p_x->m_p_parent->m_p_left = p_y;\n else\n p_x->m_p_parent->m_p_right = p_y;\n\n p_y->m_p_left = p_x;\n p_x->m_p_parent = p_y;\n\n _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)\n _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)\n\n apply_update(p_x, (Node_Update*)this);\n apply_update(p_x->m_p_parent, (Node_Update*)this);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_right(node_pointer p_x)\n{\n node_pointer p_y = p_x->m_p_left;\n p_x->m_p_left = p_y->m_p_right;\n\n if (p_y->m_p_right != 0)\n p_y->m_p_right->m_p_parent = p_x;\n\n p_y->m_p_parent = p_x->m_p_parent;\n if (p_x == m_p_head->m_p_parent)\n m_p_head->m_p_parent = p_y;\n else if (p_x == p_x->m_p_parent->m_p_right)\n p_x->m_p_parent->m_p_right = p_y;\n else\n p_x->m_p_parent->m_p_left = p_y;\n\n p_y->m_p_right = p_x;\n p_x->m_p_parent = p_y;\n\n _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)\n _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)\n\n apply_update(p_x, (Node_Update*)this);\n apply_update(p_x->m_p_parent, (Node_Update*)this);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_parent(node_pointer p_nd)\n{\n node_pointer p_parent = p_nd->m_p_parent;\n if (p_nd == p_parent->m_p_left)\n rotate_right(p_parent);\n else\n rotate_left(p_parent);\n _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd);\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent || p_nd->m_p_right == p_parent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer /*p_nd*/, __gnu_pbds::null_node_update* /*p_update*/)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer p_nd, Node_Update_* p_update)\n{\n p_update->operator()(& PB_DS_V2F(p_nd->m_value),(p_nd->m_p_left == 0) ?\n\t\t\t0 :\n\t\t\t& PB_DS_V2F(p_nd->m_p_left->m_value),(p_nd->m_p_right == 0) ?\n\t\t\t0 :\n\t\t\t& PB_DS_V2F(p_nd->m_p_right->m_value));\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_to_top(node_pointer p_nd, Node_Update_* p_update)\n{\n while (p_nd != m_p_head)\n {\n apply_update(p_nd, p_update);\n p_nd = p_nd->m_p_parent;\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_to_top(node_pointer /*p_nd*/, __gnu_pbds::null_node_update* /*p_update*/)\n{ }\n\n#endif\n","include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/split_fn_imps.hpp\n * Contains an implementation class for pat_trie.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n branch_bag bag;\n leaf_pointer p_split_lf = split_prep(r_key, other, bag);\n if (p_split_lf == 0)\n {\n _GLIBCXX_DEBUG_ASSERT(bag.empty());\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n _GLIBCXX_DEBUG_ASSERT(!bag.empty());\n other.clear();\n\n m_p_head->m_p_parent = rec_split(m_p_head->m_p_parent, pref_begin(p_split_lf),\n\t\t\t\t pref_end(p_split_lf), other, bag);\n\n m_p_head->m_p_parent->m_p_parent = m_p_head;\n\n head_pointer __ohead = other.m_p_head;\n __ohead->m_p_max = m_p_head->m_p_max;\n m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);\n __ohead->m_p_min = other.leftmost_descendant(__ohead->m_p_parent);\n\n other.m_size = std::distance(other.PB_DS_CLASS_C_DEC::begin(),\n\t\t\t other.PB_DS_CLASS_C_DEC::end());\n m_size -= other.m_size;\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::leaf_pointer\nPB_DS_CLASS_C_DEC::\nsplit_prep(key_const_reference r_key, PB_DS_CLASS_C_DEC& other,\n\t branch_bag& r_bag)\n{\n _GLIBCXX_DEBUG_ASSERT(r_bag.empty());\n if (m_size == 0)\n {\n other.clear();\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return 0;\n }\n\n if (synth_access_traits::cmp_keys(r_key,\n\t\t\t\t PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value())))\n {\n other.clear();\n value_swap(other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return 0;\n }\n\n if (!synth_access_traits::cmp_keys(r_key,\n\t\t\t\t PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value())))\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return 0;\n }\n\n iterator it = lower_bound(r_key);\n\n if (!synth_access_traits::equal_keys(PB_DS_V2F(*it), r_key))\n --it;\n\n node_pointer p_nd = it.m_p_nd;\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);\n leaf_pointer p_ret_l = static_cast<leaf_pointer>(p_nd);\n while (p_nd->m_type != head_node)\n {\n r_bag.add_branch();\n p_nd = p_nd->m_p_parent;\n }\n _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(synth_access_traits&)(*this), other);)\n\n return p_ret_l;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_split(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it,\n\t PB_DS_CLASS_C_DEC& other, branch_bag& r_bag)\n{\n if (p_nd->m_type == leaf_node)\n {\n _GLIBCXX_DEBUG_ASSERT(other.m_p_head->m_p_parent == 0);\n return p_nd;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);\n inode_pointer p_ind = static_cast<inode_pointer>(p_nd);\n\n node_pointer pfirst = p_ind->get_child_node(b_it, e_it, this);\n node_pointer p_child_ret = rec_split(pfirst, b_it, e_it, other, r_bag);\n PB_DS_ASSERT_NODE_VALID(p_child_ret)\n p_ind->replace_child(p_child_ret, b_it, e_it, this);\n apply_update(p_ind, (node_update*)this);\n\n inode_iterator child_it = p_ind->get_child_it(b_it, e_it, this);\n const size_type lhs_dist = std::distance(p_ind->begin(), child_it);\n const size_type lhs_num_children = lhs_dist + 1;\n _GLIBCXX_DEBUG_ASSERT(lhs_num_children > 0);\n\n const size_type rhs_dist = std::distance(p_ind->begin(), p_ind->end());\n size_type rhs_num_children = rhs_dist - lhs_num_children;\n if (rhs_num_children == 0)\n {\n apply_update(p_ind, (node_update*)this);\n return p_ind;\n }\n\n other.split_insert_branch(p_ind->get_e_ind(), b_it, child_it,\n\t\t\t rhs_num_children, r_bag);\n\n child_it = p_ind->get_child_it(b_it, e_it, this);\n while (rhs_num_children != 0)\n {\n ++child_it;\n p_ind->remove_child(child_it);\n --rhs_num_children;\n }\n apply_update(p_ind, (node_update*)this);\n\n const size_type int_dist = std::distance(p_ind->begin(), p_ind->end());\n _GLIBCXX_DEBUG_ASSERT(int_dist >= 1);\n if (int_dist > 1)\n {\n p_ind->update_prefixes(this);\n PB_DS_ASSERT_NODE_VALID(p_ind)\n apply_update(p_ind, (node_update*)this);\n return p_ind;\n }\n\n node_pointer p_ret = *p_ind->begin();\n p_ind->~inode();\n s_inode_allocator.deallocate(p_ind, 1);\n apply_update(p_ret, (node_update*)this);\n return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit_insert_branch(size_type e_ind, a_const_iterator b_it,\n\t\t inode_iterator child_b_it,\n\t\t size_type num_children, branch_bag& r_bag)\n{\n#ifdef _GLIBCXX_DEBUG\n if (m_p_head->m_p_parent != 0)\n PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)\n#endif\n\n const size_type start = m_p_head->m_p_parent == 0 ? 0 : 1;\n const size_type total_num_children = start + num_children;\n if (total_num_children == 0)\n {\n _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);\n return;\n }\n\n if (total_num_children == 1)\n {\n if (m_p_head->m_p_parent != 0)\n\t{\n\t PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)\n\t return;\n\t}\n\n _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);\n ++child_b_it;\n m_p_head->m_p_parent = *child_b_it;\n m_p_head->m_p_parent->m_p_parent = m_p_head;\n apply_update(m_p_head->m_p_parent, (node_update*)this);\n PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)\n return;\n }\n\n _GLIBCXX_DEBUG_ASSERT(total_num_children > 1);\n inode_pointer p_new_root = r_bag.get_branch();\n new (p_new_root) inode(e_ind, b_it);\n size_type num_inserted = 0;\n while (num_inserted++ < num_children)\n {\n ++child_b_it;\n PB_DS_ASSERT_NODE_VALID((*child_b_it))\n p_new_root->add_child(*child_b_it, pref_begin(*child_b_it),\n\t\t\t pref_end(*child_b_it), this);\n }\n\n if (m_p_head->m_p_parent != 0)\n p_new_root->add_child(m_p_head->m_p_parent,\n\t\t\t pref_begin(m_p_head->m_p_parent),\n\t\t\t pref_end(m_p_head->m_p_parent), this);\n\n m_p_head->m_p_parent = p_new_root;\n p_new_root->m_p_parent = m_p_head;\n apply_update(m_p_head->m_p_parent, (node_update*)this);\n PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)\n}\n#endif\n","include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/synth_access_traits.hpp\n * Contains an implementation class for a patricia tree.\n */\n\n#ifndef PB_DS_SYNTH_E_ACCESS_TRAITS_HPP\n#define PB_DS_SYNTH_E_ACCESS_TRAITS_HPP\n\n#include <ext/pb_ds/detail/type_utils.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n\n#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \\\n template<typename Type_Traits, bool Set, typename _ATraits>\n\n#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \\\n synth_access_traits<Type_Traits, Set, _ATraits>\n\n /// Synthetic element access traits.\n template<typename Type_Traits, bool Set, typename _ATraits>\n struct synth_access_traits : public _ATraits\n {\n typedef _ATraits \t\t\t\t\tbase_type;\n typedef typename base_type::const_iterator\tconst_iterator;\n typedef Type_Traits \t\t\t\ttype_traits;\n typedef typename type_traits::const_reference \tconst_reference;\n typedef typename type_traits::key_const_reference key_const_reference;\n\n synth_access_traits();\n\n synth_access_traits(const base_type&);\n\n inline bool\n equal_prefixes(const_iterator, const_iterator, const_iterator,\n\t\t const_iterator, bool compare_after = true) const;\n\n bool\n equal_keys(key_const_reference, key_const_reference) const;\n\n bool\n cmp_prefixes(const_iterator, const_iterator, const_iterator,\n\t\t const_iterator, bool compare_after = false) const;\n\n bool\n cmp_keys(key_const_reference, key_const_reference) const;\n\n inline static key_const_reference\n extract_key(const_reference);\n\n#ifdef _GLIBCXX_DEBUG\n bool\n operator()(key_const_reference, key_const_reference);\n#endif\n\n private:\n inline static key_const_reference\n extract_key(const_reference, true_type);\n\n inline static key_const_reference\n extract_key(const_reference, false_type);\n\n static integral_constant<int, Set> s_set_ind;\n };\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n integral_constant<int,Set>\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::s_set_ind;\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n synth_access_traits()\n { }\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n synth_access_traits(const _ATraits& r_traits) \n : _ATraits(r_traits)\n { }\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n inline bool\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n equal_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,\n\t\t const_iterator e_r, bool compare_after /*= false */) const\n {\n while (b_l != e_l)\n\t{\n\t if (b_r == e_r)\n\t return false;\n\t if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r))\n\t return false;\n\t ++b_l;\n\t ++b_r;\n\t}\n return (!compare_after || b_r == e_r);\n }\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n bool\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n equal_keys(key_const_reference r_lhs_key,\n\t key_const_reference r_rhs_key) const\n {\n return equal_prefixes(base_type::begin(r_lhs_key),\n\t\t\t base_type::end(r_lhs_key),\n\t\t\t base_type::begin(r_rhs_key),\n\t\t\t base_type::end(r_rhs_key),\n\t\t\t true);\n }\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n bool\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n cmp_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,\n\t\t const_iterator e_r, bool compare_after /* = false*/) const\n {\n while (b_l != e_l)\n\t{\n\t if (b_r == e_r)\n\t return false;\n\n\t const typename base_type::size_type l_pos = base_type::e_pos(*b_l);\n\t const typename base_type::size_type r_pos = base_type::e_pos(*b_r);\n\t if (l_pos != r_pos)\n\t return l_pos < r_pos;\n\t ++b_l;\n\t ++b_r;\n\t}\n\n if (!compare_after)\n\treturn false;\n return b_r != e_r;\n }\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n bool\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n cmp_keys(key_const_reference r_lhs_key,\n\t key_const_reference r_rhs_key) const\n {\n return cmp_prefixes(base_type::begin(r_lhs_key),\n\t\t\t base_type::end(r_lhs_key),\n\t\t\t base_type::begin(r_rhs_key),\n\t\t\t base_type::end(r_rhs_key),\n\t\t\t true);\n }\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n extract_key(const_reference r_val)\n { return extract_key(r_val, s_set_ind); }\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n extract_key(const_reference r_val, true_type)\n { return r_val; }\n\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n extract_key(const_reference r_val, false_type)\n { return r_val.first; }\n\n#ifdef _GLIBCXX_DEBUG\n PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n bool\n PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n operator()(key_const_reference r_lhs, key_const_reference r_rhs)\n { return cmp_keys(r_lhs, r_rhs); }\n#endif\n\n#undef PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n#undef PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/trace_fn_imps.hpp\n * Contains an implementation class for pat_trie_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef PB_DS_PAT_TRIE_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n std::cerr << std::endl;\n if (m_p_head->m_p_parent == 0)\n return;\n trace_node(m_p_head->m_p_parent, 0);\n std::cerr << std::endl;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node(node_const_pointer p_nd, size_type level)\n{\n for (size_type i = 0; i < level; ++i)\n std::cerr << ' ';\n std::cerr << p_nd << \" \";\n std::cerr << ((p_nd->m_type == pat_trie_leaf_node_type) ? \"l \" : \"i \");\n\n trace_node_metadata(p_nd, type_to_type<typename node::metadata_type>());\n typename access_traits::const_iterator el_it = pref_begin(p_nd);\n while (el_it != pref_end(p_nd))\n {\n std::cerr <<* el_it;\n ++el_it;\n }\n\n if (p_nd->m_type == pat_trie_leaf_node_type)\n {\n std::cerr << std::endl;\n return;\n }\n\n inode_const_pointer p_internal = static_cast<inode_const_pointer>(p_nd);\n\n std::cerr << \" \" <<\n static_cast<unsigned long>(p_internal->get_e_ind()) << std::endl;\n\n const size_type num_children = std::distance(p_internal->begin(),\n\t\t\t\t\t p_internal->end());\n\n for (size_type child_i = 0; child_i < num_children; ++child_i)\n {\n typename inode::const_iterator child_it = p_internal->begin();\n std::advance(child_it, num_children - child_i - 1);\n trace_node(*child_it, level + 1);\n }\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Metadata_>\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>)\n{\n std::cerr << \"(\" << static_cast<unsigned long>(p_nd->get_metadata()) << \") \";\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node_metadata(node_const_pointer, type_to_type<null_type>)\n{ }\n\n#endif \n\n#endif\n","include/ext/pb_ds/detail/pat_trie_/traits.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/traits.hpp\n * Contains an implementation class for pat_trie_.\n */\n\n#ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp>\n#include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Specialization.\n /// @ingroup traits\n template<typename Key,\n\t typename Mapped,\n\t typename _ATraits,\n\t template<typename Node_CItr,\n\t\t typename Node_Itr,\n\t\t typename Cmp_Fn_,\n\t\t typename _Alloc_>\n\t class Node_Update,\n\t typename _Alloc>\n struct trie_traits<Key, Mapped, _ATraits, Node_Update, pat_trie_tag, _Alloc>\n {\n private:\n typedef pat_trie_base\t\t\t\t \tbase_type;\n typedef types_traits<Key, Mapped, _Alloc, false> \t\ttype_traits;\n\n public:\n typedef typename trie_node_metadata_dispatch<Key, Mapped, _ATraits, Node_Update, _Alloc>::type metadata_type;\n typedef base_type::_Metadata<metadata_type, _Alloc> \tmetadata;\n typedef _ATraits \t\t \t\t\t \taccess_traits;\n\n /// Type for synthesized traits.\n typedef __gnu_pbds::detail::synth_access_traits<type_traits, false, access_traits> synth_access_traits;\n\n typedef base_type::_Node_base<synth_access_traits, metadata> \tnode;\n typedef base_type::_Head<synth_access_traits, metadata>\t \thead;\n typedef base_type::_Leaf<synth_access_traits, metadata>\t \tleaf;\n typedef base_type::_Inode<synth_access_traits, metadata> \t\tinode;\n\n typedef base_type::_Iter<node, leaf, head, inode, true>\t \titerator;\n typedef base_type::_CIter<node, leaf, head, inode, true> \t \tconst_iterator;\n typedef base_type::_Iter<node, leaf, head, inode, false> \t\treverse_iterator;\n typedef base_type::_CIter<node, leaf, head, inode, false>\t \tconst_reverse_iterator;\n\n /// This is an iterator to an iterator: it iterates over nodes,\n /// and de-referencing it returns one of the tree's iterators.\n typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;\n\n typedef base_type::_Node_iter<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_iterator;\n\n /// Type for node update.\n typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> \t\tnode_update;\n\n typedef null_node_update<node_const_iterator, node_iterator, _ATraits, _Alloc>* \t\tnull_node_update_pointer;\n };\n\n\n /// Specialization.\n /// @ingroup traits\n template<typename Key,\n\t typename _ATraits,\n\t template<typename Node_CItr,\n\t\t typename Node_Itr,\n\t\t typename Cmp_Fn_,\n\t\t typename _Alloc_>\n\t class Node_Update,\n\t typename _Alloc>\n struct trie_traits<Key, null_type, _ATraits, Node_Update, pat_trie_tag, _Alloc>\n {\n private:\n typedef pat_trie_base\t\t\t\t\tbase_type;\n typedef types_traits<Key, null_type, _Alloc, false> \ttype_traits;\n\n public:\n typedef typename trie_node_metadata_dispatch<Key, null_type, _ATraits, Node_Update, _Alloc>::type metadata_type;\n typedef base_type::_Metadata<metadata_type, _Alloc>\t\t\t\tmetadata;\n typedef _ATraits \t\t\t\t \t\t\t\t\taccess_traits;\n\n /// Type for synthesized traits.\n typedef __gnu_pbds::detail::synth_access_traits<type_traits, true, access_traits> synth_access_traits;\n\n typedef base_type::_Node_base<synth_access_traits, metadata> \tnode;\n typedef base_type::_Head<synth_access_traits, metadata> \t \thead;\n typedef base_type::_Leaf<synth_access_traits, metadata> \t \tleaf;\n typedef base_type::_Inode<synth_access_traits, metadata> \t \tinode;\n\n typedef base_type::_CIter<node, leaf, head, inode, true> \t\tconst_iterator;\n typedef const_iterator \t\t\t\t\t \titerator;\n typedef base_type::_CIter<node, leaf, head, inode, false>\t \tconst_reverse_iterator;\n typedef const_reverse_iterator \t\t\t \t\treverse_iterator;\n\n /// This is an iterator to an iterator: it iterates over nodes,\n /// and de-referencing it returns one of the tree's iterators.\n typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;\n\n typedef node_const_iterator \t\t\t\t\t\t\t\tnode_iterator;\n\n /// Type for node update.\n typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> \t\tnode_update;\n\n typedef null_node_update<node_const_iterator, node_const_iterator, _ATraits, _Alloc>* \tnull_node_update_pointer;\n };\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP\n","include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_/update_fn_imps.hpp\n * Contains an implementation class for pat_trie_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer, null_node_update_pointer)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer p_nd, Node_Update_*)\n{\n Node_Update_::operator()(node_iterator(p_nd, this),\n\t\t\t node_const_iterator(0, this));\n}\n#endif\n","include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file detail/priority_queue_base_dispatch.hpp\n * Contains an pqiative container dispatching base.\n */\n\n#ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP\n#define PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP\n\n#define PB_DS_ASSERT_VALID(X)\t\t\t\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);)\n\n#define PB_DS_DEBUG_VERIFY(_Cond)\t\t\t\t\t\\\n _GLIBCXX_DEBUG_VERIFY_AT(_Cond,\t\t\t\t\t\\\n\t\t\t _M_message(#_Cond\" assertion from %1;:%2;\")\t\\\n\t\t\t ._M_string(__FILE__)._M_integer(__LINE__)\t\\\n\t\t\t ,__file,__line)\n\n#include <ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp>\n#include <ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp>\n#include <ext/pb_ds/detail/binary_heap_/binary_heap_.hpp>\n#include <ext/pb_ds/detail/thin_heap_/thin_heap_.hpp>\n\n#undef PB_DS_DEBUG_VERIFY\n#undef PB_DS_ASSERT_VALID\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /**\n * @ingroup pbds\n *\n * @{\n */\n\n /// Specialization for pairing_heap.\n template<typename _VTp, typename Cmp_Fn, typename _Alloc>\n struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, pairing_heap_tag,\n\t\t\t\t null_type>\n {\n\t/// Dispatched type.\n\ttypedef pairing_heap<_VTp, Cmp_Fn, _Alloc> \t\ttype;\n };\n\n /// Specialization for binomial_heap.\n template<typename _VTp, typename Cmp_Fn, typename _Alloc>\n struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binomial_heap_tag,\n\t\t\t\t null_type>\n {\n\t/// Dispatched type.\n\ttypedef binomial_heap<_VTp, Cmp_Fn, _Alloc> \t\ttype;\n };\n\n /// Specialization for rc_binary_heap.\n template<typename _VTp, typename Cmp_Fn, typename _Alloc>\n struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, rc_binomial_heap_tag,\n \t\t\t\t null_type>\n {\n\t/// Dispatched type.\n\ttypedef rc_binomial_heap<_VTp, Cmp_Fn, _Alloc>\t \ttype;\n };\n\n /// Specialization for binary_heap.\n template<typename _VTp, typename Cmp_Fn, typename _Alloc>\n struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binary_heap_tag,\n \t\t\t\t null_type>\n {\n\t/// Dispatched type.\n\ttypedef binary_heap<_VTp, Cmp_Fn, _Alloc> \t\ttype;\n };\n\n /// Specialization for thin_heap.\n template<typename _VTp, typename Cmp_Fn, typename _Alloc>\n struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, thin_heap_tag,\n \t\t\t\t null_type> \n {\n\t/// Dispatched type.\n\ttypedef thin_heap<_VTp, Cmp_Fn, _Alloc> \t\ttype;\n };\n ///@} group pbds\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP\n","include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/constructors_destructor_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_RB_TREE_NAME()\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_RB_TREE_NAME(const Cmp_Fn& r_cmp_fn) :\n base_type(r_cmp_fn)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_RB_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :\n base_type(r_cmp_fn, r_node_update)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :\n base_type(other)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n base_type::swap(other);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{ base_type::m_p_head->m_red = true; }\n#endif\n","include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/debug_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(const node_pointer p_nd, const char* __file,\n\t\t\t\t\t\tint __line) const\n{\n if (p_nd == 0)\n return 1;\n\n const size_type l_height =\n assert_node_consistent(p_nd->m_p_left, __file, __line);\n const size_type r_height =\n assert_node_consistent(p_nd->m_p_right, __file, __line);\n if (p_nd->m_red)\n {\n PB_DS_DEBUG_VERIFY(is_effectively_black(p_nd->m_p_left));\n PB_DS_DEBUG_VERIFY(is_effectively_black(p_nd->m_p_right));\n }\n PB_DS_DEBUG_VERIFY(l_height == r_height);\n return (p_nd->m_red ? 0 : 1) + l_height;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n base_type::assert_valid(__file, __line);\n const node_pointer p_head = base_type::m_p_head;\n PB_DS_DEBUG_VERIFY(p_head->m_red);\n if (p_head->m_p_parent != 0)\n {\n PB_DS_DEBUG_VERIFY(!p_head->m_p_parent->m_red);\n assert_node_consistent(p_head->m_p_parent, __file, __line);\n }\n}\n\n#endif \n\n#endif\n","include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/erase_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(key_const_reference r_key)\n{\n point_iterator it = this->find(r_key);\n if (it == base_type::end())\n return false;\n erase(it);\n return true;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nerase(iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n if (it == base_type::end())\n return it;\n\n iterator ret_it = it;\n ++ret_it;\n erase_node(it.m_p_nd);\n PB_DS_ASSERT_VALID((*this))\n return ret_it;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nerase(reverse_iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n if (it.m_p_nd == base_type::m_p_head)\n return it;\n\n reverse_iterator ret_it = it;\n ++ret_it;\n erase_node(it.m_p_nd);\n PB_DS_ASSERT_VALID((*this))\n return ret_it;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n PB_DS_ASSERT_VALID((*this))\n size_type num_ersd = 0;\n iterator it = base_type::begin();\n while (it != base_type::end())\n {\n if (pred(*it))\n {\n\t ++num_ersd;\n\t it = erase(it);\n }\n else\n\t++it;\n }\n\n PB_DS_ASSERT_VALID((*this))\n return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_node(node_pointer p_nd)\n{\n remove_node(p_nd);\n base_type::actual_erase_node(p_nd);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nremove_node(node_pointer p_z)\n{\n this->update_min_max_for_erased_node(p_z);\n node_pointer p_y = p_z;\n node_pointer p_x = 0;\n node_pointer p_new_x_parent = 0;\n\n if (p_y->m_p_left == 0)\n p_x = p_y->m_p_right;\n else if (p_y->m_p_right == 0)\n p_x = p_y->m_p_left;\n else\n {\n p_y = p_y->m_p_right;\n while (p_y->m_p_left != 0)\n\tp_y = p_y->m_p_left;\n p_x = p_y->m_p_right;\n }\n\n if (p_y == p_z)\n {\n p_new_x_parent = p_y->m_p_parent;\n if (p_x != 0)\n\tp_x->m_p_parent = p_y->m_p_parent;\n\n if (base_type::m_p_head->m_p_parent == p_z)\n\tbase_type::m_p_head->m_p_parent = p_x;\n else if (p_z->m_p_parent->m_p_left == p_z)\n {\n\t p_y->m_p_left = p_z->m_p_parent;\n\t p_z->m_p_parent->m_p_left = p_x;\n }\n else\n {\n\t p_y->m_p_left = 0;\n\t p_z->m_p_parent->m_p_right = p_x;\n }\n }\n else\n {\n p_z->m_p_left->m_p_parent = p_y;\n p_y->m_p_left = p_z->m_p_left;\n if (p_y != p_z->m_p_right)\n {\n\t p_new_x_parent = p_y->m_p_parent;\n\t if (p_x != 0)\n\t p_x->m_p_parent = p_y->m_p_parent;\n\t p_y->m_p_parent->m_p_left = p_x;\n\t p_y->m_p_right = p_z->m_p_right;\n\t p_z->m_p_right->m_p_parent = p_y;\n }\n else\n\tp_new_x_parent = p_y;\n\n if (base_type::m_p_head->m_p_parent == p_z)\n\tbase_type::m_p_head->m_p_parent = p_y;\n else if (p_z->m_p_parent->m_p_left == p_z)\n\tp_z->m_p_parent->m_p_left = p_y;\n else\n\tp_z->m_p_parent->m_p_right = p_y;\n\n p_y->m_p_parent = p_z->m_p_parent;\n std::swap(p_y->m_red, p_z->m_red);\n p_y = p_z;\n }\n\n this->update_to_top(p_new_x_parent, (node_update* )this);\n\n if (p_y->m_red)\n return;\n\n remove_fixup(p_x, p_new_x_parent);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nremove_fixup(node_pointer p_x, node_pointer p_new_x_parent)\n{\n _GLIBCXX_DEBUG_ASSERT(p_x == 0 || p_x->m_p_parent == p_new_x_parent);\n\n while (p_x != base_type::m_p_head->m_p_parent && is_effectively_black(p_x))\n if (p_x == p_new_x_parent->m_p_left)\n {\n\tnode_pointer p_w = p_new_x_parent->m_p_right;\n\tif (p_w->m_red)\n\t {\n\t p_w->m_red = false;\n\t p_new_x_parent->m_red = true;\n\t base_type::rotate_left(p_new_x_parent);\n\t p_w = p_new_x_parent->m_p_right;\n\t }\n\n\tif (is_effectively_black(p_w->m_p_left) \n\t && is_effectively_black(p_w->m_p_right))\n\t {\n\t p_w->m_red = true;\n\t p_x = p_new_x_parent;\n\t p_new_x_parent = p_new_x_parent->m_p_parent;\n\t }\n\telse\n\t {\n\t if (is_effectively_black(p_w->m_p_right))\n\t {\n\t\tif (p_w->m_p_left != 0)\n\t\t p_w->m_p_left->m_red = false;\n\n\t\tp_w->m_red = true;\n\t\tbase_type::rotate_right(p_w);\n\t\tp_w = p_new_x_parent->m_p_right;\n\t }\n\n\t p_w->m_red = p_new_x_parent->m_red;\n\t p_new_x_parent->m_red = false;\n\n\t if (p_w->m_p_right != 0)\n\t p_w->m_p_right->m_red = false;\n\n\t base_type::rotate_left(p_new_x_parent);\n\t this->update_to_top(p_new_x_parent, (node_update* )this);\n\t break;\n\t }\n }\n else\n {\n\tnode_pointer p_w = p_new_x_parent->m_p_left;\n\tif (p_w->m_red == true)\n\t {\n\t p_w->m_red = false;\n\t p_new_x_parent->m_red = true;\n\t base_type::rotate_right(p_new_x_parent);\n\t p_w = p_new_x_parent->m_p_left;\n\t }\n\n\tif (is_effectively_black(p_w->m_p_right) \n\t && is_effectively_black(p_w->m_p_left))\n\t {\n\t p_w->m_red = true;\n\t p_x = p_new_x_parent;\n\t p_new_x_parent = p_new_x_parent->m_p_parent;\n\t }\n\telse\n\t {\n\t if (is_effectively_black(p_w->m_p_left))\n\t {\n\t\tif (p_w->m_p_right != 0)\n\t\t p_w->m_p_right->m_red = false;\n\n\t\tp_w->m_red = true;\n\t\tbase_type::rotate_left(p_w);\n\t\tp_w = p_new_x_parent->m_p_left;\n\t }\n\n\t p_w->m_red = p_new_x_parent->m_red;\n\t p_new_x_parent->m_red = false;\n\n\t if (p_w->m_p_left != 0)\n\t p_w->m_p_left->m_red = false;\n\n\t base_type::rotate_right(p_new_x_parent);\n\t this->update_to_top(p_new_x_parent, (node_update* )this);\n\t break;\n\t }\n }\n\n if (p_x != 0)\n p_x->m_red = false;\n}\n#endif\n","include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/find_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n","include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/info_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_effectively_black(const node_pointer p_nd)\n{ return (p_nd == 0 || !p_nd->m_red); }\n\n#endif\n","include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/insert_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert(const_reference r_value)\n{\n PB_DS_ASSERT_VALID((*this))\n std::pair<point_iterator, bool> ins_pair = base_type::insert_leaf(r_value);\n if (ins_pair.second == true)\n {\n ins_pair.first.m_p_nd->m_red = true;\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n insert_fixup(ins_pair.first.m_p_nd);\n }\n\n PB_DS_ASSERT_VALID((*this))\n return ins_pair;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninsert_fixup(node_pointer p_nd)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_red == true);\n while (p_nd != base_type::m_p_head->m_p_parent && p_nd->m_p_parent->m_red)\n {\n if (p_nd->m_p_parent == p_nd->m_p_parent->m_p_parent->m_p_left)\n {\n\t node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_right;\n\t if (p_y != 0 && p_y->m_red)\n {\n\t p_nd->m_p_parent->m_red = false;\n\t p_y->m_red = false;\n\t p_nd->m_p_parent->m_p_parent->m_red = true;\n\t p_nd = p_nd->m_p_parent->m_p_parent;\n }\n\t else\n {\n\t if (p_nd == p_nd->m_p_parent->m_p_right)\n {\n\t\t p_nd = p_nd->m_p_parent;\n\t\t base_type::rotate_left(p_nd);\n }\n\t p_nd->m_p_parent->m_red = false;\n\t p_nd->m_p_parent->m_p_parent->m_red = true;\n\t base_type::rotate_right(p_nd->m_p_parent->m_p_parent);\n }\n }\n else\n {\n\t node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_left;\n\t if (p_y != 0 && p_y->m_red)\n {\n\t p_nd->m_p_parent->m_red = false;\n\t p_y->m_red = false;\n\t p_nd->m_p_parent->m_p_parent->m_red = true;\n\t p_nd = p_nd->m_p_parent->m_p_parent;\n }\n\t else\n {\n\t if (p_nd == p_nd->m_p_parent->m_p_left)\n {\n\t\t p_nd = p_nd->m_p_parent;\n\t\t base_type::rotate_right(p_nd);\n }\n\t p_nd->m_p_parent->m_red = false;\n\t p_nd->m_p_parent->m_p_parent->m_red = true;\n\t base_type::rotate_left(p_nd->m_p_parent->m_p_parent);\n }\n }\n }\n\n base_type::update_to_top(p_nd, (node_update* )this);\n base_type::m_p_head->m_p_parent->m_red = false;\n}\n#endif\n","include/ext/pb_ds/detail/rb_tree_map_/node.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/node.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifndef PB_DS_RB_TREE_NODE_HPP\n#define PB_DS_RB_TREE_NODE_HPP\n\n#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Node for Red-Black trees.\n template<typename Value_Type, class Metadata, typename _Alloc>\n struct rb_tree_node_\n {\n public:\n typedef Value_Type \t\tvalue_type;\n typedef Metadata \t\t\tmetadata_type;\n\n typedef typename rebind_traits<_Alloc, rb_tree_node_>::pointer\n\tnode_pointer;\n\n typedef typename rebind_traits<_Alloc, metadata_type>::reference\n\tmetadata_reference;\n\n typedef typename rebind_traits<_Alloc, metadata_type>::const_reference\n\tmetadata_const_reference;\n\n bool\n special() const\n { return m_red; }\n\n metadata_const_reference\n get_metadata() const\n { return m_metadata; }\n\n metadata_reference\n get_metadata()\n { return m_metadata; }\n\n#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_\n void\n trace() const\n {\n\tstd::cout << PB_DS_V2F(m_value) <<(m_red? \" <r> \" : \" <b> \") \n\t\t << \"(\" << m_metadata << \")\";\n }\n#endif\n\n node_pointer \tm_p_left;\n node_pointer \tm_p_right;\n node_pointer \tm_p_parent;\n value_type \tm_value;\n bool \t\tm_red;\n metadata_type \tm_metadata;\n };\n\n template<typename Value_Type, typename _Alloc>\n struct rb_tree_node_<Value_Type, null_type, _Alloc>\n {\n public:\n typedef Value_Type \t\tvalue_type;\n typedef null_type \tmetadata_type;\n\n typedef typename rebind_traits<_Alloc, rb_tree_node_>::pointer\n\tnode_pointer;\n\n bool\n special() const\n { return m_red; }\n\n#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_\n void\n trace() const\n { std::cout << PB_DS_V2F(m_value) <<(m_red? \" <r> \" : \" <b> \"); }\n#endif \n\n node_pointer \tm_p_left;\n node_pointer \tm_p_right;\n node_pointer \tm_p_parent;\n value_type \tm_value;\n bool \t\tm_red;\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/rb_tree_.hpp\n * Contains an implementation for Red Black trees.\n */\n\n#include <ext/pb_ds/detail/standard_policies.hpp>\n#include <utility>\n#include <vector>\n#include <assert.h>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Mapped, typename Cmp_Fn, \\\n\t typename Node_And_It_Traits, typename _Alloc>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n# define PB_DS_RB_TREE_NAME rb_tree_map\n# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_map\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n# define PB_DS_RB_TREE_NAME rb_tree_set\n# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_set\n#endif\n\n#define PB_DS_CLASS_C_DEC \\\n PB_DS_RB_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>\n\n#define PB_DS_RB_TREE_BASE \\\n PB_DS_RB_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>\n\n\n /**\n * @brief Red-Black tree.\n * @ingroup branch-detail\n *\n * This implementation uses an idea from the SGI STL (using a\n * @a header node which is needed for efficient iteration).\n */\n template<typename Key,\n\t typename Mapped,\n\t typename Cmp_Fn,\n\t typename Node_And_It_Traits,\n\t typename _Alloc>\n class PB_DS_RB_TREE_NAME : public PB_DS_RB_TREE_BASE\n {\n private:\n typedef PB_DS_RB_TREE_BASE \t\t \t base_type;\n typedef typename base_type::node_pointer \t\t node_pointer;\n\n public:\n typedef rb_tree_tag \t\t\t\t container_category;\n typedef Cmp_Fn \t\t\t\t\t cmp_fn;\n typedef _Alloc \t\t\t\t\t allocator_type;\n typedef typename _Alloc::size_type \t\t size_type;\n typedef typename _Alloc::difference_type \t\t difference_type;\n typedef typename base_type::key_type \t\t key_type;\n typedef typename base_type::key_pointer \t\t key_pointer;\n typedef typename base_type::key_const_pointer \t key_const_pointer;\n typedef typename base_type::key_reference \t key_reference;\n typedef typename base_type::key_const_reference \t key_const_reference;\n typedef typename base_type::mapped_type \t\t mapped_type;\n typedef typename base_type::mapped_pointer \t mapped_pointer;\n typedef typename base_type::mapped_const_pointer \t mapped_const_pointer;\n typedef typename base_type::mapped_reference \t mapped_reference;\n typedef typename base_type::mapped_const_reference mapped_const_reference;\n typedef typename base_type::value_type \t\t value_type;\n typedef typename base_type::pointer \t\t pointer;\n typedef typename base_type::const_pointer \t const_pointer;\n typedef typename base_type::reference \t\t reference;\n typedef typename base_type::const_reference \t const_reference;\n typedef typename base_type::point_iterator \t point_iterator;\n typedef typename base_type::const_iterator \t point_const_iterator;\n typedef typename base_type::iterator \t\t iterator;\n typedef typename base_type::const_iterator \t const_iterator;\n typedef typename base_type::reverse_iterator \t reverse_iterator;\n typedef typename base_type::const_reverse_iterator const_reverse_iterator;\n typedef typename base_type::node_update \t\t node_update;\n\n PB_DS_RB_TREE_NAME();\n\n PB_DS_RB_TREE_NAME(const Cmp_Fn&);\n\n PB_DS_RB_TREE_NAME(const Cmp_Fn&, const node_update&);\n\n PB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n template<typename It>\n void\n copy_from_range(It, It);\n\n inline std::pair<point_iterator, bool>\n insert(const_reference);\n\n inline mapped_reference\n operator[](key_const_reference r_key)\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\tstd::pair<point_iterator, bool> ins_pair =\n\tbase_type::insert_leaf(value_type(r_key, mapped_type()));\n\n\tif (ins_pair.second == true)\n\t {\n\t ins_pair.first.m_p_nd->m_red = true;\n\t _GLIBCXX_DEBUG_ONLY(this->structure_only_assert_valid(__FILE__, __LINE__);)\n\t insert_fixup(ins_pair.first.m_p_nd);\n\t }\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\treturn ins_pair.first.m_p_nd->m_value.second;\n#else\n\tinsert(r_key);\n\treturn base_type::s_null_type;\n#endif\n }\n\n inline bool\n erase(key_const_reference);\n\n inline iterator\n erase(iterator);\n\n inline reverse_iterator\n erase(reverse_iterator);\n\n template<typename Pred>\n inline size_type\n erase_if(Pred);\n\n void\n join(PB_DS_CLASS_C_DEC&);\n\n void\n split(key_const_reference, PB_DS_CLASS_C_DEC&);\n\n private:\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n\n size_type\n assert_node_consistent(const node_pointer, const char*, int) const;\n#endif\n\n inline static bool\n is_effectively_black(const node_pointer);\n\n void\n initialize();\n\n void\n insert_fixup(node_pointer);\n\n void\n erase_node(node_pointer);\n\n void\n remove_node(node_pointer);\n\n void\n remove_fixup(node_pointer, node_pointer);\n\n void\n split_imp(node_pointer, PB_DS_CLASS_C_DEC&);\n\n inline node_pointer\n split_min();\n\n std::pair<node_pointer, node_pointer>\n split_min_imp();\n\n void\n join_imp(node_pointer, node_pointer);\n\n std::pair<node_pointer, node_pointer>\n find_join_pos_right(node_pointer, size_type, size_type);\n\n std::pair<node_pointer, node_pointer>\n find_join_pos_left(node_pointer, size_type, size_type);\n\n inline size_type\n black_height(node_pointer);\n\n void\n split_at_node(node_pointer, PB_DS_CLASS_C_DEC&);\n };\n\n#define PB_DS_STRUCT_ONLY_ASSERT_VALID(X)\t\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(X.structure_only_assert_valid(__FILE__, __LINE__);)\n\n#include <ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp>\n\n#undef PB_DS_STRUCT_ONLY_ASSERT_VALID\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_RB_TREE_NAME\n#undef PB_DS_RB_TREE_BASE_NAME\n#undef PB_DS_RB_TREE_BASE\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/split_join_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n if (base_type::join_prep(other) == false)\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n const node_pointer p_x = other.split_min();\n join_imp(p_x, other.m_p_head->m_p_parent);\n base_type::join_finish(other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\njoin_imp(node_pointer p_x, node_pointer p_r)\n{\n _GLIBCXX_DEBUG_ASSERT(p_x != 0);\n if (p_r != 0)\n p_r->m_red = false;\n\n const size_type h = black_height(base_type::m_p_head->m_p_parent);\n const size_type other_h = black_height(p_r);\n node_pointer p_x_l;\n node_pointer p_x_r;\n std::pair<node_pointer, node_pointer> join_pos;\n const bool right_join = h >= other_h;\n if (right_join)\n {\n join_pos = find_join_pos_right(base_type::m_p_head->m_p_parent, \n\t\t\t\t h, other_h);\n p_x_l = join_pos.first;\n p_x_r = p_r;\n }\n else\n {\n p_x_l = base_type::m_p_head->m_p_parent;\n base_type::m_p_head->m_p_parent = p_r;\n if (p_r != 0)\n\tp_r->m_p_parent = base_type::m_p_head;\n\n join_pos = find_join_pos_left(base_type::m_p_head->m_p_parent, \n\t\t\t\t h, other_h);\n p_x_r = join_pos.first;\n }\n\n node_pointer p_parent = join_pos.second;\n if (p_parent == base_type::m_p_head)\n {\n base_type::m_p_head->m_p_parent = p_x;\n p_x->m_p_parent = base_type::m_p_head;\n }\n else\n {\n p_x->m_p_parent = p_parent;\n if (right_join)\n\tp_x->m_p_parent->m_p_right = p_x;\n else\n\tp_x->m_p_parent->m_p_left = p_x;\n }\n\n p_x->m_p_left = p_x_l;\n if (p_x_l != 0)\n p_x_l->m_p_parent = p_x;\n\n p_x->m_p_right = p_x_r;\n if (p_x_r != 0)\n p_x_r->m_p_parent = p_x;\n\n p_x->m_red = true;\n\n base_type::initialize_min_max();\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n base_type::update_to_top(p_x, (node_update* )this);\n insert_fixup(p_x);\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nsplit_min()\n{\n node_pointer p_min = base_type::m_p_head->m_p_left;\n\n#ifdef _GLIBCXX_DEBUG\n const node_pointer p_head = base_type::m_p_head;\n _GLIBCXX_DEBUG_ASSERT(p_min != p_head);\n#endif \n\n remove_node(p_min);\n return p_min;\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n typename PB_DS_CLASS_C_DEC::node_pointer,\n typename PB_DS_CLASS_C_DEC::node_pointer>\nPB_DS_CLASS_C_DEC::\nfind_join_pos_right(node_pointer p_l, size_type h_l, size_type h_r)\n{\n _GLIBCXX_DEBUG_ASSERT(h_l >= h_r);\n\n if (base_type::m_p_head->m_p_parent == 0)\n return (std::make_pair((node_pointer)0, base_type::m_p_head));\n\n node_pointer p_l_parent = base_type::m_p_head;\n while (h_l > h_r)\n {\n if (p_l->m_red == false)\n {\n\t _GLIBCXX_DEBUG_ASSERT(h_l > 0);\n\t --h_l;\n }\n\n p_l_parent = p_l;\n p_l = p_l->m_p_right;\n }\n\n if (!is_effectively_black(p_l))\n {\n p_l_parent = p_l;\n p_l = p_l->m_p_right;\n }\n\n _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_l));\n _GLIBCXX_DEBUG_ASSERT(black_height(p_l) == h_r);\n _GLIBCXX_DEBUG_ASSERT(p_l == 0 || p_l->m_p_parent == p_l_parent);\n return std::make_pair(p_l, p_l_parent);\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n typename PB_DS_CLASS_C_DEC::node_pointer,\n typename PB_DS_CLASS_C_DEC::node_pointer>\nPB_DS_CLASS_C_DEC::\nfind_join_pos_left(node_pointer p_r, size_type h_l, size_type h_r)\n{\n _GLIBCXX_DEBUG_ASSERT(h_r > h_l);\n if (base_type::m_p_head->m_p_parent == 0)\n return (std::make_pair((node_pointer)0,\n\t\t\t base_type::m_p_head));\n node_pointer p_r_parent = base_type::m_p_head;\n while (h_r > h_l)\n {\n if (p_r->m_red == false)\n {\n\t _GLIBCXX_DEBUG_ASSERT(h_r > 0);\n\t --h_r;\n }\n\n p_r_parent = p_r;\n p_r = p_r->m_p_left;\n }\n\n if (!is_effectively_black(p_r))\n {\n p_r_parent = p_r;\n p_r = p_r->m_p_left;\n }\n\n _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_r));\n _GLIBCXX_DEBUG_ASSERT(black_height(p_r) == h_l);\n _GLIBCXX_DEBUG_ASSERT(p_r == 0 || p_r->m_p_parent == p_r_parent);\n return std::make_pair(p_r, p_r_parent);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nblack_height(node_pointer p_nd)\n{\n size_type h = 1;\n while (p_nd != 0)\n {\n if (p_nd->m_red == false)\n\t++h;\n p_nd = p_nd->m_p_left;\n }\n return h;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n if (base_type::split_prep(r_key, other) == false)\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n PB_DS_STRUCT_ONLY_ASSERT_VALID(other)\n node_pointer p_nd = this->upper_bound(r_key).m_p_nd;\n do\n {\n node_pointer p_next_nd = p_nd->m_p_parent;\n if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))\n\tsplit_at_node(p_nd, other);\n\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n PB_DS_STRUCT_ONLY_ASSERT_VALID(other)\n p_nd = p_next_nd;\n }\n while (p_nd != base_type::m_p_head);\n\n base_type::split_finish(other);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit_at_node(node_pointer p_nd, PB_DS_CLASS_C_DEC& other)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n\n node_pointer p_l = p_nd->m_p_left;\n node_pointer p_r = p_nd->m_p_right;\n node_pointer p_parent = p_nd->m_p_parent;\n if (p_parent == base_type::m_p_head)\n {\n base_type::m_p_head->m_p_parent = p_l;\n if (p_l != 0)\n {\n\t p_l->m_p_parent = base_type::m_p_head;\n\t p_l->m_red = false;\n }\n }\n else\n {\n if (p_parent->m_p_left == p_nd)\n\tp_parent->m_p_left = p_l;\n else\n\tp_parent->m_p_right = p_l;\n\n if (p_l != 0)\n\tp_l->m_p_parent = p_parent;\n\n this->update_to_top(p_parent, (node_update* )this);\n\n if (!p_nd->m_red)\n\tremove_fixup(p_l, p_parent);\n }\n\n base_type::initialize_min_max();\n other.join_imp(p_nd, p_r);\n PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))\n PB_DS_STRUCT_ONLY_ASSERT_VALID(other)\n}\n\n#endif\n","include/ext/pb_ds/detail/rb_tree_map_/traits.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_map_/traits.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifndef PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/rb_tree_map_/node.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Specialization.\n /// @ingroup traits\n template<typename Key,\n\t typename Mapped,\n\t typename Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t typename Node_Itr,\n\t\t typename Cmp_Fn_,\n\t\t typename _Alloc_>\n\t class Node_Update,\n\t typename _Alloc>\n struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, rb_tree_tag,_Alloc> \n : public bin_search_tree_traits<\n Key,\n Mapped,\n Cmp_Fn,\n Node_Update,\n rb_tree_node_<\n\ttypename types_traits<Key, Mapped, _Alloc, false>::value_type,\n\ttypename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update,\n\t\t\t\t\t _Alloc>::type,\n\t_Alloc>,\n _Alloc>\n { };\n\n /// Specialization.\n /// @ingroup traits\n template<typename Key,\n\t typename Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t typename Node_Itr,\n\t\t typename Cmp_Fn_,\n\t\t typename _Alloc_>\n\t class Node_Update,\n\t typename _Alloc>\n struct tree_traits<Key, null_type, Cmp_Fn, Node_Update, rb_tree_tag,_Alloc> \n : public bin_search_tree_traits<\n Key,\n null_type,\n Cmp_Fn,\n Node_Update,\n rb_tree_node_<\n typename types_traits<Key, null_type, _Alloc, false>::value_type,\n typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update,\n\t\t\t\t\t _Alloc>::type,\n\t_Alloc>,\n\t _Alloc>\n { };\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc_binomial_heap_/constructors_destructor_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nrc_binomial_heap()\n{\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nrc_binomial_heap(const Cmp_Fn& r_cmp_fn) \n: base_type(r_cmp_fn)\n{\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nrc_binomial_heap(const PB_DS_CLASS_C_DEC& other) \n: base_type(other)\n{\n make_binomial_heap();\n base_type::find_max();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~rc_binomial_heap()\n{ }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n base_type::swap(other);\n m_rc.swap(other.m_rc);\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n#endif\n","include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc_binomial_heap_/debug_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n base_type::assert_valid(false, __file, __line);\n if (!base_type::empty())\n {\n PB_DS_DEBUG_VERIFY(base_type::m_p_max != 0);\n base_type::assert_max(__file, __line);\n }\n\n m_rc.assert_valid(__file, __line);\n\n if (m_rc.empty())\n {\n base_type::assert_valid(true, __file, __line);\n PB_DS_DEBUG_VERIFY(next_2_pointer(base_type::m_p_root) == 0);\n return;\n }\n\n node_const_pointer p_nd = next_2_pointer(base_type::m_p_root);\n typename rc_t::const_iterator it = m_rc.end();\n --it;\n\n while (p_nd != 0)\n {\n PB_DS_DEBUG_VERIFY(*it == p_nd);\n node_const_pointer p_next = p_nd->m_p_next_sibling;\n PB_DS_DEBUG_VERIFY(p_next != 0);\n PB_DS_DEBUG_VERIFY(p_nd->m_metadata == p_next->m_metadata);\n PB_DS_DEBUG_VERIFY(p_next->m_p_next_sibling == 0 ||\n\t\t p_next->m_metadata < p_next->m_p_next_sibling->m_metadata);\n\n --it;\n p_nd = next_2_pointer(next_after_0_pointer(p_nd));\n }\n PB_DS_DEBUG_VERIFY(it + 1 == m_rc.begin());\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_const_pointer\nPB_DS_CLASS_C_DEC::\nnext_2_pointer(node_const_pointer p_nd)\n{\n if (p_nd == 0)\n return 0;\n\n node_pointer p_next = p_nd->m_p_next_sibling;\n\n if (p_next == 0)\n return 0;\n\n if (p_nd->m_metadata == p_next->m_metadata)\n return p_nd;\n\n return next_2_pointer(p_next);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_const_pointer\nPB_DS_CLASS_C_DEC::\nnext_after_0_pointer(node_const_pointer p_nd)\n{\n if (p_nd == 0)\n return 0;\n\n node_pointer p_next = p_nd->m_p_next_sibling;\n\n if (p_next == 0)\n return 0;\n\n if (p_nd->m_metadata < p_next->m_metadata)\n return p_next;\n\n return next_after_0_pointer(p_next);\n}\n\n#endif \n#endif\n","include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc_binomial_heap_/erase_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\npop()\n{\n make_binomial_heap();\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n base_type::pop();\n base_type::find_max();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n base_type::clear();\n m_rc.clear();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmake_binomial_heap()\n{\n node_pointer p_nd = base_type::m_p_root;\n while (p_nd != 0)\n {\n node_pointer p_next = p_nd->m_p_next_sibling;\n if (p_next == 0)\n\tp_nd = p_next;\n else if (p_nd->m_metadata == p_next->m_metadata)\n\tp_nd = link_with_next_sibling(p_nd);\n else if (p_nd->m_metadata < p_next->m_metadata)\n\tp_nd = p_next;\n#ifdef _GLIBCXX_DEBUG\n else\n\t_GLIBCXX_DEBUG_ASSERT(0);\n#endif \n }\n\n m_rc.clear();\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n make_binomial_heap();\n const size_type ersd = base_type::erase_if(pred);\n base_type::find_max();\n PB_DS_ASSERT_VALID((*this))\n return ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n make_binomial_heap();\n base_type::erase(it);\n base_type::find_max();\n}\n\n#endif\n","include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc_binomial_heap_/insert_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n PB_DS_ASSERT_VALID((*this))\n\n make_0_exposed();\n\n PB_DS_ASSERT_VALID((*this))\n\n node_pointer p_nd = base_type::get_new_node_for_insert(r_val);\n\n p_nd->m_p_l_child = p_nd->m_p_prev_or_parent = 0;\n p_nd->m_metadata = 0;\n\n if (base_type::m_p_max == 0 || Cmp_Fn::operator()(base_type::m_p_max->m_value, r_val))\n base_type::m_p_max = p_nd;\n\n p_nd->m_p_next_sibling = base_type::m_p_root;\n\n if (base_type::m_p_root != 0)\n base_type::m_p_root->m_p_prev_or_parent = p_nd;\n\n base_type::m_p_root = p_nd;\n\n if (p_nd->m_p_next_sibling != 0&& p_nd->m_p_next_sibling->m_metadata == 0)\n m_rc.push(p_nd);\n\n PB_DS_ASSERT_VALID((*this))\n\n return point_iterator(p_nd);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n PB_DS_ASSERT_VALID((*this))\n\n make_binomial_heap();\n\n base_type::modify(it, r_new_val);\n\n base_type::find_max();\n\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nlink_with_next_sibling(node_pointer p_nd)\n{\n node_pointer p_next = p_nd->m_p_next_sibling;\n\n _GLIBCXX_DEBUG_ASSERT(p_next != 0);\n _GLIBCXX_DEBUG_ASSERT(p_next->m_p_prev_or_parent == p_nd);\n\n if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))\n {\n p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n\n if (p_next->m_p_prev_or_parent == 0)\n\tbase_type::m_p_root = p_next;\n else\n\tp_next->m_p_prev_or_parent->m_p_next_sibling = p_next;\n\n if (base_type::m_p_max == p_nd)\n\tbase_type::m_p_max = p_next;\n\n base_type::make_child_of(p_nd, p_next);\n\n ++p_next->m_metadata;\n\n return p_next;\n }\n\n p_nd->m_p_next_sibling = p_next->m_p_next_sibling;\n\n if (p_nd->m_p_next_sibling != 0)\n p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;\n\n if (base_type::m_p_max == p_next)\n base_type::m_p_max = p_nd;\n\n base_type::make_child_of(p_next, p_nd);\n\n ++p_nd->m_metadata;\n\n return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmake_0_exposed()\n{\n if (m_rc.empty())\n return;\n\n node_pointer p_nd = m_rc.top();\n\n m_rc.pop();\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling != 0);\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata);\n\n node_pointer p_res = link_with_next_sibling(p_nd);\n\n if (p_res->m_p_next_sibling != 0&& p_res->m_metadata == p_res->m_p_next_sibling->m_metadata)\n m_rc.push(p_res);\n}\n#endif\n","include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc_binomial_heap_/rc.hpp\n * Contains a redundant (binary counter).\n */\n\n#ifndef PB_DS_RC_HPP\n#define PB_DS_RC_HPP\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Redundant binary counter.\n template<typename _Node, typename _Alloc>\n class rc\n {\n private:\n typedef _Alloc \t\t\t\t\t allocator_type;\n typedef typename allocator_type::size_type \t size_type;\n typedef _Node \t\t\t\t\t node;\n\n typedef typename rebind_traits<_Alloc, node>::pointer node_pointer;\n\n\n typedef typename rebind_traits<_Alloc, node_pointer>::pointer\n\tentry_pointer;\n typedef typename rebind_traits<_Alloc, node_pointer>::const_pointer\n\tentry_const_pointer;\n\n enum\n\t{\n\t max_entries = sizeof(size_type) << 3\n\t};\n\n public:\n typedef node_pointer \t\t\t\t entry;\n typedef entry_const_pointer \t\t\t const_iterator;\n\n rc();\n\n rc(const rc&);\n\n inline void\n swap(rc&);\n\n inline void\n push(entry);\n\n inline node_pointer\n top() const;\n\n inline void\n pop();\n\n _GLIBCXX_NODISCARD inline bool\n empty() const;\n\n inline size_type\n size() const;\n\n void\n clear();\n\n const const_iterator\n begin() const;\n\n const const_iterator\n end() const;\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n#endif\n\n#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n void\n trace() const;\n#endif\n\n private:\n node_pointer \tm_a_entries[max_entries];\n size_type \tm_over_top;\n };\n\n template<typename _Node, typename _Alloc>\n rc<_Node, _Alloc>::\n rc() : m_over_top(0)\n { PB_DS_ASSERT_VALID((*this)) }\n\n template<typename _Node, typename _Alloc>\n rc<_Node, _Alloc>::\n rc(const rc<_Node, _Alloc>& other) : m_over_top(0)\n { PB_DS_ASSERT_VALID((*this)) }\n\n template<typename _Node, typename _Alloc>\n inline void\n rc<_Node, _Alloc>::\n swap(rc<_Node, _Alloc>& other)\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n const size_type over_top = std::max(m_over_top, other.m_over_top);\n\n for (size_type i = 0; i < over_top; ++i)\n\tstd::swap(m_a_entries[i], other.m_a_entries[i]);\n\n std::swap(m_over_top, other.m_over_top);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n }\n\n template<typename _Node, typename _Alloc>\n inline void\n rc<_Node, _Alloc>::\n push(entry p_nd)\n {\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(m_over_top < max_entries);\n m_a_entries[m_over_top++] = p_nd;\n PB_DS_ASSERT_VALID((*this))\n }\n\n template<typename _Node, typename _Alloc>\n inline void\n rc<_Node, _Alloc>::\n pop()\n {\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!empty());\n --m_over_top;\n PB_DS_ASSERT_VALID((*this))\n }\n\n template<typename _Node, typename _Alloc>\n inline typename rc<_Node, _Alloc>::node_pointer\n rc<_Node, _Alloc>::\n top() const\n {\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!empty());\n return *(m_a_entries + m_over_top - 1);\n }\n\n template<typename _Node, typename _Alloc>\n _GLIBCXX_NODISCARD inline bool\n rc<_Node, _Alloc>::\n empty() const\n {\n PB_DS_ASSERT_VALID((*this))\n return m_over_top == 0;\n }\n\n template<typename _Node, typename _Alloc>\n inline typename rc<_Node, _Alloc>::size_type\n rc<_Node, _Alloc>::\n size() const\n { return m_over_top; }\n\n template<typename _Node, typename _Alloc>\n void\n rc<_Node, _Alloc>::\n clear()\n {\n PB_DS_ASSERT_VALID((*this))\n m_over_top = 0;\n PB_DS_ASSERT_VALID((*this))\n }\n\n template<typename _Node, typename _Alloc>\n const typename rc<_Node, _Alloc>::const_iterator\n rc<_Node, _Alloc>::\n begin() const\n { return& m_a_entries[0]; }\n\n template<typename _Node, typename _Alloc>\n const typename rc<_Node, _Alloc>::const_iterator\n rc<_Node, _Alloc>::\n end() const\n { return& m_a_entries[m_over_top]; }\n\n#ifdef _GLIBCXX_DEBUG\n template<typename _Node, typename _Alloc>\n void\n rc<_Node, _Alloc>::\n assert_valid(const char* __file, int __line) const\n { PB_DS_DEBUG_VERIFY(m_over_top < max_entries); }\n#endif\n\n#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n template<typename _Node, typename _Alloc>\n void\n rc<_Node, _Alloc>::\n trace() const\n {\n std::cout << \"rc\" << std::endl;\n for (size_type i = 0; i < m_over_top; ++i)\n\tstd::cerr << m_a_entries[i] << std::endl;\n std::cout << std::endl;\n }\n#endif\n} // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc_binomial_heap_/rc_binomial_heap_.hpp\n * Contains an implementation for redundant-counter binomial heap.\n */\n\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/rc.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_CLASS_T_DEC \\\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n rc_binomial_heap<Value_Type, Cmp_Fn, _Alloc>\n\n#define PB_DS_RC_C_DEC \\\n rc<typename binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>::node, _Alloc>\n\n /**\n * Redundant-counter binomial heap.\n *\n * @ingroup heap-detail\n */\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n class rc_binomial_heap\n : public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>\n {\n private:\n typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>\n \t\t\t\t\t\t\tbase_type;\n typedef typename base_type::node_pointer \t\tnode_pointer;\n typedef typename base_type::node_const_pointer \tnode_const_pointer;\n typedef PB_DS_RC_C_DEC \t\t\t\trc_t;\n\n public:\n typedef Value_Type \t\t\t\tvalue_type;\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \t\tdifference_type;\n typedef typename base_type::pointer \t\tpointer;\n typedef typename base_type::const_pointer \tconst_pointer;\n typedef typename base_type::reference \t\treference;\n typedef typename base_type::const_reference \tconst_reference;\n typedef typename base_type::point_const_iterator \tpoint_const_iterator;\n typedef typename base_type::point_iterator \tpoint_iterator;\n typedef typename base_type::const_iterator \tconst_iterator;\n typedef typename base_type::iterator \t\titerator;\n typedef typename base_type::cmp_fn \t\tcmp_fn;\n typedef typename base_type::allocator_type \tallocator_type;\n\n rc_binomial_heap();\n\n rc_binomial_heap(const Cmp_Fn&);\n\n rc_binomial_heap(const PB_DS_CLASS_C_DEC&);\n\n ~rc_binomial_heap();\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n inline point_iterator\n push(const_reference);\n\n void\n modify(point_iterator, const_reference);\n\n inline void\n pop();\n\n void\n erase(point_iterator);\n\n inline void\n clear();\n\n template<typename Pred>\n size_type\n erase_if(Pred);\n\n template<typename Pred>\n void\n split(Pred, PB_DS_CLASS_C_DEC&);\n\n void\n join(PB_DS_CLASS_C_DEC&);\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n#endif\n\n#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n void\n trace() const;\n#endif\n\n private:\n\n inline node_pointer\n link_with_next_sibling(node_pointer);\n\n void\n make_0_exposed();\n\n void\n make_binomial_heap();\n\n#ifdef _GLIBCXX_DEBUG\n static node_const_pointer\n next_2_pointer(node_const_pointer);\n\n static node_const_pointer\n next_after_0_pointer(node_const_pointer);\n#endif\n\n rc_t \t\t\tm_rc;\n };\n\n#include <ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_RC_C_DEC\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc_binomial_heap_/split_join_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n make_binomial_heap();\n other.make_binomial_heap();\n base_type::split(pred, other);\n base_type::find_max();\n other.find_max();\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n make_binomial_heap();\n other.make_binomial_heap();\n base_type::join(other);\n base_type::find_max();\n other.find_max();\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\n#endif\n","include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc_binomial_heap_/trace_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n base_type::trace();\n m_rc.trace();\n}\n\n#endif // #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n#endif\n","include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_max_collision_check_resize_trigger_imp.hpp\n * Contains a resize trigger implementation.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\ncc_hash_max_collision_check_resize_trigger(float load) :\n m_load(load),\n m_size(0),\n m_num_col(0),\n m_max_col(0),\n m_resize_needed(false)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_start()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_collision()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_end()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_start()\n{ m_num_col = 0; }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_collision()\n{ ++m_num_col; }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_end()\n{ calc_resize_needed(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_start()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_collision()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_end()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_inserted(size_type)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erased(size_type)\n{ m_resize_needed = true; }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_cleared()\n{ m_resize_needed = false; }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_resize_needed() const\n{ return m_resize_needed; }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_grow_needed(size_type /*size*/, size_type /*num_used_e*/) const\n{ return m_num_col >= m_max_col; }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type new_size)\n{\n m_size = new_size;\n\n#ifdef PB_DS_HT_MAP_RESIZE_TRACE_\n std::cerr << \"chmccrt::notify_resized \" \n\t << static_cast<unsigned long>(new_size) << std::endl;\n#endif \n\n calc_max_num_coll();\n calc_resize_needed();\n m_num_col = 0;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ncalc_max_num_coll()\n{\n // max_col <-- \\sqrt{2 load \\ln( 2 m \\ln( m ) ) }\n const double ln_arg = 2 * m_size * std::log(double(m_size));\n m_max_col = size_type(std::ceil(std::sqrt(2 * m_load * std::log(ln_arg))));\n\n#ifdef PB_DS_HT_MAP_RESIZE_TRACE_\n std::cerr << \"chmccrt::calc_max_num_coll \" \n\t << static_cast<unsigned long>(m_size) << \" \" \n\t << static_cast<unsigned long>(m_max_col) << std::endl;\n#endif \n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_externally_resized(size_type new_size)\n{ notify_resized(new_size); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n std::swap(m_load, other.m_load);\n std::swap(m_size, other.m_size);\n std::swap(m_num_col, other.m_num_col);\n std::swap(m_max_col, other.m_max_col);\n std::swap(m_resize_needed, other.m_resize_needed);\n}\n\nPB_DS_CLASS_T_DEC\ninline float\nPB_DS_CLASS_C_DEC::\nget_load() const\n{\n PB_DS_STATIC_ASSERT(access, external_load_access);\n return m_load;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ncalc_resize_needed()\n{ m_resize_needed = m_resize_needed || m_num_col >= m_max_col; }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nset_load(float load)\n{\n PB_DS_STATIC_ASSERT(access, external_load_access);\n m_load = load;\n calc_max_num_coll();\n calc_resize_needed();\n}\n\n#endif\n","include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_exponential_size_policy_imp.hpp\n * Contains a resize size policy implementation.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_exponential_size_policy(size_type start_size, size_type grow_factor) :\n m_start_size(start_size),\n m_grow_factor(grow_factor)\n{ }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n std::swap(m_start_size, other.m_start_size);\n std::swap(m_grow_factor, other.m_grow_factor);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_nearest_larger_size(size_type size) const\n{\n size_type ret = m_start_size;\n while (ret <= size)\n {\n const size_type next_ret = ret* m_grow_factor;\n if (next_ret < ret)\n\t__throw_insert_error();\n ret = next_ret;\n }\n return ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_nearest_smaller_size(size_type size) const\n{\n size_type ret = m_start_size;\n while (true)\n {\n const size_type next_ret = ret* m_grow_factor;\n if (next_ret < ret)\n\t__throw_resize_error();\n if (next_ret >= size)\n\treturn (ret);\n ret = next_ret;\n }\n return ret;\n}\n\n#endif\n","include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_load_check_resize_trigger_imp.hpp\n * Contains a resize trigger implementation.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#define PB_DS_ASSERT_VALID(X)\t\t\t\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);)\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_load_check_resize_trigger(float load_min, float load_max)\n: m_load_min(load_min), m_load_max(load_max), m_next_shrink_size(0),\n m_next_grow_size(0), m_resize_needed(false)\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_start()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_collision()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_end()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_start()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_collision()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_end()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_start()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_collision()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_end()\n{ PB_DS_ASSERT_VALID((*this)) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_inserted(size_type num_entries)\n{\n m_resize_needed = (num_entries >= m_next_grow_size);\n size_base::set_size(num_entries);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erased(size_type num_entries)\n{\n size_base::set_size(num_entries);\n m_resize_needed = num_entries <= m_next_shrink_size;\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_resize_needed() const\n{\n PB_DS_ASSERT_VALID((*this))\n return m_resize_needed;\n}\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_grow_needed(size_type /*size*/, size_type num_entries) const\n{\n _GLIBCXX_DEBUG_ASSERT(m_resize_needed);\n return num_entries >= m_next_grow_size;\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~hash_load_check_resize_trigger() { }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type new_size)\n{\n m_resize_needed = false;\n m_next_grow_size = size_type(m_load_max * new_size - 1);\n m_next_shrink_size = size_type(m_load_min * new_size);\n\n#ifdef PB_DS_HT_MAP_RESIZE_TRACE_\n std::cerr << \"hlcrt::notify_resized \" << std::endl\n\t << \"1 \" << new_size << std::endl\n\t << \"2 \" << m_load_min << std::endl\n\t << \"3 \" << m_load_max << std::endl\n\t << \"4 \" << m_next_shrink_size << std::endl\n\t << \"5 \" << m_next_grow_size << std::endl;\n#endif\n\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_externally_resized(size_type new_size)\n{\n m_resize_needed = false;\n size_type new_grow_size = size_type(m_load_max * new_size - 1);\n size_type new_shrink_size = size_type(m_load_min * new_size);\n\n#ifdef PB_DS_HT_MAP_RESIZE_TRACE_\n std::cerr << \"hlcrt::notify_externally_resized \" << std::endl\n\t << \"1 \" << new_size << std::endl\n\t << \"2 \" << m_load_min << std::endl\n\t << \"3 \" << m_load_max << std::endl\n\t << \"4 \" << m_next_shrink_size << std::endl\n\t << \"5 \" << m_next_grow_size << std::endl\n\t << \"6 \" << new_shrink_size << std::endl\n\t << \"7 \" << new_grow_size << std::endl;\n#endif\n\n if (new_grow_size >= m_next_grow_size)\n {\n _GLIBCXX_DEBUG_ASSERT(new_shrink_size >= m_next_shrink_size);\n m_next_grow_size = new_grow_size;\n }\n else\n {\n _GLIBCXX_DEBUG_ASSERT(new_shrink_size <= m_next_shrink_size);\n m_next_shrink_size = new_shrink_size;\n }\n\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_cleared()\n{\n PB_DS_ASSERT_VALID((*this))\n size_base::set_size(0);\n m_resize_needed = (0 < m_next_shrink_size);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n size_base::swap(other);\n std::swap(m_load_min, other.m_load_min);\n std::swap(m_load_max, other.m_load_max);\n std::swap(m_resize_needed, other.m_resize_needed);\n std::swap(m_next_grow_size, other.m_next_grow_size);\n std::swap(m_next_shrink_size, other.m_next_shrink_size);\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<float, float>\nPB_DS_CLASS_C_DEC::\nget_loads() const\n{\n PB_DS_STATIC_ASSERT(access, external_load_access);\n return std::make_pair(m_load_min, m_load_max);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nset_loads(std::pair<float, float> load_pair)\n{\n PB_DS_STATIC_ASSERT(access, external_load_access);\n const float old_load_min = m_load_min;\n const float old_load_max = m_load_max;\n const size_type old_next_shrink_size = m_next_shrink_size;\n const size_type old_next_grow_size = m_next_grow_size;\n const bool old_resize_needed = m_resize_needed;\n\n __try\n {\n m_load_min = load_pair.first;\n m_load_max = load_pair.second;\n do_resize(static_cast<size_type>(size_base::get_size() / ((m_load_min + m_load_max) / 2)));\n }\n __catch(...)\n {\n m_load_min = old_load_min;\n m_load_max = old_load_max;\n m_next_shrink_size = old_next_shrink_size;\n m_next_grow_size = old_next_grow_size;\n m_resize_needed = old_resize_needed;\n __throw_exception_again;\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndo_resize(size_type)\n{ std::abort(); }\n\n#ifdef _GLIBCXX_DEBUG\n# define PB_DS_DEBUG_VERIFY(_Cond)\t\t\t\t\t\\\n _GLIBCXX_DEBUG_VERIFY_AT(_Cond,\t\t\t\t\t\\\n\t\t\t _M_message(#_Cond\" assertion from %1;:%2;\")\t\\\n\t\t\t ._M_string(__FILE__)._M_integer(__LINE__)\t\\\n\t\t\t ,__file,__line)\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n PB_DS_DEBUG_VERIFY(m_load_max > m_load_min);\n PB_DS_DEBUG_VERIFY(m_next_grow_size >= m_next_shrink_size);\n}\n# undef PB_DS_DEBUG_VERIFY\n#endif\n#undef PB_DS_ASSERT_VALID\n#endif\n","include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_load_check_resize_trigger_size_base.hpp\n * Contains an base holding size for some resize policies.\n */\n\n#ifndef PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP\n#define PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Primary template.\n template<typename Size_Type, bool Hold_Size>\n class hash_load_check_resize_trigger_size_base;\n\n /// Specializations.\n template<typename Size_Type>\n class hash_load_check_resize_trigger_size_base<Size_Type, true>\n {\n protected:\n typedef Size_Type size_type;\n\n hash_load_check_resize_trigger_size_base(): m_size(0)\n { }\n\n inline void\n swap(hash_load_check_resize_trigger_size_base& other)\n { std::swap(m_size, other.m_size); }\n\n inline void\n set_size(size_type size)\n { m_size = size; }\n\n inline size_type\n get_size() const\n { return m_size; }\n\n private:\n size_type m_size;\n };\n\n template<typename Size_Type>\n class hash_load_check_resize_trigger_size_base<Size_Type, false>\n {\n protected:\n typedef Size_Type size_type;\n\n protected:\n inline void\n swap(hash_load_check_resize_trigger_size_base& other) { }\n\n inline void\n set_size(size_type size) { }\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_prime_size_policy_imp.hpp\n * Contains a resize size policy implementation.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_SYSHDR\n#pragma GCC system_header\n#endif\n\nnamespace detail\n{\n enum\n {\n num_distinct_sizes_16_bit = 14,\n num_distinct_sizes_32_bit = 30,\n num_distinct_sizes_64_bit = 62,\n // The number of values is limited by the width of size_t.\n // Maybe we could just use (__SIZE_WIDTH__ - 2) here.\n#if __SIZE_WIDTH__ >= 64\n num_distinct_sizes = num_distinct_sizes_64_bit\n#elif __SIZE_WIDTH__ >= 32\n num_distinct_sizes = num_distinct_sizes_32_bit\n#else\n num_distinct_sizes = num_distinct_sizes_16_bit\n#endif\n };\n\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wlong-long\"\n // Originally taken from the SGI implementation; acknowledged in the docs.\n // Further modified (for 64 bits) from tr1's hashtable.\n static const std::size_t g_a_sizes[num_distinct_sizes] =\n {\n /* 0 */ 5ul,\n /* 1 */ 11ul, \n /* 2 */ 23ul, \n /* 3 */ 47ul, \n /* 4 */ 97ul, \n /* 5 */ 199ul, \n /* 6 */ 409ul, \n /* 7 */ 823ul, \n /* 8 */ 1741ul, \n /* 9 */ 3469ul, \n /* 10 */ 6949ul, \n /* 11 */ 14033ul, \n /* 12 */ 28411ul, \n /* 13 */ 57557ul, \n#if __SIZE_WIDTH__ >= 32\n /* 14 */ 116731ul, \n /* 15 */ 236897ul,\n /* 16 */ 480881ul, \n /* 17 */ 976369ul,\n /* 18 */ 1982627ul, \n /* 19 */ 4026031ul,\n /* 20 */ 8175383ul, \n /* 21 */ 16601593ul, \n /* 22 */ 33712729ul,\n /* 23 */ 68460391ul, \n /* 24 */ 139022417ul, \n /* 25 */ 282312799ul, \n /* 26 */ 573292817ul, \n /* 27 */ 1164186217ul,\n /* 28 */ 2364114217ul, \n /* 29 */ 4294967291ul,\n#if __SIZE_WIDTH__ >= 64\n /* 30 */ (std::size_t)8589934583ull,\n /* 31 */ (std::size_t)17179869143ull,\n /* 32 */ (std::size_t)34359738337ull,\n /* 33 */ (std::size_t)68719476731ull,\n /* 34 */ (std::size_t)137438953447ull,\n /* 35 */ (std::size_t)274877906899ull,\n /* 36 */ (std::size_t)549755813881ull,\n /* 37 */ (std::size_t)1099511627689ull,\n /* 38 */ (std::size_t)2199023255531ull,\n /* 39 */ (std::size_t)4398046511093ull,\n /* 40 */ (std::size_t)8796093022151ull,\n /* 41 */ (std::size_t)17592186044399ull,\n /* 42 */ (std::size_t)35184372088777ull,\n /* 43 */ (std::size_t)70368744177643ull,\n /* 44 */ (std::size_t)140737488355213ull,\n /* 45 */ (std::size_t)281474976710597ull,\n /* 46 */ (std::size_t)562949953421231ull, \n /* 47 */ (std::size_t)1125899906842597ull,\n /* 48 */ (std::size_t)2251799813685119ull, \n /* 49 */ (std::size_t)4503599627370449ull,\n /* 50 */ (std::size_t)9007199254740881ull, \n /* 51 */ (std::size_t)18014398509481951ull,\n /* 52 */ (std::size_t)36028797018963913ull, \n /* 53 */ (std::size_t)72057594037927931ull,\n /* 54 */ (std::size_t)144115188075855859ull,\n /* 55 */ (std::size_t)288230376151711717ull,\n /* 56 */ (std::size_t)576460752303423433ull,\n /* 57 */ (std::size_t)1152921504606846883ull,\n /* 58 */ (std::size_t)2305843009213693951ull,\n /* 59 */ (std::size_t)4611686018427387847ull,\n /* 60 */ (std::size_t)9223372036854775783ull,\n /* 61 */ (std::size_t)18446744073709551557ull,\n#endif\n#endif\n };\n#pragma GCC diagnostic pop\n\n} // namespace detail\n\nPB_DS_CLASS_T_DEC\ninline\nPB_DS_CLASS_C_DEC::\nhash_prime_size_policy(size_type n) : m_start_size(n)\n{ m_start_size = get_nearest_larger_size(n); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ std::swap(m_start_size, other.m_start_size); }\n\nPB_DS_CLASS_T_DEC\ninline PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_nearest_larger_size(size_type n) const\n{\n const std::size_t* const p_upper = std::upper_bound(detail::g_a_sizes, \n\t\t detail::g_a_sizes + detail::num_distinct_sizes, n);\n\n if (p_upper == detail::g_a_sizes + detail::num_distinct_sizes)\n __throw_resize_error();\n return *p_upper;\n}\n\nPB_DS_CLASS_T_DEC\ninline PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_nearest_smaller_size(size_type n) const\n{\n const std::size_t* p_lower = std::lower_bound(detail::g_a_sizes, \n\t\t detail::g_a_sizes + detail::num_distinct_sizes, n);\n\n if (*p_lower >= n && p_lower != detail::g_a_sizes)\n --p_lower;\n if (*p_lower < m_start_size)\n return m_start_size;\n return *p_lower;\n}\n#endif\n","include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_standard_resize_policy_imp.hpp\n * Contains a resize policy implementation.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_standard_resize_policy() \n: m_size(Size_Policy::get_nearest_larger_size(1))\n{ trigger_policy_base::notify_externally_resized(m_size); }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_standard_resize_policy(const Size_Policy& r_size_policy) \n: Size_Policy(r_size_policy), m_size(Size_Policy::get_nearest_larger_size(1))\n{ trigger_policy_base::notify_externally_resized(m_size); }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_standard_resize_policy(const Size_Policy& r_size_policy, \n\t\t\t const Trigger_Policy& r_trigger_policy) \n: Size_Policy(r_size_policy), Trigger_Policy(r_trigger_policy),\n m_size(Size_Policy::get_nearest_larger_size(1))\n{ trigger_policy_base::notify_externally_resized(m_size); }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~hash_standard_resize_policy()\n{ }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n trigger_policy_base::swap(other);\n size_policy_base::swap(other);\n std::swap(m_size, other.m_size);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_start()\n{ trigger_policy_base::notify_find_search_start(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_collision()\n{ trigger_policy_base::notify_find_search_collision(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_end()\n{ trigger_policy_base::notify_find_search_end(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_start()\n{ trigger_policy_base::notify_insert_search_start(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_collision()\n{ trigger_policy_base::notify_insert_search_collision(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_end()\n{ trigger_policy_base::notify_insert_search_end(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_start()\n{ trigger_policy_base::notify_erase_search_start(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_collision()\n{ trigger_policy_base::notify_erase_search_collision(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_end()\n{ trigger_policy_base::notify_erase_search_end(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_inserted(size_type num_e)\n{ trigger_policy_base::notify_inserted(num_e); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erased(size_type num_e)\n{ trigger_policy_base::notify_erased(num_e); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_cleared()\n{ trigger_policy_base::notify_cleared(); }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_resize_needed() const\n{ return trigger_policy_base::is_resize_needed(); }\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_new_size(size_type size, size_type num_used_e) const\n{\n if (trigger_policy_base::is_grow_needed(size, num_used_e))\n return size_policy_base::get_nearest_larger_size(size);\n return size_policy_base::get_nearest_smaller_size(size);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type new_size)\n{\n trigger_policy_base::notify_resized(new_size);\n m_size = new_size;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_actual_size() const\n{\n PB_DS_STATIC_ASSERT(access, external_size_access);\n return m_size;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize(size_type new_size)\n{\n PB_DS_STATIC_ASSERT(access, external_size_access);\n size_type actual_size = size_policy_base::get_nearest_larger_size(1);\n while (actual_size < new_size)\n {\n const size_type pot = size_policy_base::get_nearest_larger_size(actual_size);\n\n if (pot == actual_size && pot < new_size)\n\t__throw_resize_error();\n actual_size = pot;\n }\n\n if (actual_size > 0)\n --actual_size;\n\n const size_type old_size = m_size;\n __try\n {\n do_resize(actual_size - 1);\n }\n __catch(insert_error& )\n {\n m_size = old_size;\n __throw_resize_error();\n }\n __catch(...)\n {\n m_size = old_size;\n __throw_exception_again;\n }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndo_resize(size_type)\n{\n // Do nothing\n}\n\nPB_DS_CLASS_T_DEC\nTrigger_Policy& \nPB_DS_CLASS_C_DEC::\nget_trigger_policy()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Trigger_Policy& \nPB_DS_CLASS_C_DEC::\nget_trigger_policy() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nSize_Policy& \nPB_DS_CLASS_C_DEC::\nget_size_policy()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Size_Policy& \nPB_DS_CLASS_C_DEC::\nget_size_policy() const\n{ return *this; }\n\n#endif\n","include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_resize_policy.hpp\n * Contains a sample resize policy for hash tables.\n */\n\n#ifndef PB_DS_SAMPLE_RESIZE_POLICY_HPP\n#define PB_DS_SAMPLE_RESIZE_POLICY_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample resize policy.\n class sample_resize_policy\n {\n public:\n /// Size type.\n typedef std::size_t size_type;\n\n /// Default constructor.\n sample_resize_policy();\n\n /// Copy constructor.\n sample_range_hashing(const sample_resize_policy& other);\n\n /// Swaps content.\n inline void\n swap(sample_resize_policy& other);\n\n protected:\n /// Notifies a search started.\n inline void\n notify_insert_search_start();\n\n /// Notifies a search encountered a collision.\n inline void\n notify_insert_search_collision();\n\n /// Notifies a search ended.\n inline void\n notify_insert_search_end();\n\n /// Notifies a search started.\n inline void\n notify_find_search_start();\n\n /// Notifies a search encountered a collision.\n inline void\n notify_find_search_collision();\n\n /// Notifies a search ended.\n inline void\n notify_find_search_end();\n\n /// Notifies a search started.\n inline void\n notify_erase_search_start();\n\n /// Notifies a search encountered a collision.\n inline void\n notify_erase_search_collision();\n\n /// Notifies a search ended.\n inline void\n notify_erase_search_end();\n\n /// Notifies an element was inserted.\n inline void\n notify_inserted(size_type num_e);\n\n /// Notifies an element was erased.\n inline void\n notify_erased(size_type num_e);\n\n /// Notifies the table was cleared.\n void\n notify_cleared();\n\n /// Notifies the table was resized to new_size.\n void\n notify_resized(size_type new_size);\n\n /// Queries whether a resize is needed.\n inline bool\n is_resize_needed() const;\n\n /// Queries what the new size should be.\n size_type\n get_new_size(size_type size, size_type num_used_e) const;\n };\n}\n#endif\n","include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_resize_trigger.hpp\n * Contains a sample resize trigger policy class.\n */\n\n#ifndef PB_DS_SAMPLE_RESIZE_TRIGGER_HPP\n#define PB_DS_SAMPLE_RESIZE_TRIGGER_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample resize trigger policy.\n class sample_resize_trigger\n {\n public:\n /// Size type.\n typedef std::size_t size_type;\n\n /// Default constructor.\n sample_resize_trigger();\n\n /// Copy constructor.\n sample_range_hashing(const sample_resize_trigger&);\n\n /// Swaps content.\n inline void\n swap(sample_resize_trigger&);\n\n protected:\n /// Notifies a search started.\n inline void\n notify_insert_search_start();\n\n /// Notifies a search encountered a collision.\n inline void\n notify_insert_search_collision();\n\n /// Notifies a search ended.\n inline void\n notify_insert_search_end();\n\n /// Notifies a search started.\n inline void\n notify_find_search_start();\n\n /// Notifies a search encountered a collision.\n inline void\n notify_find_search_collision();\n\n /// Notifies a search ended.\n inline void\n notify_find_search_end();\n\n /// Notifies a search started.\n inline void\n notify_erase_search_start();\n\n /// Notifies a search encountered a collision.\n inline void\n notify_erase_search_collision();\n\n /// Notifies a search ended.\n inline void\n notify_erase_search_end();\n\n /// Notifies an element was inserted. the total number of entries in\n /// the table is num_entries.\n inline void\n notify_inserted(size_type num_entries);\n\n /// Notifies an element was erased.\n inline void\n notify_erased(size_type num_entries);\n\n /// Notifies the table was cleared.\n void\n notify_cleared();\n\n /// Notifies the table was resized as a result of this object's\n /// signifying that a resize is needed.\n void\n notify_resized(size_type new_size);\n\n /// Notifies the table was resized externally.\n void\n notify_externally_resized(size_type new_size);\n\n /// Queries whether a resize is needed.\n inline bool\n is_resize_needed() const;\n\n /// Queries whether a grow is needed.\n inline bool\n is_grow_needed(size_type size, size_type num_entries) const;\n\n private:\n /// Resizes to new_size.\n virtual void\n do_resize(size_type);\n };\n}\n#endif\n","include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_size_policy.hpp\n * Contains a sample size resize-policy.\n */\n\n#ifndef PB_DS_SAMPLE_SIZE_POLICY_HPP\n#define PB_DS_SAMPLE_SIZE_POLICY_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample size policy.\n class sample_size_policy\n {\n public:\n /// Size type.\n typedef std::size_t size_type;\n\n /// Default constructor.\n sample_size_policy();\n\n /// Copy constructor.\n sample_range_hashing(const sample_size_policy&);\n\n /// Swaps content.\n inline void\n swap(sample_size_policy& other);\n\n protected:\n /// Given a __size size, returns a __size that is larger.\n inline size_type\n get_nearest_larger_size(size_type size) const;\n\n /// Given a __size size, returns a __size that is smaller.\n inline size_type\n get_nearest_smaller_size(size_type size) const;\n };\n}\n#endif\n","include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/constructors_destructor_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_S_TREE_NAME()\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_S_TREE_NAME(const Cmp_Fn& r_cmp_fn) :\n base_type(r_cmp_fn)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_S_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :\n base_type(r_cmp_fn, r_node_update)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_S_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :\n base_type(other)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n base_type::swap(other);\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{ base_type::m_p_head->m_special = true; }\n#endif\n","include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/debug_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n base_type::assert_valid(__file, __line);\n const node_pointer p_head = base_type::m_p_head;\n assert_special_imp(p_head, __file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_special_imp(const node_pointer p_nd,\n\t\t const char* __file, int __line) const\n{\n if (p_nd == 0)\n return;\n\n if (p_nd == base_type::m_p_head)\n {\n PB_DS_DEBUG_VERIFY(p_nd->m_special);\n assert_special_imp(p_nd->m_p_parent, __file, __line);\n return;\n }\n\n PB_DS_DEBUG_VERIFY(!p_nd->m_special);\n assert_special_imp(p_nd->m_p_left, __file, __line);\n assert_special_imp(p_nd->m_p_right, __file, __line);\n}\n\n#endif \n\n#endif\n","include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/erase_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(key_const_reference r_key)\n{\n point_iterator it = find(r_key);\n if (it == base_type::end())\n return false;\n erase(it);\n return true;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nerase(iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n if (it == base_type::end())\n return it;\n iterator ret_it = it;\n ++ret_it;\n erase_node(it.m_p_nd);\n PB_DS_ASSERT_VALID((*this))\n return ret_it;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nerase(reverse_iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n if (it.m_p_nd == base_type::m_p_head)\n return (it);\n reverse_iterator ret_it = it;\n ++ret_it;\n erase_node(it.m_p_nd);\n PB_DS_ASSERT_VALID((*this))\n return ret_it;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n PB_DS_ASSERT_VALID((*this))\n size_type num_ersd = 0;\n iterator it = base_type::begin();\n while (it != base_type::end())\n {\n if (pred(*it))\n {\n\t ++num_ersd;\n\t it = erase(it);\n }\n else\n\t++it;\n }\n PB_DS_ASSERT_VALID((*this))\n return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_node(node_pointer p_nd)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n splay(p_nd);\n\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);\n\n node_pointer p_l = p_nd->m_p_left;\n node_pointer p_r = p_nd->m_p_right;\n\n base_type::update_min_max_for_erased_node(p_nd);\n base_type::actual_erase_node(p_nd);\n if (p_r == 0)\n {\n base_type::m_p_head->m_p_parent = p_l;\n if (p_l != 0)\n\tp_l->m_p_parent = base_type::m_p_head;\n PB_DS_ASSERT_VALID((*this))\n return;\n }\n\n node_pointer p_target_r = leftmost(p_r);\n _GLIBCXX_DEBUG_ASSERT(p_target_r != 0);\n p_r->m_p_parent = base_type::m_p_head;\n base_type::m_p_head->m_p_parent = p_r;\n splay(p_target_r);\n\n _GLIBCXX_DEBUG_ONLY(p_target_r->m_p_left = 0);\n _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_parent == this->m_p_head);\n _GLIBCXX_DEBUG_ASSERT(this->m_p_head->m_p_parent == p_target_r);\n\n p_target_r->m_p_left = p_l;\n if (p_l != 0)\n p_l->m_p_parent = p_target_r;\n PB_DS_ASSERT_VALID((*this))\n this->apply_update(p_target_r, (node_update*)this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nleftmost(node_pointer p_nd)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n while (p_nd->m_p_left != 0)\n p_nd = p_nd->m_p_left;\n return p_nd;\n}\n#endif\n","include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/find_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key)\n{\n node_pointer p_found = find_imp(r_key);\n if (p_found != base_type::m_p_head)\n splay(p_found);\n return point_iterator(p_found);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_const_iterator\nPB_DS_CLASS_C_DEC::\nfind(key_const_reference r_key) const\n{\n const node_pointer p_found = find_imp(r_key);\n if (p_found != base_type::m_p_head)\n const_cast<PB_DS_CLASS_C_DEC* >(this)->splay(p_found);\n return point_iterator(p_found);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nfind_imp(key_const_reference r_key)\n{\n _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid(__FILE__,\n\t\t\t\t\t\t\t __LINE__);)\n node_pointer p_nd = base_type::m_p_head->m_p_parent;\n while (p_nd != 0)\n if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n {\n\tif (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))\n\t return p_nd;\n\tp_nd = p_nd->m_p_left;\n }\n else\n p_nd = p_nd->m_p_right;\n return base_type::m_p_head;\n}\n\nPB_DS_CLASS_T_DEC\ninline const typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nfind_imp(key_const_reference r_key) const\n{\n PB_DS_ASSERT_VALID((*this))\n node_pointer p_nd = base_type::m_p_head->m_p_parent;\n while (p_nd != 0)\n if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n {\n\tif (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))\n\t return p_nd;\n\tp_nd = p_nd->m_p_left;\n }\n else\n p_nd = p_nd->m_p_right;\n return base_type::m_p_head;\n}\n#endif\n","include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/info_fn_imps.hpp\n * Contains an implementation.\n */\n","include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/insert_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert(const_reference r_value)\n{\n PB_DS_ASSERT_VALID((*this))\n std::pair<point_iterator, bool> ins_pair = insert_leaf_imp(r_value);\n ins_pair.first.m_p_nd->m_special = false;\n PB_DS_ASSERT_VALID((*this))\n splay(ins_pair.first.m_p_nd);\n PB_DS_ASSERT_VALID((*this))\n return ins_pair;\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_leaf_imp(const_reference r_value)\n{\n _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid(__FILE__,\n\t\t\t\t\t\t\t __LINE__);)\n if (base_type::m_size == 0)\n return std::make_pair(base_type::insert_imp_empty(r_value), true);\n\n node_pointer p_nd = base_type::m_p_head->m_p_parent;\n node_pointer p_pot = base_type::m_p_head;\n\n while (p_nd != 0)\n if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(r_value)))\n {\n\tif (!Cmp_Fn::operator()(PB_DS_V2F(r_value), PB_DS_V2F(p_nd->m_value)))\n\t {\n\t return std::make_pair(point_iterator(p_nd), false);\n\t }\n\tp_pot = p_nd;\n\tp_nd = p_nd->m_p_left;\n }\n else\n p_nd = p_nd->m_p_right;\n\n if (p_pot == base_type::m_p_head)\n return std::make_pair(base_type::insert_leaf_new(r_value, base_type::m_p_head->m_p_right, false), true);\n\n PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value))\n\n p_nd = p_pot->m_p_left;\n if (p_nd == 0)\n return (std::make_pair(base_type::insert_leaf_new(r_value, p_pot, true), true));\n\n while (p_nd->m_p_right != 0)\n p_nd = p_nd->m_p_right;\n\n return std::make_pair(this->insert_leaf_new(r_value, p_nd, false), true);\n}\n#endif\n","include/ext/pb_ds/detail/splay_tree_/node.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/node.hpp\n * Contains an implementation struct for splay_tree_'s node.\n */\n\n#ifndef PB_DS_SPLAY_TREE_NODE_HPP\n#define PB_DS_SPLAY_TREE_NODE_HPP\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Node for splay tree.\n template<typename Value_Type, class Metadata, typename _Alloc>\n struct splay_tree_node_\n {\n public:\n typedef Value_Type value_type;\n typedef Metadata metadata_type;\n\n typedef typename rebind_traits<_Alloc, splay_tree_node_>::pointer\n\tnode_pointer;\n\n typedef typename rebind_traits<_Alloc, metadata_type>::reference\n\tmetadata_reference;\n\n typedef typename rebind_traits<_Alloc, metadata_type>::const_reference\n\tmetadata_const_reference;\n\n#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_\n void\n trace() const\n { std::cout << PB_DS_V2F(m_value) << \"(\" << m_metadata << \")\"; }\n#endif\n\n inline bool\n special() const\n { return m_special; }\n\n inline metadata_const_reference\n get_metadata() const\n { return m_metadata; }\n\n inline metadata_reference\n get_metadata()\n { return m_metadata; }\n\n value_type m_value;\n bool m_special;\n node_pointer m_p_left;\n node_pointer m_p_right;\n node_pointer m_p_parent;\n metadata_type m_metadata;\n };\n\n template<typename Value_Type, typename _Alloc>\n struct splay_tree_node_<Value_Type, null_type, _Alloc>\n {\n public:\n typedef Value_Type value_type;\n typedef null_type metadata_type;\n\n typedef typename rebind_traits<_Alloc, splay_tree_node_>::pointer\n\tnode_pointer;\n\n inline bool\n special() const\n { return m_special; }\n\n#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_\n void\n trace() const\n { std::cout << PB_DS_V2F(m_value); }\n#endif \n\n node_pointer m_p_left;\n node_pointer m_p_right;\n node_pointer m_p_parent;\n value_type m_value;\n bool m_special;\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/splay_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplay(node_pointer p_nd)\n{\n while (p_nd->m_p_parent != base_type::m_p_head)\n {\n#ifdef _GLIBCXX_DEBUG\n {\n\tnode_pointer p_head = base_type::m_p_head;\n\tassert_special_imp(p_head, __FILE__, __LINE__);\n }\n#endif\n\n PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd)\n\n if (p_nd->m_p_parent->m_p_parent == base_type::m_p_head)\n\t{\n\t base_type::rotate_parent(p_nd);\n\t _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);\n\t}\n else\n\t{\n\t const node_pointer p_parent = p_nd->m_p_parent;\n\t const node_pointer p_grandparent = p_parent->m_p_parent;\n\n#ifdef _GLIBCXX_DEBUG\n\t const size_type total =\n\t base_type::recursive_count(p_grandparent);\n\t _GLIBCXX_DEBUG_ASSERT(total >= 3);\n#endif\n\n\t if (p_parent->m_p_left == p_nd &&\n\t p_grandparent->m_p_right == p_parent)\n\t splay_zig_zag_left(p_nd, p_parent, p_grandparent);\n\t else if (p_parent->m_p_right == p_nd &&\n\t\t p_grandparent->m_p_left == p_parent)\n\t splay_zig_zag_right(p_nd, p_parent, p_grandparent);\n\t else if (p_parent->m_p_left == p_nd &&\n\t\t p_grandparent->m_p_left == p_parent)\n\t splay_zig_zig_left(p_nd, p_parent, p_grandparent);\n\t else\n\t splay_zig_zig_right(p_nd, p_parent, p_grandparent);\n\t _GLIBCXX_DEBUG_ASSERT(total ==this->recursive_count(p_nd));\n\t}\n\n PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd)\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zig_zag_left(node_pointer p_nd, node_pointer p_parent,\n\t\t node_pointer p_grandparent)\n{\n _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);\n _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);\n\n PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)\n\n _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&\n\t\t\tp_grandparent->m_p_right == p_parent);\n\n splay_zz_start(p_nd, p_parent, p_grandparent);\n\n node_pointer p_b = p_nd->m_p_right;\n node_pointer p_c = p_nd->m_p_left;\n\n p_nd->m_p_right = p_parent;\n p_parent->m_p_parent = p_nd;\n\n p_nd->m_p_left = p_grandparent;\n p_grandparent->m_p_parent = p_nd;\n\n p_parent->m_p_left = p_b;\n if (p_b != 0)\n p_b->m_p_parent = p_parent;\n\n p_grandparent->m_p_right = p_c;\n if (p_c != 0)\n p_c->m_p_parent = p_grandparent;\n\n splay_zz_end(p_nd, p_parent, p_grandparent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zig_zag_right(node_pointer p_nd, node_pointer p_parent,\n\t\t node_pointer p_grandparent)\n{\n _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);\n _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);\n\n PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)\n\n _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&\n\t \t\tp_grandparent->m_p_left == p_parent);\n\n splay_zz_start(p_nd, p_parent, p_grandparent);\n\n node_pointer p_b = p_nd->m_p_left;\n node_pointer p_c = p_nd->m_p_right;\n\n p_nd->m_p_left = p_parent;\n p_parent->m_p_parent = p_nd;\n\n p_nd->m_p_right = p_grandparent;\n p_grandparent->m_p_parent = p_nd;\n\n p_parent->m_p_right = p_b;\n if (p_b != 0)\n p_b->m_p_parent = p_parent;\n\n p_grandparent->m_p_left = p_c;\n if (p_c != 0)\n p_c->m_p_parent = p_grandparent;\n\n splay_zz_end(p_nd, p_parent, p_grandparent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zig_zig_left(node_pointer p_nd, node_pointer p_parent,\n\t\t node_pointer p_grandparent)\n{\n _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);\n _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);\n\n PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)\n\n _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&\n\t\t p_nd->m_p_parent->m_p_parent->m_p_left == p_nd->m_p_parent);\n\n splay_zz_start(p_nd, p_parent, p_grandparent);\n\n node_pointer p_b = p_nd->m_p_right;\n node_pointer p_c = p_parent->m_p_right;\n\n p_nd->m_p_right = p_parent;\n p_parent->m_p_parent = p_nd;\n\n p_parent->m_p_right = p_grandparent;\n p_grandparent->m_p_parent = p_parent;\n\n p_parent->m_p_left = p_b;\n if (p_b != 0)\n p_b->m_p_parent = p_parent;\n\n p_grandparent->m_p_left = p_c;\n if (p_c != 0)\n p_c->m_p_parent = p_grandparent;\n\n splay_zz_end(p_nd, p_parent, p_grandparent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zig_zig_right(node_pointer p_nd, node_pointer p_parent,\n\t\t node_pointer p_grandparent)\n{\n _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);\n _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);\n PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)\n _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&\n\t\t p_nd->m_p_parent->m_p_parent->m_p_right == p_nd->m_p_parent);\n\n splay_zz_start(p_nd, p_parent, p_grandparent);\n\n node_pointer p_b = p_nd->m_p_left;\n node_pointer p_c = p_parent->m_p_left;\n\n p_nd->m_p_left = p_parent;\n p_parent->m_p_parent = p_nd;\n\n p_parent->m_p_left = p_grandparent;\n p_grandparent->m_p_parent = p_parent;\n\n p_parent->m_p_right = p_b;\n if (p_b != 0)\n p_b->m_p_parent = p_parent;\n\n p_grandparent->m_p_right = p_c;\n if (p_c != 0)\n p_c->m_p_parent = p_grandparent;\n\n base_type::update_to_top(p_grandparent, (node_update*)this);\n splay_zz_end(p_nd, p_parent, p_grandparent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zz_start(node_pointer p_nd,\n#ifdef _GLIBCXX_DEBUG\n\t node_pointer p_parent,\n#else\n\t node_pointer /*p_parent*/,\n#endif\n\t node_pointer p_grandparent)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n _GLIBCXX_DEBUG_ASSERT(p_parent != 0);\n _GLIBCXX_DEBUG_ASSERT(p_grandparent != 0);\n\n const bool grandparent_head = p_grandparent->m_p_parent == base_type::m_p_head;\n\n if (grandparent_head)\n {\n base_type::m_p_head->m_p_parent = base_type::m_p_head->m_p_parent;\n p_nd->m_p_parent = base_type::m_p_head;\n return;\n }\n\n node_pointer p_greatgrandparent = p_grandparent->m_p_parent;\n\n p_nd->m_p_parent = p_greatgrandparent;\n\n if (p_grandparent == p_greatgrandparent->m_p_left)\n p_greatgrandparent->m_p_left = p_nd;\n else\n p_greatgrandparent->m_p_right = p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zz_end(node_pointer p_nd, node_pointer p_parent,\n\t node_pointer p_grandparent)\n{\n if (p_nd->m_p_parent == base_type::m_p_head)\n base_type::m_p_head->m_p_parent = p_nd;\n\n this->apply_update(p_grandparent, (node_update*)this);\n this->apply_update(p_parent, (node_update*)this);\n this->apply_update(p_nd, (node_update*)this);\n PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd)\n}\n#endif\n","include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/splay_tree_.hpp\n * Contains an implementation class for splay trees.\n */\n/*\n * This implementation uses an idea from the SGI STL (using a @a header node\n * which is needed for efficient iteration). Following is the SGI STL\n * copyright.\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation. Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose. It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation. Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose. It is provided \"as is\" without express or implied warranty.\n *\n *\n */\n\n#include <utility>\n#include <vector>\n#include <assert.h>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n# define PB_DS_S_TREE_NAME splay_tree_map\n# define PB_DS_S_TREE_BASE_NAME bin_search_tree_map\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n# define PB_DS_S_TREE_NAME splay_tree_set\n# define PB_DS_S_TREE_BASE_NAME bin_search_tree_set\n#endif\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Key, typename Mapped, typename Cmp_Fn, \\\n\t typename Node_And_It_Traits, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n PB_DS_S_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>\n\n#define PB_DS_S_TREE_BASE \\\n PB_DS_S_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>\n\n\n /**\n * @brief Splay tree.\n * @ingroup branch-detail\n */\n template<typename Key, typename Mapped, typename Cmp_Fn,\n\t typename Node_And_It_Traits, typename _Alloc>\n class PB_DS_S_TREE_NAME : public PB_DS_S_TREE_BASE\n {\n private:\n typedef PB_DS_S_TREE_BASE \t\t \t base_type;\n#ifdef _GLIBCXX_DEBUG\n typedef base_type debug_base;\n#endif\n typedef typename base_type::node_pointer \t\t node_pointer;\n\n public:\n typedef splay_tree_tag \t\t\t\t container_category;\n typedef _Alloc \t\t\t\t\t allocator_type;\n typedef typename _Alloc::size_type \t\t size_type;\n typedef typename _Alloc::difference_type \t\t difference_type;\n typedef Cmp_Fn \t\t\t\t\t cmp_fn;\n typedef typename base_type::key_type \t\t key_type;\n typedef typename base_type::key_pointer \t\t key_pointer;\n typedef typename base_type::key_const_pointer \t key_const_pointer;\n typedef typename base_type::key_reference \t key_reference;\n typedef typename base_type::key_const_reference \t key_const_reference;\n typedef typename base_type::mapped_type \t \t mapped_type;\n typedef typename base_type::mapped_pointer \t mapped_pointer;\n typedef typename base_type::mapped_const_pointer \t mapped_const_pointer;\n typedef typename base_type::mapped_reference \t mapped_reference;\n typedef typename base_type::mapped_const_reference mapped_const_reference;\n typedef typename base_type::value_type \t\t value_type;\n typedef typename base_type::pointer \t\t pointer;\n typedef typename base_type::const_pointer \t const_pointer;\n typedef typename base_type::reference \t \t reference;\n typedef typename base_type::const_reference \t const_reference;\n typedef typename base_type::point_iterator \t point_iterator;\n typedef typename base_type::const_iterator \t point_const_iterator;\n typedef typename base_type::iterator \t\t iterator;\n typedef typename base_type::const_iterator \t const_iterator;\n typedef typename base_type::reverse_iterator \t reverse_iterator;\n typedef typename base_type::const_reverse_iterator const_reverse_iterator;\n typedef typename base_type::node_update \t\t node_update;\n\n PB_DS_S_TREE_NAME();\n\n PB_DS_S_TREE_NAME(const Cmp_Fn&);\n\n PB_DS_S_TREE_NAME(const Cmp_Fn&, const node_update&);\n\n PB_DS_S_TREE_NAME(const PB_DS_CLASS_C_DEC&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n template<typename It>\n void\n copy_from_range(It, It);\n\n void\n initialize();\n\n inline std::pair<point_iterator, bool>\n insert(const_reference r_value);\n\n inline mapped_reference\n operator[](key_const_reference r_key)\n {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\tstd::pair<point_iterator, bool> ins_pair =\n\t insert_leaf_imp(value_type(r_key, mapped_type()));\n\n\tins_pair.first.m_p_nd->m_special = false;\n\t_GLIBCXX_DEBUG_ONLY(base_type::assert_valid(__FILE__, __LINE__));\n\tsplay(ins_pair.first.m_p_nd);\n\t_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)\n\treturn ins_pair.first.m_p_nd->m_value.second;\n#else\n\tinsert(r_key);\n\treturn base_type::s_null_type;\n#endif\n }\n\n inline point_iterator\n find(key_const_reference);\n\n inline point_const_iterator\n find(key_const_reference) const;\n\n inline bool\n erase(key_const_reference);\n\n inline iterator\n erase(iterator it);\n\n inline reverse_iterator\n erase(reverse_iterator);\n\n template<typename Pred>\n inline size_type\n erase_if(Pred);\n\n void\n join(PB_DS_CLASS_C_DEC&);\n\n void\n split(key_const_reference, PB_DS_CLASS_C_DEC&);\n\n private:\n inline std::pair<point_iterator, bool>\n insert_leaf_imp(const_reference);\n\n inline node_pointer\n find_imp(key_const_reference);\n\n inline const node_pointer\n find_imp(key_const_reference) const;\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char* file, int line) const;\n\n void\n assert_special_imp(const node_pointer, const char* file, int line) const;\n#endif\n\n void\n splay(node_pointer);\n\n inline void\n splay_zig_zag_left(node_pointer, node_pointer, node_pointer);\n\n inline void\n splay_zig_zag_right(node_pointer, node_pointer, node_pointer);\n\n inline void\n splay_zig_zig_left(node_pointer, node_pointer, node_pointer);\n\n inline void\n splay_zig_zig_right(node_pointer, node_pointer, node_pointer);\n\n inline void\n splay_zz_start(node_pointer, node_pointer, node_pointer);\n\n inline void\n splay_zz_end(node_pointer, node_pointer, node_pointer);\n\n inline node_pointer\n leftmost(node_pointer);\n\n void\n erase_node(node_pointer);\n };\n\n#define PB_DS_ASSERT_BASE_NODE_CONSISTENT(_Node)\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node,\t\t\\\n\t\t\t\t\t\t\t__FILE__, __LINE__);)\n\n#include <ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp>\n\n#undef PB_DS_ASSERT_BASE_NODE_CONSISTENT\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_S_TREE_NAME\n#undef PB_DS_S_TREE_BASE_NAME\n#undef PB_DS_S_TREE_BASE\n } // namespace detail\n} // namespace __gnu_pbds\n","include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/split_join_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n if (base_type::join_prep(other) == false)\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n node_pointer p_target_r = other.leftmost(other.m_p_head);\n _GLIBCXX_DEBUG_ASSERT(p_target_r != 0);\n other.splay(p_target_r);\n\n _GLIBCXX_DEBUG_ASSERT(p_target_r == other.m_p_head->m_p_parent);\n _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left == 0);\n\n p_target_r->m_p_left = base_type::m_p_head->m_p_parent;\n\n _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left != 0);\n p_target_r->m_p_left->m_p_parent = p_target_r;\n\n base_type::m_p_head->m_p_parent = p_target_r;\n p_target_r->m_p_parent = base_type::m_p_head;\n\n this->apply_update(p_target_r, (node_update*)this);\n base_type::join_finish(other);\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n if (base_type::split_prep(r_key, other) == false)\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n node_pointer p_upper_bound = this->upper_bound(r_key).m_p_nd;\n _GLIBCXX_DEBUG_ASSERT(p_upper_bound != 0);\n\n splay(p_upper_bound);\n _GLIBCXX_DEBUG_ASSERT(p_upper_bound->m_p_parent == this->m_p_head);\n\n node_pointer p_new_root = p_upper_bound->m_p_left;\n _GLIBCXX_DEBUG_ASSERT(p_new_root != 0);\n\n base_type::m_p_head->m_p_parent = p_new_root;\n p_new_root->m_p_parent = base_type::m_p_head;\n other.m_p_head->m_p_parent = p_upper_bound;\n p_upper_bound->m_p_parent = other.m_p_head;\n p_upper_bound->m_p_left = 0;\n this->apply_update(p_upper_bound, (node_update*)this);\n base_type::split_finish(other);\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\n#endif\n","include/ext/pb_ds/detail/splay_tree_/traits.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_/traits.hpp\n * Contains an implementation for splay_tree_.\n */\n\n#ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/splay_tree_/node.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Specialization.\n /// @ingroup traits\n template<typename Key,\n\t typename Mapped,\n\t typename Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t typename Node_Itr,\n\t\t typename Cmp_Fn_,\n\t\t typename _Alloc_>\n\t class Node_Update,\n\t typename _Alloc>\n struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, splay_tree_tag, _Alloc> \n : public bin_search_tree_traits<Key, Mapped, Cmp_Fn, Node_Update,\n\t\t\t\t splay_tree_node_<\n typename types_traits<Key, Mapped, _Alloc, false>::value_type,\n typename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update,\n\t\t\t\t\t _Alloc>::type,\n\t\t\t\t _Alloc>,\n\t\t\t\t _Alloc>\n { };\n\n /// Specialization.\n /// @ingroup traits\n template<typename Key,\n\t class Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t class Node_Itr,\n\t\t class Cmp_Fn_,\n\t\t typename _Alloc_>\n class Node_Update,\n\t typename _Alloc>\n struct tree_traits<Key, null_type, Cmp_Fn, Node_Update,\n\t\t splay_tree_tag, _Alloc> \n : public bin_search_tree_traits<Key, null_type, Cmp_Fn, Node_Update, \n\t\t\t\t splay_tree_node_<\n typename types_traits<Key, null_type, _Alloc, false>::value_type,\n typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update,\n\t\t\t\t\t _Alloc>::type,\n\t\t\t\t _Alloc>,\n\t\t\t\t _Alloc>\n { };\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP\n","include/ext/pb_ds/detail/standard_policies.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file detail/standard_policies.hpp\n * Contains standard policies for containers.\n */\n\n#ifndef PB_DS_STANDARD_POLICIES_HPP\n#define PB_DS_STANDARD_POLICIES_HPP\n\n#include <memory>\n#include <ext/pb_ds/hash_policy.hpp>\n#include <ext/pb_ds/list_update_policy.hpp>\n#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/trie_policy.hpp>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <tr1/functional>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Primary template, default_hash_fn.\n template<typename Key>\n struct default_hash_fn\n {\n\t/// Dispatched type.\n typedef std::tr1::hash<Key> \t\t\t\ttype;\n };\n\n /// Primary template, default_eq_fn.\n template<typename Key>\n struct default_eq_fn\n {\n\t/// Dispatched type.\n typedef std::equal_to<Key> \t\t\t\ttype;\n };\n\n /// Enumeration for default behavior of stored hash data.\n enum\n {\n\tdefault_store_hash = false\n };\n\n /// Primary template, default_comb_hash_fn.\n struct default_comb_hash_fn\n {\n\t/// Dispatched type.\n typedef direct_mask_range_hashing<> \t\t\ttype;\n };\n\n /// Primary template, default_resize_policy.\n template<typename Comb_Hash_Fn>\n struct default_resize_policy\n {\n private:\n typedef typename Comb_Hash_Fn::size_type \t\t\tsize_type;\n\n typedef direct_mask_range_hashing<size_type> \t\tdefault_fn;\n typedef is_same<default_fn, Comb_Hash_Fn> \t\tsame_type;\n typedef hash_exponential_size_policy<size_type> \t\tiftrue;\n typedef hash_prime_size_policy \t\t\t\tiffalse;\n typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type;\n typedef typename cond_type::__type \t\t size_policy_type;\n\n typedef hash_load_check_resize_trigger<false, size_type> \ttrigger;\n\n public:\n\t/// Dispatched type.\n typedef hash_standard_resize_policy<size_policy_type, trigger, \n\t\t\t\t\t false, size_type> \ttype;\n };\n\n /// Default update policy.\n struct default_update_policy\n {\n\t/// Dispatched type.\n typedef lu_move_to_front_policy<> \t\t\ttype;\n };\n\n /// Primary template, default_probe_fn.\n template<typename Comb_Probe_Fn>\n struct default_probe_fn\n {\n private:\n typedef typename Comb_Probe_Fn::size_type \t\tsize_type;\n typedef direct_mask_range_hashing<size_type> \t\tdefault_fn;\n typedef is_same<default_fn, Comb_Probe_Fn> \t\tsame_type;\n typedef linear_probe_fn<size_type> \t\t\tiftrue;\n typedef quadratic_probe_fn<size_type> \t\t\tiffalse;\n typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type;\n\n public:\n\t/// Dispatched type.\n typedef typename cond_type::__type \t\t\ttype;\n };\n\n\n /// Primary template, default_trie_access_traits.\n template<typename Key>\n struct default_trie_access_traits;\n\n#define __dtrie_alloc std::allocator<char> \n#define __dtrie_string std::basic_string<Char, Char_Traits, __dtrie_alloc> \n\n /// Partial specialization, default_trie_access_traits.\n template<typename Char, typename Char_Traits>\n struct default_trie_access_traits<__dtrie_string>\n {\n private:\n\ttypedef __dtrie_string\t\t\t\t\tstring_type;\n\n public:\n\t/// Dispatched type.\n\ttypedef trie_string_access_traits<string_type> \t\ttype;\n };\n\n#undef __dtrie_alloc\n#undef __dtrie_string\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_STANDARD_POLICIES_HPP\n","include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file thin_heap_/constructors_destructor_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n while (first_it != last_it)\n push(*(first_it++));\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nthin_heap() : m_p_max(0)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nthin_heap(const Cmp_Fn& r_cmp_fn) \n: base_type(r_cmp_fn), m_p_max(0)\n{\n initialize();\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nthin_heap(const PB_DS_CLASS_C_DEC& other) \n: base_type(other)\n{\n initialize();\n m_p_max = base_type::m_p_root;\n for (node_pointer p_nd = base_type::m_p_root; p_nd != 0; \n p_nd = p_nd->m_p_next_sibling)\n if (Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))\n m_p_max = p_nd;\n\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n base_type::swap(other);\n std::swap(m_p_max, other.m_p_max);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~thin_heap()\n{ }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{ std::fill(m_a_aux, m_a_aux + max_rank, static_cast<node_pointer>(0)); }\n\n#endif\n","include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file thin_heap_/debug_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(const char* __file, int __line) const\n{\n base_type::assert_valid(__file, __line);\n assert_node_consistent(base_type::m_p_root, true, __file, __line);\n assert_max(__file, __line);\n assert_aux_null(__file, __line);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_aux_null(const char* __file, int __line) const\n{\n for (size_type i = 0; i < max_rank; ++i)\n PB_DS_DEBUG_VERIFY(m_a_aux[i] == 0);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_max(const char* __file, int __line) const\n{\n if (m_p_max == 0)\n {\n PB_DS_DEBUG_VERIFY(base_type::empty());\n return;\n }\n\n PB_DS_DEBUG_VERIFY(!base_type::empty());\n PB_DS_DEBUG_VERIFY(base_type::parent(m_p_max) == 0);\n PB_DS_DEBUG_VERIFY(m_p_max->m_p_prev_or_parent == 0);\n for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)\n PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(m_p_max->m_value, it.m_p_nd->m_value));\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(node_const_pointer p_nd, bool root,\n\t\t const char* __file, int __line) const\n{\n base_type::assert_node_consistent(p_nd, root, __file, __line);\n if (p_nd == 0)\n return;\n\n assert_node_consistent(p_nd->m_p_next_sibling, root, __file, __line);\n assert_node_consistent(p_nd->m_p_l_child, false, __file, __line);\n if (!root)\n {\n if (p_nd->m_metadata == 0)\n\tPB_DS_DEBUG_VERIFY(p_nd->m_p_next_sibling == 0);\n else\n\tPB_DS_DEBUG_VERIFY(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata + 1);\n }\n\n if (p_nd->m_p_l_child != 0)\n PB_DS_DEBUG_VERIFY(p_nd->m_p_l_child->m_metadata + 1 == base_type::degree(p_nd));\n\n const bool unmarked_valid =\n (p_nd->m_p_l_child == 0 && p_nd->m_metadata == 0)\n || (p_nd->m_p_l_child != 0\n\t && p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 1);\n\n const bool marked_valid =\n (p_nd->m_p_l_child == 0 && p_nd->m_metadata == 1)\n || (p_nd->m_p_l_child != 0\n\t&& p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 2);\n\n PB_DS_DEBUG_VERIFY(unmarked_valid || marked_valid);\n if (root)\n PB_DS_DEBUG_VERIFY(unmarked_valid);\n}\n\n#endif \n#endif\n","include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file thin_heap_/erase_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\npop()\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);\n\n node_pointer p_nd = m_p_max;\n remove_max_node();\n base_type::actual_erase_node(p_nd);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nremove_max_node()\n{\n to_aux_except_max();\n make_from_aux();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nto_aux_except_max()\n{\n node_pointer p_add = base_type::m_p_root;\n while (p_add != m_p_max)\n {\n node_pointer p_next_add = p_add->m_p_next_sibling;\n add_to_aux(p_add);\n p_add = p_next_add;\n }\n\n p_add = m_p_max->m_p_l_child;\n while (p_add != 0)\n {\n node_pointer p_next_add = p_add->m_p_next_sibling;\n p_add->m_metadata = p_add->m_p_l_child == 0 ?\n\t0 : p_add->m_p_l_child->m_metadata + 1;\n\n add_to_aux(p_add);\n p_add = p_next_add;\n }\n\n p_add = m_p_max->m_p_next_sibling;\n while (p_add != 0)\n {\n node_pointer p_next_add = p_add->m_p_next_sibling;\n add_to_aux(p_add);\n p_add = p_next_add;\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nadd_to_aux(node_pointer p_nd)\n{\n size_type r = p_nd->m_metadata;\n while (m_a_aux[r] != 0)\n {\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());\n if (Cmp_Fn::operator()(m_a_aux[r]->m_value, p_nd->m_value))\n\tmake_child_of(m_a_aux[r], p_nd);\n else\n\t{\n\t make_child_of(p_nd, m_a_aux[r]);\n\t p_nd = m_a_aux[r];\n\t}\n\n m_a_aux[r] = 0;\n ++r;\n }\n\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());\n\n m_a_aux[r] = p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_child_of(node_pointer p_nd, node_pointer p_new_parent)\n{\n _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_new_parent->m_metadata);\n _GLIBCXX_DEBUG_ASSERT(m_a_aux[p_nd->m_metadata] == p_nd ||\n\t\t m_a_aux[p_nd->m_metadata] == p_new_parent);\n\n ++p_new_parent->m_metadata;\n base_type::make_child_of(p_nd, p_new_parent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_from_aux()\n{\n base_type::m_p_root = m_p_max = 0;\n const size_type rnk_bnd = rank_bound();\n size_type i = 0;\n while (i < rnk_bnd)\n {\n if (m_a_aux[i] != 0)\n\t{\n\t make_root_and_link(m_a_aux[i]);\n\t m_a_aux[i] = 0;\n\t}\n ++i;\n }\n\n PB_DS_ASSERT_AUX_NULL((*this))\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nremove_node(node_pointer p_nd)\n{\n node_pointer p_parent = p_nd;\n while (base_type::parent(p_parent) != 0)\n p_parent = base_type::parent(p_parent);\n\n base_type::bubble_to_top(p_nd);\n m_p_max = p_nd;\n\n node_pointer p_fix = base_type::m_p_root;\n while (p_fix != 0&& p_fix->m_p_next_sibling != p_parent)\n p_fix = p_fix->m_p_next_sibling;\n\n if (p_fix != 0)\n p_fix->m_p_next_sibling = p_nd;\n\n remove_max_node();\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nclear()\n{\n base_type::clear();\n m_p_max = 0;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n node_pointer p_nd = it.m_p_nd;\n remove_node(p_nd);\n base_type::actual_erase_node(p_nd);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n PB_DS_ASSERT_VALID((*this))\n if (base_type::empty())\n {\n PB_DS_ASSERT_VALID((*this))\n return 0;\n }\n\n base_type::to_linked_list();\n node_pointer p_out = base_type::prune(pred);\n size_type ersd = 0;\n while (p_out != 0)\n {\n ++ersd;\n node_pointer p_next = p_out->m_p_next_sibling;\n base_type::actual_erase_node(p_out);\n p_out = p_next;\n }\n\n node_pointer p_cur = base_type::m_p_root;\n m_p_max = base_type::m_p_root = 0;\n while (p_cur != 0)\n {\n node_pointer p_next = p_cur->m_p_next_sibling;\n make_root_and_link(p_cur);\n p_cur = p_next;\n }\n\n PB_DS_ASSERT_VALID((*this))\n return ersd;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nrank_bound()\n{\n using namespace std;\n const size_t* const p_upper =\n std::upper_bound(g_a_rank_bounds,\n\t\t g_a_rank_bounds + num_distinct_rank_bounds,\n\t\t base_type::m_size);\n\n if (p_upper == g_a_rank_bounds + num_distinct_rank_bounds)\n return max_rank;\n\n return (p_upper - g_a_rank_bounds);\n}\n#endif\n","include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file thin_heap_/find_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop() const\n{\n PB_DS_ASSERT_VALID((*this))\n _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);\n return m_p_max->m_value;\n}\n#endif\n","include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file thin_heap_/insert_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n PB_DS_ASSERT_VALID((*this))\n node_pointer p_nd = base_type::get_new_node_for_insert(r_val);\n p_nd->m_metadata = 0;\n p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0;\n if (base_type::m_p_root == 0)\n {\n p_nd->m_p_next_sibling = 0;\n m_p_max = base_type::m_p_root = p_nd;\n PB_DS_ASSERT_VALID((*this))\n return point_iterator(p_nd);\n }\n\n p_nd->m_p_next_sibling = base_type::m_p_root;\n base_type::m_p_root->m_p_prev_or_parent = 0;\n base_type::m_p_root = p_nd;\n update_max(p_nd);\n PB_DS_ASSERT_VALID((*this))\n return point_iterator(p_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_root(node_pointer p_nd)\n{\n p_nd->m_metadata = p_nd->m_p_l_child == 0 \n ? 0 : 1 + p_nd->m_p_l_child->m_metadata;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_root_and_link(node_pointer p_nd)\n{\n make_root(p_nd);\n p_nd->m_p_prev_or_parent = 0;\n p_nd->m_p_next_sibling = base_type::m_p_root;\n if (base_type::m_p_root != 0)\n base_type::m_p_root->m_p_prev_or_parent = 0;\n\n base_type::m_p_root = p_nd;\n update_max(p_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix(node_pointer p_y)\n{\n while (true)\n {\n if (p_y->m_p_prev_or_parent == 0)\n {\n\t fix_root(p_y);\n\t return;\n }\n else if (p_y->m_metadata == 1&& p_y->m_p_next_sibling == 0)\n {\n\t if (p_y->m_p_l_child != 0)\n {\n\t fix_sibling_rank_1_unmarked(p_y);\n\t return;\n }\n\n\t fix_sibling_rank_1_marked(p_y);\n\t p_y = p_y->m_p_prev_or_parent;\n }\n else if (p_y->m_metadata > p_y->m_p_next_sibling->m_metadata + 1)\n {\n\t _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child != 0);\n\t if (p_y->m_metadata != p_y->m_p_l_child->m_metadata + 2)\n {\n\t fix_sibling_general_unmarked(p_y);\n\t return;\n }\n\n\t fix_sibling_general_marked(p_y);\n\t p_y = p_y->m_p_prev_or_parent;\n }\n else if ((p_y->m_p_l_child == 0&& \n p_y->m_metadata == 2) ||(p_y->m_p_l_child != 0&& \n\t\t\t\t\t p_y->m_metadata == p_y->m_p_l_child->m_metadata + 3))\n {\n\t node_pointer p_z = p_y->m_p_prev_or_parent;\n\t fix_child(p_y);\n\t p_y = p_z;\n }\n else\n\treturn;\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_root(node_pointer p_y)\n{\n _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent == 0);\n make_root(p_y);\n PB_DS_ASSERT_NODE_CONSISTENT(p_y, true)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_sibling_rank_1_unmarked(node_pointer p_y)\n{\n _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);\n\n _GLIBCXX_DEBUG_ONLY(node_pointer p_w = p_y->m_p_l_child;)\n _GLIBCXX_DEBUG_ASSERT(p_w != 0);\n _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling == 0);\n _GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == 0);\n\n p_y->m_p_next_sibling = p_y->m_p_l_child;\n p_y->m_p_next_sibling->m_p_prev_or_parent = p_y;\n p_y->m_p_l_child = 0;\n PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_sibling_rank_1_marked(node_pointer p_y)\n{\n _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);\n _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == 0);\n p_y->m_metadata = 0;\n PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_sibling_general_unmarked(node_pointer p_y)\n{\n _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);\n\n node_pointer p_w = p_y->m_p_l_child;\n _GLIBCXX_DEBUG_ASSERT(p_w != 0);\n _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != 0);\n\n p_y->m_p_l_child = p_w->m_p_next_sibling;\n p_w->m_p_next_sibling->m_p_prev_or_parent = p_y;\n\n p_w->m_p_next_sibling = p_y->m_p_next_sibling;\n _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != 0);\n p_w->m_p_next_sibling->m_p_prev_or_parent = p_w;\n\n p_y->m_p_next_sibling = p_w;\n p_w->m_p_prev_or_parent = p_y;\n\n PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_sibling_general_marked(node_pointer p_y)\n{\n _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);\n --p_y->m_metadata;\n PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_child(node_pointer p_y)\n{\n _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);\n\n if (p_y->m_p_next_sibling != 0)\n p_y->m_p_next_sibling->m_p_prev_or_parent = p_y->m_p_prev_or_parent;\n\n if (p_y->m_p_prev_or_parent->m_p_l_child == p_y)\n p_y->m_p_prev_or_parent->m_p_l_child = p_y->m_p_next_sibling;\n else\n p_y->m_p_prev_or_parent->m_p_next_sibling = p_y->m_p_next_sibling;\n\n make_root_and_link(p_y);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n PB_DS_ASSERT_VALID((*this))\n node_pointer p_nd = it.m_p_nd;\n _GLIBCXX_DEBUG_ASSERT(p_nd != 0);\n\n const bool smaller = Cmp_Fn::operator()(r_new_val, p_nd->m_value);\n p_nd->m_value = r_new_val;\n if (smaller)\n {\n remove_node(p_nd);\n p_nd->m_p_l_child = 0;\n make_root_and_link(p_nd);\n PB_DS_ASSERT_VALID((*this))\n return;\n }\n\n if (p_nd->m_p_prev_or_parent == 0)\n {\n update_max(p_nd);\n PB_DS_ASSERT_VALID((*this))\n return;\n }\n\n node_pointer p_y = p_nd->m_p_prev_or_parent;\n _GLIBCXX_DEBUG_ASSERT(p_y != 0);\n\n if (p_nd->m_p_next_sibling != 0)\n p_nd->m_p_next_sibling->m_p_prev_or_parent = p_y;\n\n if (p_y->m_p_l_child == p_nd)\n p_y->m_p_l_child = p_nd->m_p_next_sibling;\n else\n p_y->m_p_next_sibling = p_nd->m_p_next_sibling;\n\n fix(p_y);\n make_root_and_link(p_nd);\n PB_DS_ASSERT_VALID((*this))\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_max(node_pointer p_nd)\n{\n if (m_p_max == 0 || Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))\n m_p_max = p_nd;\n}\n\n#endif\n","include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file thin_heap_/split_join_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n other.clear();\n if (base_type::empty())\n {\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n return;\n }\n\n base_type::to_linked_list();\n node_pointer p_out = base_type::prune(pred);\n\n while (p_out != 0)\n {\n _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);\n --base_type::m_size;\n ++other.m_size;\n node_pointer p_next = p_out->m_p_next_sibling;\n other.make_root_and_link(p_out);\n p_out = p_next;\n }\n\n PB_DS_ASSERT_VALID(other)\n node_pointer p_cur = base_type::m_p_root;\n m_p_max = 0;\n base_type::m_p_root = 0;\n while (p_cur != 0)\n {\n node_pointer p_next = p_cur->m_p_next_sibling;\n make_root_and_link(p_cur);\n p_cur = p_next;\n }\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n\n node_pointer p_other = other.m_p_root;\n while (p_other != 0)\n {\n node_pointer p_next = p_other->m_p_next_sibling;\n make_root_and_link(p_other);\n p_other = p_next;\n }\n base_type::m_size += other.m_size;\n other.m_p_root = 0;\n other.m_size = 0;\n other.m_p_max = 0;\n\n PB_DS_ASSERT_VALID((*this))\n PB_DS_ASSERT_VALID(other)\n}\n#endif\n","include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file thin_heap_/thin_heap_.hpp\n * Contains an implementation class for a thin heap.\n */\n\n#ifndef PB_DS_THIN_HEAP_HPP\n#define PB_DS_THIN_HEAP_HPP\n\n#include <algorithm>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>\n#include <debug/debug.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#define PB_DS_CLASS_T_DEC \\\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n thin_heap<Value_Type, Cmp_Fn, _Alloc>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_BASE_T_P \\\n <Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc, true>\n#else\n#define PB_DS_BASE_T_P \\\n <Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc>\n#endif\n\n\n /**\n * Thin heap.\n *\n * @ingroup heap-detail\n *\n * See Tarjan and Kaplan.\n */\n template<typename Value_Type, typename Cmp_Fn, typename _Alloc>\n class thin_heap\n : public left_child_next_sibling_heap PB_DS_BASE_T_P\n {\n private:\n typedef rebind_traits<_Alloc, Value_Type>\t\t __rebind_a;\n typedef left_child_next_sibling_heap PB_DS_BASE_T_P base_type;\n\n protected:\n typedef typename base_type::node \t\t\tnode;\n typedef typename base_type::node_pointer \t\tnode_pointer;\n typedef typename base_type::node_const_pointer \tnode_const_pointer;\n\n public:\n typedef Value_Type \t\t\t\tvalue_type;\n typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename _Alloc::size_type \t\tsize_type;\n typedef typename _Alloc::difference_type \t\tdifference_type;\n\n typedef typename __rebind_a::pointer\t\tpointer;\n typedef typename __rebind_a::const_pointer\tconst_pointer;\n typedef typename __rebind_a::reference\t\treference;\n typedef typename __rebind_a::const_reference \tconst_reference;\n\n typedef typename base_type::point_iterator \tpoint_iterator;\n typedef typename base_type::point_const_iterator \tpoint_const_iterator;\n typedef typename base_type::iterator \t\titerator;\n typedef typename base_type::const_iterator \tconst_iterator;\n\n\n inline point_iterator\n push(const_reference);\n\n void\n modify(point_iterator, const_reference);\n\n inline const_reference\n top() const;\n\n void\n pop();\n\n void\n erase(point_iterator);\n\n inline void\n clear();\n\n template<typename Pred>\n size_type\n erase_if(Pred);\n\n template<typename Pred>\n void\n split(Pred, PB_DS_CLASS_C_DEC&);\n\n void\n join(PB_DS_CLASS_C_DEC&);\n\n protected:\n thin_heap();\n\n thin_heap(const Cmp_Fn&);\n\n thin_heap(const PB_DS_CLASS_C_DEC&);\n\n void\n swap(PB_DS_CLASS_C_DEC&);\n\n ~thin_heap();\n\n template<typename It>\n void\n copy_from_range(It, It);\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char*, int) const;\n\n void\n assert_max(const char*, int) const;\n#endif\n\n#ifdef PB_DS_THIN_HEAP_TRACE_\n void\n trace() const;\n#endif\n\n private:\n enum\n\t{\n\t max_rank = (sizeof(size_type) << 4) + 2\n\t};\n\n void\n initialize();\n\n inline void\n update_max(node_pointer);\n\n inline void\n fix(node_pointer);\n\n inline void\n fix_root(node_pointer);\n\n inline void\n fix_sibling_rank_1_unmarked(node_pointer);\n\n inline void\n fix_sibling_rank_1_marked(node_pointer);\n\n inline void\n fix_sibling_general_unmarked(node_pointer);\n\n inline void\n fix_sibling_general_marked(node_pointer);\n\n inline void\n fix_child(node_pointer);\n\n inline static void\n make_root(node_pointer);\n\n inline void\n make_root_and_link(node_pointer);\n\n inline void\n remove_max_node();\n\n void\n to_aux_except_max();\n\n inline void\n add_to_aux(node_pointer);\n\n inline void\n make_from_aux();\n\n inline size_type\n rank_bound();\n\n inline void\n make_child_of(node_pointer, node_pointer);\n\n inline void\n remove_node(node_pointer);\n\n inline node_pointer\n join(node_pointer, node_pointer) const;\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_node_consistent(node_const_pointer, bool, const char*, int) const;\n\n void\n assert_aux_null(const char*, int) const;\n#endif\n\n node_pointer \tm_p_max;\n node_pointer \tm_a_aux[max_rank];\n };\n\n enum\n {\n\tnum_distinct_rank_bounds = 48\n };\n\n // Taken from the SGI implementation; acknowledged in the docs.\n static const std::size_t g_a_rank_bounds[num_distinct_rank_bounds] =\n {\n\t/* Dealing cards... */\n\t/* 0 */ 0ul,\n\t/* 1 */ 1ul,\n\t/* 2 */ 1ul,\n\t/* 3 */ 2ul,\n\t/* 4 */ 4ul,\n\t/* 5 */ 6ul,\n\t/* 6 */ 11ul,\n\t/* 7 */ 17ul,\n\t/* 8 */ 29ul,\n\t/* 9 */ 46ul,\n\t/* 10 */ 76ul,\n\t/* 11 */ 122ul,\n\t/* 12 */ 199ul,\n\t/* 13 */ 321ul,\n\t/* 14 */ 521ul,\n\t/* 15 */ 842ul,\n\t/* 16 */ 1364ul,\n\t/* 17 */ 2206ul,\n\t/* 18 */ 3571ul,\n\t/* 19 */ 5777ul,\n\t/* 20 */ 9349ul,\n\t/* 21 */ 15126ul,\n\t/* 22 */ 24476ul,\n\t/* 23 */ 39602ul,\n\t/* 24 */ 64079ul\n#if __SIZE_MAX__ > 0xfffful\n\t,\n\t/* 25 */ 103681ul,\n\t/* 26 */ 167761ul,\n\t/* 27 */ 271442ul,\n\t/* 28 */ 439204ul,\n\t/* 29 */ 710646ul\n#if __SIZE_MAX__ > 0xffffful\n\t,\n\t/* 30 */ 1149851ul,\n\t/* 31 */ 1860497ul,\n\t/* 32 */ 3010349ul,\n\t/* 33 */ 4870846ul,\n\t/* 34 */ 7881196ul,\n\t/* 35 */ 12752042ul\n#if __SIZE_MAX__ > 0xfffffful\n\t,\n\t/* 36 */ 20633239ul,\n\t/* 37 */ 33385282ul,\n\t/* 38 */ 54018521ul,\n\t/* 39 */ 87403803ul,\n\t/* 40 */ 141422324ul,\n\t/* 41 */ 228826127ul,\n\t/* 42 */ 370248451ul,\n\t/* 43 */ 599074578ul,\n\t/* 44 */ 969323029ul,\n\t/* 45 */ 1568397607ul,\n\t/* 46 */ 2537720636ul,\n\t/* 47 */ 4106118243ul\n#endif\n#endif\n#endif\n\t/* Pot's good, let's play */\n };\n\n#define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool)\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, _Bool,\t\t\\\n\t\t\t\t\t __FILE__, __LINE__);)\n\n#define PB_DS_ASSERT_AUX_NULL(X)\t\t\t\t\t\\\n _GLIBCXX_DEBUG_ONLY(X.assert_aux_null(__FILE__, __LINE__);)\n\n#include <ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp>\n\n#undef PB_DS_ASSERT_AUX_NULL\n#undef PB_DS_ASSERT_NODE_CONSISTENT\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_BASE_T_P\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file thin_heap_/trace_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\n#ifdef PB_DS_THIN_HEAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n std::cerr << std::endl;\n std::cerr << \"m_p_max \" << m_p_max << std::endl;\n base_type::trace();\n}\n\n#endif // #ifdef PB_DS_THIN_HEAP_TRACE_\n#endif\n","include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file tree_policy/node_metadata_selector.hpp\n * Contains an implementation class for trees.\n */\n\n#ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP\n#define PB_DS_TREE_NODE_METADATA_DISPATCH_HPP\n\n#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /**\n * @addtogroup traits Traits\n * @{\n */\n\n /// Tree metadata helper.\n template<typename Node_Update, bool _BTp>\n struct tree_metadata_helper;\n\n /// Specialization, false.\n template<typename Node_Update>\n struct tree_metadata_helper<Node_Update, false>\n {\n\ttypedef typename Node_Update::metadata_type \ttype;\n };\n\n /// Specialization, true.\n template<typename Node_Update>\n struct tree_metadata_helper<Node_Update, true>\n {\n\ttypedef null_type \t\t\t\ttype;\n };\n\n /// Tree node metadata dispatch.\n template<typename Key,\n\t typename Data,\n\t typename Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t typename Const_Iterator,\n\t\t typename Cmp_Fn_,\n\t\t typename _Alloc_>\n\t class Node_Update,\n\t typename _Alloc>\n struct tree_node_metadata_dispatch\n {\n private:\n typedef dumnode_const_iterator<Key, Data, _Alloc>\t\t__it_type;\n typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc>\t__node_u;\n typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u;\n\n enum\n\t{\n\t null_update = is_same<__node_u, __nnode_u>::value\n\t};\n\n public:\n typedef typename tree_metadata_helper<__node_u, null_update>::type type;\n };\n ///@}\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP\n","include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file tree_policy/order_statistics_imp.hpp\n * Contains forward declarations for order_statistics_key\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nfind_by_order(size_type order)\n{\n node_iterator it = node_begin();\n node_iterator end_it = node_end();\n\n while (it != end_it)\n {\n node_iterator l_it = it.get_l_child();\n const size_type o = (l_it == end_it)? 0 : l_it.get_metadata();\n\n if (order == o)\n\treturn *it;\n else if (order < o)\n\tit = l_it;\n else\n {\n\t order -= o + 1;\n\t it = it.get_r_child();\n }\n }\n\n return base_type::end_iterator();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nfind_by_order(size_type order) const\n{ return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\norder_of_key(key_const_reference r_key) const\n{\n node_const_iterator it = node_begin();\n node_const_iterator end_it = node_end();\n\n const cmp_fn& r_cmp_fn = const_cast<PB_DS_CLASS_C_DEC*>(this)->get_cmp_fn();\n size_type ord = 0;\n while (it != end_it)\n {\n node_const_iterator l_it = it.get_l_child();\n\n if (r_cmp_fn(r_key, this->extract_key(*(*it))))\n\tit = l_it;\n else if (r_cmp_fn(this->extract_key(*(*it)), r_key))\n {\n\t ord += (l_it == end_it)? 1 : 1 + l_it.get_metadata();\n\t it = it.get_r_child();\n }\n else\n {\n\t ord += (l_it == end_it)? 0 : l_it.get_metadata();\n\t it = end_it;\n }\n }\n return ord;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\noperator()(node_iterator node_it, node_const_iterator end_nd_it) const\n{\n node_iterator l_it = node_it.get_l_child();\n const size_type l_rank = (l_it == end_nd_it) ? 0 : l_it.get_metadata();\n\n node_iterator r_it = node_it.get_r_child();\n const size_type r_rank = (r_it == end_nd_it) ? 0 : r_it.get_metadata();\n\n const_cast<metadata_reference>(node_it.get_metadata())= 1 + l_rank + r_rank;\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~tree_order_statistics_node_update()\n{ }\n#endif\n","include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file tree_policy/sample_tree_node_update.hpp\n * Contains a samle node update functor.\n */\n\n#ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP\n#define PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample node updator.\n template<typename Const_Node_Iter, typename Node_Iter, typename Cmp_Fn,\n\t typename _Alloc>\n class sample_tree_node_update\n {\n typedef std::size_t metadata_type;\n\n /// Default constructor.\n sample_tree_node_update();\n\n /// Updates the rank of a node through a node_iterator node_it;\n /// end_nd_it is the end node iterator.\n inline void\n operator()(node_iterator node_it, node_const_iterator end_nd_it) const;\n };\n}\n#endif // #ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP\n","include/ext/pb_ds/detail/tree_trace_base.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file detail/tree_trace_base.hpp\n * Contains tree-related policies.\n */\n\n#ifndef PB_DS_TREE_TRACE_BASE_HPP\n#define PB_DS_TREE_TRACE_BASE_HPP\n\n#ifdef PB_DS_TREE_TRACE\n\n#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>\n#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n#ifdef PB_DS_TREE_TRACE\n\n#define PB_DS_CLASS_T_DEC\t\t\t\t\t\t\\\n template<typename Node_CItr, typename Node_Itr,\t\\\n\t typename Cmp_Fn, bool Node_Based, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n tree_trace_base<Node_CItr, Node_Itr, Cmp_Fn, \\\n\t\t Node_Based, _Alloc>\n\n#define PB_DS_TRACE_BASE \\\n branch_policy<Node_CItr, Node_Itr, _Alloc>\n\n /// Tracing base class.\n template<typename Node_CItr, typename Node_Itr,\n\t typename Cmp_Fn, bool Node_Based, typename _Alloc>\n class tree_trace_base : private PB_DS_TRACE_BASE\n {\n public:\n void\n trace() const;\n\n private:\n typedef PB_DS_TRACE_BASE \t\t\tbase_type;\n typedef Node_CItr \t\tnode_const_iterator;\n typedef typename _Alloc::size_type \tsize_type;\n\n void\n trace_node(node_const_iterator, size_type) const;\n\n _GLIBCXX_NODISCARD virtual bool\n empty() const = 0;\n\n virtual node_const_iterator\n node_begin() const = 0;\n\n virtual node_const_iterator\n node_end() const = 0;\n\n static void\n print_node_pointer(Node_CItr, integral_constant<int,true>);\n\n static void\n print_node_pointer(Node_CItr, integral_constant<int,false>);\n\n template<typename Metadata_>\n static void\n trace_it_metadata(Node_CItr, type_to_type<Metadata_>);\n\n static void\n trace_it_metadata(Node_CItr, type_to_type<null_type>);\n };\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n trace() const\n {\n if (empty())\n\treturn;\n trace_node(node_begin(), 0);\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n trace_node(node_const_iterator nd_it, size_type level) const\n {\n if (nd_it.get_r_child() != node_end())\n\ttrace_node(nd_it.get_r_child(), level + 1);\n\n for (size_type i = 0; i < level; ++i)\n\tstd::cerr << ' ';\n\n print_node_pointer(nd_it, integral_constant<int,Node_Based>());\n std::cerr << base_type::extract_key(*(*nd_it));\n\n typedef type_to_type<typename node_const_iterator::metadata_type>\n\tm_type_ind_t;\n\n trace_it_metadata(nd_it, m_type_ind_t());\n\n std::cerr << std::endl;\n\n if (nd_it.get_l_child() != node_end())\n\ttrace_node(nd_it.get_l_child(), level + 1);\n }\n\n PB_DS_CLASS_T_DEC\n template<typename Metadata_>\n void\n PB_DS_CLASS_C_DEC::\n trace_it_metadata(Node_CItr nd_it, type_to_type<Metadata_>)\n {\n const unsigned long ul = static_cast<unsigned long>(nd_it.get_metadata());\n std::cerr << \" (\" << ul << \") \";\n }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n trace_it_metadata(Node_CItr, type_to_type<null_type>)\n { }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n print_node_pointer(Node_CItr nd_it, integral_constant<int,true>)\n { std::cerr << nd_it.m_p_nd << \" \"; }\n\n PB_DS_CLASS_T_DEC\n void\n PB_DS_CLASS_C_DEC::\n print_node_pointer(Node_CItr nd_it, integral_constant<int,false>)\n { std::cerr << *nd_it << \" \"; }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_TRACE_BASE\n#endif // #ifdef PB_DS_TREE_TRACE\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifdef PB_DS_TREE_TRACE\n\n#endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP\n","include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy/node_metadata_selector.hpp\n * Contains an implementation class for tries.\n */\n\n#ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP\n#define PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP\n\n#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /**\n * @addtogroup traits Traits\n * @{\n */\n\n /// Trie metadata helper.\n template<typename Node_Update, bool _BTp>\n struct trie_metadata_helper;\n\n /// Specialization, false.\n template<typename Node_Update>\n struct trie_metadata_helper<Node_Update, false>\n {\n\ttypedef typename Node_Update::metadata_type \ttype;\n };\n\n /// Specialization, true.\n template<typename Node_Update>\n struct trie_metadata_helper<Node_Update, true>\n {\n\ttypedef null_type \t\t\t\ttype;\n };\n\n /// Trie node metadata dispatch.\n template<typename Key,\n\t typename Data,\n\t typename Cmp_Fn,\n\t template<typename Node_CItr,\n\t\t typename Const_Iterator,\n\t\t typename Cmp_Fn_,\n\t\t typename _Alloc_>\n\t class Node_Update,\n\t typename _Alloc>\n struct trie_node_metadata_dispatch\n {\n private:\n typedef dumnode_const_iterator<Key, Data, _Alloc>\t\t__it_type;\n typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc>\t__node_u;\n typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u;\n\n enum\n\t{\n\t null_update = is_same<__node_u, __nnode_u>::value\n\t};\n\n public:\n typedef typename trie_metadata_helper<__node_u, null_update>::type type;\n };\n ///@}\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP\n","include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy/order_statistics_imp.hpp\n * Contains forward declarations for order_statistics_key\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nfind_by_order(size_type order)\n{\n if (empty())\n return end();\n\n ++order;\n node_iterator nd_it = node_begin();\n\n while (true)\n {\n if (order > nd_it.get_metadata())\n\treturn ++base_type::rightmost_it(nd_it);\n\n const size_type num_children = nd_it.num_children();\n if (num_children == 0)\n\treturn *nd_it;\n\n for (size_type i = 0; i < num_children; ++i)\n\t{\n\t node_iterator child_nd_it = nd_it.get_child(i);\n\t if (order <= child_nd_it.get_metadata())\n\t {\n\t i = num_children;\n\t nd_it = child_nd_it;\n\t }\n\t else\n\t order -= child_nd_it.get_metadata();\n\t}\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nfind_by_order(size_type order) const\n{ return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\norder_of_key(key_const_reference r_key) const\n{\n const _ATraits& r_traits =\n const_cast<PB_DS_CLASS_C_DEC* >(this)->get_access_traits();\n\n return order_of_prefix(r_traits.begin(r_key), r_traits.end(r_key));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\norder_of_prefix(typename access_traits::const_iterator b,\n\t\ttypename access_traits::const_iterator e) const\n{\n if (empty())\n return 0;\n\n const _ATraits& r_traits =\n const_cast<PB_DS_CLASS_C_DEC*>(this)->get_access_traits();\n\n node_const_iterator nd_it = node_begin();\n node_const_iterator end_nd_it = node_end();\n size_type ord = 0;\n\n while (true)\n {\n const size_type num_children = nd_it.num_children();\n if (num_children == 0)\n\t{\n\t key_const_reference r_key = base_type::extract_key(*(*nd_it));\n\t typename access_traits::const_iterator key_b =\n\t r_traits.begin(r_key);\n\n\t typename access_traits::const_iterator key_e =\n\t r_traits.end(r_key);\n\n\t return (base_type::less(key_b, key_e, b, e, r_traits)) ?\n\t\t ord + 1 : ord;\n\t}\n\n node_const_iterator next_nd_it = end_nd_it;\n size_type i = num_children - 1;\n\n do\n\t{\n\t node_const_iterator child_nd_it = nd_it.get_child(i);\n\n\t if (next_nd_it != end_nd_it)\n\t ord += child_nd_it.get_metadata();\n\t else if (!base_type::less(b, e,\n\t\t\t\t child_nd_it.valid_prefix().first,\n\t\t\t\t child_nd_it.valid_prefix().second,\n\t\t\t\t r_traits))\n\t next_nd_it = child_nd_it;\n\t}\n while (i-- > 0);\n\n if (next_nd_it == end_nd_it)\n\treturn ord;\n\n nd_it = next_nd_it;\n }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\noperator()(node_iterator nd_it, node_const_iterator /*end_nd_it*/) const\n{\n const size_type num_children = nd_it.num_children();\n size_type children_rank = 0;\n for (size_type i = 0; i < num_children; ++i)\n children_rank += nd_it.get_child(i).get_metadata();\n\n const size_type res = (num_children == 0) ? 1 : children_rank;\n const_cast<size_type&>(nd_it.get_metadata()) = res;\n}\n#endif\n","include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy/prefix_search_node_update_imp.hpp\n * Contains an implementation of prefix_search_node_update.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n typename PB_DS_CLASS_C_DEC::const_iterator,\n typename PB_DS_CLASS_C_DEC::const_iterator>\nPB_DS_CLASS_C_DEC::\nprefix_range(key_const_reference r_key) const\n{\n const access_traits& r_traits = get_access_traits();\n return (prefix_range(r_traits.begin(r_key), r_traits.end(r_key)));\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n typename PB_DS_CLASS_C_DEC::iterator,\n typename PB_DS_CLASS_C_DEC::iterator>\nPB_DS_CLASS_C_DEC::\nprefix_range(key_const_reference r_key)\n{\n return (prefix_range(get_access_traits().begin(r_key),\n\t\t get_access_traits().end(r_key)));\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n typename PB_DS_CLASS_C_DEC::const_iterator,\n typename PB_DS_CLASS_C_DEC::const_iterator>\nPB_DS_CLASS_C_DEC::\nprefix_range(typename access_traits::const_iterator b,\n\t typename access_traits::const_iterator e) const\n{\n const std::pair<iterator, iterator> non_const_ret =\n const_cast<PB_DS_CLASS_C_DEC* >(this)->prefix_range(b, e);\n\n return (std::make_pair(const_iterator(non_const_ret.first),\n\t\t\t const_iterator(non_const_ret.second)));\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n typename PB_DS_CLASS_C_DEC::iterator,\n typename PB_DS_CLASS_C_DEC::iterator>\nPB_DS_CLASS_C_DEC::\nprefix_range(typename access_traits::const_iterator b,\n\t typename access_traits::const_iterator e)\n{\n Node_Itr nd_it = node_begin();\n Node_Itr end_nd_it = node_end();\n\n const access_traits& r_traits = get_access_traits();\n const size_type given_range_length = std::distance(b, e);\n\n while (true)\n {\n if (nd_it == end_nd_it)\n\treturn (std::make_pair(end(), end()));\n\n const size_type common_range_length =\n\tbase_type::common_prefix_len(nd_it, b, e, r_traits);\n\n if (common_range_length >= given_range_length)\n\t{\n\t iterator ret_b = this->leftmost_it(nd_it);\n\t iterator ret_e = this->rightmost_it(nd_it);\n\t return (std::make_pair(ret_b, ++ret_e));\n\t}\n nd_it = next_child(nd_it, b, e, end_nd_it, r_traits);\n }\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnext_child(node_iterator nd_it, typename access_traits::const_iterator b,\n\t typename access_traits::const_iterator e, node_iterator end_nd_it,\n\t const access_traits& r_traits)\n{\n const size_type num_children = nd_it.num_children();\n node_iterator ret = end_nd_it;\n size_type max_length = 0;\n for (size_type i = 0; i < num_children; ++i)\n {\n node_iterator pot = nd_it.get_child(i);\n const size_type common_range_length =\n\tbase_type::common_prefix_len(pot, b, e, r_traits);\n\n if (common_range_length > max_length)\n\t{\n\t ret = pot;\n\t max_length = common_range_length;\n\t}\n }\n return (ret);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\noperator()(node_iterator /*nd_it*/, node_const_iterator /*end_nd_it*/) const\n{ }\n#endif\n","include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy/sample_trie_access_traits.hpp\n * Contains a sample probe policy.\n */\n\n#ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP\n#define PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample trie element access traits.\n struct sample_trie_access_traits\n {\n typedef std::size_t \t\t \t\tsize_type;\n typedef std::string \t\t\t \tkey_type;\n\n typedef typename rebind_traits<_Alloc, key_type>::const_reference\n key_const_reference;\n typedef std::string::const_iterator \t\tconst_iterator;\n\n /// Element type.\n typedef char \t\t\t\t \te_type;\n\n enum\n {\n\tmax_size = 4\n };\n\n /// Returns a const_iterator to the first element of r_key.\n inline static const_iterator\n begin(key_const_reference);\n\n /// Returns a const_iterator to the after-last element of r_key.\n inline static const_iterator\n end(key_const_reference);\n\n /// Maps an element to a position.\n inline static size_type\n e_pos(e_type);\n };\n}\n#endif // #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP\n","include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy/sample_trie_node_update.hpp\n * Contains a samle node update functor.\n */\n\n#ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP\n#define PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP\n\nnamespace __gnu_pbds\n{\n /// A sample node updator.\n template<typename Node_CItr, typename Node_Itr,\n\t typename _ATraits, typename _Alloc>\n class sample_trie_node_update\n {\n public:\n typedef std::size_t \t\tmetadata_type;\n\n protected:\n /// Default constructor.\n sample_trie_node_update();\n\n /// Updates the rank of a node through a node_iterator node_it;\n /// end_nd_it is the end node iterator.\n inline void\n operator()(node_iterator, node_const_iterator) const;\n };\n}\n#endif // #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP\n","include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy/trie_policy_base.hpp\n * Contains an implementation of trie_policy_base.\n */\n\n#ifndef PB_DS_TRIE_POLICY_BASE_HPP\n#define PB_DS_TRIE_POLICY_BASE_HPP\n\n#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /// Base class for trie policies.\n template<typename Node_CItr, typename Node_Itr,\n\t typename _ATraits, typename _Alloc>\n class trie_policy_base\n : public branch_policy<Node_CItr, Node_Itr, _Alloc>\n {\n typedef branch_policy<Node_CItr, Node_Itr, _Alloc> base_type;\n\n public:\n typedef _ATraits \t\t\t\taccess_traits;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename allocator_type::size_type \tsize_type;\n typedef null_type \t\t\t\tmetadata_type;\n typedef Node_CItr \t\t\t\tnode_const_iterator;\n typedef Node_Itr \t\t\t\t\tnode_iterator;\n typedef typename node_const_iterator::value_type \tconst_iterator;\n typedef typename node_iterator::value_type \titerator;\n typedef typename base_type::key_type \t\tkey_type;\n typedef typename base_type::key_const_reference \tkey_const_reference;\n\n protected:\n virtual const_iterator\n end() const = 0;\n\n virtual iterator\n end() = 0;\n\n virtual node_const_iterator\n node_begin() const = 0;\n\n virtual node_iterator\n node_begin() = 0;\n\n virtual node_const_iterator\n node_end() const = 0;\n\n virtual node_iterator\n node_end() = 0;\n\n virtual const access_traits&\n get_access_traits() const = 0;\n\n private:\n typedef typename access_traits::const_iterator \te_const_iterator;\n typedef std::pair<e_const_iterator, e_const_iterator> prefix_range_t;\n\n protected:\n static size_type\n common_prefix_len(node_iterator, e_const_iterator,\n\t\t\te_const_iterator, const access_traits&);\n\n static iterator\n leftmost_it(node_iterator);\n\n static iterator\n rightmost_it(node_iterator);\n\n static bool\n less(e_const_iterator, e_const_iterator, e_const_iterator,\n\t e_const_iterator, const access_traits&);\n };\n\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Node_CItr, typename Node_Itr, \\\n\t typename _ATraits, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n trie_policy_base<Node_CItr, Node_Itr, _ATraits, _Alloc>\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::size_type\n PB_DS_CLASS_C_DEC::\n common_prefix_len(node_iterator nd_it, e_const_iterator b_r,\n\t\t e_const_iterator e_r, const access_traits& r_traits)\n {\n prefix_range_t pref_range = nd_it.valid_prefix();\n\n e_const_iterator b_l = pref_range.first;\n e_const_iterator e_l = pref_range.second;\n\n const size_type range_length_l = std::distance(b_l, e_l);\n const size_type range_length_r = std::distance(b_r, e_r);\n\n if (range_length_r < range_length_l)\n\t{\n\t std::swap(b_l, b_r);\n\t std::swap(e_l, e_r);\n\t}\n\n size_type ret = 0;\n while (b_l != e_l)\n\t{\n\t if (r_traits.e_pos(*b_l) != r_traits.e_pos(*b_r))\n\t return ret;\n\n\t ++ret;\n\t ++b_l;\n\t ++b_r;\n\t}\n\n return ret;\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::iterator\n PB_DS_CLASS_C_DEC::\n leftmost_it(node_iterator nd_it)\n {\n if (nd_it.num_children() == 0)\n\treturn *nd_it;\n\n return leftmost_it(nd_it.get_child(0));\n }\n\n PB_DS_CLASS_T_DEC\n typename PB_DS_CLASS_C_DEC::iterator\n PB_DS_CLASS_C_DEC::\n rightmost_it(node_iterator nd_it)\n {\n const size_type num_children = nd_it.num_children();\n\n if (num_children == 0)\n\treturn *nd_it;\n\n return rightmost_it(nd_it.get_child(num_children - 1));\n }\n\n PB_DS_CLASS_T_DEC\n bool\n PB_DS_CLASS_C_DEC::\n less(e_const_iterator b_l, e_const_iterator e_l,\n\t e_const_iterator b_r, e_const_iterator e_r,\n\t const access_traits& r_traits)\n {\n while (b_l != e_l)\n\t{\n\t if (b_r == e_r)\n\t return false;\n\n\t size_type l_pos = r_traits.e_pos(*b_l);\n\t size_type r_pos = r_traits.e_pos(*b_r);\n\t if (l_pos != r_pos)\n\t return (l_pos < r_pos);\n\n\t ++b_l;\n\t ++b_r;\n\t}\n return b_r != e_r;\n }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif // #ifndef PB_DS_TRIE_POLICY_BASE_HPP\n","include/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy/trie_string_access_traits_imp.hpp\n * Contains a policy for extracting character positions from\n * a string for a vector-based PATRICIA tree\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n\nPB_DS_CLASS_T_DEC\ndetail::integral_constant<int, Reverse> PB_DS_CLASS_C_DEC::s_rev_ind;\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\ne_pos(e_type e)\n{\n return (static_cast<size_type>(e - min_e_val));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin(key_const_reference r_key)\n{\n return (begin_imp(r_key, s_rev_ind));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend(key_const_reference r_key)\n{\n return (end_imp(r_key, s_rev_ind));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin_imp(key_const_reference r_key, detail::false_type)\n{\n return (r_key.begin());\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin_imp(key_const_reference r_key, detail::true_type)\n{\n return (r_key.rbegin());\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend_imp(key_const_reference r_key, detail::false_type)\n{\n return (r_key.end());\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend_imp(key_const_reference r_key, detail::true_type)\n{\n return (r_key.rend());\n}\n#endif\n","include/ext/pb_ds/detail/type_utils.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file detail/type_utils.hpp\n * Contains utilities for handling types. All of these classes are based on\n * Modern C++ by Andrei Alxandrescu.\n */\n\n#ifndef PB_DS_TYPE_UTILS_HPP\n#define PB_DS_TYPE_UTILS_HPP\n\n#include <cstddef>\n#include <utility>\n#include <tr1/type_traits>\n#include <ext/type_traits.h>\n#include <ext/numeric_traits.h>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n using std::tr1::is_same;\n using std::tr1::is_const;\n using std::tr1::is_pointer;\n using std::tr1::is_reference;\n using std::tr1::is_fundamental;\n using std::tr1::is_member_object_pointer;\n using std::tr1::is_member_pointer;\n using std::tr1::is_base_of;\n using std::tr1::remove_const;\n using std::tr1::remove_reference;\n\n // Need integral_const<bool, true> <-> integral_const<int, 1>, so\n // because of this use the following typedefs instead of importing\n // std::tr1's.\n using std::tr1::integral_constant;\n typedef std::tr1::integral_constant<int, 1> true_type;\n typedef std::tr1::integral_constant<int, 0> false_type;\n\n using __gnu_cxx::__conditional_type;\n using __gnu_cxx::__numeric_traits;\n\n template<typename T>\n struct is_const_pointer\n {\n enum\n\t{\n\t value = is_const<T>::value && is_pointer<T>::value\n\t};\n };\n\n template<typename T>\n struct is_const_reference\n {\n enum\n\t{\n\t value = is_const<T>::value && is_reference<T>::value\n\t};\n };\n\n template<typename T>\n struct is_simple\n {\n enum\n\t{\n\t value = is_fundamental<typename remove_const<T>::type>::value \n\t || is_pointer<typename remove_const<T>::type>::value \n\t || is_member_pointer<T>::value \n\t};\n };\n\n template<typename T>\n class is_pair\n {\n private:\n template<typename U>\n struct is_pair_imp\n {\n\tenum\n\t {\n\t value = 0\n\t };\n };\n\n template<typename U, typename V>\n struct is_pair_imp<std::pair<U,V> >\n {\n\tenum\n\t {\n\t value = 1\n\t };\n };\n\n public:\n enum\n\t{\n\t value = is_pair_imp<T>::value\n\t};\n };\n\n // Use C++11's static_assert if possible.\n#if __cplusplus >= 201103L\n#define PB_DS_STATIC_ASSERT(UNIQUE, E) static_assert(E, #UNIQUE)\n#else\n template<bool>\n struct __static_assert;\n\n template<>\n struct __static_assert<true>\n { };\n\n template<int>\n struct __static_assert_dumclass\n {\n enum\n\t{\n\t v = 1\n\t};\n };\n\n#define PB_DS_STATIC_ASSERT(UNIQUE, E) \\\n typedef __gnu_pbds::detail::__static_assert_dumclass<sizeof(__gnu_pbds::detail::__static_assert<bool(E)>)> \\\n UNIQUE##__static_assert_type __attribute__((__unused__))\n\n#endif\n\n template<typename Type>\n struct type_to_type\n {\n typedef Type type;\n };\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/detail/types_traits.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file detail/types_traits.hpp\n * Contains a traits class of types used by containers.\n */\n\n#ifndef PB_DS_TYPES_TRAITS_HPP\n#define PB_DS_TYPES_TRAITS_HPP\n\n#include <algorithm>\n#include <utility>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <memory>\n\nnamespace __gnu_pbds\n{\n namespace detail\n {\n /**\n * @addtogroup traits Traits\n * @{\n */\n\n /// Primary template.\n template<typename Key, typename Mapped>\n struct no_throw_copies\n {\n\tstatic const bool __simple = is_simple<Key>::value\n\t\t\t \t && is_simple<Mapped>::value;\n\ttypedef integral_constant<int, __simple> \t \tindicator;\n };\n\n /// Specialization.\n template<typename Key>\n struct no_throw_copies<Key, null_type>\n {\n\ttypedef integral_constant<int, is_simple<Key>::value> \tindicator;\n };\n\n\n /// Stored value.\n template<typename _Tv>\n struct stored_value\n {\n\ttypedef _Tv \tvalue_type;\n\tvalue_type \tm_value;\n };\n\n /// Stored hash.\n template<typename _Th>\n struct stored_hash\n {\n\ttypedef _Th \thash_type;\n\thash_type \tm_hash;\n };\n\n /// Primary template for representation of stored data.\n /// Two types of data can be stored: value and hash.\n template<typename _Tv, typename _Th, bool Store_Hash>\n struct stored_data\n : public stored_value<_Tv>, public stored_hash<_Th>\n { };\n\n /// Specialization for representation of stored data of just value type.\n template<typename _Tv, typename _Th>\n struct stored_data<_Tv, _Th, false>\n : public stored_value<_Tv>\n { };\n\n /// Choose value_type to be a key/value pair or just a key.\n template<typename Key, typename Mapped>\n struct select_value_type\n {\n\ttypedef std::pair<const Key, Mapped> type;\n };\n\n /// Specialization for sets where the key is the value_type.\n template<typename Key>\n struct select_value_type<Key, null_type>\n {\n\ttypedef Key type;\n };\n\n /// Base class for conditionally defining a static data member.\n template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>\n struct maybe_null_type\n { };\n\n /// Specialization that defines a static data member of type null_type.\n template<typename Key,typename _Alloc, bool Store_Hash>\n struct maybe_null_type<Key, null_type, _Alloc, Store_Hash>\n {\n\tstatic null_type s_null_type;\n };\n\n template<typename Key,typename _Alloc, bool Store_Hash>\n null_type\n maybe_null_type<Key, null_type, _Alloc, Store_Hash>::s_null_type;\n\n /// Consistent API for accessing allocator-related types.\n template<typename _Alloc, typename T>\n struct rebind_traits\n#if __cplusplus >= 201103L\n : std::allocator_traits<_Alloc>::template rebind_traits<T>\n {\n\tusing reference = T&;\n\tusing const_reference = const T&;\n };\n#else\n : _Alloc::template rebind<T>::other\n {\n\ttypedef typename _Alloc::template rebind<T>::other allocator_type;\n };\n#endif\n\n\n /// Traits for abstract types.\n template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>\n struct types_traits\n : public maybe_null_type<Key, Mapped, _Alloc, Store_Hash>\n {\n public:\n\ttypedef typename _Alloc::size_type\t\t\tsize_type;\n\ttypedef typename select_value_type<Key, Mapped>::type\tvalue_type;\n\ttypedef Key\t\t\t\t\t\tkey_type;\n\ttypedef Mapped\t\t\t\t\t\tmapped_type;\n\n private:\n\ttypedef rebind_traits<_Alloc, value_type>\t__rebind_va;\n\ttypedef rebind_traits<_Alloc, key_type>\t\t__rebind_ka;\n\ttypedef rebind_traits<_Alloc, mapped_type>\t__rebind_ma;\n\n\ttypedef no_throw_copies<Key, Mapped>\t\t__nothrowcopy;\n\n public:\n\ttypedef typename __rebind_ma::pointer \t\tmapped_pointer;\n\ttypedef typename __rebind_ma::const_pointer \tmapped_const_pointer;\n\ttypedef typename __rebind_ma::reference\t \tmapped_reference;\n\ttypedef typename __rebind_ma::const_reference \tmapped_const_reference;\n\n\ttypedef typename __rebind_va::pointer \t\tpointer;\n\ttypedef typename __rebind_va::const_pointer \tconst_pointer;\n\ttypedef typename __rebind_va::reference \treference;\n\ttypedef typename __rebind_va::const_reference \tconst_reference;\n\n\ttypedef stored_data<value_type, size_type, Store_Hash> stored_data_type;\n\n\ttypedef typename __rebind_ka::pointer \t\tkey_pointer;\n\ttypedef typename __rebind_ka::const_pointer \tkey_const_pointer;\n\ttypedef typename __rebind_ka::reference \tkey_reference;\n\ttypedef typename __rebind_ka::const_reference \tkey_const_reference;\n\ttypedef std::pair<size_type, size_type> \tcomp_hash;\n\ttypedef integral_constant<int, Store_Hash> \tstore_extra;\n\ttypedef typename __nothrowcopy::indicator \tno_throw_indicator;\n\n\tstore_extra\t\t\t \tm_store_extra_indicator;\n\tno_throw_indicator \t\t \tm_no_throw_copies_indicator;\n };\n ///@}\n } // namespace detail\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file unordered_iterator/const_iterator.hpp\n * Contains an iterator class used for const ranging over the elements of the\n * table.\n *\n * This file is intended to be included inside a class definition, with\n * PB_DS_CLASS_C_DEC defined to the name of the enclosing class.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n/// Const range-type iterator.\nclass const_iterator_\n: public point_const_iterator_\n{\npublic:\n /// Category.\n typedef std::forward_iterator_tag iterator_category;\n\n /// Difference type.\n typedef typename _Alloc::difference_type difference_type;\n\n /// Iterator's value type.\n typedef value_type_ value_type;\n\n /// Iterator's pointer type.\n typedef pointer_ pointer;\n\n /// Iterator's const pointer type.\n typedef const_pointer_ const_pointer;\n\n /// Iterator's reference type.\n typedef reference_ reference;\n\n /// Iterator's const reference type.\n typedef const_reference_ const_reference;\n\n /// Default constructor.\n const_iterator_() : m_p_tbl(0)\n { }\n\n /// Increments.\n const_iterator_&\n operator++()\n {\n m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);\n return *this;\n }\n\n /// Increments.\n const_iterator_\n operator++(int)\n {\n const_iterator_ ret =* this;\n m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);\n return ret;\n }\n\nprotected:\n typedef point_const_iterator_ base_type;\n\n /**\n * Constructor used by the table to initiate the generalized\n * pointer and position (e.g., this is called from within a find()\n * of a table.\n * */\n const_iterator_(const_pointer_ p_value, PB_DS_GEN_POS pos,\n\t\t const PB_DS_CLASS_C_DEC* p_tbl)\n : point_const_iterator_(p_value), m_p_tbl(p_tbl), m_pos(pos)\n { }\n\n /**\n * Pointer to the table object which created the iterator (used for\n * incrementing its position.\n * */\n const PB_DS_CLASS_C_DEC* m_p_tbl;\n\n PB_DS_GEN_POS m_pos;\n\n friend class PB_DS_CLASS_C_DEC;\n};\n#endif\n","include/ext/pb_ds/detail/unordered_iterator/iterator.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterator.hpp\n * Contains an iterator_ class used for ranging over the elements of the\n * table.\n *\n * This file is intended to be included inside a class definition, with\n * PB_DS_CLASS_C_DEC defined to the name of the enclosing class.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n/// Range-type iterator.\nclass iterator_\n: public const_iterator_\n{\npublic:\n /// Category.\n typedef std::forward_iterator_tag iterator_category;\n\n /// Difference type.\n typedef typename _Alloc::difference_type difference_type;\n\n /// Iterator's value type.\n typedef value_type_ value_type;\n\n /// Iterator's pointer type.\n typedef pointer_ pointer;\n\n /// Iterator's const pointer type.\n typedef const_pointer_ const_pointer;\n\n /// Iterator's reference type.\n typedef reference_ reference;\n\n /// Iterator's const reference type.\n typedef const_reference_ const_reference;\n\n /// Default constructor.\n inline\n iterator_()\n : const_iterator_(0, PB_DS_GEN_POS(), 0) { }\n\n /// Conversion to a point-type iterator.\n inline\n operator point_iterator_()\n { return point_iterator_(const_cast<pointer>(const_iterator_::m_p_value)); }\n\n /// Conversion to a point-type iterator.\n inline\n operator const point_iterator_() const\n { return point_iterator_(const_cast<pointer>(const_iterator_::m_p_value)); }\n\n /// Access.\n pointer\n operator->() const\n {\n _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0);\n return (const_cast<pointer>(base_type::m_p_value));\n }\n\n /// Access.\n reference\n operator*() const\n {\n _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0);\n return (const_cast<reference>(*base_type::m_p_value));\n }\n\n /// Increments.\n iterator_&\n operator++()\n {\n base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);\n return *this;\n }\n\n /// Increments.\n iterator_\n operator++(int)\n {\n iterator_ ret =* this;\n base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);\n return ret;\n }\n\nprotected:\n typedef const_iterator_ base_type;\n\n /**\n * Constructor used by the table to initiate the generalized\n * pointer and position (e.g., this is called from within a find()\n * of a table.\n * */\n inline\n iterator_(pointer p_value, PB_DS_GEN_POS pos, PB_DS_CLASS_C_DEC* p_tbl)\n : const_iterator_(p_value, pos, p_tbl)\n { }\n\n friend class PB_DS_CLASS_C_DEC;\n};\n#endif\n","include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file unordered_iterator/point_const_iterator.hpp\n * Contains an iterator class returned by the tables' const find and insert\n * methods.\n *\n * * This file is intended to be included inside a class definition, with\n * PB_DS_CLASS_C_DEC defined to the name of the enclosing class.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\nclass point_iterator_;\n\n/// Const point-type iterator.\nclass point_const_iterator_\n{\npublic:\n /// Category.\n typedef trivial_iterator_tag iterator_category;\n\n /// Difference type.\n typedef trivial_iterator_difference_type difference_type;\n\n /// Iterator's value type.\n typedef value_type_ value_type;\n\n /// Iterator's pointer type.\n typedef pointer_ pointer;\n\n /// Iterator's const pointer type.\n typedef const_pointer_ const_pointer;\n\n /// Iterator's reference type.\n typedef reference_ reference;\n\n /// Iterator's const reference type.\n typedef const_reference_ const_reference;\n\n inline\n point_const_iterator_(const_pointer p_value) : m_p_value(p_value)\n { }\n\n /// Default constructor.\n inline\n point_const_iterator_() : m_p_value(0)\n { }\n\n /// Copy constructor.\n inline\n point_const_iterator_(const point_const_iterator_& other)\n : m_p_value(other.m_p_value)\n { }\n\n /// Copy constructor.\n inline\n point_const_iterator_(const point_iterator_& other)\n : m_p_value(other.m_p_value)\n { }\n\n /// Access.\n const_pointer\n operator->() const\n {\n _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);\n return m_p_value;\n }\n\n /// Access.\n const_reference\n operator*() const\n {\n _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);\n return *m_p_value;\n }\n\n /// Compares content to a different iterator object.\n bool\n operator==(const point_iterator_& other) const\n { return m_p_value == other.m_p_value; }\n\n /// Compares content to a different iterator object.\n bool\n operator==(const point_const_iterator_& other) const\n { return m_p_value == other.m_p_value; }\n\n /// Compares content (negatively) to a different iterator object.\n bool\n operator!=(const point_iterator_& other) const\n { return m_p_value != other.m_p_value; }\n\n /// Compares content (negatively) to a different iterator object.\n bool\n operator!=(const point_const_iterator_& other) const\n { return m_p_value != other.m_p_value; }\n\nprotected:\n const_pointer m_p_value;\n\n friend class point_iterator_;\n\n friend class PB_DS_CLASS_C_DEC;\n};\n#endif\n","include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file point_iterator.hpp\n * Contains an iterator class returned by the tables' find and insert\n * methods.\n *\n * This file is intended to be included inside a class definition, with\n * PB_DS_CLASS_C_DEC defined to the name of the enclosing class.\n */\n\n#ifdef PB_DS_CLASS_C_DEC\n/// Find type iterator.\nclass point_iterator_\n{\npublic:\n /// Category.\n typedef trivial_iterator_tag iterator_category;\n\n /// Difference type.\n typedef trivial_iterator_difference_type difference_type;\n\n /// Iterator's value type.\n typedef value_type_ value_type;\n\n /// Iterator's pointer type.\n typedef pointer_ pointer;\n\n /// Iterator's const pointer type.\n typedef const_pointer_ const_pointer;\n\n /// Iterator's reference type.\n typedef reference_ reference;\n\n /// Iterator's const reference type.\n typedef const_reference_ const_reference;\n\n /// Default constructor.\n inline\n point_iterator_()\n : m_p_value(0)\n { }\n\n /// Copy constructor.\n inline\n point_iterator_(const point_iterator_& other)\n : m_p_value(other.m_p_value)\n { }\n\n /// Access.\n pointer\n operator->() const\n {\n _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);\n return (m_p_value);\n }\n\n /// Access.\n reference\n operator*() const\n {\n _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);\n return (*m_p_value);\n }\n\n /// Compares content to a different iterator object.\n bool\n operator==(const point_iterator_& other) const\n { return m_p_value == other.m_p_value; }\n\n /// Compares content to a different iterator object.\n bool\n operator==(const point_const_iterator_& other) const\n { return m_p_value == other.m_p_value; }\n\n /// Compares content to a different iterator object.\n bool\n operator!=(const point_iterator_& other) const\n { return m_p_value != other.m_p_value; }\n\n /// Compares content (negatively) to a different iterator object.\n bool\n operator!=(const point_const_iterator_& other) const\n { return m_p_value != other.m_p_value; }\n\n inline\n point_iterator_(pointer p_value) : m_p_value(p_value)\n { }\n\nprotected:\n friend class point_const_iterator_;\n\n friend class PB_DS_CLASS_C_DEC;\n\nprotected:\n pointer m_p_value;\n};\n#endif\n","include/ext/pb_ds/exception.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file exception.hpp\n * Contains exception classes.\n */\n\n#ifndef PB_DS_EXCEPTION_HPP\n#define PB_DS_EXCEPTION_HPP\n\n#include <bits/c++config.h>\n#include <stdexcept>\n#include <cstdlib>\n\nnamespace __gnu_pbds\n{\n /**\n * @defgroup exceptions-pbds Exceptions\n * @ingroup pbds\n * @{\n */\n\n /// Base class for exceptions.\n struct container_error : public std::logic_error\n {\n container_error()\n : std::logic_error(__N(\"__gnu_pbds::container_error\")) { }\n };\n\n /// An entry cannot be inserted into a container object for logical\n /// reasons (not, e.g., if memory is unabvailable, in which case\n /// the allocator_type's exception will be thrown).\n struct insert_error : public container_error { };\n\n /// A join cannot be performed logical reasons (i.e., the ranges of\n /// the two container objects being joined overlaps.\n struct join_error : public container_error { };\n\n /// A container cannot be resized.\n struct resize_error : public container_error { };\n\n inline void\n __throw_container_error()\n { _GLIBCXX_THROW_OR_ABORT(container_error()); }\n\n inline void\n __throw_insert_error()\n { _GLIBCXX_THROW_OR_ABORT(insert_error()); }\n\n inline void\n __throw_join_error()\n { _GLIBCXX_THROW_OR_ABORT(join_error()); }\n\n inline void\n __throw_resize_error()\n { _GLIBCXX_THROW_OR_ABORT(resize_error()); }\n ///@}\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/hash_policy.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_policy.hpp\n * Contains hash-related policies.\n */\n\n#ifndef PB_DS_HASH_POLICY_HPP\n#define PB_DS_HASH_POLICY_HPP\n\n#include <bits/c++config.h>\n#include <algorithm>\n#include <vector>\n#include <cmath>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp>\n#include <ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp>\n#include <ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp>\n\nnamespace __gnu_pbds\n{\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC linear_probe_fn<Size_Type>\n\n /// A probe sequence policy using fixed increments.\n template<typename Size_Type = std::size_t>\n class linear_probe_fn\n {\n public:\n typedef Size_Type size_type;\n\n void\n swap(PB_DS_CLASS_C_DEC& other);\n\n protected:\n /// Returns the i-th offset from the hash value.\n inline size_type\n operator()(size_type i) const;\n };\n\n#include <ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC quadratic_probe_fn<Size_Type>\n\n /// A probe sequence policy using square increments.\n template<typename Size_Type = std::size_t>\n class quadratic_probe_fn\n {\n public:\n typedef Size_Type size_type;\n\n void\n swap(PB_DS_CLASS_C_DEC& other);\n\n protected:\n /// Returns the i-th offset from the hash value.\n inline size_type\n operator()(size_type i) const;\n };\n\n#include <ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC direct_mask_range_hashing<Size_Type>\n\n /// A mask range-hashing class (uses a bitmask).\n template<typename Size_Type = std::size_t>\n class direct_mask_range_hashing\n : public detail::mask_based_range_hashing<Size_Type>\n {\n private:\n typedef detail::mask_based_range_hashing<Size_Type> mask_based_base;\n\n public:\n typedef Size_Type size_type;\n\n void\n swap(PB_DS_CLASS_C_DEC& other);\n\n protected:\n void\n notify_resized(size_type size);\n\n /// Transforms the __hash value hash into a ranged-hash value\n /// (using a bit-mask).\n inline size_type\n operator()(size_type hash) const;\n };\n\n#include <ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC direct_mod_range_hashing<Size_Type>\n\n /// A mod range-hashing class (uses the modulo function).\n template<typename Size_Type = std::size_t>\n class direct_mod_range_hashing\n : public detail::mod_based_range_hashing<Size_Type>\n {\n public:\n typedef Size_Type size_type;\n\n void\n swap(PB_DS_CLASS_C_DEC& other);\n\n protected:\n void\n notify_resized(size_type size);\n\n /// Transforms the __hash value hash into a ranged-hash value\n /// (using a modulo operation).\n inline size_type\n operator()(size_type hash) const;\n\n private:\n typedef detail::mod_based_range_hashing<size_type> mod_based_base;\n };\n\n#include <ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type>\n#define PB_DS_CLASS_C_DEC hash_load_check_resize_trigger<External_Load_Access, Size_Type>\n#define PB_DS_SIZE_BASE_C_DEC detail::hash_load_check_resize_trigger_size_base<Size_Type, External_Load_Access>\n\n /// A resize trigger policy based on a load check. It keeps the\n /// load factor between some load factors load_min and load_max.\n template<bool External_Load_Access = false, typename Size_Type = std::size_t>\n class hash_load_check_resize_trigger : private PB_DS_SIZE_BASE_C_DEC\n {\n public:\n typedef Size_Type size_type;\n\n enum\n {\n\t/// Specifies whether the load factor can be accessed\n\t/// externally. The two options have different trade-offs in\n\t/// terms of flexibility, genericity, and encapsulation.\n\texternal_load_access = External_Load_Access\n };\n\n /// Default constructor, or constructor taking load_min and\n /// load_max load factors between which this policy will keep the\n /// actual load.\n hash_load_check_resize_trigger(float load_min = 0.125,\n\t\t\t\t float load_max = 0.5);\n\n void\n swap(hash_load_check_resize_trigger& other);\n\n virtual\n ~hash_load_check_resize_trigger();\n\n /// Returns a pair of the minimal and maximal loads, respectively.\n inline std::pair<float, float>\n get_loads() const;\n\n /// Sets the loads through a pair of the minimal and maximal\n /// loads, respectively.\n void\n set_loads(std::pair<float, float> load_pair);\n\n protected:\n inline void\n notify_insert_search_start();\n\n inline void\n notify_insert_search_collision();\n\n inline void\n notify_insert_search_end();\n\n inline void\n notify_find_search_start();\n\n inline void\n notify_find_search_collision();\n\n inline void\n notify_find_search_end();\n\n inline void\n notify_erase_search_start();\n\n inline void\n notify_erase_search_collision();\n\n inline void\n notify_erase_search_end();\n\n /// Notifies an element was inserted. The total number of entries\n /// in the table is num_entries.\n inline void\n notify_inserted(size_type num_entries);\n\n inline void\n notify_erased(size_type num_entries);\n\n /// Notifies the table was cleared.\n void\n notify_cleared();\n\n /// Notifies the table was resized as a result of this object's\n /// signifying that a resize is needed.\n void\n notify_resized(size_type new_size);\n\n void\n notify_externally_resized(size_type new_size);\n\n inline bool\n is_resize_needed() const;\n\n inline bool\n is_grow_needed(size_type size, size_type num_entries) const;\n\n private:\n virtual void\n do_resize(size_type new_size);\n\n typedef PB_DS_SIZE_BASE_C_DEC size_base;\n\n#ifdef _GLIBCXX_DEBUG\n void\n assert_valid(const char* file, int line) const;\n#endif\n\n float \tm_load_min;\n float \tm_load_max;\n size_type \tm_next_shrink_size;\n size_type \tm_next_grow_size;\n bool \tm_resize_needed;\n };\n\n#include <ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_SIZE_BASE_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type>\n#define PB_DS_CLASS_C_DEC cc_hash_max_collision_check_resize_trigger<External_Load_Access, Size_Type>\n\n /// A resize trigger policy based on collision checks. It keeps the\n /// simulated load factor lower than some given load factor.\n template<bool External_Load_Access = false, typename Size_Type = std::size_t>\n class cc_hash_max_collision_check_resize_trigger\n {\n public:\n typedef Size_Type \tsize_type;\n\n enum\n {\n\t/// Specifies whether the load factor can be accessed\n\t/// externally. The two options have different trade-offs in\n\t/// terms of flexibility, genericity, and encapsulation.\n\texternal_load_access = External_Load_Access\n };\n\n /// Default constructor, or constructor taking load, a __load\n /// factor which it will attempt to maintain.\n cc_hash_max_collision_check_resize_trigger(float load = 0.5);\n\n void\n swap(PB_DS_CLASS_C_DEC& other);\n\n /// Returns the current load.\n inline float\n get_load() const;\n\n /// Sets the load; does not resize the container.\n void\n set_load(float load);\n\n protected:\n /// Notifies an insert search started.\n inline void\n notify_insert_search_start();\n\n /// Notifies a search encountered a collision.\n inline void\n notify_insert_search_collision();\n\n /// Notifies a search ended.\n inline void\n notify_insert_search_end();\n\n /// Notifies a find search started.\n inline void\n notify_find_search_start();\n\n /// Notifies a search encountered a collision.\n inline void\n notify_find_search_collision();\n\n /// Notifies a search ended.\n inline void\n notify_find_search_end();\n\n /// Notifies an erase search started.\n inline void\n notify_erase_search_start();\n\n /// Notifies a search encountered a collision.\n inline void\n notify_erase_search_collision();\n\n /// Notifies a search ended.\n inline void\n notify_erase_search_end();\n\n /// Notifies an element was inserted.\n inline void\n notify_inserted(size_type num_entries);\n\n /// Notifies an element was erased.\n inline void\n notify_erased(size_type num_entries);\n\n /// Notifies the table was cleared.\n void\n notify_cleared();\n\n /// Notifies the table was resized as a result of this object's\n /// signifying that a resize is needed.\n void\n notify_resized(size_type new_size);\n\n /// Notifies the table was resized externally.\n void\n notify_externally_resized(size_type new_size);\n\n /// Queries whether a resize is needed.\n inline bool\n is_resize_needed() const;\n\n /// Queries whether a grow is needed. This method is called only\n /// if this object indicated is needed.\n inline bool\n is_grow_needed(size_type size, size_type num_entries) const;\n\n private:\n void\n calc_max_num_coll();\n\n inline void\n calc_resize_needed();\n\n float \tm_load;\n size_type \tm_size;\n size_type \tm_num_col;\n size_type \tm_max_col;\n bool \tm_resize_needed;\n };\n\n#include <ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC hash_exponential_size_policy<Size_Type>\n\n /// A size policy whose sequence of sizes form an exponential\n /// sequence (typically powers of 2.\n template<typename Size_Type = std::size_t>\n class hash_exponential_size_policy\n {\n public:\n typedef Size_Type size_type;\n\n /// Default constructor, or onstructor taking a start_size, or\n /// constructor taking a start size and grow_factor. The policy\n /// will use the sequence of sizes start_size, start_size*\n /// grow_factor, start_size* grow_factor^2, ...\n hash_exponential_size_policy(size_type start_size = 8,\n\t\t\t\t size_type grow_factor = 2);\n\n void\n swap(PB_DS_CLASS_C_DEC& other);\n\n protected:\n size_type\n get_nearest_larger_size(size_type size) const;\n\n size_type\n get_nearest_smaller_size(size_type size) const;\n\n private:\n size_type m_start_size;\n size_type m_grow_factor;\n };\n\n#include <ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC\n#define PB_DS_CLASS_C_DEC hash_prime_size_policy\n\n /// A size policy whose sequence of sizes form a nearly-exponential\n /// sequence of primes.\n class hash_prime_size_policy\n {\n public:\n /// Size type.\n typedef std::size_t size_type;\n\n /// Default constructor, or onstructor taking a start_size The\n /// policy will use the sequence of sizes approximately\n /// start_size, start_size* 2, start_size* 2^2, ...\n hash_prime_size_policy(size_type start_size = 8);\n\n inline void\n swap(PB_DS_CLASS_C_DEC& other);\n\n protected:\n size_type\n get_nearest_larger_size(size_type size) const;\n\n size_type\n get_nearest_smaller_size(size_type size) const;\n\n private:\n size_type m_start_size;\n };\n\n#include <ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Policy, typename Trigger_Policy, bool External_Size_Access, typename Size_Type>\n\n#define PB_DS_CLASS_C_DEC hash_standard_resize_policy<Size_Policy, Trigger_Policy, External_Size_Access, Size_Type>\n\n /// A resize policy which delegates operations to size and trigger policies.\n template<typename Size_Policy = hash_exponential_size_policy<>,\n\t typename Trigger_Policy = hash_load_check_resize_trigger<>,\n\t bool External_Size_Access = false,\n\t typename Size_Type = std::size_t>\n class hash_standard_resize_policy\n : public Size_Policy, public Trigger_Policy\n {\n public:\n typedef Size_Type \t\tsize_type;\n typedef Trigger_Policy \ttrigger_policy;\n typedef Size_Policy \tsize_policy;\n\n enum\n {\n\texternal_size_access = External_Size_Access\n };\n\n /// Default constructor.\n hash_standard_resize_policy();\n\n /// constructor taking some policies r_size_policy will be copied\n /// by the Size_Policy object of this object.\n hash_standard_resize_policy(const Size_Policy& r_size_policy);\n\n /// constructor taking some policies. r_size_policy will be\n /// copied by the Size_Policy object of this\n /// object. r_trigger_policy will be copied by the Trigger_Policy\n /// object of this object.\n hash_standard_resize_policy(const Size_Policy& r_size_policy,\n\t\t\t\tconst Trigger_Policy& r_trigger_policy);\n\n virtual\n ~hash_standard_resize_policy();\n\n inline void\n swap(PB_DS_CLASS_C_DEC& other);\n\n /// Access to the Size_Policy object used.\n Size_Policy&\n get_size_policy();\n\n /// Const access to the Size_Policy object used.\n const Size_Policy&\n get_size_policy() const;\n\n /// Access to the Trigger_Policy object used.\n Trigger_Policy&\n get_trigger_policy();\n\n /// Access to the Trigger_Policy object used.\n const Trigger_Policy&\n get_trigger_policy() const;\n\n /// Returns the actual size of the container.\n inline size_type\n get_actual_size() const;\n\n /// Resizes the container to suggested_new_size, a suggested size\n /// (the actual size will be determined by the Size_Policy\n /// object).\n void\n resize(size_type suggested_new_size);\n\n protected:\n inline void\n notify_insert_search_start();\n\n inline void\n notify_insert_search_collision();\n\n inline void\n notify_insert_search_end();\n\n inline void\n notify_find_search_start();\n\n inline void\n notify_find_search_collision();\n\n inline void\n notify_find_search_end();\n\n inline void\n notify_erase_search_start();\n\n inline void\n notify_erase_search_collision();\n\n inline void\n notify_erase_search_end();\n\n inline void\n notify_inserted(size_type num_e);\n\n inline void\n notify_erased(size_type num_e);\n\n void\n notify_cleared();\n\n void\n notify_resized(size_type new_size);\n\n inline bool\n is_resize_needed() const;\n\n /// Queries what the new size should be, when the container is\n /// resized naturally. The current __size of the container is\n /// size, and the number of used entries within the container is\n /// num_used_e.\n size_type\n get_new_size(size_type size, size_type num_used_e) const;\n\n private:\n /// Resizes to new_size.\n virtual void\n do_resize(size_type new_size);\n\n typedef Trigger_Policy trigger_policy_base;\n\n typedef Size_Policy size_policy_base;\n\n size_type m_size;\n };\n\n#include <ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/list_update_policy.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_policy.hpp\n * Contains policies for list update containers.\n */\n\n#ifndef PB_DS_LU_POLICY_HPP\n#define PB_DS_LU_POLICY_HPP\n\n#include <bits/c++config.h>\n#include <cstdlib>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp>\n#include <ext/pb_ds/tag_and_trait.hpp>\n\nnamespace __gnu_pbds\n{\n /**\n * A list-update policy that unconditionally moves elements to the\n * front of the list. A null type means that each link in a\n * list-based container does not actually need metadata.\n */\n template<typename _Alloc = std::allocator<char> >\n class lu_move_to_front_policy\n {\n public:\n typedef _Alloc \t\t\t\t\tallocator_type;\n\n /// Metadata on which this functor operates.\n typedef null_type \t\t\t\t\tmetadata_type;\n\n public:\n /// Reference to metadata on which this functor operates.\n typedef typename detail::rebind_traits<_Alloc, metadata_type>::reference\n metadata_reference;\n\n /// Creates a metadata object.\n metadata_type\n operator()() const\n { return s_metadata; }\n\n /// Decides whether a metadata object should be moved to the front\n /// of the list.\n inline bool\n operator()(metadata_reference r_metadata) const\n { return true; }\n\n private:\n static null_type \t\t\t\t\ts_metadata;\n };\n\n /**\n * A list-update policy that moves elements to the front of the\n * list based on the counter algorithm.\n */\n template<std::size_t Max_Count = 5, typename _Alloc = std::allocator<char> >\n class lu_counter_policy\n : private detail::lu_counter_policy_base<typename _Alloc::size_type>\n {\n public:\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename allocator_type::size_type \tsize_type;\n\n enum\n\t{\n\t /// When some element is accessed this number of times, it\n\t /// will be moved to the front of the list.\n\t max_count = Max_Count\n\t};\n\n /// Metadata on which this functor operates.\n typedef detail::lu_counter_metadata<size_type> \tmetadata_type;\n\n private:\n typedef detail::lu_counter_policy_base<size_type> \tbase_type;\n\n public:\n /// Reference to metadata on which this functor operates.\n typedef typename detail::rebind_traits<_Alloc, metadata_type>::reference\n metadata_reference;\n\n /// Creates a metadata object.\n metadata_type\n operator()() const\n { return base_type::operator()(max_count); }\n\n /// Decides whether a metadata object should be moved to the front\n /// of the list.\n bool\n operator()(metadata_reference r_data) const\n { return base_type::operator()(r_data, max_count); }\n };\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/priority_queue.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file priority_queue.hpp\n * Contains priority_queues.\n */\n\n#ifndef PB_DS_PRIORITY_QUEUE_HPP\n#define PB_DS_PRIORITY_QUEUE_HPP\n\n#include <bits/c++config.h>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/priority_queue_base_dispatch.hpp>\n#include <ext/pb_ds/detail/standard_policies.hpp>\n\nnamespace __gnu_pbds\n{\n /**\n * @defgroup heap-based Heap-Based\n * @ingroup containers-pbds\n *\n * @{\n */\n\n /**\n * @defgroup heap-detail Base and Policy Classes\n * @ingroup heap-based\n */\n\n /**\n * A priority queue composed of one specific heap policy.\n *\n * @tparam _Tv \t \tValue type.\n * @tparam Cmp_Fn\t \tComparison functor.\n * @tparam Tag \t \tInstantiating data structure type,\n *\t\t\t \tsee container_tag.\n * @tparam _Alloc \t \tAllocator type.\n *\n * Base is dispatched at compile time via Tag, from the following\n * choices: binary_heap_tag, binomial_heap_tag, pairing_heap_tag,\n * rc_binomial_heap_tag, thin_heap_tag\n *\n * Base choices are: detail::binary_heap, detail::binomial_heap,\n * detail::pairing_heap, detail::rc_binomial_heap,\n * detail::thin_heap.\n */\n template<typename _Tv,\n\t typename Cmp_Fn = std::less<_Tv>,\n\t typename Tag = pairing_heap_tag,\n\t typename _Alloc = std::allocator<char> >\n class priority_queue\n : public detail::container_base_dispatch<_Tv, Cmp_Fn, _Alloc, Tag>::type\n {\n public:\n typedef _Tv \t\t\t\t\tvalue_type;\n typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n typedef Tag \t\t\t\t\tcontainer_category;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename allocator_type::size_type \t\tsize_type;\n typedef typename allocator_type::difference_type \tdifference_type;\n\n private:\n typedef typename detail::container_base_dispatch<_Tv, Cmp_Fn, _Alloc,\n\t\t\t\t\t\t Tag>::type\n \t\t\t\t\t\t\tbase_type;\n typedef detail::rebind_traits<_Alloc, _Tv>\t\t__rebind_va;\n\n public:\n typedef typename __rebind_va::reference \t\treference;\n typedef typename __rebind_va::const_reference \tconst_reference;\n typedef typename __rebind_va::pointer \t \tpointer;\n typedef typename __rebind_va::const_pointer \tconst_pointer;\n\n typedef typename base_type::point_iterator \t\tpoint_iterator;\n typedef typename base_type::point_const_iterator \tpoint_const_iterator;\n typedef typename base_type::iterator \t\titerator;\n typedef typename base_type::const_iterator \t\tconst_iterator;\n\n priority_queue() { }\n\n /// Constructor taking some policy objects. r_cmp_fn will be\n /// copied by the Cmp_Fn object of the container object.\n priority_queue(const cmp_fn& r_cmp_fn) : base_type(r_cmp_fn) { }\n\n /// Constructor taking __iterators to a range of value_types. The\n /// value_types between first_it and last_it will be inserted into\n /// the container object.\n template<typename It>\n priority_queue(It first_it, It last_it)\n { base_type::copy_from_range(first_it, last_it); }\n\n /// Constructor taking __iterators to a range of value_types and\n /// some policy objects The value_types between first_it and\n /// last_it will be inserted into the container object. r_cmp_fn\n /// will be copied by the cmp_fn object of the container object.\n template<typename It>\n priority_queue(It first_it, It last_it, const cmp_fn& r_cmp_fn)\n : base_type(r_cmp_fn)\n { base_type::copy_from_range(first_it, last_it); }\n\n priority_queue(const priority_queue& other)\n : base_type((const base_type& )other) { }\n\n virtual\n ~priority_queue() { }\n\n priority_queue&\n operator=(const priority_queue& other)\n {\n if (this != &other)\n\t{\n\t priority_queue tmp(other);\n\t swap(tmp);\n\t}\n return *this;\n }\n\n void\n swap(priority_queue& other)\n { base_type::swap(other); }\n };\n ///@} heap-based\n} // namespace __gnu_pbds\n#endif\n","include/ext/pb_ds/tag_and_trait.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file tag_and_trait.hpp\n * Contains tags and traits, e.g., ones describing underlying\n * data structures.\n */\n\n#ifndef PB_DS_TAG_AND_TRAIT_HPP\n#define PB_DS_TAG_AND_TRAIT_HPP\n\n#include <bits/c++config.h>\n#include <ext/pb_ds/detail/type_utils.hpp>\n\n/**\n * @namespace __gnu_pbds\n * @brief GNU extensions for policy-based data structures for public use.\n */\nnamespace __gnu_pbds\n{\n /** @defgroup pbds Policy-Based Data Structures\n * @ingroup extensions\n *\n * This is a library of policy-based elementary data structures:\n * associative containers and priority queues. It is designed for\n * high-performance, flexibility, semantic safety, and conformance\n * to the corresponding containers in std (except for some points\n * where it differs by design).\n *\n * For details, see:\n * http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/index.html\n *\n * @{\n */\n\n /**\n * @defgroup tags Tags\n * @{ \n */\n /// A trivial iterator tag. Signifies that the iterators has none of\n /// std::iterators's movement abilities.\n struct trivial_iterator_tag\n { };\n\n /// Prohibit moving trivial iterators.\n typedef void trivial_iterator_difference_type;\n\n\n /**\n * @defgroup invalidation_tags Invalidation Guarantees\n * @ingroup tags\n * @{\n */\n\n /**\n * Signifies a basic invalidation guarantee that any iterator,\n * pointer, or reference to a container object's mapped value type\n * is valid as long as the container is not modified.\n */\n struct basic_invalidation_guarantee\n { };\n\n /**\n * Signifies an invalidation guarantee that includes all those of\n * its base, and additionally, that any point-type iterator,\n * pointer, or reference to a container object's mapped value type\n * is valid as long as its corresponding entry has not be erased,\n * regardless of modifications to the container object.\n */\n struct point_invalidation_guarantee : public basic_invalidation_guarantee\n { };\n\n /**\n * Signifies an invalidation guarantee that includes all those of\n * its base, and additionally, that any range-type iterator\n * (including the returns of begin() and end()) is in the correct\n * relative positions to other range-type iterators as long as its\n * corresponding entry has not be erased, regardless of\n * modifications to the container object.\n */\n struct range_invalidation_guarantee : public point_invalidation_guarantee\n { };\n ///@}\n\n\n /**\n * @defgroup ds_tags Data Structure Type\n * @ingroup tags\n * @{\n */\n /// Base data structure tag.\n struct container_tag\n { };\n\n /// Basic sequence.\n struct sequence_tag : public container_tag { };\n\n /// Basic string container, inclusive of strings, ropes, etc.\n struct string_tag : public sequence_tag { };\n\n /// Basic associative-container.\n struct associative_tag : public container_tag { };\n\n /// Basic hash structure.\n struct basic_hash_tag : public associative_tag { };\n\n /// Collision-chaining hash.\n struct cc_hash_tag : public basic_hash_tag { };\n\n /// General-probing hash.\n struct gp_hash_tag : public basic_hash_tag { };\n\n /// Basic branch structure.\n struct basic_branch_tag : public associative_tag { };\n\n /// Basic tree structure.\n struct tree_tag : public basic_branch_tag { };\n\n /// Red-black tree.\n struct rb_tree_tag : public tree_tag { };\n\n /// Splay tree.\n struct splay_tree_tag : public tree_tag { };\n\n /// Ordered-vector tree.\n struct ov_tree_tag : public tree_tag { };\n\n /// Basic trie structure.\n struct trie_tag : public basic_branch_tag { };\n\n /// PATRICIA trie.\n struct pat_trie_tag : public trie_tag { };\n\n /// List-update.\n struct list_update_tag : public associative_tag { };\n\n /// Basic priority-queue.\n struct priority_queue_tag : public container_tag { };\n\n /// Pairing-heap.\n struct pairing_heap_tag : public priority_queue_tag { };\n\n /// Binomial-heap.\n struct binomial_heap_tag : public priority_queue_tag { };\n\n /// Redundant-counter binomial-heap.\n struct rc_binomial_heap_tag : public priority_queue_tag { };\n\n /// Binary-heap (array-based).\n struct binary_heap_tag : public priority_queue_tag { };\n\n /// Thin heap.\n struct thin_heap_tag : public priority_queue_tag { };\n ///@}\n ///@}\n\n\n /**\n * @defgroup traits Traits\n * @{\n */\n\n /**\n * @brief Represents no type, or absence of type, for template tricks.\n *\n * In a mapped-policy, indicates that an associative container is a set.\n *\n * In a list-update policy, indicates that each link does not need\n * metadata.\n *\n * In a hash policy, indicates that the combining hash function\n * is actually a ranged hash function.\n *\n * In a probe policy, indicates that the combining probe function\n * is actually a ranged probe function.\n */\n struct null_type { };\n\n /// A null node updator, indicating that no node updates are required.\n template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>\n struct null_node_update : public null_type\n { };\n\n\n /// Primary template, container traits base.\n template<typename _Tag>\n struct container_traits_base;\n\n /// Specialization, cc hash.\n template<>\n struct container_traits_base<cc_hash_tag>\n {\n typedef cc_hash_tag \t\t\t\tcontainer_category;\n typedef point_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = false,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = false\n };\n };\n\n /// Specialization, gp hash.\n template<>\n struct container_traits_base<gp_hash_tag>\n {\n typedef gp_hash_tag \t\t\t\tcontainer_category;\n typedef basic_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = false,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = false\n };\n };\n\n /// Specialization, rb tree.\n template<>\n struct container_traits_base<rb_tree_tag>\n {\n typedef rb_tree_tag \t\t\t\tcontainer_category;\n typedef range_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = true,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = true\n };\n };\n\n /// Specialization, splay tree.\n template<>\n struct container_traits_base<splay_tree_tag>\n {\n typedef splay_tree_tag \t\t\t\tcontainer_category;\n typedef range_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = true,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = true\n };\n };\n\n /// Specialization, ov tree.\n template<>\n struct container_traits_base<ov_tree_tag>\n {\n typedef ov_tree_tag \t\t\t\tcontainer_category;\n typedef basic_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = true,\n\terase_can_throw = true,\n\tsplit_join_can_throw = true,\n\treverse_iteration = false\n };\n };\n\n /// Specialization, pat trie.\n template<>\n struct container_traits_base<pat_trie_tag>\n {\n typedef pat_trie_tag \t\t\t\tcontainer_category;\n typedef range_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = true,\n\terase_can_throw = false,\n\tsplit_join_can_throw = true,\n\treverse_iteration = true\n };\n };\n\n /// Specialization, list update.\n template<>\n struct container_traits_base<list_update_tag>\n {\n typedef list_update_tag \t\t\t\tcontainer_category;\n typedef point_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = false,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = false\n };\n };\n\n /// Specialization, pairing heap.\n template<>\n struct container_traits_base<pairing_heap_tag>\n {\n typedef pairing_heap_tag \t\t\t\tcontainer_category;\n typedef point_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = false,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = false\n };\n };\n\n /// Specialization, thin heap.\n template<>\n struct container_traits_base<thin_heap_tag>\n {\n typedef thin_heap_tag \t\t\t\tcontainer_category;\n typedef point_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = false,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = false\n };\n };\n\n /// Specialization, binomial heap.\n template<>\n struct container_traits_base<binomial_heap_tag>\n {\n typedef binomial_heap_tag \t\t\t\tcontainer_category;\n typedef point_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = false,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = false\n };\n };\n\n /// Specialization, rc binomial heap.\n template<>\n struct container_traits_base<rc_binomial_heap_tag>\n {\n typedef rc_binomial_heap_tag \t\t\tcontainer_category;\n typedef point_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = false,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = false\n };\n };\n\n /// Specialization, binary heap.\n template<>\n struct container_traits_base<binary_heap_tag>\n {\n typedef binary_heap_tag \t\t\t\tcontainer_category;\n typedef basic_invalidation_guarantee \t\tinvalidation_guarantee;\n\n enum\n {\n\torder_preserving = false,\n\terase_can_throw = false,\n\tsplit_join_can_throw = true,\n\treverse_iteration = false\n };\n };\n\n\n /// Container traits.\n // See Matt Austern for the name, S. Meyers MEFC++ #2, others.\n template<typename Cntnr>\n struct container_traits\n : public container_traits_base<typename Cntnr::container_category>\n {\n typedef Cntnr \t\t\t\t container_type;\n typedef typename Cntnr::container_category container_category;\n typedef container_traits_base<container_category> base_type;\n typedef typename base_type::invalidation_guarantee invalidation_guarantee;\n\n enum\n {\n\t/// True only if Cntnr objects guarantee storing keys by order.\n\torder_preserving = base_type::order_preserving,\n\n\t/// True only if erasing a key can throw.\n\terase_can_throw = base_type::erase_can_throw,\n\n\t/// True only if split or join operations can throw.\n\tsplit_join_can_throw = base_type::split_join_can_throw,\n\n\t/// True only reverse iterators are supported.\n\treverse_iteration = base_type::reverse_iteration\n };\n };\n ///@}\n\n\n namespace detail\n {\n /// Dispatch mechanism, primary template for associative types.\n template<typename Key, typename Mapped, typename _Alloc, typename Tag,\n\t typename Policy_Tl = null_type>\n struct container_base_dispatch;\n } // namespace detail\n ///@}\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/pb_ds/tree_policy.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file tree_policy.hpp\n * Contains tree-related policies.\n */\n\n#ifndef PB_DS_TREE_POLICY_HPP\n#define PB_DS_TREE_POLICY_HPP\n\n#include <bits/c++config.h>\n#include <iterator>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>\n\nnamespace __gnu_pbds\n{\n#define PB_DS_CLASS_T_DEC \\\n template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn, \\\n\t typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n tree_order_statistics_node_update<Node_CItr, Node_Itr, Cmp_Fn, _Alloc>\n\n#define PB_DS_BRANCH_POLICY_BASE \\\n detail::branch_policy<Node_CItr, Node_Itr, _Alloc>\n\n /// Functor updating ranks of entrees.\n template<typename Node_CItr, typename Node_Itr, \n\t typename Cmp_Fn, typename _Alloc>\n class tree_order_statistics_node_update : private PB_DS_BRANCH_POLICY_BASE\n {\n private:\n typedef PB_DS_BRANCH_POLICY_BASE \t\t \tbase_type;\n\n public:\n typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename allocator_type::size_type \t\tsize_type;\n typedef typename base_type::key_type \t\tkey_type;\n typedef typename base_type::key_const_reference \tkey_const_reference;\n\n typedef size_type \t\t\t\t\tmetadata_type;\n typedef Node_CItr \t \t\t\tnode_const_iterator;\n typedef Node_Itr \t\t\t\t\tnode_iterator;\n typedef typename node_const_iterator::value_type \tconst_iterator;\n typedef typename node_iterator::value_type \t\titerator;\n\n /// Finds an entry by __order. Returns a const_iterator to the\n /// entry with the __order order, or a const_iterator to the\n /// container object's end if order is at least the size of the\n /// container object.\n inline const_iterator\n find_by_order(size_type) const;\n\n /// Finds an entry by __order. Returns an iterator to the entry\n /// with the __order order, or an iterator to the container\n /// object's end if order is at least the size of the container\n /// object.\n inline iterator\n find_by_order(size_type);\n\n /// Returns the order of a key within a sequence. For exapmle, if\n /// r_key is the smallest key, this method will return 0; if r_key\n /// is a key between the smallest and next key, this method will\n /// return 1; if r_key is a key larger than the largest key, this\n /// method will return the size of r_c.\n inline size_type\n order_of_key(key_const_reference) const;\n\n private:\n /// Const reference to the container's value-type.\n typedef typename base_type::const_reference \tconst_reference;\n\n /// Const pointer to the container's value-type.\n typedef typename base_type::const_pointer \t\tconst_pointer;\n\n /// Const metadata reference.\n typedef typename detail::rebind_traits<_Alloc, metadata_type>::const_reference\n metadata_const_reference;\n\n /// Metadata reference.\n typedef typename detail::rebind_traits<_Alloc, metadata_type>::reference\n metadata_reference;\n\n /// Returns the node_const_iterator associated with the tree's root node.\n virtual node_const_iterator\n node_begin() const = 0;\n\n /// Returns the node_iterator associated with the tree's root node.\n virtual node_iterator\n node_begin() = 0;\n\n /// Returns the node_const_iterator associated with a just-after leaf node.\n virtual node_const_iterator\n node_end() const = 0;\n\n /// Returns the node_iterator associated with a just-after leaf node.\n virtual node_iterator\n node_end() = 0;\n\n /// Access to the cmp_fn object.\n virtual cmp_fn& \n get_cmp_fn() = 0;\n\n protected:\n /// Updates the rank of a node through a node_iterator node_it;\n /// end_nd_it is the end node iterator.\n inline void\n operator()(node_iterator, node_const_iterator) const;\n\n virtual\n ~tree_order_statistics_node_update();\n };\n\n#include <ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_BRANCH_POLICY_BASE\n\n} // namespace __gnu_pbds\n\n#endif \n","include/ext/pb_ds/trie_policy.hpp":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy.hpp\n * Contains trie-related policies.\n */\n\n#ifndef PB_DS_TRIE_POLICY_HPP\n#define PB_DS_TRIE_POLICY_HPP\n\n#include <bits/c++config.h>\n#include <string>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/trie_policy/trie_policy_base.hpp>\n\nnamespace __gnu_pbds\n{\n#define PB_DS_CLASS_T_DEC \\\n template<typename String, typename String::value_type Min_E_Val, \\\n\t typename String::value_type Max_E_Val, bool Reverse, \\\n\t typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n trie_string_access_traits<String, Min_E_Val,Max_E_Val,Reverse,_Alloc>\n\n /**\n * Element access traits for string types.\n *\n * @tparam String \t \tString type.\n * @tparam Min_E_Val \tMinimal element value.\n * @tparam Max_E_Val\t \tMaximum element value.\n * @tparam Reverse\t Reverse iteration should be used.\n * Default: false.\n * @tparam _Alloc \t \tAllocator type.\n */\n template<typename String = std::string,\n\t typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min,\n\t typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max,\n\t bool Reverse = false,\n\t typename _Alloc = std::allocator<char> >\n struct trie_string_access_traits\n {\n public:\n typedef typename _Alloc::size_type\t\t\t size_type;\n typedef String \t\t\t\t\t key_type;\n typedef typename detail::rebind_traits<_Alloc, key_type>::const_reference\n key_const_reference;\n\n enum\n {\n\treverse = Reverse\n };\n\n /// Element const iterator type.\n typedef typename detail::__conditional_type<Reverse, \\\n\t\t typename String::const_reverse_iterator, \\\n\t\t typename String::const_iterator>::__type const_iterator;\n\n /// Element type.\n typedef typename std::iterator_traits<const_iterator>::value_type e_type;\n\n enum\n {\n\tmin_e_val = Min_E_Val,\n\tmax_e_val = Max_E_Val,\n\tmax_size = max_e_val - min_e_val + 1\n };\n PB_DS_STATIC_ASSERT(min_max_size, max_size >= 2);\n\n /// Returns a const_iterator to the first element of\n /// key_const_reference agumnet.\n inline static const_iterator\n begin(key_const_reference);\n\n /// Returns a const_iterator to the after-last element of\n /// key_const_reference argument.\n inline static const_iterator\n end(key_const_reference);\n\n /// Maps an element to a position.\n inline static size_type\n e_pos(e_type e);\n\n private:\n inline static const_iterator\n begin_imp(key_const_reference, detail::false_type);\n\n inline static const_iterator\n begin_imp(key_const_reference, detail::true_type);\n\n inline static const_iterator\n end_imp(key_const_reference, detail::false_type);\n\n inline static const_iterator\n end_imp(key_const_reference, detail::true_type);\n\n static detail::integral_constant<int, Reverse> s_rev_ind;\n };\n\n#include <ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n template<typename Node_CItr,typename Node_Itr, \\\n\t typename _ATraits, typename _Alloc>\n\n#define PB_DS_CLASS_C_DEC \\\n trie_prefix_search_node_update<Node_CItr, Node_Itr, \\\n\t\t\t\t _ATraits,_Alloc>\n\n#define PB_DS_TRIE_POLICY_BASE \\\n detail::trie_policy_base<Node_CItr,Node_Itr,_ATraits, _Alloc>\n\n /// A node updator that allows tries to be searched for the range of\n /// values that match a certain prefix.\n template<typename Node_CItr,\n\t typename Node_Itr,\n\t typename _ATraits,\n\t typename _Alloc>\n class trie_prefix_search_node_update : private PB_DS_TRIE_POLICY_BASE\n {\n private:\n typedef PB_DS_TRIE_POLICY_BASE \t\t \tbase_type;\n\n public:\n typedef typename base_type::key_type \t\tkey_type;\n typedef typename base_type::key_const_reference \tkey_const_reference;\n\n /// Element access traits.\n typedef _ATraits \t\t\t\taccess_traits;\n\n /// Const element iterator.\n typedef typename access_traits::const_iterator \ta_const_iterator;\n\n /// _Alloc type.\n typedef _Alloc \t \t\t\t\tallocator_type;\n\n /// Size type.\n typedef typename allocator_type::size_type \t\tsize_type;\n typedef null_type \t\t\t\t\tmetadata_type;\n typedef Node_Itr \t\t\t\t\tnode_iterator;\n typedef Node_CItr \t\t\t\t\tnode_const_iterator;\n typedef typename node_iterator::value_type \t\titerator;\n typedef typename node_const_iterator::value_type \tconst_iterator;\n\n /// Finds the const iterator range corresponding to all values\n /// whose prefixes match r_key.\n std::pair<const_iterator, const_iterator>\n prefix_range(key_const_reference) const;\n\n /// Finds the iterator range corresponding to all values whose\n /// prefixes match r_key.\n std::pair<iterator, iterator>\n prefix_range(key_const_reference);\n\n /// Finds the const iterator range corresponding to all values\n /// whose prefixes match [b, e).\n std::pair<const_iterator, const_iterator>\n prefix_range(a_const_iterator, a_const_iterator) const;\n\n /// Finds the iterator range corresponding to all values whose\n /// prefixes match [b, e).\n std::pair<iterator, iterator>\n prefix_range(a_const_iterator, a_const_iterator);\n\n protected:\n /// Called to update a node's metadata.\n inline void\n operator()(node_iterator node_it, node_const_iterator end_nd_it) const;\n\n private:\n node_iterator\n next_child(node_iterator, a_const_iterator, a_const_iterator,\n\t node_iterator, const access_traits&);\n\n /// Returns the const iterator associated with the just-after last element.\n virtual const_iterator\n end() const = 0;\n\n /// Returns the iterator associated with the just-after last element.\n virtual iterator\n end() = 0;\n\n /// Returns the node_const_iterator associated with the trie's root node.\n virtual node_const_iterator\n node_begin() const = 0;\n\n /// Returns the node_iterator associated with the trie's root node.\n virtual node_iterator\n node_begin() = 0;\n\n /// Returns the node_const_iterator associated with a just-after leaf node.\n virtual node_const_iterator\n node_end() const = 0;\n\n /// Returns the node_iterator associated with a just-after leaf node.\n virtual node_iterator\n node_end() = 0;\n\n /// Access to the cmp_fn object.\n virtual const access_traits&\n get_access_traits() const = 0;\n };\n\n#include <ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_C_DEC \\\n trie_order_statistics_node_update<Node_CItr, Node_Itr, \\\n\t\t\t\t _ATraits, _Alloc>\n\n /// Functor updating ranks of entrees.\n template<typename Node_CItr,\n\t typename Node_Itr,\n\t typename _ATraits,\n\t typename _Alloc>\n class trie_order_statistics_node_update : private PB_DS_TRIE_POLICY_BASE\n {\n private:\n typedef PB_DS_TRIE_POLICY_BASE \t\t \tbase_type;\n\n public:\n typedef _ATraits \t\t\t\taccess_traits;\n typedef typename access_traits::const_iterator \ta_const_iterator;\n typedef _Alloc \t\t\t\t\tallocator_type;\n typedef typename allocator_type::size_type \t\tsize_type;\n typedef typename base_type::key_type \t\tkey_type;\n typedef typename base_type::key_const_reference \tkey_const_reference;\n\n typedef size_type \t\t\t\t\tmetadata_type;\n typedef Node_CItr \t\t\t\t\tnode_const_iterator;\n typedef Node_Itr \t\t\t\t\tnode_iterator;\n typedef typename node_const_iterator::value_type \tconst_iterator;\n typedef typename node_iterator::value_type \t\titerator;\n\n /// Finds an entry by __order. Returns a const_iterator to the\n /// entry with the __order order, or a const_iterator to the\n /// container object's end if order is at least the size of the\n /// container object.\n inline const_iterator\n find_by_order(size_type) const;\n\n /// Finds an entry by __order. Returns an iterator to the entry\n /// with the __order order, or an iterator to the container\n /// object's end if order is at least the size of the container\n /// object.\n inline iterator\n find_by_order(size_type);\n\n /// Returns the order of a key within a sequence. For exapmle, if\n /// r_key is the smallest key, this method will return 0; if r_key\n /// is a key between the smallest and next key, this method will\n /// return 1; if r_key is a key larger than the largest key, this\n /// method will return the size of r_c.\n inline size_type\n order_of_key(key_const_reference) const;\n\n /// Returns the order of a prefix within a sequence. For exapmle,\n /// if [b, e] is the smallest prefix, this method will return 0; if\n /// r_key is a key between the smallest and next key, this method\n /// will return 1; if r_key is a key larger than the largest key,\n /// this method will return the size of r_c.\n inline size_type\n order_of_prefix(a_const_iterator, a_const_iterator) const;\n\n protected:\n /// Updates the rank of a node through a node_iterator node_it;\n /// end_nd_it is the end node iterator.\n inline void\n operator()(node_iterator, node_const_iterator) const;\n\n private:\n typedef typename base_type::const_reference \tconst_reference;\n typedef typename base_type::const_pointer \t\tconst_pointer;\n\n typedef typename _Alloc::template rebind<metadata_type> __rebind_m;\n typedef typename __rebind_m::other \t\t\t__rebind_ma;\n typedef typename __rebind_ma::const_reference metadata_const_reference;\n typedef typename __rebind_ma::reference \t\tmetadata_reference;\n\n /// Returns true if the container is empty.\n _GLIBCXX_NODISCARD virtual bool\n empty() const = 0;\n\n /// Returns the iterator associated with the trie's first element.\n virtual iterator\n begin() = 0;\n\n /// Returns the iterator associated with the trie's\n /// just-after-last element.\n virtual iterator\n end() = 0;\n\n /// Returns the node_const_iterator associated with the trie's root node.\n virtual node_const_iterator\n node_begin() const = 0;\n\n /// Returns the node_iterator associated with the trie's root node.\n virtual node_iterator\n node_begin() = 0;\n\n /// Returns the node_const_iterator associated with a just-after\n /// leaf node.\n virtual node_const_iterator\n node_end() const = 0;\n\n /// Returns the node_iterator associated with a just-after leaf node.\n virtual node_iterator\n node_end() = 0;\n\n /// Access to the cmp_fn object.\n virtual access_traits&\n get_access_traits() = 0;\n };\n\n#include <ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_TRIE_POLICY_BASE\n\n} // namespace __gnu_pbds\n\n#endif\n","include/ext/type_traits.h":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 3, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n/** @file ext/type_traits.h\n * This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _EXT_TYPE_TRAITS\n#define _EXT_TYPE_TRAITS 1\n\n#ifdef _GLIBCXX_SYSHDR\n#pragma GCC system_header\n#endif\n\n#include <bits/c++config.h>\n#include <bits/cpp_type_traits.h>\n\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wlong-long\"\n\nextern \"C++\" {\n\nnamespace __gnu_cxx _GLIBCXX_VISIBILITY(default)\n{\n_GLIBCXX_BEGIN_NAMESPACE_VERSION\n\n // Define a nested type if some predicate holds.\n template<bool, typename>\n struct __enable_if\n { };\n\n template<typename _Tp>\n struct __enable_if<true, _Tp>\n { typedef _Tp __type; };\n\n\n // Conditional expression for types. If true, first, if false, second.\n template<bool _Cond, typename _Iftrue, typename _Iffalse>\n struct __conditional_type\n { typedef _Iftrue __type; };\n\n template<typename _Iftrue, typename _Iffalse>\n struct __conditional_type<false, _Iftrue, _Iffalse>\n { typedef _Iffalse __type; };\n\n\n // Given an integral builtin type, return the corresponding unsigned type.\n template<typename _Tp>\n struct __add_unsigned\n {\n private:\n typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;\n\n public:\n typedef typename __if_type::__type __type;\n };\n\n template<>\n struct __add_unsigned<char>\n { typedef unsigned char __type; };\n\n template<>\n struct __add_unsigned<signed char>\n { typedef unsigned char __type; };\n\n template<>\n struct __add_unsigned<short>\n { typedef unsigned short __type; };\n\n template<>\n struct __add_unsigned<int>\n { typedef unsigned int __type; };\n\n template<>\n struct __add_unsigned<long>\n { typedef unsigned long __type; };\n\n template<>\n struct __add_unsigned<long long>\n { typedef unsigned long long __type; };\n\n // Declare but don't define.\n template<>\n struct __add_unsigned<bool>;\n\n template<>\n struct __add_unsigned<wchar_t>;\n\n\n // Given an integral builtin type, return the corresponding signed type.\n template<typename _Tp>\n struct __remove_unsigned\n {\n private:\n typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;\n\n public:\n typedef typename __if_type::__type __type;\n };\n\n template<>\n struct __remove_unsigned<char>\n { typedef signed char __type; };\n\n template<>\n struct __remove_unsigned<unsigned char>\n { typedef signed char __type; };\n\n template<>\n struct __remove_unsigned<unsigned short>\n { typedef short __type; };\n\n template<>\n struct __remove_unsigned<unsigned int>\n { typedef int __type; };\n\n template<>\n struct __remove_unsigned<unsigned long>\n { typedef long __type; };\n\n template<>\n struct __remove_unsigned<unsigned long long>\n { typedef long long __type; };\n\n // Declare but don't define.\n template<>\n struct __remove_unsigned<bool>;\n\n template<>\n struct __remove_unsigned<wchar_t>;\n\n\n // For use in string and vstring.\n template<typename _Type>\n _GLIBCXX_CONSTEXPR\n inline bool\n __is_null_pointer(_Type* __ptr)\n { return __ptr == 0; }\n\n template<typename _Type>\n _GLIBCXX_CONSTEXPR\n inline bool\n __is_null_pointer(_Type)\n { return false; }\n\n#if __cplusplus >= 201103L\n constexpr bool\n __is_null_pointer(std::nullptr_t)\n { return true; }\n#endif\n\n // For arithmetic promotions in <complex> and <cmath>\n\n template<typename _Tp, bool = std::__is_integer<_Tp>::__value>\n struct __promote\n { typedef double __type; };\n\n // No nested __type member for non-integer non-floating point types,\n // allows this type to be used for SFINAE to constrain overloads in\n // <cmath> and <complex> to only the intended types.\n template<typename _Tp>\n struct __promote<_Tp, false>\n { };\n\n template<>\n struct __promote<long double>\n { typedef long double __type; };\n\n template<>\n struct __promote<double>\n { typedef double __type; };\n\n template<>\n struct __promote<float>\n { typedef float __type; };\n\n#ifdef __STDCPP_FLOAT16_T__\n template<>\n struct __promote<_Float16>\n { typedef _Float16 __type; };\n#endif\n\n#ifdef __STDCPP_FLOAT32_T__\n template<>\n struct __promote<_Float32>\n { typedef _Float32 __type; };\n#endif\n\n#ifdef __STDCPP_FLOAT64_T__\n template<>\n struct __promote<_Float64>\n { typedef _Float64 __type; };\n#endif\n\n#ifdef __STDCPP_FLOAT128_T__\n template<>\n struct __promote<_Float128>\n { typedef _Float128 __type; };\n#endif\n\n#ifdef __STDCPP_BFLOAT16_T__\n template<>\n struct __promote<__gnu_cxx::__bfloat16_t>\n { typedef __gnu_cxx::__bfloat16_t __type; };\n#endif\n\n#if __cpp_fold_expressions\n\n template<typename... _Tp>\n using __promoted_t = decltype((typename __promote<_Tp>::__type(0) + ...));\n\n // Deducing the promoted type is done by __promoted_t<_Tp...>,\n // then __promote is used to provide the nested __type member.\n template<typename _Tp, typename _Up>\n using __promote_2 = __promote<__promoted_t<_Tp, _Up>>;\n\n template<typename _Tp, typename _Up, typename _Vp>\n using __promote_3 = __promote<__promoted_t<_Tp, _Up, _Vp>>;\n\n template<typename _Tp, typename _Up, typename _Vp, typename _Wp>\n using __promote_4 = __promote<__promoted_t<_Tp, _Up, _Vp, _Wp>>;\n\n#else\n\n template<typename _Tp, typename _Up,\n typename _Tp2 = typename __promote<_Tp>::__type,\n typename _Up2 = typename __promote<_Up>::__type>\n struct __promote_2\n {\n typedef __typeof__(_Tp2() + _Up2()) __type;\n };\n\n template<typename _Tp, typename _Up, typename _Vp,\n typename _Tp2 = typename __promote<_Tp>::__type,\n typename _Up2 = typename __promote<_Up>::__type,\n typename _Vp2 = typename __promote<_Vp>::__type>\n struct __promote_3\n {\n typedef __typeof__(_Tp2() + _Up2() + _Vp2()) __type;\n };\n\n template<typename _Tp, typename _Up, typename _Vp, typename _Wp,\n typename _Tp2 = typename __promote<_Tp>::__type,\n typename _Up2 = typename __promote<_Up>::__type,\n typename _Vp2 = typename __promote<_Vp>::__type,\n typename _Wp2 = typename __promote<_Wp>::__type>\n struct __promote_4\n {\n typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type;\n };\n#endif\n\n_GLIBCXX_END_NAMESPACE_VERSION\n} // namespace\n} // extern \"C++\"\n\n#pragma GCC diagnostic pop\n\n#endif\n","include/ext/typelist.h":"// -*- C++ -*-\n\n// Copyright (C) 2005-2025 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library. This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 3, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// Under Section 7 of GPL version 3, you are granted additional\n// permissions described in the GCC Runtime Library Exception, version\n// 3.1, as published by the Free Software Foundation.\n\n// You should have received a copy of the GNU General Public License and\n// a copy of the GCC Runtime Library Exception along with this program;\n// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see\n// <http://www.gnu.org/licenses/>.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice and\n// this permission notice appear in supporting documentation. None of\n// the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied warranty.\n\n/**\n * @file ext/typelist.h\n * This file is a GNU extension to the Standard C++ Library.\n *\n * Contains typelist_chain definitions.\n * Typelists are an idea by Andrei Alexandrescu.\n */\n\n#ifndef _TYPELIST_H\n#define _TYPELIST_H 1\n\n#include <ext/type_traits.h>\n\nnamespace __gnu_cxx _GLIBCXX_VISIBILITY(default)\n{\n_GLIBCXX_BEGIN_NAMESPACE_VERSION\n\n/** @namespace __gnu_cxx::typelist\n * @brief GNU typelist extensions for public compile-time use.\n*/\nnamespace typelist\n{\n struct null_type { };\n\n template<typename Root>\n struct node\n {\n typedef Root \troot;\n };\n\n // Forward declarations of functors.\n template<typename Hd, typename Typelist>\n struct chain\n {\n typedef Hd \thead;\n typedef Typelist \ttail;\n };\n\n // Apply all typelist types to unary functor.\n template<typename Fn, typename Typelist>\n void\n apply(Fn&, Typelist);\n\n /// Apply all typelist types to generator functor.\n template<typename Gn, typename Typelist>\n void\n apply_generator(Gn&, Typelist);\n\n // Apply all typelist types and values to generator functor.\n template<typename Gn, typename TypelistT, typename TypelistV>\n void\n apply_generator(Gn&, TypelistT, TypelistV);\n\n template<typename Typelist0, typename Typelist1>\n struct append;\n\n template<typename Typelist_Typelist>\n struct append_typelist;\n\n template<typename Typelist, typename T>\n struct contains;\n\n template<typename Typelist, template<typename T> class Pred>\n struct filter;\n\n template<typename Typelist, int i>\n struct at_index;\n\n template<typename Typelist, template<typename T> class Transform>\n struct transform;\n\n template<typename Typelist_Typelist>\n struct flatten;\n\n template<typename Typelist>\n struct from_first;\n\n template<typename T1>\n struct create1;\n\n template<typename T1, typename T2>\n struct create2;\n\n template<typename T1, typename T2, typename T3>\n struct create3;\n\n template<typename T1, typename T2, typename T3, typename T4>\n struct create4;\n\n template<typename T1, typename T2, typename T3, typename T4, typename T5>\n struct create5;\n\n template<typename T1, typename T2, typename T3,\n\t typename T4, typename T5, typename T6>\n struct create6;\n\nnamespace detail\n{\n template<typename Fn, typename Typelist_Chain>\n struct apply_;\n\n template<typename Fn, typename Hd, typename Tl>\n struct apply_<Fn, chain<Hd, Tl> >\n {\n void\n operator()(Fn& f)\n {\n\tf.operator()(Hd());\n\tapply_<Fn, Tl> next;\n\tnext(f);\n }\n };\n\n template<typename Fn>\n struct apply_<Fn, null_type>\n {\n void\n operator()(Fn&) { }\n };\n\n template<typename Gn, typename Typelist_Chain>\n struct apply_generator1_;\n\n template<typename Gn, typename Hd, typename Tl>\n struct apply_generator1_<Gn, chain<Hd, Tl> >\n {\n void\n operator()(Gn& g)\n {\n\tg.template operator()<Hd>();\n\tapply_generator1_<Gn, Tl> next;\n\tnext(g);\n }\n };\n\n template<typename Gn>\n struct apply_generator1_<Gn, null_type>\n {\n void\n operator()(Gn&) { }\n };\n\n template<typename Gn, typename TypelistT_Chain, typename TypelistV_Chain>\n struct apply_generator2_;\n\n template<typename Gn, typename Hd1, typename TlT, typename Hd2, typename TlV>\n struct apply_generator2_<Gn, chain<Hd1, TlT>, chain<Hd2, TlV> >\n {\n void\n operator()(Gn& g)\n {\n\tg.template operator()<Hd1, Hd2>();\n\tapply_generator2_<Gn, TlT, TlV> next;\n\tnext(g);\n }\n };\n\n template<typename Gn>\n struct apply_generator2_<Gn, null_type, null_type>\n {\n void\n operator()(Gn&) { }\n };\n\n template<typename Typelist_Chain0, typename Typelist_Chain1>\n struct append_;\n\n template<typename Hd, typename Tl, typename Typelist_Chain>\n struct append_<chain<Hd, Tl>, Typelist_Chain>\n {\n private:\n typedef append_<Tl, Typelist_Chain> \t\t\tappend_type;\n\n public:\n typedef chain<Hd, typename append_type::type> \t\ttype;\n };\n\n template<typename Typelist_Chain>\n struct append_<null_type, Typelist_Chain>\n {\n typedef Typelist_Chain \t\t\t \t\ttype;\n };\n\n template<typename Hd, typename Tl>\n struct append_<chain<Hd, Tl>, null_type>\n {\n typedef chain<Hd, Tl> \t\t\t\t\ttype;\n };\n\n template<>\n struct append_<null_type, null_type>\n {\n typedef null_type \t\t\t\t\ttype;\n };\n\n template<typename Typelist_Typelist_Chain>\n struct append_typelist_;\n\n template<typename Hd>\n struct append_typelist_<chain<Hd, null_type> >\n {\n typedef chain<Hd, null_type> \t\t\t\ttype;\n };\n\n template<typename Hd, typename Tl>\n struct append_typelist_<chain< Hd, Tl> >\n {\n private:\n typedef typename append_typelist_<Tl>::type \t\trest_type;\n\n public:\n typedef typename append<Hd, node<rest_type> >::type::root\ttype;\n };\n\n template<typename Typelist_Chain, typename T>\n struct contains_;\n\n template<typename T>\n struct contains_<null_type, T>\n {\n enum\n\t{\n\t value = false\n\t};\n };\n\n template<typename Hd, typename Tl, typename T>\n struct contains_<chain<Hd, Tl>, T>\n {\n enum\n\t{\n\t value = contains_<Tl, T>::value\n\t};\n };\n\n template<typename Tl, typename T>\n struct contains_<chain<T, Tl>, T>\n {\n enum\n\t{\n\t value = true\n\t};\n };\n\n template<typename Typelist_Chain, template<typename T> class Pred>\n struct chain_filter_;\n\n template<template<typename T> class Pred>\n struct chain_filter_<null_type, Pred>\n {\n typedef null_type \t\t\t\t\ttype;\n };\n\n template<typename Hd, typename Tl, template<typename T> class Pred>\n struct chain_filter_<chain<Hd, Tl>, Pred>\n {\n private:\n enum\n\t{\n\t include_hd = Pred<Hd>::value\n\t};\n\n typedef typename chain_filter_<Tl, Pred>::type \t\trest_type;\n typedef chain<Hd, rest_type> \t\t\t\tchain_type;\n\n public:\n typedef typename __conditional_type<include_hd, chain_type, rest_type>::__type type;\n };\n\n template<typename Typelist_Chain, int i>\n struct chain_at_index_;\n\n template<typename Hd, typename Tl>\n struct chain_at_index_<chain<Hd, Tl>, 0>\n {\n typedef Hd \t\t\t\t\t\ttype;\n };\n\n template<typename Hd, typename Tl, int i>\n struct chain_at_index_<chain<Hd, Tl>, i>\n {\n typedef typename chain_at_index_<Tl, i - 1>::type \ttype;\n };\n\n template<class Typelist_Chain, template<typename T> class Transform>\n struct chain_transform_;\n\n template<template<typename T> class Transform>\n struct chain_transform_<null_type, Transform>\n {\n typedef null_type \t\t\t\t\ttype;\n };\n\n template<class Hd, class Tl, template<typename T> class Transform>\n struct chain_transform_<chain<Hd, Tl>, Transform>\n {\n private:\n typedef typename chain_transform_<Tl, Transform>::type \trest_type;\n typedef typename Transform<Hd>::type \t\t\ttransform_type;\n\n public:\n typedef chain<transform_type, rest_type> \t\t\ttype;\n };\n\n template<typename Typelist_Typelist_Chain>\n struct chain_flatten_;\n\n template<typename Hd_Tl>\n struct chain_flatten_<chain<Hd_Tl, null_type> >\n {\n typedef typename Hd_Tl::root \t\t\t\ttype;\n };\n\n template<typename Hd_Typelist, class Tl_Typelist>\n struct chain_flatten_<chain<Hd_Typelist, Tl_Typelist> >\n {\n private:\n typedef typename chain_flatten_<Tl_Typelist>::type \trest_type;\n typedef append<Hd_Typelist, node<rest_type> >\t\tappend_type;\n public:\n typedef typename append_type::type::root \t\t\ttype;\n };\n} // namespace detail\n\n#define _GLIBCXX_TYPELIST_CHAIN1(X0) __gnu_cxx::typelist::chain<X0, __gnu_cxx::typelist::null_type>\n#define _GLIBCXX_TYPELIST_CHAIN2(X0, X1) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN1(X1) >\n#define _GLIBCXX_TYPELIST_CHAIN3(X0, X1, X2) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN2(X1, X2) >\n#define _GLIBCXX_TYPELIST_CHAIN4(X0, X1, X2, X3) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN3(X1, X2, X3) >\n#define _GLIBCXX_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN4(X1, X2, X3, X4) >\n#define _GLIBCXX_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >\n#define _GLIBCXX_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) >\n#define _GLIBCXX_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) >\n#define _GLIBCXX_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) >\n#define _GLIBCXX_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) >\n#define _GLIBCXX_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) >\n#define _GLIBCXX_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) >\n#define _GLIBCXX_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) >\n#define _GLIBCXX_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) >\n#define _GLIBCXX_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) >\n#define _GLIBCXX_TYPELIST_CHAIN16(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN15(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15) >\n#define _GLIBCXX_TYPELIST_CHAIN17(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN16(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16) >\n#define _GLIBCXX_TYPELIST_CHAIN18(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN17(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17) >\n#define _GLIBCXX_TYPELIST_CHAIN19(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN18(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18) >\n#define _GLIBCXX_TYPELIST_CHAIN20(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN19(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19) >\n\n template<typename Fn, typename Typelist>\n void\n apply(Fn& fn, Typelist)\n {\n detail::apply_<Fn, typename Typelist::root> a;\n a(fn);\n }\n\n template<typename Fn, typename Typelist>\n void\n apply_generator(Fn& fn, Typelist)\n {\n detail::apply_generator1_<Fn, typename Typelist::root> a;\n a(fn);\n }\n\n template<typename Fn, typename TypelistT, typename TypelistV>\n void\n apply_generator(Fn& fn, TypelistT, TypelistV)\n {\n typedef typename TypelistT::root rootT;\n typedef typename TypelistV::root rootV;\n detail::apply_generator2_<Fn, rootT, rootV> a;\n a(fn);\n }\n\n template<typename Typelist0, typename Typelist1>\n struct append\n {\n private:\n typedef typename Typelist0::root \t\t\t\troot0_type;\n typedef typename Typelist1::root \t\t\t\troot1_type;\n typedef detail::append_<root0_type, root1_type> \t\tappend_type;\n\n public:\n typedef node<typename append_type::type> \t\t\ttype;\n };\n\n template<typename Typelist_Typelist>\n struct append_typelist\n {\n private:\n typedef typename Typelist_Typelist::root \t\t \troot_type;\n typedef detail::append_typelist_<root_type> \t\tappend_type;\n\n public:\n typedef node<typename append_type::type> \t\t\ttype;\n };\n\n template<typename Typelist, typename T>\n struct contains\n {\n private:\n typedef typename Typelist::root \t\t\t\troot_type;\n\n public:\n enum\n\t{\n\t value = detail::contains_<root_type, T>::value\n\t};\n };\n\n template<typename Typelist, template<typename T> class Pred>\n struct filter\n {\n private:\n typedef typename Typelist::root \t\t\t\troot_type;\n typedef detail::chain_filter_<root_type, Pred> \t\tfilter_type;\n\n public:\n typedef node<typename filter_type::type> \t \t\ttype;\n };\n\n template<typename Typelist, int i>\n struct at_index\n {\n private:\n typedef typename Typelist::root \t\t\t\troot_type;\n typedef detail::chain_at_index_<root_type, i> \t\tindex_type;\n\n public:\n typedef typename index_type::type \t\t\ttype;\n };\n\n template<typename Typelist, template<typename T> class Transform>\n struct transform\n {\n private:\n typedef typename Typelist::root \t\t\t\troot_type;\n typedef detail::chain_transform_<root_type, Transform> \ttransform_type;\n\n public:\n typedef node<typename transform_type::type> \t\ttype;\n };\n\n template<typename Typelist_Typelist>\n struct flatten\n {\n private:\n typedef typename Typelist_Typelist::root \t\t \troot_type;\n typedef typename detail::chain_flatten_<root_type>::type \tflatten_type;\n\n public:\n typedef node<flatten_type> \t\t\t\ttype;\n };\n\n template<typename Typelist>\n struct from_first\n {\n private:\n typedef typename at_index<Typelist, 0>::type \t\tfirst_type;\n\n public:\n typedef node<chain<first_type, null_type> > \t\ttype;\n };\n\n template<typename T1>\n struct create1\n {\n typedef node<_GLIBCXX_TYPELIST_CHAIN1(T1)> \t\ttype;\n };\n\n template<typename T1, typename T2>\n struct create2\n {\n typedef node<_GLIBCXX_TYPELIST_CHAIN2(T1,T2)> \t\ttype;\n };\n\n template<typename T1, typename T2, typename T3>\n struct create3\n {\n typedef node<_GLIBCXX_TYPELIST_CHAIN3(T1,T2,T3)>\t\ttype;\n };\n\n template<typename T1, typename T2, typename T3, typename T4>\n struct create4\n {\n typedef node<_GLIBCXX_TYPELIST_CHAIN4(T1,T2,T3,T4)>\ttype;\n };\n\n template<typename T1, typename T2, typename T3,\n\t typename T4, typename T5>\n struct create5\n {\n typedef node<_GLIBCXX_TYPELIST_CHAIN5(T1,T2,T3,T4,T5)>\ttype;\n };\n\n template<typename T1, typename T2, typename T3,\n\t typename T4, typename T5, typename T6>\n struct create6\n {\n typedef node<_GLIBCXX_TYPELIST_CHAIN6(T1,T2,T3,T4,T5,T6)>\ttype;\n };\n} // namespace typelist\n_GLIBCXX_END_NAMESPACE_VERSION\n} // namespace\n\n\n#endif\n","include/bits/c++config.h":"#ifndef _AIBP_GLIBCXX_CXXCONFIG_H\n#define _AIBP_GLIBCXX_CXXCONFIG_H 1\n\n#define _GLIBCXX_VISIBILITY(V)\n#define _GLIBCXX_BEGIN_NAMESPACE_VERSION\n#define _GLIBCXX_END_NAMESPACE_VERSION\n#define _GLIBCXX_PSEUDO_VISIBILITY(V)\n#define _GLIBCXX_NOTHROW noexcept\n#define _GLIBCXX_NOEXCEPT noexcept\n#define _GLIBCXX_USE_NOEXCEPT noexcept\n#define _GLIBCXX_NOEXCEPT_IF(...) noexcept(__VA_ARGS__)\n#define _GLIBCXX_NOEXCEPT_PARM\n#define _GLIBCXX_NOEXCEPT_QUAL noexcept\n#define _GLIBCXX_CONSTEXPR constexpr\n#define _GLIBCXX_USE_CONSTEXPR constexpr\n#define _GLIBCXX14_CONSTEXPR constexpr\n#define _GLIBCXX17_CONSTEXPR constexpr\n#define _GLIBCXX20_CONSTEXPR constexpr\n#define _GLIBCXX23_CONSTEXPR constexpr\n#define _GLIBCXX17_INLINE inline\n#define _GLIBCXX_STD_A std\n#define _GLIBCXX_STD_C std\n#define _GLIBCXX_USE_ALLOC_NOEXCEPT\n#define _GLIBCXX_BEGIN_NAMESPACE_ALGO\n#define _GLIBCXX_END_NAMESPACE_ALGO\n#define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER\n#define _GLIBCXX_END_NAMESPACE_CONTAINER\n#define _GLIBCXX_BEGIN_NAMESPACE_LDBL\n#define _GLIBCXX_END_NAMESPACE_LDBL\n#define _GLIBCXX_BEGIN_EXTERN_C extern \"C\" {\n#define _GLIBCXX_END_EXTERN_C }\n#define __N(msgid) (msgid)\n#define _GLIBCXX_WEAK_DEFINITION\n#define _GLIBCXX_CONST\n#define _GLIBCXX_PURE\n#define _GLIBCXX_NORETURN __attribute__((__noreturn__))\n#define _GLIBCXX_NODISCARD\n#define _GLIBCXX_DEPRECATED\n#define _GLIBCXX_ABI_TAG_CXX11\n#define _GLIBCXX_NAMESPACE_CXX11\n#define _GLIBCXX_BEGIN_NAMESPACE_CXX11\n#define _GLIBCXX_END_NAMESPACE_CXX11\n#define _GLIBCXX_CAN_INLINE\n#ifndef _GLIBCXX_USE_ALLOCATOR_NEW\n#define _GLIBCXX_USE_ALLOCATOR_NEW 1\n#endif\n#define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)\n#define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)\n#if __cpp_exceptions\n#define __try try\n#define __catch(X) catch (X)\n#define __throw_exception_again throw\n#define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw(_EXC))\n#else\n#define __try if (true)\n#define __catch(X) if (false)\n#define __throw_exception_again\n#define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort())\n#endif\n#define __glibcxx_assert(cond)\n#define _GLIBCXX_DEBUG_ASSERT(cond)\n#define _GLIBCXX_DEBUG_ONLY(expr)\n\n#endif\n","include/debug/debug.h":"#pragma once\n\n#define _GLIBCXX_DEBUG_ASSERT(x)\n#define _GLIBCXX_DEBUG_PEDASSERT(x)\n#define _GLIBCXX_DEBUG_ONLY(expr)\n#define __glibcxx_check_valid_range(a, b)\n#define __glibcxx_requires_valid_range(a, b)\n","include/tr1/functional":"#pragma once\n\n#include <functional>\n\nnamespace std {\nnamespace tr1 {\nusing std::hash;\nusing std::equal_to;\n} // namespace tr1\n} // namespace std\n","include/tr1/type_traits":"#pragma once\n\n#include <type_traits>\n\nnamespace std {\nnamespace tr1 {\nusing std::is_same;\nusing std::is_const;\nusing std::is_pointer;\nusing std::is_reference;\nusing std::is_fundamental;\nusing std::is_member_object_pointer;\nusing std::is_member_pointer;\nusing std::is_base_of;\nusing std::remove_const;\nusing std::remove_reference;\nusing std::integral_constant;\nusing std::true_type;\nusing std::false_type;\n} // namespace tr1\n} // namespace std\n","include/atcoder/all":"#include \"atcoder/convolution\"\n#include \"atcoder/dsu\"\n#include \"atcoder/fenwicktree\"\n#include \"atcoder/lazysegtree\"\n#include \"atcoder/math\"\n#include \"atcoder/maxflow\"\n#include \"atcoder/mincostflow\"\n#include \"atcoder/modint\"\n#include \"atcoder/scc\"\n#include \"atcoder/segtree\"\n#include \"atcoder/string\"\n#include \"atcoder/twosat\"\n","include/atcoder/convolution":"#ifndef ATCODER_CONVOLUTION_HPP\n#define ATCODER_CONVOLUTION_HPP 1\n\n#include <algorithm>\n#include <array>\n#include <cassert>\n#include <type_traits>\n#include <vector>\n\n#include \"atcoder/internal_bit\"\n#include \"atcoder/modint\"\n\nnamespace atcoder {\n\nnamespace internal {\n\ntemplate <class mint,\n int g = internal::primitive_root<mint::mod()>,\n internal::is_static_modint_t<mint>* = nullptr>\nstruct fft_info {\n static constexpr int rank2 = countr_zero_constexpr(mint::mod() - 1);\n std::array<mint, rank2 + 1> root; // root[i]^(2^i) == 1\n std::array<mint, rank2 + 1> iroot; // root[i] * iroot[i] == 1\n\n std::array<mint, std::max(0, rank2 - 2 + 1)> rate2;\n std::array<mint, std::max(0, rank2 - 2 + 1)> irate2;\n\n std::array<mint, std::max(0, rank2 - 3 + 1)> rate3;\n std::array<mint, std::max(0, rank2 - 3 + 1)> irate3;\n\n fft_info() {\n root[rank2] = mint(g).pow((mint::mod() - 1) >> rank2);\n iroot[rank2] = root[rank2].inv();\n for (int i = rank2 - 1; i >= 0; i--) {\n root[i] = root[i + 1] * root[i + 1];\n iroot[i] = iroot[i + 1] * iroot[i + 1];\n }\n\n {\n mint prod = 1, iprod = 1;\n for (int i = 0; i <= rank2 - 2; i++) {\n rate2[i] = root[i + 2] * prod;\n irate2[i] = iroot[i + 2] * iprod;\n prod *= iroot[i + 2];\n iprod *= root[i + 2];\n }\n }\n {\n mint prod = 1, iprod = 1;\n for (int i = 0; i <= rank2 - 3; i++) {\n rate3[i] = root[i + 3] * prod;\n irate3[i] = iroot[i + 3] * iprod;\n prod *= iroot[i + 3];\n iprod *= root[i + 3];\n }\n }\n }\n};\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nvoid butterfly(std::vector<mint>& a) {\n int n = int(a.size());\n int h = internal::countr_zero((unsigned int)n);\n\n static const fft_info<mint> info;\n\n int len = 0; // a[i, i+(n>>len), i+2*(n>>len), ..] is transformed\n while (len < h) {\n if (h - len == 1) {\n int p = 1 << (h - len - 1);\n mint rot = 1;\n for (int s = 0; s < (1 << len); s++) {\n int offset = s << (h - len);\n for (int i = 0; i < p; i++) {\n auto l = a[i + offset];\n auto r = a[i + offset + p] * rot;\n a[i + offset] = l + r;\n a[i + offset + p] = l - r;\n }\n if (s + 1 != (1 << len))\n rot *= info.rate2[countr_zero(~(unsigned int)(s))];\n }\n len++;\n } else {\n // 4-base\n int p = 1 << (h - len - 2);\n mint rot = 1, imag = info.root[2];\n for (int s = 0; s < (1 << len); s++) {\n mint rot2 = rot * rot;\n mint rot3 = rot2 * rot;\n int offset = s << (h - len);\n for (int i = 0; i < p; i++) {\n auto mod2 = 1ULL * mint::mod() * mint::mod();\n auto a0 = 1ULL * a[i + offset].val();\n auto a1 = 1ULL * a[i + offset + p].val() * rot.val();\n auto a2 = 1ULL * a[i + offset + 2 * p].val() * rot2.val();\n auto a3 = 1ULL * a[i + offset + 3 * p].val() * rot3.val();\n auto a1na3imag =\n 1ULL * mint(a1 + mod2 - a3).val() * imag.val();\n auto na2 = mod2 - a2;\n a[i + offset] = a0 + a2 + a1 + a3;\n a[i + offset + 1 * p] = a0 + a2 + (2 * mod2 - (a1 + a3));\n a[i + offset + 2 * p] = a0 + na2 + a1na3imag;\n a[i + offset + 3 * p] = a0 + na2 + (mod2 - a1na3imag);\n }\n if (s + 1 != (1 << len))\n rot *= info.rate3[countr_zero(~(unsigned int)(s))];\n }\n len += 2;\n }\n }\n}\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nvoid butterfly_inv(std::vector<mint>& a) {\n int n = int(a.size());\n int h = internal::countr_zero((unsigned int)n);\n\n static const fft_info<mint> info;\n\n int len = h; // a[i, i+(n>>len), i+2*(n>>len), ..] is transformed\n while (len) {\n if (len == 1) {\n int p = 1 << (h - len);\n mint irot = 1;\n for (int s = 0; s < (1 << (len - 1)); s++) {\n int offset = s << (h - len + 1);\n for (int i = 0; i < p; i++) {\n auto l = a[i + offset];\n auto r = a[i + offset + p];\n a[i + offset] = l + r;\n a[i + offset + p] =\n (unsigned long long)((unsigned int)(l.val() - r.val()) + mint::mod()) *\n irot.val();\n ;\n }\n if (s + 1 != (1 << (len - 1)))\n irot *= info.irate2[countr_zero(~(unsigned int)(s))];\n }\n len--;\n } else {\n // 4-base\n int p = 1 << (h - len);\n mint irot = 1, iimag = info.iroot[2];\n for (int s = 0; s < (1 << (len - 2)); s++) {\n mint irot2 = irot * irot;\n mint irot3 = irot2 * irot;\n int offset = s << (h - len + 2);\n for (int i = 0; i < p; i++) {\n auto a0 = 1ULL * a[i + offset + 0 * p].val();\n auto a1 = 1ULL * a[i + offset + 1 * p].val();\n auto a2 = 1ULL * a[i + offset + 2 * p].val();\n auto a3 = 1ULL * a[i + offset + 3 * p].val();\n\n auto a2na3iimag =\n 1ULL *\n mint((mint::mod() + a2 - a3) * iimag.val()).val();\n\n a[i + offset] = a0 + a1 + a2 + a3;\n a[i + offset + 1 * p] =\n (a0 + (mint::mod() - a1) + a2na3iimag) * irot.val();\n a[i + offset + 2 * p] =\n (a0 + a1 + (mint::mod() - a2) + (mint::mod() - a3)) *\n irot2.val();\n a[i + offset + 3 * p] =\n (a0 + (mint::mod() - a1) + (mint::mod() - a2na3iimag)) *\n irot3.val();\n }\n if (s + 1 != (1 << (len - 2)))\n irot *= info.irate3[countr_zero(~(unsigned int)(s))];\n }\n len -= 2;\n }\n }\n}\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nstd::vector<mint> convolution_naive(const std::vector<mint>& a,\n const std::vector<mint>& b) {\n int n = int(a.size()), m = int(b.size());\n std::vector<mint> ans(n + m - 1);\n if (n < m) {\n for (int j = 0; j < m; j++) {\n for (int i = 0; i < n; i++) {\n ans[i + j] += a[i] * b[j];\n }\n }\n } else {\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n ans[i + j] += a[i] * b[j];\n }\n }\n }\n return ans;\n}\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nstd::vector<mint> convolution_fft(std::vector<mint> a, std::vector<mint> b) {\n int n = int(a.size()), m = int(b.size());\n int z = (int)internal::bit_ceil((unsigned int)(n + m - 1));\n a.resize(z);\n internal::butterfly(a);\n b.resize(z);\n internal::butterfly(b);\n for (int i = 0; i < z; i++) {\n a[i] *= b[i];\n }\n internal::butterfly_inv(a);\n a.resize(n + m - 1);\n mint iz = mint(z).inv();\n for (int i = 0; i < n + m - 1; i++) a[i] *= iz;\n return a;\n}\n\n} // namespace internal\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nstd::vector<mint> convolution(std::vector<mint>&& a, std::vector<mint>&& b) {\n int n = int(a.size()), m = int(b.size());\n if (!n || !m) return {};\n\n int z = (int)internal::bit_ceil((unsigned int)(n + m - 1));\n assert((mint::mod() - 1) % z == 0);\n\n if (std::min(n, m) <= 60) return convolution_naive(std::move(a), std::move(b));\n return internal::convolution_fft(std::move(a), std::move(b));\n}\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nstd::vector<mint> convolution(const std::vector<mint>& a,\n const std::vector<mint>& b) {\n int n = int(a.size()), m = int(b.size());\n if (!n || !m) return {};\n\n int z = (int)internal::bit_ceil((unsigned int)(n + m - 1));\n assert((mint::mod() - 1) % z == 0);\n\n if (std::min(n, m) <= 60) return convolution_naive(a, b);\n return internal::convolution_fft(a, b);\n}\n\ntemplate <unsigned int mod = 998244353,\n class T,\n std::enable_if_t<internal::is_integral<T>::value>* = nullptr>\nstd::vector<T> convolution(const std::vector<T>& a, const std::vector<T>& b) {\n int n = int(a.size()), m = int(b.size());\n if (!n || !m) return {};\n\n using mint = static_modint<mod>;\n\n int z = (int)internal::bit_ceil((unsigned int)(n + m - 1));\n assert((mint::mod() - 1) % z == 0);\n\n std::vector<mint> a2(n), b2(m);\n for (int i = 0; i < n; i++) {\n a2[i] = mint(a[i]);\n }\n for (int i = 0; i < m; i++) {\n b2[i] = mint(b[i]);\n }\n auto c2 = convolution(std::move(a2), std::move(b2));\n std::vector<T> c(n + m - 1);\n for (int i = 0; i < n + m - 1; i++) {\n c[i] = c2[i].val();\n }\n return c;\n}\n\nstd::vector<long long> convolution_ll(const std::vector<long long>& a,\n const std::vector<long long>& b) {\n int n = int(a.size()), m = int(b.size());\n if (!n || !m) return {};\n\n static constexpr unsigned long long MOD1 = 754974721; // 2^24\n static constexpr unsigned long long MOD2 = 167772161; // 2^25\n static constexpr unsigned long long MOD3 = 469762049; // 2^26\n static constexpr unsigned long long M2M3 = MOD2 * MOD3;\n static constexpr unsigned long long M1M3 = MOD1 * MOD3;\n static constexpr unsigned long long M1M2 = MOD1 * MOD2;\n static constexpr unsigned long long M1M2M3 = MOD1 * MOD2 * MOD3;\n\n static constexpr unsigned long long i1 =\n internal::inv_gcd(MOD2 * MOD3, MOD1).second;\n static constexpr unsigned long long i2 =\n internal::inv_gcd(MOD1 * MOD3, MOD2).second;\n static constexpr unsigned long long i3 =\n internal::inv_gcd(MOD1 * MOD2, MOD3).second;\n \n static constexpr int MAX_AB_BIT = 24;\n static_assert(MOD1 % (1ull << MAX_AB_BIT) == 1, \"MOD1 isn't enough to support an array length of 2^24.\");\n static_assert(MOD2 % (1ull << MAX_AB_BIT) == 1, \"MOD2 isn't enough to support an array length of 2^24.\");\n static_assert(MOD3 % (1ull << MAX_AB_BIT) == 1, \"MOD3 isn't enough to support an array length of 2^24.\");\n assert(n + m - 1 <= (1 << MAX_AB_BIT));\n\n auto c1 = convolution<MOD1>(a, b);\n auto c2 = convolution<MOD2>(a, b);\n auto c3 = convolution<MOD3>(a, b);\n\n std::vector<long long> c(n + m - 1);\n for (int i = 0; i < n + m - 1; i++) {\n unsigned long long x = 0;\n x += (c1[i] * i1) % MOD1 * M2M3;\n x += (c2[i] * i2) % MOD2 * M1M3;\n x += (c3[i] * i3) % MOD3 * M1M2;\n // B = 2^63, -B <= x, r(real value) < B\n // (x, x - M, x - 2M, or x - 3M) = r (mod 2B)\n // r = c1[i] (mod MOD1)\n // focus on MOD1\n // r = x, x - M', x - 2M', x - 3M' (M' = M % 2^64) (mod 2B)\n // r = x,\n // x - M' + (0 or 2B),\n // x - 2M' + (0, 2B or 4B),\n // x - 3M' + (0, 2B, 4B or 6B) (without mod!)\n // (r - x) = 0, (0)\n // - M' + (0 or 2B), (1)\n // -2M' + (0 or 2B or 4B), (2)\n // -3M' + (0 or 2B or 4B or 6B) (3) (mod MOD1)\n // we checked that\n // ((1) mod MOD1) mod 5 = 2\n // ((2) mod MOD1) mod 5 = 3\n // ((3) mod MOD1) mod 5 = 4\n long long diff =\n c1[i] - internal::safe_mod((long long)(x), (long long)(MOD1));\n if (diff < 0) diff += MOD1;\n static constexpr unsigned long long offset[5] = {\n 0, 0, M1M2M3, 2 * M1M2M3, 3 * M1M2M3};\n x -= offset[diff % 5];\n c[i] = x;\n }\n\n return c;\n}\n\n} // namespace atcoder\n\n#endif // ATCODER_CONVOLUTION_HPP\n","include/atcoder/convolution.hpp":"#ifndef ATCODER_CONVOLUTION_HPP\n#define ATCODER_CONVOLUTION_HPP 1\n\n#include <algorithm>\n#include <array>\n#include <cassert>\n#include <type_traits>\n#include <vector>\n\n#include \"atcoder/internal_bit\"\n#include \"atcoder/modint\"\n\nnamespace atcoder {\n\nnamespace internal {\n\ntemplate <class mint,\n int g = internal::primitive_root<mint::mod()>,\n internal::is_static_modint_t<mint>* = nullptr>\nstruct fft_info {\n static constexpr int rank2 = countr_zero_constexpr(mint::mod() - 1);\n std::array<mint, rank2 + 1> root; // root[i]^(2^i) == 1\n std::array<mint, rank2 + 1> iroot; // root[i] * iroot[i] == 1\n\n std::array<mint, std::max(0, rank2 - 2 + 1)> rate2;\n std::array<mint, std::max(0, rank2 - 2 + 1)> irate2;\n\n std::array<mint, std::max(0, rank2 - 3 + 1)> rate3;\n std::array<mint, std::max(0, rank2 - 3 + 1)> irate3;\n\n fft_info() {\n root[rank2] = mint(g).pow((mint::mod() - 1) >> rank2);\n iroot[rank2] = root[rank2].inv();\n for (int i = rank2 - 1; i >= 0; i--) {\n root[i] = root[i + 1] * root[i + 1];\n iroot[i] = iroot[i + 1] * iroot[i + 1];\n }\n\n {\n mint prod = 1, iprod = 1;\n for (int i = 0; i <= rank2 - 2; i++) {\n rate2[i] = root[i + 2] * prod;\n irate2[i] = iroot[i + 2] * iprod;\n prod *= iroot[i + 2];\n iprod *= root[i + 2];\n }\n }\n {\n mint prod = 1, iprod = 1;\n for (int i = 0; i <= rank2 - 3; i++) {\n rate3[i] = root[i + 3] * prod;\n irate3[i] = iroot[i + 3] * iprod;\n prod *= iroot[i + 3];\n iprod *= root[i + 3];\n }\n }\n }\n};\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nvoid butterfly(std::vector<mint>& a) {\n int n = int(a.size());\n int h = internal::countr_zero((unsigned int)n);\n\n static const fft_info<mint> info;\n\n int len = 0; // a[i, i+(n>>len), i+2*(n>>len), ..] is transformed\n while (len < h) {\n if (h - len == 1) {\n int p = 1 << (h - len - 1);\n mint rot = 1;\n for (int s = 0; s < (1 << len); s++) {\n int offset = s << (h - len);\n for (int i = 0; i < p; i++) {\n auto l = a[i + offset];\n auto r = a[i + offset + p] * rot;\n a[i + offset] = l + r;\n a[i + offset + p] = l - r;\n }\n if (s + 1 != (1 << len))\n rot *= info.rate2[countr_zero(~(unsigned int)(s))];\n }\n len++;\n } else {\n // 4-base\n int p = 1 << (h - len - 2);\n mint rot = 1, imag = info.root[2];\n for (int s = 0; s < (1 << len); s++) {\n mint rot2 = rot * rot;\n mint rot3 = rot2 * rot;\n int offset = s << (h - len);\n for (int i = 0; i < p; i++) {\n auto mod2 = 1ULL * mint::mod() * mint::mod();\n auto a0 = 1ULL * a[i + offset].val();\n auto a1 = 1ULL * a[i + offset + p].val() * rot.val();\n auto a2 = 1ULL * a[i + offset + 2 * p].val() * rot2.val();\n auto a3 = 1ULL * a[i + offset + 3 * p].val() * rot3.val();\n auto a1na3imag =\n 1ULL * mint(a1 + mod2 - a3).val() * imag.val();\n auto na2 = mod2 - a2;\n a[i + offset] = a0 + a2 + a1 + a3;\n a[i + offset + 1 * p] = a0 + a2 + (2 * mod2 - (a1 + a3));\n a[i + offset + 2 * p] = a0 + na2 + a1na3imag;\n a[i + offset + 3 * p] = a0 + na2 + (mod2 - a1na3imag);\n }\n if (s + 1 != (1 << len))\n rot *= info.rate3[countr_zero(~(unsigned int)(s))];\n }\n len += 2;\n }\n }\n}\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nvoid butterfly_inv(std::vector<mint>& a) {\n int n = int(a.size());\n int h = internal::countr_zero((unsigned int)n);\n\n static const fft_info<mint> info;\n\n int len = h; // a[i, i+(n>>len), i+2*(n>>len), ..] is transformed\n while (len) {\n if (len == 1) {\n int p = 1 << (h - len);\n mint irot = 1;\n for (int s = 0; s < (1 << (len - 1)); s++) {\n int offset = s << (h - len + 1);\n for (int i = 0; i < p; i++) {\n auto l = a[i + offset];\n auto r = a[i + offset + p];\n a[i + offset] = l + r;\n a[i + offset + p] =\n (unsigned long long)((unsigned int)(l.val() - r.val()) + mint::mod()) *\n irot.val();\n ;\n }\n if (s + 1 != (1 << (len - 1)))\n irot *= info.irate2[countr_zero(~(unsigned int)(s))];\n }\n len--;\n } else {\n // 4-base\n int p = 1 << (h - len);\n mint irot = 1, iimag = info.iroot[2];\n for (int s = 0; s < (1 << (len - 2)); s++) {\n mint irot2 = irot * irot;\n mint irot3 = irot2 * irot;\n int offset = s << (h - len + 2);\n for (int i = 0; i < p; i++) {\n auto a0 = 1ULL * a[i + offset + 0 * p].val();\n auto a1 = 1ULL * a[i + offset + 1 * p].val();\n auto a2 = 1ULL * a[i + offset + 2 * p].val();\n auto a3 = 1ULL * a[i + offset + 3 * p].val();\n\n auto a2na3iimag =\n 1ULL *\n mint((mint::mod() + a2 - a3) * iimag.val()).val();\n\n a[i + offset] = a0 + a1 + a2 + a3;\n a[i + offset + 1 * p] =\n (a0 + (mint::mod() - a1) + a2na3iimag) * irot.val();\n a[i + offset + 2 * p] =\n (a0 + a1 + (mint::mod() - a2) + (mint::mod() - a3)) *\n irot2.val();\n a[i + offset + 3 * p] =\n (a0 + (mint::mod() - a1) + (mint::mod() - a2na3iimag)) *\n irot3.val();\n }\n if (s + 1 != (1 << (len - 2)))\n irot *= info.irate3[countr_zero(~(unsigned int)(s))];\n }\n len -= 2;\n }\n }\n}\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nstd::vector<mint> convolution_naive(const std::vector<mint>& a,\n const std::vector<mint>& b) {\n int n = int(a.size()), m = int(b.size());\n std::vector<mint> ans(n + m - 1);\n if (n < m) {\n for (int j = 0; j < m; j++) {\n for (int i = 0; i < n; i++) {\n ans[i + j] += a[i] * b[j];\n }\n }\n } else {\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n ans[i + j] += a[i] * b[j];\n }\n }\n }\n return ans;\n}\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nstd::vector<mint> convolution_fft(std::vector<mint> a, std::vector<mint> b) {\n int n = int(a.size()), m = int(b.size());\n int z = (int)internal::bit_ceil((unsigned int)(n + m - 1));\n a.resize(z);\n internal::butterfly(a);\n b.resize(z);\n internal::butterfly(b);\n for (int i = 0; i < z; i++) {\n a[i] *= b[i];\n }\n internal::butterfly_inv(a);\n a.resize(n + m - 1);\n mint iz = mint(z).inv();\n for (int i = 0; i < n + m - 1; i++) a[i] *= iz;\n return a;\n}\n\n} // namespace internal\n\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nstd::vector<mint> convolution(std::vector<mint>&& a, std::vector<mint>&& b) {\n int n = int(a.size()), m = int(b.size());\n if (!n || !m) return {};\n\n int z = (int)internal::bit_ceil((unsigned int)(n + m - 1));\n assert((mint::mod() - 1) % z == 0);\n\n if (std::min(n, m) <= 60) return convolution_naive(std::move(a), std::move(b));\n return internal::convolution_fft(std::move(a), std::move(b));\n}\ntemplate <class mint, internal::is_static_modint_t<mint>* = nullptr>\nstd::vector<mint> convolution(const std::vector<mint>& a,\n const std::vector<mint>& b) {\n int n = int(a.size()), m = int(b.size());\n if (!n || !m) return {};\n\n int z = (int)internal::bit_ceil((unsigned int)(n + m - 1));\n assert((mint::mod() - 1) % z == 0);\n\n if (std::min(n, m) <= 60) return convolution_naive(a, b);\n return internal::convolution_fft(a, b);\n}\n\ntemplate <unsigned int mod = 998244353,\n class T,\n std::enable_if_t<internal::is_integral<T>::value>* = nullptr>\nstd::vector<T> convolution(const std::vector<T>& a, const std::vector<T>& b) {\n int n = int(a.size()), m = int(b.size());\n if (!n || !m) return {};\n\n using mint = static_modint<mod>;\n\n int z = (int)internal::bit_ceil((unsigned int)(n + m - 1));\n assert((mint::mod() - 1) % z == 0);\n\n std::vector<mint> a2(n), b2(m);\n for (int i = 0; i < n; i++) {\n a2[i] = mint(a[i]);\n }\n for (int i = 0; i < m; i++) {\n b2[i] = mint(b[i]);\n }\n auto c2 = convolution(std::move(a2), std::move(b2));\n std::vector<T> c(n + m - 1);\n for (int i = 0; i < n + m - 1; i++) {\n c[i] = c2[i].val();\n }\n return c;\n}\n\nstd::vector<long long> convolution_ll(const std::vector<long long>& a,\n const std::vector<long long>& b) {\n int n = int(a.size()), m = int(b.size());\n if (!n || !m) return {};\n\n static constexpr unsigned long long MOD1 = 754974721; // 2^24\n static constexpr unsigned long long MOD2 = 167772161; // 2^25\n static constexpr unsigned long long MOD3 = 469762049; // 2^26\n static constexpr unsigned long long M2M3 = MOD2 * MOD3;\n static constexpr unsigned long long M1M3 = MOD1 * MOD3;\n static constexpr unsigned long long M1M2 = MOD1 * MOD2;\n static constexpr unsigned long long M1M2M3 = MOD1 * MOD2 * MOD3;\n\n static constexpr unsigned long long i1 =\n internal::inv_gcd(MOD2 * MOD3, MOD1).second;\n static constexpr unsigned long long i2 =\n internal::inv_gcd(MOD1 * MOD3, MOD2).second;\n static constexpr unsigned long long i3 =\n internal::inv_gcd(MOD1 * MOD2, MOD3).second;\n \n static constexpr int MAX_AB_BIT = 24;\n static_assert(MOD1 % (1ull << MAX_AB_BIT) == 1, \"MOD1 isn't enough to support an array length of 2^24.\");\n static_assert(MOD2 % (1ull << MAX_AB_BIT) == 1, \"MOD2 isn't enough to support an array length of 2^24.\");\n static_assert(MOD3 % (1ull << MAX_AB_BIT) == 1, \"MOD3 isn't enough to support an array length of 2^24.\");\n assert(n + m - 1 <= (1 << MAX_AB_BIT));\n\n auto c1 = convolution<MOD1>(a, b);\n auto c2 = convolution<MOD2>(a, b);\n auto c3 = convolution<MOD3>(a, b);\n\n std::vector<long long> c(n + m - 1);\n for (int i = 0; i < n + m - 1; i++) {\n unsigned long long x = 0;\n x += (c1[i] * i1) % MOD1 * M2M3;\n x += (c2[i] * i2) % MOD2 * M1M3;\n x += (c3[i] * i3) % MOD3 * M1M2;\n // B = 2^63, -B <= x, r(real value) < B\n // (x, x - M, x - 2M, or x - 3M) = r (mod 2B)\n // r = c1[i] (mod MOD1)\n // focus on MOD1\n // r = x, x - M', x - 2M', x - 3M' (M' = M % 2^64) (mod 2B)\n // r = x,\n // x - M' + (0 or 2B),\n // x - 2M' + (0, 2B or 4B),\n // x - 3M' + (0, 2B, 4B or 6B) (without mod!)\n // (r - x) = 0, (0)\n // - M' + (0 or 2B), (1)\n // -2M' + (0 or 2B or 4B), (2)\n // -3M' + (0 or 2B or 4B or 6B) (3) (mod MOD1)\n // we checked that\n // ((1) mod MOD1) mod 5 = 2\n // ((2) mod MOD1) mod 5 = 3\n // ((3) mod MOD1) mod 5 = 4\n long long diff =\n c1[i] - internal::safe_mod((long long)(x), (long long)(MOD1));\n if (diff < 0) diff += MOD1;\n static constexpr unsigned long long offset[5] = {\n 0, 0, M1M2M3, 2 * M1M2M3, 3 * M1M2M3};\n x -= offset[diff % 5];\n c[i] = x;\n }\n\n return c;\n}\n\n} // namespace atcoder\n\n#endif // ATCODER_CONVOLUTION_HPP\n","include/atcoder/dsu":"#ifndef ATCODER_DSU_HPP\n#define ATCODER_DSU_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <vector>\n\nnamespace atcoder {\n\n// Implement (union by size) + (path compression)\n// Reference:\n// Zvi Galil and Giuseppe F. Italiano,\n// Data structures and algorithms for disjoint set union problems\nstruct dsu {\n public:\n dsu() : _n(0) {}\n explicit dsu(int n) : _n(n), parent_or_size(n, -1) {}\n\n int merge(int a, int b) {\n assert(0 <= a && a < _n);\n assert(0 <= b && b < _n);\n int x = leader(a), y = leader(b);\n if (x == y) return x;\n if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);\n parent_or_size[x] += parent_or_size[y];\n parent_or_size[y] = x;\n return x;\n }\n\n bool same(int a, int b) {\n assert(0 <= a && a < _n);\n assert(0 <= b && b < _n);\n return leader(a) == leader(b);\n }\n\n int leader(int a) {\n assert(0 <= a && a < _n);\n return _leader(a);\n }\n\n int size(int a) {\n assert(0 <= a && a < _n);\n return -parent_or_size[leader(a)];\n }\n\n std::vector<std::vector<int>> groups() {\n std::vector<int> leader_buf(_n), group_size(_n);\n for (int i = 0; i < _n; i++) {\n leader_buf[i] = leader(i);\n group_size[leader_buf[i]]++;\n }\n std::vector<std::vector<int>> result(_n);\n for (int i = 0; i < _n; i++) {\n result[i].reserve(group_size[i]);\n }\n for (int i = 0; i < _n; i++) {\n result[leader_buf[i]].push_back(i);\n }\n result.erase(\n std::remove_if(result.begin(), result.end(),\n [&](const std::vector<int>& v) { return v.empty(); }),\n result.end());\n return result;\n }\n\n private:\n int _n;\n // root node: -1 * component size\n // otherwise: parent\n std::vector<int> parent_or_size;\n\n int _leader(int a) {\n if (parent_or_size[a] < 0) return a;\n return parent_or_size[a] = _leader(parent_or_size[a]);\n }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_DSU_HPP\n","include/atcoder/dsu.hpp":"#ifndef ATCODER_DSU_HPP\n#define ATCODER_DSU_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <vector>\n\nnamespace atcoder {\n\n// Implement (union by size) + (path compression)\n// Reference:\n// Zvi Galil and Giuseppe F. Italiano,\n// Data structures and algorithms for disjoint set union problems\nstruct dsu {\n public:\n dsu() : _n(0) {}\n explicit dsu(int n) : _n(n), parent_or_size(n, -1) {}\n\n int merge(int a, int b) {\n assert(0 <= a && a < _n);\n assert(0 <= b && b < _n);\n int x = leader(a), y = leader(b);\n if (x == y) return x;\n if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);\n parent_or_size[x] += parent_or_size[y];\n parent_or_size[y] = x;\n return x;\n }\n\n bool same(int a, int b) {\n assert(0 <= a && a < _n);\n assert(0 <= b && b < _n);\n return leader(a) == leader(b);\n }\n\n int leader(int a) {\n assert(0 <= a && a < _n);\n return _leader(a);\n }\n\n int size(int a) {\n assert(0 <= a && a < _n);\n return -parent_or_size[leader(a)];\n }\n\n std::vector<std::vector<int>> groups() {\n std::vector<int> leader_buf(_n), group_size(_n);\n for (int i = 0; i < _n; i++) {\n leader_buf[i] = leader(i);\n group_size[leader_buf[i]]++;\n }\n std::vector<std::vector<int>> result(_n);\n for (int i = 0; i < _n; i++) {\n result[i].reserve(group_size[i]);\n }\n for (int i = 0; i < _n; i++) {\n result[leader_buf[i]].push_back(i);\n }\n result.erase(\n std::remove_if(result.begin(), result.end(),\n [&](const std::vector<int>& v) { return v.empty(); }),\n result.end());\n return result;\n }\n\n private:\n int _n;\n // root node: -1 * component size\n // otherwise: parent\n std::vector<int> parent_or_size;\n\n int _leader(int a) {\n if (parent_or_size[a] < 0) return a;\n return parent_or_size[a] = _leader(parent_or_size[a]);\n }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_DSU_HPP\n","include/atcoder/fenwicktree":"#ifndef ATCODER_FENWICKTREE_HPP\n#define ATCODER_FENWICKTREE_HPP 1\n\n#include <cassert>\n#include <vector>\n\n#include \"atcoder/internal_type_traits\"\n\nnamespace atcoder {\n\n// Reference: https://en.wikipedia.org/wiki/Fenwick_tree\ntemplate <class T> struct fenwick_tree {\n using U = internal::to_unsigned_t<T>;\n\n public:\n fenwick_tree() : _n(0) {}\n explicit fenwick_tree(int n) : _n(n), data(n) {}\n\n void add(int p, T x) {\n assert(0 <= p && p < _n);\n p++;\n while (p <= _n) {\n data[p - 1] += U(x);\n p += p & -p;\n }\n }\n\n T sum(int l, int r) {\n assert(0 <= l && l <= r && r <= _n);\n return sum(r) - sum(l);\n }\n\n private:\n int _n;\n std::vector<U> data;\n\n U sum(int r) {\n U s = 0;\n while (r > 0) {\n s += data[r - 1];\n r -= r & -r;\n }\n return s;\n }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_FENWICKTREE_HPP\n","include/atcoder/fenwicktree.hpp":"#ifndef ATCODER_FENWICKTREE_HPP\n#define ATCODER_FENWICKTREE_HPP 1\n\n#include <cassert>\n#include <vector>\n\n#include \"atcoder/internal_type_traits\"\n\nnamespace atcoder {\n\n// Reference: https://en.wikipedia.org/wiki/Fenwick_tree\ntemplate <class T> struct fenwick_tree {\n using U = internal::to_unsigned_t<T>;\n\n public:\n fenwick_tree() : _n(0) {}\n explicit fenwick_tree(int n) : _n(n), data(n) {}\n\n void add(int p, T x) {\n assert(0 <= p && p < _n);\n p++;\n while (p <= _n) {\n data[p - 1] += U(x);\n p += p & -p;\n }\n }\n\n T sum(int l, int r) {\n assert(0 <= l && l <= r && r <= _n);\n return sum(r) - sum(l);\n }\n\n private:\n int _n;\n std::vector<U> data;\n\n U sum(int r) {\n U s = 0;\n while (r > 0) {\n s += data[r - 1];\n r -= r & -r;\n }\n return s;\n }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_FENWICKTREE_HPP\n","include/atcoder/internal_bit":"#ifndef ATCODER_INTERNAL_BITOP_HPP\n#define ATCODER_INTERNAL_BITOP_HPP 1\n\n#ifdef _MSC_VER\n#include <intrin.h>\n#endif\n\n#if __cplusplus >= 202002L\n#include <bit>\n#endif\n\nnamespace atcoder {\n\nnamespace internal {\n\n#if __cplusplus >= 202002L\n\nusing std::bit_ceil;\n\n#else\n\n// @return same with std::bit::bit_ceil\nunsigned int bit_ceil(unsigned int n) {\n unsigned int x = 1;\n while (x < (unsigned int)(n)) x *= 2;\n return x;\n}\n\n#endif\n\n// @param n `1 <= n`\n// @return same with std::bit::countr_zero\nint countr_zero(unsigned int n) {\n#ifdef _MSC_VER\n unsigned long index;\n _BitScanForward(&index, n);\n return index;\n#else\n return __builtin_ctz(n);\n#endif\n}\n\n// @param n `1 <= n`\n// @return same with std::bit::countr_zero\nconstexpr int countr_zero_constexpr(unsigned int n) {\n int x = 0;\n while (!(n & (1 << x))) x++;\n return x;\n}\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_BITOP_HPP\n","include/atcoder/internal_bit.hpp":"#ifndef ATCODER_INTERNAL_BITOP_HPP\n#define ATCODER_INTERNAL_BITOP_HPP 1\n\n#ifdef _MSC_VER\n#include <intrin.h>\n#endif\n\n#if __cplusplus >= 202002L\n#include <bit>\n#endif\n\nnamespace atcoder {\n\nnamespace internal {\n\n#if __cplusplus >= 202002L\n\nusing std::bit_ceil;\n\n#else\n\n// @return same with std::bit::bit_ceil\nunsigned int bit_ceil(unsigned int n) {\n unsigned int x = 1;\n while (x < (unsigned int)(n)) x *= 2;\n return x;\n}\n\n#endif\n\n// @param n `1 <= n`\n// @return same with std::bit::countr_zero\nint countr_zero(unsigned int n) {\n#ifdef _MSC_VER\n unsigned long index;\n _BitScanForward(&index, n);\n return index;\n#else\n return __builtin_ctz(n);\n#endif\n}\n\n// @param n `1 <= n`\n// @return same with std::bit::countr_zero\nconstexpr int countr_zero_constexpr(unsigned int n) {\n int x = 0;\n while (!(n & (1 << x))) x++;\n return x;\n}\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_BITOP_HPP\n","include/atcoder/internal_csr":"#ifndef ATCODER_INTERNAL_CSR_HPP\n#define ATCODER_INTERNAL_CSR_HPP 1\n\n#include <algorithm>\n#include <utility>\n#include <vector>\n\nnamespace atcoder {\nnamespace internal {\n\ntemplate <class E> struct csr {\n std::vector<int> start;\n std::vector<E> elist;\n explicit csr(int n, const std::vector<std::pair<int, E>>& edges)\n : start(n + 1), elist(edges.size()) {\n for (auto e : edges) {\n start[e.first + 1]++;\n }\n for (int i = 1; i <= n; i++) {\n start[i] += start[i - 1];\n }\n auto counter = start;\n for (auto e : edges) {\n elist[counter[e.first]++] = e.second;\n }\n }\n};\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_CSR_HPP\n","include/atcoder/internal_csr.hpp":"#ifndef ATCODER_INTERNAL_CSR_HPP\n#define ATCODER_INTERNAL_CSR_HPP 1\n\n#include <algorithm>\n#include <utility>\n#include <vector>\n\nnamespace atcoder {\nnamespace internal {\n\ntemplate <class E> struct csr {\n std::vector<int> start;\n std::vector<E> elist;\n explicit csr(int n, const std::vector<std::pair<int, E>>& edges)\n : start(n + 1), elist(edges.size()) {\n for (auto e : edges) {\n start[e.first + 1]++;\n }\n for (int i = 1; i <= n; i++) {\n start[i] += start[i - 1];\n }\n auto counter = start;\n for (auto e : edges) {\n elist[counter[e.first]++] = e.second;\n }\n }\n};\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_CSR_HPP\n","include/atcoder/internal_math":"#ifndef ATCODER_INTERNAL_MATH_HPP\n#define ATCODER_INTERNAL_MATH_HPP 1\n\n#include <utility>\n\n#ifdef _MSC_VER\n#include <intrin.h>\n#endif\n\nnamespace atcoder {\n\nnamespace internal {\n\n// @param m `1 <= m`\n// @return x mod m\nconstexpr long long safe_mod(long long x, long long m) {\n x %= m;\n if (x < 0) x += m;\n return x;\n}\n\n// Fast modular multiplication by barrett reduction\n// Reference: https://en.wikipedia.org/wiki/Barrett_reduction\n// NOTE: reconsider after Ice Lake\nstruct barrett {\n unsigned int _m;\n unsigned long long im;\n\n // @param m `1 <= m`\n explicit barrett(unsigned int m) : _m(m), im((unsigned long long)(-1) / m + 1) {}\n\n // @return m\n unsigned int umod() const { return _m; }\n\n // @param a `0 <= a < m`\n // @param b `0 <= b < m`\n // @return `a * b % m`\n unsigned int mul(unsigned int a, unsigned int b) const {\n // [1] m = 1\n // a = b = im = 0, so okay\n\n // [2] m >= 2\n // im = ceil(2^64 / m)\n // -> im * m = 2^64 + r (0 <= r < m)\n // let z = a*b = c*m + d (0 <= c, d < m)\n // a*b * im = (c*m + d) * im = c*(im*m) + d*im = c*2^64 + c*r + d*im\n // c*r + d*im < m * m + m * im < m * m + 2^64 + m <= 2^64 + m * (m + 1) < 2^64 * 2\n // ((ab * im) >> 64) == c or c + 1\n unsigned long long z = a;\n z *= b;\n#ifdef _MSC_VER\n unsigned long long x;\n _umul128(z, im, &x);\n#else\n unsigned long long x =\n (unsigned long long)(((unsigned __int128)(z)*im) >> 64);\n#endif\n unsigned long long y = x * _m;\n return (unsigned int)(z - y + (z < y ? _m : 0));\n }\n};\n\n// @param n `0 <= n`\n// @param m `1 <= m`\n// @return `(x ** n) % m`\nconstexpr long long pow_mod_constexpr(long long x, long long n, int m) {\n if (m == 1) return 0;\n unsigned int _m = (unsigned int)(m);\n unsigned long long r = 1;\n unsigned long long y = safe_mod(x, m);\n while (n) {\n if (n & 1) r = (r * y) % _m;\n y = (y * y) % _m;\n n >>= 1;\n }\n return r;\n}\n\n// Reference:\n// M. Forisek and J. Jancina,\n// Fast Primality Testing for Integers That Fit into a Machine Word\n// @param n `0 <= n`\nconstexpr bool is_prime_constexpr(int n) {\n if (n <= 1) return false;\n if (n == 2 || n == 7 || n == 61) return true;\n if (n % 2 == 0) return false;\n long long d = n - 1;\n while (d % 2 == 0) d /= 2;\n constexpr long long bases[3] = {2, 7, 61};\n for (long long a : bases) {\n long long t = d;\n long long y = pow_mod_constexpr(a, t, n);\n while (t != n - 1 && y != 1 && y != n - 1) {\n y = y * y % n;\n t <<= 1;\n }\n if (y != n - 1 && t % 2 == 0) {\n return false;\n }\n }\n return true;\n}\ntemplate <int n> constexpr bool is_prime = is_prime_constexpr(n);\n\n// @param b `1 <= b`\n// @return pair(g, x) s.t. g = gcd(a, b), xa = g (mod b), 0 <= x < b/g\nconstexpr std::pair<long long, long long> inv_gcd(long long a, long long b) {\n a = safe_mod(a, b);\n if (a == 0) return {b, 0};\n\n // Contracts:\n // [1] s - m0 * a = 0 (mod b)\n // [2] t - m1 * a = 0 (mod b)\n // [3] s * |m1| + t * |m0| <= b\n long long s = b, t = a;\n long long m0 = 0, m1 = 1;\n\n while (t) {\n long long u = s / t;\n s -= t * u;\n m0 -= m1 * u; // |m1 * u| <= |m1| * s <= b\n\n // [3]:\n // (s - t * u) * |m1| + t * |m0 - m1 * u|\n // <= s * |m1| - t * u * |m1| + t * (|m0| + |m1| * u)\n // = s * |m1| + t * |m0| <= b\n\n auto tmp = s;\n s = t;\n t = tmp;\n tmp = m0;\n m0 = m1;\n m1 = tmp;\n }\n // by [3]: |m0| <= b/g\n // by g != b: |m0| < b/g\n if (m0 < 0) m0 += b / s;\n return {s, m0};\n}\n\n// Compile time primitive root\n// @param m must be prime\n// @return primitive root (and minimum in now)\nconstexpr int primitive_root_constexpr(int m) {\n if (m == 2) return 1;\n if (m == 167772161) return 3;\n if (m == 469762049) return 3;\n if (m == 754974721) return 11;\n if (m == 998244353) return 3;\n int divs[20] = {};\n divs[0] = 2;\n int cnt = 1;\n int x = (m - 1) / 2;\n while (x % 2 == 0) x /= 2;\n for (int i = 3; (long long)(i)*i <= x; i += 2) {\n if (x % i == 0) {\n divs[cnt++] = i;\n while (x % i == 0) {\n x /= i;\n }\n }\n }\n if (x > 1) {\n divs[cnt++] = x;\n }\n for (int g = 2;; g++) {\n bool ok = true;\n for (int i = 0; i < cnt; i++) {\n if (pow_mod_constexpr(g, (m - 1) / divs[i], m) == 1) {\n ok = false;\n break;\n }\n }\n if (ok) return g;\n }\n}\ntemplate <int m> constexpr int primitive_root = primitive_root_constexpr(m);\n\n// @param n `n < 2^32`\n// @param m `1 <= m < 2^32`\n// @return sum_{i=0}^{n-1} floor((ai + b) / m) (mod 2^64)\nunsigned long long floor_sum_unsigned(unsigned long long n,\n unsigned long long m,\n unsigned long long a,\n unsigned long long b) {\n unsigned long long ans = 0;\n while (true) {\n if (a >= m) {\n ans += n * (n - 1) / 2 * (a / m);\n a %= m;\n }\n if (b >= m) {\n ans += n * (b / m);\n b %= m;\n }\n\n unsigned long long y_max = a * n + b;\n if (y_max < m) break;\n // y_max < m * (n + 1)\n // floor(y_max / m) <= n\n n = (unsigned long long)(y_max / m);\n b = (unsigned long long)(y_max % m);\n std::swap(m, a);\n }\n return ans;\n}\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_MATH_HPP\n","include/atcoder/internal_math.hpp":"#ifndef ATCODER_INTERNAL_MATH_HPP\n#define ATCODER_INTERNAL_MATH_HPP 1\n\n#include <utility>\n\n#ifdef _MSC_VER\n#include <intrin.h>\n#endif\n\nnamespace atcoder {\n\nnamespace internal {\n\n// @param m `1 <= m`\n// @return x mod m\nconstexpr long long safe_mod(long long x, long long m) {\n x %= m;\n if (x < 0) x += m;\n return x;\n}\n\n// Fast modular multiplication by barrett reduction\n// Reference: https://en.wikipedia.org/wiki/Barrett_reduction\n// NOTE: reconsider after Ice Lake\nstruct barrett {\n unsigned int _m;\n unsigned long long im;\n\n // @param m `1 <= m`\n explicit barrett(unsigned int m) : _m(m), im((unsigned long long)(-1) / m + 1) {}\n\n // @return m\n unsigned int umod() const { return _m; }\n\n // @param a `0 <= a < m`\n // @param b `0 <= b < m`\n // @return `a * b % m`\n unsigned int mul(unsigned int a, unsigned int b) const {\n // [1] m = 1\n // a = b = im = 0, so okay\n\n // [2] m >= 2\n // im = ceil(2^64 / m)\n // -> im * m = 2^64 + r (0 <= r < m)\n // let z = a*b = c*m + d (0 <= c, d < m)\n // a*b * im = (c*m + d) * im = c*(im*m) + d*im = c*2^64 + c*r + d*im\n // c*r + d*im < m * m + m * im < m * m + 2^64 + m <= 2^64 + m * (m + 1) < 2^64 * 2\n // ((ab * im) >> 64) == c or c + 1\n unsigned long long z = a;\n z *= b;\n#ifdef _MSC_VER\n unsigned long long x;\n _umul128(z, im, &x);\n#else\n unsigned long long x =\n (unsigned long long)(((unsigned __int128)(z)*im) >> 64);\n#endif\n unsigned long long y = x * _m;\n return (unsigned int)(z - y + (z < y ? _m : 0));\n }\n};\n\n// @param n `0 <= n`\n// @param m `1 <= m`\n// @return `(x ** n) % m`\nconstexpr long long pow_mod_constexpr(long long x, long long n, int m) {\n if (m == 1) return 0;\n unsigned int _m = (unsigned int)(m);\n unsigned long long r = 1;\n unsigned long long y = safe_mod(x, m);\n while (n) {\n if (n & 1) r = (r * y) % _m;\n y = (y * y) % _m;\n n >>= 1;\n }\n return r;\n}\n\n// Reference:\n// M. Forisek and J. Jancina,\n// Fast Primality Testing for Integers That Fit into a Machine Word\n// @param n `0 <= n`\nconstexpr bool is_prime_constexpr(int n) {\n if (n <= 1) return false;\n if (n == 2 || n == 7 || n == 61) return true;\n if (n % 2 == 0) return false;\n long long d = n - 1;\n while (d % 2 == 0) d /= 2;\n constexpr long long bases[3] = {2, 7, 61};\n for (long long a : bases) {\n long long t = d;\n long long y = pow_mod_constexpr(a, t, n);\n while (t != n - 1 && y != 1 && y != n - 1) {\n y = y * y % n;\n t <<= 1;\n }\n if (y != n - 1 && t % 2 == 0) {\n return false;\n }\n }\n return true;\n}\ntemplate <int n> constexpr bool is_prime = is_prime_constexpr(n);\n\n// @param b `1 <= b`\n// @return pair(g, x) s.t. g = gcd(a, b), xa = g (mod b), 0 <= x < b/g\nconstexpr std::pair<long long, long long> inv_gcd(long long a, long long b) {\n a = safe_mod(a, b);\n if (a == 0) return {b, 0};\n\n // Contracts:\n // [1] s - m0 * a = 0 (mod b)\n // [2] t - m1 * a = 0 (mod b)\n // [3] s * |m1| + t * |m0| <= b\n long long s = b, t = a;\n long long m0 = 0, m1 = 1;\n\n while (t) {\n long long u = s / t;\n s -= t * u;\n m0 -= m1 * u; // |m1 * u| <= |m1| * s <= b\n\n // [3]:\n // (s - t * u) * |m1| + t * |m0 - m1 * u|\n // <= s * |m1| - t * u * |m1| + t * (|m0| + |m1| * u)\n // = s * |m1| + t * |m0| <= b\n\n auto tmp = s;\n s = t;\n t = tmp;\n tmp = m0;\n m0 = m1;\n m1 = tmp;\n }\n // by [3]: |m0| <= b/g\n // by g != b: |m0| < b/g\n if (m0 < 0) m0 += b / s;\n return {s, m0};\n}\n\n// Compile time primitive root\n// @param m must be prime\n// @return primitive root (and minimum in now)\nconstexpr int primitive_root_constexpr(int m) {\n if (m == 2) return 1;\n if (m == 167772161) return 3;\n if (m == 469762049) return 3;\n if (m == 754974721) return 11;\n if (m == 998244353) return 3;\n int divs[20] = {};\n divs[0] = 2;\n int cnt = 1;\n int x = (m - 1) / 2;\n while (x % 2 == 0) x /= 2;\n for (int i = 3; (long long)(i)*i <= x; i += 2) {\n if (x % i == 0) {\n divs[cnt++] = i;\n while (x % i == 0) {\n x /= i;\n }\n }\n }\n if (x > 1) {\n divs[cnt++] = x;\n }\n for (int g = 2;; g++) {\n bool ok = true;\n for (int i = 0; i < cnt; i++) {\n if (pow_mod_constexpr(g, (m - 1) / divs[i], m) == 1) {\n ok = false;\n break;\n }\n }\n if (ok) return g;\n }\n}\ntemplate <int m> constexpr int primitive_root = primitive_root_constexpr(m);\n\n// @param n `n < 2^32`\n// @param m `1 <= m < 2^32`\n// @return sum_{i=0}^{n-1} floor((ai + b) / m) (mod 2^64)\nunsigned long long floor_sum_unsigned(unsigned long long n,\n unsigned long long m,\n unsigned long long a,\n unsigned long long b) {\n unsigned long long ans = 0;\n while (true) {\n if (a >= m) {\n ans += n * (n - 1) / 2 * (a / m);\n a %= m;\n }\n if (b >= m) {\n ans += n * (b / m);\n b %= m;\n }\n\n unsigned long long y_max = a * n + b;\n if (y_max < m) break;\n // y_max < m * (n + 1)\n // floor(y_max / m) <= n\n n = (unsigned long long)(y_max / m);\n b = (unsigned long long)(y_max % m);\n std::swap(m, a);\n }\n return ans;\n}\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_MATH_HPP\n","include/atcoder/internal_queue":"#ifndef ATCODER_INTERNAL_QUEUE_HPP\n#define ATCODER_INTERNAL_QUEUE_HPP 1\n\n#include <vector>\n\nnamespace atcoder {\n\nnamespace internal {\n\ntemplate <class T> struct simple_queue {\n std::vector<T> payload;\n int pos = 0;\n void reserve(int n) { payload.reserve(n); }\n int size() const { return int(payload.size()) - pos; }\n bool empty() const { return pos == int(payload.size()); }\n void push(const T& t) { payload.push_back(t); }\n T& front() { return payload[pos]; }\n void clear() {\n payload.clear();\n pos = 0;\n }\n void pop() { pos++; }\n};\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_QUEUE_HPP\n","include/atcoder/internal_queue.hpp":"#ifndef ATCODER_INTERNAL_QUEUE_HPP\n#define ATCODER_INTERNAL_QUEUE_HPP 1\n\n#include <vector>\n\nnamespace atcoder {\n\nnamespace internal {\n\ntemplate <class T> struct simple_queue {\n std::vector<T> payload;\n int pos = 0;\n void reserve(int n) { payload.reserve(n); }\n int size() const { return int(payload.size()) - pos; }\n bool empty() const { return pos == int(payload.size()); }\n void push(const T& t) { payload.push_back(t); }\n T& front() { return payload[pos]; }\n void clear() {\n payload.clear();\n pos = 0;\n }\n void pop() { pos++; }\n};\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_QUEUE_HPP\n","include/atcoder/internal_scc":"#ifndef ATCODER_INTERNAL_SCC_HPP\n#define ATCODER_INTERNAL_SCC_HPP 1\n\n#include <algorithm>\n#include <utility>\n#include <vector>\n\n#include \"atcoder/internal_csr\"\n\nnamespace atcoder {\nnamespace internal {\n\n// Reference:\n// R. Tarjan,\n// Depth-First Search and Linear Graph Algorithms\nstruct scc_graph {\n public:\n explicit scc_graph(int n) : _n(n) {}\n\n int num_vertices() { return _n; }\n\n void add_edge(int from, int to) { edges.push_back({from, {to}}); }\n\n // @return pair of (# of scc, scc id)\n std::pair<int, std::vector<int>> scc_ids() {\n auto g = csr<edge>(_n, edges);\n int now_ord = 0, group_num = 0;\n std::vector<int> visited, low(_n), ord(_n, -1), ids(_n);\n visited.reserve(_n);\n auto dfs = [&](auto self, int v) -> void {\n low[v] = ord[v] = now_ord++;\n visited.push_back(v);\n for (int i = g.start[v]; i < g.start[v + 1]; i++) {\n auto to = g.elist[i].to;\n if (ord[to] == -1) {\n self(self, to);\n low[v] = std::min(low[v], low[to]);\n } else {\n low[v] = std::min(low[v], ord[to]);\n }\n }\n if (low[v] == ord[v]) {\n while (true) {\n int u = visited.back();\n visited.pop_back();\n ord[u] = _n;\n ids[u] = group_num;\n if (u == v) break;\n }\n group_num++;\n }\n };\n for (int i = 0; i < _n; i++) {\n if (ord[i] == -1) dfs(dfs, i);\n }\n for (auto& x : ids) {\n x = group_num - 1 - x;\n }\n return {group_num, ids};\n }\n\n std::vector<std::vector<int>> scc() {\n auto ids = scc_ids();\n int group_num = ids.first;\n std::vector<int> counts(group_num);\n for (auto x : ids.second) counts[x]++;\n std::vector<std::vector<int>> groups(ids.first);\n for (int i = 0; i < group_num; i++) {\n groups[i].reserve(counts[i]);\n }\n for (int i = 0; i < _n; i++) {\n groups[ids.second[i]].push_back(i);\n }\n return groups;\n }\n\n private:\n int _n;\n struct edge {\n int to;\n };\n std::vector<std::pair<int, edge>> edges;\n};\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_SCC_HPP\n","include/atcoder/internal_scc.hpp":"#ifndef ATCODER_INTERNAL_SCC_HPP\n#define ATCODER_INTERNAL_SCC_HPP 1\n\n#include <algorithm>\n#include <utility>\n#include <vector>\n\n#include \"atcoder/internal_csr\"\n\nnamespace atcoder {\nnamespace internal {\n\n// Reference:\n// R. Tarjan,\n// Depth-First Search and Linear Graph Algorithms\nstruct scc_graph {\n public:\n explicit scc_graph(int n) : _n(n) {}\n\n int num_vertices() { return _n; }\n\n void add_edge(int from, int to) { edges.push_back({from, {to}}); }\n\n // @return pair of (# of scc, scc id)\n std::pair<int, std::vector<int>> scc_ids() {\n auto g = csr<edge>(_n, edges);\n int now_ord = 0, group_num = 0;\n std::vector<int> visited, low(_n), ord(_n, -1), ids(_n);\n visited.reserve(_n);\n auto dfs = [&](auto self, int v) -> void {\n low[v] = ord[v] = now_ord++;\n visited.push_back(v);\n for (int i = g.start[v]; i < g.start[v + 1]; i++) {\n auto to = g.elist[i].to;\n if (ord[to] == -1) {\n self(self, to);\n low[v] = std::min(low[v], low[to]);\n } else {\n low[v] = std::min(low[v], ord[to]);\n }\n }\n if (low[v] == ord[v]) {\n while (true) {\n int u = visited.back();\n visited.pop_back();\n ord[u] = _n;\n ids[u] = group_num;\n if (u == v) break;\n }\n group_num++;\n }\n };\n for (int i = 0; i < _n; i++) {\n if (ord[i] == -1) dfs(dfs, i);\n }\n for (auto& x : ids) {\n x = group_num - 1 - x;\n }\n return {group_num, ids};\n }\n\n std::vector<std::vector<int>> scc() {\n auto ids = scc_ids();\n int group_num = ids.first;\n std::vector<int> counts(group_num);\n for (auto x : ids.second) counts[x]++;\n std::vector<std::vector<int>> groups(ids.first);\n for (int i = 0; i < group_num; i++) {\n groups[i].reserve(counts[i]);\n }\n for (int i = 0; i < _n; i++) {\n groups[ids.second[i]].push_back(i);\n }\n return groups;\n }\n\n private:\n int _n;\n struct edge {\n int to;\n };\n std::vector<std::pair<int, edge>> edges;\n};\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_SCC_HPP\n","include/atcoder/internal_type_traits":"#ifndef ATCODER_INTERNAL_TYPE_TRAITS_HPP\n#define ATCODER_INTERNAL_TYPE_TRAITS_HPP 1\n\n#include <cassert>\n#include <numeric>\n#include <type_traits>\n\nnamespace atcoder {\n\nnamespace internal {\n\n#ifndef _MSC_VER\ntemplate <class T>\nusing is_signed_int128 =\n typename std::conditional<std::is_same<T, __int128_t>::value ||\n std::is_same<T, __int128>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing is_unsigned_int128 =\n typename std::conditional<std::is_same<T, __uint128_t>::value ||\n std::is_same<T, unsigned __int128>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing make_unsigned_int128 =\n typename std::conditional<std::is_same<T, __int128_t>::value,\n __uint128_t,\n unsigned __int128>;\n\ntemplate <class T>\nusing is_integral = typename std::conditional<std::is_integral<T>::value ||\n is_signed_int128<T>::value ||\n is_unsigned_int128<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing is_signed_int = typename std::conditional<(is_integral<T>::value &&\n std::is_signed<T>::value) ||\n is_signed_int128<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing is_unsigned_int =\n typename std::conditional<(is_integral<T>::value &&\n std::is_unsigned<T>::value) ||\n is_unsigned_int128<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing to_unsigned = typename std::conditional<\n is_signed_int128<T>::value,\n make_unsigned_int128<T>,\n typename std::conditional<std::is_signed<T>::value,\n std::make_unsigned<T>,\n std::common_type<T>>::type>::type;\n\n#else\n\ntemplate <class T> using is_integral = typename std::is_integral<T>;\n\ntemplate <class T>\nusing is_signed_int =\n typename std::conditional<is_integral<T>::value && std::is_signed<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing is_unsigned_int =\n typename std::conditional<is_integral<T>::value &&\n std::is_unsigned<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing to_unsigned = typename std::conditional<is_signed_int<T>::value,\n std::make_unsigned<T>,\n std::common_type<T>>::type;\n\n#endif\n\ntemplate <class T>\nusing is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;\n\ntemplate <class T>\nusing is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;\n\ntemplate <class T> using to_unsigned_t = typename to_unsigned<T>::type;\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_TYPE_TRAITS_HPP\n","include/atcoder/internal_type_traits.hpp":"#ifndef ATCODER_INTERNAL_TYPE_TRAITS_HPP\n#define ATCODER_INTERNAL_TYPE_TRAITS_HPP 1\n\n#include <cassert>\n#include <numeric>\n#include <type_traits>\n\nnamespace atcoder {\n\nnamespace internal {\n\n#ifndef _MSC_VER\ntemplate <class T>\nusing is_signed_int128 =\n typename std::conditional<std::is_same<T, __int128_t>::value ||\n std::is_same<T, __int128>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing is_unsigned_int128 =\n typename std::conditional<std::is_same<T, __uint128_t>::value ||\n std::is_same<T, unsigned __int128>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing make_unsigned_int128 =\n typename std::conditional<std::is_same<T, __int128_t>::value,\n __uint128_t,\n unsigned __int128>;\n\ntemplate <class T>\nusing is_integral = typename std::conditional<std::is_integral<T>::value ||\n is_signed_int128<T>::value ||\n is_unsigned_int128<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing is_signed_int = typename std::conditional<(is_integral<T>::value &&\n std::is_signed<T>::value) ||\n is_signed_int128<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing is_unsigned_int =\n typename std::conditional<(is_integral<T>::value &&\n std::is_unsigned<T>::value) ||\n is_unsigned_int128<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing to_unsigned = typename std::conditional<\n is_signed_int128<T>::value,\n make_unsigned_int128<T>,\n typename std::conditional<std::is_signed<T>::value,\n std::make_unsigned<T>,\n std::common_type<T>>::type>::type;\n\n#else\n\ntemplate <class T> using is_integral = typename std::is_integral<T>;\n\ntemplate <class T>\nusing is_signed_int =\n typename std::conditional<is_integral<T>::value && std::is_signed<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing is_unsigned_int =\n typename std::conditional<is_integral<T>::value &&\n std::is_unsigned<T>::value,\n std::true_type,\n std::false_type>::type;\n\ntemplate <class T>\nusing to_unsigned = typename std::conditional<is_signed_int<T>::value,\n std::make_unsigned<T>,\n std::common_type<T>>::type;\n\n#endif\n\ntemplate <class T>\nusing is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;\n\ntemplate <class T>\nusing is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;\n\ntemplate <class T> using to_unsigned_t = typename to_unsigned<T>::type;\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_INTERNAL_TYPE_TRAITS_HPP\n","include/atcoder/lazysegtree":"#ifndef ATCODER_LAZYSEGTREE_HPP\n#define ATCODER_LAZYSEGTREE_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <functional>\n#include <vector>\n\n#include \"atcoder/internal_bit\"\n\nnamespace atcoder {\n\n#if __cplusplus >= 201703L\n\ntemplate <class S,\n auto op,\n auto e,\n class F,\n auto mapping,\n auto composition,\n auto id>\nstruct lazy_segtree {\n static_assert(std::is_convertible_v<decltype(op), std::function<S(S, S)>>,\n \"op must work as S(S, S)\");\n static_assert(std::is_convertible_v<decltype(e), std::function<S()>>,\n \"e must work as S()\");\n static_assert(\n std::is_convertible_v<decltype(mapping), std::function<S(F, S)>>,\n \"mapping must work as S(F, S)\");\n static_assert(\n std::is_convertible_v<decltype(composition), std::function<F(F, F)>>,\n \"composition must work as F(F, F)\");\n static_assert(std::is_convertible_v<decltype(id), std::function<F()>>,\n \"id must work as F()\");\n\n#else\n\ntemplate <class S,\n S (*op)(S, S),\n S (*e)(),\n class F,\n S (*mapping)(F, S),\n F (*composition)(F, F),\n F (*id)()>\nstruct lazy_segtree {\n\n#endif\n\n public:\n lazy_segtree() : lazy_segtree(0) {}\n explicit lazy_segtree(int n) : lazy_segtree(std::vector<S>(n, e())) {}\n explicit lazy_segtree(const std::vector<S>& v) : _n(int(v.size())) {\n size = (int)internal::bit_ceil((unsigned int)(_n));\n log = internal::countr_zero((unsigned int)size);\n d = std::vector<S>(2 * size, e());\n lz = std::vector<F>(size, id());\n for (int i = 0; i < _n; i++) d[size + i] = v[i];\n for (int i = size - 1; i >= 1; i--) {\n update(i);\n }\n }\n\n void set(int p, S x) {\n assert(0 <= p && p < _n);\n p += size;\n for (int i = log; i >= 1; i--) push(p >> i);\n d[p] = x;\n for (int i = 1; i <= log; i++) update(p >> i);\n }\n\n S get(int p) {\n assert(0 <= p && p < _n);\n p += size;\n for (int i = log; i >= 1; i--) push(p >> i);\n return d[p];\n }\n\n S prod(int l, int r) {\n assert(0 <= l && l <= r && r <= _n);\n if (l == r) return e();\n\n l += size;\n r += size;\n\n for (int i = log; i >= 1; i--) {\n if (((l >> i) << i) != l) push(l >> i);\n if (((r >> i) << i) != r) push((r - 1) >> i);\n }\n\n S sml = e(), smr = e();\n while (l < r) {\n if (l & 1) sml = op(sml, d[l++]);\n if (r & 1) smr = op(d[--r], smr);\n l >>= 1;\n r >>= 1;\n }\n\n return op(sml, smr);\n }\n\n S all_prod() { return d[1]; }\n\n void apply(int p, F f) {\n assert(0 <= p && p < _n);\n p += size;\n for (int i = log; i >= 1; i--) push(p >> i);\n d[p] = mapping(f, d[p]);\n for (int i = 1; i <= log; i++) update(p >> i);\n }\n void apply(int l, int r, F f) {\n assert(0 <= l && l <= r && r <= _n);\n if (l == r) return;\n\n l += size;\n r += size;\n\n for (int i = log; i >= 1; i--) {\n if (((l >> i) << i) != l) push(l >> i);\n if (((r >> i) << i) != r) push((r - 1) >> i);\n }\n\n {\n int l2 = l, r2 = r;\n while (l < r) {\n if (l & 1) all_apply(l++, f);\n if (r & 1) all_apply(--r, f);\n l >>= 1;\n r >>= 1;\n }\n l = l2;\n r = r2;\n }\n\n for (int i = 1; i <= log; i++) {\n if (((l >> i) << i) != l) update(l >> i);\n if (((r >> i) << i) != r) update((r - 1) >> i);\n }\n }\n\n template <bool (*g)(S)> int max_right(int l) {\n return max_right(l, [](S x) { return g(x); });\n }\n template <class G> int max_right(int l, G g) {\n assert(0 <= l && l <= _n);\n assert(g(e()));\n if (l == _n) return _n;\n l += size;\n for (int i = log; i >= 1; i--) push(l >> i);\n S sm = e();\n do {\n while (l % 2 == 0) l >>= 1;\n if (!g(op(sm, d[l]))) {\n while (l < size) {\n push(l);\n l = (2 * l);\n if (g(op(sm, d[l]))) {\n sm = op(sm, d[l]);\n l++;\n }\n }\n return l - size;\n }\n sm = op(sm, d[l]);\n l++;\n } while ((l & -l) != l);\n return _n;\n }\n\n template <bool (*g)(S)> int min_left(int r) {\n return min_left(r, [](S x) { return g(x); });\n }\n template <class G> int min_left(int r, G g) {\n assert(0 <= r && r <= _n);\n assert(g(e()));\n if (r == 0) return 0;\n r += size;\n for (int i = log; i >= 1; i--) push((r - 1) >> i);\n S sm = e();\n do {\n r--;\n while (r > 1 && (r % 2)) r >>= 1;\n if (!g(op(d[r], sm))) {\n while (r < size) {\n push(r);\n r = (2 * r + 1);\n if (g(op(d[r], sm))) {\n sm = op(d[r], sm);\n r--;\n }\n }\n return r + 1 - size;\n }\n sm = op(d[r], sm);\n } while ((r & -r) != r);\n return 0;\n }\n\n private:\n int _n, size, log;\n std::vector<S> d;\n std::vector<F> lz;\n\n void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }\n void all_apply(int k, F f) {\n d[k] = mapping(f, d[k]);\n if (k < size) lz[k] = composition(f, lz[k]);\n }\n void push(int k) {\n all_apply(2 * k, lz[k]);\n all_apply(2 * k + 1, lz[k]);\n lz[k] = id();\n }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_LAZYSEGTREE_HPP\n","include/atcoder/lazysegtree.hpp":"#ifndef ATCODER_LAZYSEGTREE_HPP\n#define ATCODER_LAZYSEGTREE_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <functional>\n#include <vector>\n\n#include \"atcoder/internal_bit\"\n\nnamespace atcoder {\n\n#if __cplusplus >= 201703L\n\ntemplate <class S,\n auto op,\n auto e,\n class F,\n auto mapping,\n auto composition,\n auto id>\nstruct lazy_segtree {\n static_assert(std::is_convertible_v<decltype(op), std::function<S(S, S)>>,\n \"op must work as S(S, S)\");\n static_assert(std::is_convertible_v<decltype(e), std::function<S()>>,\n \"e must work as S()\");\n static_assert(\n std::is_convertible_v<decltype(mapping), std::function<S(F, S)>>,\n \"mapping must work as S(F, S)\");\n static_assert(\n std::is_convertible_v<decltype(composition), std::function<F(F, F)>>,\n \"composition must work as F(F, F)\");\n static_assert(std::is_convertible_v<decltype(id), std::function<F()>>,\n \"id must work as F()\");\n\n#else\n\ntemplate <class S,\n S (*op)(S, S),\n S (*e)(),\n class F,\n S (*mapping)(F, S),\n F (*composition)(F, F),\n F (*id)()>\nstruct lazy_segtree {\n\n#endif\n\n public:\n lazy_segtree() : lazy_segtree(0) {}\n explicit lazy_segtree(int n) : lazy_segtree(std::vector<S>(n, e())) {}\n explicit lazy_segtree(const std::vector<S>& v) : _n(int(v.size())) {\n size = (int)internal::bit_ceil((unsigned int)(_n));\n log = internal::countr_zero((unsigned int)size);\n d = std::vector<S>(2 * size, e());\n lz = std::vector<F>(size, id());\n for (int i = 0; i < _n; i++) d[size + i] = v[i];\n for (int i = size - 1; i >= 1; i--) {\n update(i);\n }\n }\n\n void set(int p, S x) {\n assert(0 <= p && p < _n);\n p += size;\n for (int i = log; i >= 1; i--) push(p >> i);\n d[p] = x;\n for (int i = 1; i <= log; i++) update(p >> i);\n }\n\n S get(int p) {\n assert(0 <= p && p < _n);\n p += size;\n for (int i = log; i >= 1; i--) push(p >> i);\n return d[p];\n }\n\n S prod(int l, int r) {\n assert(0 <= l && l <= r && r <= _n);\n if (l == r) return e();\n\n l += size;\n r += size;\n\n for (int i = log; i >= 1; i--) {\n if (((l >> i) << i) != l) push(l >> i);\n if (((r >> i) << i) != r) push((r - 1) >> i);\n }\n\n S sml = e(), smr = e();\n while (l < r) {\n if (l & 1) sml = op(sml, d[l++]);\n if (r & 1) smr = op(d[--r], smr);\n l >>= 1;\n r >>= 1;\n }\n\n return op(sml, smr);\n }\n\n S all_prod() { return d[1]; }\n\n void apply(int p, F f) {\n assert(0 <= p && p < _n);\n p += size;\n for (int i = log; i >= 1; i--) push(p >> i);\n d[p] = mapping(f, d[p]);\n for (int i = 1; i <= log; i++) update(p >> i);\n }\n void apply(int l, int r, F f) {\n assert(0 <= l && l <= r && r <= _n);\n if (l == r) return;\n\n l += size;\n r += size;\n\n for (int i = log; i >= 1; i--) {\n if (((l >> i) << i) != l) push(l >> i);\n if (((r >> i) << i) != r) push((r - 1) >> i);\n }\n\n {\n int l2 = l, r2 = r;\n while (l < r) {\n if (l & 1) all_apply(l++, f);\n if (r & 1) all_apply(--r, f);\n l >>= 1;\n r >>= 1;\n }\n l = l2;\n r = r2;\n }\n\n for (int i = 1; i <= log; i++) {\n if (((l >> i) << i) != l) update(l >> i);\n if (((r >> i) << i) != r) update((r - 1) >> i);\n }\n }\n\n template <bool (*g)(S)> int max_right(int l) {\n return max_right(l, [](S x) { return g(x); });\n }\n template <class G> int max_right(int l, G g) {\n assert(0 <= l && l <= _n);\n assert(g(e()));\n if (l == _n) return _n;\n l += size;\n for (int i = log; i >= 1; i--) push(l >> i);\n S sm = e();\n do {\n while (l % 2 == 0) l >>= 1;\n if (!g(op(sm, d[l]))) {\n while (l < size) {\n push(l);\n l = (2 * l);\n if (g(op(sm, d[l]))) {\n sm = op(sm, d[l]);\n l++;\n }\n }\n return l - size;\n }\n sm = op(sm, d[l]);\n l++;\n } while ((l & -l) != l);\n return _n;\n }\n\n template <bool (*g)(S)> int min_left(int r) {\n return min_left(r, [](S x) { return g(x); });\n }\n template <class G> int min_left(int r, G g) {\n assert(0 <= r && r <= _n);\n assert(g(e()));\n if (r == 0) return 0;\n r += size;\n for (int i = log; i >= 1; i--) push((r - 1) >> i);\n S sm = e();\n do {\n r--;\n while (r > 1 && (r % 2)) r >>= 1;\n if (!g(op(d[r], sm))) {\n while (r < size) {\n push(r);\n r = (2 * r + 1);\n if (g(op(d[r], sm))) {\n sm = op(d[r], sm);\n r--;\n }\n }\n return r + 1 - size;\n }\n sm = op(d[r], sm);\n } while ((r & -r) != r);\n return 0;\n }\n\n private:\n int _n, size, log;\n std::vector<S> d;\n std::vector<F> lz;\n\n void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }\n void all_apply(int k, F f) {\n d[k] = mapping(f, d[k]);\n if (k < size) lz[k] = composition(f, lz[k]);\n }\n void push(int k) {\n all_apply(2 * k, lz[k]);\n all_apply(2 * k + 1, lz[k]);\n lz[k] = id();\n }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_LAZYSEGTREE_HPP\n","include/atcoder/math":"#ifndef ATCODER_MATH_HPP\n#define ATCODER_MATH_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <tuple>\n#include <vector>\n\n#include \"atcoder/internal_math\"\n\nnamespace atcoder {\n\nlong long pow_mod(long long x, long long n, int m) {\n assert(0 <= n && 1 <= m);\n if (m == 1) return 0;\n internal::barrett bt((unsigned int)(m));\n unsigned int r = 1, y = (unsigned int)(internal::safe_mod(x, m));\n while (n) {\n if (n & 1) r = bt.mul(r, y);\n y = bt.mul(y, y);\n n >>= 1;\n }\n return r;\n}\n\nlong long inv_mod(long long x, long long m) {\n assert(1 <= m);\n auto z = internal::inv_gcd(x, m);\n assert(z.first == 1);\n return z.second;\n}\n\n// (rem, mod)\nstd::pair<long long, long long> crt(const std::vector<long long>& r,\n const std::vector<long long>& m) {\n assert(r.size() == m.size());\n int n = int(r.size());\n // Contracts: 0 <= r0 < m0\n long long r0 = 0, m0 = 1;\n for (int i = 0; i < n; i++) {\n assert(1 <= m[i]);\n long long r1 = internal::safe_mod(r[i], m[i]), m1 = m[i];\n if (m0 < m1) {\n std::swap(r0, r1);\n std::swap(m0, m1);\n }\n if (m0 % m1 == 0) {\n if (r0 % m1 != r1) return {0, 0};\n continue;\n }\n // assume: m0 > m1, lcm(m0, m1) >= 2 * max(m0, m1)\n\n // (r0, m0), (r1, m1) -> (r2, m2 = lcm(m0, m1));\n // r2 % m0 = r0\n // r2 % m1 = r1\n // -> (r0 + x*m0) % m1 = r1\n // -> x*u0*g = r1-r0 (mod u1*g) (u0*g = m0, u1*g = m1)\n // -> x = (r1 - r0) / g * inv(u0) (mod u1)\n\n // im = inv(u0) (mod u1) (0 <= im < u1)\n long long g, im;\n std::tie(g, im) = internal::inv_gcd(m0, m1);\n\n long long u1 = (m1 / g);\n // |r1 - r0| < (m0 + m1) <= lcm(m0, m1)\n if ((r1 - r0) % g) return {0, 0};\n\n // u1 * u1 <= m1 * m1 / g / g <= m0 * m1 / g = lcm(m0, m1)\n long long x = (r1 - r0) / g % u1 * im % u1;\n\n // |r0| + |m0 * x|\n // < m0 + m0 * (u1 - 1)\n // = m0 + m0 * m1 / g - m0\n // = lcm(m0, m1)\n r0 += x * m0;\n m0 *= u1; // -> lcm(m0, m1)\n if (r0 < 0) r0 += m0;\n }\n return {r0, m0};\n}\n\nlong long floor_sum(long long n, long long m, long long a, long long b) {\n assert(0 <= n && n < (1LL << 32));\n assert(1 <= m && m < (1LL << 32));\n unsigned long long ans = 0;\n if (a < 0) {\n unsigned long long a2 = internal::safe_mod(a, m);\n ans -= 1ULL * n * (n - 1) / 2 * ((a2 - a) / m);\n a = a2;\n }\n if (b < 0) {\n unsigned long long b2 = internal::safe_mod(b, m);\n ans -= 1ULL * n * ((b2 - b) / m);\n b = b2;\n }\n return ans + internal::floor_sum_unsigned(n, m, a, b);\n}\n\n} // namespace atcoder\n\n#endif // ATCODER_MATH_HPP\n","include/atcoder/math.hpp":"#ifndef ATCODER_MATH_HPP\n#define ATCODER_MATH_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <tuple>\n#include <vector>\n\n#include \"atcoder/internal_math\"\n\nnamespace atcoder {\n\nlong long pow_mod(long long x, long long n, int m) {\n assert(0 <= n && 1 <= m);\n if (m == 1) return 0;\n internal::barrett bt((unsigned int)(m));\n unsigned int r = 1, y = (unsigned int)(internal::safe_mod(x, m));\n while (n) {\n if (n & 1) r = bt.mul(r, y);\n y = bt.mul(y, y);\n n >>= 1;\n }\n return r;\n}\n\nlong long inv_mod(long long x, long long m) {\n assert(1 <= m);\n auto z = internal::inv_gcd(x, m);\n assert(z.first == 1);\n return z.second;\n}\n\n// (rem, mod)\nstd::pair<long long, long long> crt(const std::vector<long long>& r,\n const std::vector<long long>& m) {\n assert(r.size() == m.size());\n int n = int(r.size());\n // Contracts: 0 <= r0 < m0\n long long r0 = 0, m0 = 1;\n for (int i = 0; i < n; i++) {\n assert(1 <= m[i]);\n long long r1 = internal::safe_mod(r[i], m[i]), m1 = m[i];\n if (m0 < m1) {\n std::swap(r0, r1);\n std::swap(m0, m1);\n }\n if (m0 % m1 == 0) {\n if (r0 % m1 != r1) return {0, 0};\n continue;\n }\n // assume: m0 > m1, lcm(m0, m1) >= 2 * max(m0, m1)\n\n // (r0, m0), (r1, m1) -> (r2, m2 = lcm(m0, m1));\n // r2 % m0 = r0\n // r2 % m1 = r1\n // -> (r0 + x*m0) % m1 = r1\n // -> x*u0*g = r1-r0 (mod u1*g) (u0*g = m0, u1*g = m1)\n // -> x = (r1 - r0) / g * inv(u0) (mod u1)\n\n // im = inv(u0) (mod u1) (0 <= im < u1)\n long long g, im;\n std::tie(g, im) = internal::inv_gcd(m0, m1);\n\n long long u1 = (m1 / g);\n // |r1 - r0| < (m0 + m1) <= lcm(m0, m1)\n if ((r1 - r0) % g) return {0, 0};\n\n // u1 * u1 <= m1 * m1 / g / g <= m0 * m1 / g = lcm(m0, m1)\n long long x = (r1 - r0) / g % u1 * im % u1;\n\n // |r0| + |m0 * x|\n // < m0 + m0 * (u1 - 1)\n // = m0 + m0 * m1 / g - m0\n // = lcm(m0, m1)\n r0 += x * m0;\n m0 *= u1; // -> lcm(m0, m1)\n if (r0 < 0) r0 += m0;\n }\n return {r0, m0};\n}\n\nlong long floor_sum(long long n, long long m, long long a, long long b) {\n assert(0 <= n && n < (1LL << 32));\n assert(1 <= m && m < (1LL << 32));\n unsigned long long ans = 0;\n if (a < 0) {\n unsigned long long a2 = internal::safe_mod(a, m);\n ans -= 1ULL * n * (n - 1) / 2 * ((a2 - a) / m);\n a = a2;\n }\n if (b < 0) {\n unsigned long long b2 = internal::safe_mod(b, m);\n ans -= 1ULL * n * ((b2 - b) / m);\n b = b2;\n }\n return ans + internal::floor_sum_unsigned(n, m, a, b);\n}\n\n} // namespace atcoder\n\n#endif // ATCODER_MATH_HPP\n","include/atcoder/maxflow":"#ifndef ATCODER_MAXFLOW_HPP\n#define ATCODER_MAXFLOW_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <limits>\n#include <queue>\n#include <vector>\n\n#include \"atcoder/internal_queue\"\n\nnamespace atcoder {\n\ntemplate <class Cap> struct mf_graph {\n public:\n mf_graph() : _n(0) {}\n explicit mf_graph(int n) : _n(n), g(n) {}\n\n int add_edge(int from, int to, Cap cap) {\n assert(0 <= from && from < _n);\n assert(0 <= to && to < _n);\n assert(0 <= cap);\n int m = int(pos.size());\n pos.push_back({from, int(g[from].size())});\n int from_id = int(g[from].size());\n int to_id = int(g[to].size());\n if (from == to) to_id++;\n g[from].push_back(_edge{to, to_id, cap});\n g[to].push_back(_edge{from, from_id, 0});\n return m;\n }\n\n struct edge {\n int from, to;\n Cap cap, flow;\n };\n\n edge get_edge(int i) {\n int m = int(pos.size());\n assert(0 <= i && i < m);\n auto _e = g[pos[i].first][pos[i].second];\n auto _re = g[_e.to][_e.rev];\n return edge{pos[i].first, _e.to, _e.cap + _re.cap, _re.cap};\n }\n std::vector<edge> edges() {\n int m = int(pos.size());\n std::vector<edge> result;\n for (int i = 0; i < m; i++) {\n result.push_back(get_edge(i));\n }\n return result;\n }\n void change_edge(int i, Cap new_cap, Cap new_flow) {\n int m = int(pos.size());\n assert(0 <= i && i < m);\n assert(0 <= new_flow && new_flow <= new_cap);\n auto& _e = g[pos[i].first][pos[i].second];\n auto& _re = g[_e.to][_e.rev];\n _e.cap = new_cap - new_flow;\n _re.cap = new_flow;\n }\n\n Cap flow(int s, int t) {\n return flow(s, t, std::numeric_limits<Cap>::max());\n }\n Cap flow(int s, int t, Cap flow_limit) {\n assert(0 <= s && s < _n);\n assert(0 <= t && t < _n);\n assert(s != t);\n\n std::vector<int> level(_n), iter(_n);\n internal::simple_queue<int> que;\n\n auto bfs = [&]() {\n std::fill(level.begin(), level.end(), -1);\n level[s] = 0;\n que.clear();\n que.push(s);\n while (!que.empty()) {\n int v = que.front();\n que.pop();\n for (auto e : g[v]) {\n if (e.cap == 0 || level[e.to] >= 0) continue;\n level[e.to] = level[v] + 1;\n if (e.to == t) return;\n que.push(e.to);\n }\n }\n };\n auto dfs = [&](auto self, int v, Cap up) {\n if (v == s) return up;\n Cap res = 0;\n int level_v = level[v];\n for (int& i = iter[v]; i < int(g[v].size()); i++) {\n _edge& e = g[v][i];\n if (level_v <= level[e.to] || g[e.to][e.rev].cap == 0) continue;\n Cap d =\n self(self, e.to, std::min(up - res, g[e.to][e.rev].cap));\n if (d <= 0) continue;\n g[v][i].cap += d;\n g[e.to][e.rev].cap -= d;\n res += d;\n if (res == up) return res;\n }\n level[v] = _n;\n return res;\n };\n\n Cap flow = 0;\n while (flow < flow_limit) {\n bfs();\n if (level[t] == -1) break;\n std::fill(iter.begin(), iter.end(), 0);\n Cap f = dfs(dfs, t, flow_limit - flow);\n if (!f) break;\n flow += f;\n }\n return flow;\n }\n\n std::vector<bool> min_cut(int s) {\n std::vector<bool> visited(_n);\n internal::simple_queue<int> que;\n que.push(s);\n while (!que.empty()) {\n int p = que.front();\n que.pop();\n visited[p] = true;\n for (auto e : g[p]) {\n if (e.cap && !visited[e.to]) {\n visited[e.to] = true;\n que.push(e.to);\n }\n }\n }\n return visited;\n }\n\n private:\n int _n;\n struct _edge {\n int to, rev;\n Cap cap;\n };\n std::vector<std::pair<int, int>> pos;\n std::vector<std::vector<_edge>> g;\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_MAXFLOW_HPP\n","include/atcoder/maxflow.hpp":"#ifndef ATCODER_MAXFLOW_HPP\n#define ATCODER_MAXFLOW_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <limits>\n#include <queue>\n#include <vector>\n\n#include \"atcoder/internal_queue\"\n\nnamespace atcoder {\n\ntemplate <class Cap> struct mf_graph {\n public:\n mf_graph() : _n(0) {}\n explicit mf_graph(int n) : _n(n), g(n) {}\n\n int add_edge(int from, int to, Cap cap) {\n assert(0 <= from && from < _n);\n assert(0 <= to && to < _n);\n assert(0 <= cap);\n int m = int(pos.size());\n pos.push_back({from, int(g[from].size())});\n int from_id = int(g[from].size());\n int to_id = int(g[to].size());\n if (from == to) to_id++;\n g[from].push_back(_edge{to, to_id, cap});\n g[to].push_back(_edge{from, from_id, 0});\n return m;\n }\n\n struct edge {\n int from, to;\n Cap cap, flow;\n };\n\n edge get_edge(int i) {\n int m = int(pos.size());\n assert(0 <= i && i < m);\n auto _e = g[pos[i].first][pos[i].second];\n auto _re = g[_e.to][_e.rev];\n return edge{pos[i].first, _e.to, _e.cap + _re.cap, _re.cap};\n }\n std::vector<edge> edges() {\n int m = int(pos.size());\n std::vector<edge> result;\n for (int i = 0; i < m; i++) {\n result.push_back(get_edge(i));\n }\n return result;\n }\n void change_edge(int i, Cap new_cap, Cap new_flow) {\n int m = int(pos.size());\n assert(0 <= i && i < m);\n assert(0 <= new_flow && new_flow <= new_cap);\n auto& _e = g[pos[i].first][pos[i].second];\n auto& _re = g[_e.to][_e.rev];\n _e.cap = new_cap - new_flow;\n _re.cap = new_flow;\n }\n\n Cap flow(int s, int t) {\n return flow(s, t, std::numeric_limits<Cap>::max());\n }\n Cap flow(int s, int t, Cap flow_limit) {\n assert(0 <= s && s < _n);\n assert(0 <= t && t < _n);\n assert(s != t);\n\n std::vector<int> level(_n), iter(_n);\n internal::simple_queue<int> que;\n\n auto bfs = [&]() {\n std::fill(level.begin(), level.end(), -1);\n level[s] = 0;\n que.clear();\n que.push(s);\n while (!que.empty()) {\n int v = que.front();\n que.pop();\n for (auto e : g[v]) {\n if (e.cap == 0 || level[e.to] >= 0) continue;\n level[e.to] = level[v] + 1;\n if (e.to == t) return;\n que.push(e.to);\n }\n }\n };\n auto dfs = [&](auto self, int v, Cap up) {\n if (v == s) return up;\n Cap res = 0;\n int level_v = level[v];\n for (int& i = iter[v]; i < int(g[v].size()); i++) {\n _edge& e = g[v][i];\n if (level_v <= level[e.to] || g[e.to][e.rev].cap == 0) continue;\n Cap d =\n self(self, e.to, std::min(up - res, g[e.to][e.rev].cap));\n if (d <= 0) continue;\n g[v][i].cap += d;\n g[e.to][e.rev].cap -= d;\n res += d;\n if (res == up) return res;\n }\n level[v] = _n;\n return res;\n };\n\n Cap flow = 0;\n while (flow < flow_limit) {\n bfs();\n if (level[t] == -1) break;\n std::fill(iter.begin(), iter.end(), 0);\n Cap f = dfs(dfs, t, flow_limit - flow);\n if (!f) break;\n flow += f;\n }\n return flow;\n }\n\n std::vector<bool> min_cut(int s) {\n std::vector<bool> visited(_n);\n internal::simple_queue<int> que;\n que.push(s);\n while (!que.empty()) {\n int p = que.front();\n que.pop();\n visited[p] = true;\n for (auto e : g[p]) {\n if (e.cap && !visited[e.to]) {\n visited[e.to] = true;\n que.push(e.to);\n }\n }\n }\n return visited;\n }\n\n private:\n int _n;\n struct _edge {\n int to, rev;\n Cap cap;\n };\n std::vector<std::pair<int, int>> pos;\n std::vector<std::vector<_edge>> g;\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_MAXFLOW_HPP\n","include/atcoder/mincostflow":"#ifndef ATCODER_MINCOSTFLOW_HPP\n#define ATCODER_MINCOSTFLOW_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <limits>\n#include <queue>\n#include <vector>\n\n#include \"atcoder/internal_csr\"\n#include \"atcoder/internal_queue\"\n\nnamespace atcoder {\n\ntemplate <class Cap, class Cost> struct mcf_graph {\n public:\n mcf_graph() {}\n explicit mcf_graph(int n) : _n(n) {}\n\n int add_edge(int from, int to, Cap cap, Cost cost) {\n assert(0 <= from && from < _n);\n assert(0 <= to && to < _n);\n assert(0 <= cap);\n assert(0 <= cost);\n int m = int(_edges.size());\n _edges.push_back({from, to, cap, 0, cost});\n return m;\n }\n\n struct edge {\n int from, to;\n Cap cap, flow;\n Cost cost;\n };\n\n edge get_edge(int i) {\n int m = int(_edges.size());\n assert(0 <= i && i < m);\n return _edges[i];\n }\n std::vector<edge> edges() { return _edges; }\n\n std::pair<Cap, Cost> flow(int s, int t) {\n return flow(s, t, std::numeric_limits<Cap>::max());\n }\n std::pair<Cap, Cost> flow(int s, int t, Cap flow_limit) {\n return slope(s, t, flow_limit).back();\n }\n std::vector<std::pair<Cap, Cost>> slope(int s, int t) {\n return slope(s, t, std::numeric_limits<Cap>::max());\n }\n std::vector<std::pair<Cap, Cost>> slope(int s, int t, Cap flow_limit) {\n assert(0 <= s && s < _n);\n assert(0 <= t && t < _n);\n assert(s != t);\n\n int m = int(_edges.size());\n std::vector<int> edge_idx(m);\n\n auto g = [&]() {\n std::vector<int> degree(_n), redge_idx(m);\n std::vector<std::pair<int, _edge>> elist;\n elist.reserve(2 * m);\n for (int i = 0; i < m; i++) {\n auto e = _edges[i];\n edge_idx[i] = degree[e.from]++;\n redge_idx[i] = degree[e.to]++;\n elist.push_back({e.from, {e.to, -1, e.cap - e.flow, e.cost}});\n elist.push_back({e.to, {e.from, -1, e.flow, -e.cost}});\n }\n auto _g = internal::csr<_edge>(_n, elist);\n for (int i = 0; i < m; i++) {\n auto e = _edges[i];\n edge_idx[i] += _g.start[e.from];\n redge_idx[i] += _g.start[e.to];\n _g.elist[edge_idx[i]].rev = redge_idx[i];\n _g.elist[redge_idx[i]].rev = edge_idx[i];\n }\n return _g;\n }();\n\n auto result = slope(g, s, t, flow_limit);\n\n for (int i = 0; i < m; i++) {\n auto e = g.elist[edge_idx[i]];\n _edges[i].flow = _edges[i].cap - e.cap;\n }\n\n return result;\n }\n\n private:\n int _n;\n std::vector<edge> _edges;\n\n // inside edge\n struct _edge {\n int to, rev;\n Cap cap;\n Cost cost;\n };\n\n std::vector<std::pair<Cap, Cost>> slope(internal::csr<_edge>& g,\n int s,\n int t,\n Cap flow_limit) {\n // variants (C = maxcost):\n // -(n-1)C <= dual[s] <= dual[i] <= dual[t] = 0\n // reduced cost (= e.cost + dual[e.from] - dual[e.to]) >= 0 for all edge\n\n // dual_dist[i] = (dual[i], dist[i])\n std::vector<std::pair<Cost, Cost>> dual_dist(_n);\n std::vector<int> prev_e(_n);\n std::vector<bool> vis(_n);\n struct Q {\n Cost key;\n int to;\n bool operator<(Q r) const { return key > r.key; }\n };\n std::vector<int> que_min;\n std::vector<Q> que;\n auto dual_ref = [&]() {\n for (int i = 0; i < _n; i++) {\n dual_dist[i].second = std::numeric_limits<Cost>::max();\n }\n std::fill(vis.begin(), vis.end(), false);\n que_min.clear();\n que.clear();\n\n // que[0..heap_r) was heapified\n size_t heap_r = 0;\n\n dual_dist[s].second = 0;\n que_min.push_back(s);\n while (!que_min.empty() || !que.empty()) {\n int v;\n if (!que_min.empty()) {\n v = que_min.back();\n que_min.pop_back();\n } else {\n while (heap_r < que.size()) {\n heap_r++;\n std::push_heap(que.begin(), que.begin() + heap_r);\n }\n v = que.front().to;\n std::pop_heap(que.begin(), que.end());\n que.pop_back();\n heap_r--;\n }\n if (vis[v]) continue;\n vis[v] = true;\n if (v == t) break;\n // dist[v] = shortest(s, v) + dual[s] - dual[v]\n // dist[v] >= 0 (all reduced cost are positive)\n // dist[v] <= (n-1)C\n Cost dual_v = dual_dist[v].first, dist_v = dual_dist[v].second;\n for (int i = g.start[v]; i < g.start[v + 1]; i++) {\n auto e = g.elist[i];\n if (!e.cap) continue;\n // |-dual[e.to] + dual[v]| <= (n-1)C\n // cost <= C - -(n-1)C + 0 = nC\n Cost cost = e.cost - dual_dist[e.to].first + dual_v;\n if (dual_dist[e.to].second - dist_v > cost) {\n Cost dist_to = dist_v + cost;\n dual_dist[e.to].second = dist_to;\n prev_e[e.to] = e.rev;\n if (dist_to == dist_v) {\n que_min.push_back(e.to);\n } else {\n que.push_back(Q{dist_to, e.to});\n }\n }\n }\n }\n if (!vis[t]) {\n return false;\n }\n\n for (int v = 0; v < _n; v++) {\n if (!vis[v]) continue;\n // dual[v] = dual[v] - dist[t] + dist[v]\n // = dual[v] - (shortest(s, t) + dual[s] - dual[t]) +\n // (shortest(s, v) + dual[s] - dual[v]) = - shortest(s,\n // t) + dual[t] + shortest(s, v) = shortest(s, v) -\n // shortest(s, t) >= 0 - (n-1)C\n dual_dist[v].first -= dual_dist[t].second - dual_dist[v].second;\n }\n return true;\n };\n Cap flow = 0;\n Cost cost = 0, prev_cost_per_flow = -1;\n std::vector<std::pair<Cap, Cost>> result = {{Cap(0), Cost(0)}};\n while (flow < flow_limit) {\n if (!dual_ref()) break;\n Cap c = flow_limit - flow;\n for (int v = t; v != s; v = g.elist[prev_e[v]].to) {\n c = std::min(c, g.elist[g.elist[prev_e[v]].rev].cap);\n }\n for (int v = t; v != s; v = g.elist[prev_e[v]].to) {\n auto& e = g.elist[prev_e[v]];\n e.cap += c;\n g.elist[e.rev].cap -= c;\n }\n Cost d = -dual_dist[s].first;\n flow += c;\n cost += c * d;\n if (prev_cost_per_flow == d) {\n result.pop_back();\n }\n result.push_back({flow, cost});\n prev_cost_per_flow = d;\n }\n return result;\n }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_MINCOSTFLOW_HPP\n","include/atcoder/mincostflow.hpp":"#ifndef ATCODER_MINCOSTFLOW_HPP\n#define ATCODER_MINCOSTFLOW_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <limits>\n#include <queue>\n#include <vector>\n\n#include \"atcoder/internal_csr\"\n#include \"atcoder/internal_queue\"\n\nnamespace atcoder {\n\ntemplate <class Cap, class Cost> struct mcf_graph {\n public:\n mcf_graph() {}\n explicit mcf_graph(int n) : _n(n) {}\n\n int add_edge(int from, int to, Cap cap, Cost cost) {\n assert(0 <= from && from < _n);\n assert(0 <= to && to < _n);\n assert(0 <= cap);\n assert(0 <= cost);\n int m = int(_edges.size());\n _edges.push_back({from, to, cap, 0, cost});\n return m;\n }\n\n struct edge {\n int from, to;\n Cap cap, flow;\n Cost cost;\n };\n\n edge get_edge(int i) {\n int m = int(_edges.size());\n assert(0 <= i && i < m);\n return _edges[i];\n }\n std::vector<edge> edges() { return _edges; }\n\n std::pair<Cap, Cost> flow(int s, int t) {\n return flow(s, t, std::numeric_limits<Cap>::max());\n }\n std::pair<Cap, Cost> flow(int s, int t, Cap flow_limit) {\n return slope(s, t, flow_limit).back();\n }\n std::vector<std::pair<Cap, Cost>> slope(int s, int t) {\n return slope(s, t, std::numeric_limits<Cap>::max());\n }\n std::vector<std::pair<Cap, Cost>> slope(int s, int t, Cap flow_limit) {\n assert(0 <= s && s < _n);\n assert(0 <= t && t < _n);\n assert(s != t);\n\n int m = int(_edges.size());\n std::vector<int> edge_idx(m);\n\n auto g = [&]() {\n std::vector<int> degree(_n), redge_idx(m);\n std::vector<std::pair<int, _edge>> elist;\n elist.reserve(2 * m);\n for (int i = 0; i < m; i++) {\n auto e = _edges[i];\n edge_idx[i] = degree[e.from]++;\n redge_idx[i] = degree[e.to]++;\n elist.push_back({e.from, {e.to, -1, e.cap - e.flow, e.cost}});\n elist.push_back({e.to, {e.from, -1, e.flow, -e.cost}});\n }\n auto _g = internal::csr<_edge>(_n, elist);\n for (int i = 0; i < m; i++) {\n auto e = _edges[i];\n edge_idx[i] += _g.start[e.from];\n redge_idx[i] += _g.start[e.to];\n _g.elist[edge_idx[i]].rev = redge_idx[i];\n _g.elist[redge_idx[i]].rev = edge_idx[i];\n }\n return _g;\n }();\n\n auto result = slope(g, s, t, flow_limit);\n\n for (int i = 0; i < m; i++) {\n auto e = g.elist[edge_idx[i]];\n _edges[i].flow = _edges[i].cap - e.cap;\n }\n\n return result;\n }\n\n private:\n int _n;\n std::vector<edge> _edges;\n\n // inside edge\n struct _edge {\n int to, rev;\n Cap cap;\n Cost cost;\n };\n\n std::vector<std::pair<Cap, Cost>> slope(internal::csr<_edge>& g,\n int s,\n int t,\n Cap flow_limit) {\n // variants (C = maxcost):\n // -(n-1)C <= dual[s] <= dual[i] <= dual[t] = 0\n // reduced cost (= e.cost + dual[e.from] - dual[e.to]) >= 0 for all edge\n\n // dual_dist[i] = (dual[i], dist[i])\n std::vector<std::pair<Cost, Cost>> dual_dist(_n);\n std::vector<int> prev_e(_n);\n std::vector<bool> vis(_n);\n struct Q {\n Cost key;\n int to;\n bool operator<(Q r) const { return key > r.key; }\n };\n std::vector<int> que_min;\n std::vector<Q> que;\n auto dual_ref = [&]() {\n for (int i = 0; i < _n; i++) {\n dual_dist[i].second = std::numeric_limits<Cost>::max();\n }\n std::fill(vis.begin(), vis.end(), false);\n que_min.clear();\n que.clear();\n\n // que[0..heap_r) was heapified\n size_t heap_r = 0;\n\n dual_dist[s].second = 0;\n que_min.push_back(s);\n while (!que_min.empty() || !que.empty()) {\n int v;\n if (!que_min.empty()) {\n v = que_min.back();\n que_min.pop_back();\n } else {\n while (heap_r < que.size()) {\n heap_r++;\n std::push_heap(que.begin(), que.begin() + heap_r);\n }\n v = que.front().to;\n std::pop_heap(que.begin(), que.end());\n que.pop_back();\n heap_r--;\n }\n if (vis[v]) continue;\n vis[v] = true;\n if (v == t) break;\n // dist[v] = shortest(s, v) + dual[s] - dual[v]\n // dist[v] >= 0 (all reduced cost are positive)\n // dist[v] <= (n-1)C\n Cost dual_v = dual_dist[v].first, dist_v = dual_dist[v].second;\n for (int i = g.start[v]; i < g.start[v + 1]; i++) {\n auto e = g.elist[i];\n if (!e.cap) continue;\n // |-dual[e.to] + dual[v]| <= (n-1)C\n // cost <= C - -(n-1)C + 0 = nC\n Cost cost = e.cost - dual_dist[e.to].first + dual_v;\n if (dual_dist[e.to].second - dist_v > cost) {\n Cost dist_to = dist_v + cost;\n dual_dist[e.to].second = dist_to;\n prev_e[e.to] = e.rev;\n if (dist_to == dist_v) {\n que_min.push_back(e.to);\n } else {\n que.push_back(Q{dist_to, e.to});\n }\n }\n }\n }\n if (!vis[t]) {\n return false;\n }\n\n for (int v = 0; v < _n; v++) {\n if (!vis[v]) continue;\n // dual[v] = dual[v] - dist[t] + dist[v]\n // = dual[v] - (shortest(s, t) + dual[s] - dual[t]) +\n // (shortest(s, v) + dual[s] - dual[v]) = - shortest(s,\n // t) + dual[t] + shortest(s, v) = shortest(s, v) -\n // shortest(s, t) >= 0 - (n-1)C\n dual_dist[v].first -= dual_dist[t].second - dual_dist[v].second;\n }\n return true;\n };\n Cap flow = 0;\n Cost cost = 0, prev_cost_per_flow = -1;\n std::vector<std::pair<Cap, Cost>> result = {{Cap(0), Cost(0)}};\n while (flow < flow_limit) {\n if (!dual_ref()) break;\n Cap c = flow_limit - flow;\n for (int v = t; v != s; v = g.elist[prev_e[v]].to) {\n c = std::min(c, g.elist[g.elist[prev_e[v]].rev].cap);\n }\n for (int v = t; v != s; v = g.elist[prev_e[v]].to) {\n auto& e = g.elist[prev_e[v]];\n e.cap += c;\n g.elist[e.rev].cap -= c;\n }\n Cost d = -dual_dist[s].first;\n flow += c;\n cost += c * d;\n if (prev_cost_per_flow == d) {\n result.pop_back();\n }\n result.push_back({flow, cost});\n prev_cost_per_flow = d;\n }\n return result;\n }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_MINCOSTFLOW_HPP\n","include/atcoder/modint":"#ifndef ATCODER_MODINT_HPP\n#define ATCODER_MODINT_HPP 1\n\n#include <cassert>\n#include <numeric>\n#include <type_traits>\n\n#ifdef _MSC_VER\n#include <intrin.h>\n#endif\n\n#include \"atcoder/internal_math\"\n#include \"atcoder/internal_type_traits\"\n\nnamespace atcoder {\n\nnamespace internal {\n\nstruct modint_base {};\nstruct static_modint_base : modint_base {};\n\ntemplate <class T> using is_modint = std::is_base_of<modint_base, T>;\ntemplate <class T> using is_modint_t = std::enable_if_t<is_modint<T>::value>;\n\n} // namespace internal\n\ntemplate <int m, std::enable_if_t<(1 <= m)>* = nullptr>\nstruct static_modint : internal::static_modint_base {\n using mint = static_modint;\n\n public:\n static constexpr int mod() { return m; }\n static mint raw(int v) {\n mint x;\n x._v = v;\n return x;\n }\n\n static_modint() : _v(0) {}\n template <class T, internal::is_signed_int_t<T>* = nullptr>\n static_modint(T v) {\n long long x = (long long)(v % (long long)(umod()));\n if (x < 0) x += umod();\n _v = (unsigned int)(x);\n }\n template <class T, internal::is_unsigned_int_t<T>* = nullptr>\n static_modint(T v) {\n _v = (unsigned int)(v % umod());\n }\n\n int val() const { return _v; }\n\n mint& operator++() {\n _v++;\n if (_v == umod()) _v = 0;\n return *this;\n }\n mint& operator--() {\n if (_v == 0) _v = umod();\n _v--;\n return *this;\n }\n mint operator++(int) {\n mint result = *this;\n ++*this;\n return result;\n }\n mint operator--(int) {\n mint result = *this;\n --*this;\n return result;\n }\n\n mint& operator+=(const mint& rhs) {\n _v += rhs._v;\n if (_v >= umod()) _v -= umod();\n return *this;\n }\n mint& operator-=(const mint& rhs) {\n _v -= rhs._v;\n if (_v >= umod()) _v += umod();\n return *this;\n }\n mint& operator*=(const mint& rhs) {\n unsigned long long z = _v;\n z *= rhs._v;\n _v = (unsigned int)(z % umod());\n return *this;\n }\n mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }\n\n mint operator+() const { return *this; }\n mint operator-() const { return mint() - *this; }\n\n mint pow(long long n) const {\n assert(0 <= n);\n mint x = *this, r = 1;\n while (n) {\n if (n & 1) r *= x;\n x *= x;\n n >>= 1;\n }\n return r;\n }\n mint inv() const {\n if (prime) {\n assert(_v);\n return pow(umod() - 2);\n } else {\n auto eg = internal::inv_gcd(_v, m);\n assert(eg.first == 1);\n return eg.second;\n }\n }\n\n friend mint operator+(const mint& lhs, const mint& rhs) {\n return mint(lhs) += rhs;\n }\n friend mint operator-(const mint& lhs, const mint& rhs) {\n return mint(lhs) -= rhs;\n }\n friend mint operator*(const mint& lhs, const mint& rhs) {\n return mint(lhs) *= rhs;\n }\n friend mint operator/(const mint& lhs, const mint& rhs) {\n return mint(lhs) /= rhs;\n }\n friend bool operator==(const mint& lhs, const mint& rhs) {\n return lhs._v == rhs._v;\n }\n friend bool operator!=(const mint& lhs, const mint& rhs) {\n return lhs._v != rhs._v;\n }\n\n private:\n unsigned int _v;\n static constexpr unsigned int umod() { return m; }\n static constexpr bool prime = internal::is_prime<m>;\n};\n\ntemplate <int id> struct dynamic_modint : internal::modint_base {\n using mint = dynamic_modint;\n\n public:\n static int mod() { return (int)(bt.umod()); }\n static void set_mod(int m) {\n assert(1 <= m);\n bt = internal::barrett(m);\n }\n static mint raw(int v) {\n mint x;\n x._v = v;\n return x;\n }\n\n dynamic_modint() : _v(0) {}\n template <class T, internal::is_signed_int_t<T>* = nullptr>\n dynamic_modint(T v) {\n long long x = (long long)(v % (long long)(mod()));\n if (x < 0) x += mod();\n _v = (unsigned int)(x);\n }\n template <class T, internal::is_unsigned_int_t<T>* = nullptr>\n dynamic_modint(T v) {\n _v = (unsigned int)(v % mod());\n }\n\n int val() const { return _v; }\n\n mint& operator++() {\n _v++;\n if (_v == umod()) _v = 0;\n return *this;\n }\n mint& operator--() {\n if (_v == 0) _v = umod();\n _v--;\n return *this;\n }\n mint operator++(int) {\n mint result = *this;\n ++*this;\n return result;\n }\n mint operator--(int) {\n mint result = *this;\n --*this;\n return result;\n }\n\n mint& operator+=(const mint& rhs) {\n _v += rhs._v;\n if (_v >= umod()) _v -= umod();\n return *this;\n }\n mint& operator-=(const mint& rhs) {\n _v += mod() - rhs._v;\n if (_v >= umod()) _v -= umod();\n return *this;\n }\n mint& operator*=(const mint& rhs) {\n _v = bt.mul(_v, rhs._v);\n return *this;\n }\n mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }\n\n mint operator+() const { return *this; }\n mint operator-() const { return mint() - *this; }\n\n mint pow(long long n) const {\n assert(0 <= n);\n mint x = *this, r = 1;\n while (n) {\n if (n & 1) r *= x;\n x *= x;\n n >>= 1;\n }\n return r;\n }\n mint inv() const {\n auto eg = internal::inv_gcd(_v, mod());\n assert(eg.first == 1);\n return eg.second;\n }\n\n friend mint operator+(const mint& lhs, const mint& rhs) {\n return mint(lhs) += rhs;\n }\n friend mint operator-(const mint& lhs, const mint& rhs) {\n return mint(lhs) -= rhs;\n }\n friend mint operator*(const mint& lhs, const mint& rhs) {\n return mint(lhs) *= rhs;\n }\n friend mint operator/(const mint& lhs, const mint& rhs) {\n return mint(lhs) /= rhs;\n }\n friend bool operator==(const mint& lhs, const mint& rhs) {\n return lhs._v == rhs._v;\n }\n friend bool operator!=(const mint& lhs, const mint& rhs) {\n return lhs._v != rhs._v;\n }\n\n private:\n unsigned int _v;\n static internal::barrett bt;\n static unsigned int umod() { return bt.umod(); }\n};\ntemplate <int id> internal::barrett dynamic_modint<id>::bt(998244353);\n\nusing modint998244353 = static_modint<998244353>;\nusing modint1000000007 = static_modint<1000000007>;\nusing modint = dynamic_modint<-1>;\n\nnamespace internal {\n\ntemplate <class T>\nusing is_static_modint = std::is_base_of<internal::static_modint_base, T>;\n\ntemplate <class T>\nusing is_static_modint_t = std::enable_if_t<is_static_modint<T>::value>;\n\ntemplate <class> struct is_dynamic_modint : public std::false_type {};\ntemplate <int id>\nstruct is_dynamic_modint<dynamic_modint<id>> : public std::true_type {};\n\ntemplate <class T>\nusing is_dynamic_modint_t = std::enable_if_t<is_dynamic_modint<T>::value>;\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_MODINT_HPP\n","include/atcoder/modint.hpp":"#ifndef ATCODER_MODINT_HPP\n#define ATCODER_MODINT_HPP 1\n\n#include <cassert>\n#include <numeric>\n#include <type_traits>\n\n#ifdef _MSC_VER\n#include <intrin.h>\n#endif\n\n#include \"atcoder/internal_math\"\n#include \"atcoder/internal_type_traits\"\n\nnamespace atcoder {\n\nnamespace internal {\n\nstruct modint_base {};\nstruct static_modint_base : modint_base {};\n\ntemplate <class T> using is_modint = std::is_base_of<modint_base, T>;\ntemplate <class T> using is_modint_t = std::enable_if_t<is_modint<T>::value>;\n\n} // namespace internal\n\ntemplate <int m, std::enable_if_t<(1 <= m)>* = nullptr>\nstruct static_modint : internal::static_modint_base {\n using mint = static_modint;\n\n public:\n static constexpr int mod() { return m; }\n static mint raw(int v) {\n mint x;\n x._v = v;\n return x;\n }\n\n static_modint() : _v(0) {}\n template <class T, internal::is_signed_int_t<T>* = nullptr>\n static_modint(T v) {\n long long x = (long long)(v % (long long)(umod()));\n if (x < 0) x += umod();\n _v = (unsigned int)(x);\n }\n template <class T, internal::is_unsigned_int_t<T>* = nullptr>\n static_modint(T v) {\n _v = (unsigned int)(v % umod());\n }\n\n int val() const { return _v; }\n\n mint& operator++() {\n _v++;\n if (_v == umod()) _v = 0;\n return *this;\n }\n mint& operator--() {\n if (_v == 0) _v = umod();\n _v--;\n return *this;\n }\n mint operator++(int) {\n mint result = *this;\n ++*this;\n return result;\n }\n mint operator--(int) {\n mint result = *this;\n --*this;\n return result;\n }\n\n mint& operator+=(const mint& rhs) {\n _v += rhs._v;\n if (_v >= umod()) _v -= umod();\n return *this;\n }\n mint& operator-=(const mint& rhs) {\n _v -= rhs._v;\n if (_v >= umod()) _v += umod();\n return *this;\n }\n mint& operator*=(const mint& rhs) {\n unsigned long long z = _v;\n z *= rhs._v;\n _v = (unsigned int)(z % umod());\n return *this;\n }\n mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }\n\n mint operator+() const { return *this; }\n mint operator-() const { return mint() - *this; }\n\n mint pow(long long n) const {\n assert(0 <= n);\n mint x = *this, r = 1;\n while (n) {\n if (n & 1) r *= x;\n x *= x;\n n >>= 1;\n }\n return r;\n }\n mint inv() const {\n if (prime) {\n assert(_v);\n return pow(umod() - 2);\n } else {\n auto eg = internal::inv_gcd(_v, m);\n assert(eg.first == 1);\n return eg.second;\n }\n }\n\n friend mint operator+(const mint& lhs, const mint& rhs) {\n return mint(lhs) += rhs;\n }\n friend mint operator-(const mint& lhs, const mint& rhs) {\n return mint(lhs) -= rhs;\n }\n friend mint operator*(const mint& lhs, const mint& rhs) {\n return mint(lhs) *= rhs;\n }\n friend mint operator/(const mint& lhs, const mint& rhs) {\n return mint(lhs) /= rhs;\n }\n friend bool operator==(const mint& lhs, const mint& rhs) {\n return lhs._v == rhs._v;\n }\n friend bool operator!=(const mint& lhs, const mint& rhs) {\n return lhs._v != rhs._v;\n }\n\n private:\n unsigned int _v;\n static constexpr unsigned int umod() { return m; }\n static constexpr bool prime = internal::is_prime<m>;\n};\n\ntemplate <int id> struct dynamic_modint : internal::modint_base {\n using mint = dynamic_modint;\n\n public:\n static int mod() { return (int)(bt.umod()); }\n static void set_mod(int m) {\n assert(1 <= m);\n bt = internal::barrett(m);\n }\n static mint raw(int v) {\n mint x;\n x._v = v;\n return x;\n }\n\n dynamic_modint() : _v(0) {}\n template <class T, internal::is_signed_int_t<T>* = nullptr>\n dynamic_modint(T v) {\n long long x = (long long)(v % (long long)(mod()));\n if (x < 0) x += mod();\n _v = (unsigned int)(x);\n }\n template <class T, internal::is_unsigned_int_t<T>* = nullptr>\n dynamic_modint(T v) {\n _v = (unsigned int)(v % mod());\n }\n\n int val() const { return _v; }\n\n mint& operator++() {\n _v++;\n if (_v == umod()) _v = 0;\n return *this;\n }\n mint& operator--() {\n if (_v == 0) _v = umod();\n _v--;\n return *this;\n }\n mint operator++(int) {\n mint result = *this;\n ++*this;\n return result;\n }\n mint operator--(int) {\n mint result = *this;\n --*this;\n return result;\n }\n\n mint& operator+=(const mint& rhs) {\n _v += rhs._v;\n if (_v >= umod()) _v -= umod();\n return *this;\n }\n mint& operator-=(const mint& rhs) {\n _v += mod() - rhs._v;\n if (_v >= umod()) _v -= umod();\n return *this;\n }\n mint& operator*=(const mint& rhs) {\n _v = bt.mul(_v, rhs._v);\n return *this;\n }\n mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }\n\n mint operator+() const { return *this; }\n mint operator-() const { return mint() - *this; }\n\n mint pow(long long n) const {\n assert(0 <= n);\n mint x = *this, r = 1;\n while (n) {\n if (n & 1) r *= x;\n x *= x;\n n >>= 1;\n }\n return r;\n }\n mint inv() const {\n auto eg = internal::inv_gcd(_v, mod());\n assert(eg.first == 1);\n return eg.second;\n }\n\n friend mint operator+(const mint& lhs, const mint& rhs) {\n return mint(lhs) += rhs;\n }\n friend mint operator-(const mint& lhs, const mint& rhs) {\n return mint(lhs) -= rhs;\n }\n friend mint operator*(const mint& lhs, const mint& rhs) {\n return mint(lhs) *= rhs;\n }\n friend mint operator/(const mint& lhs, const mint& rhs) {\n return mint(lhs) /= rhs;\n }\n friend bool operator==(const mint& lhs, const mint& rhs) {\n return lhs._v == rhs._v;\n }\n friend bool operator!=(const mint& lhs, const mint& rhs) {\n return lhs._v != rhs._v;\n }\n\n private:\n unsigned int _v;\n static internal::barrett bt;\n static unsigned int umod() { return bt.umod(); }\n};\ntemplate <int id> internal::barrett dynamic_modint<id>::bt(998244353);\n\nusing modint998244353 = static_modint<998244353>;\nusing modint1000000007 = static_modint<1000000007>;\nusing modint = dynamic_modint<-1>;\n\nnamespace internal {\n\ntemplate <class T>\nusing is_static_modint = std::is_base_of<internal::static_modint_base, T>;\n\ntemplate <class T>\nusing is_static_modint_t = std::enable_if_t<is_static_modint<T>::value>;\n\ntemplate <class> struct is_dynamic_modint : public std::false_type {};\ntemplate <int id>\nstruct is_dynamic_modint<dynamic_modint<id>> : public std::true_type {};\n\ntemplate <class T>\nusing is_dynamic_modint_t = std::enable_if_t<is_dynamic_modint<T>::value>;\n\n} // namespace internal\n\n} // namespace atcoder\n\n#endif // ATCODER_MODINT_HPP\n","include/atcoder/scc":"#ifndef ATCODER_SCC_HPP\n#define ATCODER_SCC_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <vector>\n\n#include \"atcoder/internal_scc\"\n\nnamespace atcoder {\n\nstruct scc_graph {\n public:\n scc_graph() : internal(0) {}\n explicit scc_graph(int n) : internal(n) {}\n\n void add_edge(int from, int to) {\n int n = internal.num_vertices();\n assert(0 <= from && from < n);\n assert(0 <= to && to < n);\n internal.add_edge(from, to);\n }\n\n std::vector<std::vector<int>> scc() { return internal.scc(); }\n\n private:\n internal::scc_graph internal;\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_SCC_HPP\n","include/atcoder/scc.hpp":"#ifndef ATCODER_SCC_HPP\n#define ATCODER_SCC_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <vector>\n\n#include \"atcoder/internal_scc\"\n\nnamespace atcoder {\n\nstruct scc_graph {\n public:\n scc_graph() : internal(0) {}\n explicit scc_graph(int n) : internal(n) {}\n\n void add_edge(int from, int to) {\n int n = internal.num_vertices();\n assert(0 <= from && from < n);\n assert(0 <= to && to < n);\n internal.add_edge(from, to);\n }\n\n std::vector<std::vector<int>> scc() { return internal.scc(); }\n\n private:\n internal::scc_graph internal;\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_SCC_HPP\n","include/atcoder/segtree":"#ifndef ATCODER_SEGTREE_HPP\n#define ATCODER_SEGTREE_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <functional>\n#include <vector>\n\n#include \"atcoder/internal_bit\"\n\nnamespace atcoder {\n\n#if __cplusplus >= 201703L\n\ntemplate <class S, auto op, auto e> struct segtree {\n static_assert(std::is_convertible_v<decltype(op), std::function<S(S, S)>>,\n \"op must work as S(S, S)\");\n static_assert(std::is_convertible_v<decltype(e), std::function<S()>>,\n \"e must work as S()\");\n\n#else\n\ntemplate <class S, S (*op)(S, S), S (*e)()> struct segtree {\n\n#endif\n\n public:\n segtree() : segtree(0) {}\n explicit segtree(int n) : segtree(std::vector<S>(n, e())) {}\n explicit segtree(const std::vector<S>& v) : _n(int(v.size())) {\n size = (int)internal::bit_ceil((unsigned int)(_n));\n log = internal::countr_zero((unsigned int)size);\n d = std::vector<S>(2 * size, e());\n for (int i = 0; i < _n; i++) d[size + i] = v[i];\n for (int i = size - 1; i >= 1; i--) {\n update(i);\n }\n }\n\n void set(int p, S x) {\n assert(0 <= p && p < _n);\n p += size;\n d[p] = x;\n for (int i = 1; i <= log; i++) update(p >> i);\n }\n\n S get(int p) const {\n assert(0 <= p && p < _n);\n return d[p + size];\n }\n\n S prod(int l, int r) const {\n assert(0 <= l && l <= r && r <= _n);\n S sml = e(), smr = e();\n l += size;\n r += size;\n\n while (l < r) {\n if (l & 1) sml = op(sml, d[l++]);\n if (r & 1) smr = op(d[--r], smr);\n l >>= 1;\n r >>= 1;\n }\n return op(sml, smr);\n }\n\n S all_prod() const { return d[1]; }\n\n template <bool (*f)(S)> int max_right(int l) const {\n return max_right(l, [](S x) { return f(x); });\n }\n template <class F> int max_right(int l, F f) const {\n assert(0 <= l && l <= _n);\n assert(f(e()));\n if (l == _n) return _n;\n l += size;\n S sm = e();\n do {\n while (l % 2 == 0) l >>= 1;\n if (!f(op(sm, d[l]))) {\n while (l < size) {\n l = (2 * l);\n if (f(op(sm, d[l]))) {\n sm = op(sm, d[l]);\n l++;\n }\n }\n return l - size;\n }\n sm = op(sm, d[l]);\n l++;\n } while ((l & -l) != l);\n return _n;\n }\n\n template <bool (*f)(S)> int min_left(int r) const {\n return min_left(r, [](S x) { return f(x); });\n }\n template <class F> int min_left(int r, F f) const {\n assert(0 <= r && r <= _n);\n assert(f(e()));\n if (r == 0) return 0;\n r += size;\n S sm = e();\n do {\n r--;\n while (r > 1 && (r % 2)) r >>= 1;\n if (!f(op(d[r], sm))) {\n while (r < size) {\n r = (2 * r + 1);\n if (f(op(d[r], sm))) {\n sm = op(d[r], sm);\n r--;\n }\n }\n return r + 1 - size;\n }\n sm = op(d[r], sm);\n } while ((r & -r) != r);\n return 0;\n }\n\n private:\n int _n, size, log;\n std::vector<S> d;\n\n void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_SEGTREE_HPP\n","include/atcoder/segtree.hpp":"#ifndef ATCODER_SEGTREE_HPP\n#define ATCODER_SEGTREE_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <functional>\n#include <vector>\n\n#include \"atcoder/internal_bit\"\n\nnamespace atcoder {\n\n#if __cplusplus >= 201703L\n\ntemplate <class S, auto op, auto e> struct segtree {\n static_assert(std::is_convertible_v<decltype(op), std::function<S(S, S)>>,\n \"op must work as S(S, S)\");\n static_assert(std::is_convertible_v<decltype(e), std::function<S()>>,\n \"e must work as S()\");\n\n#else\n\ntemplate <class S, S (*op)(S, S), S (*e)()> struct segtree {\n\n#endif\n\n public:\n segtree() : segtree(0) {}\n explicit segtree(int n) : segtree(std::vector<S>(n, e())) {}\n explicit segtree(const std::vector<S>& v) : _n(int(v.size())) {\n size = (int)internal::bit_ceil((unsigned int)(_n));\n log = internal::countr_zero((unsigned int)size);\n d = std::vector<S>(2 * size, e());\n for (int i = 0; i < _n; i++) d[size + i] = v[i];\n for (int i = size - 1; i >= 1; i--) {\n update(i);\n }\n }\n\n void set(int p, S x) {\n assert(0 <= p && p < _n);\n p += size;\n d[p] = x;\n for (int i = 1; i <= log; i++) update(p >> i);\n }\n\n S get(int p) const {\n assert(0 <= p && p < _n);\n return d[p + size];\n }\n\n S prod(int l, int r) const {\n assert(0 <= l && l <= r && r <= _n);\n S sml = e(), smr = e();\n l += size;\n r += size;\n\n while (l < r) {\n if (l & 1) sml = op(sml, d[l++]);\n if (r & 1) smr = op(d[--r], smr);\n l >>= 1;\n r >>= 1;\n }\n return op(sml, smr);\n }\n\n S all_prod() const { return d[1]; }\n\n template <bool (*f)(S)> int max_right(int l) const {\n return max_right(l, [](S x) { return f(x); });\n }\n template <class F> int max_right(int l, F f) const {\n assert(0 <= l && l <= _n);\n assert(f(e()));\n if (l == _n) return _n;\n l += size;\n S sm = e();\n do {\n while (l % 2 == 0) l >>= 1;\n if (!f(op(sm, d[l]))) {\n while (l < size) {\n l = (2 * l);\n if (f(op(sm, d[l]))) {\n sm = op(sm, d[l]);\n l++;\n }\n }\n return l - size;\n }\n sm = op(sm, d[l]);\n l++;\n } while ((l & -l) != l);\n return _n;\n }\n\n template <bool (*f)(S)> int min_left(int r) const {\n return min_left(r, [](S x) { return f(x); });\n }\n template <class F> int min_left(int r, F f) const {\n assert(0 <= r && r <= _n);\n assert(f(e()));\n if (r == 0) return 0;\n r += size;\n S sm = e();\n do {\n r--;\n while (r > 1 && (r % 2)) r >>= 1;\n if (!f(op(d[r], sm))) {\n while (r < size) {\n r = (2 * r + 1);\n if (f(op(d[r], sm))) {\n sm = op(d[r], sm);\n r--;\n }\n }\n return r + 1 - size;\n }\n sm = op(d[r], sm);\n } while ((r & -r) != r);\n return 0;\n }\n\n private:\n int _n, size, log;\n std::vector<S> d;\n\n void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_SEGTREE_HPP\n","include/atcoder/string":"#ifndef ATCODER_STRING_HPP\n#define ATCODER_STRING_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <numeric>\n#include <string>\n#include <vector>\n\nnamespace atcoder {\n\nnamespace internal {\n\nstd::vector<int> sa_naive(const std::vector<int>& s) {\n int n = int(s.size());\n std::vector<int> sa(n);\n std::iota(sa.begin(), sa.end(), 0);\n std::sort(sa.begin(), sa.end(), [&](int l, int r) {\n if (l == r) return false;\n while (l < n && r < n) {\n if (s[l] != s[r]) return s[l] < s[r];\n l++;\n r++;\n }\n return l == n;\n });\n return sa;\n}\n\nstd::vector<int> sa_doubling(const std::vector<int>& s) {\n int n = int(s.size());\n std::vector<int> sa(n), rnk = s, tmp(n);\n std::iota(sa.begin(), sa.end(), 0);\n for (int k = 1; k < n; k *= 2) {\n auto cmp = [&](int x, int y) {\n if (rnk[x] != rnk[y]) return rnk[x] < rnk[y];\n int rx = x + k < n ? rnk[x + k] : -1;\n int ry = y + k < n ? rnk[y + k] : -1;\n return rx < ry;\n };\n std::sort(sa.begin(), sa.end(), cmp);\n tmp[sa[0]] = 0;\n for (int i = 1; i < n; i++) {\n tmp[sa[i]] = tmp[sa[i - 1]] + (cmp(sa[i - 1], sa[i]) ? 1 : 0);\n }\n std::swap(tmp, rnk);\n }\n return sa;\n}\n\n// SA-IS, linear-time suffix array construction\n// Reference:\n// G. Nong, S. Zhang, and W. H. Chan,\n// Two Efficient Algorithms for Linear Time Suffix Array Construction\ntemplate <int THRESHOLD_NAIVE = 10, int THRESHOLD_DOUBLING = 40>\nstd::vector<int> sa_is(const std::vector<int>& s, int upper) {\n int n = int(s.size());\n if (n == 0) return {};\n if (n == 1) return {0};\n if (n == 2) {\n if (s[0] < s[1]) {\n return {0, 1};\n } else {\n return {1, 0};\n }\n }\n if (n < THRESHOLD_NAIVE) {\n return sa_naive(s);\n }\n if (n < THRESHOLD_DOUBLING) {\n return sa_doubling(s);\n }\n\n std::vector<int> sa(n);\n std::vector<bool> ls(n);\n for (int i = n - 2; i >= 0; i--) {\n ls[i] = (s[i] == s[i + 1]) ? ls[i + 1] : (s[i] < s[i + 1]);\n }\n std::vector<int> sum_l(upper + 1), sum_s(upper + 1);\n for (int i = 0; i < n; i++) {\n if (!ls[i]) {\n sum_s[s[i]]++;\n } else {\n sum_l[s[i] + 1]++;\n }\n }\n for (int i = 0; i <= upper; i++) {\n sum_s[i] += sum_l[i];\n if (i < upper) sum_l[i + 1] += sum_s[i];\n }\n\n auto induce = [&](const std::vector<int>& lms) {\n std::fill(sa.begin(), sa.end(), -1);\n std::vector<int> buf(upper + 1);\n std::copy(sum_s.begin(), sum_s.end(), buf.begin());\n for (auto d : lms) {\n if (d == n) continue;\n sa[buf[s[d]]++] = d;\n }\n std::copy(sum_l.begin(), sum_l.end(), buf.begin());\n sa[buf[s[n - 1]]++] = n - 1;\n for (int i = 0; i < n; i++) {\n int v = sa[i];\n if (v >= 1 && !ls[v - 1]) {\n sa[buf[s[v - 1]]++] = v - 1;\n }\n }\n std::copy(sum_l.begin(), sum_l.end(), buf.begin());\n for (int i = n - 1; i >= 0; i--) {\n int v = sa[i];\n if (v >= 1 && ls[v - 1]) {\n sa[--buf[s[v - 1] + 1]] = v - 1;\n }\n }\n };\n\n std::vector<int> lms_map(n + 1, -1);\n int m = 0;\n for (int i = 1; i < n; i++) {\n if (!ls[i - 1] && ls[i]) {\n lms_map[i] = m++;\n }\n }\n std::vector<int> lms;\n lms.reserve(m);\n for (int i = 1; i < n; i++) {\n if (!ls[i - 1] && ls[i]) {\n lms.push_back(i);\n }\n }\n\n induce(lms);\n\n if (m) {\n std::vector<int> sorted_lms;\n sorted_lms.reserve(m);\n for (int v : sa) {\n if (lms_map[v] != -1) sorted_lms.push_back(v);\n }\n std::vector<int> rec_s(m);\n int rec_upper = 0;\n rec_s[lms_map[sorted_lms[0]]] = 0;\n for (int i = 1; i < m; i++) {\n int l = sorted_lms[i - 1], r = sorted_lms[i];\n int end_l = (lms_map[l] + 1 < m) ? lms[lms_map[l] + 1] : n;\n int end_r = (lms_map[r] + 1 < m) ? lms[lms_map[r] + 1] : n;\n bool same = true;\n if (end_l - l != end_r - r) {\n same = false;\n } else {\n while (l < end_l) {\n if (s[l] != s[r]) {\n break;\n }\n l++;\n r++;\n }\n if (l == n || s[l] != s[r]) same = false;\n }\n if (!same) rec_upper++;\n rec_s[lms_map[sorted_lms[i]]] = rec_upper;\n }\n\n auto rec_sa =\n sa_is<THRESHOLD_NAIVE, THRESHOLD_DOUBLING>(rec_s, rec_upper);\n\n for (int i = 0; i < m; i++) {\n sorted_lms[i] = lms[rec_sa[i]];\n }\n induce(sorted_lms);\n }\n return sa;\n}\n\n} // namespace internal\n\nstd::vector<int> suffix_array(const std::vector<int>& s, int upper) {\n assert(0 <= upper);\n for (int d : s) {\n assert(0 <= d && d <= upper);\n }\n auto sa = internal::sa_is(s, upper);\n return sa;\n}\n\ntemplate <class T> std::vector<int> suffix_array(const std::vector<T>& s) {\n int n = int(s.size());\n std::vector<int> idx(n);\n iota(idx.begin(), idx.end(), 0);\n sort(idx.begin(), idx.end(), [&](int l, int r) { return s[l] < s[r]; });\n std::vector<int> s2(n);\n int now = 0;\n for (int i = 0; i < n; i++) {\n if (i && s[idx[i - 1]] != s[idx[i]]) now++;\n s2[idx[i]] = now;\n }\n return internal::sa_is(s2, now);\n}\n\nstd::vector<int> suffix_array(const std::string& s) {\n int n = int(s.size());\n std::vector<int> s2(n);\n for (int i = 0; i < n; i++) {\n s2[i] = s[i];\n }\n return internal::sa_is(s2, 255);\n}\n\n// Reference:\n// T. Kasai, G. Lee, H. Arimura, S. Arikawa, and K. Park,\n// Linear-Time Longest-Common-Prefix Computation in Suffix Arrays and Its\n// Applications\ntemplate <class T>\nstd::vector<int> lcp_array(const std::vector<T>& s,\n const std::vector<int>& sa) {\n assert(s.size() == sa.size());\n int n = int(s.size());\n assert(n >= 1);\n std::vector<int> rnk(n);\n for (int i = 0; i < n; i++) {\n assert(0 <= sa[i] && sa[i] < n);\n rnk[sa[i]] = i;\n }\n std::vector<int> lcp(n - 1);\n int h = 0;\n for (int i = 0; i < n; i++) {\n if (h > 0) h--;\n if (rnk[i] == 0) continue;\n int j = sa[rnk[i] - 1];\n for (; j + h < n && i + h < n; h++) {\n if (s[j + h] != s[i + h]) break;\n }\n lcp[rnk[i] - 1] = h;\n }\n return lcp;\n}\n\nstd::vector<int> lcp_array(const std::string& s, const std::vector<int>& sa) {\n int n = int(s.size());\n std::vector<int> s2(n);\n for (int i = 0; i < n; i++) {\n s2[i] = s[i];\n }\n return lcp_array(s2, sa);\n}\n\n// Reference:\n// D. Gusfield,\n// Algorithms on Strings, Trees, and Sequences: Computer Science and\n// Computational Biology\ntemplate <class T> std::vector<int> z_algorithm(const std::vector<T>& s) {\n int n = int(s.size());\n if (n == 0) return {};\n std::vector<int> z(n);\n z[0] = 0;\n for (int i = 1, j = 0; i < n; i++) {\n int& k = z[i];\n k = (j + z[j] <= i) ? 0 : std::min(j + z[j] - i, z[i - j]);\n while (i + k < n && s[k] == s[i + k]) k++;\n if (j + z[j] < i + z[i]) j = i;\n }\n z[0] = n;\n return z;\n}\n\nstd::vector<int> z_algorithm(const std::string& s) {\n int n = int(s.size());\n std::vector<int> s2(n);\n for (int i = 0; i < n; i++) {\n s2[i] = s[i];\n }\n return z_algorithm(s2);\n}\n\n} // namespace atcoder\n\n#endif // ATCODER_STRING_HPP\n","include/atcoder/string.hpp":"#ifndef ATCODER_STRING_HPP\n#define ATCODER_STRING_HPP 1\n\n#include <algorithm>\n#include <cassert>\n#include <numeric>\n#include <string>\n#include <vector>\n\nnamespace atcoder {\n\nnamespace internal {\n\nstd::vector<int> sa_naive(const std::vector<int>& s) {\n int n = int(s.size());\n std::vector<int> sa(n);\n std::iota(sa.begin(), sa.end(), 0);\n std::sort(sa.begin(), sa.end(), [&](int l, int r) {\n if (l == r) return false;\n while (l < n && r < n) {\n if (s[l] != s[r]) return s[l] < s[r];\n l++;\n r++;\n }\n return l == n;\n });\n return sa;\n}\n\nstd::vector<int> sa_doubling(const std::vector<int>& s) {\n int n = int(s.size());\n std::vector<int> sa(n), rnk = s, tmp(n);\n std::iota(sa.begin(), sa.end(), 0);\n for (int k = 1; k < n; k *= 2) {\n auto cmp = [&](int x, int y) {\n if (rnk[x] != rnk[y]) return rnk[x] < rnk[y];\n int rx = x + k < n ? rnk[x + k] : -1;\n int ry = y + k < n ? rnk[y + k] : -1;\n return rx < ry;\n };\n std::sort(sa.begin(), sa.end(), cmp);\n tmp[sa[0]] = 0;\n for (int i = 1; i < n; i++) {\n tmp[sa[i]] = tmp[sa[i - 1]] + (cmp(sa[i - 1], sa[i]) ? 1 : 0);\n }\n std::swap(tmp, rnk);\n }\n return sa;\n}\n\n// SA-IS, linear-time suffix array construction\n// Reference:\n// G. Nong, S. Zhang, and W. H. Chan,\n// Two Efficient Algorithms for Linear Time Suffix Array Construction\ntemplate <int THRESHOLD_NAIVE = 10, int THRESHOLD_DOUBLING = 40>\nstd::vector<int> sa_is(const std::vector<int>& s, int upper) {\n int n = int(s.size());\n if (n == 0) return {};\n if (n == 1) return {0};\n if (n == 2) {\n if (s[0] < s[1]) {\n return {0, 1};\n } else {\n return {1, 0};\n }\n }\n if (n < THRESHOLD_NAIVE) {\n return sa_naive(s);\n }\n if (n < THRESHOLD_DOUBLING) {\n return sa_doubling(s);\n }\n\n std::vector<int> sa(n);\n std::vector<bool> ls(n);\n for (int i = n - 2; i >= 0; i--) {\n ls[i] = (s[i] == s[i + 1]) ? ls[i + 1] : (s[i] < s[i + 1]);\n }\n std::vector<int> sum_l(upper + 1), sum_s(upper + 1);\n for (int i = 0; i < n; i++) {\n if (!ls[i]) {\n sum_s[s[i]]++;\n } else {\n sum_l[s[i] + 1]++;\n }\n }\n for (int i = 0; i <= upper; i++) {\n sum_s[i] += sum_l[i];\n if (i < upper) sum_l[i + 1] += sum_s[i];\n }\n\n auto induce = [&](const std::vector<int>& lms) {\n std::fill(sa.begin(), sa.end(), -1);\n std::vector<int> buf(upper + 1);\n std::copy(sum_s.begin(), sum_s.end(), buf.begin());\n for (auto d : lms) {\n if (d == n) continue;\n sa[buf[s[d]]++] = d;\n }\n std::copy(sum_l.begin(), sum_l.end(), buf.begin());\n sa[buf[s[n - 1]]++] = n - 1;\n for (int i = 0; i < n; i++) {\n int v = sa[i];\n if (v >= 1 && !ls[v - 1]) {\n sa[buf[s[v - 1]]++] = v - 1;\n }\n }\n std::copy(sum_l.begin(), sum_l.end(), buf.begin());\n for (int i = n - 1; i >= 0; i--) {\n int v = sa[i];\n if (v >= 1 && ls[v - 1]) {\n sa[--buf[s[v - 1] + 1]] = v - 1;\n }\n }\n };\n\n std::vector<int> lms_map(n + 1, -1);\n int m = 0;\n for (int i = 1; i < n; i++) {\n if (!ls[i - 1] && ls[i]) {\n lms_map[i] = m++;\n }\n }\n std::vector<int> lms;\n lms.reserve(m);\n for (int i = 1; i < n; i++) {\n if (!ls[i - 1] && ls[i]) {\n lms.push_back(i);\n }\n }\n\n induce(lms);\n\n if (m) {\n std::vector<int> sorted_lms;\n sorted_lms.reserve(m);\n for (int v : sa) {\n if (lms_map[v] != -1) sorted_lms.push_back(v);\n }\n std::vector<int> rec_s(m);\n int rec_upper = 0;\n rec_s[lms_map[sorted_lms[0]]] = 0;\n for (int i = 1; i < m; i++) {\n int l = sorted_lms[i - 1], r = sorted_lms[i];\n int end_l = (lms_map[l] + 1 < m) ? lms[lms_map[l] + 1] : n;\n int end_r = (lms_map[r] + 1 < m) ? lms[lms_map[r] + 1] : n;\n bool same = true;\n if (end_l - l != end_r - r) {\n same = false;\n } else {\n while (l < end_l) {\n if (s[l] != s[r]) {\n break;\n }\n l++;\n r++;\n }\n if (l == n || s[l] != s[r]) same = false;\n }\n if (!same) rec_upper++;\n rec_s[lms_map[sorted_lms[i]]] = rec_upper;\n }\n\n auto rec_sa =\n sa_is<THRESHOLD_NAIVE, THRESHOLD_DOUBLING>(rec_s, rec_upper);\n\n for (int i = 0; i < m; i++) {\n sorted_lms[i] = lms[rec_sa[i]];\n }\n induce(sorted_lms);\n }\n return sa;\n}\n\n} // namespace internal\n\nstd::vector<int> suffix_array(const std::vector<int>& s, int upper) {\n assert(0 <= upper);\n for (int d : s) {\n assert(0 <= d && d <= upper);\n }\n auto sa = internal::sa_is(s, upper);\n return sa;\n}\n\ntemplate <class T> std::vector<int> suffix_array(const std::vector<T>& s) {\n int n = int(s.size());\n std::vector<int> idx(n);\n iota(idx.begin(), idx.end(), 0);\n sort(idx.begin(), idx.end(), [&](int l, int r) { return s[l] < s[r]; });\n std::vector<int> s2(n);\n int now = 0;\n for (int i = 0; i < n; i++) {\n if (i && s[idx[i - 1]] != s[idx[i]]) now++;\n s2[idx[i]] = now;\n }\n return internal::sa_is(s2, now);\n}\n\nstd::vector<int> suffix_array(const std::string& s) {\n int n = int(s.size());\n std::vector<int> s2(n);\n for (int i = 0; i < n; i++) {\n s2[i] = s[i];\n }\n return internal::sa_is(s2, 255);\n}\n\n// Reference:\n// T. Kasai, G. Lee, H. Arimura, S. Arikawa, and K. Park,\n// Linear-Time Longest-Common-Prefix Computation in Suffix Arrays and Its\n// Applications\ntemplate <class T>\nstd::vector<int> lcp_array(const std::vector<T>& s,\n const std::vector<int>& sa) {\n assert(s.size() == sa.size());\n int n = int(s.size());\n assert(n >= 1);\n std::vector<int> rnk(n);\n for (int i = 0; i < n; i++) {\n assert(0 <= sa[i] && sa[i] < n);\n rnk[sa[i]] = i;\n }\n std::vector<int> lcp(n - 1);\n int h = 0;\n for (int i = 0; i < n; i++) {\n if (h > 0) h--;\n if (rnk[i] == 0) continue;\n int j = sa[rnk[i] - 1];\n for (; j + h < n && i + h < n; h++) {\n if (s[j + h] != s[i + h]) break;\n }\n lcp[rnk[i] - 1] = h;\n }\n return lcp;\n}\n\nstd::vector<int> lcp_array(const std::string& s, const std::vector<int>& sa) {\n int n = int(s.size());\n std::vector<int> s2(n);\n for (int i = 0; i < n; i++) {\n s2[i] = s[i];\n }\n return lcp_array(s2, sa);\n}\n\n// Reference:\n// D. Gusfield,\n// Algorithms on Strings, Trees, and Sequences: Computer Science and\n// Computational Biology\ntemplate <class T> std::vector<int> z_algorithm(const std::vector<T>& s) {\n int n = int(s.size());\n if (n == 0) return {};\n std::vector<int> z(n);\n z[0] = 0;\n for (int i = 1, j = 0; i < n; i++) {\n int& k = z[i];\n k = (j + z[j] <= i) ? 0 : std::min(j + z[j] - i, z[i - j]);\n while (i + k < n && s[k] == s[i + k]) k++;\n if (j + z[j] < i + z[i]) j = i;\n }\n z[0] = n;\n return z;\n}\n\nstd::vector<int> z_algorithm(const std::string& s) {\n int n = int(s.size());\n std::vector<int> s2(n);\n for (int i = 0; i < n; i++) {\n s2[i] = s[i];\n }\n return z_algorithm(s2);\n}\n\n} // namespace atcoder\n\n#endif // ATCODER_STRING_HPP\n","include/atcoder/twosat":"#ifndef ATCODER_TWOSAT_HPP\n#define ATCODER_TWOSAT_HPP 1\n\n#include <cassert>\n#include <vector>\n\n#include \"atcoder/internal_scc\"\n\nnamespace atcoder {\n\n// Reference:\n// B. Aspvall, M. Plass, and R. Tarjan,\n// A Linear-Time Algorithm for Testing the Truth of Certain Quantified Boolean\n// Formulas\nstruct two_sat {\n public:\n two_sat() : _n(0), scc(0) {}\n explicit two_sat(int n) : _n(n), _answer(n), scc(2 * n) {}\n\n void add_clause(int i, bool f, int j, bool g) {\n assert(0 <= i && i < _n);\n assert(0 <= j && j < _n);\n scc.add_edge(2 * i + (f ? 0 : 1), 2 * j + (g ? 1 : 0));\n scc.add_edge(2 * j + (g ? 0 : 1), 2 * i + (f ? 1 : 0));\n }\n bool satisfiable() {\n auto id = scc.scc_ids().second;\n for (int i = 0; i < _n; i++) {\n if (id[2 * i] == id[2 * i + 1]) return false;\n _answer[i] = id[2 * i] < id[2 * i + 1];\n }\n return true;\n }\n std::vector<bool> answer() { return _answer; }\n\n private:\n int _n;\n std::vector<bool> _answer;\n internal::scc_graph scc;\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_TWOSAT_HPP\n","include/atcoder/twosat.hpp":"#ifndef ATCODER_TWOSAT_HPP\n#define ATCODER_TWOSAT_HPP 1\n\n#include <cassert>\n#include <vector>\n\n#include \"atcoder/internal_scc\"\n\nnamespace atcoder {\n\n// Reference:\n// B. Aspvall, M. Plass, and R. Tarjan,\n// A Linear-Time Algorithm for Testing the Truth of Certain Quantified Boolean\n// Formulas\nstruct two_sat {\n public:\n two_sat() : _n(0), scc(0) {}\n explicit two_sat(int n) : _n(n), _answer(n), scc(2 * n) {}\n\n void add_clause(int i, bool f, int j, bool g) {\n assert(0 <= i && i < _n);\n assert(0 <= j && j < _n);\n scc.add_edge(2 * i + (f ? 0 : 1), 2 * j + (g ? 1 : 0));\n scc.add_edge(2 * j + (g ? 0 : 1), 2 * i + (f ? 1 : 0));\n }\n bool satisfiable() {\n auto id = scc.scc_ids().second;\n for (int i = 0; i < _n; i++) {\n if (id[2 * i] == id[2 * i + 1]) return false;\n _answer[i] = id[2 * i] < id[2 * i + 1];\n }\n return true;\n }\n std::vector<bool> answer() { return _answer; }\n\n private:\n int _n;\n std::vector<bool> _answer;\n internal::scc_graph scc;\n};\n\n} // namespace atcoder\n\n#endif // ATCODER_TWOSAT_HPP\n"}}
|