{"problem":{"name":"C. Really Big Numbers","description":{"content":"Ivan likes to learn different things about numbers, but he is especially interested in _really big_ numbers. Ivan thinks that a positive integer number _x_ is _really big_ if the difference between _x","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF817C"},"statements":[{"statement_type":"Markdown","content":"Ivan likes to learn different things about numbers, but he is especially interested in _really big_ numbers. Ivan thinks that a positive integer number _x_ is _really big_ if the difference between _x_ and the sum of its digits (in decimal representation) is not less than _s_. To prove that these numbers may have different special properties, he wants to know how rare (or not rare) they are — in fact, he needs to calculate the quantity of _really big_ numbers that are not greater than _n_.\n\nIvan tried to do the calculations himself, but soon realized that it's too difficult for him. So he asked you to help him in calculations.\n\n## Input\n\nThe first (and the only) line contains two integers _n_ and _s_ (1 ≤ _n_, _s_ ≤ 1018).\n\n## Output\n\nPrint one integer — the quantity of _really big_ numbers that are not greater than _n_.\n\n[samples]\n\n## Note\n\nIn the first example numbers 10, 11 and 12 are _really big_.\n\nIn the second example there are no _really big_ numbers that are not greater than 25 (in fact, the first _really big_ number is 30: 30 - 3 ≥ 20).\n\nIn the third example 10 is the only _really big_ number (10 - 1 ≥ 9).","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"Ivan 喜欢学习关于数字的各种知识，但他尤其对 _真正大_ 的数字感兴趣。Ivan 认为一个正整数 #cf_span[x] 是 _真正大_ 的，当且仅当 #cf_span[x] 与其各位数字之和（十进制表示）的差不小于 #cf_span[s]。为了证明这类数字可能具有不同的特殊性质，他需要知道这类数字有多稀有（或不稀有）——实际上，他需要计算不超过 #cf_span[n] 的 _真正大_ 数字的数量。\n\nIvan 试图自己进行计算，但很快意识到这对他来说太难了。因此他请求你帮助他进行计算。\n\n第一行（也是唯一一行）包含两个整数 #cf_span[n] 和 #cf_span[s]（#cf_span[1 ≤ n, s ≤ 1018]）。\n\n请输出一个整数——不超过 #cf_span[n] 的 _真正大_ 数字的数量。\n\n在第一个例子中，数字 #cf_span[10]、#cf_span[11] 和 #cf_span[12] 是 _真正大_ 的。\n\n在第二个例子中，没有不超过 #cf_span[25] 的 _真正大_ 数字（事实上，第一个 _真正大_ 数字是 #cf_span[30]：#cf_span[30 - 3 ≥ 20]）。\n\n在第三个例子中，#cf_span[10] 是唯一的 _真正大_ 数字（#cf_span[10 - 1 ≥ 9]）。\n\n## Input\n\n第一行（也是唯一一行）包含两个整数 #cf_span[n] 和 #cf_span[s]（#cf_span[1 ≤ n, s ≤ 1018]）。\n\n## Output\n\n请输出一个整数——不超过 #cf_span[n] 的 _真正大_ 数字的数量。\n\n[samples]\n\n## Note\n\n在第一个例子中，数字 #cf_span[10]、#cf_span[11] 和 #cf_span[12] 是 _真正大_ 的。在第二个例子中，没有不超过 #cf_span[25] 的 _真正大_ 数字（事实上，第一个 _真正大_ 数字是 #cf_span[30]：#cf_span[30 - 3 ≥ 20]）。在第三个例子中，#cf_span[10] 是唯一的 _真正大_ 数字（#cf_span[10 - 1 ≥ 9]）。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n, s \\in \\mathbb{Z}^+ $ with $ 1 \\leq n, s \\leq 10^{18} $.  \nFor a positive integer $ x $, let $ d(x) $ denote the sum of its decimal digits.  \n\n**Constraint**  \nA positive integer $ x $ is *really big* if:  \n$$\nx - d(x) \\geq s\n$$\n\n**Objective**  \nCompute the quantity of integers $ x $ such that:  \n$$\n1 \\leq x \\leq n \\quad \\text{and} \\quad x - d(x) \\geq s\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF817C","tags":["binary search","brute force","dp","math"],"sample_group":[["12 1","3"],["25 20","0"],["10 9","1"]],"created_at":"2026-03-03 11:00:39"}}