{"raw_statement":[{"iden":"problem statement","content":"There are $N$ one-off jobs available. If you take the $i$\\-th job and complete it, you will earn the reward of $B_i$ after $A_i$ days from the day you do it.\nYou can take and complete at most one of these jobs in a day.\nHowever, you cannot retake a job that you have already done.\nFind the maximum total reward that you can earn no later than $M$ days from today.\nYou can already start working today."},{"iden":"constraints","content":"*   All values in input are integers.\n*   $1 \\leq N \\leq 10^5$\n*   $1 \\leq M \\leq 10^5$\n*   $1 \\leq A_i \\leq 10^5$\n*   $1 \\leq B_i \\leq 10^4$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\vdots$\n$A_N$ $B_N$"},{"iden":"sample input 1","content":"3 4\n4 3\n4 1\n2 2"},{"iden":"sample output 1","content":"5\n\nYou can earn the total reward of $5$ by taking the jobs as follows:\n\n*   Take and complete the first job today. You will earn the reward of $3$ after four days from today.\n*   Take and complete the third job tomorrow. You will earn the reward of $2$ after two days from tomorrow, that is, after three days from today."},{"iden":"sample input 2","content":"5 3\n1 2\n1 3\n1 4\n2 1\n2 3"},{"iden":"sample output 2","content":"10"},{"iden":"sample input 3","content":"1 1\n2 1"},{"iden":"sample output 3","content":"0"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}