{"problem":{"name":"AtCoder Alloy","description":{"content":"There are $N$ rectangular plate materials made of special metal called AtCoder Alloy. The dimensions of the $i$\\-th material are $A_i \\times B_i$ ($A_i$ vertically and $B_i$ horizontally). Takahashi w","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"caddi2018b_b"},"statements":[{"statement_type":"Markdown","content":"There are $N$ rectangular plate materials made of special metal called AtCoder Alloy. The dimensions of the $i$\\-th material are $A_i \\times B_i$ ($A_i$ vertically and $B_i$ horizontally).\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly $H \\times W$. He is trying to obtain such a plate by choosing one of the $N$ materials and cutting it if necessary. When cutting a material, the cuts must be parallel to one of the sides of the material. Also, the materials have fixed directions and cannot be rotated. For example, a $5 \\times 3$ material cannot be used as a $3 \\times 5$ plate.\nOut of the $N$ materials, how many can produce an $H \\times W$ plate if properly cut?\n\n## Constraints\n\n*   $1 \\leq N \\leq 1000$\n*   $1 \\leq H \\leq 10^9$\n*   $1 \\leq W \\leq 10^9$\n*   $1 \\leq A_i \\leq 10^9$\n*   $1 \\leq B_i \\leq 10^9$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $H$ $W$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$:$\n$A_N$ $B_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"caddi2018b_b","tags":[],"sample_group":[["3 5 2\n10 3\n5 2\n2 5","2\n\nTakahashi wants a $5 \\times 2$ plate.\n\n*   The dimensions of the first material are $10 \\times 3$. We can obtain a $5 \\times 2$ plate by properly cutting it.\n*   The dimensions of the second material are $5 \\times 2$. We can obtain a $5 \\times 2$ plate without cutting it.\n*   The dimensions of the third material are $2 \\times 5$. We cannot obtain a $5 \\times 2$ plate, whatever cuts are made. Note that the material cannot be rotated and used as a $5 \\times 2$ plate."],["10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268","8"]],"created_at":"2026-03-03 11:01:14"}}