Official algorithmic problem description and constraints.
One of the first programming problems by K1o0n looked like this: "Noobish_Monk has π (1β€πβ€100) friends. Each of them gave him π (1β€πβ€10000) apples for his birthday. Delighted with such a gift, Noobish_Monk returned π (1β€πβ€min(10000,πβ π)) apples to his friends. How many apples are left with Noobish_Monk?"
K1o0n wrote a solution, but accidentally considered the value of π as a string, so the value of πβ πβπ was calculated differently. Specifically:
Learning about this, ErnKor became interested in how many pairs (π,π) exist for a given π, satisfying the constraints of the problem, on which K1o0n's solution gives the correct answer.
"The solution gives the correct answer" means that it outputs a non-empty string, and this string, when converted to an integer, equals the correct answer, i.e., the value of πβ πβπ.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.