{"trustable":true,"sections":[{"title":"Background","value":{"format":"MD","content":"The fleeting time will not blur my memory of you. It\u0027s hard to believe that it has been 3 years since I first saw you. I still vividly remember, 3 years ago, at the beautiful Jimei Middle School, when I saw you smiling as you walked out of the classroom, tilting your head back, the soft sunset shining on your rosy cheeks. I understood, I was already infatuated with you. After a few months of observation and peeking, your elegance and wisdom, your attitude towards life and your aspirations for the future deeply impressed me. You are a charming sunshine girl, and I always dream of sharing my life with you. Alas, in reality, you far exceed my wildest dreams. I don\u0027t know how to bridge the gap between you and me. So I have no plan, just waiting, waiting for a suitable opportunity to come. Until now, with graduation approaching, I realize I have been a fool, I should create opportunities and seize them instead of just waiting.\n\n\nDuring these days, I have been saying goodbye to my friends, roommates, and classmates one by one. I still can\u0027t believe that after waving goodbye, these familiar faces will soon disappear from our lives, leaving only memories. I will leave school tomorrow. You have plans to go far and pursue your future, to fulfill your dreams. If it weren\u0027t for fate, perhaps we would never meet again. So tonight, I am wandering below your dormitory, hoping to accidentally meet you. But the contradiction is, your beauty will surely make my heart beat faster, and my clumsy tongue may not be able to utter a word. I don\u0027t remember how many times I have passed by your dormitory, each time hoping to see you appear on the balcony or window sill. I don\u0027t remember how many times this thought has surged in my mind: to call you for dinner or chat. But every time, considering your excellence and my mediocrity, cowardice outweighs courage and drives me to leave quietly.\n\n\nGraduation means the end of high school life. These glorious and romantic times come to an end. Your lovely smile was the motivation for my hard work in studying, and this unrequited love will be sealed as a memory deep in my heart. Graduation also means the beginning of a new life, a footprint towards a bright future. I truly hope you will be happy every day abroad, and everything goes smoothly. At the same time, I will strive to grow out of immaturity and become more mature. My ideal is to pursue my love and happiness in reality, and I will never give up.\n\n\nFarewell, my princess!\n\n\nIf one day, at some corner of the world, we have the chance to meet again, even if we are old and gray, I hope we can proudly share this memory, relive the passion of our youth. If this opportunity never comes, I hope I am a star in the sky, twinkling outside your window. Blessing you from afar, like a friend, accompanying you every night, sharing sweet dreams or experiencing terrible nightmares together."}},{"title":"Description","value":{"format":"MD","content":"Now the problem is here: The sky can be understood as a number line, with many stars distributed on this number line, each star having its position $X_i$ and its brightness $B_i$. **Multiple stars can be at the same position**. The range that the window can see is a given parameter $W$, and the stars we see also include the stars at the window edges. Now, you are required to calculate the maximum sum of brightness of stars that can be seen after adjusting the window position."}},{"title":"Input","value":{"format":"MD","content":"One line $N,W$, representing the number of stars and the width of the window.\n\nThe next $N$ lines, input $X_i$ and $B_i$, representing the coordinates and brightness of the stars."}},{"title":"Output","value":{"format":"MD","content":"A number, representing the maximum sum of brightness of stars that can be seen."}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6 3\n1 2\n2 4\n3 8\n4 4\n5 2\n1000 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e16\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"Example explanation:\n\n\n ![](CDN_BASE_URL/f560b503cadc4fb8bfc8b55c10188948?v\u003d1720359668) \n\nFor data of $10\\%$, $W\u003d0$ (without edges);\n\nFor data of $40\\%$, $W\\leq 1000$;\n\nFor data of $100\\%$, $1 \\leq N\\leq 10 ^ 5$, $0 \\leq W\\leq 10 ^ 5$, $1 \\leq X_i\\leq 10 ^ 5$, $1\\leq B_i\\leq 100$.\n\nExcept for the case of $W\u003d0$, $W$ are all odd numbers of $\\geq 3$."}}]}