Problem Description: Maximize Tasty Cookie Consumption
Takahashi has three types of cookies:
A: Untasty cookies containing antidotes
B: Tasty cookies containing antidotes
C: Tasty cookies containing poison
Constraints
Eating a cookie containing poison (type C) results in a stomachache.
If Takahashi eats a cookie containing poison while already having a stomachache, it results in death. Therefore, he cannot eat a cookie in that situation.
Eating a cookie containing antidotes (type A or B) cures any stomachaches.
Given these conditions, your task is to determine the maximum number of tasty cookies (type B and C) that Takahashi can eat without succumbing to a stomachache or death.
Input Format
An integer A (0 ≤ A ≤ 10^9): the number of untasty cookies containing antidotes.
An integer B (0 ≤ B ≤ 10^9): the number of tasty cookies containing antidotes.
An integer C (0 ≤ C ≤ 10^9): the number of tasty cookies containing poison.
Output Format
Output a single integer: the maximum number of tasty cookies Takahashi can eat.
Example Input/Output
Example 1:
text
Input
3 5 2
Output
7
Example 2:
text
Input
0 1 1
Output
1
Example 3:
text
Input
1 2 3
Output
4
Solution
The solution to this problem should be implemented in the /app/ directory. Be sure to account for all constraints and edge cases to correctly determine the maximum number of tasty cookies that can be consumed.
Important: place your implementation at /app/solution.py so the verifier can run it.