question stringlengths 716 2.93k | options listlengths 4 8 | answer stringclasses 8
values | id stringlengths 24 24 | source_question_id stringlengths 30 30 | num_choices int64 4 8 |
|---|---|---|---|---|---|
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"circles.append((-r, idx))\ncircles.sort()\nselected = [circle[1] for circle in circles[-k:]]",
"circles.append((r * r, idx))\ncircles.sort()\nselected = [circle[1] for circle in circles[:k]]",
"circles.append((-r, idx))\ncircles.sort(reverse=True)\nselected = [circle[1] for circle in circles[:k]]",
"circles.... | D | code-272411-6ddfc9406b0c | code-question-92ea54979a348d36 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"comb = fact[M] * inv_fact[K] % MOD\ncomb = comb * inv_fact[M - K] % MOD\nans = comb * fact[E] % MOD\nans = ans * fact[O] % MOD\nprint(ans)",
"comb = fact[M] * inv_fact[X] % MOD\ncomb = comb * inv_fact[M - X] % MOD\nans = comb * fact[E] % MOD\nans = ans * fact[O] % MOD\nprint(ans)",
"comb = fact[M] * inv_fact[X... | B | code-069498-008d954fecaa | code-question-15f5fb07195e5eb5 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if task in seen:\n seen.remove(task)\n if len(dq) > k:\n old_task = dq.pop()\n seen.discard(old_task)\n dq.appendleft(task)",
"if task not in seen and len(dq) >= k:\n dq.popleft()\n if task not in seen:\n dq.appendleft(task)\n see... | E | code-194204-1ec6a36dfa0e | code-question-c765aba4156836db | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"x = rem - b\n idx = bisect.bisect_left(s_list, x) - 1\n if idx >= 0:\n c = s_list[idx]\n sum_bc = b + c\n if sum_bc > current_max:\n current_max = sum_bc",
"x = rem - b\n idx = bisect.bisect_left(s_list, x)\n ... | C | code-231570-ee670eadb767 | code-question-b0c17a01304f0559 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for i in range(n):\n flipped = 1 - int(s[i])\n current = 1\n if i > 0 and int(s[i-1]) != flipped:\n current += left[i-1]\n if i < n-1 and int(s[i+1]) != flipped:\n current += right[i+1]\n if current > max_len:\n max_len = current",
"for i in range(n):\n flipped = 1 - int(s[... | A | code-063932-407f8c59b02e | code-question-230ab0f4dc304acf | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"prefix = [0]\n total = 0\n for delta in deltas:\n total -= delta\n prefix.append(total)\n idx = bisect.bisect_right(times, time)\n print(prefix[idx])",
"prefix = [0]\n current = 0\n for delta in deltas:\n current += delta\n prefix.append(current)\n idx = bisect.bi... | D | code-134940-7f1cdd2c0bca | code-question-f5cfccf3ce979ed6 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for i in range(2, sqrt_n + 1):\n if n % i == 0:\n sum_div += i\n other = n // i\n if other != i:\n sum_div += other",
"for i in range(2, sqrt_n + 1):\n if i % n == 0:\n sum_div += i\n other = n // i\n if other != i:\n ... | A | code-268636-ab3a9eef4a16 | code-question-44d6b4549c4fc984 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for i in range(1, n):\n if a[i] < a[i + 1]:\n current += 1\n else:\n current = 1\n if current > max_len:\n max_len = current",
"for i in range(1, n):\n if a[i] < a[i - 1]:\n current = 2\n else:\n current = 1\n if current > max_len:\n max_len = current",... | C | code-014791-13a55389b875 | code-question-d876c135e706c7d3 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if n <= m:\n starting = 'R'\n other = 'B'\nelse:\n starting = 'B'\n other = 'R'",
"if n > m:\n starting = 'B'\n other = 'R'\nelse:\n starting = 'R'\n other = 'B'",
"if n < m:\n starting = 'R'\n other = 'B'\nelse:\n starting = 'B'\n other = 'R'",
"if m > n:\n starting = ... | F | code-231952-ca7e49958661 | code-question-1c7201065b42c76c | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"current = a\n while current <= r:\n if current >= l:\n count += 1\n if current > r // 3:\n break\n current *= 5",
"current = 1\n while current * a <= r:\n if current * a > l:\n count += 1\n if current >= r // 5:\n break\n ... | D | code-070232-0c2e59495bc2 | code-question-1781ba454a8baf64 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"total = 0\n for child in range(2, n + 1):\n s = size[child]\n other = n - s\n term1 = s * (s - 1) // 2\n term2 = other * (other - 1) // 2\n total += 2 * term1 * term2\n print(total)",
"total = 0\n for child in range(2, n + 1):\n s = size[child]\n other = ... | A | code-248276-91eca5cd3c3a | code-question-e783e45986bb1d2e | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"while current_sum > max_height and left < right:\n current_sum -= h[left]\n left += 1\n window_length = right - left + 1\n if window_length >= max_len:\n max_len = window_length",
"while current_sum > max_height:\n current_sum -= h[right]\n right -= 1\n window_length =... | C | code-182856-7d2b09c232ed | code-question-65d042556fdf36d7 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"fib = [0, 1]\nfor i in range(2, 200):\n fib.append(fib[i-1] + fib[i-2])",
"fib = [0, 1]\nfor i in range(201):\n fib.append(fib[i-1] + fib[i-2])",
"fib = [0, 1]\nfor i in range(2, 201):\n fib.append(fib[i-1] + fib[i-2])",
"fib = [0, 1]\nfor i in range(1, 201):\n fib.append(fib[i-1] + fib[i-2])",
... | C | code-066288-af9e76d7263a | code-question-30736789ad9a884a | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"titles = set()\nfor _ in range(m):\n title = input().strip()\n titles.add(title)\nsorted_titles = sorted(title)",
"titles = set()\nfor _ in range(m):\n title = input().strip()\n titles.add(title)\nsorted_titles = sorted(titles, key=len)",
"titles = {}\nfor _ in range(m):\n title = input().strip(... | G | code-188359-d22ad550fc97 | code-question-a32384c53125e6de | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if count == 0:\n print(q)\nelse:\n print(min(count * q, (count - 1) * p))",
"if count == 0:\n print(0)\nelse:\n cost1 = (count + 1) * p + q\n cost2 = count * q\n print(min(cost1, cost2))",
"if count == 0:\n print(q)\nelse:\n cost = min(q, p) * count\n print(cost)",
"if count <= 1:\... | E | code-238968-da07e1d0b0db | code-question-9ed3424a348293e9 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"result = 0\n for d in digits:\n result = (result * 2 + d) % MOD\n print(result)",
"result = digits[0] if digits else 0\n for d in digits:\n result = (result * 3 + d) % MOD\n print(result)",
"result = 0\n for d in reversed(digits):\n result = (result * 3 + d) % MOD\n print... | E | code-086958-de1ee28f52b5 | code-question-cee6248de3e70845 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if i + 3 <= n:\n substr3 = s_lower[i:i+3]\n if substr3 == 'cat':\n print(\"Alice\")\n break\n elif substr3 == 'dog':\n print(\"Bob\")\n break\n if i + 4 <= n:\n substr4 = s_lower[i:i+4]\n if substr4 == 'fish':\n print(\"Ch... | F | code-174256-8a8f48eb8b55 | code-question-aa317a18ea460000 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"current_sum_mod = 0\n seen = set()\n ans = 0\n for num in A:\n current_sum_mod = (current_sum_mod + num) % X\n if current_sum_mod in seen:\n ans += 1\n else:\n seen.add(current_sum_mod)\n print(ans)",
"current_sum_mod = 0\... | F | code-177759-310e56181dc7 | code-question-d18b51e77b6834b0 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"count = 0\nfor i in range(n):\n for j in range(m):\n if grid[i][j] == 0:\n directions = 0\n if has_left[i][j]:\n directions += 1\n if has_right[i][j]:\n directions += 1\n if has_up[i][j]:\n directions += 1\n ... | A | code-155479-6d1847ec61a2 | code-question-9115beac6f65f10d | 4 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"required = c[i] - 1\nif c[i-1] <= required:\n continue\ndelta = c[i-1] - required\nm = (delta + k - 1) // k\nsteps += m\nc[i-1] -= m * k",
"required = c[i-1] - 1\nif c[i] <= required:\n continue\ndelta = required - c[i]\nm = (delta + k - 1) // k\nsteps += m\nc[i] -= m * k",
"required = c[i-1] - 1\nif c[i... | D | code-166245-920824583028 | code-question-2f962129301f3963 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"required = set(chr(ord('a') + i) for i in range(k))\ncount = 0\nfor _ in range(n):\n s = input().strip()\n s_chars = set(s)\n if s_chars.issubset(required):\n count += 1",
"required = set(chr(ord('a') + i) for i in range(k+1))\ncount = 0\nfor _ in range(n):\n s = input().strip()\n s_chars =... | D | code-101555-3f423c620573 | code-question-07677a53872ffb68 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"total = S0 * k\nnumerator_part = (n - 1) * total\ndenominator = n - 1\ng = math.gcd(numerator_part, denominator)\nnumerator = numerator_part // g",
"numerator_part = (n - 1) * (k * S0 - (k - 1) // 2)\ndenominator = n\ng = math.gcd(numerator_part, denominator)\nnumerator = numerator_part // g",
"numerator_part ... | F | code-271622-14614a7904db | code-question-3daad0336d66a8ff | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if n % i == 0:\n exponent = 0\n while n % i == 0:\n exponent += 1\n n = n // i\n total *= (i ** (exponent + 1) + 1) // (i + 1)",
"if n % i == 0:\n exponent = 0\n while n % i == 0:\n exponent += 1\n ... | F | code-134789-6efcb05bff24 | code-question-b587d31074cf9756 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if count_odds == 0:\n print(total)\nelse:\n if total % 2 == 1:\n print(0)\n else:\n print(total - min_odd)",
"if count_odds == 0:\n print(0)\nelse:\n if total % 2 == 1:\n print(total - min_odd)\n else:\n print(total)",
"if count_odds == 0:\n print(0)\nelse:\n ... | D | code-078202-f8c1e9cbd4b2 | code-question-ca22100ea42386b0 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"dp[i] = (dp[i] + dp[i-1]) % MOD\n min_split[i] = min(min_split[i], min_split[j])\n current_length = 1\n if current_length > max_len:\n max_len = current_length",
"dp[i] = dp[j] % MOD\n min_split[i] = min_split[j] + 1\n current_length = i - j\n if current_lengt... | F | code-061509-d6a06e48ff51 | code-question-2ef44f1d2c8f50c0 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for num in schedule:\n if num == 0 and found:\n break\n if num == 1:\n current += 1",
"for num in schedule:\n if num == 1:\n current += 1\n found = True\n else:\n break",
"for num in schedule:\n if num == 0:\n if found:\n current = 0\n ... | D | code-044440-3fccf43d80ab | code-question-28402188791537b1 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"c_even = n // 2\nc_odd = n - c_even\nr_even = m // 2\nr_odd = m - r_even\npossible_pairs = min(c_even, r_even) + min(c_odd, r_odd)\nprint(possible_pairs)",
"c_even = sum(1 for num in c if num % 2 == 0)\nc_odd = n - c_even\nr_even = sum(1 for num in r if num % 2 == 0)\nr_odd = m - r_even\npossible_pairs = min(c_e... | G | code-229848-93dd268e42af | code-question-95cd492057a6ec85 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"result = []\nfor c in s:\n if c in lower_letters and c in upper_letters:\n result.append(c)",
"result = []\nfor c in s:\n base = c.lower()\n if base not in lower_letters or base.upper() not in upper_letters:\n result.append(c)",
"result = []\nfor c in s:\n base = c.lower()\n if bas... | G | code-272765-7f38875f165e | code-question-e9e07016042f5087 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for i in range(1, n):\n current_val = a[i]\n prev = adjusted[i-1]\n new_val = max(current_val, prev)\n adjusted[i] = new_val\n total += new_val - a[i]",
"for i in range(1, n):\n current_val = a[i]\n prev = adjusted[i-1]\n new_val = min(current_val, prev)\n ... | D | code-064062-4bec1fb39e1e | code-question-06b74ce34896696b | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if n <= 1:\n return False\n if n == 2:\n return True\n if n % 2 == 0:\n return False\n max_divisor = int(n ** 0.5) + 1\n for d in range(3, max_divisor, 2):\n if n % d == 0:\n return False",
"if n <= 1:\n return False\n if n == 2:\n return True\n... | A | code-158789-8b1ede5bc5ff | code-question-deb79dc69b3f08e5 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"max_sum = column_sums[0]\ncolumn = 0\nfor i in range(1, n):\n if column_sums[i] < max_sum:\n max_sum = column_sums[i]\n column = i",
"max_sum = column_sums[-1]\ncolumn = n - 1\nfor i in range(n - 2, -1, -1):\n if column_sums[i] > max_sum:\n max_sum = column_sums[i]\n column = i"... | D | code-087214-011f261e42f5 | code-question-ef2fb94084a86a7c | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"x_max = min(a, d)\nfor x in range(x_max + 1):\n remaining_laptops = d - x\n y_max = min(b, c, remaining_laptops)\n total = e * y_max + f * x\n if total > max_total:\n max_total = total",
"x_max = min(a, d)\nfor x in range(1, x_max + 1):\n remaining_laptops = d - x\n y_max = min(b, c, rem... | E | code-033092-7e18dcdb8141 | code-question-f03bc28e445bae2b | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"i = j = count = 0\n while i < len(boxes) and j < len(bags):\n if boxes[i] <= bags[j]:\n count += 1\n j += 1\n else:\n i += 1\n return count",
"i = j = count = 0\n while i < len(boxes) and j < len(bags):\n if bags[j] <= boxes[i]:\n count +=... | C | code-072596-bd744a126195 | code-question-cf449aeb8316ed5f | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for freq in count.values():\n if freq % 2 != 0:\n continue\n odd_count += 1",
"for freq in count.values():\n if freq % 2 != 0:\n odd_count += 1",
"for freq in count.values():\n if freq % 2 != 0:\n odd_count += 1\n break",
"for freq in count.values():\n if (freq & 1)... | B | code-272810-9d5c8cf949f3 | code-question-ebae722d8f4966f8 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if (i, j) in blocked:\n dp[i][j] = 0\n else:\n val = 0\n if i > 0 and j > 0:\n val = dp[i-1][j] or dp[i][j-1]\n elif i > 0:\n val = dp[i-1][j]\n elif j > 0:\n val = dp[i][j... | E | code-117661-8732355ae4df | code-question-05aec5c5111b2784 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"vertical = True\n for c in range(n):\n col = [matrix[r][c] for r in range(n)]\n if col != col[::-1]:\n vertical = False\n break",
"vertical = True\n for r in range(n):\n if matrix[r][0] != matrix[r][n-1]:\n vertical = Fal... | G | code-261387-d9fa24ee9da8 | code-question-a7641e034827b967 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if N > 0:\n if N % 2 == 0:\n print(\"Odd Number!\")\n else:\n print(\"Even Number!\")\n else:\n print(\"Invalid Number!\")",
"if N >= 2:\n if N % 2 == 0:\n print(\"Even Number!\")\n else:\n print(\"Odd Number!\")\n else:\n ... | D | code-268549-1c3cf2733a73 | code-question-658c143de322ccd6 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"sorted_participants = sorted(participants, key=lambda x: (-x[1], x[0]))\nfor p in sorted_participants:\n print(p[1])",
"sorted_participants = sorted(participants, key=lambda x: (-x[1], -x[0]))\nfor p in sorted_participants:\n print(p[0])",
"sorted_participants = sorted(set(participants), key=lambda x: (-... | F | code-110858-9443d752ee5e | code-question-90fa910dc8a68a01 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"seminars.sort(key=lambda x: x[1])\ncount = 0\nprev_end = 0\nfor s, e in seminars:\n if s >= prev_end:\n count += 1\n prev_end = e",
"seminars.sort(key=lambda x: x[1])\ncount = 0\nprev_end = 0\nfor s, e in seminars:\n if s >= prev_end:\n count += 1\n prev_end = s",
"seminars.so... | A | code-250343-855151296a3e | code-question-c4f4aea27ea5767a | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"binary = bin(N)[2:]\n return 0 if '00' in binary or '11' in binary else 1",
"binary = bin(N)[2:]\n return 1 if '00' in binary or '11' in binary else 0",
"binary = bin(N)[2:]\n return 1 if len(set(binary)) == 2 else 0",
"binary = bin(N)[2:]\n return 0 if '01' in binary or '10' in binary else 1",
... | A | code-014250-16141e187d27 | code-question-fe2d822a865fe3ab | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"s = 2 * h_i - 1\n if k_i % s != 0:\n print(\"NO\")\n else:\n h_candidate = k_i // s\n if 1 <= h_candidate <= h_i:\n print(f\"YES {h_candidate}\")\n else:\n print(\"NO\")",
"s = h_i * h_i\n if k_i != s:\n print(\"NO\")\n else:\n h_candida... | A | code-132111-d883bdbca761 | code-question-7b7a85e516f605fd | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"angle = math.pi / (2 * n)\nsin_angle = math.sin(angle)\nR = (r * sin_angle) / (1 + sin_angle)",
"angle = math.pi / n\nsin_angle = math.sin(angle)\nR = (r * (1 - sin_angle)) / sin_angle",
"angle = math.pi / n\nsin_angle = math.sin(angle / 2)\nR = (r * sin_angle) / (1 - sin_angle)",
"angle = math.pi / n\ntan_a... | F | code-007577-57fef86be044 | code-question-8b0a014f5c9be2d1 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if x > 0:\n x -= 1\n elif y > 0:\n y -= 1\n s += 1\n elif s > 0:\n y -= 1\n else:\n denied += 1",
"if x > 0:\n x -= 1\n elif s > 0:\n s -= 1\n elif y > 0:\n y -= 1\n s += 1\n ... | F | code-118588-8230d46663e1 | code-question-281644c7fb21a3e5 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"m = 0\n for num in arr:\n if num % k != 0:\n m += 1\n count = (1 << m) - 1\n print(count)",
"m = 0\n for num in arr:\n if num % k == 0:\n m += 1\n count = (1 << m)\n print(count)",
"m = 0\n for num in arr:\n ... | G | code-166295-f220eae5807a | code-question-a5ea609d433c2912 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for i in range(m):\n total = sum(matrix[i][j] * b[j] for j in range(n))\n print(total)",
"for row in matrix:\n total = sum(x * y for x, y in zip(b, b))\n print(total)",
"for row in matrix:\n total = sum(x + y for x, y in zip(row, b))\n print(total)",
"for row in matrix:\n total = sum(row... | G | code-148240-456cac68e4e2 | code-question-dc6a1299c387a063 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"count = sum(1 for distance in distances if distance == d)\nprint(count)",
"count = sum(1 for i in range(p) if i >= d)\nprint(count)",
"count = sum(1 for distance in distances if distance >= p)\nprint(count)",
"count = sum(1 for distance in distances if distance >= d - 1)\nprint(count)",
"count = 1 if sum(d... | F | code-116116-e111df1bf703 | code-question-eaebd1cab19c7aed | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if current_sum + word_len + (1 if current_line else 0) > M:\n lines.append(' '.join(current_line))\n current_line = [word]\n current_sum = word_len\nelse:\n current_line.append(word)\n current_sum += word_len + 1",
"if current_sum < M - word_len:\n current_line.append(word)\n current_sum += ... | C | code-038815-a15d4ab49819 | code-question-ca0c8c47e27d377d | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"a = end[i-1][j] if i > 0 else 0\n b = end[i][j-1] if j > 0 else 0\n start = a + b\n end[i][j] = start + times[i][j]",
"a = end[i-1][j] if i > 0 else 0\n b = 0\n start = max(a, b)\n end[i][j] = start + times[i][j]",
"a = end[i-1][j] if i > 0 else... | D | code-025353-9e9ad59cbd02 | code-question-51043904a5bca8d3 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for row in a:\n candidate = [total_xor[j] ^ row[j] for j in range(m)]\n if any(c == 1 for c in candidate):\n print(\"YES\")\n exit()\nprint(\"NO\")",
"for row in a:\n candidate = [total_xor[j] ^ row[j] for j in range(m)]\n if candidate == total_xor:\n print(\"YES\")\n exit... | E | code-186861-53f05ff34c6e | code-question-eb6730bfca8a2800 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"count = 0\n for p in positions:\n if a < p < b:\n count += 1",
"count = 0\n for p in range(n):\n if a <= p <= b:\n count += 1",
"count = 0\n for p in positions:\n if a <= p <= b:\n count += 1",
"count = 0\n for p in positions:\n if a <=... | C | code-254520-2cb62a8e017b | code-question-8bafe616b81f298d | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"ones = s.count('1')\nkey = ones\nif key not in groups:\n groups[key] = []\ngroups[key].append(idx)",
"ones = [j for j, c in enumerate(s) if c == '1']\nkey = tuple(set(ones))\nif key not in groups:\n groups[key] = []\ngroups[key].append(idx)",
"ones = [j for j, c in enumerate(s) if c == '0']\nones.sort()\... | F | code-156592-a97c38739987 | code-question-a01489f44ce9b34d | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for x in range(N, 0, -1):\n if not has_digit(N, D):\n print(N)\n break",
"x = N\n while x >= 0:\n if has_digit(x, D):\n print(x)\n break",
"for x in range(N, 0, -1):\n if has_digit(x, D):\n print(x)\n break",
"for x in ... | F | code-247761-9a83bdfb98ef | code-question-931b4059ecbd4ab1 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"count = 0\nfor string in strings:\n for c in string:\n if c not in emma_chars:\n count += 1\n break",
"count = 0\nfor string in strings:\n if string in s:\n count += 1",
"count = 0\nfor string in strings:\n for c in string:\n if c in emma_chars:\n ... | F | code-257203-038a56fde9bd | code-question-acc5053fdaba834b | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if i >= 1:\n alice_ways[i] += alice_ways[i - 1]\n if i >= 2:\n alice_ways[i] += alice_ways[i - 3]\n if i >= 4:\n alice_ways[i] += alice_ways[i - 4]",
"if i >= 0:\n alice_ways[i] += alice_ways[i]\n if i >= 1:\n alice_ways[i] += alice_ways... | E | code-252604-bb79e14a1384 | code-question-ccb1b28a5bd6d2eb | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for j in range(n_i - 1):\n p = (j + 1) % k\n gp = g[p]\n next_r = (r + gp) % m\n if r >= next_r:\n count += 1\n r = next_r",
"for j in range(n_i - 1):\n p = j % k\n gp = g[p]\n current_sum += gp\n next_r = current_sum % m\n if r > next_r:\n count += 1\n r = current_... | H | code-203632-a9f77501ec59 | code-question-72ca19486283f619 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"pair_count = [0] * k\n for r1 in range(k):\n for r2 in range(k):\n s = (r1 - r2) % k\n pair_count[s] = (pair_count[s] + cnt[r1] * cnt[r2]) % MOD\n triplet_count = 0\n for s in range(k):\n r3 = s % k\n triplet_count = (triplet_count + pair_count[s] * cnt[r3]) % MO... | D | code-185333-f51cc0cd1a44 | code-question-92b41c1b1d20fae3 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"count1 = b // q1 - (a - 1) // q1\n count2 = b // q2 - (a - 1) // q2\n count_both = b // lcm_val - (a - 1) // lcm_val\n total = count1 + count2 - count_both\n total_numbers = b - a\n percentage = (total / total_numbers) * 100",
"count1 = b // q1 - (a - 1) // q1\n count2 =... | F | code-274977-5c31eeae5f26 | code-question-2e83cc373bf05623 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"all_chests = set(range(1, total + 1))\nnonA = list(all_chests - set(a))\nresult = []\nfor i in range(n):\n result.append(a[i])\n result.append(nonA[i])",
"all_chests = set(range(1, total + 1))\nnonA = sorted(all_chests - set(a))\nresult = []\nfor i in range(n):\n result.append(nonA[i])\n result.appen... | E | code-252785-d91ac0839a26 | code-question-2846ac5dbde30c4e | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for i in range(m):\n start = i * 3\n group = windows[start:start+3]\n if '1' in windows:\n total += 1",
"for i in range(m):\n start = i * 3\n group = windows[start:start+3]\n if group.count('1') == 3:\n total += 1",
"for i in range(m):\n st... | D | code-110475-9eb4f9967f95 | code-question-88436cc0deb1fd12 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"prefix_sum = [0] * (n + 1)\n for i in range(1, n+1):\n prefix_sum[i] = prefix_sum[i-1] + (1 if s[i-1] == '0' else 0)\n for __ in range(q):\n l = int(data[ptr])\n r = int(data[ptr+1])\n ptr += 2\n total = prefix_sum[r] - prefix_sum[l-1]\n ... | G | code-000381-007cd502f43a | code-question-549c51c8f09454f7 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"sorted_T = sorted(T)\nfor combo in itertools.permutations(sorted_T, m):\n print(''.join(combo))",
"sorted_T = T\nfor combo in itertools.combinations(sorted_T, m):\n print(''.join(combo))",
"sorted_T = sorted(T, reverse=True)\nfor combo in itertools.combinations(sorted_T, m):\n print(''.join(combo))",
... | D | code-171484-bab9521dcbd7 | code-question-ff584870c627f414 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"unique_titles = set(titles)\nsorted_titles = sorted(unique_titles, key=len)\nprint(len(sorted_titles))\nfor title in sorted_titles:\n print(title)",
"unique_titles = set(titles)\nsorted_titles = sorted(titles)\nprint(len(sorted_titles))\nfor title in sorted_titles:\n print(title)",
"unique_titles = list(... | E | code-073765-e8f8611560bb | code-question-2b23997051532fdb | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"placed = False\n for i in range(len(stacks)):\n if stacks[i][-1] == num:\n placed = True\n break\n if stacks[i][-1] < num:\n stacks[i].append(num)\n placed = True\n break\n if not placed:\n stacks.append([num])",
"placed = False\n ... | G | code-054282-00b88f53f380 | code-question-8f3f272aea3ab8fc | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"sum_i = (r - l + 1) * (l + r) // 2\n sum_sq = (r * (r + 1) * (2 * r + 1) // 6) - (\n l * (l + 1) * (2 * l + 1) // 6\n )\n term2 = (sum_i + sum_sq) // 2\n total = term1 + term2",
"sum_i = ((l - 1) * l // 2) - (r * (r + 1) // 2)\n sum_sq = (\n (l - 1) * l * ... | F | code-223210-a2fd3f43d081 | code-question-d956689ad1e137b1 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"idx_L = title_to_index[L]\nidx_R = title_to_index[R]\ntotal = 0\nfor i in range(idx_L + 1, idx_R):\n total += episodes[i][1]",
"idx_L = title_to_index[L]\nidx_R = title_to_index[R]\ntotal = 0\nfor i in range(idx_L + 1, idx_R):\n total += episodes[idx_L][1]",
"idx_L = title_to_index[R]\nidx_R = title_to_i... | A | code-210619-6e8810e1f4d5 | code-question-daaa52366d9f0d76 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"digit = binary[i]\n exponent = length - i\n terms.append(f\"{digit}*2^{exponent}\")",
"digit = str(int(binary[i]) * (2 ** (length - 1 - i)))\n exponent = 0\n terms.append(f\"{digit}*2^{exponent}\")",
"digit = binary[length - 1 - i]\n exponent = length - 1 - i\n terms.append(f\"{digit}*2^{expo... | E | code-083878-46658ab3090f | code-question-a416f7e20c5dc58a | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"b_list = list(map(int, input().split()))\ncounts = {}\nfor b in b_list:\n counts[b] = counts.get(b, 0) + 1\nfor i in range(1, m + 1):\n print(counts.get(i + 1, 0))",
"b_list = list(map(int, input().split()))\ncounts = [0] * (m + 1)\nfor b in b_list:\n counts[b] = 1\nfor i in range(1, m + 1):\n print(... | G | code-036246-1f4c915ab369 | code-question-e0542e6f67dec993 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"def find(u):\n while parent[u] != u:\n u = parent[u]\n return parent[u]\ndef union(u, v):\n u_root = find(u)\n v_root = find(v)\n if u_root != v_root:\n parent[u_root] = v_root",
"def find(u):\n while parent[u] != u:\n parent[u] = u\n u = parent[u]\n return u\ndef... | D | code-151620-f70b9a495152 | code-question-ad5ab236ee29fa48 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for c in s:\n if c.isdigit():\n sum_digits -= int(c)\n elif c == '.':\n sum_periods += 1",
"for c in s:\n if c.isdigit():\n sum_digits += int(c)\n elif c == '.':\n continue",
"for c in s:\n if c.isdigit():\n sum_periods += int(c)\n elif c == '.':\n su... | H | code-088997-3707dff60f98 | code-question-cd5464c0d12564db | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"while low < high:\n mid = (low + high) // 2\n cnt = count_trailing_zeros(mid)\n if cnt < n:\n low = mid + 1\n else:\n high = mid\n return low",
"while low < high:\n mid = (low + high + 1) // 2\n cnt = count_trailing_zeros(mid)\n if cnt < n... | A | code-101841-c0c72901cd65 | code-question-f9f5f2f2c9bf6c75 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"last_digits = [1, 1, 2, 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\na = last_digits[m - 1]\nb = last_digits[n - 1]",
"last_digits = [1, 1, 2, 6, 4, 6, 2, 4, 8, 6, 6, 2, 4, 8, 6, 6, 2, 4, 8, 6]\na = last_digits[m]\nb = last_digits[n]",
"last_digits = [1, 1, 2, 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0... | E | code-003618-c9f44247efc8 | code-question-089d7a49396fe455 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for _ in range(100):\n if right - left < 1e-13:\n break\n mid1 = left + (right - left)/3\n mid2 = right - (right - left)/3\n f1 = compute_max_time(mid1)\n f2 = compute_max_time(mid2)\n if f1 < f2:\n right = mid2\n else:\n left = mid1",
"for _ in range(100):\n if right... | A | code-108560-e5c65b80a224 | code-question-59110b3e33768dae | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"xs = [p[0] for p in points]\n ys = [p[1] for p in points]\n minX = min(xs)\n maxX = max(xs)\n minY = min(ys)\n maxY = max(ys)\n area = (maxX - minX) + (maxY - minY)\n if area > 0:\n print(area)\n else:\n if minX == maxX and minY == maxY:... | C | code-057640-1fd9a0dbc37d | code-question-b0ce1ab4ee54a3cc | 5 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"u, _ = bfs(1, adj, n)\n v, diameter = bfs(u, adj, n)\n print(diameter)",
"u, _ = bfs(1, adj, n)\n v, diameter = bfs(1, adj, n)\n print(diameter)",
"u, _ = bfs(n, adj, n)\n v, diameter = bfs(u, adj, n)\n print(diameter)",
"diameter = 0\n for i in range(1, n + 1... | A | code-123778-ef05868e0e83 | code-question-a64e3cda4cf7342f | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"max_profit = -float('inf')\nfor S in range(1, 1 << 10):\n total = 0\n for i in range(n):\n m = bin(D[i] | S).count('1')\n total += G[i][m]\n if total > max_profit:\n max_profit = total",
"max_profit = float('inf')\nfor S in range(1, 1 << 10):\n total = 0\n for i in range(n):\n... | H | code-211475-ae8269954bbc | code-question-cbb33f7664c0c205 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"left = min(xi)\n right = max(xi)\n d1 = abs(j - left)\n d2 = abs(j - right)\n min_d = d1 if d1 < d2 else d2\n time = min_d + 1\n if time > max_time:\n max_time = time",
"min_d = float('inf')\n for x in xi:\n d = (j - x) * (j - x)\n ... | F | code-063763-47a42790acca | code-question-7d07e02d16db4ef4 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"colors = list(last.keys())\n last_list = sorted(last[color] for color in colors)\n total = 0\n for q in colors:\n fq = first[q]\n count = len(last_list) - bisect.bisect_left(last_list, fq)\n total += count",
"colors = list(first.keys())\n first_list = sorted(first[color] for colo... | F | code-210775-04ba1735e519 | code-question-845a003bf4564571 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"if first % y == 0 and second % x == 0:\n print(f\"{first_str} {second_str}\")\n return",
"if first % x == 0 or second % y == 0:\n print(f\"{first_str} {second_str}\")\n return",
"if first_str.endswith(str(x)) and second_str.endswith(str(y)):\n print(f\"{fi... | H | code-080482-4296818e0ff5 | code-question-db4247b6342eba0e | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"a_num = 3 * X - Y\n b_num = 3 * Y - X\n if a_num <= 0 or b_num <= 0:\n print(0)\n elif a_num % 8 != 0 or b_num % 8 != 0:\n print(0)\n else:\n a = a_num // 8\n b = b_num // 8\n n = a + b\n combination = compute_combination(n, a)\n print(combination)",
"... | H | code-212353-914dd9eeb06e | code-question-7ae340ec8f246a46 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"possible = False\n if count0 % 3 == 0 and count0 > 0:\n possible = True\n elif (count1 + count2) % 3 == 0 and (count1 > 0 or count2 > 0):\n possible = True",
"possible = False\n if count0 >= 2 and (count1 >= 1 or count2 >= 1):\n possible = True\n elif ... | E | code-247489-fd960d358cd7 | code-question-bab8eb4b930a1d18 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"clubs = [(j + 1, counts[j]) for j in range(m)]\nclubs.sort(key=lambda x: (x[1], x[0]))\nprint(' '.join(map(str, [club[0] for club in clubs])))",
"clubs = [(counts[j], j + 1) for j in range(m)]\nclubs.sort(key=lambda x: (-x[1], x[0]))\nprint(' '.join(map(str, [club[1] for club in clubs])))",
"clubs = [(counts[j... | C | code-213343-600dcec1f7d7 | code-question-6fa6dd2c641928e8 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for i in range(len(b)):\n distance = abs((i + 1) - k) + (k - 1)\n total += b[i] * distance\n total *= 2",
"for i in range(len(b)):\n distance = abs((i + 1) - k) + (k - 1)\n total += b[i] * distance",
"for i in range(len(b)):\n distance = (abs((i + 1) - k) + (k - 1)) ** 2\n... | A | code-064828-ff2495ce3376 | code-question-32e307c55946f69a | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for k in range(2, l + 1):\n for j in range(len(beads)):\n for i in range(len(beads)):\n if beads[j] - beads[i] >= 3:\n if dp[k-1][i] != INF:\n if dp[k][j] > dp[k-1][i] + beads[j]:\n dp[k][j] = dp[k-1][i] + beads[j]",
"for k in range(2,... | B | code-217205-e5deee3bbbb8 | code-question-f3033059b91eda37 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"runs = []\n current_char = s[0]\n count = 1\n for c in s[1:]:\n if c == current_char:\n count += 1\n else:\n runs.append(count)\n current_char = c\n count = 1",
"runs = []\n equal = 0\n for i in r... | E | code-257057-0cf0a49ef648 | code-question-fd1e1a2aadfa56be | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"current_x = min_x * 2\n while current_x in freq:\n if freq[current_x] < max_seq:\n break\n max_seq = freq[current_x]\n current_x *= 2",
"current_x = min_x\n while current_x in freq:\n if freq[current_x] > max_seq:\n max_seq =... | E | code-044332-140d9089bf2d | code-question-b0d66347492281bc | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for time, idx in book_details:\n if current_sum + time >= h:\n current_sum += time\n selected.append(idx)\n break",
"for time, idx in book_details:\n if current_sum + time > h:\n break\n current_sum += time\n selected.append(time)",
"for time, idx in reversed(book_detail... | H | code-044586-189fb6776be3 | code-question-7a85e8f16a19d714 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"found = False\n if len(s) % 2 == 0:\n a = s[:len(s)//2]\n b = s[len(s)//2:]\n if sorted(a) == b:\n found = True",
"found = False\n for split in range(0, len(s)+1):\n a = s[:split]\n b = s[split:]\n if sorted(a) == sort... | G | code-255184-de27c6f9cfb1 | code-question-5d3424d529192cef | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"m = d[0] % n\nfor j in range(1, n):\n current = d[j] % n\n if (current - j) % n != m:\n print(\"Impossible\")\n exit()",
"m = (0 - d[0]) % n\nfor j in range(0, n):\n current = (j - d[j]) % n\n if current != 0:\n print(\"Impossible\")\n exit()",
"m = (d[0] - 0) % n\nfor j... | E | code-112131-17129c89f63d | code-question-abdff8e3d5f1360e | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"right_dist = [0] * m\n prev_R = -1\n for i in range(m-1, -1, -1):\n if s[i] == 'L':\n right_dist[i] = 0\n prev_R = i\n else:\n if prev_R == -1:\n right_dist[i] = float('inf')\n else:\n right_dist[i] = i - prev_R",
"righ... | F | code-040509-3df981bb8572 | code-question-b5a91b7bd4a018d9 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"valid = True\n for c in s:\n if c not in {'4', '5', '6'}:\n valid = False\n break\n if valid:\n result.append(s)",
"valid = True\n for c in s:\n break\n if int(s[-1]) in {4, 5, 6}:\n result.append(s)\n else:\n valid = False",
"valid = True... | A | code-181917-d6735ae371a7 | code-question-798452bfc8fa2e22 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"for i in range(1, len(s)):\n if s[i] == current_char:\n current_streak += 1\n if current_streak >= 5:\n critical_found = True\n break\n else:\n current_char = s[i]\n current_streak = 0",
"for i in range(1, len(s)):\n if s[i] != current_char:\n cur... | D | code-045495-11fd8f5c8bae | code-question-0ced511c452387e4 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"prefix = [0] * n\nprefix[0] = A[0]\nfor i in range(1, n):\n prefix[i] = prefix[i-1] - A[i]",
"prefix = [0] * n\nprefix[0] = A[0]\nfor i in range(n):\n prefix[i] = prefix[i-1] + A[i]",
"prefix = [0] * n\nprefix[0] = 0\nfor i in range(1, n):\n prefix[i] = prefix[i] + A[i - 1]",
"prefix = [0] * (n + 1)... | F | code-238073-7b9d036bbc75 | code-question-544497352ec323b0 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"sorted_emails = sorted(counts.keys())\nfor email in counts:\n print(f\"{email} {counts[email]}\")",
"sorted_emails = sorted(counts.keys(), reverse=True)\nfor email in sorted_emails:\n print(f\"{email} {counts[email]}\")",
"sorted_emails = sorted(counts.keys(), key=lambda e: counts[e])\nfor email in sorte... | D | code-157347-94af7ec73a3e | code-question-8d92960dd00d1caf | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"while i < len(vowels) and j < len(consonants):\n if vowels[i] <= consonants[j]:\n result.append(vowels[i])\n i += 1\n else:\n result.append(consonants[j])\n j += 1\n result += vowels[i:]\n result += consonants[j:]",
"vowels.sort()\n consonants.so... | E | code-175144-301c7654e5b6 | code-question-e05c633c6aa1e1d0 | 6 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"T = [[2, 3], [1, 0]]\n mat = matrix_power(T, n - 1, MOD)\n term = (mat[0][0] * 3 + mat[0][1] * 2) % MOD\n print(term)",
"T = [[3, 2], [1, 0]]\n mat = matrix_power(T, n - 1, MOD)\n term = mat[0][0] * 3 + mat[0][1] * 2\n print(term % (10**9 + 9))",
"T = [[3, 2], [1, 0]]\n mat = matrix_power(... | F | code-084935-4f716eacdf30 | code-question-d6675f86a5593da9 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"delta = D - S\nsteps = (delta + 1) // 2 + (delta % 2)\nprint(steps)",
"delta = D - S\nsteps = (delta + (S % 2)) // 2\nprint(steps)",
"delta = D - S\nsteps = (delta + (D % 2)) // 2\nprint(steps)",
"delta = D - S\nsteps = delta if D % 2 == 0 else (delta + 1) // 2\nprint(steps)",
"delta = abs(D - S)\nsteps = ... | F | code-058379-94597f5dc84c | code-question-07db66d2c9e9f7d1 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"while count > k:\n if s[left] == target:\n count -= 1\n left += 1",
"while count > k:\n if s[left] != target:\n count += 1\n left += 1",
"while count > k:\n if s[right] != target:\n count -= 1\n left ... | G | code-204370-a916050add3e | code-question-c872bacf1a0948e2 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"total = A1 + A2 + A3\n if max(A1, A2, A3) <= C:\n print(1)\n elif A1 + A2 <= C or A1 + A3 <= C or A2 + A3 <= C:\n print(2)\n else:\n print(3)",
"total = A1 + A2 + A3\n trips = (total + C - 1) // C\n if trips == 0:\n print(0)\n ... | H | code-229861-8a4b05a7f5d6 | code-question-4c9b819ada9a1096 | 8 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"count = [0] * 26\n for c in s:\n idx = ord(c) - ord('a')\n count[idx] = 1\n counts.append(count)",
"count = [0] * 26\n for c in s:\n if c < 'a' or c > 'z':\n continue\n idx = ord(c) - ord('a')\n counts.append(count)",
"count = [0] * 26\n for c in set(s):\n ... | F | code-266073-9983d5a654e6 | code-question-338606ea816b3535 | 7 |
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}.
**Questio... | [
"dr = abs(r2 - r1)\n dc = abs(c2 - c1)\n if dr % k != 0 and dc % k != 0:\n print(-1)\n else:\n a = (dr + k - 1) // k\n b = (dc + k - 1) // k\n print(max(a, b))",
"dr = abs(r2 - r1)\n dc = abs(c2 - c1)\n if dr % k != 0 or dc % k != 0:\n... | G | code-197380-15e92d185191 | code-question-047c8ec3e330c290 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.