{"raw_statement":[{"iden":"statement","content":"Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on the crust, and he does not really like the crust.\n\nThe pizza is a circle of radius _r_ and center at the origin. Pizza consists of the main part — circle of radius _r_ - _d_ with center at the origin, and crust around the main part of the width _d_. Pieces of sausage are also circles. The radius of the _i_ -th piece of the sausage is _r__i_, and the center is given as a pair (_x__i_, _y__i_).\n\nGleb asks you to help determine the number of pieces of sausage caught on the crust. A piece of sausage got on the crust, if it completely lies on the crust."},{"iden":"input","content":"First string contains two integer numbers _r_ and _d_ (0 ≤ _d_ < _r_ ≤ 500) — the radius of pizza and the width of crust.\n\nNext line contains one integer number _n_ — the number of pieces of sausage (1 ≤ _n_ ≤ 105).\n\nEach of next _n_ lines contains three integer numbers _x__i_, _y__i_ and _r__i_ ( - 500 ≤ _x__i_, _y__i_ ≤ 500, 0 ≤ _r__i_ ≤ 500), where _x__i_ and _y__i_ are coordinates of the center of _i_\\-th peace of sausage, _r__i_ — radius of _i_\\-th peace of sausage."},{"iden":"output","content":"Output the number of pieces of sausage that lay on the crust."},{"iden":"examples","content":"Input\n\n8 4\n7\n7 8 1\n-7 3 2\n0 2 1\n0 -2 2\n-3 -3 1\n0 6 2\n5 3 1\n\nOutput\n\n2\n\nInput\n\n10 8\n4\n0 0 9\n0 0 10\n1 0 1\n1 0 2\n\nOutput\n\n0"},{"iden":"note","content":"Below is a picture explaining the first example. Circles of green color denote pieces of sausage lying on the crust.\n\n<center>![image](https://espresso.codeforces.com/f81223a0b6c596bd36f93cf97967395194e23ccd.png)</center>"}],"translated_statement":[{"iden":"statement","content":"Gleb 订了一份披萨。当快递员送达时，他非常沮丧，因为有几块香肠落在了饼皮上，而他并不喜欢饼皮。\n\n披萨是一个以原点为中心、半径为 $r$ 的圆。披萨由两部分组成：主部分——一个以原点为中心、半径为 $r - d$ 的圆，以及围绕主部分、宽度为 $d$ 的饼皮。香肠块也是圆形的。第 $i$ 块香肠的半径为 $r_i$，其中心坐标为 $(x_i, y_i)$。\n\nGleb 请你帮助确定有多少块香肠完全落在饼皮上。一块香肠落在饼皮上，当且仅当它完全位于饼皮区域内。\n\n第一行包含两个整数 $r$ 和 $d$ ($0 ≤ d < r ≤ 500$) —— 披萨的半径和饼皮的宽度。\n\n接下来一行包含一个整数 $n$ —— 香肠块的数量 ($1 ≤ n ≤ 10^5$)。\n\n接下来的 $n$ 行，每行包含三个整数 $x_i$, $y_i$ 和 $r_i$ ($-500 ≤ x_i, y_i ≤ 500$, $0 ≤ r_i ≤ 500$)，其中 $x_i$ 和 $y_i$ 是第 $i$ 块香肠的中心坐标，$r_i$ 是第 $i$ 块香肠的半径。\n\n请输出落在饼皮上的香肠块的数量。\n\n下图解释了第一个示例。绿色的圆表示位于饼皮上的香肠块。"},{"iden":"input","content":"第一行包含两个整数 $r$ 和 $d$ ($0 ≤ d < r ≤ 500$) —— 披萨的半径和饼皮的宽度。接下来一行包含一个整数 $n$ —— 香肠块的数量 ($1 ≤ n ≤ 10^5$)。每行接下来的 $n$ 行包含三个整数 $x_i$, $y_i$ 和 $r_i$ ($-500 ≤ x_i, y_i ≤ 500$, $0 ≤ r_i ≤ 500$)，其中 $x_i$ 和 $y_i$ 是第 $i$ 块香肠的中心坐标，$r_i$ 是第 $i$ 块香肠的半径。"},{"iden":"output","content":"请输出落在饼皮上的香肠块的数量。"},{"iden":"examples","content":"输入8 477 8 1-7 3 20 2 10 -2 2-3 -3 10 6 25 3 1输出2输入10 840 0 90 0 101 0 11 0 2输出0"},{"iden":"note","content":"下图解释了第一个示例。绿色的圆表示位于饼皮上的香肠块。  "}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ r \\in \\mathbb{R}_{\\geq 0} $ be the radius of the pizza.  \nLet $ d \\in \\mathbb{R}_{\\geq 0} $ be the width of the crust, with $ 0 \\leq d < r $.  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of sausage pieces.  \nFor each $ i \\in \\{1, \\dots, n\\} $, let $ (x_i, y_i) \\in \\mathbb{R}^2 $ be the center and $ r_i \\in \\mathbb{R}_{\\geq 0} $ be the radius of the $ i $-th sausage piece.\n\n**Constraints**  \n1. $ 0 \\leq d < r \\leq 500 $  \n2. $ 1 \\leq n \\leq 10^5 $  \n3. $ -500 \\leq x_i, y_i \\leq 500 $  \n4. $ 0 \\leq r_i \\leq 500 $\n\n**Objective**  \nCount the number of sausage pieces $ i $ such that the entire sausage circle lies **completely on the crust**, i.e.,  \n$$\nr - d \\leq \\sqrt{x_i^2 + y_i^2} - r_i \\quad \\text{and} \\quad \\sqrt{x_i^2 + y_i^2} + r_i \\leq r\n$$  \nEquivalently:  \n$$\nr - d + r_i \\leq \\sqrt{x_i^2 + y_i^2} \\leq r - r_i\n$$  \n(Note: The sausage lies entirely on the crust if it does not overlap the inner circle and does not extend beyond the outer pizza boundary.)","simple_statement":null,"has_page_source":false}