hackercupai/hackercup huggingface dataset:
Problem: cheeseburger_corollary_ch1 (2023 practice)

*This problem shares some similarities with A2, with key differences in bold.*

Problem solving skills are applicable to many daily musings. For instance, you might ponder over shared birthdays, bird houses, mapmaking, or ordering an exact number of chicken nuggets. Naturally, another great question to ponder is: how many deckers of a cheeseburger you could build if you spent your entire salary on fast food!

Specifically, you're interested in building a \(K\)-decker cheeseburger, which alternates between buns, cheese, and patty starting and ending with a bun. **You've already bought \(S\) single cheeseburgers and \(D\) double cheeseburgers**. Each provides you with two buns, though a single provides one patty and one cheese, while a double provides two patties and two cheese.

{{PHOTO_ID:1367507087507489|WIDTH:600}}

You'd like to know **whether you can build a \(K\)-decker cheeseburger** with the ingredients from \(S\) single and \(D\) double cheeseburgers.

# Constraints
\(1 \leq T \leq 40\)
\(0 \leq S, D \leq 100\)
\(1 \leq K \leq 100\)

# Input Format

Input begins with an integer \(T\), the number of test cases. Each case contains one line with three space-separated integers, \(S\) and \(D\) and \(K\).

# Output Format

For the \(i\)th test case, print "`Case #i:` " followed by "`YES`" if you have enough ingredients to build a \(K\)-decker cheeseburger, or "`NO`" otherwise.

# Sample Explanation
In the first case, you have one single and one double cheeseburger. In total, you have \(4\) buns, \(3\) slices of cheese, and \(3\) patties. This gives you exactly enough ingredients to build a \(3\)-decker cheeseburger.

In the second case, you have \(4\) buns, but a \(4\)-decker cheeseburger would require \(5\), so you cannot build it.

In the third case, you have plenty of ingredients to build a \(1\)-decker cheeseburger. You'll even have \(4\) single and \(5\) double cheeseburgers left over afterwards.


Sample input:
7
1 1 3
0 2 4
5 5 1
0 1 1
1 1 2
97 1 99
97 1 100


Sample output:
Case #1: YES
Case #2: NO
Case #3: YES
Case #4: YES
Case #5: YES
Case #6: YES
Case #7: NO


Solution: Each single provides \(2\) buns and \(1\) patty. Each double provides \(2\) buns and \(2\) patties. Given \(S\) singles and \(D\) doubles, we will have \(2*(S + D)\) buns and \(S + 2*D\) patties.

A \(K\)-decker happens to require \(K+1\) buns and \(K\) patties. To know if we can build one, it suffices to check that both \(2*(S + D) \ge K + 1\) and \(S + 2*D \ge K\) hold true.



Code: #include <iostream>
using namespace std;

int main() {
  int T;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    cout << "Case #" << t << ": ";
    int S, D, K;
    cin >> S >> D >> K;
    int buns = 2*(S + D);
    int patties = S + 2*D;
    if (buns >= K + 1 && patties >= K) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}