{"problem":{"name":"Fishing","description":{"content":"On a number line, there are $N$ fish swimming. Fish $i$, which has a weight of $W_i$, is at the coordinate $X_i$ at time $0$ and moves at a speed of $V_i$ in the positive direction. Takahashi will cho","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc274_f"},"statements":[{"statement_type":"Markdown","content":"On a number line, there are $N$ fish swimming.\nFish $i$, which has a weight of $W_i$, is at the coordinate $X_i$ at time $0$ and moves at a speed of $V_i$ in the positive direction.\nTakahashi will choose an arbitrary real number $t$ greater than or equal to $0$ and do the following action at time $t$ just once.  \nAction: Choose an arbitrary real number $x$. Catch all fish whose coordinates are between $x$ and $x+A$, inclusive.\nFind the maximum total weight of fish that he can catch.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2000$\n*   $1 \\leq A \\leq 10^4$\n*   $1 \\leq W_i\\leq 10^4$\n*   $0 \\leq X_i\\leq 10^4$\n*   $1 \\leq V_i\\leq 10^4$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $A$\n$W_1$ $X_1$ $V_1$\n$W_2$ $X_2$ $V_2$\n$\\vdots$\n$W_N$ $X_N$ $V_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc274_f","tags":[],"sample_group":[["3 10\n100 0 100\n1 10 30\n10 20 10","111\n\nAt time $0.25$, fish $1$, $2$, and $3$ are at the coordinates $25$, $17.5$, and $22.5$, respectively. Thus, the action done at this time with $x=16$ catches all the fish."],["3 10\n100 100 100\n1 10 30\n10 20 10","100\n\nOne optimal choice is to do the action at time $0$ with $x=100$."],["4 10\n1000 100 10\n100 99 1\n10 0 100\n1 1 1","1110\n\nOne optimal choice is to do the action at time $1$ with $x=100$."]],"created_at":"2026-03-03 11:01:14"}}