#line 2 "/home/bayashi/dev/byslib/core/stdlib.hpp" #ifndef LOCAL #define NDEBUG #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace bys { using std::array, std::vector, std::string, std::set, std::map, std::pair; using std::cin, std::cout, std::endl; using std::min, std::max, std::sort, std::reverse, std::abs, std::pow; // alias using ll = long long int; using ld = long double; using Pa = pair; using Pall = pair; using ibool = std::int8_t; template using uset = std::unordered_set; template using umap = std::unordered_map; } // namespace bys #line 3 "/home/bayashi/dev/byslib/core/const.hpp" namespace bys { constexpr int MOD = 998244353; constexpr int MOD7 = 1000000007; constexpr int INF = std::numeric_limits::max() / 2; constexpr ll LINF = std::numeric_limits::max() / 2; } // namespace bys #line 4 "/home/bayashi/dev/byslib/core/types.hpp" #include namespace bys { template struct has_lshift_to_ostream : std::false_type {}; template struct has_lshift_to_ostream() << std::declval())>> : std::true_type {}; template struct has_rshift_from_istream : std::false_type {}; template struct has_rshift_from_istream() >> std::declval())>> : std::true_type {}; template struct has_tuple_interface : std::false_type {}; template struct has_tuple_interface())>> : std::true_type {}; template struct has_iterator : std::false_type {}; template struct has_iterator> : std::true_type {}; struct Int1 {}; } // namespace bys #line 4 "/home/bayashi/dev/byslib/core/printer.hpp" namespace bys { struct Printer { Printer(std::ostream& os_) : os(os_) {} ~Printer() { os << std::flush; } template void cat(T&& v) { if constexpr (has_lshift_to_ostream>::value) { os << v; } else if constexpr (has_iterator>::value) { string sep2; if constexpr (has_iterator::value_type>>::value) { sep2 = _end; } else { sep2 = _sep; } for (auto &&itr = std::begin(v), end = std::end(v); itr != end; ++itr) { cat(*itr); if (std::next(itr) != end) cat(sep2); } } else if constexpr (has_tuple_interface>::value) { print_tuple(std::forward(v), std::make_index_sequence>>()); } else { static_assert([] { return false; }(), "type error"); } } void print() { cat(_end); } template void print(T&& top) { cat(std::forward(top)); cat(_end); } template void print(T&& top, Ts&&... args) { cat(std::forward(top)); cat(_sep); print(std::forward(args)...); } template void operator()(Ts&&... args) { print(std::forward(args)...); } void flush() { os << std::flush; } template void send(Ts&&... args) { print(std::forward(args)...); flush(); } Printer set(string sep_ = " ", string end_ = "\n") { _sep = sep_; _end = end_; return *this; } void lf() { cat(_end); } private: std::ostream& os; std::string _sep = " ", _end = "\n"; template inline void print_tuple_element(T&& elem) { if constexpr (I != 0) cat(_sep); cat(std::forward(elem)); } template inline void print_tuple(Tp&& tp, std::index_sequence) { (print_tuple_element(std::forward(tp))>(std::get(tp))), ...); } }; } // namespace bys #line 4 "/home/bayashi/dev/byslib/core/scanner.hpp" namespace bys { struct Scanner { Scanner(std::istream& is_) : is(is_){}; template void scan(Ts&... args) { (is >> ... >> args); } template decltype(auto) read() { if constexpr (sizeof...(Us) == 0) { if constexpr (has_rshift_from_istream::value) { T res; is >> res; return res; } else if constexpr (has_tuple_interface::value) { auto res = read_tuple(std::make_index_sequence>()); return res; } else if constexpr (std::is_same_v) { int res; is >> res; --res; return res; } else if constexpr (has_iterator::value) { //! TODO: 一行読んでsplit static_assert([] { return false; }(), "NotImplementedError"); } else { static_assert([] { return false; }(), "TypeError"); } } else { return std::tuple{read(), read()...}; } } template , int, T>> std::array read() { std::array res; for (auto&& e : res) e = read(); return res; } template , int, T>> vector readvec(int n) { vector res(n); for (auto&& e : res) e = read(); return res; } template , int, T>> vector> readvec(int n, int m) { vector> res(n); for (auto&& e : res) e = readvec(m); return res; } template , typename T = std::invoke_result_t, std::string>> std::vector readln( Lambda f = [](string x) { return std::stoi(x); }, char sep = ' ') { std::ws(is); std::string elem; std::getline(is, elem); std::stringstream ss{elem}; std::vector res; while (std::getline(ss, elem, sep)) res.emplace_back(f(elem)); return res; } private: std::istream& is; template inline decltype(auto) read_tuple(std::index_sequence) { return Tp{read>()...}; } }; } // namespace bys #line 5 "/home/bayashi/dev/byslib/core/io.hpp" namespace bys { __attribute__((constructor)) void setup_io() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout << std::fixed << std::setprecision(11); std::cerr << std::fixed << std::setprecision(11); std::cerr << std::boolalpha; } Printer print(std::cout), debug(std::cerr); Scanner scanner(std::cin); } // namespace bys #line 2 "/home/bayashi/dev/byslib/core/macro.hpp" // clang-format off #ifdef LOCAL //! @brief デバッグ用出力 ジャッジ上では何もしない。 #define DEBUG(...) { std::cerr << "[debug] line" << std::setw(4) << __LINE__ << ": "; debug(__VA_ARGS__); } #else #define DEBUG(...) #endif //! @brief printしてreturnする。 #define EXIT(...) { print(__VA_ARGS__); return; } #define CONCAT_IMPL(a, b) a##b #define CONCAT(a, b) CONCAT_IMPL(a, b) //! @brief [[maybe_unused]]な変数を生成。 #define UV [[maybe_unused]] auto CONCAT(unused_val_, __LINE__) // clang-format on #line 2 "/home/bayashi/dev/byslib/core/solver.hpp" namespace bys { struct Solver { int IT = 1; Solver() {} void solve(); void solve(int rep) { for (; IT <= rep; ++IT) solve(); } }; } // namespace bys #line 2 "/home/bayashi/dev/byslib/utility/change.hpp" namespace bys { template inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } } // namespace bys #line 2 "/home/bayashi/dev/byslib/utility/range.hpp" namespace bys { //! @brief pythonのrangeと同じ挙動 template struct Range { Range(T start, T stop, T step = 1) : it(start), stop(stop), step(step), dir(step >= 0 ? 1 : -1) {} Range(T stop) : it(0), stop(stop), step(1), dir(1) {} Range begin() const { return *this; } T end() const { return stop; } bool operator!=(const T val) const { return (val - it) * dir > 0; } void operator++() { it += step; } const T& operator*() const { return it; } private: T it; const T stop, step; const int dir; friend Range reversed(const Range& r) { auto new_start = (r.stop - r.dir - r.it) / r.step * r.step + r.it; return {new_start, r.it - r.dir, -r.step}; } }; } // namespace bys #line 4 "test.cpp" namespace bys { void Solver::solve() { scanner.read(); auto as = scanner.readln([](const string& s) { return std::stoll(s); }); if (as.size() != 1) EXIT("\"assert\""); auto a = as[0]; auto [b, c] = scanner.read(); set s{a + b, a + c, b + c}; print(*std::next(s.rbegin())); } } // namespace bys int main() { bys::Solver solver; solver.solve(/* bys::scanner.read() */); return 0; }