#include <iostream>
#include <type_traits>
template <typename Arg1, typename Arg2>
constexpr typename std::common_type<Arg1, Arg2>::type vmin(Arg1&& arg1, Arg2&& arg2)
{
return arg1 < arg2 ? std::forward<Arg1>(arg1) : std::forward<Arg2>(arg2);
}
template <typename Arg, typename... Args>
constexpr typename std::common_type<Arg, Args...>::type vmin(Arg&& arg, Args&&... args)
{
return vmin(std::forward<Arg>(arg), vmin(std::forward<Args>(args)...));
}
int main()
{
std::cout << vmin(3, 2, 1, 2, 5) << std::endl;
std::cout << vmin(3., 1.2, 1.3, 2., 5.2) << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZV90cmFpdHM+Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgQXJnMSwgdHlwZW5hbWUgQXJnMj4KY29uc3RleHByIHR5cGVuYW1lIHN0ZDo6Y29tbW9uX3R5cGU8QXJnMSwgQXJnMj46OnR5cGUgdm1pbihBcmcxJiYgYXJnMSwgQXJnMiYmIGFyZzIpCnsKICAgIHJldHVybiBhcmcxIDwgYXJnMiA/IHN0ZDo6Zm9yd2FyZDxBcmcxPihhcmcxKSA6IHN0ZDo6Zm9yd2FyZDxBcmcyPihhcmcyKTsKfQoKdGVtcGxhdGUgPHR5cGVuYW1lIEFyZywgdHlwZW5hbWUuLi4gQXJncz4KY29uc3RleHByIHR5cGVuYW1lIHN0ZDo6Y29tbW9uX3R5cGU8QXJnLCBBcmdzLi4uPjo6dHlwZSB2bWluKEFyZyYmIGFyZywgQXJncyYmLi4uIGFyZ3MpCnsKICAgIHJldHVybiB2bWluKHN0ZDo6Zm9yd2FyZDxBcmc+KGFyZyksIHZtaW4oc3RkOjpmb3J3YXJkPEFyZ3M+KGFyZ3MpLi4uKSk7Cn0KCmludCBtYWluKCkKewogICAgc3RkOjpjb3V0IDw8IHZtaW4oMywgMiwgMSwgMiwgNSkgPDwgc3RkOjplbmRsOwogICAgc3RkOjpjb3V0IDw8IHZtaW4oMy4sIDEuMiwgMS4zLCAyLiwgNS4yKSA8PCBzdGQ6OmVuZGw7Cn0=