This documentation is automatically generated by online-judge-tools/verification-helper
#include "algebra/monoid_s_f/monoid_max_index_add.hpp"
#pragma once
#include "algebra/monoid_s/monoid_max_index.hpp"
#include "algebra/monoid_f/monoid_add.hpp"
// MSF
template <class T, bool left = true> struct MonoidMaxIndexAdd {
using MS = MonoidMaxIndex<T, left>;
using MF = MonoidAdd<T>;
using S = typename MS::S;
using F = typename MF::F;
static constexpr S mapping(F f, S x) { return {f + x.first, x.second}; }
};
#line 2 "algebra/monoid_s/monoid_max_index.hpp"
// MS
template <class T, bool left = true> struct MonoidMaxIndex {
using S = std::pair<T, int>;
static constexpr S op(S a, S b) {
if (a.first > b.first) return a;
if (a.first < b.first) return b;
if (a.second > b.second) std::swap(a, b);
return (left ? a : b);
}
static constexpr S e() { return {std::numeric_limits<T>::lowest(), -1}; }
};
#line 2 "algebra/monoid_f/monoid_add.hpp"
// MF
template <class T> struct MonoidAdd {
using F = T;
static constexpr F composition(F f, F g) { return f + g; }
static constexpr F id() { return T(0); }
};
#line 4 "algebra/monoid_s_f/monoid_max_index_add.hpp"
// MSF
template <class T, bool left = true> struct MonoidMaxIndexAdd {
using MS = MonoidMaxIndex<T, left>;
using MF = MonoidAdd<T>;
using S = typename MS::S;
using F = typename MF::F;
static constexpr S mapping(F f, S x) { return {f + x.first, x.second}; }
};