diff --git a/codeforces/cf2044c_hard_problem.cpp b/codeforces/cf2044c_hard_problem.cpp new file mode 100644 index 0000000..b80ad10 --- /dev/null +++ b/codeforces/cf2044c_hard_problem.cpp @@ -0,0 +1,26 @@ +// Vicfred +// https://codeforces.com/contest/2044/problem/C +// implementation +#include +#include + +using namespace std; + +int main() { + int t; + cin >> t; + while (t--) { + long long m, a, b, c; + cin >> m >> a >> b >> c; + long long ans = 0LL; + long long seats = 2LL * m; + long long remaining = 0LL; + ans += min(m, a); + remaining += m - min(m, a); + ans += min(m, b); + remaining += m - min(m, b); + ans += min(remaining, c); + cout << ans << endl; + } + return 0; +}