This documentation is automatically generated by online-judge-tools/verification-helper
#include "../template.hh"
// for c++14 and above; explicitly specify the return type of the lambda
// links:
// 1. https://stackoverflow.com/a/40873657
// 2. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0200r0.html
template<typename F>
struct y_combinator_result {
F f;
template<typename T>
explicit y_combinator_result(T&& fun) : f(forward<T>(fun)) {}
template<typename... Args>
decltype(auto) operator()(Args&&... args) {
return f(ref(*this), forward<Args>(args)...);
}
};
template<typename F>
decltype(auto) y_combinator(F&& f) {
return y_combinator_result<decay_t<F>>(forward<F>(f));
}
#line 1 "code/template.cc"
// this line is here for a reason
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl '\n'
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SZ(x) (int)(x).size()
#define FOR(a, b, c) for (auto a = (b); (a) < (c); ++(a))
#define F0R(a, b) FOR (a, 0, (b))
template <typename T>
bool ckmin(T& a, const T& b) { return a > b ? a = b, true : false; }
template <typename T>
bool ckmax(T& a, const T& b) { return a < b ? a = b, true : false; }
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout if (DEBUG) cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#line 2 "code/utils/y_combinator.cc"
// for c++14 and above; explicitly specify the return type of the lambda
// links:
// 1. https://stackoverflow.com/a/40873657
// 2. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0200r0.html
template<typename F>
struct y_combinator_result {
F f;
template<typename T>
explicit y_combinator_result(T&& fun) : f(forward<T>(fun)) {}
template<typename... Args>
decltype(auto) operator()(Args&&... args) {
return f(ref(*this), forward<Args>(args)...);
}
};
template<typename F>
decltype(auto) y_combinator(F&& f) {
return y_combinator_result<decay_t<F>>(forward<F>(f));
}