{"problem":{"name":"Examination","description":{"content":"$N$ students, numbered $1,2,\\ldots,N$, took an examination. Student $i\\,(1 \\leq i \\leq N)$ had to score at least $B_i$ points to graduate, where they actually scored $A_i$ points. You can repeat the f","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc147_e"},"statements":[{"statement_type":"Markdown","content":"$N$ students, numbered $1,2,\\ldots,N$, took an examination. Student $i\\,(1 \\leq i \\leq N)$ had to score at least $B_i$ points to graduate, where they actually scored $A_i$ points.\nYou can repeat the following operation any number of times (possibly zero):\n\n*   Choose two students, and swap their scores.\n\nYour goal is to make everyone graduate. Determine whether it is possible. If it is possible, find the maximum number of students whose scores do not change during the process.\n\n## Constraints\n\n*   $2 \\leq N \\leq 3 \\times 10^5$\n*   $1 \\leq A_i,B_i \\leq 10^9\\,(1 \\leq i \\leq N)$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\vdots$\n$A_N$ $B_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc147_e","tags":[],"sample_group":[["3\n1 2\n3 1\n3 3","1\n\nIf you swap scores of Student $1$ and $2$, everyone can graduate. Here, the number of students whose scores do not change is $1$ (only Student $3$)."],["2\n100 1\n100 1","2"],["6\n3 2\n1 6\n4 5\n1 3\n5 5\n9 8","\\-1"],["6\n3 1\n4 5\n5 2\n2 3\n5 4\n5 1","3"]],"created_at":"2026-03-03 11:01:13"}}