/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author Egor Kulikov */ #include #include #ifndef JHELPER_EXAMPLE_PROJECT_INPUT_H #define JHELPER_EXAMPLE_PROJECT_INPUT_H // // Created by egor on 30.10.2019. // #ifndef JHELPER_EXAMPLE_PROJECT_GENERAL_H #define JHELPER_EXAMPLE_PROJECT_GENERAL_H #include using namespace std; #define all(v) (v).begin(), (v).end() typedef long long ll; typedef vector vi; typedef pair pii; const int MAX_INT = 2147483647; const double PI = atan(1) * 4; const int DX_KNIGHT[] = {2, 1, -1, -2, -2, -1, 1, 2}; const int DY_KNIGHT[] = {1, 2, 2, 1, -1, -2, -2, -1}; const int DX4[] = {1, 0, -1, 0}; const int DY4[] = {0, 1, 0, -1}; bool isValidCell(int x, int y, int rows, int cols) { return x >= 0 && y >= 0 && x < rows && y < cols; } void decreaseByOne() { } template void decreaseByOne(vector& arr, Vargs&...arrs) { for (int& i : arr) { i--; } decreaseByOne(arrs...); } template T minim(T& was, T cand) { return was = min(was, cand); } template T maxim(T& was, T cand) { return was = max(was, cand); } inline int bitCount(int number) { return __builtin_popcount(number); } inline int bitCount(ll number) { return __builtin_popcount(number); } #endif //JHELPER_EXAMPLE_PROJECT_GENERAL_H class Input { public: enum ErrorType { OK, END_OF_FILE, UNEXPECTED_SYMBOL, INVALID_CALL }; private: istream& in; bool exhausted = false; ErrorType error = OK; int get(); template T readInteger(); int skipWhitespace(); public: Input(istream& in); int readInt(); ll readLong(); string readString(); vector readIntArray(int size); template T readType(); template pair readType(); template vector readArray(int size); template tuple, vector > readArrays(int size); template tuple, vector, vector > readArrays(int size); template tuple, vector, vector, vector > readArrays(int size); template tuple, vector, vector, vector, vector > readArrays(int size); template vector > readTable(int rows, int cols); string readLine(); }; inline bool isWhitespace(int c) { return isspace(c) || c == EOF; } int Input::skipWhitespace() { int c; do { c = get(); if (exhausted) { error = END_OF_FILE; return c; } } while (isWhitespace(c)); return c; } Input::Input(std::istream &in) : in(in) { } inline int Input::get() { int result = in.get(); if (result == EOF) { exhausted = true; } return result; } template T Input::readType() { error = INVALID_CALL; return nullptr; } template T Input::readInteger() { error = OK; int c = skipWhitespace(); if (error != OK) { return 0; } int sgn = 1; if (c == '-') { sgn = -1; c = get(); } T res = 0; do { if (!isdigit(c)) { error = UNEXPECTED_SYMBOL; return 0; } res *= 10; res += c - '0'; c = get(); } while (!isWhitespace(c)); return res * sgn; } template<> int Input::readType() { return readInteger(); } template<> ll Input::readType() { return readInteger(); } template<> char Input::readType() { error = OK; int c = skipWhitespace(); if (error != OK) { return 0; } return c; } template<> string Input::readType() { error = OK; int c = skipWhitespace(); if (error != OK) { return ""; } vector res; do { if (error != OK) { return ""; } res.push_back(c); } while (!isWhitespace(c = get())); return string(res.begin(), res.end()); } inline int Input::readInt() { return readType(); } inline ll Input::readLong() { return readType(); } template vector Input::readArray(int size) { vector res; res.reserve(size); for (int i = 0; i < size; i++) { res.push_back(readType()); if (error != OK) { res.clear(); return res; } } return res; } vector Input::readIntArray(int size) { return readArray(size); } template tuple, vector > Input::readArrays(int size) { vector v1; vector v2; v1.reserve(size); v2.reserve(size); for (int i = 0; i < size; ++i) { v1.push_back(readType()); v2.push_back(readType()); } return make_tuple(v1, v2); } string Input::readString() { return readType(); } template vector> Input::readTable(int rows, int cols) { vector > result; result.reserve(rows); for (int i = 0; i < rows; ++i) { result.push_back(readArray(cols)); } return result; } string Input::readLine() { error = OK; int c = skipWhitespace(); if (error != OK) { return ""; } int length = 0; vector res; do { if (error != OK) { return ""; } res.push_back(c); if (!isWhitespace(c)) { length = res.size(); } c = get(); } while (c != '\n' && c != '\r' && c != EOF); return string(res.begin(), res.begin() + length); } template tuple, vector, vector > Input::readArrays(int size) { vector v1; vector v2; vector v3; v1.reserve(size); v2.reserve(size); v3.reserve(size); for (int i = 0; i < size; ++i) { v1.push_back(readType()); v2.push_back(readType()); v3.push_back(readType()); } return make_tuple(v1, v2, v3); } template tuple, vector, vector, vector > Input::readArrays(int size) { vector v1; vector v2; vector v3; vector v4; v1.reserve(size); v2.reserve(size); v3.reserve(size); v4.reserve(size); for (int i = 0; i < size; ++i) { v1.push_back(readType()); v2.push_back(readType()); v3.push_back(readType()); v4.push_back(readType()); } return make_tuple(v1, v2, v3, v4); } template tuple, vector, vector, vector, vector > Input::readArrays(int size) { vector v1; vector v2; vector v3; vector v4; vector v5; v1.reserve(size); v2.reserve(size); v3.reserve(size); v4.reserve(size); v5.reserve(size); for (int i = 0; i < size; ++i) { v1.push_back(readType()); v2.push_back(readType()); v3.push_back(readType()); v4.push_back(readType()); v5.push_back(readType()); } return make_tuple(v1, v2, v3, v4, v5); } #endif //JHELPER_EXAMPLE_PROJECT_INPUT_H // // Created by egor on 31.10.2019. // #ifndef JHELPER_EXAMPLE_PROJECT_OUTPUT_H #define JHELPER_EXAMPLE_PROJECT_OUTPUT_H class Output { private: ostream& out; template void printSingle(const T& value); template void printSingle(const vector& value); template void printSingle(const pair& value); public: Output(ostream& out); void print(); templatevoid print(const T& first, const Targs... args); templatevoid printLine(const Targs... args); void flush(); }; Output::Output(ostream &out) : out(out) { out << setprecision(12); } void Output::print() { } template void Output::print(const T& first, const Targs... args) { printSingle(first); if (sizeof...(args) != 0) { out << ' '; print(args...); } } template void Output::printSingle(const T& value) { out << value; } template void Output::printLine(const Targs... args) { print(args...); out << '\n'; } void Output::flush() { out.flush(); } template void Output::printSingle(const vector& array) { unsigned int size = array.size(); for (int i = 0; i < size; ++i) { out << array[i]; if (i + 1 != size) { out << ' '; } } } template void Output::printSingle(const pair& value) { out << value.first << ' ' << value.second; } #endif //JHELPER_EXAMPLE_PROJECT_OUTPUT_H class a { public: void solve(istream& inp, ostream& outp) { Input in(inp); Output out(outp); int x = in.readInt(); int y = in.readInt(); int z = in.readInt(); if (x >= y + z) { out.printLine(y + z); } else if (y >= x + z) { out.printLine(x + z); } else { out.printLine((x + y + z) / 2); } } }; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); a solver; std::istream& in(std::cin); std::ostream& out(std::cout); solver.solve(in, out); return 0; }