messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 1
value |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has a rectangular Board of size $n \\times m$. Initially, $k$ chips are placed on the board, $i$-th chip is located in the cell at the intersection of $sx_i$-th row and $sy_i$-th column.\n\nIn one action, Petya can ... | [{"type": "stdin_stdout", "input": "10 10 20\n7 5\n4 5\n5 4\n7 4\n1 5\n6 7\n9 10\n8 4\n1 4\n2 10\n3 10\n4 10\n0 6\n5 7\n6 2\n1 1\n10 9\n7 6\n1 4\n11 4\n8 2\n10 3\n5 1\n10 8\n4 2\n1 9\n1 10\n9 5\n2 2\n6 7\n8 6\n8 9\n2 2\n7 1\n3 3\n1 2\n6 20\n9 4\n10 2\n7 7\n", "output": "117\nUUUUUUUUULLLLLLLLLRRRRRRRRRDLLLLLLLLLDRRRRRR... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is... | [{"type": "stdin_stdout", "input": "8\n2224571\n2410907\n1906778\n4433130\n429304\n748393\n1234320\n1234321\n", "output": "2982\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou may know that Euclid was a mathematician. Well, as it turns out, Morpheus knew it too. So when he wanted to play a mean trick on Euclid, he sent him an appropriate nightmare. \n\nIn his bad dream Euclid has a set S of... | [{"type": "stdin_stdout", "input": "50 500000\n2 57 94\n2 1 10\n2 97 98\n2 15 86\n2 66 84\n2 40 100\n2 8 27\n2 14 43\n2 55 75\n2 25 90\n2 22 69\n2 9 12\n2 32 34\n2 24 48\n2 54 88\n2 13 50\n2 30 56\n2 38 77\n2 4 70\n2 39 92\n2 23 72\n2 17 36\n2 20 29\n2 6 51\n2 11 87\n2 21 68\n2 59 80\n2 52 61\n2 26 42\n2 2 37\n2 45 62\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Vasya found a golden ticket — a sequence which consists of $n$ digits $a_1a_2\\dots a_n$. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For ... | [{"type": "stdin_stdout", "input": "100\n0809740931424957283280264749151125408689778966769781910603952566405858112111930579193115510555198933\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\n4360837235306857829226262079948050131795231482102447137288804547991971660484969090651046154392003840\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya writes his own library for building graphical user interface. Vasya called his creation VTK (VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other. \n\nA widget is so... | [{"type": "stdin_stdout", "input": "20\nVBox hykl\nVBox enwv\nenwv.pack(hykl)\nVBox dlepf\ndlepf.pack(hykl)\nenwv.set_border(30)\nWidget mjrrik(54,21)\nhykl.set_border(2)\ndlepf.set_border(22)\nenwv.set_border(3)\nenwv.pack(dlepf)\ndlepf.pack(mjrrik)\nhykl.set_spacing(96)\nenwv.set_border(32)\ndlepf.set_border(72)\nWid... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA star map in Berland is a checked field n × m squares. In each square there is or there is not a star. The favourite constellation of all Berland's astronomers is the constellation of the Cross. This constellation can be... | [{"type": "stdin_stdout", "input": "10 10 40\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n", "output": "6 9\n5 9\n7 9\n6 8\n6 10\n"}, {"type": "stdin_stdout", "input": "10 10 59\n**.*******\n********.*\n***.******\n**.*******\n*******.**\n*****... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus d... | [{"type": "stdin_stdout", "input": "1116434957\n", "output": "-O|OO-OO\n-O|-OOOO\n-O|OOOO-\nO-|OOOO-\nO-|OOO-O\nO-|OOOO-\n-O|O-OOO\nO-|O-OOO\nO-|O-OOO\nO-|O-OOO\n"}, {"type": "stdin_stdout", "input": "1603481361\n", "output": "O-|O-OOO\n-O|O-OOO\nO-|OOO-O\nO-|O-OOO\n-O|OOO-O\nO-|OOOO-\nO-|OOO-O\nO-|-OOOO\n-O|O-OOO\nO-|... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\nTakahashi, the king, loves the positive integer K. Th... | [{"type": "stdin_stdout", "input": "6 727202214173249351\n6 5 2 5 3 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "6 1007784494318310970\n6 5 2 5 3 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "6 1122048832909353099\n6 4 1 1 3 2", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 21904273061... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNazar, a student of the scientific lyceum of the Kingdom of Kremland, is known for his outstanding mathematical abilities. Today a math teacher gave him a very difficult task.\n\nConsider two infinite sets of numbers. The... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "975735772\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000010000000\n", "output": "636734266\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "975735772"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe employees of the F company have lots of ways to entertain themselves. Today they invited a famous magician who shows a trick with plastic cups and a marble.\n\nThe point is to trick the spectator's attention. Initiall... | [{"type": "stdin_stdout", "input": "100 50\n11 28\n11 1\n98 58\n38 27\n24 27\n67 37\n90 48\n91 14\n43 29\n3 64\n24 6\n53 19\n97 65\n13 27\n75 53\n37 82\n69 75\n94 99\n1 26\n95 60\n45 27\n100 82\n71 49\n86 99\n74 58\n88 68\n39 63\n38 23\n22 39\n29 58\n62 83\n62 1\n61 58\n2 30\n41 48\n83 90\n1 17\n73 81\n23 53\n71 16\n43... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a sc... | [{"type": "stdin_stdout", "input": "10 10550000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10 100\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe government of Berland decided to improve network coverage in his country. Berland has a unique structure: the capital in the center and $n$ cities in a circle around the capital. The capital already has a good network... | [{"type": "stdin_stdout", "input": "3\n10\n3 3 2 3 2 5 1 2 11 3\n6 5 2 5 3 2 4 2 1 2\n20\n9 1 10 1 17 7 5 5 8 1 1 2 7 1 4 2 3 7 6 3\n2 6 3 2 37 1 5 5 4 5 1 3 21 15 1 7 7 5 0 1\n20\n9 1 9 1 5 1 3 2 0 3 6 1 2 8 11 7 3 5 14 2\n11 14 6 4 6 8 8 2 9 9 6 5 3 2 5 7 1 9 14 1\n", "output": "NO\nNO\nNO\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRidhiman challenged Ashish to find the maximum valued subsequence of an array $a$ of size $n$ consisting of positive integers. \n\nThe value of a non-empty subsequence of $k$ elements of $a$ is defined as $\\sum 2^i$ over... | [{"type": "stdin_stdout", "input": "20\n541032394951352952 204302388514120798 548305186805250399 743987576790520671 332874928746186630 60150973547887825 600093435051546090 862815570651991829 798946884837606574 383607230476788640 748981752333005915 317959714195378963 824508576221039025 547099154391774856 411018774272655... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.\n\nDuring one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the c... | [{"type": "stdin_stdout", "input": "2\n2 9\n5\n4 10 7 3 4\n", "output": "2 2 2 2 2\n"}, {"type": "stdin_stdout", "input": "2\n2 9\n5\n4 10 7 3 4\n", "output": "2 2 2 2 2\n"}, {"type": "stdin_stdout", "input": "2\n2 1\n5\n4 10 7 3 4\n", "output": "1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "2\n2 9\n5\n4 13 7 3 4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a grid with $2$ rows and $n$ columns. He colours each cell red, green, or blue.\n\nVasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be colo... | [{"type": "stdin_stdout", "input": "1\n55\nBBBBBBBBBBBBBBBBBBBGGGGGGGGGGGGGGGGGGGGGGGGGGGGBBBBGBGB\nBBBBBBBBBBBBBBBBBBBGGGGGGGGGGGGGGGGGGGGGGGGGGGGBBBBGBGB\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "6\n2\nRG\nRB\n4\nGRBG\nGBGB\n5\nGGGGG\nBBBBB\n7\nBBBBBBB\nRRRRRRR\n8\nRGBRRGBR\nRGGRRBGR\n1\nG\nG\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp plays a computer game (yet again!). This game has a unique trading mechanics.\n\nTo trade with a character, Monocarp has to choose one of the items he possesses and trade it for some item the other character poss... | [{"type": "stdin_stdout", "input": "3 4 5\n10 60 30\n12 57 17 6\n0 2 2 1 1\n", "output": "100\n102\n102\n100\n100\n"}, {"type": "stdin_stdout", "input": "3 4 5\n10 60 30\n12 57 17 6\n0 2 1 1 1\n", "output": "100\n102\n100\n100\n100\n"}, {"type": "stdin_stdout", "input": "3 4 5\n10 36 60\n19 57 23 0\n0 2 2 1 1\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImplication is a function of two logical arguments, its value is false if and only if the value of the first argument is true and the value of the second argument is false. \n\nImplication is written by using character '$... | [{"type": "stdin_stdout", "input": "200\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nIt seems that a magician with a smoky smell will show off his magic.\n\n\"Now, think of one favorite integer.\"\nYou decide to think of your counting years in your head.\n\nThe magician has thrown the query $ N... | [{"type": "stdin_stdout", "input": "10\n1 10\n2 10\n1 10\n1 10\n1 10\n1 10\n1 10\n1 10\n1 10\n1 10", "output": "-1000000000 1000000000\n"}, {"type": "stdin_stdout", "input": "10\n1 10\n1 10\n1 10\n1 10\n2 10\n1 10\n1 10\n1 10\n1 10\n1 10", "output": "-1000000 1000000000\n"}, {"type": "stdin_stdout", "input": "10\n1 10\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following mo... | [{"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 400000000 500000000 600000000 700000000 800000000 900000000 1000000000\n", "output": "Bob\n"}, {"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 400000000 500000000 600000000 700000000 800000000 900000000 1000000000\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute of the movie. By pressing this button, you watch the current minute of the movie and the player au... | [{"type": "stdin_stdout", "input": "18 111\n1449 2156\n3497 4784\n7775 14575\n23857 24593\n29211 30739\n31932 33447\n35902 36426\n36991 38506\n39679 47202\n48772 60016\n60522 61868\n63340 63982\n68417 78537\n79445 86568\n86918 87940\n90081 90310\n90629 94325\n95728 96263\n", "output": "58967\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a car, and an employee can choose one of four different car makes.\n\nThe parking lot befo... | [{"type": "stdin_stdout", "input": "30\n", "output": "4809844402031689728\n"}, {"type": "stdin_stdout", "input": "29\n", "output": "1161928703861587968\n"}, {"type": "stdin_stdout", "input": "29\n", "output": "1161928703861587968"}, {"type": "stdin_stdout", "input": "30\n", "output": "4809844402031689728"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem you will have to help Berland army with organizing their command delivery system.\n\nThere are $n$ officers in Berland army. The first officer is the commander of the army, and he does not have any superio... | [{"type": "stdin_stdout", "input": "13 12\n1 1 1 1 1 1 1 1 1 1 1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "13 12\n1 1 1 1 1 1 1 1 1 1 1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer n and prints the number of prime numbers which are less than or equal to n. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. F... | [{"type": "stdin_stdout", "input": "10\n10\n126", "output": "4\n4\n30\n"}, {"type": "stdin_stdout", "input": "10\n117\n4", "output": "4\n30\n2\n"}, {"type": "stdin_stdout", "input": "10\n147\n9", "output": "4\n34\n4\n"}, {"type": "stdin_stdout", "input": "10\n54\n18", "output": "4\n16\n7\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer r.\nHow many times is the area of a circle of radius r larger than the area of a circle of radius 1?\nIt can be proved that the answer is always an integer under the constraints given.\n\n-----Constrai... | [{"type": "stdin_stdout", "input": "100\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "87\n", "output": "7569\n"}, {"type": "stdin_stdout", "input": "76\n", "output": "5776\n"}, {"type": "stdin_stdout", "input": "91\n", "output": "8281\n"}, {"type": "stdin_stdout", "input": "88\n", "output": "7744\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi, Aoki and Snuke love cookies. They have A, B and C cookies, respectively. Now, they will exchange those cookies by repeating the action below:\n\n* Each person simultaneously divides his cookies in half and give... | [{"type": "stdin_stdout", "input": "1390 180 1200", "output": "1\n"}, {"type": "stdin_stdout", "input": "1390 180 2246", "output": "1\n"}, {"type": "stdin_stdout", "input": "1390 180 2625", "output": "0\n"}, {"type": "stdin_stdout", "input": "1390 213 2625", "output": "0\n"}, {"type": "stdin_stdout", "input": "1390 213... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nD: Shiritori Compression\n\nproblem\n\nEbi-chan and Kana-chan did a shiritori. Ebi-chan is looking at the memo of the word that came out in Shiritori.\n\nEbi-chan wants to remove redundant continuous subsequences from thi... | [{"type": "stdin_stdout", "input": "7\nbanana\nta\ntomb\nbus\nsound\ndoes\nsome", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\nananab\nta\nsomb\nbus\nsound\ndoes\nsemo", "output": "3\n"}, {"type": "stdin_stdout", "input": "7\nbanaoa\nta\ntomb\nbus\nsound\ndoes\nsome", "output": "2\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEric is the teacher of graph theory class. Today, Eric teaches independent set and edge-induced subgraph.\n\nGiven a graph $G=(V,E)$, an independent set is a subset of vertices $V' \\subset V$ such that for every pair $u,... | [{"type": "stdin_stdout", "input": "50\n21 10\n30 22\n3 37\n37 32\n4 27\n18 7\n2 30\n29 19\n6 37\n12 39\n47 25\n41 49\n45 9\n25 48\n16 14\n9 7\n33 28\n3 31\n34 16\n35 37\n27 40\n45 16\n29 44\n16 15\n26 15\n1 12\n2 13\n15 21\n43 14\n9 33\n44 15\n46 1\n38 5\n15 5\n1 32\n42 35\n20 27\n23 8\n1 16\n15 17\n36 50\n13 8\n49 45... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDexterina and Womandark have been arch-rivals since they’ve known each other. Since both are super-intelligent teenage girls, they’ve always been trying to solve their disputes in a peaceful and nonviolent way. After god ... | [{"type": "stdin_stdout", "input": "1000000 50\n0.034403 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.033928 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.071853 0.000000 0.000000 0.016440 0.000000 0.000000 0.000000 0.000000 0.023167 0.067938 0.000000 0.000000 0.000000 0.000000 0.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese here \n\n------ Problem Statement ------ \n\nLira is a little girl form Bytenicut, a small and cozy village located in the country of Byteland.\n As the village is located on a... | [{"type": "stdin_stdout", "input": "2\n-1 -1 0 100 100 0\n1 2 0 11 14 1", "output": "2 1\n"}, {"type": "stdin_stdout", "input": "2\n-1 1 -1 010 000 0\n1 6 0 10 14 1", "output": "1 2\n"}, {"type": "stdin_stdout", "input": "2\n-1 1 -1 000 000 0\n1 6 0 10 14 1", "output": "1 2\n"}, {"type": "stdin_stdout", "input": "2\n-2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet f(A, B) be the exclusive OR of A, A+1, ..., B. Find f(A, B).\nWhat is exclusive OR?\nThe bitwise exclusive OR of integers c_1, c_2, ..., c_n (let us call it y) is defined as follows:\n - When y is written in base two,... | [{"type": "stdin_stdout", "input": "1000000000000 1000000000000\n", "output": "1000000000000\n"}, {"type": "stdin_stdout", "input": "123456789012 123456789012\n", "output": "123456789012\n"}, {"type": "stdin_stdout", "input": "250874886258 260155437540\n", "output": "260155437541\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have $n$ coins, each of the same value of $1$.\n\nDistribute them into packets such that any amount $x$ ($1 \\leq x \\leq n$) can be formed using some (possibly one or all) number of these packets.\n\nEach packet may ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "30"}, {"type": "stdin_stdout", "input": "723061816\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "517188853\n", "output": "29\n"}, {"type": "stdin_stdout", "input": "237913214\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe smallest unit of data handled by a computer is called a bit, and the amount of information that represents multiple bits together is called a word. Currently, many computers process one word as 32 bits.\n\nFor a compu... | [{"type": "stdin_stdout", "input": "-322", "output": "-10304\n"}, {"type": "stdin_stdout", "input": "-542", "output": "-17344\n"}, {"type": "stdin_stdout", "input": "-130", "output": "-4160\n"}, {"type": "stdin_stdout", "input": "-133", "output": "-4256\n"}, {"type": "stdin_stdout", "input": "-199", "output": "-6368\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Chef commutes to work every day using the city's underground metro. The schedule for the trains has recently been changed and he wants to know how long it will take to travel from the station nearest to his house and ... | [{"type": "stdin_stdout", "input": "3\n2\n0 3 6\n0 6 8\n2\n0 -1 3\n12 4 1\n2\n0 1 8\n0 0 12", "output": "14\n16\n12\n"}, {"type": "stdin_stdout", "input": "3\n2\n0 4 12\n-1 8 5\n2\n-1 1 2\n6 8 10\n2\n1 1 5\n0 2 3", "output": "12\n14\n5\n"}, {"type": "stdin_stdout", "input": "3\n2\n0 3 7\n0 6 5\n2\n0 -1 3\n12 4 1\n2\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.\n\nLimak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stol... | [{"type": "stdin_stdout", "input": "11005 209 166\n", "output": "1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n10 11\n11 12\n12 13\n13 14\n14 15\n15 16\n16 17\n17 18\n18 19\n19 20\n20 21\n21 22\n22 23\n23 24\n24 25\n25 26\n26 27\n27 28\n28 29\n29 30\n30 31\n31 32\n32 33\n33 34\n34 35\n35 36\n36 37\n37 38\n38 39\n39 40\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSet\n\nGiven the sequence a_1, a_2, .., a_N.\n\nHow many values are there in this sequence?\n\ninput\n\n\nN\na_1 a_2 ... a_N\n\n\noutput\n\nOutput the number of types of values in the sequence.\n\nConstraint\n\n* 1 \\... | [{"type": "stdin_stdout", "input": "6\n-4 -3 1 -1 27 -1", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n-1 0 63 -1 3 -1", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n-2 -1 25 -2 4 0", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n-1 -1 25 -2 4 0", "output": "5\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence $a_1, a_2, \\dots, a_n$.\n\nFind the number of pairs of indices $(l, r)$ ($1 \\le l \\le r \\le n$) such that the value of median of $a_l, a_{l+1}, \\dots, a_r$ is exactly the given numbe... | [{"type": "stdin_stdout", "input": "15 2\n1 2 3 1 2 3 1 2 3 1 2 3 1 2 3\n", "output": "97\n"}, {"type": "stdin_stdout", "input": "15 1\n1 2 3 1 2 3 1 2 3 1 2 3 1 2 3\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "15 1\n1 2 3 0 2 3 1 2 3 1 2 3 1 2 3\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMarcin is a coach in his university. There are n students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.\n\nLet's focus on the stud... | [{"type": "stdin_stdout", "input": "10\n206158430208 206162624513 68719476737 137506062337 206162624513 4194305 68719476737 206225539072 137443147777 68719476736\n202243898 470292528 170057449 290025540 127995253 514454151 607963029 768676450 611202521 68834463\n", "output": "2773043292\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSunuke-kun's dictionary contains the words s1, ..., sn, which consist of n lowercase letters. This satisfies s1 <... <sn when compared in lexicographical order. Unfortunately, some characters are faint and unreadable. Unr... | [{"type": "stdin_stdout", "input": "2\n?rum??mer\nc??a??mp", "output": "715167440\n"}, {"type": "stdin_stdout", "input": "2\n?sum??mer\nc??a??mp", "output": "703286064"}, {"type": "stdin_stdout", "input": "2\n?rum??mer\nc@?a??mp", "output": "0\n"}, {"type": "stdin_stdout", "input": "2\n?rum??mer\ncA?a??mp", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC). \n\nA team is to be formed of... | [{"type": "stdin_stdout", "input": "65 173 136\n26 18 8 11 1 22 44 6 15 22 13 49 30 36 37 41 25 27 9 36 36 1 45 20 7 47 28 30 30 21 33 32 9 11 16 5 19 12 44 40 25 40 32 36 15 34 4 43 28 19 29 33 7 11 18 13 40 18 10 26 1 48 20 38 1 20 34 8 46 8 32 35 16 49 26 36 11 16 4 29 35 44 14 21 22 42 10 1 3 12 35 30 14 45 2 24 32... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the sum of weights of edges of the Minimum Spanning Tree for a given weighted undirected graph G = (V, E).\n\nConstraints\n\n* 1 ≤ |V| ≤ 10,000\n* 0 ≤ |E| ≤ 100,000\n* 0 ≤ wi ≤ 10,000\n* The graph is connected\n* The... | [{"type": "stdin_stdout", "input": "6 1\n0 1 -1\n1 0 2\n1 2 8\n-1 3 13\n0 0 -1\n1 -1 11\n7 0 0\n2 1 2\n1 8 0", "output": "-1\n"}, {"type": "stdin_stdout", "input": "6 9\n0 2 1\n0 2 3\n0 2 2\n0 3 7\n2 4 5\n1 4 3\n3 2 1\n3 3 1\n2 5 10", "output": "20\n"}, {"type": "stdin_stdout", "input": "6 9\n0 2 1\n0 2 3\n2 0 2\n1 3 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndryusha is an orderly boy and likes to keep things in their place.\n\nToday he faced a problem to put his socks in the wardrobe. He has n distinct pairs of socks which are initially in a bag. The pairs are numbered from... | [{"type": "stdin_stdout", "input": "50\n50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 10 4 3 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's family, so let's number them with integers from 1 to n.\n\nEa... | [{"type": "stdin_stdout", "input": "4 3\n1 2\n2 3\n3 4\n1 2 3 4\n", "output": "4\n4\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "4 3\n1 2\n2 3\n3 4\n1 2 3 3\n", "output": "3\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "4 3\n1 2\n2 3\n3 4\n1 1 3 4\n", "output": "3\n4\n3\n1\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMishka got an integer array $a$ of length $n$ as a birthday present (what a surprise!).\n\nMishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it \"Mishka's Adjacent Re... | [{"type": "stdin_stdout", "input": "10\n10100 18 108515962 1 16 111 2 999999999 60506056 1000000000\n", "output": "10099 17 108515961 1 15 111 1 999999999 60506055 999999999\n"}, {"type": "stdin_stdout", "input": "10\n10100 12 108515962 1 5 101 2 999999999 60506056 1000000000\n", "output": "10099 11 108515961 1 5 101 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.\n\nLet's assume that a song... | [{"type": "stdin_stdout", "input": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA@AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n", "output": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe get more and more news about DDoS-attacks of popular websites.\n\nArseny is an admin and he thinks that a website is under a DDoS-attack if the total number of requests for a some period of time exceeds $100 \\cdot t$,... | [{"type": "stdin_stdout", "input": "100\n70 111 5 73 69 22 79 62 101 99 249 88 75 31 27 49 7 36 37 62 61 77 75 38 203 61 81 43 98 224 114 48 98 8 67 46 80 83 81 64 15 72 95 39 79 93 79 140 27 65 67 44 294 170 89 97 73 48 18 53 31 49 47 13 88 70 5 46 256 81 26 9 89 38 43 28 219 30 10 71 96 95 241 96 98 96 82 29 219 85 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlmost Identical Programs\n\nThe programming contest named Concours de Programmation Comtemporaine Interuniversitaire (CPCI) has a judging system similar to that of ICPC; contestants have to submit correct outputs for two... | [{"type": "stdin_stdout", "input": "print\"hello\";print133\nprint\"hello\";print123\nread\"B1input\";solve;output;\n;tuptuo;evlos;\"2B\"daer\nread\"C1\";solve;output\"C1ans\";\nread\"C2\";solve;output\"C2ans\";\n\"\"\"\"\"\"\"\"\n\"\"\"42\"\"#\"\"\nslow\"program\"\nfast\"code\"\n\"super\"fast\"program\"\n\"super\"fast... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so me... | [{"type": "stdin_stdout", "input": "2\ndevelopment:alice,bob,design,eve.\ndesign:carol,alice.\n3\none:another.\nanother:yetanother.\nxetanother:dave.\n3\nfriends:alice,bob,bestfriends,carol,fran,badcompany.\nbestfriends:eve,alice.\nbadcompany:dave,carol.\n5\na:b,c,d,e.\nb:c,d,e,f.\nc:d,e,f,g.\nd:e,f,g,h.\ne:f,g,h,i.\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little.\n\nThe size of the board of this game is 5 frames wide, and it is high enough to accomm... | [{"type": "stdin_stdout", "input": "4\n2 4 1\n1 3 1\n2 2 4\n2 3 5\n1\n1 5 1\n7\n2 2 2\n1 1 1\n2 1 3\n1 4 1\n1 1 1\n2 5 5\n1 4 2\n0", "output": "12\n0\n13\n"}, {"type": "stdin_stdout", "input": "4\n2 4 1\n1 3 1\n2 2 4\n2 3 5\n1\n1 5 1\n7\n2 2 2\n1 1 1\n2 0 3\n1 4 1\n1 1 1\n2 5 5\n1 4 2\n0", "output": "12\n0\n12\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day a well-known sponsor of a well-known contest decided to give every participant of the contest a T-shirt as a present. A natural problem occurred: on the one hand, it is not clear how many T-shirts of what sizes sh... | [{"type": "stdin_stdout", "input": "302 143 40 63 452\n100\nXXL\nM\nXL\nS\nXXL\nS\nL\nXL\nXL\nXL\nXXL\nS\nXXL\nS\nXXL\nXL\nXL\nXXL\nXL\nXXL\nM\nS\nS\nS\nS\nXXL\nS\nL\nXL\nXXL\nXXL\nS\nXXL\nL\nXXL\nM\nS\nL\nL\nXL\nXL\nS\nXL\nL\nXL\nM\nXL\nL\nM\nS\nXL\nXXL\nXL\nL\nXL\nXL\nXL\nM\nM\nXL\nL\nS\nS\nXL\nS\nXXL\nXXL\nXL\nS\nXL... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMake a wish to a shooting star\n\nThe mysterious organization JAG (Japanese Alumni Group) holds regular meetings. One day, the agenda was \"How to enable participating teams to demonstrate their strength in the upcoming I... | [{"type": "stdin_stdout", "input": "1\n0.0000 0.0000 0.0000 2.0000 0.0000 0.0000 4.0000 1.0000\n2\n0.0000 0.0000 0.0000 2.0000 0.0000 0.0000 4.0000 1.0000\n10.0000 0.0000 0.0000 -2.0000 0.0000 0.0000 4.0000 1.0000\n5\n-10.0000 0.5301491670709055 0.0000 10.0000 0.15723569039702578 0.6247894746810593 2.0000 1.0000\n-5.00... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBizon the Champion isn't just a bison. He also is a favorite of the \"Bizons\" team.\n\nAt a competition the \"Bizons\" got the following problem: \"You are given two distinct words (strings of English letters), s and t. ... | [{"type": "stdin_stdout", "input": "itwtyhhsdjjffmmoqkkhxjouypznewstyorotxhozlytndehmaxogrohccnqcgkrjrdmnuaogiwmnmsbdaizqkxnkqxxiihbwepc\nsnixfywvcntitcefsgqxjcodwtumurcglfmnamnowzbjzmfzspbfuldraiepeeiyasmrsneekydsbvazoqszyjxkjiotushsddet\n", "output": "need tree\n"}, {"type": "stdin_stdout", "input": "yyyyxxxxyxyyxxxy... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are labeled from 1 to k. Balls of the same color are indistinguishable. He draws balls from the bag one by one until the bag... | [{"type": "stdin_stdout", "input": "47\n20\n21\n16\n18\n24\n20\n25\n13\n20\n22\n26\n24\n17\n18\n21\n22\n21\n23\n17\n15\n24\n19\n18\n21\n20\n19\n26\n25\n20\n17\n17\n17\n26\n32\n20\n21\n25\n28\n24\n21\n21\n17\n28\n20\n20\n31\n19\n", "output": "295545118\n"}, {"type": "stdin_stdout", "input": "47\n20\n21\n16\n18\n24\n20\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro's Shopping\n\nMammy decided to give Taro his first shopping experience. Mammy tells him to choose any two items he wants from those listed in the shopping catalogue, but Taro cannot decide which two, as all the items... | [{"type": "stdin_stdout", "input": "3 13\n17 20 30\n6 7\n1 2 5 1 4 11\n7 000\n22 34 102 94 59 39 61\n4 100\n133 98 100 50\n4 5\n10 5 10 13\n0 0", "output": "NONE\n7\nNONE\nNONE\nNONE\n"}, {"type": "stdin_stdout", "input": "3 48\n17 20 30\n6 1\n1 2 5 1 4 11\n7 000\n22 34 102 94 59 39 70\n4 100\n80 70 119 50\n4 20\n10 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya went out for a walk in the yard but there weren't any of his friends outside and he had no one to play touch and run. But the boy didn't lose the high spirits and decided to play touch and run with himself. ... | [{"type": "stdin_stdout", "input": "1000 2000\n226 566\n20\n0 -100\n-100 100\n100 0\n42 0\n-100 -79\n-66 -16\n0 -7\n-1 0\n0 100\n100 91\n99 0\n1 0\n-100 0\n70 -100\n-100 100\n100 1\n66 0\n-100 1\n-47 -100\n-42 0\n", "output": "708\n"}, {"type": "stdin_stdout", "input": "1010 2000\n226 566\n20\n0 -100\n-100 100\n100 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has got an array consisting of $n$ integers, and two integers $k$ and $len$ in addition. All numbers in the array are either between $1$ and $k$ (inclusive), or equal to $-1$. The array is good if there is no segmen... | [{"type": "stdin_stdout", "input": "10 42 7\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "645711643\n"}, {"type": "stdin_stdout", "input": "10 42 7\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "645711643\n"}, {"type": "stdin_stdout", "input": "10 32 7\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "61884984"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee are so busy maniacally developing (possibly useless) programs that... | [{"type": "stdin_stdout", "input": "3 2\n2 1 2\n-1\n3 3 8 8\n3 2\n4 1 5 0 9\n3 2 5 9\n5 2 4 5 7 12\n3 3\n0 1 4\n3 2 5 9\n2 2 4\n3 3\n2 1 1\n3 1 2 9\n2 2 4\n0 0", "output": "8\n5\n0\n1\n"}, {"type": "stdin_stdout", "input": "3 2\n2 1 2\n-1\n3 3 8 8\n3 2\n4 1 5 0 9\n3 2 5 9\n5 2 4 5 7 12\n3 3\n0 1 4\n3 2 5 9\n2 2 4\n3 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet’s play a stone removing game.\n\nInitially, n stones are arranged on a circle and numbered 1, ... , n clockwise (Figure 1). You are also given two numbers k and m. From this state, remove stones one by one following t... | [{"type": "stdin_stdout", "input": "12 2 3\n100 15522 98\n10000 10000 10000\n0 0 0", "output": "10\n89\n2019\n"}, {"type": "stdin_stdout", "input": "12 2 3\n100 15914 98\n10000 10000 10000\n0 0 0", "output": "10\n16\n2019\n"}, {"type": "stdin_stdout", "input": "12 2 3\n100 15914 98\n10001 10000 10000\n0 0 0", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.\n\nThe electoral system in the country is pretty unu... | [{"type": "stdin_stdout", "input": "100 1\n439 158 619 538 187 153 973 781 610 475 94 1829 449 531 220 51 788 118 189 501 54 434 465 902 280 635 688 214 737 327 682 690 683 519 261 923 254 388 529 659 662 276 376 735 976 664 521 285 42 147 187 259 407 977 879 465 522 17 550 701 114 921 577 265 668 812 232 267 135 371 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:\n\n$\\sum_{i = 1}^{a} \\sum_{j = 1}^{b} \\sum_{k = 1}^{c} d(i \\cd... | [{"type": "stdin_stdout", "input": "100 100 100\n", "output": "51103588\n"}, {"type": "stdin_stdout", "input": "100 100 100\n", "output": "51103588"}, {"type": "stdin_stdout", "input": "98 34 100\n", "output": "13589991\n"}, {"type": "stdin_stdout", "input": "90 82 100\n", "output": "35482866\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ products in the shop. The price of the $i$-th product is $a_i$. The owner of the shop wants to equalize the prices of all products. However, he wants to change prices smoothly.\n\nIn fact, the owner of the s... | [{"type": "stdin_stdout", "input": "5\n8 19551489\n31131899 17585660 3913937 14521321 9846714 96097161 115568124 35051437\n1 93900441\n15578410\n7 19560555\n124492495 53703939 20259503 99698023 98868060 83313210 5487534\n6 72321938\n59271765 72426489 16625497 51598082 31475864 20946400\n7 44965081\n49955408 62397026 39... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew was very excited to participate in Olympiad of Metropolises. Days flew by quickly, and Andrew is already at the airport, ready to go home. He has $n$ rubles left, and would like to exchange them to euro and dollar ... | [{"type": "stdin_stdout", "input": "100000000\n30\n30\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "100000000\n30\n30\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "100000000\n60\n30\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "100000000\n31\n33\n", "output": "0\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\nLeha is playing a very interesting game. The game will be played on a rectangular grid consisting of N rows and M columns. Initially all th... | [{"type": "stdin_stdout", "input": "1\n16 -10", "output": "-326\n"}, {"type": "stdin_stdout", "input": "1\n32 -10", "output": "-662\n"}, {"type": "stdin_stdout", "input": "1\n23 -10", "output": "-473\n"}, {"type": "stdin_stdout", "input": "1\n23 -20", "output": "-923\n"}, {"type": "stdin_stdout", "input": "1\n17 -20", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers numbered from $1$ to $n$.\n\nLet's define the $k$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $k... | [{"type": "stdin_stdout", "input": "3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1\n", "output": "-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1 \n"}, {"type": "stdin_stdout", "input": "3\n5\n1 2 3 1 2\n5\n4 4 4 3 2\n6\n1 4 3 5 1 1\n", "output": "-1 -1 1 1 1\n-1 -1 4 3 2\n-1 -1 -1 1 1 1\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have recently fallen through a hole and, after several hours of unconsciousness, have realized you are in an underground city. On one of your regular, daily walks through the unknown, you have encountered two unusuall... | [{"type": "stdin_stdout", "input": "11\nfghdgrakmnq\n8\nfgh 4\ngh 3\nh 10\nhdg 6\nhdgra 7\nakm 12\nrakm 5\na 15\n3\n", "output": "52\n"}, {"type": "stdin_stdout", "input": "11\nfghdgrakmnq\n8\nfgh 4\ngh 3\nh 10\nhdg 6\nargdh 7\nakm 12\nrakm 5\na 15\n3\n", "output": "52\n"}, {"type": "stdin_stdout", "input": "11\nfghdgr... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLong is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.\n\nHis farm is presented by a rectangle grid with r rows and c columns. Some of... | [{"type": "stdin_stdout", "input": "4\n3 5 3\n..R..\n...R.\n....R\n6 4 12\nR..R\nR..R\nRRRR\nRRRR\nR..R\nR..R\n5 5 4\nRRR..\nR.R..\nRRR..\nR..R.\nR.R..\n2 31 62\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", "output": "aaabb\ncccbb\nccccc\naaaa\nbbbb\nccdd\nhgfe\nijjj\nlllk\naaabb\nbbbbb\nbcccc\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ integer numbers $a_1, a_2, \\dots, a_n$. Consider graph on $n$ nodes, in which nodes $i$, $j$ ($i\\neq j$) are connected if and only if, $a_i$ AND $a_j\\neq 0$, where AND denotes the bitwise AND operatio... | [{"type": "stdin_stdout", "input": "150\n0 0 0 0 0 0 0 2537672836907008 0 0 0 0 0 0 16384 0 0 0 0 34360787232 0 0 70871155232 0 0 0 0 0 0 0 0 0 0 0 2256197860262016 0 0 0 0 0 0 0 0 0 0 536872961 0 0 0 0 0 0 0 0 0 0 33619968 0 0 0 0 0 0 0 0 0 0 0 0 37189881297899520 0 18031990695526400 0 0 1099511627776 0 0 0 0 0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is the sleuth, he should investigate a \"crime\" and find out what is happening. He can ask a... | [{"type": "stdin_stdout", "input": "ARIWmwqFqxsQXsXXzHqvFjxOCttAGPUzDtWzsenPYdNXuFOIUGYZsLLK IaoxiyjBBRThoelwdPTkuCQfcBLUEJpCPIrVZlvUWA?\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "ARIWmwqFqxsQXsXXzHqvFjxOCttAGPUzDtWzsenPYdNXuFOIUGYZsLLK IaoxiykBBRThoelwdPTkuCQfcBLUEJpCPIrVZlvUWA?\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has $26$ tasks. Each task is designated by a capital letter of the Latin alphabet.\n\nThe teacher asked Polycarp to solve tasks in the following way: if Polycarp began to solve some task, then he must solve it to... | [{"type": "stdin_stdout", "input": "5\n3\nABA\n11\nDDBBCCCBBEZ\n7\nFFGZZZY\n1\nZ\n2\nAB\n", "output": "\nNO\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "5\n3\nABA\n11\nDDBBCCCBBEZ\n7\nFFGZZZY\n1\nZ\n2\nAB\n", "output": "NO\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "1\n24\nDEBOOFORCEDMETODO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, \"Play with Tsukuro\". Today is the time to make a rectangle with sticks, but I would like to see i... | [{"type": "stdin_stdout", "input": "-1 -2 1 11", "output": "no\n"}, {"type": "stdin_stdout", "input": "-1 -2 1 19", "output": "no\n"}, {"type": "stdin_stdout", "input": "-2 -2 1 1", "output": "yes\n"}, {"type": "stdin_stdout", "input": "-1 4 4 10", "output": "no\n"}, {"type": "stdin_stdout", "input": "-1 1 4 10", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou play your favourite game yet another time. You chose the character you didn't play before. It has $str$ points of strength and $int$ points of intelligence. Also, at start, the character has $exp$ free experience poin... | [{"type": "stdin_stdout", "input": "5\n1 1 100000000\n100000000 100000000 100000000\n100000000 1 100000000\n1 100000000 100000000\n100000000 100000000 1\n", "output": "50000000\n50000000\n100000000\n1\n1\n"}, {"type": "stdin_stdout", "input": "5\n1 1 100000000\n100000000 100000000 100000000\n100000000 1 100000000\n1 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach evening after the dinner the SIS's students gather together to play the game of Sport Mafia. \n\nFor the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs ... | [{"type": "stdin_stdout", "input": "1000000000 846040702\n", "output": "999939239\n"}, {"type": "stdin_stdout", "input": "1000000000 315152540\n", "output": "999948715\n"}, {"type": "stdin_stdout", "input": "1000000000 315152540\n", "output": "999948715"}, {"type": "stdin_stdout", "input": "1000000000 846040702\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCan the greatest common divisor and bitwise operations have anything in common? It is time to answer this question.\n\nSuppose you are given a positive integer $a$. You want to choose some integer $b$ from $1$ to $a - 1$ ... | [{"type": "stdin_stdout", "input": "9\n30\n11\n12\n122\n136\n92\n1984716\n217\n14628115\n", "output": "31\n15\n15\n127\n255\n127\n2097151\n255\n16777215\n"}, {"type": "stdin_stdout", "input": "9\n30\n7\n12\n122\n136\n92\n1984716\n204\n14628115\n", "output": "31\n1\n15\n127\n255\n127\n2097151\n255\n16777215\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N points in a two-dimensional plane.\n\nThe coordinates of the i-th point (1 \\leq i \\leq N) are (x_i,y_i).\n\nLet us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more o... | [{"type": "stdin_stdout", "input": "4 3\n-1000000000 -1000000000\n1000000000 1000000000\n-999999999 999999999\n999999999 -999999999\n", "output": "3999999996000000001\n"}, {"type": "stdin_stdout", "input": "4 3\n-1000000000 -1000000000\n1000000000 1000000000\n-999999999 999999999\n999999999 -1704052742", "output": "400... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lac... | [{"type": "stdin_stdout", "input": "5 30 10\nH 8\nH 9\nV 1\nH 2\nH 5\nH 3\nH 1\nV 2\nH 13\nV 3\n", "output": "110\n105\n84\n84\n84\n84\n84\n63\n51\n34\n"}, {"type": "stdin_stdout", "input": "5 15 10\nH 8\nH 9\nV 1\nH 2\nH 6\nH 4\nH 1\nV 2\nH 13\nV 3\n", "output": "40\n40\n32\n24\n24\n24\n24\n18\n12\n8\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohn Doe has an n × m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n × n have exactly k points... | [{"type": "stdin_stdout", "input": "100 1000000000000000000 5000\n", "output": "824224847\n"}, {"type": "stdin_stdout", "input": "100 1000000000000000000 1221\n", "output": "43180268\n"}, {"type": "stdin_stdout", "input": "79 1000000000000000000 3107\n", "output": "631080535\n"}, {"type": "stdin_stdout", "input": "100 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAsmany strings are strings of '0's and '1's that have as many 00 as 11. A string such as 00110001 consists of 3 \"00\" and\n1 \"11\". Of course this is not an Asmany string. 0011, 1100, 000111000111 are Asmany strings. An... | [{"type": "stdin_stdout", "input": "2\n12\n12", "output": "YES\nYES\n"}, {"type": "stdin_stdout", "input": "2\n12\n4", "output": "YES\nYES\n"}, {"type": "stdin_stdout", "input": "2\n18\n12", "output": "NO\nYES\n"}, {"type": "stdin_stdout", "input": "2\n12\n6", "output": "YES\nYES\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[Image] \n\n\n-----Input-----\n\nThe input consists of four lines, each line containing a single digit 0 or 1.\n\n\n-----Output-----\n\nOutput a single digit, 0 or 1.\n\n\n-----Example-----\nInput\n0\n1\n1\n0\n\nOutput\n0... | [{"type": "stdin_stdout", "input": "0\n1\n1\n0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "0\n0\n0\n0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n0\n0\n0\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "0\n1\n0\n0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n1\n0\n0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nGiven a sequence of n integers a1, a2, ..., an and a positive integer k (1 ≤ k ≤ n), then the sum of k consecutive integers Si = ai + ai + Create a program that outputs the maximum value of 1 + ... + ai + k-1 (... | [{"type": "stdin_stdout", "input": "5 1\n-1\n18\n-4\n17\n2\n0 0", "output": "18\n"}, {"type": "stdin_stdout", "input": "5 1\n-1\n3\n-4\n30\n2\n0 0", "output": "30\n"}, {"type": "stdin_stdout", "input": "5 3\n2\n13\n-3\n27\n1\n0 0", "output": "37\n"}, {"type": "stdin_stdout", "input": "5 1\n2\n10\n-4\n14\n2\n0 0", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a polyline going through points (0, 0) – (x, x) – (2x, 0) – (3x, x) – (4x, 0) – ... - (2kx, 0) – (2kx + x, x) – .... \n\nWe know that the polyline passes through the point (a, b). Find minimum positive value x su... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": " 1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "999999999.5000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 111111111\n", "output": "111111111... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves computer games. Finally a game that he's been waiting for so long came out!\n\nThe main character of this game has n different skills, each of which is characterized by an integer a_{i} from 0 to 100. The high... | [{"type": "stdin_stdout", "input": "100 10000\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which calculates the area and circumference of a circle for given radius r.\n\nConstraints\n\n* 0 < r < 10000\n\nInput\n\nA real number r is given.\n\nOutput\n\nPrint the area and circumference of the circ... | [{"type": "stdin_stdout", "input": "-210", "output": "138544.236023275 -1319.46891451\n"}, {"type": "stdin_stdout", "input": "-215", "output": "145220.120412152 -1350.88484104\n"}, {"type": "stdin_stdout", "input": "-113", "output": "40114.996593678 -709.999939711\n"}, {"type": "stdin_stdout", "input": "-114", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEnter a positive integer n of 4,000 or less, with a pair of integers a, b, c, d in the range 0-1000.\n\n\na + b + c + d = n\n\n\nCreate a program that outputs the number of combinations that satisfy the conditions.\n\n\n\... | [{"type": "stdin_stdout", "input": "2\n-1\n207", "output": "10\n0\n1521520\n"}, {"type": "stdin_stdout", "input": "2\n-1\n254", "output": "10\n0\n2796160\n"}, {"type": "stdin_stdout", "input": "2\n-1\n326", "output": "10\n0\n5881204\n"}, {"type": "stdin_stdout", "input": "2\n-1\n100", "output": "10\n0\n176851\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob ... | [{"type": "stdin_stdout", "input": "50 2\nYES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES\n", "output": "Aa Ab Ac Ad Ae Af Ag Ah Ai Aj Ak Al Am An Ao Ap Aq Ar As At Au Av A... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHaving learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) hav... | [{"type": "stdin_stdout", "input": "15 31 1\n--------R---------G------------\n-G----------------------------R\n--------------G--------------R-\n---G--------------------------R\n-----R---------G---------------\n--R--G-------------------------\n-----G-----------------R-------\n--R-------------------G--------\n-R---------... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet $f_{x} = c^{2x-6} \\cdot f_{x-1} \\cdot f_{x-2} \\cdot f_{x-3}$ for $x \\ge 4$.\n\nYou have given integers $n$, $f_{1}$, $f_{2}$, $f_{3}$, and $c$. Find $f_{n} \\bmod (10^{9}+7)$.\n\n\n-----Input-----\n\nThe only line... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "607659049\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "607659049"}, {"type": "stdin_stdout", "input": "1440135023384277212 29874180... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp found $n$ segments on the street. A segment with the index $i$ is described by two integers $l_i$ and $r_i$ — coordinates of the beginning and end of the segment, respectively. Polycarp realized that he didn't ne... | [{"type": "stdin_stdout", "input": "4\n3\n1 4\n2 3\n3 6\n4\n1 2\n2 3\n3 5\n2 5\n5\n0 0\n1 13\n4 1\n6 14\n9 10\n5\n1 5\n2 4\n3 5\n2 8\n4 8\n", "output": "0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 4\n2 3\n3 6\n4\n1 2\n2 3\n3 5\n2 5\n5\n0 0\n1 13\n4 1\n6 14\n9 10\n5\n1 5\n2 4\n3 5\n2 9\n4 8\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.\n\nThere a... | [{"type": "stdin_stdout", "input": "10 50 200\n10 1 22\n2 9 6\n4 2 98\n6 6 38\n5 1 67\n6 7 17\n10 4 29\n6 5 97\n3 8 51\n1 6 31\n5 9 72\n4 5 50\n2 1 3\n10 2 27\n1 10 78\n9 9 48\n8 7 81\n5 8 64\n9 4 78\n7 5 90\n9 8 83\n7 1 99\n5 5 43\n1 2 37\n3 3 6\n4 3 61\n9 6 25\n1 3 46\n2 10 18\n1 4 68\n2 4 75\n3 10 67\n7 8 82\n5 7 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the constraints.\n\nVova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $n$ consecutive pictures (with kitt... | [{"type": "stdin_stdout", "input": "200 103 37\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChouti is working on a strange math problem.\n\nThere was a sequence of $n$ positive integers $x_1, x_2, \\ldots, x_n$, where $n$ is even. The sequence was very special, namely for every integer $t$ from $1$ to $n$, $x_1+... | [{"type": "stdin_stdout", "input": "80\n24 192 896 1568 2907 4840 7475 9775 11109 29939 22475 45951 46552 36859 66787 106329 85211 94423 65627 147436 143259 128699 139277 167743 178063 192167 150133 162719 177103 160732 139859 157301 176681 199291 152867 182611 199632 199535 199905 199959\n", "output": "Yes\n1 24 39 19... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h_1 cm from the ground. On the height h_2 cm (h_2 > h_1) on the same tree... | [{"type": "stdin_stdout", "input": "43951 66098\n1604 35654\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "35413 75637\n4087 30166\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "28473 80380\n2568 95212\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "43951 66098\n1604 35654\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.\n\nPolycarpus continues working as a system administrator in ... | [{"type": "stdin_stdout", "input": "10 14\n3 2\n7 2\n6 4\n8 1\n3 9\n5 6\n6 3\n4 1\n2 5\n7 10\n9 5\n7 1\n8 10\n3 4\n", "output": "unknown topology\n"}, {"type": "stdin_stdout", "input": "10 14\n3 2\n7 2\n6 4\n8 1\n3 9\n5 6\n6 3\n4 1\n2 5\n7 10\n9 5\n7 1\n8 10\n3 4\n", "output": "unknown topology\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of th... | [{"type": "stdin_stdout", "input": "900\n13595314340746721027884681972026445045155446054797436718350397773609081581610067818125738383867204953\n", "output": "86\n"}, {"type": "stdin_stdout", "input": "200\n1000000010000000000000000000010000000000000001000001000000000000000000000000000000000000000000000000\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a new computer game in which you have to fight monsters. In a dungeon you are trying to clear, you met three monsters; the first of them has $a$ health points, the second has $b$ health points, and the thi... | [{"type": "stdin_stdout", "input": "13\n3 2 4\n10 2 4\n10 3 5\n5 4 6\n7 1 1\n3 3 3\n6 6 6\n14 2 2\n16 1 1\n9 9 9\n26 3 3\n9 8 10\n4 1 4\n", "output": "YES\nNO\nYES\nNO\nYES\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "13\n3 2 4\n10 2 4\n10 3 5\n5 4 6\n7 1 1\n3 3 3\n6 6 6\n14 2 2\n16 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA festival will be held in a town's main street. There are n sections in the main street. The sections are numbered 1 through n from left to right. The distance between each adjacent sections is 1.\n\nIn the festival m fi... | [{"type": "stdin_stdout", "input": "100 20 5\n47 93 3\n61 49 10\n14 69 10\n88 2 14\n35 86 18\n63 16 20\n39 49 22\n32 45 23\n66 54 25\n77 2 36\n96 85 38\n33 28 45\n29 78 53\n78 13 60\n58 96 64\n74 39 71\n18 80 80\n18 7 85\n97 82 96\n74 99 97\n", "output": " 877... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHave you ever implemented a program adding two big integers that cannot be represented by the primitive data type of your programming language? The algorithm is just simulation of the column addition method that we have b... | [{"type": "stdin_stdout", "input": "3\n7\n1\n16", "output": "3.44444445\n0.45\n7.94444444444\n"}, {"type": "stdin_stdout", "input": "3\n4\n1\n16", "output": "1.94445\n0.45\n7.94444444444\n"}, {"type": "stdin_stdout", "input": "3\n4\n0\n16", "output": "1.94445\n0.0\n7.94444444444\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the year 2020, a race of atomically energized cars will be held. Unlike today’s car races, fueling is not a concern of racing teams. Cars can run throughout the course without any refueling. Instead, the critical facto... | [{"type": "stdin_stdout", "input": "2\n2 3\n1.1946563976133233\n1 2.557093764182385 0.48719322387595776 0.3\n5\n5 6 15 20 25\n0.15\n1 1.0 0.04 1.0346326402545585\n10\n1783 3640 3991 4623 5465 5481 6369 6533 6865 8425\n5.110816362691462\n72 59.4705 0.6319554453888588 0.12728810127294996\n0", "output": "1.317231571615\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $x$ and $y$ (it is guaranteed that $x > y$). You may choose any prime integer $p$ and subtract it any number of times from $x$. Is it possible to make $x$ equal to $y$?\n\nRecall that a prime nu... | [{"type": "stdin_stdout", "input": "69\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n4 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 2300, the Life Science Division of Federal Republic of Space starts a very ambitious project to complete the genome sequencing of all living creatures in the entire universe and develop the genomic database of all spac... | [{"type": "stdin_stdout", "input": "ABC 3\nABC 2\n2(4()B)3(XY)A10C 30\n1000(1000(1000(1000(1000(1000(OM)))))) 1090860\n0 0", "output": "0\nC\n0\nO\n"}, {"type": "stdin_stdout", "input": "CBA 3\nABC 0\n2(4(AB)3(XY))10C 10\n1000(1000(1000(1000(1000(1000(NM)))))) 1889091\n0 0", "output": "0\nA\nX\nM\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nqd ucyhf yi q fhycu dkcruh mxeiu huluhiu yi q tyvvuhudj fhycu dkcruh. oekh jqia yi je vydt jxu djx ucyhf.\n\nInput\n\njxu ydfkj sediyiji ev q iydwbu ydjuwuh d (1 ≤ d ≤ 11184) — jxu edu-rqiut ydtun ev jxu ucyhf je vydt.\n\... | [{"type": "stdin_stdout", "input": "10526\n", "output": "971513\n"}, {"type": "stdin_stdout", "input": "11183\n", "output": "999931\n"}, {"type": "stdin_stdout", "input": "10107\n", "output": "953077\n"}, {"type": "stdin_stdout", "input": "10476\n", "output": "969481\n"}, {"type": "stdin_stdout", "input": "10962\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters.\nDetermine whether we can turn S into a palindrome by repeating the operation of swapping two adjacent characters. If it is possible, find the minimum requ... | [{"type": "stdin_stdout", "input": "ataatmma\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "aatltmaa", "output": "-1\n"}, {"type": "stdin_stdout", "input": "aamtltaa", "output": "-1\n"}, {"type": "stdin_stdout", "input": "aamaltta", "output": "-1\n"}, {"type": "stdin_stdout", "input": "attlamaa", "output": "-... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.