A student is taking a multiple-choice quiz with $N$ questions. To discourage guessing, the teacher uses a strict grading system:
- For every question answered correctly, the student earns $2$ points.
- For every question answered incorrectly, the student loses $1$ point.
- The final score can never be negative: the lowest possible score is $0$ points.
The student answers every single question on the quiz, and answers $C$ of them correctly. Calculate the student's final score.
Input
The first line contains one integer $N$, the total number of questions on the quiz.
The second line contains one integer $C$, the number of questions answered correctly.
Output
Print a single integer, the student's final score.
Constraints
For all cases, $1 \le N \le 100$ and $0 \le C \le N$.
Sample Test Cases
| Input | Output | |
|---|---|---|
| 10 7 |
11 | |
| The student earns $7 \times 2 = 14$ points and loses $3 \times 1 = 3$ points, so the final score is $14 - 3 = 11$. | ||
| 10 2 |
0 | |
| The student earns $2 \times 2 = 4$ points and loses $8 \times 1 = 8$ points. Since $4 - 8 = -4$ is negative, the final score is $0$. | ||
| 5 5 |
10 | |
Scoring: Per Case
Authored by hclee and s17r28
Appeared in 2026 Wah Yan Interschool Olympiad in Informatics 🤯🥷⚡🧠🏆