chosen listlengths 2 2 | rejected listlengths 2 2 |
|---|---|
[
{
"content": "Question:\nIn AtCoder Land, there are N popcorn stands numbered 1 to N. They have M different flavors of popcorn, labeled 1, 2, \\dots, M, but not every stand sells all flavors of popcorn.\nTakahashi has obtained information about which flavors of popcorn are sold at each stand. This information i... | [
{
"content": "Question:\nIn AtCoder Land, there are N popcorn stands numbered 1 to N. They have M different flavors of popcorn, labeled 1, 2, \\dots, M, but not every stand sells all flavors of popcorn.\nTakahashi has obtained information about which flavors of popcorn are sold at each stand. This information i... |
[
{
"content": "Question:\nA sequence X = (X_1, X_2, \\ldots) of positive integers (possibly empty) is called a 1122 sequence if and only if it satisfies all of the following three conditions: (The definition of a 1122 sequence is the same as in Problem F.)\n\n- \\lvert X \\rvert is even. Here, \\lvert X \\rvert ... | [
{
"content": "Question:\nA sequence X = (X_1, X_2, \\ldots) of positive integers (possibly empty) is called a 1122 sequence if and only if it satisfies all of the following three conditions: (The definition of a 1122 sequence is the same as in Problem F.)\n\n- \\lvert X \\rvert is even. Here, \\lvert X \\rvert ... |
[
{
"content": "Question:\nYou are given an integer array nums of length n.\nYour goal is to start at index 0 and reach index n - 1. You can only jump to indices greater than your current index.\nThe score for a jump from index i to index j is calculated as (j - i) * nums[i].\nReturn the maximum possible total sc... | [
{
"content": "Question:\nYou are given an integer array nums of length n.\nYour goal is to start at index 0 and reach index n - 1. You can only jump to indices greater than your current index.\nThe score for a jump from index i to index j is calculated as (j - i) * nums[i].\nReturn the maximum possible total sc... |
[
{
"content": "Question:\nYou are given an integer mountainHeight denoting the height of a mountain.\nYou are also given an integer array workerTimes representing the work time of workers in seconds.\nThe workers work simultaneously to reduce the height of the mountain. For worker i:\n\nTo decrease the mountain'... | [
{
"content": "Question:\nYou are given an integer mountainHeight denoting the height of a mountain.\nYou are also given an integer array workerTimes representing the work time of workers in seconds.\nThe workers work simultaneously to reduce the height of the mountain. For worker i:\n\nTo decrease the mountain'... |
[
{
"content": "Question:\nThere is a grid of H \\times W cells. Let (i, j) denote the cell at the i-th row from the top and the j-th column from the left.\nCell (i, j) is empty if S_{i,j} is ., and blocked if it is #.\nCount the number of ways to start from an empty cell and make K moves to adjacent cells (up, d... | [
{
"content": "Question:\nThere is a grid of H \\times W cells. Let (i, j) denote the cell at the i-th row from the top and the j-th column from the left.\nCell (i, j) is empty if S_{i,j} is ., and blocked if it is #.\nCount the number of ways to start from an empty cell and make K moves to adjacent cells (up, d... |
[
{
"content": "Question:\nThere are N buildings numbered 1 to N on a number line.\nBuilding i is at coordinate X_i and has height H_i. The size in directions other than height is negligible.\nFrom a point P with coordinate x and height h, building i is considered visible if there exists a point Q on building i s... | [
{
"content": "Question:\nThere are N buildings numbered 1 to N on a number line.\nBuilding i is at coordinate X_i and has height H_i. The size in directions other than height is negligible.\nFrom a point P with coordinate x and height h, building i is considered visible if there exists a point Q on building i s... |
[
{
"content": "Question:\nThis problem fully contains Problem C (Operate 1), with K \\le 20.\nYou can solve Problem C by submitting a correct solution to this problem for Problem C.\nDetermine whether it is possible to perform the following operation on string S between 0 and K times, inclusive, to make it ident... | [
{
"content": "Question:\nThis problem fully contains Problem C (Operate 1), with K \\le 20.\nYou can solve Problem C by submitting a correct solution to this problem for Problem C.\nDetermine whether it is possible to perform the following operation on string S between 0 and K times, inclusive, to make it ident... |
[
{
"content": "Question:\nThere is a grid of H \\times W cells. Let (i, j) denote the cell at the i-th row from the top and the j-th column from the left.\nCell (i, j) is empty if S_{i,j} is ., and blocked if it is #.\nCount the number of ways to start from an empty cell and make K moves to adjacent cells (up, d... | [
{
"content": "Question:\nThere is a grid of H \\times W cells. Let (i, j) denote the cell at the i-th row from the top and the j-th column from the left.\nCell (i, j) is empty if S_{i,j} is ., and blocked if it is #.\nCount the number of ways to start from an empty cell and make K moves to adjacent cells (up, d... |
[
{
"content": "Question:\nYou are given a string target, an array of strings words, and an integer array costs, both arrays of the same length.\nImagine an empty string s.\nYou can perform the following operation any number of times (including zero):\n\nChoose an index i in the range [0, words.length - 1].\nAppe... | [
{
"content": "Question:\nYou are given a string target, an array of strings words, and an integer array costs, both arrays of the same length.\nImagine an empty string s.\nYou can perform the following operation any number of times (including zero):\n\nChoose an index i in the range [0, words.length - 1].\nAppe... |
[
{
"content": "Question:\nThere is a printing machine that prints line segments on the xy-plane by emitting a laser.\n\n- At the start of printing, the laser position is at coordinate (0, 0).\n- \nWhen printing a line segment, the procedure below is followed.\n\n- First, move the laser position to one of the end... | [
{
"content": "Question:\nThere is a printing machine that prints line segments on the xy-plane by emitting a laser.\n\n- At the start of printing, the laser position is at coordinate (0, 0).\n- \nWhen printing a line segment, the procedure below is followed.\n\n- First, move the laser position to one of the end... |
[
{
"content": "Question:\nThere are N buildings numbered 1 to N on a number line.\nBuilding i is at coordinate X_i and has height H_i. The size in directions other than height is negligible.\nFrom a point P with coordinate x and height h, building i is considered visible if there exists a point Q on building i s... | [
{
"content": "Question:\nThere are N buildings numbered 1 to N on a number line.\nBuilding i is at coordinate X_i and has height H_i. The size in directions other than height is negligible.\nFrom a point P with coordinate x and height h, building i is considered visible if there exists a point Q on building i s... |
[
{
"content": "Question:\nYou are given a string s.\nWe define the mirror of a letter in the English alphabet as its corresponding letter when the alphabet is reversed. For example, the mirror of 'a' is 'z', and the mirror of 'y' is 'b'.\nInitially, all characters in the string s are unmarked.\nYou start with a ... | [
{
"content": "Question:\nYou are given a string s.\nWe define the mirror of a letter in the English alphabet as its corresponding letter when the alphabet is reversed. For example, the mirror of 'a' is 'z', and the mirror of 'y' is 'b'.\nInitially, all characters in the string s are unmarked.\nYou start with a ... |
[
{
"content": "Question:\nYou are given an integer array a of size 4 and another integer array b of size at least 4.\nYou need to choose 4 indices i_0, i_1, i_2, and i_3 from the array b such that i_0 < i_1 < i_2 < i_3. Your score will be equal to the value a[0] * b[i_0] + a[1] * b[i_1] + a[2] * b[i_2] + a[3] * ... | [
{
"content": "Question:\nYou are given an integer array a of size 4 and another integer array b of size at least 4.\nYou need to choose 4 indices i_0, i_1, i_2, and i_3 from the array b such that i_0 < i_1 < i_2 < i_3. Your score will be equal to the value a[0] * b[i_0] + a[1] * b[i_1] + a[2] * b[i_2] + a[3] * ... |
[
{
"content": "Question:\nYou are given a sequence A of length N.\r\nFreely choose exactly K elements from A and remove them, then concatenate the remaining elements in their original order to form a new sequence B.\r\nFind the minimum possible value of this: the maximum value of B minus the minimum value of B.\... | [
{
"content": "Question:\nYou are given a sequence A of length N.\r\nFreely choose exactly K elements from A and remove them, then concatenate the remaining elements in their original order to form a new sequence B.\r\nFind the minimum possible value of this: the maximum value of B minus the minimum value of B.\... |
[
{
"content": "Question:\nYou are given an array of integers start and an integer d, representing n intervals [start[i], start[i] + d].\nYou are asked to choose n integers where the i^th integer must belong to the i^th interval. The score of the chosen integers is defined as the minimum absolute difference betwe... | [
{
"content": "Question:\nYou are given an array of integers start and an integer d, representing n intervals [start[i], start[i] + d].\nYou are asked to choose n integers where the i^th integer must belong to the i^th interval. The score of the chosen integers is defined as the minimum absolute difference betwe... |
[
{
"content": "Question:\nYou are given an array nums consisting of positive integers.\nWe call two integers x and y in this problem almost equal if both integers can become equal after performing the following operation at most once:\n\nChoose either x or y and swap any two digits within the chosen number.\n\nR... | [
{
"content": "Question:\nYou are given an array nums consisting of positive integers.\nWe call two integers x and y in this problem almost equal if both integers can become equal after performing the following operation at most once:\n\nChoose either x or y and swap any two digits within the chosen number.\n\nR... |
[
{
"content": "Question:\nThere are N buildings numbered 1 to N on a number line.\nBuilding i is at coordinate X_i and has height H_i. The size in directions other than height is negligible.\nFrom a point P with coordinate x and height h, building i is considered visible if there exists a point Q on building i s... | [
{
"content": "Question:\nThere are N buildings numbered 1 to N on a number line.\nBuilding i is at coordinate X_i and has height H_i. The size in directions other than height is negligible.\nFrom a point P with coordinate x and height h, building i is considered visible if there exists a point Q on building i s... |
[
{
"content": "Question:\nThere are N+2 cells arranged in a row. Let cell i denote the i-th cell from the left.\nThere is one stone placed in each of the cells from cell 1 to cell N.\r\nFor each 1 \\leq i \\leq N, the stone in cell i is white if S_i is W, and black if S_i is B.\r\nCells N+1 and N+2 are empty.\nY... | [
{
"content": "Question:\nThere are N+2 cells arranged in a row. Let cell i denote the i-th cell from the left.\nThere is one stone placed in each of the cells from cell 1 to cell N.\r\nFor each 1 \\leq i \\leq N, the stone in cell i is white if S_i is W, and black if S_i is B.\r\nCells N+1 and N+2 are empty.\nY... |
[
{
"content": "Question:\nIn the Kingdom of AtCoder, the eldest son is always given the name Taro. No one else is given the name Taro.\nThe eldest son is the earliest born male child in each family.\nThere are N families in the Kingdom, and M babies were born. Before the M babies were born, none of the N famili... | [
{
"content": "Question:\nIn the Kingdom of AtCoder, the eldest son is always given the name Taro. No one else is given the name Taro.\nThe eldest son is the earliest born male child in each family.\nThere are N families in the Kingdom, and M babies were born. Before the M babies were born, none of the N famili... |
[
{
"content": "Question:\nIn the nation of AtCoder, there are N cities numbered 1 to N and N-1 roads numbered 1 to N-1.\nRoad i connects cities A_i and B_i bidirectionally, and its length is C_i. Any pair of cities can be reached from each other by traveling through some roads.\nFind the minimum travel distance ... | [
{
"content": "Question:\nIn the nation of AtCoder, there are N cities numbered 1 to N and N-1 roads numbered 1 to N-1.\nRoad i connects cities A_i and B_i bidirectionally, and its length is C_i. Any pair of cities can be reached from each other by traveling through some roads.\nFind the minimum travel distance ... |
[
{
"content": "Question:\nA sequence X = (X_1, X_2, \\ldots) of positive integers (possibly empty) is called a 1122 sequence if and only if it satisfies all of the following three conditions: (The definition of a 1122 sequence is the same as in Problem F.)\n\n- \\lvert X \\rvert is even. Here, \\lvert X \\rvert ... | [
{
"content": "Question:\nA sequence X = (X_1, X_2, \\ldots) of positive integers (possibly empty) is called a 1122 sequence if and only if it satisfies all of the following three conditions: (The definition of a 1122 sequence is the same as in Problem F.)\n\n- \\lvert X \\rvert is even. Here, \\lvert X \\rvert ... |
[
{
"content": "Question:\nYou are given a binary string s and an integer k.\nA binary string satisfies the k-constraint if either of the following conditions holds:\n\nThe number of 0's in the string is at most k.\nThe number of 1's in the string is at most k.\n\nReturn an integer denoting the number of substrin... | [
{
"content": "Question:\nYou are given a binary string s and an integer k.\nA binary string satisfies the k-constraint if either of the following conditions holds:\n\nThe number of 0's in the string is at most k.\nThe number of 1's in the string is at most k.\n\nReturn an integer denoting the number of substrin... |
[
{
"content": "Question:\nThere is a grid of H \\times W cells. Let (i, j) denote the cell at the i-th row from the top and the j-th column from the left.\nCell (i, j) is empty if S_{i,j} is ., and blocked if it is #.\nCount the number of ways to start from an empty cell and make K moves to adjacent cells (up, d... | [
{
"content": "Question:\nThere is a grid of H \\times W cells. Let (i, j) denote the cell at the i-th row from the top and the j-th column from the left.\nCell (i, j) is empty if S_{i,j} is ., and blocked if it is #.\nCount the number of ways to start from an empty cell and make K moves to adjacent cells (up, d... |
[
{
"content": "Question:\nYou are given a string target, an array of strings words, and an integer array costs, both arrays of the same length.\nImagine an empty string s.\nYou can perform the following operation any number of times (including zero):\n\nChoose an index i in the range [0, words.length - 1].\nAppe... | [
{
"content": "Question:\nYou are given a string target, an array of strings words, and an integer array costs, both arrays of the same length.\nImagine an empty string s.\nYou can perform the following operation any number of times (including zero):\n\nChoose an index i in the range [0, words.length - 1].\nAppe... |
[
{
"content": "Question:\nYou are given an integer array nums and a non-negative integer k. A sequence of integers seq is called good if there are at most k indices i in the range [0, seq.length - 2] such that seq[i] != seq[i + 1].\nReturn the maximum possible length of a good subsequence of nums.\n \nExample 1:... | [
{
"content": "Question:\nYou are given an integer array nums and a non-negative integer k. A sequence of integers seq is called good if there are at most k indices i in the range [0, seq.length - 2] such that seq[i] != seq[i + 1].\nReturn the maximum possible length of a good subsequence of nums.\n \nExample 1:... |
[
{
"content": "Question:\nAs KEYENCE headquarters have more and more workers, they decided to divide the departments in the headquarters into two groups and stagger their lunch breaks.\nKEYENCE headquarters have N departments, and the number of people in the i-th department (1\\leq i\\leq N) is K_i.\nWhen assign... | [
{
"content": "Question:\nAs KEYENCE headquarters have more and more workers, they decided to divide the departments in the headquarters into two groups and stagger their lunch breaks.\nKEYENCE headquarters have N departments, and the number of people in the i-th department (1\\leq i\\leq N) is K_i.\nWhen assign... |
[
{
"content": "Question:\nTakahashi has a piano with 100 keys arranged in a row.\r\nThe i-th key from the left is called key i.\nHe will play music by pressing N keys one by one.\r\nFor the i-th press, he will press key A_i, using his left hand if S_i= L, and his right hand if S_i= R.\nBefore starting to play, h... | [
{
"content": "Question:\nTakahashi has a piano with 100 keys arranged in a row.\r\nThe i-th key from the left is called key i.\nHe will play music by pressing N keys one by one.\r\nFor the i-th press, he will press key A_i, using his left hand if S_i= L, and his right hand if S_i= R.\nBefore starting to play, h... |
[
{
"content": "Question:\nFor a positive integer N, let V_N be the integer formed by concatenating N exactly N times.\r\nMore precisely, consider N as a string, concatenate N copies of it, and treat the result as an integer to get V_N.\r\nFor example, V_3=333 and V_{10}=10101010101010101010.\nFind the remainder ... | [
{
"content": "Question:\nFor a positive integer N, let V_N be the integer formed by concatenating N exactly N times.\r\nMore precisely, consider N as a string, concatenate N copies of it, and treat the result as an integer to get V_N.\r\nFor example, V_3=333 and V_{10}=10101010101010101010.\nFind the remainder ... |
[
{
"content": "Question:\nThe AtCoder company office can be represented as a grid of H rows and W columns. Let (i, j) denote the cell at the i-th row from the top and j-th column from the left.\nThe state of each cell is represented by a character S_{i,j}. If S_{i,j} is #, that cell contains a desk; if S_{i,j} i... | [
{
"content": "Question:\nThe AtCoder company office can be represented as a grid of H rows and W columns. Let (i, j) denote the cell at the i-th row from the top and j-th column from the left.\nThe state of each cell is represented by a character S_{i,j}. If S_{i,j} is #, that cell contains a desk; if S_{i,j} i... |
[
{
"content": "Question:\nYou are given an integer array a of size 4 and another integer array b of size at least 4.\nYou need to choose 4 indices i_0, i_1, i_2, and i_3 from the array b such that i_0 < i_1 < i_2 < i_3. Your score will be equal to the value a[0] * b[i_0] + a[1] * b[i_1] + a[2] * b[i_2] + a[3] * ... | [
{
"content": "Question:\nYou are given an integer array a of size 4 and another integer array b of size at least 4.\nYou need to choose 4 indices i_0, i_1, i_2, and i_3 from the array b such that i_0 < i_1 < i_2 < i_3. Your score will be equal to the value a[0] * b[i_0] + a[1] * b[i_1] + a[2] * b[i_2] + a[3] * ... |
[
{
"content": "Question:\nThe AtCoder company office can be represented as a grid of H rows and W columns. Let (i, j) denote the cell at the i-th row from the top and j-th column from the left.\nThe state of each cell is represented by a character S_{i,j}. If S_{i,j} is #, that cell contains a desk; if S_{i,j} i... | [
{
"content": "Question:\nThe AtCoder company office can be represented as a grid of H rows and W columns. Let (i, j) denote the cell at the i-th row from the top and j-th column from the left.\nThe state of each cell is represented by a character S_{i,j}. If S_{i,j} is #, that cell contains a desk; if S_{i,j} i... |
[
{
"content": "Question:\nYou are given an m x n binary matrix grid and an integer health.\nYou start on the upper-left corner (0, 0) and would like to get to the lower-right corner (m - 1, n - 1).\nYou can move up, down, left, or right from one cell to another adjacent cell as long as your health remains positi... | [
{
"content": "Question:\nYou are given an m x n binary matrix grid and an integer health.\nYou start on the upper-left corner (0, 0) and would like to get to the lower-right corner (m - 1, n - 1).\nYou can move up, down, left, or right from one cell to another adjacent cell as long as your health remains positi... |
[
{
"content": "Question:\nYou are given a string target, an array of strings words, and an integer array costs, both arrays of the same length.\nImagine an empty string s.\nYou can perform the following operation any number of times (including zero):\n\nChoose an index i in the range [0, words.length - 1].\nAppe... | [
{
"content": "Question:\nYou are given a string target, an array of strings words, and an integer array costs, both arrays of the same length.\nImagine an empty string s.\nYou can perform the following operation any number of times (including zero):\n\nChoose an index i in the range [0, words.length - 1].\nAppe... |
[
{
"content": "Question:\nFind the number of positive integers not greater than N that have exactly 9 positive divisors.\n\nInput\n\nThe input is given from Standard Input in the following format:\nN\n\nOutput\n\nPrint the answer.\n\nConstraints\n\n\n- 1 \\leq N \\leq 4 \\times 10^{12}\n- All input values are in... | [
{
"content": "Question:\nFind the number of positive integers not greater than N that have exactly 9 positive divisors.\n\nInput\n\nThe input is given from Standard Input in the following format:\nN\n\nOutput\n\nPrint the answer.\n\nConstraints\n\n\n- 1 \\leq N \\leq 4 \\times 10^{12}\n- All input values are in... |
[
{
"content": "Question:\nIn the nation of AtCoder, there are N cities numbered 1 to N and N-1 roads numbered 1 to N-1.\nRoad i connects cities A_i and B_i bidirectionally, and its length is C_i. Any pair of cities can be reached from each other by traveling through some roads.\nFind the minimum travel distance ... | [
{
"content": "Question:\nIn the nation of AtCoder, there are N cities numbered 1 to N and N-1 roads numbered 1 to N-1.\nRoad i connects cities A_i and B_i bidirectionally, and its length is C_i. Any pair of cities can be reached from each other by traveling through some roads.\nFind the minimum travel distance ... |
[
{
"content": "Question:\nYou are given a string s.\nWe define the mirror of a letter in the English alphabet as its corresponding letter when the alphabet is reversed. For example, the mirror of 'a' is 'z', and the mirror of 'y' is 'b'.\nInitially, all characters in the string s are unmarked.\nYou start with a ... | [
{
"content": "Question:\nYou are given a string s.\nWe define the mirror of a letter in the English alphabet as its corresponding letter when the alphabet is reversed. For example, the mirror of 'a' is 'z', and the mirror of 'y' is 'b'.\nInitially, all characters in the string s are unmarked.\nYou start with a ... |
[
{
"content": "Question:\nThere are N buildings aligned in a row. The i-th building from the left has a height of H_i.\nDetermine if there is a building taller than the first one from the left. If such a building exists, find the position of the leftmost such building from the left.\n\nInput\n\nThe input is give... | [
{
"content": "Question:\nThere are N buildings aligned in a row. The i-th building from the left has a height of H_i.\nDetermine if there is a building taller than the first one from the left. If such a building exists, find the position of the leftmost such building from the left.\n\nInput\n\nThe input is give... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 30