chosen
listlengths
2
2
rejected
listlengths
2
2
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an m x n binary matrix grid.\nA row or column is considered palindro...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an m x n binary matrix grid.\nA row or column is considered palindro...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLet quasi-palindromic number be such number that adding some leading zeros (possib...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLet quasi-palindromic number be such number that adding some leading zeros (possib...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a horizontally written text. Convert it to vertical writing, filling...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a horizontally written text. Convert it to vertical writing, filling...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a sequence of N positive integers A = (A_1, A_2, \\dots ,A_N), where...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a sequence of N positive integers A = (A_1, A_2, \\dots ,A_N), where...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a sequence X of length N where each element is between 1 and N, incl...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a sequence X of length N where each element is between 1 and N, incl...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere is a grid with H rows and W columns.\r\nLet (i,j) denote the cell at the i-t...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere is a grid with H rows and W columns.\r\nLet (i,j) denote the cell at the i-t...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a string S consisting of uppercase and lowercase English letters. \...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a string S consisting of uppercase and lowercase English letters. \...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given two strings S and T consisting of lowercase English letters. Here, S...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given two strings S and T consisting of lowercase English letters. Here, S...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLet quasi-palindromic number be such number that adding some leading zeros (possib...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLet quasi-palindromic number be such number that adding some leading zeros (possib...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an m x n binary matrix grid and an integer health.\nYou start on the...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an m x n binary matrix grid and an integer health.\nYou start on the...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N buildings numbered 1 to N on a number line.\nBuilding i is at coordina...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N buildings numbered 1 to N on a number line.\nBuilding i is at coordina...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are $n$ students in the first grade of Nlogonia high school. The principal w...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are $n$ students in the first grade of Nlogonia high school. The principal w...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nAs a programmer, you sometimes have to deal with some math and this is the time to...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nAs a programmer, you sometimes have to deal with some math and this is the time to...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nWatchmen are in a danger and Doctor Manhattan together with his friend Daniel Drei...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nWatchmen are in a danger and Doctor Manhattan together with his friend Daniel Drei...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nIn the nation of AtCoder, there are N cities numbered 1 to N and N-1 roads numbere...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nIn the nation of AtCoder, there are N cities numbered 1 to N and N-1 roads numbere...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N cells numbered from 1 to N in a row. Initially, M cells contain stones...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N cells numbered from 1 to N in a row. Initially, M cells contain stones...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nConsider a rooted tree. A rooted tree has one special vertex called the root. All ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nConsider a rooted tree. A rooted tree has one special vertex called the root. All ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nConnected undirected weighted graph without self-loops and multiple edges is given...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nConnected undirected weighted graph without self-loops and multiple edges is given...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a binary string s and an integer k.\nA binary string satisfies the k...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a binary string s and an integer k.\nA binary string satisfies the k...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLittle penguin Polo has an n × m matrix, consisting of integers. Let's index the m...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLittle penguin Polo has an n × m matrix, consisting of integers. Let's index the m...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLet quasi-palindromic number be such number that adding some leading zeros (possib...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLet quasi-palindromic number be such number that adding some leading zeros (possib...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nOkabe and Super Hacker Daru are stacking and removing boxes. There are n boxes num...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nOkabe and Super Hacker Daru are stacking and removing boxes. There are n boxes num...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an array of integers start and an integer d, representing n interval...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an array of integers start and an integer d, representing n interval...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\n$n$ distinct integers $x_1,x_2,\\ldots,x_n$ are written on the board. Nezzar can p...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\n$n$ distinct integers $x_1,x_2,\\ldots,x_n$ are written on the board. Nezzar can p...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given two binary square matrices $a$ and $b$ of size $n \\times n$. A matr...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given two binary square matrices $a$ and $b$ of size $n \\times n$. A matr...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nSometimes it is not easy to come to an agreement in a bargain. Right now Sasha and...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nSometimes it is not easy to come to an agreement in a bargain. Right now Sasha and...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLet quasi-palindromic number be such number that adding some leading zeros (possib...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nLet quasi-palindromic number be such number that adding some leading zeros (possib...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are $n$ students in the first grade of Nlogonia high school. The principal w...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are $n$ students in the first grade of Nlogonia high school. The principal w...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nWhen Xellos was doing a practice course in university, he once had to measure the ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nWhen Xellos was doing a practice course in university, he once had to measure the ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese and Russian. \nA number is called as...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese and Russian. \nA number is called as...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an array of integers start and an integer d, representing n interval...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an array of integers start and an integer d, representing n interval...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nSince Sonya is interested in robotics too, she decided to construct robots that wi...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nSince Sonya is interested in robotics too, she decided to construct robots that wi...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a tree (a connected undirected graph without cycles) of $n$ vertices...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a tree (a connected undirected graph without cycles) of $n$ vertices...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA competition consists of n players numbered from 0 to n - 1.\nYou are given an in...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA competition consists of n players numbered from 0 to n - 1.\nYou are given an in...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given two strings S and T consisting of lowercase English letters. Here, S...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given two strings S and T consisting of lowercase English letters. Here, S...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nTakahashi and Aoki will play a game using cards with numbers written on them.\nIni...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nTakahashi and Aoki will play a game using cards with numbers written on them.\nIni...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe AtCoder company office can be represented as a grid of H rows and W columns. L...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe AtCoder company office can be represented as a grid of H rows and W columns. L...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a horizontally written text. Convert it to vertical writing, filling...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a horizontally written text. Convert it to vertical writing, filling...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nOkabe and Super Hacker Daru are stacking and removing boxes. There are n boxes num...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nOkabe and Super Hacker Daru are stacking and removing boxes. There are n boxes num...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a sequence of integers A = (A_1, A_2, \\ldots, A_N) of length N.\r\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a sequence of integers A = (A_1, A_2, \\ldots, A_N) of length N.\r\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an array $A$ consisting of $N$ Integers which are initially all $0$....
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an array $A$ consisting of $N$ Integers which are initially all $0$....
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nNatasha is going to fly on a rocket to Mars and return to Earth. Also, on the way ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nNatasha is going to fly on a rocket to Mars and return to Earth. Also, on the way ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nJanusz is a businessman. He owns a company \"Januszex\", which produces games for ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nJanusz is a businessman. He owns a company \"Januszex\", which produces games for ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nOkabe and Super Hacker Daru are stacking and removing boxes. There are n boxes num...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nOkabe and Super Hacker Daru are stacking and removing boxes. There are n boxes num...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a positive integer days representing the total number of days an emp...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a positive integer days representing the total number of days an emp...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA sequence X = (X_1, X_2, \\ldots) of positive integers (possibly empty) is called...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA sequence X = (X_1, X_2, \\ldots) of positive integers (possibly empty) is called...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given 2 arrays $a$ and $b$, both of size $n$. You can swap two elements in...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given 2 arrays $a$ and $b$, both of size $n$. You can swap two elements in...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an integer array a of size 4 and another integer array b of size at ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an integer array a of size 4 and another integer array b of size at ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nStack has a positive integer P(P > 1). \nHe starts a game where his initial score...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nStack has a positive integer P(P > 1). \nHe starts a game where his initial score...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nOkabe and Super Hacker Daru are stacking and removing boxes. There are n boxes num...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nOkabe and Super Hacker Daru are stacking and removing boxes. There are n boxes num...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere is a grid with H rows and W columns.\r\nLet (i,j) denote the cell at the i-t...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere is a grid with H rows and W columns.\r\nLet (i,j) denote the cell at the i-t...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA peak in an array arr is an element that is greater than its previous and next el...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA peak in an array arr is an element that is greater than its previous and next el...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese and Russian. \n\nTuzik and his maste...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese and Russian. \n\nTuzik and his maste...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nSince Sonya is interested in robotics too, she decided to construct robots that wi...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nSince Sonya is interested in robotics too, she decided to construct robots that wi...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe organizers of a programming contest have decided to present t-shirts to partic...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe organizers of a programming contest have decided to present t-shirts to partic...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N+2 cells arranged in a row. Let cell i denote the i-th cell from the le...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N+2 cells arranged in a row. Let cell i denote the i-th cell from the le...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N cells numbered from 1 to N in a row. Initially, M cells contain stones...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N cells numbered from 1 to N in a row. Initially, M cells contain stones...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe girl named Masha was walking in the forest and found a complete binary tree of...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe girl named Masha was walking in the forest and found a complete binary tree of...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a binary string s and an integer k.\nA binary string satisfies the k...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a binary string s and an integer k.\nA binary string satisfies the k...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a positive integer days representing the total number of days an emp...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a positive integer days representing the total number of days an emp...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nConnected undirected weighted graph without self-loops and multiple edges is given...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nConnected undirected weighted graph without self-loops and multiple edges is given...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nWatson gives a square of side length 1 to Sherlock. Now, after each second, each s...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nWatson gives a square of side length 1 to Sherlock. Now, after each second, each s...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N cells numbered from 1 to N in a row. Initially, M cells contain stones...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N cells numbered from 1 to N in a row. Initially, M cells contain stones...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an array $A$ consisting of $N$ Integers which are initially all $0$....
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an array $A$ consisting of $N$ Integers which are initially all $0$....
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nIn Ann's favorite book shop are as many as n books on math and economics. Books ar...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nIn Ann's favorite book shop are as many as n books on math and economics. Books ar...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThis is the harder version of the problem. In this version, 1 ≤ n ≤ 10^6 and 0 ≤ a...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThis is the harder version of the problem. In this version, 1 ≤ n ≤ 10^6 and 0 ≤ a...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese and Russian. \n\nTuzik and his maste...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese and Russian. \n\nTuzik and his maste...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a [tree] with N nodes rooted at node 1. \nThe i^{th} node of the tr...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a [tree] with N nodes rooted at node 1. \nThe i^{th} node of the tr...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a tree with N vertices. The i-th edge (1 \\leq i \\leq N-1) connects...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a tree with N vertices. The i-th edge (1 \\leq i \\leq N-1) connects...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nTakahashi and Aoki will play a game using cards with numbers written on them.\nIni...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nTakahashi and Aoki will play a game using cards with numbers written on them.\nIni...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA sequence X = (X_1, X_2, \\ldots) of positive integers (possibly empty) is called...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA sequence X = (X_1, X_2, \\ldots) of positive integers (possibly empty) is called...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe girl named Masha was walking in the forest and found a complete binary tree of...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe girl named Masha was walking in the forest and found a complete binary tree of...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nMonocarp had a sequence $a$ consisting of $n + m$ integers $a_1, a_2, \\dots, a_{n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nMonocarp had a sequence $a$ consisting of $n + m$ integers $a_1, a_2, \\dots, a_{n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nAs a tradition, every year before IOI all the members of Natalia Fan Club are invi...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nAs a tradition, every year before IOI all the members of Natalia Fan Club are invi...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nIn Ciel's restaurant, a waiter is training.\nSince the waiter isn't good at arithm...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nIn Ciel's restaurant, a waiter is training.\nSince the waiter isn't good at arithm...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nDexter and Debra are playing a game. They have N containers each having one or mor...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nDexter and Debra are playing a game. They have N containers each having one or mor...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N cells numbered from 1 to N in a row. Initially, M cells contain stones...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThere are N cells numbered from 1 to N in a row. Initially, M cells contain stones...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problem statements in [Russian], [Bengali], and [Mandarin Chinese] as well.\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problem statements in [Russian], [Bengali], and [Mandarin Chinese] as well.\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given sequences of length N: A = (A_1, A_2, \\dots, A_N) and B = (B_1, B_2...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given sequences of length N: A = (A_1, A_2, \\dots, A_N) and B = (B_1, B_2...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nAs a teacher, Riko Hakozaki often needs to help her students with problems from va...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nAs a teacher, Riko Hakozaki often needs to help her students with problems from va...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nMoriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locke...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nMoriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locke...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an integer array a of size 4 and another integer array b of size at ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an integer array a of size 4 and another integer array b of size at ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an integer mountainHeight denoting the height of a mountain.\nYou ar...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an integer mountainHeight denoting the height of a mountain.\nYou ar...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nKyoya Ootori has a bag with n colored balls that are colored with k different colo...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nKyoya Ootori has a bag with n colored balls that are colored with k different colo...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nJanusz is a businessman. He owns a company \"Januszex\", which produces games for ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nJanusz is a businessman. He owns a company \"Januszex\", which produces games for ...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe legend of the foundation of Vectorland talks of two integers $x$ and $y$. Cent...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nThe legend of the foundation of Vectorland talks of two integers $x$ and $y$. Cent...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nIn Ciel's restaurant, a waiter is training.\nSince the waiter isn't good at arithm...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nIn Ciel's restaurant, a waiter is training.\nSince the waiter isn't good at arithm...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nSometimes it is not easy to come to an agreement in a bargain. Right now Sasha and...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nSometimes it is not easy to come to an agreement in a bargain. Right now Sasha and...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a string S of length N. You are also given Q queries, which you shou...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a string S of length N. You are also given Q queries, which you shou...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA permutation of length $n$ is an array consisting of $n$ distinct integers from $...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nA permutation of length $n$ is an array consisting of $n$ distinct integers from $...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nJust to remind, girls in Arpa's land are really nice.\n\nMehrdad wants to invite s...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nJust to remind, girls in Arpa's land are really nice.\n\nMehrdad wants to invite s...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an integer array nums and a non-negative integer k. A sequence of in...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given an integer array nums and a non-negative integer k. A sequence of in...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a string s and an integer t, representing the number of transformati...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a string s and an integer t, representing the number of transformati...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a positive integer days representing the total number of days an emp...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a positive integer days representing the total number of days an emp...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a string s.\nWe define the mirror of a letter in the English alphabe...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a string s.\nWe define the mirror of a letter in the English alphabe...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a sequence of integers A = (A_1, A_2, \\ldots, A_N) of length N.\r\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a sequence of integers A = (A_1, A_2, \\ldots, A_N) of length N.\r\n...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a positive integer days representing the total number of days an emp...
[ { "content": "You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.\n\nQuestion:\nYou are given a positive integer days representing the total number of days an emp...