#include <iostream>

class Counter {
    int limit_;
    int used_{0};

public:
    explicit Counter(int limit) : limit_{limit} {
    }

    int used() const {
        return used_;
    }

    bool try_add(int amount) {
        if (amount < 0) {
            return false;
        }
        if (amount > limit_) {
            return false;
        }
        used_ = used_ + amount;
        return true;
    }
};

int main() {
    Counter counter{10};
    bool first{counter.try_add(6)};
    bool second{counter.try_add(5)};
    std::cout << first << ' ' << second << ' ' << counter.used() << '\n';
    return 0;
}
