#include <algorithm>
#include <cstdint>
#include <iterator>
#include <iostream>
#include <tuple>
#include <vector>
#include <iostream>
#include <tuple>
#include <utility>
template <typename Seq, typename T1, typename T2>
struct cartesian_pairs_helper;
template <std::size_t...Is, typename T1, typename T2>
struct cartesian_pairs_helper<std::index_sequence<Is...>, T1, T2>
{
static constexpr std::size_t size1 = std::tuple_size<T1>::value;
using type = std::tuple<
std::pair<
std::tuple_element_t<Is / size1, T1>,
std::tuple_element_t<Is % size1, T2>
>...>;
};
template <typename T1, typename T2>
struct cartesian_pairs
{
using type = typename cartesian_pairs_helper<
std::make_index_sequence<std::tuple_size<T1>::value
* std::tuple_size<T2>::value>,
T1, T2>::type;
};
static_assert(std::is_same<
std::tuple<
std::pair<char, float>,
std::pair<char, double>,
std::pair<int, float>,
std::pair<int, double>>,
cartesian_pairs<std::tuple<char, int>, std::tuple<float, double>>::type
>::value, "unexpected");
int main() {
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGNzdGRpbnQ+CiNpbmNsdWRlIDxpdGVyYXRvcj4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHVwbGU+CiNpbmNsdWRlIDx2ZWN0b3I+CgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDx0dXBsZT4KI2luY2x1ZGUgPHV0aWxpdHk+Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgU2VxLCB0eXBlbmFtZSBUMSwgdHlwZW5hbWUgVDI+CnN0cnVjdCBjYXJ0ZXNpYW5fcGFpcnNfaGVscGVyOwoKdGVtcGxhdGUgPHN0ZDo6c2l6ZV90Li4uSXMsIHR5cGVuYW1lIFQxLCB0eXBlbmFtZSBUMj4Kc3RydWN0IGNhcnRlc2lhbl9wYWlyc19oZWxwZXI8c3RkOjppbmRleF9zZXF1ZW5jZTxJcy4uLj4sIFQxLCBUMj4KewoJc3RhdGljIGNvbnN0ZXhwciBzdGQ6OnNpemVfdCBzaXplMSA9IHN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