prithivMLmods/Coder-Stat
Coder-Stat Dataset Overview The Coder-Stat dataset is a collection of programming-related data, including problem IDs, programming languages, original statuses, and source code snippets. This dataset is designed to assist in the analysis of coding patterns, error types, and performance metrics. Dataset Details Modalities Tabular: The dataset is structured in a tabular format. Text: Contains text data, including source code snippets.… See the full description on the dataset page: https://huggingface.co/datasets/prithivMLmods/Coder-Stat.
3139
1 2 3<h1>Problem B: Spellcasters</h1>4<p>5n 人の魔法使いがいる。彼らには 1 から n までの番号があり、i 番目の魔法使いは魔力 r<sub>i</sub> ( 1 ≤ i ≤ n ) を持っている。いま彼らは強力な魔法使いと対峙しており、その敵の魔力は S である。n 人の魔法使いは協力して戦うのが得意で、特に 2 人で協力して戦うことを好む。2 人の魔法使いが協力した場合、魔力は単純にその和となり、強力な魔法などを駆使してある程度強い敵にも勝てるようになる。あなたの仕事は魔力 S を持つ敵に対して勝つことができる魔法使いのペア (i, j) ( i ≠ j かつ 1 ≤ i ≤ n かつ 1 ≤ j ≤ n ) の総数を出力することである。ただし (i, j) と (j, i) は同じ組として数える。一方の魔力が他方の魔力よりも大きいとき、大きい魔力を持っている側が勝つ。等しい場合は相打ちで勝ったことにならない。6</p>7<h2>Input</h2>8<p>9入力は複数のテストケースからなる。 各テストケースは以下の形式に従う。10</p>11<pre>12n S13r<sub>1</sub>14r<sub>2</sub>15…16r<sub>n</sub>17</pre>18<p>19各変数の意味は問題文中の通りである。20入力の終わりは、ふたつの0が一文字の空白で区切られる一行で示される。21</p>22 23<h2>Constraints</h2>24<ul>25<li>入力はすべて整数</li>26<li>1 ≤ n ≤ 20,000</li>27<li>1 ≤ r<sub>i</sub> ≤ 100 ( 1 ≤ i ≤ n )</li>28<li>1 ≤ S ≤ 100</li>29<li>テストケースの数は 100 を超えない。</li>30</ul>31 32<h2>Output</h2>33<p>34条件を満たす組 (i, j) (i ≠ j) の総数を各ケースに付き 1 行に出力せよ。35</p>36<h2>Sample Input</h2>37<pre>383 73914034110420 043</pre>44<h2>Sample Output</h2>45<pre>46247</pre>