7¤0ìEDrB¨2ã0333333333…
ýÆß"—m‘Þ¡Ò�„Û¤–ŒaÂ346Õ>Ffà¿ß”–aªª±Ûý•o[™!ÌD%À3( ‹DB‘Hlü  ‡Ÿ—“‹Ë£áp$	Äa FAEA„QrÌ1‡ˆ  T9õ,¨�!                    
module concepts {
    umbrella "concepts"
    export *
}
module meta {
    umbrella "meta"
    export *
}
module range_v3 {
    umbrella "range"
    export *
    exclude header "range/v3/algorithm/tagspec.hpp"
    exclude header "range/v3/at.hpp"
    exclude header "range/v3/back.hpp"
    exclude header "range/v3/begin_end.hpp"
    exclude header "range/v3/data.hpp"
    exclude header "range/v3/distance.hpp"
    exclude header "range/v3/em     : sin_(&sin)
          , str_{}
          , delim_(delim)
        {
            this->next(); // prime the pump
        }
        std::string & cached() noexcept
        {
            return str_;
        }
    };

    /// \cond
    using getlines_range RANGES_DEPRECATED(
        "getlines_range has been renamed getlines_view") = getlines_view;
    /// \endcond

    struct getlines_fn
    {
        getlines_view operator()(std::istream & sin, char delim = '\n') const
        {
            return getlines_view{sin, delim};
    .com/ericniebler/range-v3
//

#ifndef RANGES_V3_VIEW_FOR_EACH_HPP
#define RANGES_V3_VIEW_FOR_EACH_HPP

#include <utility>

#include <meta/meta.hpp>

#include <range/v3/range_fwd.hpp>

#include <range/v3/functional/bind_back.hpp>
#include <range/v3/functional/invoke.hpp>
#include <range/v3/utility/static_const.hpp>
#include <range/v3/view/all.hpp>
#include <range/v3/view/generate_n.hpp>
#include <range/v3/view/join.hpp>
#include <range/v3/view/repeat_n.hpp>
#include <range/v3/view/single.hpp>
#include <range/v3/view/transform.hpp>
#     , fun_(std::move(fun))
        {}
    };

#if RANGES_CXX_DEDUCTION_GUIDES >= RANGES_CXX_DEDUCTION_GUIDES_17
    template(typename Rng, typename Fun)(
        requires copy_constructible<Fun>) chunk_by_view(Rng &&, Fun)
        ->chunk_by_view<views::all_t<Rng>, Fun>;
#endif

    namespace views
    {
        struct chunk_by_base_fn
        {
            template(typename Rng, typename Fun)(
                requires viewable_range<Rng> AND forward_range<Rng> AND //
                    indirect_relation<Fun, iterator_t<Rng>>)   l equal(cursor that) const
            {
                return !rng_->sin_ == !that.rng_->sin_;
            }
        };
        void next()
        {
            if(!(*sin_ >> cached()))
                sin_ = nullptr;
        }
        cursor begin_cursor()
        {
            return cursor{this};
        }

    public:
        istream_view() = default;
        explicit istream_view(std::istream & sin)
          : sin_(&sin)
          , obj_{}
        {
            next(); // prime the pump
        }
        Val & cached() noeename D = Derived)(
            requires same_as<D, Derived> AND range<base_range_t const>)
        constexpr auto begin_cursor() const
            noexcept(noexcept(view_adaptor::begin_cursor_(std::declval<D const &>())))
                -> decltype(view_adaptor::begin_cursor_(std::declval<D const &>()))
        {
            return view_adaptor::begin_cursor_(derived());
        }

        template<typename D>
        static constexpr adaptor_sentinel_t<D> end_cursor_(D & d) noexcept(noexcept(
            adaptor_sentinel_t<D>{stlval<A const &>().read(std::declval<BaseIter const &>())))
        {
            using V = range_access::cursor_value_t<adaptor_cursor>;
            static_assert(common_reference_with<R &&, V &>,
                          "In your adaptor, you've specified a value type that does not "
                          "share a common reference type with the return type of read.");
            return this->data_.second().read(this->data_.first());
        }
        template<typename A = Adapt, typename = decltype(std::declval<A &>().next(
RESS compressed_pair<BaseSent, Adapt> data_;

    public:
        base_adaptor_sentinel() = default;
        base_adaptor_sentinel(BaseSent sent, Adapt adapt)
          : data_{std::move(sent), std::move(adapt)}
        {}

        // All sentinels into adapted ranges have a base() member for fetching
        // the underlying sentinel.
        BaseSent base() const
        {
            return data_.first();
        }

    protected:
        // Adaptor accessor
        Adapt & get()
        {
            return data_.second();
        template<typename Derived>
        using adapted_iterator_t = detail::decay_t<decltype(
            std::declval<begin_adaptor_t<Derived>>().begin(std::declval<Derived &>()))>;

        template<typename Derived>
        using adapted_sentinel_t = detail::decay_t<decltype(
            std::declval<end_adaptor_t<Derived>>().end(std::declval<Derived &>()))>;

        struct adaptor_base_current_mem_fn
        {};

        template<typename BaseIter, typename Adapt>
        constexpr int which_adaptor_value_(priority_tag<0>)
    or.hpp>
#include <range/v3/view/view.hpp>

#include <range/v3/detail/prologue.hpp>

namespace ranges
{
    /// \addtogroup group-views
    /// @{
    template<typename Rng, typename Pred>
    struct iter_take_while_view
      : view_adaptor<iter_take_while_view<Rng, Pred>, Rng,
                     is_finite<Rng>::value ? finite : unknown>
    {
    private:
        friend range_access;
        RANGES_NO_UNIQUE_ADDRESS semiregular_box_t<Pred> pred_;

        template<bool IsConst>
        struct sentinel_adaptor : adaptor_base
    or_t<meta::const_if_c<Const, Rngs>>>...>)
            {
                // By returning true if *any* of the iterators are equal, we allow
                // zipped ranges to be of different lengths, stopping when the first
                // one reaches the last.
                return tuple_foldl(tuple_transform(its_, that.its_, detail::equal_to),
                                   false,
                                   [](bool a, bool b) { return a || b; });
            }
            bool equal(sentinel<Const> const & s) constail::ignore_t,
                     std::tuple<sentinel_t<meta::const_if_c<Const, Rngs>>...> ends)
              : ends_(std::move(ends))
            {}
            template(bool Other)(
                requires Const AND CPP_NOT(Other)) //
            sentinel(sentinel<Other> that)
              : ends_(std::move(that.ends_))
            {}
        };

        template<bool Const>
        struct cursor
        {
        private:
            friend struct cursor<!Const>;
            using fun_ref_ = semiregular_box_ref_or_val_t<Fu  - The range of elements to filter
        ///   - Reference type: `T`
        ///
        /// <pre><b>output_range</b></pre>
        ///   - The range of filtered values
        ///     - Is either a `forward_range` or the concept satisfied by the input
        ///     - Is a `common_range` if the input is a `common_range`
        ///     - Is not a `sized_range` or `borrowed_range`
        ///   - Reference type: `T`
        ///
        struct filter_fn : filter_base_fn
        {
            using filter_base_fn::operator();

  oj proj) const
                -> drop_while_view<all_t<Rng>, composed<Pred, Proj>>
            {
                return {all(static_cast<Rng &&>(rng)),
                        compose(std::move(pred), std::move(proj))};
            }
        };

        struct drop_while_bind_fn
        {
            template<typename Pred>
            constexpr auto operator()(Pred pred) const // TODO: underconstrained
            {
                return make_view_closure(
                    bind_back(drop_while_base_fn{}, std::move(pred)));
  ar_box_t<Pred> pred_;
        detail::non_propagating_cache<iterator_t<Rng>> begin_;

        iterator_t<Rng> get_begin_()
        {
            if(!begin_)
                begin_ = find_if_not(rng_, std::ref(pred_));
            return *begin_;
        }

    public:
        drop_while_view() = default;
        drop_while_view(Rng rng, Pred pred)
          : rng_(std::move(rng))
          , pred_(std::move(pred))
        {}
        iterator_t<Rng> begin()
        {
            return get_begin_();
        }
        sentinel_t<Rng>             is_finite<Rng>::value ? finite : range_cardinality<Rng>::value>
      , private detail::non_propagating_cache<iterator_t<Rng>, drop_view<Rng>,
                                              !random_access_range<Rng>>
    {
    private:
        using difference_type_ = range_difference_t<Rng>;
        Rng rng_;
        difference_type_ n_;

        template(bool Const = true)(
            requires Const AND range<meta::const_if_c<Const, Rng>>)
        iterator_t<meta::const_if_c<Const, Rng>> //
        get_begin_(std::trconstexpr iota_view<Val, Val> operator()(Val from, Val to) const
            {
                return {from, to};
            }
        };

        /// \relates ints_fn
        /// \ingroup group-views
        RANGES_INLINE_VARIABLE(ints_fn, ints)
    } // namespace views

    namespace cpp20
    {
        namespace views
        {
            using ranges::views::iota;
        }
    } // namespace cpp20
    /// @}
} // namespace ranges

#include <range/v3/detail/satisfy_boost_range.hpp>
RANGES_SATISFY_BOOST_RANGE(::ranges::closed_hable_sentinel_t*/>
    struct RANGES_EMPTY_BASES iota_view
      : view_facade<iota_view<From, To>,
                    same_as<To, unreachable_sentinel_t>
                        ? infinite
                        : std::is_integral<From>::value && std::is_integral<To>::value
                              ? finite
                              : unknown>
    {
    private:
        friend range_access;
        From from_ = From();
        RANGES_NO_UNIQUE_ADDRESS To to_ = To();

        struct cursor;
        struct sentinel
        constexpr void check_bounds_(std::false_type)
        {}

    public:
        closed_iota_view() = default;
        constexpr closed_iota_view(meta::id_t<From> from, meta::id_t<To> to)
          : from_(std::move(from))
          , to_(std::move(to))
        {
            check_bounds_(meta::bool_<totally_ordered_with<From, To>>{});
        }
    };

    template<typename From, typename To>
    RANGES_INLINE_VAR constexpr bool enable_borrowed_range<closed_iota_view<From, To>> =
        true;

#if RANGES_CXX_DEDUCTION_GUIDES >= Rge/v3/view/delimit.hpp>
#include <range/v3/view/facade.hpp>

#include <range/v3/detail/prologue.hpp>

RANGES_DIAGNOSTIC_PUSH
RANGES_DIAGNOSTIC_IGNORE_UNSIGNED_MATH
RANGES_DIAGNOSTIC_IGNORE_TRUNCATION

namespace ranges
{
    /// \cond
    namespace detail
    {
        template<std::size_t N, typename = void>
        struct promote_as_signed_
        {
            // This shouldn't cause us to LOSE precision, but maybe it doesn't
            // net us any either.
            static_assert(sizeof(std::intmax_t) * CHAR_BIT >= N,
     concept
    template<typename C>
    CPP_concept random_access_reservable =
        reservable<C> && random_access_range<C>;
    // clang-format on

    /// \cond
    namespace detail
    {
        template(typename T)(
            requires container<T>)
        std::true_type is_lvalue_container_like(T &) noexcept
        {
            return {};
        }

        template(typename T)(
            requires container<T>)
        meta::not_<std::is_rvalue_reference<T>> //
        is_lvalue_container_like(reference_wrapper<T>) noexc_value_t<T>>>
    );

    /// \concept container
    /// \brief The \c container concept
    template<typename T>
    CPP_concept container =
        semi_container<T> &&
        CPP_concept_ref(ranges::container_, T);

    /// \concept reservable_
    /// \brief The \c reservable_ concept
    template<typename C>
    CPP_requires(reservable_,
        requires(C & c, C const & cc) //
        (
            c.reserve(ranges::size(c)),
            cc.capacity(),
            cc.max_size(),
            concepts::requires_<same_as<declty return make_action_closure(bind_back(slice_fn{}, from, to));
            }

            template(typename Rng, typename I = iterator_t<Rng>)(
                requires forward_range<Rng> AND erasable_range<Rng &, I, I>)
            Rng operator()(Rng && rng, diff_t<Rng> from, diff_t<Rng> to) const
            {
                RANGES_EXPECT(0 <= from && 0 <= to && from <= to);
                RANGES_EXPECT(!sized_range<Rng> || to <= distance(rng));
                ranges::actions::erase(rng, begin(rng), next(begin(rng), from));
   like<Cont> AND input_iterator<P> AND
                sentinel_for<S, I> AND
            (!range<S>)) //
        auto insert(Cont && cont, P p, I i, S j) //
            -> decltype(detail::insert_impl(
                static_cast<Cont &&>(cont),
                static_cast<P &&>(p),
                static_cast<I &&>(i),
                static_cast<S &&>(j),
                meta::bool_<random_access_reservable<Cont> && //
                            sized_sentinel_for<S, I>>{}))
        {
            return detail::insert_impl(staticuto const delta = static_cast<range_size_t<Cont>>(j - i);
                auto pos = insert_reserve_helper(cont, std::move(p), delta);
                return cont.insert(pos, C{std::move(i)}, C{std::move(j)});
            }

            template(typename Cont, typename I, typename Rng)(
                requires range<Rng>)
            auto insert_impl(Cont && cont, I p, Rng && rng, std::false_type)
                -> decltype(unwrap_reference(cont).insert(
                    p, range_cpp17_iterator_t<Rng>{ranges::begin(rng)},
     requires lvalue_container_like<Cont> AND range<Rng>)
        insert_t<Cont, Rng> push_back(Cont && cont, Rng && rng)
        {
            ranges::insert(cont, end(cont), static_cast<Rng &&>(rng));
        }

        /// \cond
        // clang-format off
        /// \concept can_push_back_frag_
        /// \brief The \c can_push_back_frag_ concept
        template<typename Rng, typename T>
        CPP_requires(can_push_back_frag_,
            requires(Rng && rng, T && t) //
            (
                push_back(rng, (T &&) t)
  tible_to<invoke_result_t<Gen &>, range_difference_t<Rng>>)
            Rng operator()(Rng && rng, Gen && gen) const
            {
                ranges::shuffle(rng, static_cast<Gen &&>(gen));
                return static_cast<Rng &&>(rng);
            }

            /// \cond
            template<typename Rng, typename T>
            invoke_result_t<shuffle_fn, Rng, T &> //
            operator()(Rng && rng, detail::reference_wrapper_<T> r) const
            {
                return (*this)(static_cast<Rng &&>(rng), r.get());
  ame Fun)(
                requires forward_range<Rng> AND
                        predicate<Fun const &, range_reference_t<Rng>> AND
                            copy_constructible<Fun>)
            std::vector<split_value_t<Rng>> operator()(Rng && rng, Fun fun) const
            {
                return views::split_when(rng, std::move(fun)) |
                       to<std::vector<split_value_t<Rng>>>();
            }
        };

        /// \relates actions::split_when_fn
        RANGES_INLINE_VARIABLE(split_when_fn, split_when)
  meta::if_c<(bool)ranges::container<Rng>, //
                           uncvref_t<Rng>, std::vector<range_value_t<Rng>>>;

            template<typename Fun>
            constexpr auto operator()(Fun fun) const
            {
                return make_action_closure(
                    bind_back(split_when_fn{}, static_cast<Fun &&>(fun)));
            }

            // BUGBUG something is not right with the actions. It should be possible
            // to move a container into a split and have elements moved into the result.
               "action_access and actions::action<> are deprecated. Please "
            "replace action<> with action_closure<> and discontinue use of "
            "action_access.") = action_access_;

        template<typename>
        struct old_action_;

        struct make_action_fn_
        {
            template<typename Fun>
            constexpr old_action_<Fun> operator()(Fun fun) const
            {
                return old_action_<Fun>{static_cast<Fun &&>(fun)};
            }
        };
        using make_action_fn RANGES********************
            // *    When piping a range into an action, the range must be moved in.     *
            // **************************************************************************
#endif // RANGES_WORKAROUND_CLANG_43400

            template<typename ActionFn, typename Pipeable>
            friend constexpr auto operator|(action_closure<ActionFn> act, Pipeable pipe)
                -> CPP_broken_friend_ret(action_closure<composed<Pipeable, ActionFn>>)(
                    requires (is_pipeable_v<Pipeable>))
   HPP
#define RANGES_V3_ACTION_TAKE_WHILE_HPP

#include <range/v3/range_fwd.hpp>

#include <range/v3/action/action.hpp>
#include <range/v3/action/erase.hpp>
#include <range/v3/algorithm/find_if_not.hpp>
#include <range/v3/functional/bind_back.hpp>
#include <range/v3/iterator/concepts.hpp>
#include <range/v3/iterator/traits.hpp>
#include <range/v3/utility/static_const.hpp>

#include <range/v3/detail/prologue.hpp>

namespace ranges
{
    /// \addtogroup group-actions
    /// @{
    namespace actions
    {
        struct take_while_fn
 {
    /// \addtogroup group-actions
    /// @{
    namespace actions
    {
        struct drop_fn
        {
            template(typename Int)(
                requires detail::integer_like_<Int>)
            constexpr auto operator()(Int n) const
            {
                RANGES_EXPECT(n >= Int(0));
                return make_action_closure(bind_back(drop_fn{}, n));
            }

            template(typename Rng)(
                requires forward_range<Rng> AND
                    erasable_range<Rng &, iterator_t<Rng>, itereclval<T>())));

        template<typename Cont, typename Rng>
        using insert_t = decltype(static_cast<void>(
            ranges::insert(std::declval<Cont &>(), std::declval<iterator_t<Cont>>(),
                           std::declval<Rng>())));

        template(typename Cont, typename T)(
            requires lvalue_container_like<Cont> AND
                (!range<T>) AND constructible_from<range_value_t<Cont>, T>)
        push_front_t<Cont, T> push_front(Cont && cont, T && t)
        {
            unwrap_reference(cont).pulang__) && (defined(__CYGWIN__) || defined(__apple_build_version__)))
// BUGBUG avoid unresolved __cxa_thread_atexit
#define RANGES_CXX_THREAD_LOCAL RANGES_CXX_THREAD_LOCAL_PRE_STANDARD
#else
#define RANGES_CXX_THREAD_LOCAL RANGES_CXX_FEATURE(THREAD_LOCAL)
#endif
#endif

#if !defined(RANGES_DEPRECATED) && !defined(RANGES_DISABLE_DEPRECATED_WARNINGS)
#if defined(__GNUC__) && !defined(__clang__)
// GCC's support for [[deprecated("message")]] is unusably buggy.
#define RANGES_DEPRECATED(MSG) __attribute__((deprecated(MSG)))
#elif RANGTEMPLATES
#ifdef __cpp_variable_templates
#define RANGES_CXX_VARIABLE_TEMPLATES __cpp_variable_templates
#else
#define RANGES_CXX_VARIABLE_TEMPLATES RANGES_CXX_FEATURE(VARIABLE_TEMPLATES)
#endif
#endif

#if(defined(__cpp_lib_type_trait_variable_templates) && \
    __cpp_lib_type_trait_variable_templates > 0) ||     \
    RANGES_CXX_VER >= RANGES_CXX_STD_17
#define RANGES_CXX_TRAIT_VARIABLE_TEMPLATES 1
#else
#define RANGES_CXX_TRAIT_VARIABLE_TEMPLATES 0
#endif

#ifndef RANGES_CXX_ATTRIBUTE_DEPRECATED
#ifdef __has_cpp_attribute
#defie RANGES_DIAGNOSTIC_IGNORE_MULTIPLE_ASSIGNMENT_OPERATORS \
    RANGES_DIAGNOSTIC_IGNORE(4522)
#define RANGES_DIAGNOSTIC_IGNORE_VOID_PTR_DEREFERENCE
#define RANGES_DIAGNOSTIC_KEYWORD_MACRO
#define RANGES_DIAGNOSTIC_SUGGEST_OVERRIDE

#define RANGES_CXX_VER _MSVC_LANG

#if _MSC_VER < 1920 || _MSVC_LANG < 201703L
#error range-v3 requires Visual Studio 2019 with the /std:c++17 (or /std:c++latest) and /permissive- options.
#endif

#if _MSC_VER < 1927
#define RANGES_WORKAROUND_MSVC_895622 // Error when phase 1 name binding finds only
    ES_CXX_COROUTINES_TS1 201703L
#define RANGES_CXX_DEDUCTION_GUIDES_11 0L
#define RANGES_CXX_DEDUCTION_GUIDES_14 0L
#define RANGES_CXX_DEDUCTION_GUIDES_17 201606L
#define RANGES_CXX_IF_CONSTEXPR_11 0L
#define RANGES_CXX_IF_CONSTEXPR_14 0L
#define RANGES_CXX_IF_CONSTEXPR_17 201606L
#define RANGES_CXX_ALIGNED_NEW_11 0L
#define RANGES_CXX_ALIGNED_NEW_14 0L
#define RANGES_CXX_ALIGNED_NEW_17 201606L

// Implementation-specific diagnostic control
#if defined(_MSC_VER) && !defined(__clang__)
#define RANGES_DIAGNOSTIC_PUSH __pragma(warning(p/

#ifndef RANGES_V3_DETAIL_CONFIG_HPP
#define RANGES_V3_DETAIL_CONFIG_HPP

// Grab some version information.
#ifndef __has_include
#include <iosfwd>
#elif __has_include(<version>)
#include <version>
#else
#include <iosfwd>
#endif

#if(defined(NDEBUG) && !defined(RANGES_ENSURE_MSG)) || \
    (!defined(NDEBUG) && !defined(RANGES_ASSERT) &&    \
     ((defined(__GNUC__) && !defined(__clang__) &&     \
       (__GNUC__ < 5 || defined(__MINGW32__))) ||      \
      defined(_MSVC_STL_VERSION)))
#include <cstdio>
#include <cstdlib>

name     requires (!same_as<variant<Args...>, variant>) AND
            (all_convertible_to<Args...>(0))) //
        variant(variant<Args...> that)
          : detail::variant_data<Ts...>{}
          , index_(detail::variant_move_copy_(that.index(), data_(),
                                              std::move(that.data_())))
        {}
        variant & operator=(variant && that)
        {
            // TODO do a simple move assign when index()==that.index()
            this->clear_();
            this->assign_(detail::move(that))                elem_t * elem = nullptr;
                auto & data_var = detail::variant_core_access::data(var);
                detail::variant_visit_(
                    var.index(), data_var, detail::get_fn<elem_t, N>{&elem});
                return detail::variant_deref_(elem);
            }
            template<std::size_t N>
            friend meta::_t<
                std::add_lvalue_reference<meta::at_c<meta::as_list<Variant>, N> const>>
            get(Variant const & var)
            {
                using elem_t = me       struct variant_visitor
        {
            Fun fun_;
            Variant * var_;

            // clang-format off
            template<typename U, std::size_t N>
            auto CPP_auto_fun(operator())(indexed_element<U, N> u)
            (
                return compose(emplace_fn<Variant, N>{var_}, fun_)(u)
            )
            // clang-format on
        };

        template<typename Variant, typename Fun>
        variant_visitor<Fun, Variant> make_variant_visitor(
            Variant & var,
            Fun fun) nle<tail_t, meta::size_t<N - 1>,
                                                  Args...>::value)
                  : tail{meta::size_t<N - 1>{}, ((Args &&) args)...}
                {}
            };
        };

        template<typename... Ts>
        using variant_data = meta::_t<variant_data_<meta::transform<
            meta::list<Ts...>, meta::as_list<meta::make_index_sequence<sizeof...(Ts)>>,
            meta::quote<indexed_datum>>>>;

        inline std::size_t variant_move_copy_(std::size_t, variant_nil, variant_nil)
              : datum_(static_cast<Ts &&>(ts)...)
            {}
            template(typename U)(
                requires (!same_as<T, U>) AND convertible_to<U, T>)
            constexpr indexed_datum(indexed_datum<U, Index> that) //
                noexcept(std::is_nothrow_constructible<T, U>::value) //
              : datum_(std::move(that.datum_))
            {}
            constexpr auto ref() noexcept
            {
                return indexed_element<T, Index::value>{datum_};
            }
            constexpr auto ref() conursor_,
            requires(S & s, C & c) //
            (
                range_access::equal(c, s),
                concepts::requires_<convertible_to<decltype(
                    range_access::equal(c, s)), bool>>
            ));
        /// \concept sentinel_for_cursor
        /// \brief The \c sentinel_for_cursor concept
        template<typename S, typename C>
        CPP_concept sentinel_for_cursor =
            semiregular<S> &&
            cursor<C> &&
            CPP_requires_ref(detail::sentinel_for_cursor_, S, C);

      using type = decltype(range_access::mixin_base_2_<Cur>(42));
        };


    public:
        template<typename Cur>
        using single_pass_t = meta::_t<single_pass_<Cur>>;

        template<typename Cur>
        using contiguous_t = meta::_t<contiguous_<Cur>>;

        template<typename Cur>
        using mixin_base_t = meta::_t<mixin_base_<Cur>>;

        // clang-format off
        template<typename Rng>
        static constexpr auto CPP_auto_fun(begin_cursor)(Rng &rng)
        (
            return rng.begin_cursor()
    >
    struct range_const_iterator;

    /// \brief Boost Range specialisation point, for making Boost ranges out of range-v3
    /// views
    template<typename T>
    struct range_value;

    /// \brief Boost Range specialisation point, for making Boost ranges out of range-v3
    /// views
    template<typename T>
    struct range_size;
} // namespace boost

/// \brief Macro specialising Boost Range metafunctions for the specified view
#define RANGES_SATISFY_BOOST_RANGE(view_name)                                           \
    na         requires copy_constructible<B>)
                constexpr forward_tuple_interface(TupleLike const & base) noexcept(
                    std::is_nothrow_copy_constructible<TupleLike>::value)
              : TupleLike(base)
            {}
#endif

            // clang-format off
            template<std::size_t I, typename U = TupleLike>
            friend constexpr auto CPP_auto_fun(get)(
                forward_tuple_interface<TupleLike> &wb)
            (
                return detail::adl_get<I>(static_cast<U &>(wb))
                             iter_common_reference_t<B>> AND
                    indirectly_copyable<I, B> AND mergeable<B, I, I, C, P, P>)
            I operator()(I first, iter_difference_t<I> n, B buff, C r = C{}, P p = P{})
                const
            {
                auto half = n / 2;
                if(0 == half)
                    return next(first, n);
                I m = (*this)(first, half, buff, r, p);
                (*this)(m, n - half, buff, r, p);
                return merge_n_with_buffer(first, half, m, n - ALGORITHM_AUX_SORT_N_WITH_BUFFER_HPP

#include <tuple>

#include <range/v3/range_fwd.hpp>

#include <range/v3/algorithm/aux_/merge_n_with_buffer.hpp>
#include <range/v3/functional/comparisons.hpp>
#include <range/v3/functional/identity.hpp>
#include <range/v3/iterator/concepts.hpp>
#include <range/v3/iterator/operations.hpp>
#include <range/v3/iterator/traits.hpp>
#include <range/v3/utility/static_const.hpp>

#include <range/v3/detail/prologue.hpp>

namespace ranges
{
    namespace aux
    {
        struct sort_n_with_buffer_fn
            constexpr bool operator()(T && t) const
            {
                return !invoke(pred_, val_, static_cast<T &&>(t));
            }
        };

        template<typename Pred, typename Val>
        constexpr upper_bound_predicate<Pred, Val> make_upper_bound_predicate(Pred & pred,
                                                                              Val & val)
        {
            return {pred, val};
        }
    } // namespace detail
    /// \endcond

    namespace aux
    {
        struct upper_bound_n_fn
   namespace ranges

#include <range/v3/detail/epilogue.hpp>

#endif
/// \file
// Range v3 library
//
//  Copyright Eric Niebler 2014-present
//  Copyright Casey Carter 2015
//
//  Use, modification and distribution is subject to the
//  Boost Software License, Version 1.0. (See accompanying
//  file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3
//
#ifndef RANGES_V3_ALGORITHM_MIN_HPP
#define RANGES_V3_ALGORITHM_MIN_HPP

#include <initializer_list>

#incexpr minmax_element_result<I> //
        RANGES_FUNC(minmax_element)(I first, S last, C pred = C{}, P proj = P{}) //
        {
            minmax_element_result<I> result{first, first};
            if(first == last || ++first == last)
                return result;
            if(invoke(pred, invoke(proj, *first), invoke(proj, *result.min)))
                result.min = first;
            else
                result.max = first;
            while(++first != last)
            {
                I tmp = first;
                if(++fir          iterator_t<Rng> first = ranges::begin(rng);
            auto const n = distance(rng);
            if(n > 1)
                // start from the first parent, there is no need to consider children
                for(auto start = (n - 2) / 2; start >= 0; --start)
                    detail::sift_down_n(
                        first, n, first + start, ranges::ref(pred), ranges::ref(proj));
            return first + n;
        }

    RANGES_FUNC_END(make_heap)

    namespace cpp20
    {
        using ranges::make_heap;
    }ild = start - first;

                if(len < 2 || (len - 2) / 2 < child)
                    return;

                child = 2 * child + 1;
                I child_i = first + child;

                if((child + 1) < len &&
                   invoke(pred, invoke(proj, *child_i), invoke(proj, *(child_i + 1))))
                {
                    // right-child exists and is greater than left-child
                    ++child_i;
                    ++child;
                }

                // check if we are in heap-order
    er_difference_t<I> n, 
                                      C pred = C{},
                                      P proj = P{}) const
            {
                return is_heap_until_n(first, n, std::move(pred), std::move(proj)) ==
                       first + n;
            }
        };

        RANGES_INLINE_VARIABLE(is_heap_n_fn, is_heap_n)
    } // namespace detail
    /// \endcond

    /// \addtogroup group-algorithms
    /// @{
    RANGES_FUNC_BEGIN(is_heap_until)

        /// \brief function template \c is_heap_until
    es input_range<Rng0> AND input_range<Rng1> AND
                indirect_strict_weak_order<C,
                                           projected<iterator_t<Rng0>, P0>,
                                           projected<iterator_t<Rng1>, P1>>)
        constexpr bool RANGES_FUNC(lexicographical_compare)(Rng0 && rng0, 
                                                            Rng1 && rng1, 
                                                            C pred = C{}, 
                                                            P0 pro*mid, mid is after the target range.
                auto && v = *mid;
                auto && pv = invoke(proj, (decltype(v) &&)v);
                if(invoke(pred, val, pv))
                {
                    return aux::equal_range_n(
                        std::move(first), dist, val, ranges::ref(pred), ranges::ref(proj));
                }
                else if(!invoke(pred, pv, val))
                {
                    // *mid == val: the lower bound is <= mid, and the upper bound is >
                    // mid.
         constexpr move_result<borrowed_iterator_t<Rng>, O> //
        RANGES_FUNC(move)(Rng && rng, O out)            //
        {
            return (*this)(begin(rng), end(rng), std::move(out));
        }

    RANGES_FUNC_END(move)
    RANGES_HIDDEN_DETAIL(CPP_PP_RBRACE())

#ifndef RANGES_DOXYGEN_INVOKED
    struct RANGES_EMPTY_BASES move_fn
      : aux::move_fn
      , _move::move_fn
    {
        using aux::move_fn::operator();
        using _move::move_fn::operator();
    };

    RANGES_INLINE_VARIABLE(move_fn, move)
#endif

    nmove(op));
        }

    RANGES_FUNC_END(fold_left)

    RANGES_FUNC_BEGIN(fold_left_first)

        template(typename I, typename S, typename Op)(
            requires sentinel_for<S, I> AND input_iterator<I> AND
                indirectly_binary_left_foldable<Op, iter_value_t<I>, I>
                    AND constructible_from<iter_value_t<I>, iter_reference_t<I>>) //
            constexpr auto
            RANGES_FUNC(fold_left_first)(I first, S last, Op op)
        {
            using U = invoke_result_t<fold_left_fn, I, S, iter_                                ++n_swaps;
                                ++i;
                            }
                            // [first, i) == *first and *first < [i, last)
                            // The first part is sorted,
                            if(nth < i)
                                return end_orig;
                            // nth_element the second part
                            // nth_element<C>(i, nth, last, pred);
                            first = i;
                            continue;
   turn end_orig;
                }
                // len > limit >= 3
                I m = first + len / 2;
                I lm1 = last;
                unsigned n_swaps = detail::sort3(first, m, --lm1, pred, proj);
                // *m is median
                // partition [first, m) < *m and *m <= [m, last)
                //(this inhibits tossing elements equivalent to m around unnecessarily)
                I i = first;
                I j = lm1;
                // j points beyond range to be tested, *lm1 is known to be <= *go before here
            I1 l1 = end1;
            I2 l2 = end2;
            --l2;
            while(true)
            {
                do
                    if(start == l1)
                        return {end1, end1};
                while(!invoke(pred, invoke(proj, *--l1), *l2));
                I1 m1 = l1;
                I2 m2 = l2;
                do
                    if(m2 == begin2)
                        return {m1, ++l1};
                // no need to check range on m1 because s guarantees we have enough source
    
                    // Otherwise if source exhausted, pattern not found
                    else if(m1 == begin1)
                        return {end1, end1};
                // if there is a mismatch, restart with a new l1
                // else there is a match, check next elements
                while(invoke(pred, invoke(proj, *--m1), *--m2));
            }
        }

        template<typename I1, typename I2, typename R, typename P>
        constexpr subrange<I1> find_end_impl(I1 begin1, I1 end1, I2 begin2, I2 end2, R pred, ight notice and this permission notice
// appear in supporting documentation. The authors make no
// representations about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
//
// Algorithms from
// Elements of Programming
// by Alexander Stepanov and Paul McJones
// Addison-Wesley Professional, 2009

#ifndef RANGES_V3_ALGORITHM_MERGE_HPP
#define RANGES_V3_ALGORITHM_MERGE_HPP

#include <tuple>

#include <range/v3/range_fwd.hpp>

#include <range/v3/algorithm/copy.hpp>
ed
        // not actually compute the end of [I1,S0); therefore, it is not necessarily
        // losing information. E.g., if begin0 == end0, we can return begin0 immediately.
        // If we returned pair<I0,I1>, we would need to do an O(N) scan to find the
        // end position.

        /// \brief function template \c find_first_of
        template(typename I0,
                 typename S0,
                 typename I1,
                 typename S1,
                 typename R = equal_to,
                 typename P0 = iden      return {first, middle};
            }
            return detail::rotate_(first, middle, last, iterator_tag_of<I>{});
        }

        /// \overload
        template(typename Rng, typename I = iterator_t<Rng>)(
            requires range<Rng> AND permutable<I>)
        constexpr borrowed_subrange_t<Rng> RANGES_FUNC(rotate)(Rng && rng, I middle) //
        {
            return (*this)(begin(rng), std::move(middle), end(rng));
        }

    RANGES_FUNC_END(rotate)

    namespace cpp20
    {
        using ranges::rotate;
    }r_move(i);
                    ++first;
                }
            }

            *first = iter_move(i);
            ++first;
            return first;
        }

        /// \overload
        template(typename Rng, typename Pred, typename Proj = identity)(
            requires forward_range<Rng> AND
            indirect_relation<Pred, projected<iterator_t<Rng>, Proj>> AND
            permutable<iterator_t<Rng>>)
        constexpr borrowed_iterator_t<Rng>
        RANGES_FUNC(adjacent_remove_if)(Rng && rng, Pred pred, Proj proj = uid{};
            using param_t = typename decltype(uid)::param_type;
            while(++mid != last)
            {
                RANGES_ENSURE(mid - first <= PTRDIFF_MAX);
                if(auto const i = uid(gen, param_t{0, D2(mid - first)}))
                    ranges::iter_swap(mid - i, mid);
            }
            return mid;
        }

        /// \overload
        template(typename Rng, typename Gen = detail::default_random_engine &)(
            requires random_access_range<Rng> AND permutable<iterator_t<Rng>> AND
      {
            for(I i = first; i != last; ++i)
                detail::unguarded_linear_insert(i, iter_move(i), pred, proj);
        }

        constexpr int introsort_threshold()
        {
            return 16;
        }

        template<typename I, typename C, typename P>
        inline constexpr void final_insertion_sort(I first, I last, C & pred, P & proj)
        {
            if(last - first > detail::introsort_threshold())
            {
                detail::insertion_sort(
                    first, first + detail           T min;
            U max;

            RANGES_ALGO_RESULT_AUX_2(min_max_result, T, min, U, max)
        };

        template<typename I1, typename I2, typename O>
        struct in1_in2_out_result
        {
            I1 in1;
            I2 in2;
            O out;

            RANGES_ALGO_RESULT_AUX_3(in1_in2_out_result, I1, in1, I2, in2, O, out)
        };

        template<typename I, typename O1, typename O2>
        struct in_out1_out2_result
        {
            I in;
            O1 out1;
            O2 out2;

   fine RANGES_ALGO_RESULT_AUX_2(C, T1, M1, T2, M2)                                   \
    template(typename X, typename Y)(                                                 \
        requires convertible_to<T1 const &, X> AND convertible_to<T2 const &, Y>)     \
    operator C<X, Y>() const &                                                        \
    {                                                                                 \
        return {M1, M2};                                                              \
    }              typename P1 = identity,
                 typename P2 = identity)(
            requires sentinel_for<S1, I1> AND sentinel_for<S2, I2> AND
                mergeable<I1, I2, O, C, P1, P2>)
        constexpr set_difference_result<I1, O> RANGES_FUNC(set_difference)(I1 begin1,
                                                                           S1 end1,
                                                                           I2 begin2,
                                                                           S2 end2,
     end(rng1),
                           begin(rng2),
                           end(rng2),
                           std::move(pred),
                           std::move(proj1),
                           std::move(proj2));
        }

    RANGES_FUNC_END(includes)

    namespace cpp20
    {
        using ranges::includes;
    }

    template<typename I1, typename I2, typename O>
    using set_union_result = detail::in1_in2_out_result<I1, I2, O>;

    RANGES_FUNC_BEGIN(set_union)

        /// \brief function template \c set_union
 ult = detail::in_out_result<I, O>;

    RANGES_FUNC_BEGIN(replace_copy)

        /// \brief function template \c replace_copy
        template(typename I,
                 typename S,
                 typename O,
                 typename T1,
                 typename T2,
                 typename P = identity)(
            requires input_iterator<I> AND sentinel_for<S, I> AND
                output_iterator<O, T2 const &> AND indirectly_copyable<I, O> AND
                indirect_relation<equal_to, projected<I, P>, T1 const *>)
   P proj,
                                                            std::input_iterator_tag,
                                                            std::false_type)
        {
            if(first != last)
            {
                // Must save a copy into a local because we will need this value
                // even after we advance the input iterator.
                iter_value_t<I> value =
                    *first; // This is guaranteed by indirectly_copyable
                *out = value;
                ++out;
    ename F>
    using generate_n_result = detail::out_fun_result<O, F>;

    RANGES_FUNC_BEGIN(generate_n)

        /// \brief function template \c generate_n
        template(typename O, typename F)(
            requires invocable<F &> AND output_iterator<O, invoke_result_t<F &>>)
        constexpr generate_n_result<O, F> //
        RANGES_FUNC(generate_n)(O first, iter_difference_t<O> n, F fun)
        {
            RANGES_EXPECT(n >= 0);
            auto norig = n;
            auto b = uncounted(first);
            for(; 0 != n; ++      auto buf_size = ranges::min(len1, len2_and_end.first);
            std::pair<value_type *, std::ptrdiff_t> buf{nullptr, 0};
            std::unique_ptr<value_type, detail::return_temporary_buffer> h;
            if(detail::is_trivially_copy_assignable_v<value_type> && 8 < buf_size)
            {
                buf = detail::get_temporary_buffer<value_type>(buf_size);
                h.reset(buf.first);
            }
            detail::merge_adaptive(std::move(first),
                                   std::move(middle),
           I m1;    // "median" of [first, middle)
                    I m2;    // "median" of [middle, last)
                    D len11; // distance(first, m1)
                    D len21; // distance(middle, m2)
                    // binary search smaller range
                    if(len1 < len2)
                    { // len >= 1, len2 >= 2
                        len21 = len2 / 2;
                        m2 = next(middle, len21);
                        m1 = upper_bound(first,
                                         middle,
    <Rng>, range_value_t<Rng> *>)
        constexpr range_value_t<Rng> //
        RANGES_FUNC(max)(Rng && rng, C pred = C{}, P proj = P{}) //
        {
            auto first = ranges::begin(rng);
            auto last = ranges::end(rng);
            RANGES_EXPECT(first != last);
            range_value_t<Rng> result = *first;
            while(++first != last)
            {
                auto && tmp = *first;
                if(invoke(pred, invoke(proj, result), invoke(proj, tmp)))
                    result = (decltype(tmp) &&)tmp;_BEGIN(find_if_not)
        /// \brief template function \c find_if_not
        ///
        /// range-based version of the \c find_if_not std algorithm
        ///
        /// \pre `Rng` is a model of the `range` concept
        /// \pre `I` is a model of the `input_iterator` concept
        /// \pre `S` is a model of the `sentinel_for<I>` concept
        /// \pre `P` is a model of the `invocable<V>` concept, where `V` is the
        ///      value type of I.
        /// \pre `F` models `predicate<X>`, where `X` is the result type
          detail::merge_sort_loop(first, last, buffer, step_size, pred, proj);
            step_size *= 2;
            goto loop;
        }

        // buffer points to raw memory
        template<typename I, typename V, typename C, typename P>
        void stable_sort_adaptive(I first, I last, V * buffer, std::ptrdiff_t buffer_size,
                                  C & pred, P & proj)
        {
            iter_difference_t<I> len = (last - first + 1) / 2;
            I middle = first + len;
            if(len > buffer_size)
    //  Permission to use, copy, modify, distribute and sell this software
//  and its documentation for any purpose is hereby granted without fee,
//  provided that the above copyright notice appear in all copies and
//  that both that copyright notice and this permission notice appear
//  in supporting documentation.  Hewlett-Packard Company makes no
//  representations about the suitability of this software for any
//  purpose.  It is provided "as is" without express or implied warranty.
//
//  Copyright (c) 1996
//  Silicon Graphic RANGES_FUNC(partition_point)(I first, S last, C pred, P proj = P{})
        {
            if(RANGES_CONSTEXPR_IF(sized_sentinel_for<S, I>))
            {
                auto len = distance(first, std::move(last));
                return aux::partition_point_n(
                    std::move(first), len, std::move(pred), std::move(proj));
            }

            // Probe exponentially for either last-of-range or an iterator
            // that is past the partition point (i.e., does not satisfy pred).
            auto len = iteremplate \c for_each_n
        template(typename I, typename F, typename P = identity)(
            requires input_iterator<I> AND
                indirectly_unary_invocable<F, projected<I, P>>)
        constexpr I RANGES_FUNC(for_each_n)(I first, iter_difference_t<I> n, F fun, P proj = P{})
        {
            RANGES_EXPECT(0 <= n);
            auto norig = n;
            auto b = uncounted(first);
            for(; 0 < n; ++b, --n)
                invoke(fun, invoke(proj, *b));
            return recounted(first, b, norig);
    ires sortable<I, C, P> AND random_access_iterator<I> AND
                sentinel_for<S, I>)
        constexpr I RANGES_FUNC(partial_sort)(
            I first, I middle, S last, C pred = C{}, P proj = P{}) //
        {
            make_heap(first, middle, ranges::ref(pred), ranges::ref(proj));
            auto const len = middle - first;
            I i = middle;
            for(; i != last; ++i)
            {
                if(invoke(pred, invoke(proj, *i), invoke(proj, *first)))
                {
                    iter_swap(i                          proj2,
                               *m2))) // if there is a mismatch, restart with a new begin1
                    {
                        ++begin1;
                        break;
                    } // else there is a match, check next elements
                }
            }
        }
    } // namespace detail
    /// \endcond

    RANGES_FUNC_BEGIN(search)

        /// \brief function template \c search
        template(typename I1,
                 typename S1,
                 typename I2,
         ++begin1;
                    --d1;
                }
                // *begin1 matches *begin2, now match elements after here
                auto m1 = begin1;
                I2 m2 = begin2;
                while(true)
                {
                    if(++m2 == end2) // If pattern exhausted, begin1 is the answer (works
                                     // for 1 element pattern)
                    {
                        return {recounted(begin1_, std::move(begin1), d1_ - d1),
                                reco             // Move falses back into range, but don't mess up first which points to
                // first false
                ranges::move(p.first, res.out2.base().base(), first);
                // h destructs moved-from values out of the temp buffer, but doesn't
                // deallocate buffer
                return first;
            }
            // Else not enough buffer, do in place
            // len >= 4
            I middle = first;
            D half = len / 2; // half >= 2
            advance(middle, half);
  detail::stable_partition_impl(first, middle, pred, proj, half, p, fi);
            // TTTFFFFF??????????
            // f  ff   m         l
            // recurse on [middle, last], except increase middle until *(middle) is false,
            // *last know to be true
            I m1 = middle;
            D len_half = len - half;
            while(invoke(pred, invoke(proj, *m1)))
            {
                if(++m1 == last)
                    return ranges::rotate(begin_false, middle, last).begin();
                --len_half;
 1 = identity)(
            requires input_iterator<I0> AND sentinel_for<S0, I0> AND
                input_iterator<I1> AND sentinel_for<S1, I1> AND
                weakly_incrementable<O> AND copy_constructible<F> AND
                indirectly_writable<
                    O,
                    indirect_result_t<F &, projected<I0, P0>, projected<I1, P1>>>)
        constexpr binary_transform_result<I0, I1, O> //
        RANGES_FUNC(transform)(I0 begin0,
                               S0 end0,
                               I1 begiectly_comparable<iterator_t<Rng0>, iterator_t<Rng1>, C, P0, P1>)
        constexpr bool RANGES_FUNC(ends_with)(
            Rng0 && rng0, Rng1 && rng1, C pred = C{}, P0 proj0 = P0{}, P1 proj1 = P1{}) //
        {
            const auto drop = distance(rng0) - distance(rng1);
            if(drop < 0)
                return false;
            return equal(next(begin(rng0), drop),
                         end(rng0),
                         begin(rng1),
                         end(rng1),
                         std::move(pred),
         uniform_random_bit_generator<std::remove_reference_t<Gen>> AND
                (random_access_iterator<O> || forward_range<Rng> || sized_range<Rng>))
        sample_result<borrowed_iterator_t<Rng>, O> RANGES_FUNC(sample)(
            Rng && rng,
            O out,
            iter_difference_t<O> const n,
            Gen && gen = detail::get_random_engine()) //
        {
            if(RANGES_CONSTEXPR_IF(forward_range<Rng> || sized_range<Rng>)) //
            {
                return detail::sample_sized_impl(begin(rng),
    tility/tagged_pair.hpp>

RANGES_DEPRECATED_HEADER(
    "This file is deprecated. Please discontinue using the tag types defined here and "
    "define your own.")

#include <range/v3/detail/prologue.hpp>

namespace ranges
{
    /// \cond
    RANGES_DEFINE_TAG_SPECIFIER(in)
    RANGES_DEFINE_TAG_SPECIFIER(in1)
    RANGES_DEFINE_TAG_SPECIFIER(in2)
    RANGES_DEFINE_TAG_SPECIFIER(out)
    RANGES_DEFINE_TAG_SPECIFIER(out1)
    RANGES_DEFINE_TAG_SPECIFIER(out2)
    RANGES_DEFINE_TAG_SPECIFIER(fun)
    RANGES_DEFINE_TAG_SPECIFIER(min)
           return partition_point(std::move(first),
                                   std::move(last),
                                   detail::make_lower_bound_predicate(pred, val),
                                   std::move(proj));
        }

        /// \overload
        template(typename Rng, typename V, typename C = less, typename P = identity)(
            requires forward_range<Rng> AND
                indirect_strict_weak_order<C, V const *, projected<iterator_t<Rng>, P>>)
        constexpr borrowed_iterator_t<Rng> //
   v3 library
//
//  Copyright Eric Niebler 2013-present
//  Copyright Gonzalo Brito Gadeschi 2014
//
//  Use, modification and distribution is subject to the
//  Boost Software License, Version 1.0. (See accompanying
//  file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3
//
// Implementation based on the code in libc++
//   http://http://libcxx.llvm.org/
#ifndef RANGES_V3_ALGORITHM_IS_SORTED_UNTIL_HPP
#define RANGES_V3_ALGORITHM_IS_SORTED_UNTIL_HPP

#e<C, projected<I, P>> AND
                indirectly_copyable<I, O>)
        constexpr replace_copy_if_result<I, O> RANGES_FUNC(replace_copy_if)(
            I first, S last, O out, C pred, T const & new_value, P proj = {}) //
        {
            for(; first != last; ++first, ++out)
            {
                auto && x = *first;
                if(invoke(pred, invoke(proj, x)))
                    *out = new_value;
                else
                    *out = (decltype(x) &&)x;
            }
            return {first, out};ename D, typename V, typename C, typename P>
        constexpr subrange<I> search_n_impl(I first, 
                                            S last, 
                                            D cnt, 
                                            V const & val, 
                                            C & pred,
                                            P & proj)
        {
            while(true)
            {
                // Find first element in sequence 1 that matches val, with a mininum of
                // loop check_swap(i, j);
                    ranges::reverse(ip1, last);
                    return true;
                }
                if(i == first)
                {
                    ranges::reverse(first, last);
                    return false;
                }
            }
        }

        /// \overload
        template(typename Rng, typename C = less, typename P = identity)(
            requires bidirectional_range<Rng> AND sortable<iterator_t<Rng>, C, P>)
        constexpr bool RANGES_FUNC(prev_permutation)(Rng && rng, C preame Rng1,
                     typename I2Ref,
                     typename C = equal_to,
                     typename P1 = identity,
                     typename P2 = identity)(
            requires forward_range<Rng1> AND forward_iterator<uncvref_t<I2Ref>> AND
                indirectly_comparable<iterator_t<Rng1>, uncvref_t<I2Ref>, C, P1, P2>)
        RANGES_DEPRECATED(
            "Use the variant of ranges::is_permutation that takes an upper bound "
            "for both sequences")
        bool RANGES_FUNC(is_permutation)(ranges::mismatch(begin1, end1, begin2, end2, pred, proj1, proj2);
            begin1 = mismatch.in1;
            begin2 = mismatch.in2;
            if(begin1 == end1 || begin2 == end2)
            {
                return begin1 == end1 && begin2 == end2;
            }
            // begin1 != end1 && begin2 != end2 && *begin1 != *begin2
            auto l1 = distance(begin1, end1);
            auto l2 = distance(begin2, end2);
            if(l1 != l2)
                return false;

            // For each element in [f1, l1) see iame I, typename O>
    using copy_backward_result = detail::in_out_result<I, O>;

    RANGES_FUNC_BEGIN(copy_backward)

        /// \brief function template \c copy_backward
        template(typename I, typename S, typename O)(
            requires bidirectional_iterator<I> AND sentinel_for<S, I> AND
            bidirectional_iterator<O> AND indirectly_copyable<I, O>)
        constexpr copy_backward_result<I, O> RANGES_FUNC(copy_backward)(I first, S end_, O out)
        {
            I i = ranges::next(first, end_), last = i;
         if(!invoke(pred, invoke(proj, *first)))
                    break;
            return first == last;
        }

        /// \overload
        template(typename Rng, typename F, typename P = identity)(
            requires input_range<Rng> AND
            indirect_unary_predicate<F, projected<iterator_t<Rng>, P>>)
        constexpr bool RANGES_FUNC(all_of)(Rng && rng, F pred, P proj = P{}) //
        {
            return (*this)(begin(rng), end(rng), std::move(pred), std::move(proj));
        }

    RANGES_FUNC_END(all_of)

    > AND permutable<I> AND
            indirect_unary_predicate<C, projected<I, P>>)
        constexpr I RANGES_FUNC(unstable_remove_if)(I first, I last, C pred, P proj = {})
        {
            while(true)
            {
                first = find_if(std::move(first), last, ranges::ref(pred), ranges::ref(proj));
                if(first == last)
                    return first;

                last = next(find_if_not(make_reverse_iterator(std::move(last)),
                                        make_reverse_iterator(next(first)out)
                *out = *--last;
            return {res, out};
        }

        /// \overload
        template(typename Rng, typename O)(
            requires bidirectional_range<Rng> AND weakly_incrementable<O> AND
            indirectly_copyable<iterator_t<Rng>, O>)
        constexpr reverse_copy_result<borrowed_iterator_t<Rng>, O> //
        RANGES_FUNC(reverse_copy)(Rng && rng, O out)            //
        {
            return (*this)(begin(rng), end(rng), std::move(out));
        }

    RANGES_FUNC_END(reverse_copy)

  erator<I> AND sentinel_for<S, I> AND
                indirect_strict_weak_order<C, V const *, projected<I, P>>)
        constexpr bool RANGES_FUNC(binary_search)(
            I first, S last, V const & val, C pred = C{}, P proj = P{})
        {
            first =
                lower_bound(std::move(first), last, val, ranges::ref(pred), ranges::ref(proj));
            return first != last && !invoke(pred, val, invoke(proj, *first));
        }

        /// \overload
        template(typename Rng, typename V, typename C = less, typ group-algorithms
    /// @{
    RANGES_FUNC_BEGIN(adjacent_find)
        /// \brief function template \c adjacent_find
        ///
        /// range-based version of the \c adjacent_find std algorithm
        ///
        /// \pre `Rng` is a model of the `range` concept
        /// \pre `C` is a model of the `BinaryPredicate` concept
        template(typename I, typename S, typename C = equal_to, typename P = identity)(
            requires forward_iterator<I> AND sentinel_for<S, I> AND
            indirect_relation<C, projected<I,ch_result<I1, I2> RANGES_FUNC(mismatch)(I1 begin1,
                                                      S1 end1,
                                                      I2 begin2,
                                                      C pred = C{},
                                                      P1 proj1 = P1{},
                                                      P2 proj2 = P2{}) //
        {
            for(; begin1 != end1; ++begin1, ++begin2)
                if(!invoke(pred, invoke(proj1, *begin1), invoke(proj2, *begin2)))lude <utility>

#include <meta/meta.hpp>

#include <range/v3/range_fwd.hpp>

#include <range/v3/algorithm/result_types.hpp>
#include <range/v3/functional/comparisons.hpp>
#include <range/v3/functional/identity.hpp>
#include <range/v3/functional/invoke.hpp>
#include <range/v3/iterator/concepts.hpp>
#include <range/v3/iterator/traits.hpp>
#include <range/v3/range/access.hpp>
#include <range/v3/range/concepts.hpp>
#include <range/v3/range/dangling.hpp>
#include <range/v3/range/traits.hpp>
#include <range/v3/utility/static_const.hpp>

 sentinel_for<S1, I2> AND sentinel_for<S2, I1> AND
            equality_comparable_with<I1, I2>)
    bool operator==(common_iterator<I1, S1> const & x, common_iterator<I2, S2> const & y)
    {
        return detail::cidata(x).index() == 1u
                   ? (detail::cidata(y).index() == 1u ||
                      ranges::get<0>(detail::cidata(y)) ==
                          ranges::get<1>(detail::cidata(x)))
                   : (detail::cidata(y).index() == 1u
                          ? ranges::get<0>(detail::cidata(x)) ==
 _t<I>;

        common_iterator() = default;
        common_iterator(I i)
          : data_(emplaced_index<0>, std::move(i))
        {}
        common_iterator(S s)
          : data_(emplaced_index<1>, std::move(s))
        {}
        template(typename I2, typename S2)(
            requires convertible_to<I2, I> AND convertible_to<S2, S>)
        common_iterator(common_iterator<I2, S2> const & that)
          : data_(detail::variant_core_access::make_empty<I, S>())
        {
            detail::cidata(that).visit_i(emplace_fn{&data_order_ concept
    template(typename C, typename I1, typename P1, typename I2, typename P2)(
    concept (projected_indirect_strict_weak_order_)(C, I1, P1, I2, P2),
        indirect_strict_weak_order<C, projected<I1, P1>, projected<I2, P2>>
    );

    template<typename I1, typename I2, typename Out, typename C = less,
        typename P1 = identity, typename P2 = identity>
    CPP_concept mergeable =
        input_iterator<I1> &&
        input_iterator<I2> &&
        weakly_incrementable<Out> &&
        indirectly_copyable<I1, Ou<I2> &&
        copy_constructible<F> &&
        CPP_concept_ref(ranges::indirect_strict_weak_order_, F, I1, I2);
    // clang-format on

    //////////////////////////////////////////////////////////////////////////////////////
    // projected struct, for "projecting" a readable with a unary callable
    /// \cond
    namespace detail
    {
        RANGES_DIAGNOSTIC_PUSH
        RANGES_DIAGNOSTIC_IGNORE_UNDEFINED_INTERNAL
        template<typename I, typename Proj>
        struct projected_
        {
            struct type
     ncept_ref(ranges::indirectly_regular_unary_invocable_, F, I);

    /// \cond
    // Non-standard indirect invocable concepts
    /// \concept indirectly_binary_invocable_impl_
    /// \brief The \c indirectly_binary_invocable_impl_ concept
    template(typename F, typename I1, typename I2)(
    concept (indirectly_binary_invocable_impl_)(F, I1, I2),
        invocable<F &, iter_value_t<I1> &, iter_value_t<I2> &> AND
        invocable<F &, iter_value_t<I1> &, iter_reference_t<I2>> AND
        invocable<F &, iter_reference_t<I1>, iterordered<I> &&
        sized_sentinel_for<I, I> &&
        CPP_requires_ref(ranges::random_access_iterator_, I) &&
        CPP_concept_ref(ranges::with_category_, I, std::random_access_iterator_tag);

    /// \concept contiguous_iterator_
    /// \brief The \c contiguous_iterator_ concept
    template(typename I)(
    concept (contiguous_iterator_)(I),
        std::is_lvalue_reference<iter_reference_t<I>>::value AND
        same_as<iter_value_t<I>, uncvref_t<iter_reference_t<I>>> AND
        derived_from<detail::iter_concept_t<I>, rence_t<I> &&, iter_value_t<I> const &>
    );

    /// \concept indirectly_readable
    /// \brief The \c indirectly_readable concept
    template<typename I>
    CPP_concept indirectly_readable = //
        CPP_concept_ref(ranges::readable_, uncvref_t<I>);

    template<typename I>
    RANGES_DEPRECATED("Please use ranges::indirectly_readable instead")
    RANGES_INLINE_VAR constexpr bool readable = //
        indirectly_readable<I>;

    /// \concept writable_
    /// \brief The \c writable_ concept
    template<typename O, typen group-iterator-concepts
    /// @{

    /// \cond
    namespace detail
    {
        template<typename I>
        using iter_traits_t = meta::conditional_t<is_std_iterator_traits_specialized_v<I>,
                                        std::iterator_traits<I>, I>;

#if defined(_GLIBCXX_DEBUG)
        template(typename I, typename T, typename Seq)(
            requires same_as<I, __gnu_debug::_Safe_iterator<T *, Seq>>)
        auto iter_concept_(__gnu_debug::_Safe_iterator<T *, Seq>, priority_tag<3>)
            -> ranges::contigu<typename Delim, typename Char = char,
             typename Traits = std::char_traits<Char>>
    struct ostream_joiner
    {
        CPP_assert(semiregular<Delim>);
        using difference_type = std::ptrdiff_t;
        using char_type = Char;
        using traits_type = Traits;
        using ostream_type = std::basic_ostream<Char, Traits>;

        constexpr ostream_joiner() = default;
        ostream_joiner(ostream_type & s, Delim const & d)
          : delim_(d)
          , sout_(std::addressof(s))
          , first_(true)
                            TQual, UQual>
      : basic_common_reference<::ranges::detail::cursor_reference_t<Cur1>,
                               ::ranges::detail::cursor_reference_t<Cur2>, TQual, UQual>
    {};

    // common_type specializations for basic_proxy_reference
    template<typename Cur, typename U>
    struct common_type<::ranges::detail::basic_proxy_reference_<Cur, true>, U>
      : common_type<::ranges::range_access::cursor_value_t<Cur>, U>
    {};
    template<typename T, typename Cur>
    struct common_type<T, ::ranccess::distance_to(range_access::pos(right), left);
    }
    template(typename Cur, typename S)(
        requires detail::sized_sentinel_for_cursor<S, Cur>)
    constexpr typename basic_iterator<Cur>::difference_type //
    operator-(basic_iterator<Cur> const & left, S const & right)
    {
        return -(right - left);
    }
    // Asymmetric comparisons
    template(typename Left, typename Right)(
        requires detail::sized_sentinel_for_cursor<Right, Left>)
    constexpr bool operator<(basic_iterator<Left> const & left,
   typename OtherCur)(
            requires (!same_as<OtherCur, Cur>) AND convertible_to<OtherCur, Cur>)
        constexpr basic_iterator & operator=(basic_iterator<OtherCur> that)
        {
            pos() = std::move(that.pos());
            return *this;
        }

        CPP_member
        constexpr auto operator*() const
            noexcept(noexcept(range_access::read(std::declval<Cur const &>())))
            -> CPP_ret(const_reference_t)(
                requires detail::readable_cursor<Cur> &&
                    (!detail:ss::cursor_value_t<Cur>;
            using reference = iter_reference_t;
            using iterator_concept = cpp20_iter_cat_of_t<Cur>;
            using pointer = meta::_t<
                meta::conditional_t<
                    (bool)has_cursor_arrow<Cur>,
                    meta::defer<cursor_arrow_t, Cur>,
                    std::add_pointer<reference>>>;
            using common_reference = common_reference_t<reference, value_type &>;

            iterator_associated_types_base_() = default;
            using readable_itera     forward_cursor<Cur>,            //
                                std::forward_iterator_tag,      //
                                std::input_iterator_tag>>>>>;

        // clang-format off
        /// \concept cpp17_input_cursor_
        /// \brief The \c cpp17_input_cursor_ concept
        template(typename C)(
        concept (cpp17_input_cursor_)(C),
            // Either it is not single-pass, or else we can create a
            // proxy for postfix increment.
            !range_access::single_pass_t<uncvref_t<C>>::val     using cursor_value_t = typename cursor_traits<Cur>::value_t_;

        template<typename Cur, bool IsReadable>
        struct basic_proxy_reference_;
        template<typename Cur>
        using basic_proxy_reference =
            basic_proxy_reference_<Cur, (bool)readable_cursor<Cur>>;

        // The One Proxy Reference type to rule them all. basic_iterator uses this
        // as the return type of operator* when the cursor type has a set() member
        // function of the correct signature (i.e., if it can accept a value_      requires indirectly_writable<I, aux::move_t<T>>)
            void write(T && t) const noexcept(noexcept(*it_ = std::move(t)))
            {
                *it_ = std::move(t);
            }
            CPP_member
            auto read() const noexcept(noexcept(*std::declval<I const &>()))
                -> CPP_ret(iter_reference_t<I>)(
                    requires indirectly_readable<I>)
            {
                return *it_;
            }
            CPP_member
            auto equal(move_into_cursor const & that) constor-=(difference_type n) //
            -> CPP_ret(move_iterator &)(
                requires random_access_iterator<I>)
        {
            current_ -= n;
            return *this;
        }
        CPP_member
        auto operator[](difference_type n) const //
            -> CPP_ret(reference)(
                requires random_access_iterator<I>)
        {
            return iter_move(current_ + n);
        }

        template<typename I2>
        friend auto operator==(move_iterator const & x, move_iterator<I2> const & y)
     rsor &&>(cur))
                {}
                constexpr explicit mixin(reverse_cursor const & cur)
                  : basic_mixin<reverse_cursor>(cur)
                {}
                #endif
                constexpr mixin(I it)
                  : mixin{reverse_cursor{it}}
                {}
                constexpr I base() const
                {
                    return this->get().base();
                }
            };

            I it_;

            constexpr reverse_cursor(I it)
              : it_(std::move(it)t_inserter_fn, front_inserter)

    template<typename Container>
    struct insert_iterator
    {
        using container_type = Container;
        using difference_type = std::ptrdiff_t;

        constexpr insert_iterator() = default;
        constexpr explicit insert_iterator(Container & x, typename Container::iterator w)
          : container_(detail::addressof(x))
          , where_(w)
        {}
        insert_iterator & operator=(typename Container::value_type const & value)
        {
            where_ = ranges::next(contain            requires indirectly_swappable<I2, I1>)
        {
            return ranges::iter_swap(_counted_iterator_::access::current(x),
                                     _counted_iterator_::access::current(y));
        }
    } // namespace _counted_iterator_
#endif
    /// endcond

    template(typename I1, typename I2)(
        requires common_with<I1, I2>)
    constexpr bool operator==(counted_iterator<I1> const & x,
                              counted_iterator<I2> const & y)
    {
        return x.count() == y.count();
  stexpr counted_iterator & operator++()
        {
            RANGES_EXPECT(cnt_ > 0);
            ++current_;
            --cnt_;
            return *this;
        }

#ifdef RANGES_WORKAROUND_MSVC_677925
        template(typename I2 = I)(
            requires (!forward_iterator<I2>)) //
        constexpr auto operator++(int) -> decltype(std::declval<I2 &>()++)
#else  // ^^^ workaround ^^^ / vvv no workaround vvv
        CPP_member
        constexpr auto operator++(int) //
            -> CPP_ret(decltype(std::declval<I &>()++))(
   xpr auto operator!=(unreachable_sentinel_t, I const &) noexcept
            -> CPP_broken_friend_ret(bool)(
                requires weakly_incrementable<I>)
        {
            return true;
        }
    };

    RANGES_INLINE_VARIABLE(unreachable_sentinel_t, unreachable)

    namespace cpp20
    {
        using ranges::unreachable;
        using ranges::unreachable_sentinel_t;
    } // namespace cpp20
    /// @}
} // namespace ranges

#include <range/v3/detail/epilogue.hpp>

#endif // RANGES_V3_ITERATOR_UNREACHABLE_SENTINEL_HPP
     };

#if RANGES_CXX_INLINE_VARIABLES >= RANGES_CXX_INLINE_VARIABLES_17
        template<>
        inline constexpr bool _is_integer_like_<diffmax_t> = true;
#else
        template<typename Enable>
        constexpr bool _is_integer_like_<diffmax_t, Enable> = true;
#endif
    } // namespace detail
    /// \endcond
} // namespace ranges

/// \cond
RANGES_DIAGNOSTIC_IGNORE_MISMATCHED_TAGS

namespace std
{
    template<>
    struct numeric_limits<::ranges::detail::diffmax_t>
    {
        static constexpr bool is_specialized = truet
            {
                return _normalize(
                    bool(a.neg_ ^ b.neg_),
                    compl_if(bool(a.neg_ ^ b.neg_),
                             compl_if(a.neg_, a.val_) ^ compl_if(b.neg_, b.val_)));
            }

            friend constexpr diffmax_t operator<<(diffmax_t a, diffmax_t b) noexcept
            {
                RANGES_ENSURE(!a.neg_);
                return b.neg_ ? diffmax_t{tag{}, false, a.val_ >> b.val_}
                              : diffmax_t{tag{}, false, a.val_ << b.val_};
     trying to compute the distance of an infinite range:
            RANGES_EXPECT(!is_infinite<Rng>::value);
            return enumerate_fn::impl_r(
                rng, common_range_tag_of<Rng>(), sized_range_tag_of<Rng>());
        }
    };

    /// \sa `enumerate_fn`
    RANGES_INLINE_VARIABLE(enumerate_fn, enumerate)

    struct distance_fn : iter_distance_fn
    {
    private:
        template<typename Rng>
        static range_difference_t<Rng> impl_r(Rng & rng, range_tag)
        {
            return enumerate(rng).first;
   ce_t<I> d = 0;
            for(; first != last; ++first)
                ++d;
            return {d, first};
        }
        template(typename I, typename S)(
            requires sized_sentinel_for<I, I>)
        static constexpr std::pair<iter_difference_t<I>, I> //
        impl_i(I first, S end_, sentinel_tag)
        {
            I last = ranges::next(first, end_);
            auto n = static_cast<iter_difference_t<I>>(last - first);
            RANGES_EXPECT(((bool)same_as<I, S> || 0 <= n));
            return {n, last};
              I bound, sentinel_tag,
                                                        std::bidirectional_iterator_tag)
    {
        if(0 <= n)
            for(; 0 != n && it != bound; --n)
                ++it;
        else
            for(; 0 != n && it != bound; ++n)
                --it;
        return n;
    }
    template<typename I, typename S, typename Concept>
    constexpr iter_difference_t<I> advance_fn::bounded_(I & it, iter_difference_t<I> n,
                                                        S bound, sized_s
    /// \cond
    template<typename I>
        // requires input_or_output_iterator<I>
    struct counted_iterator;
    /// \endcond

    struct advance_fn
    {
#if RANGES_CXX_IF_CONSTEXPR >= RANGES_CXX_IF_CONSTEXPR_17
        template(typename I)(
            requires input_or_output_iterator<I>)
        constexpr void operator()(I & i, iter_difference_t<I> n) const
        // [[expects: n >= 0 || bidirectional_iterator<I>]]
        {
            if constexpr(random_access_iterator<I>)
            {
                i += n;
     _movable_storable, implement as:
            //      iter_value_t<T0> tmp = iter_move(a);
            //      *a = iter_move(b);
            //      *b = std::move(tmp);
            template<typename I0, typename I1>
            constexpr detail::enable_if_t<
                !is_adl_indirectly_swappable_v<I0, I1> &&
                !is_swappable_with<iter_reference_t<I0>, iter_reference_t<I1>>::value &&
                is_indirectly_movable_v<I0, I1> && is_indirectly_movable_v<I1, I0>>
            operator()(I0 && a, I1 && b) constusing size_type_t RANGES_DEPRECATED("size_type_t is deprecated.") =
        detail::iter_size_t<I>;
    /// \endcond

    namespace cpp20
    {
        using ranges::iter_common_reference_t;
        using ranges::iter_difference_t;
        using ranges::iter_reference_t;
        using ranges::iter_rvalue_reference_t;
        using ranges::iter_value_t;

        // Specialize these in the ranges:: namespace
        using ranges::disable_sized_sentinel;
        template<typename T>
        using incrementable_traits = ranges::incremendard iterator tags") = std::bidirectional_iterator_tag;
    using random_access_iterator_tag RANGES_DEPRECATED(
        "Please switch to the standard iterator tags") = std::random_access_iterator_tag;
    /// \endcond

    struct contiguous_iterator_tag : std::random_access_iterator_tag
    {};

    /// \cond
    namespace detail
    {
        template<typename I, typename = iter_reference_t<I>,
                 typename R = decltype(iter_move(std::declval<I &>())), typename = R &>
        using iter_rvalue_reference_t = R;

                                                 P proj = P{}) const
        {
            // BUGBUG think about the use of coerce here.
            using V = iter_value_t<I>;
            using X = invoke_result_t<P &, V>;
            coerce<V> v;
            coerce<X> x;

            if(first != last && result != end_result)
            {
                auto t1(x(invoke(proj, v(*first))));
                *result = t1;
                for(++first, ++result; first != last && result != end_result;
                    ++first, ++result)me Op = plus, typename P = identity)(
            requires input_range<Rng> AND
                indirectly_binary_invocable_<Op, T *, projected<iterator_t<Rng>, P>> AND
                assignable_from<
                    T &, indirect_result_t<Op &, T *, projected<iterator_t<Rng>, P>>>)
        T operator()(Rng && rng, T init, Op op = Op{}, P proj = P{}) const
        {
            return (*this)(
                begin(rng), end(rng), std::move(init), std::move(op), std::move(proj));
        }
    };

    RANGES_INLINE_VARIABLE(acOp2 = multiplies, typename P1 = identity,
                 typename P2 = identity, typename I1 = iterator_t<Rng1>,
                 typename I2 = iterator_t<Rng2>)(
            requires range<Rng1> AND range<Rng2> AND
                inner_product_constraints<I1, I2, T, BOp1, BOp2, P1, P2>)
        T operator()(Rng1 && rng1, Rng2 && rng2, T init, BOp1 bop1 = BOp1{},
                     BOp2 bop2 = BOp2{}, P1 proj1 = P1{}, P2 proj2 = P2{}) const
        {
            return (*this)(begin(rng1),
                           end(rng1),       template(typename Rng)(
                    requires range<Rng> AND (!viewable_range<Rng>)AND
                        constructible_from<detail::decay_t<Rng>, Rng>)
                shared_view<detail::decay_t<Rng>> operator()(Rng && rng) const
                {
                    return shared_view<detail::decay_t<Rng>>{static_cast<Rng &&>(rng)};
                }
            };

            /// \relates shared_fn
            /// \ingroup group-views
            RANGES_INLINE_VARIABLE(shared_closure<shared_fn>, shared)
    _t<Reference>>
        struct sized_generator;

        template<typename Reference, typename Value = uncvref_t<Reference>>
        struct generator : view_facade<generator<Reference, Value>>
        {
            using promise_type = detail::generator_promise<Reference>;

            constexpr generator() noexcept = default;
            generator(promise_type * p)
              : coro_{handle::from_promise(*p)}
            {
                RANGES_EXPECT(coro_);
            }

        private:
            friend range_access;
     sized_generator
        enum struct generator_size : generator_size_t
        {
            invalid = ~generator_size_t(0)
        };

        template<typename Promise = void>
        struct RANGES_EMPTY_BASES coroutine_owner;

        class enable_coroutine_owner
        {
            template<class>
            friend struct coroutine_owner;
            std::atomic<unsigned int> refcount_{1};
        };
    } // namespace experimental

    /// \cond
    namespace detail
    {
        inline void resume(RANGES_COROUTINES_NS::cor/range_fwd.hpp>

#include <range/v3/utility/common_type.hpp>
#include <range/v3/utility/swap.hpp>

#endif
// Range v3 library
//
//  Copyright Eric Niebler 2013-present
//  Copyright Casey Carter 2016
//
//  Use, modification and distribution is subject to the
//  Boost Software License, Version 1.0. (See accompanying
//  file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3
//
#ifndef RANGES_V3_UTILITY_INVOKE_HPP
#define RANGES_V3_UTILITY_INVOKE_HPP

#,
                                               meta::quote<ranges::common_tuple>>
    {};

    // common reference for pairs
    template<typename F1, typename S1, typename F2, typename S2,
             template<typename> class Qual1, template<typename> class Qual2>
    struct basic_common_reference<ranges::common_pair<F1, S1>, std::pair<F2, S2>, Qual1,
                                  Qual2>
      : ranges::detail::common_ref_tuple_like<
            ranges::common_pair<Qual1<F1>, Qual1<S1>>, std::pair<Qual2<F2>, Qual2<S2>>,
                    ranges::common_pair<F2, S2>,
                                               meta::quote<ranges::common_pair>>
    {};
    // common_type for tuples
    template<typename... Ts, typename... Us>
    struct common_type<ranges::common_tuple<Ts...>, std::tuple<Us...>>
      : ranges::detail::common_type_tuple_like<
            ranges::common_tuple<Ts...>, std::tuple<Us...>,
            meta::quote<ranges::common_tuple>>
    {};
    template<typename... Ts, typename... Us>
    struct common_type<std::tuple<Ts...>, ranges<S const &, S2 &&>::value)
        {
            this->first = static_cast<F2 &&>(that.first);
            this->second = static_cast<S2 &&>(that.second);
            return *this;
        }
    };

    // Logical operators
    template(typename F1, typename S1, typename F2, typename S2)(
        requires equality_comparable_with<F1, F2> AND equality_comparable_with<S1, S2>)
    bool operator==(common_pair<F1, S1> const & a, common_pair<F2, S2> const & b)
    {
        return a.first == b.first && a.second == b.second;
    }
    te  LOGICAL_OP(>, totally_ordered_with)
    LOGICAL_OP(>=, totally_ordered_with)
#undef LOGICAL_OP

    struct make_common_tuple_fn
    {
        template<typename... Args>
        common_tuple<bind_element_t<Args>...> operator()(Args &&... args) const noexcept(
            meta::and_c<std::is_nothrow_constructible<
                bind_element_t<Args>, unwrap_reference_t<Args>>::value...>::value)
        {
            return common_tuple<bind_element_t<Args>...>{
                unwrap_reference(static_cast<Args &&>(args))...};
    
        }
        std::tuple<Ts...> const & base() const noexcept
        {
            return *this;
        }

        // Assignment
        template(typename... Us)(
            requires std::is_assignable<detail::args<Ts...> &,
                                        detail::rargs<Us...>>::value) //
        common_tuple & operator=(std::tuple<Us...> & that) noexcept(
            meta::and_c<std::is_nothrow_assignable<Ts &, Us &>::value...>::value)
        {
            (void)tuple_transform(base(), that, element_assign_{});
  quires forward_iterator<O>)
        {
            auto tmp = *this;
            ++out_;
            return tmp;
        }
        O base() const
        {
            return out_;
        }
    };

    template<typename I>
    struct iterator_wrapper
    {
    private:
        CPP_assert(input_or_output_iterator<I>);
        mutable I * i_ = nullptr;

    public:
        using difference_type = iter_difference_t<I>;
        iterator_wrapper() = default;
        iterator_wrapper(iterator_wrapper const & that)
          : i_(that.i_)icniebler/range-v3
//
//===-------------------------- algorithm ---------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef RANGES_V3_UTILITY_MEMORY_HPP
#define RANGES_V3_UTILITY_MEMORY_HPP

#include <cstdint>
#include <memory>
#include <type_traits>
#include <utility>

#incIGNORE_DEPRECATED_DECLARATIONS

namespace ranges
{
    struct bad_any_cast : std::bad_cast
    {
        virtual const char * what() const noexcept override
        {
            return "bad any_cast";
        }
    };

    struct RANGES_DEPRECATED(
        "ranges::any will be going away in the not-too-distant future. "
        "We suggest you use std::any or boost::any instead (or simply steal "
        "this header and maintain it yourself).") any;

    template<typename T>
    meta::if_c<std::is_reference<T>() || copyable<T>, Ting_cache && that) noexcept
            {
                that.optional<T>::reset();
                optional<T>::reset();
                return *this;
            }
            using optional<T>::operator=;
            template<class I>
            constexpr T & emplace_deref(const I & i)
            {
                return optional<T>::emplace(*i);
            }
        };

        template<typename T, typename Tag>
        struct non_propagating_cache<T, Tag, false>
        {};
    } // namespace detail
    /// \endcond
} // n    template<typename T>
            constexpr bool operator>=(nullopt_t, optional<T> const & x) noexcept
            {
                return !x;
            }

            // Comparisons with T [optional.comp_with_t]
            template<typename T, typename U>
            constexpr auto operator==(optional<T> const & x, U const & y) //
                noexcept(noexcept(convert_bool(*x == y)))                 //
                -> decltype(convert_bool(*x == y))
            {
                return x && convert_bool(*x == y);
   tible<T, std::initializer_list<E> &, Args...>::value)
        {
            reset();
            return base_t::construct_from(il, static_cast<Args &&>(args)...);
        }

        using base_t::swap;
        using base_t::operator->;
        using base_t::operator*;

        constexpr explicit operator bool() const noexcept
        {
            return has_value();
        }
        using base_t::has_value;

        constexpr T const & value() const &
        {
            return (has_value() || detail::throw_bad_optional_access(ible<T>::value && std::is_move_assignable<T>::value,
                meta::if_c<std::is_reference<T>::value ||
                               !(detail::is_trivially_move_constructible_v<T> &&
                                 detail::is_trivially_move_assignable_v<T>),
                           optional_move_assign<T>, copy_assign_layer<T>>,
                deleted_move_assign<T>>;
        } // namespace optional_adl
    }     // namespace detail
    /// \endcond

    // clang-format off
    /// \concept optional_should_convert
   RANGES_EXPECT(!ptr_);
                    ptr_ = detail::addressof(ref);
                    return *ptr_;
                }
                template<typename U>
                constexpr void assign_from(U && that)
                {
                    if(ptr_ && that.ptr_)
                        *ptr_ = *that.ptr_;
                    else
                        ptr_ = that.ptr_;
                }

            private:
                T * ptr_ = nullptr;
            };

            template<typename T>
            struct option     char dummy_;
                    meta::_t<std::remove_cv<T>> data_;
                };
                bool engaged_;

                constexpr optional_storage() noexcept
                  : optional_storage(
                        tag{},
                        meta::bool_<detail::is_trivially_default_constructible_v<T> &&
                                    detail::is_trivially_copyable_v<T>>{})
                {}
                template(typename... Args)(
                    requires constructible_from<T, Args...>)
    
            ranges::swap(static_cast<Base &>(*this), static_cast<Base &>(that));
        }
#if !RANGES_BROKEN_CPO_LOOKUP
        template<typename B = Base>
        friend constexpr auto swap(tagged & x, tagged & y) //
            noexcept(is_nothrow_swappable<B>::value)
            -> CPP_broken_friend_ret(void)(
                requires is_swappable<B>::value)
        {
            x.swap(y);
        }
#endif
    };

#if RANGES_BROKEN_CPO_LOOKUP
    namespace _tagged_
    {
        template(typename Base, typename... Tags)(
        auto operator=(indexed_datum const & that) //
                -> CPP_ret(indexed_datum &)(
                    requires assignable_from<T &, T const &>)
            {
                ranges::copy(that.data_, data_);
                return *this;
            }
            // \pre Requires ranges::distance(r) <= N
            template(typename R)(
                requires input_range<R> AND assignable_from<T &, range_reference_t<R>>)
            indexed_datum & operator=(R && r)
            {
                ranges::copy(r, data_/range/access.hpp>
#include <range/v3/range/concepts.hpp>
#include <range/v3/range/primitives.hpp>

#include <range/v3/detail/prologue.hpp>

namespace ranges
{
    /// \cond
    namespace detail
    {
        template<typename T, std::size_t N, typename Index>
        struct indexed_datum<T[N], Index>
        {
        private:
            union
            {
                char c;
                T data_[N];
            };
            void fill_default_(T * p, std::true_type)
            {
                for(; p != ranges::end(dpename O)(
                    requires weakly_incrementable<O> AND
                        indirectly_copyable<decltype(mixer_.begin()), O>)
                RANGES_INTENDED_MODULAR_ARITHMETIC void param(O dest) const
                {
                    constexpr IntRep INV_A = randutils::fast_exp(MULT_A, IntRep(-1));
                    constexpr IntRep MIX_INV_L =
                        randutils::fast_exp(MIX_MULT_L, IntRep(-1));

                    auto mixer_copy = mixer_;
                    for(std::size_t round = 0; rouuint32_t XSHIFT = sizeof(IntRep) * 8 / 2;

                std::array<IntRep, count> mixer_;

                template(typename I, typename S)(
                    requires input_iterator<I> AND sentinel_for<S, I> AND
                        convertible_to<iter_reference_t<I>, IntRep>)
                void mix_entropy(I first, S last)
                {
                    auto hash_const = INIT_A;
                    auto hash = [&](IntRep value) RANGES_INTENDED_MODULAR_ARITHMETIC {
                        value ^= hash_const;
        // Hopefully high-quality entropy from random_device.
#if defined(__GLIBCXX__) && defined(RANGES_WORKAROUND_VALGRIND_RDRAND)
                std::random_device rd{"/dev/urandom"};
#else
                std::random_device rd;
#endif
                std::uniform_int_distribution<std::uint32_t> dist{};
                ranges::generate(seeds, [&] { return dist(rd); });

                return seeds;
            }

            template(typename I)(
                requires unsigned_integral<I>)
            constexpr I fast_exp(I x, _box() = default;
        template(typename Arg)(
            requires constructible_from<ranges::reference_wrapper<T &>, Arg &>)
        semiregular_box(in_place_t, Arg & arg) noexcept //
          : ranges::reference_wrapper<T &>(arg)
        {}
        using ranges::reference_wrapper<T &>::get;
        using ranges::reference_wrapper<T &>::operator T &;
        using ranges::reference_wrapper<T &>::operator();

#if defined(_MSC_VER)
        template(typename U)(
            requires (!same_as<uncvref_t<U>, semiregular_box>) AND
/// @{
    template<typename T>
    struct semiregular_box : private detail::semiregular_get
    {
    private:
        struct tag
        {};
        template<typename... Args>
        void construct_from(Args &&... args)
        {
            new((void *)std::addressof(data_)) T(static_cast<Args &&>(args)...);
            engaged_ = true;
        }
        void move_assign(T && t, std::true_type)
        {
            data_ = detail::move(t);
        }
        void move_assign(T && t, std::false_type)
        {
            reset(      explicit scope_exit(Fun && fun) noexcept(noexcept(scope_exit(std::move(fun),
                                                                     nothrow_move_t{})))
          : scope_exit(std::move(fun), nothrow_move_t{})
        {}

        scope_exit(scope_exit const &) = delete;

        scope_exit(scope_exit && that) noexcept(
            std::is_nothrow_move_constructible<Fun>::value)
          : scope_exit(std::move((that.dismiss(), that)).fun_)
        {}

        ~scope_exit()
        {
            if(!dismissed_)
  ypename> class Qual2>
    struct basic_common_reference<::ranges::common_tuple<Ts...>, ::ranges::common_tuple<Us...>, Qual1, Qual2>;
} // namespace concepts

#if RANGES_CXX_VER > RANGES_CXX_STD_17
RANGES_DIAGNOSTIC_PUSH
RANGES_DIAGNOSTIC_IGNORE_MISMATCHED_TAGS
RANGES_BEGIN_NAMESPACE_STD
RANGES_BEGIN_NAMESPACE_VERSION

    template<typename...>
    struct common_type;

    // common_type for std::pairs
    template<typename F1, typename S1, typename F2, typename S2>
    struct common_type<std::pair<F1, S1>, ::ranges::common_pair<F2,/// \sa `make_compressed_pair_fn`
    RANGES_INLINE_VARIABLE(make_compressed_pair_fn, make_compressed_pair)
} // namespace ranges

RANGES_DIAGNOSTIC_PUSH
RANGES_DIAGNOSTIC_IGNORE_MISMATCHED_TAGS
namespace std
{
    template<typename... Ts, size_t... Is>
    struct tuple_size<::ranges::compressed_tuple_detail::compressed_tuple_<
        ::meta::list<Ts...>, ::meta::index_sequence<Is...>>>
      : integral_constant<size_t, sizeof...(Ts)>
    {};

    template<size_t I, typename... Ts, size_t... Is>
    struct tuple_element<I, ::rangexcept
        -> meta::if_<std::is_reference<Target>,
                     decltype((static_cast<Target>(std::declval<Source>()),
                               dynamic_cast<Target>(std::declval<Source>())))>
    {
        auto && result = static_cast<Target>(static_cast<Source &&>(x));
#ifndef NDEBUG
        auto && dresult = dynamic_cast<Target>(static_cast<Source &&>(x));
        RANGES_ASSERT(std::addressof(dresult) == std::addressof(result));
#endif
        return static_cast<Target>(result);
    }
} // namespace ranges

#inclpename Val, typename Fun>
        constexpr auto CPP_auto_fun(operator())(Tup &&tup, Val val, Fun fun)(const)
        (
            return tuple_foldl_fn::impl2(static_cast<Tup &&>(tup),
                                         std::move(val),
                                         fun,
                                         tuple_indices_t<Tup>{})
        )
        // clang-format on
    };

    /// \ingroup group-utility
    /// \sa `tuple_foldl_fn`
    RANGES_INLINE_VARIABLE(tuple_foldl_fn, tuple_foldl)

    struct tuple_fore_from<Element, E> AND
                (!convertible_to<E, Element>))
        constexpr explicit box(E && e)
            noexcept(std::is_nothrow_constructible<Element, E>::value) //
          : value(static_cast<E &&>(e))
        {}
#endif

        constexpr Element & get() & noexcept
        {
            return value;
        }
        constexpr Element const & get() const & noexcept
        {
            return value;
        }
        constexpr Element && get() && noexcept
        {
            return detail::move(value);
    ;

    public:
        CPP_member
        constexpr CPP_ctor(box)()(                                          //
            noexcept(std::is_nothrow_default_constructible<Element>::value) //
                requires std::is_default_constructible<Element>::value)
          : value{}
        {}
#if defined(__cpp_conditional_explicit) && __cpp_conditional_explicit > 0
        template(typename E)(
            requires (!same_as<box, detail::decay_t<E>>) AND
                constructible_from<Element, E>)
        constexpr explicit(!c/v3/iterator/common_iterator.hpp>
#include <range/v3/iterator/concepts.hpp>
#include <range/v3/iterator/counted_iterator.hpp>
#include <range/v3/iterator/default_sentinel.hpp>
#include <range/v3/iterator/diffmax_t.hpp>
#include <range/v3/iterator/insert_iterators.hpp>
#include <range/v3/iterator/move_iterators.hpp>
#include <range/v3/iterator/operations.hpp>
#include <range/v3/iterator/reverse_iterator.hpp>
#include <range/v3/iterator/stream_iterators.hpp>
#include <range/v3/iterator/traits.hpp>ct iter_zip_with_view;

    template<typename Fun, typename... Rngs>
    struct zip_with_view;

    template<typename... Rngs>
    struct zip_view;

    namespace views
    {
        struct iter_zip_with_fn;

        struct zip_with_fn;

        struct zip_fn;
    } // namespace views
} // namespace ranges

/// \cond
namespace ranges
{
    namespace concepts = ::concepts;
    using namespace ::concepts::defs;
    using ::concepts::and_v;
} // namespace ranges
/// \endcond

RANGES_DIAGNOSTIC_POP

#include <range/v3/detail/epilogue.h Rng, bool = (bool)is_infinite<Rng>()>
    struct RANGES_EMPTY_BASES cycled_view;

    namespace views
    {
        struct cycle_fn;
    }

    /// \cond
    namespace detail
    {
        template<typename I>
        struct reverse_cursor;
    }
    /// \endcond

    template<typename I>
    using reverse_iterator = basic_iterator<detail::reverse_cursor<I>>;

    template<typename T>
    struct empty_view;

    namespace views
    {
        struct empty_fn;
    }

    template<typename Rng, typename Fun>
    struct group_by_view;ignable_v =
            is_trivially_move_assignable<T>::value;
#endif
#endif

        template<typename T>
        RANGES_INLINE_VAR constexpr bool is_trivial_v =
            is_trivially_copyable_v<T> &&
            is_trivially_default_constructible_v<T>;

        template<typename T>
        struct is_trivial
          : meta::bool_<is_trivial_v<T>>
        {};

#if RANGES_CXX_LIB_IS_FINAL > 0
#if defined(__clang__) && !defined(_LIBCPP_VERSION)
        template<typename T>
        RANGES_INLINE_VAR constexpr bool is_final_v = _s deprecated. Use "
        "ranges::indirectly_readable_traits<T>::value_type instead.") = detail::value_type_<T>;

    template<typename T>
    struct size_type;
    /// \endcond

    /// \cond
    namespace detail
    {
        struct ignore_t
        {
            ignore_t() = default;
            template<typename T>
            constexpr ignore_t(T &&) noexcept
            {}
            template<typename T>
            constexpr ignore_t const & operator=(T &&) const noexcept
            {
                return *this;
     lude <range/v3/functional/bind_back.hpp>
#include <range/v3/functional/comparisons.hpp>
#include <range/v3/functional/compose.hpp>
#include <range/v3/functional/concepts.hpp>
#include <range/v3/functional/identity.hpp>
#include <range/v3/functional/indirect.hpp>
#include <range/v3/functional/invoke.hpp>
#include <range/v3/functional/not_fn.hpp>
#include <range/v3/functional/on.hpp>
#include <range/v3/functional/overload.hpp>
#include <range/v3/functional/pipeable.hpp>
#include <range/v3/functional/reference_wrapper.hpp>

#endif
// n
        /// \overload
        template(std::size_t N)(
            requires (N == 2)) //
        friend constexpr size_type get(sized_iterator_range const & p) noexcept
        {
            return p.size();
        }
    };

    struct make_iterator_range_fn
    {
        /// \return `{first, last}`
        template(typename I, typename S)(
            requires sentinel_for<S, I>)
        constexpr iterator_range<I, S> operator()(I first, S last) const
        {
            return {detail::move(first), detail::move(last)};
      <range/v3/range_fwd.hpp>

#include <range/v3/iterator/concepts.hpp>
#include <range/v3/iterator/operations.hpp>
#include <range/v3/iterator/unreachable_sentinel.hpp>
#include <range/v3/utility/static_const.hpp>
#include <range/v3/view/interface.hpp>

RANGES_DEPRECATED_HEADER(
    "This header is deprecated. Please switch to subrange in "
    "<range/v3/view/subrange.hpp>.")

#include <range/v3/detail/prologue.hpp>

namespace ranges
{
    /// \addtogroup group-views
    /// @{

    template<typename I, typename S>
    RANGES_INLINEnge/v3/iterator/operations.hpp>

#endif
/// \file
// Range v3 library
//
//  Copyright Eric Niebler 2013-present
//
//  Use, modification and distribution is subject to the
//  Boost Software License, Version 1.0. (See accompanying
//  file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3
//

#ifndef RANGES_V3_ALGORITHM_HPP
#define RANGES_V3_ALGORITHM_HPP

#include <range/v3/algorithm/adjacent_find.hpp>
#include <range/v3/algorithm/adjacent_remove_if.hpst Software License, Version 1.0. (See accompanying
//  file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3
//

#ifndef RANGES_V3_DATA_HPP
#define RANGES_V3_DATA_HPP

#include <range/v3/detail/config.hpp>
RANGES_DEPRECATED_HEADER(
    "This header is deprecated. Please #include <range/v3/range/primitives.hpp> instead.")

#include <range/v3/range/primitives.hpp>

#endif // RANGES_V3_DATA_HPP
// Range v3 library
//
//  Copyright Eric Niebler 2014-presen   struct transform_<list<list<Ts0...>, list<Ts1...>, Fn>,
                            void_<invoke<Fn, Ts0, Ts1>...>>
        {
            using type = list<invoke<Fn, Ts0, Ts1>...>;
        };
#endif
    } // namespace detail
        /// \endcond

    /// Return a new \c meta::list constructed by transforming all the
    /// elements in \p L with the unary invocable \p Fn. \c transform can
    /// also be called with two lists of the same length and a binary
    /// invocable, in which case it returns a new list constructed with     : concat_<list<L1..., L2..., L3..., L4..., L5..., L6..., L7..., L8..., L9..., L10...>,
                    Rest...>
        {
        };
    } // namespace detail
    /// \endcond

    /// Concatenates several lists into a single list.
    /// \pre The parameters must all be instantiations of \c meta::list.
    /// \par Complexity
    /// `O(L)` where `L` is the number of lists in the list of lists.
    /// \ingroup transformation
    template <META_TYPE_CONSTRAINT(list_like)... Ls>
    using concat_ = _t<detail::concat_<Ls...l...>, invoke<Fn, State, Head>, Fn>
        {
        };

        template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5,
                    typename T6, typename T7, typename T8, typename T9, typename... Tail,
                    typename State, typename Fn>
        requires valid<invoke, compose_<Fn>, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, State>
        struct fold_<list<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Tail...>, State, Fn>
          : fold_<list<Tail...>,
                  invoke<composer bool and_v = (true && ... && Bs);

    /// Logically AND together all the Boolean parameters
    /// \ingroup logical
    template <bool... Bs>
#if defined(META_WORKAROUND_MSVC_756112) || defined(META_WORKAROUND_GCC_86356)
    using and_c = bool_<and_v<Bs...>>;
#else
    using and_c = bool_<(true && ... && Bs)>;
#endif
#else
#if defined(META_WORKAROUND_GCC_66405)
    template <bool... Bs>
    using and_c = meta::bool_<
        META_IS_SAME(integer_sequence<bool, true, Bs...>,
                     integer_sequence<bool, Bs..., trutd::enable_if<_v<If>, Then>
        {
        };

        template <typename If, typename Then, typename Else>
            requires integral<If>
        struct _if_<If, Then, Else> : std::conditional<_v<If>, Then, Else>
        {
        };
#elif defined(__clang__)
        // Clang is faster with this implementation
        template <typename, typename = bool>
        struct _if_
        {
        };

        template <typename If>
        struct _if_<list<If>, decltype(bool(If::type::value))> : std::enable_if<If::type::value>
     invocable that partially applies the invocable \p Fn by binding the
    /// arguments \p Us to the \e back of \p Fn.
    /// \ingroup composition
    template <META_TYPE_CONSTRAINT(invocable) Fn, typename... Us>
    struct bind_back
    {
        template <typename... Ts>
        using invoke = invoke<Fn, Ts..., Us...>;
    };

    namespace lazy
    {
        /// \sa 'meta::bind_front'
        /// \ingroup lazy_composition
        template <typename Fn, typename... Ts>
        using bind_front = defer<bind_front, Fn, Ts...>;

   _trait = _t<detail::is_trait_<T>>;

    /// An alias for `std::true_type` if `T::invoke` exists and names a class
    /// template or alias template; otherwise, it's an alias for
    /// `std::false_type`.
    /// \ingroup trait
    template <typename T>
    using is_callable = _t<detail::is_callable_<T>>;
#endif

    /// \cond
    namespace detail
    {
#ifdef META_CONCEPT
        template <template <typename...> class, typename...>
        struct defer_
        {
        };

        template <template <typename...> class C, typen       {
        };
    } // namespace detail
    /// \endcond

    ///////////////////////////////////////////////////////////////////////////////////////////
    // integer_sequence
#if !META_CXX_INTEGER_SEQUENCE
    /// A container for a sequence of compile-time integer constants.
    /// \ingroup integral
    template <typename T, T... Is>
    struct integer_sequence
    {
        using value_type = T;
        /// \return `sizeof...(Is)`
        static constexpr std::size_t size() noexcept { return sizeof...(Is); }
    };
#endi     : indices_strategy_::recurse;
        }

        template <typename T>
        constexpr std::size_t range_distance_(T begin, T end)
        {
            return begin <= end ? static_cast<std::size_t>(end - begin)
                                : throw "The start of the integer_sequence must not be "
                                        "greater than the end";
        }

        template <std::size_t End, typename State, indices_strategy_ Status_>
        struct make_indices_
        {
            using type = State;
    res C++14 or greater.
    /// \ingroup invocation
    template <META_TYPE_CONSTRAINT(integral) T>
    constexpr typename T::type::value_type _v = T::type::value;
#endif

    /// Lazy versions of meta actions
    namespace lazy
    {
        /// \sa `meta::_t`
        /// \ingroup lazy_invocation
        template <typename T>
        using _t = defer<_t, T>;
    } // namespace lazy

    /// An integral constant wrapper for \c std::size_t.
    /// \ingroup integral
    template <std::size_t N>
    using size_t = std::integral_constant defer;

    template <typename T, template <T...> class C, T... Is>
    struct defer_i;

#if META_CXX_VARIABLE_TEMPLATES || defined(META_DOXYGEN_INVOKED)
    /// is_v
    /// Test whether a type \p T is an instantiation of class
    /// template \p C.
    /// \ingroup trait
    template <typename, template <typename...> class>
    META_INLINE_VAR constexpr bool is_v = false;
    template <typename... Ts, template <typename...> class C>
    META_INLINE_VAR constexpr bool is_v<C<Ts...>, C> = true;
#endif

#ifdef META_CONCEPT
    na     copyable<T> &&
            default_constructible<T>;
            // Axiom: copies are independent. See Fundamentals of Generic
            // Programming http://www.stepanovpapers.com/DeSt98.pdf

        /// \concept regular
        /// \brief The \c regular concept
        template<typename T>
        CPP_concept regular =
            semiregular<T> &&
            equality_comparable<T>;

    } // inline namespace defs
} // namespace concepts

#endif // RANGES_V3_UTILITY_CONCEPTS_HPP
/// \file meta_fwd.hpp Forward declarationame T)(
        concept (copy_constructible_)(T),
            constructible_from<T, T &> &&
            constructible_from<T, T const &> &&
            constructible_from<T, T const> &&
            convertible_to<T &, T> &&
            convertible_to<T const &, T> &&
            convertible_to<T const, T>);
        /// \concept copy_constructible
        /// \brief The \c copy_constructible concept
        template<typename T>
        CPP_concept copy_constructible =
            move_constructible<T> &&
            CPP_concept_ref((T && t) //
            (
                !(T&&) t,
                concepts::requires_<boolean_testable_impl_<decltype(!(T&&) t)>>
            ));

        /// \concept boolean_testable_
        /// \brief The \c boolean_testable_ concept
        template<typename T>
        CPP_concept boolean_testable_ =
            CPP_requires_ref(boolean_testable_frag_, T) &&
            boolean_testable_impl_<T>;

        CPP_DIAGNOSTIC_PUSH
        CPP_DIAGNOSTIC_IGNORE_FLOAT_EQUAL

        /// \concept weakly_equality_comparable_with_frag_\brief The \c implicitly_convertible_to concept
        template<typename From, typename To>
        CPP_concept implicitly_convertible_to =
            std::is_convertible<std::add_rvalue_reference_t<From>, To>::value;

        /// \concept explicitly_convertible_to_
        /// \brief The \c explicitly_convertible_to_ concept
        template<typename From, typename To>
        CPP_requires(explicitly_convertible_to_,
            requires(From(*from)()) //
            (
                static_cast<To>(from())
            ));
    //       requires Concept1<A> && Concept2<B>)
//   {}
//
// Note: This macro cannot be used when the last function argument is a
//       parameter pack.
#define CPP_fun(X) CPP_PP_IGNORE_CXX2A_COMPAT_BEGIN X CPP_FUN_IMPL_1_
#endif

////////////////////////////////////////////////////////////////////////////////
// CPP_auto_fun
// Usage:
//   template <typename A, typename B>
//   auto CPP_auto_fun(foo)(A a, B b)([const]opt [noexcept(cond)]opt)opt
//   (
//       return a + b
//   )
#define CPP_auto_fun(X) X CPP_AUTO_FUN_IMPL_

///       \
    CPP_concept CPP_PP_CAT(NAME, requires_) =                                   \
        CPP_PP_CAT(CPP_REQUIRES_, REQS)
#define CPP_requires_ref(NAME, ...)                                             \
    CPP_PP_CAT(NAME, requires_)<__VA_ARGS__>
#endif

/// INTERNAL ONLY
#define CPP_REQUIRES_requires(...)                                              \
    requires(__VA_ARGS__) CPP_REQUIRES_AUX_

/// INTERNAL ONLY
#define CPP_REQUIRES_AUX_(...)                                                  \
    { __VA_ARGS__; }

#else       \
        CPP_BOOL(CPP_true),                                                     \
        int> = 0>                                                               \
    CPP_PP_IGNORE_CXX2A_COMPAT_END

// A concept definition
/// INTERNAL ONLY
#define CPP_TEMPLATE_SFINAE_AUX_1(DECL, ...) ,                                  \
        bool CPP_true = true,                                                   \
        std::enable_if_t<__VA_ARGS__ && CPP_BOOL(CPP_true), int> = 0>           \
    auto CPP_CONCEPT_NAME_(DECL)(       _assert(static_cast<bool>(__VA_ARGS__),                               \
        "Concept assertion failed : " #__VA_ARGS__)

#define CPP_assert_msg static_assert

#if CPP_CXX_CONCEPTS || defined(CPP_DOXYGEN_INVOKED)
#define CPP_concept META_CONCEPT
#define CPP_and &&

#else
#define CPP_concept CPP_INLINE_VAR constexpr bool
#define CPP_and CPP_and_sfinae

#endif

////////////////////////////////////////////////////////////////////////////////
// CPP_template
// Usage:
//   CPP_template(typename A, typename B)
//     (requires Concep(__cpp_concepts) && defined(__cpp_impl_three_way_comparison)

#include <compare>
#include <concepts/concepts.hpp>
#include <range/v3/compare.hpp>

// clang-format off

namespace concepts
{
    // Note: concepts in this file can use C++20 concepts, since operator<=> isn't available in
    // compilers that don't support core concepts.
    namespace detail
    {
        template<typename T, typename Cat>
        concept compares_as = same_as<ranges::common_comparison_category_t<T, Cat>, Cat>;
    } // namespace detail

    inline namtuple<Us...> &&right) const
                noexcept(meta::and_c<is_nothrow_swappable_with<Ts, Us>::value...>::value)
            {
                swap_fn::impl(
                    static_cast<std::tuple<Ts...> &&>(left),
                    static_cast<std::tuple<Us...> &&>(right),
                    meta::make_index_sequence<sizeof...(Ts)>{});
            }

        private:
            template<typename... Ts>
            static constexpr int ignore_unused(Ts &&...)
            {
                return 0;
            }
      : detail::_common_reference2<T, U>
    {};

    template<typename... Ts>
    using common_reference_t = typename common_reference<Ts...>::type;

    template<typename T, typename U, typename... Vs>
    struct common_reference<T, U, Vs...>
        : meta::lazy::fold<meta::list<U, Vs...>, T, meta::quote<common_reference_t>>
    {};
    /// @}
} // namespace concepts

#endif
/// \file
// Concepts library
//
//  Copyright Eric Niebler 2013-present
//
//  Use, modification and distribution is subject to the
//  Boost Software License, Vref<T const volatile>
        {
            template<typename U>
            using invoke = U const volatile;
        };

        template<typename T, typename U>
        using _basic_common_reference =
            basic_common_reference<
                remove_cvref_t<T>,
                remove_cvref_t<U>,
                _xref<T>::template invoke,
                _xref<U>::template invoke>;

        template<typename T, typename U, typename = void>
        struct _common_reference2
            : if_else_t<
                meta::iense, Version 1.0. (See accompanying
//  file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3

#ifndef CPP_TYPE_TRAITS_HPP
#define CPP_TYPE_TRAITS_HPP

#include <tuple>
#include <utility>
#include <type_traits>
#include <meta/meta.hpp>

namespace concepts
{
    template<typename T>
    using re