PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: raysh07
Tester: sushil2006
Editorialist: iceknight1093
DIFFICULTY:
Cakewalk
PREREQUISITES:
None
PROBLEM:
Chef is trying to buy a Diwali gift for Rs. A, and has a discount coupon worth Rs. B.
How much will Chef have to pay out of his own pocket to cover the cost?
EXPLANATION:
If B \geq A, Chef need not pay anything.
Otherwise, Chef must pay Rs. (A-B) to cover the cost.
This can either be checked using an if condition, or you can combine both cases into the expression
\max(0, A-B)
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (PyPy3)
a, b = map(int, input().split())
print(max(0, a-b))