id stringlengths 23 59 | messages listlengths 2 2 | category stringclasses 193
values |
|---|---|---|
discretelogarithm_diff_2_9_a21b74ad91 | [
{
"content": "Please find the **smallest** non-negative integer **y** such that **(7^y) MOD 9 = 1 MOD 9**.\n\n**Output Format:** Your final answer should be a single non-negative integer β the smallest **y** satisfying the equation.",
"role": "user"
},
{
"content": "We are to find the smallest non-... | discretelogarithm |
discretelogarithm_diff_1_11_360476fcc3 | [
{
"content": "Please find the **smallest** non-negative integer **y** such that **(9^y) MOD 9 = 0 MOD 9**.\n\n**Output Format:** Your final answer should be a single non-negative integer β the smallest **y** satisfying the equation.",
"role": "user"
},
{
"content": "First, let's interpret the probl... | discretelogarithm |
fractionalprogramming_diff_0_4_c9ad1c5bf6 | [
{
"content": "You are given two arrays `A` and `B`, each containing 3 integers:\nA[0]=15 B[0]=10\nA[1]=2 B[1]=4\nA[2]=2 B[2]=13\n\nPlease select 2 **distinct indices** `i_1, ..., i_2` to maximize the value of `(A[i_1] + ... + A[i_2]) / (B[i_1] + ... + B[i_2])`\n\n**Output Format:** Your final answer should be a... | fractionalprogramming |
threevertexcyclecounting_diff_1_27_079810dcef | [
{
"content": "You are given an **undirected graph** with 6 vertices, labeled from `0` to `5`.\nThe graph contains the following undirected edges:\n(2, 5)\n(3, 4)\n(0, 3)\n(0, 4)\n(2, 4)\n(2, 3)\n(3, 5)\n(0, 2)\n(1, 2)\n(4, 5)\n(1, 3)\n(1, 4)\n(1, 5)\n(0, 1)\n(0, 5)\n\nPlease count the number of distinct **three... | threevertexcyclecounting |
stringpartitionshuffle_diff_1_0_b4c5501bdf | [
{
"content": "You are given a string S of length 5 (0-indexed): 00000\n\nPlease find 3 intervals [L[1], R[1]), ..., [L[3], R[3]) such that:\n- Each interval [L[i], R[i]) is non-empty and disjoint.\n- The intervals together cover the entire string S (each index appears in exactly one interval).\n- Concatenating ... | stringpartitionshuffle |
shortestpath_diff_2_16_cc68277845 | [
{
"content": "You are given a **directed graph** with 6 vertices, labeled from `0` to `5`.\n\nThe graph contains the following directed edges. Each edge is represented as a tuple `(s, t, w)`, meaning there is a directed edge **from vertex `s` to vertex `t` with weight `w`** :\n(1, 4, 4)\n(3, 5, 1)\n(0, 1, 3)\n(... | shortestpath |
maximumweightmatching_diff_1_4_7749bf94a5 | [
{
"content": "You are given an **undirected graph** with 6 vertices, labeled from `0` to `5`.\n\nThe graph contains the following undirected edges. Each edge is represented as a tuple `(u, v, w)`, meaning an undirected edge **connecting vertex `u` to vertex `v` with weight `w`**:\n(1, 5, 1)\n\nYour task is to s... | maximumweightmatching |
maxpermutation_diff_1_4_e9361a1987 | [
{
"content": "You are given an array `A` of 4 positive integers:\nA[0]=12122\nA[1]=12122\nA[2]=11112\nA[3]=1\n\nYour task is to rearrange **all** the elements of the array (each number must be used **exactly once**) to form the **largest possible integer** when the numbers are **concatenated in order**. Treat t... | maxpermutation |
hamiltonianpathexistence_diff_2_28_3933ecb66e | [
{
"content": "You are given a **directed graph** with 5 vertices, labeled from `0` to `4`. The graph contains the following directed edges. Each edge is represented as a tuple `(s, t)`, meaning there is a directed edge **from vertex `s` to vertex `t`**:\n(2, 1)\n(4, 0)\n(3, 4)\n(0, 2)\n(4, 2)\n(4, 1)\n(1, 0)\n\... | hamiltonianpathexistence |
sorting_diff_2_31_425ae95adb | [
{
"content": "You are given the following list of numbers:\n0 15 3 24 12\nPlease sort them in **ascending order**.\n\nYour final answer should be a single line containing the sorted numbers, separated by **spaces**.\nFor example: `1 2 3 4 5` (do **NOT** include the backticks or quotes).",
"role": "user"
}... | sorting |
constructhackinterval_diff_0_2_31b76024ff | [
{
"content": "Let's define f(x) as the sum of digits in the decimal representation of number x (for example, f(1234) = 1 + 2 + 3 + 4). Please construct an interval [L, R], such that the sum of f(x) for all x in the interval is divisible by 1.\nNote that L and R should be both positive integers, L should be less... | constructhackinterval |
combinationoddsubsequencecounting_diff_0_11_a4d5eedc0d | [
{
"content": "You are given a sequence of **distinct** integers: 5 3 4\n\nPlease count the number of subsequences (not necessarily contiguous, but the order must be preserved) a[1], ..., a[k] such that:\n1. k β₯ 2 (the subsequence must have at least two elements);\n2. C(a[1], a[2]) Γ C(a[2], a[3]) Γ ... Γ C(a[kβ... | combinationoddsubsequencecounting |
setcover_diff_0_17_f8c6e8cbf3 | [
{
"content": "You are given 3 items labeled from 0 to 2, and 3 sets labeled from 0 to 2. Each set is a subset of the items:\nSet 0: { 2 }\nSet 1: { 0, 1 }\nSet 2: { 0, 1, 2 }\n\nYour task is to select a collection of sets such that every item is covered **by exactly one** of the selected sets.\n\n**Output Forma... | setcover |
eightdigitpuzzle_diff_2_21_de62a6101a | [
{
"content": "You are given a 3 Γ 5 grid, where each cell contains a digit from `0` to `14`. At any time, you can **swap the `0`** with one of its four (existing) neighbors:\n- `U` = up\n- `D` = down\n- `L` = left\n- `R` = right\n\nYou start with the following grid:\n8 5 9 0 1\n13 14 2 12 3\n7 4 10 6 11\n\nYour... | eightdigitpuzzle |
boundedintervalintersection_diff_0_14_1c59261895 | [
{
"content": "An interval [l, r]'s length is defined as r - l. The length of an **empty intersection** is considered to be 0. The **intersection** of a set of intervals is the range covered by all of them simultaneously.\n\nYou are given 3 intervals:\n[27, 105]\n[63, 97]\n[65, 102]\n\nPlease count how many **no... | boundedintervalintersection |
circulatingdecimalcounting_diff_0_7_7aac06c053 | [
{
"content": "Please count how many **distinct pure repeating decimals** (in terms of numeric value) exist in base $3$, that can be written as a reduced fraction $\\frac{x}{y}$ where $1 \\le x \\le 2$ and $1 \\le y \\le 3$, with $x$ and $y$ being integers.\nA number is called a **pure repeating decimal** if and... | circulatingdecimalcounting |
minesweeping_diff_0_20_2118874b96 | [
{
"content": "You are given a 2 Γ 3 matrix. Each element is either a number in [0, 8] or `-1`. Your task is to construct a grid of the same size, satisfying the following conditions:\n1. Each cell is either `*` or `.`\n2. For any cell in the original matrix that is **NOT** `-1`, the corresponding cell in the ou... | minesweeping |
fbi_binarytree_diff_1_16_eeee8d1748 | [
{
"content": "We classify binary strings made up of only `0` and `1` into three types:\n- A string consisting of only `0`s is called a **B-string**.\n- A string consisting of only `1`s is called an **I-string**.\n- A string that contains both `0` and `1` is called an **F-string**.\n\nAn **FBI tree** is a binary... | fbi |
palindromepartitioncounting_diff_1_4_04005e09b8 | [
{
"content": "Please count the number of ways to partition the string `100110` into (non-empty) palindromic substrings, where the number of substrings is arbitrary.",
"role": "user"
},
{
"content": "First, let's clarify the task:\n\nGiven string: `100110` (length = 6)\n\nWe want to partition it into... | palindromepartitioncounting |
minimumspanningtree_diff_2_20_3c2ea223ae | [
{
"content": "You are given an **undirected graph** with 6 vertices, labeled from `0` to `5`.\n\nThe graph contains the following undirected edges. Each edge is represented as a tuple `(u, v, w)`, meaning an undirected edge **connecting vertex `u` to vertex `v` with weight `w`**:\n(1, 4, 1)\n(0, 4, 5)\n(3, 5, 2... | minimumspanningtree |
maximumweightmatching_diff_0_26_60215a1068 | [
{
"content": "You are given an **undirected graph** with 5 vertices, labeled from `0` to `4`.\n\nThe graph contains the following undirected edges. Each edge is represented as a tuple `(u, v, w)`, meaning an undirected edge **connecting vertex `u` to vertex `v` with weight `w`**:\n(0, 3, 4)\n(2, 4, 1)\n(1, 4, 2... | maximumweightmatching |
maximum_subsequencenum_diff_1_3_ab9957b07a | [
{
"content": "We want to obtain a sequence of length 3 + 3 = 6 from an initial sequence of length 3 by appending 3 integers, each in [0, 2). The initial sequence of length 3: 0 1 0\n\nTry your best to maximize the number of essentially different subsequences of the final sequence.\nSubsequence: picking some (>=... | maximum |
gridbfs_diff_1_24_289cd53e1c | [
{
"content": "You are given a 5 Γ 3 grid. Each cell contains `0`, `1`, or `X`. For each cell, compute its **shortest distance** to any cell containing `1`, where distance is defined as the minimum number of steps required to move from one cell to another under the following rules:\n1. You may move **up**, **dow... | gridbfs |
polynomialfactorization_diff_2_7_6116d874cd | [
{
"content": "You are given a degree-5 polynomial: (x - a_1)...(x - a_5) = (75) * x^1 + (-50) * x^2 + (-28) * x^3 + (2) * x^4 + (1) * x^5\n\nYour task is to find any valid set of integers `a_1, ..., a_5` (not necessarily distinct) such that the product of the linear factors on the left expands to match the give... | polynomialfactorization |
longest_matchingsubsequence_diff_2_17_9304b3d82b | [
{
"content": "You are given an array `A` of length 5, indexed from 0 to 4. The array is as follows:\nA[0]=5\nA[1]=3\nA[2]=1\nA[3]=4\nA[4]=3\n\nYour task is to select a **strictly increasing sequence of indices** `i_1, i_2, ..., i_k` (0 β€ i_1 < i_2 < ... < i_k < 5) such that:\n- Let B[1] = A[i_1], B[2] = A[i_2],... | longest |
numberpartitioncounting_diff_2_0_9fa1c270ba | [
{
"content": "You are given a positive integer 13. Your task is to divide it into exactly 13 **non-empty** positive integers such that:\n\n- The **sum** of the 13 parts is exactly 13,\n- The **order does not matter** β that is, two partitions are considered the same if they contain the same numbers, regardless ... | numberpartitioncounting |
path_nogoingback_counting_diff_0_1_cf4d4e6a17 | [
{
"content": "You are given an **undirected graph** with 6 vertices labeled from `0` to `5`. The graph contains the following undirected edges (no repeated edges): \n(1, 3)\n(0, 2)\n(4, 5)\n(1, 5)\n(0, 3)\n\nPlease count the number of paths from vertex `0` to vertex `5` that satisfy the following conditions:\n... | path |
axis_kcenter_diff_0_0_2b5b3e7a40 | [
{
"content": "You are given 4 points on a line, labeled from 0 to 3. Their positions (from left to right) are: 1 8 13 16\n\nPlease select a set of 2 distinct points. Try your best to minimize the total distance from all points to their nearest selected point (the distance is the absolute difference between posi... | axis |
prefixconcatenation_diff_0_31_c8f1b072d7 | [
{
"content": "Define $Concatenate(n)$ as the number formed by concatenating all positive integers from $1$ to $n$ in order. For example, when $n = 12$, $Concatenate(12) = 123456789101112$\n\nYour task is to compute $Concatenate(2) \\bmod 492391$.\n\n**Output Format:** Your final answer should be a **single inte... | prefixconcatenation |
bezoutidentity_diff_2_25_98cd627626 | [
{
"content": "You are given an array of length 4, denoted as A[1], ..., A[4]. Please find **integers** X[1], ..., X[4] such that the value of S = A[1] * X[1] + ... + A[4] * X[4] satisfies the condition: **S > 0**. Try your best to **minimize the value of S** while meeting this condition.\n\nA: -62, -74, -98, 50... | bezoutidentity |
maximum_independentset_tree_diff_1_28_2349fd6d6b | [
{
"content": "You are given a **tree** (i.e., a connected undirected graph with no cycles) with 5 vertices, labeled from `0` to `4`.\n\nThe tree contains the following 5 - 1 = 4 undirected edges. Each edge is represented as a tuple `(u, v)`, meaning there is an undirected edge **connecting vertex `u` to vertex ... | maximum |
coloringcounting_diff_0_13_c541400b6a | [
{
"content": "You are given an **undirected graph** with 4 vertices, labeled from `0` to `3`. The graph contains the following undirected edges:\n(2, 3)\n(0, 3)\n(0, 2)\n\nYou are also given an array `R` of length 4, where `R[u]` denotes the **maximum allowed color** for vertex `u`:\nR[0]=4\nR[1]=0\nR[2]=2\nR[3... | coloringcounting |
circulatingdecimalcounting_diff_2_7_9900e17c23 | [
{
"content": "Please count how many **distinct pure repeating decimals** (in terms of numeric value) exist in base $5$, that can be written as a reduced fraction $\\frac{x}{y}$ where $1 \\le x \\le 6$ and $1 \\le y \\le 3$, with $x$ and $y$ being integers.\nA number is called a **pure repeating decimal** if and... | circulatingdecimalcounting |
pairmoreonecounting_diff_0_25_5d16600e72 | [
{
"content": "Please count the number of pairs of binary strings (S, T) such that:\n- The length of S is 9 = 4 + 5, and the length of T is 4.\n- The number of 1s in S is strictly greater than the number of 1s in T.\n\nPlease output the result modulo 10^2.",
"role": "user"
},
{
"content": "<think> \... | pairmoreonecounting |
divisorflipexpectation_diff_1_24_0a1afaa0bd | [
{
"content": "You are given 4 lights labeled from 1 to 4, each in an initial state: `1` (on) or `0` (off). The initial state is:\nLight 1: 1\nLight 2: 1\nLight 3: 0\nLight 4: 0\n\nEach light can be toggled by pressing switches. There are 4 switches, and pressing switch `i` will **toggle the state** of all light... | divisorflipexpectation |
weightedbinarytree_diff_0_1_641aa16977 | [
{
"content": "You are given a binary tree with 3 nodes, labeled from 0 to 2.\nThe **in-order traversal** of the tree is: `0, 1, ..., 2` β that is, the in-order sequence is fixed in increasing order of node labels.\n\nEach node `i` has an associated score `d_i` (where `0 β€ i < 3`), given as:\nd_0=2\nd_1=5\nd_2=1... | weightedbinarytree |
vertex_kcenter_diff_0_0_1453b75a08 | [
{
"content": "You are given an **undirected connected graph** with 4 vertices, labeled from `0` to `3`.\n\nThe graph contains the following undirected edges. Each edge is represented as a tuple `(u, v, w)`, meaning an undirected edge **connecting vertex `u` to vertex `v` with weight `w`**:\n(1, 3, 5)\n(1, 2, 4)... | vertex |
countdownequal_diff_2_14_7c13112817 | [
{
"content": "You are given the following numbers: 4 5 5 5 2\nYour task is to create a valid mathematical expression that evaluates to the target number: **13**.\n\nConstraints:\n- Use **each number exactly once**\n- Only these basic arithmetic operations are allowed: +, -, *, /\n- You may use **parentheses** t... | countdownequal |
nextpalindromic_diff_1_25_0608962611 | [
{
"content": "Please find the **smallest palindromic number** that is greater than 387.",
"role": "user"
},
{
"content": "First, I need to understand what a palindromic number is. A palindromic number reads the same forwards and backwards (like 121, 777, etc.). \n\nThe user wants the smallest palind... | nextpalindromic |
boundedintervalintersection_diff_0_20_b5fa564d64 | [
{
"content": "An interval [l, r]'s length is defined as r - l. The length of an **empty intersection** is considered to be 0. The **intersection** of a set of intervals is the range covered by all of them simultaneously.\n\nYou are given 3 intervals:\n[38, 71]\n[25, 66]\n[43, 46]\n\nPlease count how many **non-... | boundedintervalintersection |
crt_diff_1_12_dfbb464bcf | [
{
"content": "You are given a system of 2 modular congruences:\nx β‘ 1 (mod 5)\nx β‘ 2 (mod 4)\n\nYour task is to find **any non-negative integer x** that satisfies all of the above congruences.\n\n**Output Format:** Your output should be a **single integer x** that satisfies all the equations.",
"role": "use... | crt |
longestpath_diff_1_2_3616b0a045 | [
{
"content": "You are given a **directed graph** with 5 vertices, labeled from `0` to `4`.\n\nThe graph contains the following directed edges. Each edge is represented as a tuple `(s, t, w)`, meaning there is a directed edge **from vertex `s` to vertex `t` with weight `w`** :\n(1, 2, 6)\n\nYour task is to find ... | longestpath |
kingsorting_diff_2_30_dbec9c4847 | [
{
"content": "You are given `5 + 1 = 6` pairs of integers: `(A[0], B[0])`, `(a[1], b[1])`, `(a[2], b[2])`, ..., `(a[5], b[5])`\n(A[0], B[0]) = (9, 5)\n(a[1], b[1]) = (10, 1)\n(a[2], b[2]) = (10, 4)\n(a[3], b[3]) = (5, 1)\n(a[4], b[4]) = (7, 7)\n(a[5], b[5]) = (3, 2)\n\nYour task is to **rearrange the 5 pairs** ... | kingsorting |
maximumweightmatching_diff_0_29_02f82bc1bf | [
{
"content": "You are given an **undirected graph** with 5 vertices, labeled from `0` to `4`.\n\nThe graph contains the following undirected edges. Each edge is represented as a tuple `(u, v, w)`, meaning an undirected edge **connecting vertex `u` to vertex `v` with weight `w`**:\n(0, 1, 5)\n(1, 4, 1)\n(2, 4, 3... | maximumweightmatching |
treedynamic_xorzeropath_diff_2_8_ad462dfd9a | [
{
"content": "You are given a **tree** (i.e., a connected undirected graph with no cycles) with 5 vertices labeled from `0` to `4`.\n\nThe tree has the following 4 undirected edges. Each edge is represented as a tuple `(u, v, w)`, meaning there is an undirected edge between vertex `u` and vertex `v` with weight... | treedynamic |
minimum_maxslicer_diff_1_18_50719055a1 | [
{
"content": "You are given an array A of length 5. The values are as follows (indexing starts at 0):\nA[0]=4\nA[1]=15\nA[2]=11\nA[3]=8\nA[4]=7\n\nYou may divide these items (in order) into 3 **consecutive batches**. Let end[1], end[2], ..., end[3] (0 <= end[1] < end[2] < ... < end[3] = 5 - 1 = 4) represent the... | minimum |
pcppermutation_diff_2_8_6a6c5669b6 | [
{
"content": "You are given two arrays of strings, `A` and `B`, each containing 5 strings:\nA[0]=a B[0]=bb\nA[1]=b B[1]=aab\nA[2]=abbb B[2]=a\nA[3]=a B[3]=b\nA[4]=a B[4]=a\n\nFind a permutation p_0, ..., p_4 of the indices `0` to `4` such that: `A[p_0] + ... + A[p_4]` is equal to `B[p_0] + ... + B[p_4]` (here, ... | pcppermutation |
threevertexcyclecounting_diff_2_0_cf48679c3b | [
{
"content": "You are given an **undirected graph** with 7 vertices, labeled from `0` to `6`.\nThe graph contains the following undirected edges:\n(1, 4)\n(5, 6)\n(0, 3)\n(1, 5)\n(1, 2)\n(3, 4)\n(2, 4)\n(0, 6)\n(2, 3)\n(0, 5)\n(3, 5)\n(1, 3)\n(2, 5)\n(0, 4)\n(0, 2)\n\nPlease count the number of distinct **three... | threevertexcyclecounting |
minimum_maxslicer_diff_0_11_dd289969a3 | [
{
"content": "You are given an array A of length 4. The values are as follows (indexing starts at 0):\nA[0]=18\nA[1]=15\nA[2]=15\nA[3]=17\n\nYou may divide these items (in order) into 3 **consecutive batches**. Let end[1], end[2], ..., end[3] (0 <= end[1] < end[2] < ... < end[3] = 4 - 1 = 3) represent the last ... | minimum |
salesmanfatigue_diff_2_23_be11f090e7 | [
{
"content": "You are given 5 pairs of integers `(S[i], A[i])` for `0 <= i < 5`, provided as:\nS[0]=1 A[0]=7\nS[1]=1 A[1]=7\nS[2]=3 A[2]=9\nS[3]=3 A[3]=6\nS[4]=5 A[4]=3\n\n**Note:** The array `S` is sorted in non-decreasing order: `S[0] <= S[1] <= ... <= S[4]`\n\nPlease select k distinct pairs `i_1, i_2, ..., i... | salesmanfatigue |
pairmoreonecounting_diff_2_26_20b3b7b3fc | [
{
"content": "Please count the number of pairs of binary strings (S, T) such that:\n- The length of S is 16 = 13 + 3, and the length of T is 13.\n- The number of 1s in S is strictly greater than the number of 1s in T.\n\nPlease output the result modulo 10^4.",
"role": "user"
},
{
"content": "Let's i... | pairmoreonecounting |
fbi_binarytree_diff_2_7_0d4866c49b | [
{
"content": "We classify binary strings made up of only `0` and `1` into three types:\n- A string consisting of only `0`s is called a **B-string**.\n- A string consisting of only `1`s is called an **I-string**.\n- A string that contains both `0` and `1` is called an **F-string**.\n\nAn **FBI tree** is a binary... | fbi |
axis_kcenter_diff_0_30_c2f8dbf3d2 | [
{
"content": "You are given 4 points on a line, labeled from 0 to 3. Their positions (from left to right) are: 0 6 9 19\n\nPlease select a set of 3 distinct points. Try your best to minimize the total distance from all points to their nearest selected point (the distance is the absolute difference between posit... | axis |
treedynamic_xorzeropath_diff_1_5_35c3887ea7 | [
{
"content": "You are given a **tree** (i.e., a connected undirected graph with no cycles) with 4 vertices labeled from `0` to `3`.\n\nThe tree has the following 3 undirected edges. Each edge is represented as a tuple `(u, v, w)`, meaning there is an undirected edge between vertex `u` and vertex `v` with weight... | treedynamic |
gridbfs_diff_1_21_b03b1b9325 | [
{
"content": "You are given a 3 Γ 5 grid. Each cell contains `0`, `1`, or `X`. For each cell, compute its **shortest distance** to any cell containing `1`, where distance is defined as the minimum number of steps required to move from one cell to another under the following rules:\n1. You may move **up**, **dow... | gridbfs |
weightedbinarytree_diff_2_20_2f68444981 | [
{
"content": "You are given a binary tree with 5 nodes, labeled from 0 to 4.\nThe **in-order traversal** of the tree is: `0, 1, ..., 4` β that is, the in-order sequence is fixed in increasing order of node labels.\n\nEach node `i` has an associated score `d_i` (where `0 β€ i < 5`), given as:\nd_0=2\nd_1=3\nd_2=1... | weightedbinarytree |
futoshikipuzzle_diff_2_29_1bc3c31340 | [
{
"content": "You are given a 5 Γ 5 matrix. Some cells are already filled with integers in the range [0, 4], and the rest are empty (denoted by `-1`). Please fill the empty cells with integers in the same range such that:\n- Each **row** and each **column** contains all integers from `0` to `4` **exactly once**... | futoshikipuzzle |
stringpartitionshuffle_diff_1_10_f6a9c668f0 | [
{
"content": "You are given a string S of length 5 (0-indexed): 11010\n\nPlease find 3 intervals [L[1], R[1]), ..., [L[3], R[3]) such that:\n- Each interval [L[i], R[i]) is non-empty and disjoint.\n- The intervals together cover the entire string S (each index appears in exactly one interval).\n- Concatenating ... | stringpartitionshuffle |
randomrangemaxexpectation_diff_0_11_d78e73b6d7 | [
{
"content": "You are given an array of 3 integers: 3 3 1\n\nYou will perform 2 operations in order. In each operation, you uniformly select a subarray (a contiguous segment of the array) at random from all 3 Γ (3 + 1) / 2 possible subarrays. Then, all elements in that subarray are changed to the **maximum** va... | randomrangemaxexpectation |
sudoku_diff_1_24_74c8fa9864 | [
{
"content": "Solve a Sudoku puzzle of size (3 Γ 2) Γ (2 Γ 3) = 6 Γ 6. Each number is in the range from 1 to 6, and empty cells are represented by 0. Here is the input grid:\n5 0 0 0 3 0\n0 4 1 0 0 0\n3 1 6 0 0 0\n0 0 0 0 0 0\n0 0 0 6 0 3\n0 0 0 1 0 2\n\nRules of Sudoku:\n1. Each **row** must contain all digits... | sudoku |
halvingchaincounting_diff_2_19_3e0280ee65 | [
{
"content": "Construct sequences based on the following rules:\n\n1. A sequence that contains only a single number `19` is considered a valid sequence.\n2. Given any valid sequence, you can create a new valid sequence by appending a positive integer to the end β but the new number must be **at most half** of t... | halvingchaincounting |
fixedmodk_selection_counting_diff_2_29_dc428c33f0 | [
{
"content": "Please compute $$\\left( \\sum_{i = 0}^\\infty C_{nk}^{ik + r} \\right) \\bmod p$$, where n = 5, k = 4, r = 2, p = 90947.",
"role": "user"
},
{
"content": "<think>\nWe have the sum:\n\\[\n\\sum_{i=0}^\\infty C_{nk}^{ik + r}\n\\]\nwhere \\( n = 5 \\), \\( k = 4 \\), \\( r = 2 \\), and \... | fixedmodk |
topologicalsort_diff_2_2_4a25375d34 | [
{
"content": "Please find a permutation of `0` to `4` (5 integers in total) such that the following conditions are satisfied:\n2 must be before 3\n1 must be before 0\n4 must be before 0\n2 must be before 4\n3 must be before 0\n1 must be before 3\n3 must be before 4\n1 must be before 4\n2 must be before 0\n2 mus... | topologicalsort |
binaryalternation_diff_0_11_48e6bd77f0 | [
{
"content": "You are given a binary string of length 5, consisting of `0`s and `1`s. It is 0-indexed: 10110\n\nIn one operation, you may **swap** the characters at indices `i` and `j` (0 β€ i, j < 5). Please transform the string into an **alternating binary string** (no two adjacent characters are the same) usi... | binaryalternation |
doublepalindromicstringcounting_diff_2_1_0ca0cfd7a7 | [
{
"content": "We define a string `S` as **double palindromic** if it satisfies all of the following conditions:\n- Each character in `S` is an integer between `1` and `3` (inclusive).\n- `S` can be written as the concatenation of two **non-empty palindromic strings**, `S1` and `S2`, such that `S = S1 + S2`.\n\n... | doublepalindromicstringcounting |
longestpath_diff_0_18_8ed61888d5 | [
{
"content": "You are given a **directed graph** with 4 vertices, labeled from `0` to `3`.\n\nThe graph contains the following directed edges. Each edge is represented as a tuple `(s, t, w)`, meaning there is a directed edge **from vertex `s` to vertex `t` with weight `w`** :\n(2, 1, 8)\n(1, 2, 6)\n(1, 0, 8)\n(... | longestpath |
minimum_vertexcover_diff_0_5_293cebac9b | [
{
"content": "You are given an **undirected graph** with 4 vertices labeled from 0 to 3. The graph contains the following undirected edges:\n(2, 3)\n(1, 2)\n(0, 3)\n(1, 3)\n\nEach vertex has a cost, given as a list `C` of length 4, where `C[i]` is the cost of vertex i:\nC[0]=1\nC[1]=3\nC[2]=2\nC[3]=6\n\nYour ta... | minimum |
knightsandknaves_diff_1_15_4e97b2e780 | [
{
"content": "A very special island is inhabited only by knights and knaves. Knights always tell the truth, and knaves always lie. You meet 4 inhabitants: Aiden, Matthew, Jack, and Lily. Aiden said that Lily is a knave or Matthew is a knight. \"Jack is not a knave,\" Matthew declared. \"Aiden is a knight if and... | knightsandknaves |
powercycle_diff_1_17_d80ef3d2d6 | [
{
"content": "It is well known that the **last digit** of positive powers of 2 follows a repeating pattern:\n`2, 4, 8, 6, 2, 4, 8, 6, ...`.\nWe say that the **last digit** of powers of 2 has a **cycle length of 4** (there are other cycle lengths, but we focus only on the **smallest** one).\n\nNow, your task is ... | powercycle |
topologicalsort_diff_1_9_26e437499c | [
{
"content": "Please find a permutation of `0` to `3` (4 integers in total) such that the following conditions are satisfied:\n2 must be before 3\n1 must be before 3\n0 must be before 2\n0 must be before 1\n\n**Output Format:** Your final answer should be a single line containing the permutation `p(0), p(1), ..... | topologicalsort |
maxthreesquaresum_diff_2_9_448cf91ffb | [
{
"content": "You are given a grid of size 5 Γ 6, where each cell contains an integer. Please find three **non-overlapping** 2 Γ 2 squares in the grid such that the sum of all values in the three squares is maximized. The grid is provided as follows:\n2 1 1 6 5 0\n2 4 3 4 0 2\n4 4 5 0 5 3\n1 5 3 5 3 1\n1 1 0 0 ... | maxthreesquaresum |
monochromeblockcounting_diff_0_13_d4593d0a9e | [
{
"content": "You are building a **tower of blocks** with the following rules:\n- The i-th layer (from top to bottom) must contain exactly i blocks (i is from 1 to N if the tower has N layers).\n- All blocks in the same layer must be of the **same color**: either black or white.\n- You may use **at most 5 black... | monochromeblockcounting |
xorequationcounting_diff_1_0_b9953da8e5 | [
{
"content": "You are given an equation: X[1] XOR ... XOR X[3] = 24907\nThat is, the bitwise XOR of all variables X[1] through X[3] must equal the integer 24907. Each variable X[i] must satisfy the constraint: 24836 <= X[i] <= 25247 for all i = 1, ..., 3. Please compute how many such combinations of values sati... | xorequationcounting |
ldstwo_counting_diff_2_4_da97282a48 | [
{
"content": "Consider a permutation A[1], A[2], ..., A[6] of the integers 1 through 6 that satisfies the following conditions:\n- `A` is a **permutation**, meaning each integer from 1 to 6 appears **exactly once**.\n- The value at position 5 is fixed: A[5] = 3.\n- The permutation must **not contain any decreas... | ldstwo |
twiddlepuzzle_diff_2_4_5743aadcd0 | [
{
"content": "You are given a 3 Γ 4 grid, where each cell contains a digit from `0` to `11`. At any time, you may select a cell `(i, j)` such that 0 β€ i β€ 3 - 2 and 0 β€ j β€ 4 - 2. Then, you perform a **90-degree counterclockwise rotation** on the 2 Γ 2 subgrid starting at position `(i, j)`.\n\nYou start with th... | twiddlepuzzle |
longest_doublepalindrome_diff_2_26_ae735cec9c | [
{
"content": "You are given a string S of length 7 (0-indexed): 0110000\n\nPlease find two non-empty intervals [A, B) and [B, C) (obviously, 0 <= A < B < C <= 7) such that:\n- S[A : B] and S[B : C] are both palindromes (S[a : b] refers to the substring starting at index a and ending at index b - 1, i.e., S[a] +... | longest |
maze_diff_0_16_5dfa4e2f05 | [
{
"content": "You are given a 4Γ4 grid representing a maze. Each cell in the grid is either a wall (`#`) or an open space (`.`). The maze is provided in the following format:\n....\n..#.\n#..#\n....\n\nYour task is to find the **shortest path** from the top-left corner `(0, 0)` to the bottom-right corner `(3, 3... | maze |
quantumlockpuzzle_diff_0_25_966e8c1751 | [
{
"content": "There is a 0/1 variable X, which is initially 0. You also have a variable Y, which starts at 1. You can press the buttons in any order, and you may press the same button multiple times. There are 2 buttons in total. Each time you press **any** button, X toggles: it becomes 1 - X.\n\nWhen X is 0 an... | quantumlockpuzzle |
weightedbinarytree_diff_0_13_2f19af061b | [
{
"content": "You are given a binary tree with 3 nodes, labeled from 0 to 2.\nThe **in-order traversal** of the tree is: `0, 1, ..., 2` β that is, the in-order sequence is fixed in increasing order of node labels.\n\nEach node `i` has an associated score `d_i` (where `0 β€ i < 3`), given as:\nd_0=1\nd_1=5\nd_2=5... | weightedbinarytree |
binaryalternation_diff_1_12_bdc5f918a8 | [
{
"content": "You are given a binary string of length 6, consisting of `0`s and `1`s. It is 0-indexed: 101100\n\nIn one operation, you may **swap** the characters at indices `i` and `j` (0 β€ i, j < 6). Please transform the string into an **alternating binary string** (no two adjacent characters are the same) us... | binaryalternation |
fractionalprogramming_diff_1_12_980b667fb6 | [
{
"content": "You are given two arrays `A` and `B`, each containing 4 integers:\nA[0]=12 B[0]=9\nA[1]=0 B[1]=17\nA[2]=11 B[2]=12\nA[3]=7 B[3]=5\n\nPlease select 3 **distinct indices** `i_1, ..., i_3` to maximize the value of `(A[i_1] + ... + A[i_3]) / (B[i_1] + ... + B[i_3])`\n\n**Output Format:** Your final an... | fractionalprogramming |
polynomialfactorization_diff_1_27_0a46a836b5 | [
{
"content": "You are given a degree-4 polynomial: (x - a_1)...(x - a_4) = (-3) * x^2 + (-2) * x^3 + (1) * x^4\n\nYour task is to find any valid set of integers `a_1, ..., a_4` (not necessarily distinct) such that the product of the linear factors on the left expands to match the given polynomial.\n\n**Output F... | polynomialfactorization |
magicsquarepuzzle_diff_1_21_642036787c | [
{
"content": "Given a grid of size 4 Γ 4 filled with integers, some cells may be empty (represented by `0`). Please complete the grid to form a **magic square**, such that:\n1. Each integer from `1` to `4^2` appears **exactly once**.\n2. The sum of each row, each column, and both main diagonals is equal to 4 * ... | magicsquarepuzzle |
quantumlockpuzzle_diff_2_2_1b0d3b9cfb | [
{
"content": "There is a 0/1 variable X, which is initially 0. You also have a variable Y, which starts at -4. You can press the buttons in any order, and you may press the same button multiple times. There are 4 buttons in total. Each time you press **any** button, X toggles: it becomes 1 - X.\n\nWhen X is 0 a... | quantumlockpuzzle |
sumgcd_diff_0_7_1b40233268 | [
{
"content": "Please compute sum(GCD(i, j)^4) for all pairs (i, j) such that 1 β€ i β€ 7 and 1 β€ j β€ 4. Here, GCD(i, j) denotes the **greatest common divisor** of integers i and j, and x^4 denotes x raised to the power of K.\n\n**Output Format:** Your final answer should be a single integer β the sum of GCD(i, j)... | sumgcd |
divisorflipexpectation_diff_0_10_0216a6638d | [
{
"content": "You are given 3 lights labeled from 1 to 3, each in an initial state: `1` (on) or `0` (off). The initial state is:\nLight 1: 0\nLight 2: 0\nLight 3: 0\n\nEach light can be toggled by pressing switches. There are 3 switches, and pressing switch `i` will **toggle the state** of all lights whose indi... | divisorflipexpectation |
gridbfs_diff_0_17_9730391e9e | [
{
"content": "You are given a 4 Γ 3 grid. Each cell contains `0`, `1`, or `X`. For each cell, compute its **shortest distance** to any cell containing `1`, where distance is defined as the minimum number of steps required to move from one cell to another under the following rules:\n1. You may move **up**, **dow... | gridbfs |
maximum_independentset_tree_diff_1_9_a4decb3662 | [
{
"content": "You are given a **tree** (i.e., a connected undirected graph with no cycles) with 5 vertices, labeled from `0` to `4`.\n\nThe tree contains the following 5 - 1 = 4 undirected edges. Each edge is represented as a tuple `(u, v)`, meaning there is an undirected edge **connecting vertex `u` to vertex ... | maximum |
boundedintervalintersection_diff_1_5_a1146bbae4 | [
{
"content": "An interval [l, r]'s length is defined as r - l. The length of an **empty intersection** is considered to be 0. The **intersection** of a set of intervals is the range covered by all of them simultaneously.\n\nYou are given 4 intervals:\n[65, 110]\n[7, 114]\n[119, 122]\n[13, 128]\n\nPlease count h... | boundedintervalintersection |
sorting_diff_2_28_78365ad164 | [
{
"content": "You are given the following list of numbers:\n3 23 4 17 19\nPlease sort them in **ascending order**.\n\nYour final answer should be a single line containing the sorted numbers, separated by **spaces**.\nFor example: `1 2 3 4 5` (do **NOT** include the backticks or quotes).",
"role": "user"
}... | sorting |
constructhackinterval_diff_2_13_076b9bd240 | [
{
"content": "Let's define f(x) as the sum of digits in the decimal representation of number x (for example, f(1234) = 1 + 2 + 3 + 4). Please construct an interval [L, R], such that the sum of f(x) for all x in the interval is divisible by 14.\nNote that L and R should be both positive integers, L should be les... | constructhackinterval |
sameadjacencycounting_diff_2_31_f81771ca13 | [
{
"content": "Count the number of length-2 sequences using integers from `1` to `5` such that **at least one pair of adjacent elements is equal**. Output the result modulo 5.",
"role": "user"
},
{
"content": "<think>\nWe are asked for the number of length-2 sequences with integers from 1 to 5 (inclu... | sameadjacencycounting |
whackamole_diff_0_20_84c4990dc4 | [
{
"content": "You are given an 2 Γ 3 grid, where each cell contains a non-negative integer representing the number of moles in that hole:\n2 2 2\n2 2 2\n\nYou are allowed to define a **fixed** hammer size of r Γ c (1 β€ r β€ 2, 1 β€ c β€ 3) before starting. Each time you swing the hammer:\n- You choose an r Γ c sub... | whackamole |
fractionalprogramming_diff_0_11_4686d15078 | [
{
"content": "You are given two arrays `A` and `B`, each containing 3 integers:\nA[0]=32 B[0]=18\nA[1]=27 B[1]=15\nA[2]=18 B[2]=15\n\nPlease select 2 **distinct indices** `i_1, ..., i_2` to maximize the value of `(A[i_1] + ... + A[i_2]) / (B[i_1] + ... + B[i_2])`\n\n**Output Format:** Your final answer should b... | fractionalprogramming |
weightedlis_diff_2_28_68f02d949a | [
{
"content": "You are given two arrays `A` and `B`, each of length 6. Their values are (indexing starts at 0):\nA[0]=1 A[1]=2 A[2]=8 A[3]=9 A[4]=2 A[5]=3\nB[0]=3 B[1]=8 B[2]=7 B[3]=4 B[4]=4 B[5]=3\n\nYour task is to select a strictly increasing sequence of indices `i1, i2, ..., ik` such that:\n- 0 β€ i1 < i2 < .... | weightedlis |
countdownequal_diff_2_25_1d2f5290f5 | [
{
"content": "You are given the following numbers: 1 14 20 31 3\nYour task is to create a valid mathematical expression that evaluates to the target number: **193**.\n\nConstraints:\n- Use **each number exactly once**\n- Only these basic arithmetic operations are allowed: +, -, *, /\n- You may use **parentheses... | countdownequal |
minimumchromaticnumber_diff_0_28_256b0fc8b3 | [
{
"content": "You are given an **undirected graph** with 5 vertices, labeled from `0` to `4`.\nThe graph contains the following undirected edges:\n(0, 2)\n(1, 4)\n(1, 3)\n(1, 2)\n(0, 3)\n(2, 3)\n(2, 4)\n(3, 4)\n(0, 1)\n\nYour task is to assign a **non-negative integer color** to each vertex, represented as `c[0... | minimumchromaticnumber |
nandresultcounting_diff_0_7_01dad6086f | [
{
"content": "From now on, all numbers are treated as 2-bit binary strings (i.e., only the lowest 2 bits are considered, and leading zeros may be added to fill up to 2 bits).\n\nThe **NAND** operation is defined as:\n- 0 NAND 0 = 1\n- 0 NAND 1 = 1 NAND 0 = 1\n- 1 NAND 1 = 0\n\nYou are given the following 3 numb... | nandresultcounting |
numberpartitioncounting_diff_2_11_0124cc3fc3 | [
{
"content": "You are given a positive integer 15. Your task is to divide it into exactly 14 **non-empty** positive integers such that:\n\n- The **sum** of the 14 parts is exactly 15,\n- The **order does not matter** β that is, two partitions are considered the same if they contain the same numbers, regardless ... | numberpartitioncounting |
countdownclose_diff_0_2_dfd3b9c257 | [
{
"content": "You are given the following numbers: 2 2 6\nYour task is to create a valid mathematical expression whose result has the **minimal absolute difference** from the target number: **7**. Try your best to get as close to the target as possible.\n\nConstraints:\n- Use **each number exactly once**\n- Onl... | countdownclose |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.