ReasonFLux-Coder
Collection
Coding LLMs excel at both writing code and generating unit tests. • 9 items • Updated • 11
dataset stringclasses 1
value | solutions null | task_id int64 0 467 | exe_method stringclasses 1
value | example_input sequencelengths 1 5 | example_output sequencelengths 1 5 | test_input sequencelengths 1 20 | test_output sequencelengths 1 20 | question stringlengths 474 5.27k | test_time_limit int64 1 1 |
|---|---|---|---|---|---|---|---|---|---|
Codeforces_test | null | 0 | stdin | [
"8\n1\n0\n2\n01\n10\n3\n010\n000\n101\n4\n0110\n1001\n1001\n0110\n11\n11111110111\n10000010010\n10111010011\n10111010011\n10111010001\n10000010000\n11111110101\n00000000111\n11011010011\n10010101100\n11101010100\n11\n11011111110\n10010000010\n00010111010\n10010111010\n01010111010\n11010000010\n01011111110\n11000000... | [
"0\n4\n9\n355\n593092633\n438667113\n922743932\n155\n"
] | [
"2\n13\n1011111101110\n1011101111111\n1111011111110\n1111111111111\n1111101001111\n1011111011111\n1111101111110\n1101001111111\n1110111010111\n1101111011111\n0111111011011\n1111111111011\n1110111111000\n13\n1010010110000\n0010010010110\n1010100011010\n1011000110011\n0001110100011\n1100000010000\n1111111000111\n0101... | [
"283846468\n932959163\n",
"4876\n",
"0\n",
"64\n",
"4064\n",
"65822\n",
"1565933\n",
"37486795\n",
"220548424\n",
"814456507\n",
"504219283\n",
"563273889\n",
"890361504\n",
"6370940\n",
"500253357\n",
"981554370\n",
"418313361\n",
"420066028\n",
"816404576\n",
"282047794\n"
] | In a two-dimensional universe, a star can be represented by a point $$$(x,y)$$$ on a two-dimensional plane. Two stars are directly connected if and only if their $$$x$$$ or $$$y$$$ coordinates are the same, and there are no other stars on the line segment between them. Define a galaxy as a connected component composed ... | 1 |
Codeforces_test | null | 1 | stdin | [
"5\n1\n0 0\n1\n0 1\n1\n1 1\n3\n0 0 1 0 1 0\n3\n0 1 1 1 0 0\n"
] | [
"0 0\n1 1\n0 0\n0 2\n1 3\n"
] | [
"5\n1\n0 0\n1\n0 1\n1\n1 1\n3\n0 0 1 0 1 0\n3\n0 1 1 1 0 0\n"
] | [
"0 0\n1 1\n0 0\n0 2\n1 3\n"
] | Alice has just crafted a circuit with $$$n$$$ lights and $$$2n$$$ switches. Each component (a light or a switch) has two states: on or off. The lights and switches are arranged in a way that:
- Each light is connected to exactly two switches.
- Each switch is connected to exactly one light. It's unknown which light ea... | 1 |
Codeforces_test | null | 2 | stdin | [
"2\n6\n\n3 4\n\n3 4\n\n2 3\n\n10\n\n3 4\n\n6 7\n"
] | [
"? 6 1 2 3 4 5 6\n\n? 4 3 6 1 5\n\n? 4 3 6 2 5\n\n! 3 6\n\n? 6 1 3 7 8 9 10\n\n? 8 1 2 3 4 5 6 7 8\n\n! 6 5\n"
] | [
"2\n6\n6 2 3 5 1 4\n10\n10 9 8 7 6 5 4 3 2 1\n"
] | [
"5\n3\n"
] | This is an interactive problem.
Returning from a restful vacation on Australia's Gold Coast, Penchick forgot to bring home gifts for his pet duck Duong Canh! But perhaps a beautiful problem crafted through deep thought on the scenic beaches could be the perfect souvenir.
There is a hidden permutation$$$^{\text{∗}}$$$... | 1 |
Codeforces_test | null | 3 | stdin | [
"5\n4\n1 2\n2 3\n3 4\n2\n1 2\n4\n1 2\n1 3\n1 4\n8\n3 7\n2 4\n1 2\n2 5\n3 6\n1 3\n3 8\n6\n2 3\n1 2\n3 6\n1 5\n1 4\n"
] | [
"1\n0\n3\n7\n3\n"
] | [
"5\n4\n1 2\n2 3\n3 4\n2\n1 2\n4\n1 2\n1 3\n1 4\n8\n3 7\n2 4\n1 2\n2 5\n3 6\n1 3\n3 8\n6\n2 3\n1 2\n3 6\n1 5\n1 4\n"
] | [
"1\n0\n3\n7\n3\n"
] | In the heart of an ancient kingdom grows the legendary Tree of Life — the only one of its kind and the source of magical power for the entire world. The tree consists of $$$n$$$ nodes. Each node of this tree is a magical source, connected to other such sources through magical channels (edges). In total, there are $$$n-... | 1 |
Codeforces_test | null | 4 | stdin | [
"4\n4 4\n1 2 3 2\n8 15\n1 2 3 4 5 6 7 8\n6 1\n1 1 1 1 1 1\n16 9\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\n"
] | [
"2\n1\n0\n4\n"
] | [
"4\n4 4\n1 2 3 2\n8 15\n1 2 3 4 5 6 7 8\n6 1\n1 1 1 1 1 1\n16 9\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\n"
] | [
"2\n1\n0\n4\n"
] | Alice and Bob are playing a game. There are $$$n$$$ ($$$n$$$ is even) integers written on a blackboard, represented by $$$x_1, x_2, \ldots, x_n$$$. There is also a given integer $$$k$$$ and an integer score that is initially $$$0$$$. The game lasts for $$$\frac{n}{2}$$$ turns, in which the following events happen seque... | 1 |
Codeforces_test | null | 5 | stdin | [
"4 4\n.//.\n.\\\\.\n.\\/.\n....\n",
"4 6\n./..\\.\n.\\...\\\n./../\\\n......\n",
"4 4\n....\n./\\.\n.\\/.\n....\n"
] | [
"2\nN3 W2\n",
"2\nE3 S2\n",
"0\n"
] | [
"4 4\n.//.\n.\\\\.\n.\\/.\n....\n",
"4 6\n./..\\.\n.\\...\\\n./../\\\n......\n",
"4 4\n....\n./\\.\n.\\/.\n....\n",
"1 1\n/\n",
"1 1\n\\\n",
"2 2\n\\/\n..\n",
"2 2\n./\n.\\\n",
"3 6\n......\n./....\n......\n",
"3 3\n.//\n//.\n/..\n",
"3 3\n///\n///\n///\n",
"3 3\n/\\.\n\\\\\\\n\\/\\\n"
] | [
"2\nN3 W2\n",
"2\nE3 S2\n",
"0\n",
"4\nE1 N1 S1 W1\n",
"4\nE1 N1 S1 W1\n",
"2\nN1 N2\n",
"2\nE1 E2\n",
"4\nE2 N2 S2 W2\n",
"2\nN3 W3\n",
"0\n",
"2\nE3 W2\n"
] | You are given a grid of $$$R$$$ rows (numbered from $$$1$$$ to $$$R$$$ from north to south) and $$$C$$$ columns (numbered from $$$1$$$ to $$$C$$$ from west to east). Every cell in this grid is a square of the same size. The cell located at row $$$r$$$ and column $$$c$$$ is denoted as $$$(r, c)$$$. Each cell can either ... | 1 |
Codeforces_test | null | 6 | stdin | [
"7\nSS\nR\nRPS\nRPPP\nSPPRSP\nPPP\nPR\n"
] | [
"3\n1\n3\n6\n7\n5\n3\n"
] | [
"7\nSS\nR\nRPS\nRPPP\nSPPRSP\nPPP\nPR\n"
] | [
"3\n1\n3\n6\n7\n5\n3\n"
] | Rock-Paper-Scissors is a game for two players. It is played in rounds. During each round, every player chooses one of three moves: Rock, Paper, or Scissors. Depending on the chosen moves, the following happens:
- if one player chooses Rock and the other player chooses Paper, the player who chooses Paper wins and gets ... | 1 |
Codeforces_test | null | 7 | stdin | [
"7\n3\n1 2 3\n3 2 2\n1\n13\n45\n5\n5 4 7 8 6\n4 4 5 5 5\n4\n6 4 8 8\n12 13 14 12\n3\n92856133 46637598 12345678\n29384774 73775896 87654321\n2\n65 12\n110 31\n4\n677810235 275091182 428565855 720629731\n74522416 889934149 3394714 230851724\n"
] | [
"4\n4\n0\n6552\n722019507\n541\n665443265\n"
] | [
"7\n3\n1 2 3\n3 2 2\n1\n13\n45\n5\n5 4 7 8 6\n4 4 5 5 5\n4\n6 4 8 8\n12 13 14 12\n3\n92856133 46637598 12345678\n29384774 73775896 87654321\n2\n65 12\n110 31\n4\n677810235 275091182 428565855 720629731\n74522416 889934149 3394714 230851724\n"
] | [
"4\n4\n0\n6552\n722019507\n541\n665443265\n"
] | This is the hard version of this problem. The only difference is that you need to output the number of choices of games where Bob wins in this version, where the number of stones in each pile are not fixed. You must solve both versions to be able to hack.
Alice and Bob are playing a familiar game where they take turns... | 1 |
Codeforces_test | null | 8 | stdin | [
"3\n2\n5\n9\n"
] | [
"4\n29\n165\n"
] | [
"3\n2\n5\n9\n",
"9\n10000\n10001\n10002\n10003\n10004\n10005\n10006\n10007\n10008\n",
"1\n99999\n",
"1\n100000\n",
"1\n66320\n",
"1\n83160\n",
"1\n98280\n",
"20\n4810\n4811\n4812\n4813\n4814\n4815\n4816\n4817\n4818\n4819\n4820\n4821\n4822\n4823\n4824\n4825\n4826\n4827\n4828\n4829\n",
"19\n5092\n5093... | [
"4\n29\n165\n",
"926353610\n930486251\n910514688\n935141989\n320198968\n685185061\n735275092\n735295105\n425719120\n",
"527066026\n",
"668533589\n",
"823050396\n",
"601463362\n",
"565515786\n",
"939583113\n942299934\n39026730\n39036355\n918112810\n14110953\n98095962\n98105595\n365228036\n366548073\n71... | This is the easy version of the problem. The only differences between the two versions of this problem are the constraints on $$$t$$$, $$$m$$$, and the sum of $$$m$$$. You can only make hacks if both versions of the problem are solved.
For an integer array $$$a$$$ of length $$$n$$$, define $$$f(k)$$$ as the greatest c... | 1 |
Codeforces_test | null | 9 | stdin | [
"3\n5\n1 3 1 3 4\n3\n1 2 3\n4\n4 4 4 4\n"
] | [
"4\n4\n1\n"
] | [
"3\n5\n1 3 1 3 4\n3\n1 2 3\n4\n4 4 4 4\n"
] | [
"4\n4\n1\n"
] | Alice and Bob play a game. There are $$$n$$$ marbles, the $$$i$$$-th of them has color $$$c_i$$$. The players take turns; Alice goes first, then Bob, then Alice again, then Bob again, and so on.
During their turn, a player must take one of the remaining marbles and remove it from the game. If there are no marbles left... | 1 |
Codeforces_test | null | 10 | stdin | [
"3\n3 3 3\n",
"4\n2 2 4 4\n",
"9\n4 2 6 9 7 7 7 3 3\n"
] | [
"36\n",
"44\n",
"10858\n"
] | [
"3\n3 3 3\n",
"4\n2 2 4 4\n",
"9\n4 2 6 9 7 7 7 3 3\n",
"2\n1 1\n",
"2\n1 2\n",
"2\n2 2\n",
"20\n6 11 8 18 18 9 9 17 13 11 2 6 8 20 10 16 17 13 17 13\n",
"20\n20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n",
"20\n20 11 17 18 13 17 13 16 14 14 17 12 16 13 16 17 10 11 11 19\n",
"20\n2... | [
"36\n",
"44\n",
"10858\n",
"2\n",
"0\n",
"4\n",
"345471941\n",
"814884643\n",
"391972057\n",
"371292043\n",
"870560372\n",
"343901199\n",
"779046866\n",
"627430749\n",
"758557443\n",
"833255082\n",
"324930452\n",
"432017879\n",
"451884715\n",
"501309126\n"
] | You are playing the Greatest Common Divisor Deck-Building Card Game (GCDDCG). There are $$$N$$$ cards (numbered from $$$1$$$ to $$$N$$$). Card $$$i$$$ has the value of $$$A_i$$$, which is an integer between $$$1$$$ and $$$N$$$ (inclusive).
The game consists of $$$N$$$ rounds (numbered from $$$1$$$ to $$$N$$$). Within ... | 1 |
Codeforces_test | null | 11 | stdin | [
"4\n2\naa\n3\naba\n4\nabcb\n12\nabcabcabcabc\n"
] | [
"No\nnO\nYes\nYES\n"
] | [
"4\n2\naa\n3\naba\n4\nabcb\n12\nabcabcabcabc\n",
"1\n7\nhonglan\n"
] | [
"No\nNo\nYes\nYes\n",
"Yes\n"
] | Turtle thinks a string $$$s$$$ is a good string if there exists a sequence of strings $$$t_1, t_2, \ldots, t_k$$$ ($$$k$$$ is an arbitrary integer) such that:
- $$$k \ge 2$$$.
- $$$s = t_1 + t_2 + \ldots + t_k$$$, where $$$+$$$ represents the concatenation operation. For example, $$$\texttt{abc} = \texttt{a} + \texttt... | 1 |
Codeforces_test | null | 12 | stdin | [
"9\n4 4\n2 3 4 5\n4 3\n2 3 4 5\n4 3\n3 4 8 9\n3 3\n6 2 1\n1 1\n1\n7 5\n14 34 6 25 46 7 17\n6 5\n40 80 99 60 90 50\n6 5\n64 40 50 68 70 10\n2 1\n1 1000000000\n"
] | [
"5\n-1\n10\n8\n1\n47\n100\n-1\n-1\n"
] | [
"9\n4 4\n2 3 4 5\n4 3\n2 3 4 5\n4 3\n3 4 8 9\n3 3\n6 2 1\n1 1\n1\n7 5\n14 34 6 25 46 7 17\n6 5\n40 80 99 60 90 50\n6 5\n64 40 50 68 70 10\n2 1\n1 1000000000\n"
] | [
"5\n-1\n10\n8\n1\n47\n100\n-1\n-1\n"
] | There is an apartment consisting of $$$n$$$ rooms, each with its light initially turned off.
To control the lights in these rooms, the owner of the apartment decided to install chips in the rooms so that each room has exactly one chip, and the chips are installed at different times. Specifically, these times are repre... | 1 |
Codeforces_test | null | 13 | stdin | [
"4\n2 3 7\nS.\n..\n2 3 7\nS.\n.W\n2 7 3\nS.\n.W\n4 999999999 1000000000\nW.S.\nW..W\n",
"2\n6 6 7\nW....W\nW.S..W\n6 6 7\nW...WW\n..S..W\n"
] | [
"0\n3\n6\n2999999997\n",
"21\n20\n"
] | [
"4\n2 3 7\nS.\n..\n2 3 7\nS.\n.W\n2 7 3\nS.\n.W\n4 999999999 1000000000\nW.S.\nW..W\n",
"2\n6 6 7\nW....W\nW.S..W\n6 6 7\nW...WW\n..S..W\n"
] | [
"0\n3\n6\n2999999997\n",
"21\n20\n"
] | In a game you started playing recently, there is a field that can be represented as a rectangular grid. The field has $$$2$$$ rows and $$$n$$$ columns — $$$2n$$$ cells in total.
Some cells are empty, but some are occupied by wolves. In the beginning of the game, you have one sheep in some cell, and you'd like to save ... | 1 |
Codeforces_test | null | 14 | stdin | [
"6\n7\n3 6 4 9 2 5 2\n5\n5 4 4 2 2\n8\n2 2 4 4 6 6 10 10\n1\n1000\n9\n6 8 9 10 12 9 7 5 4\n7\n300000000 600000000 400000000 900000000 200000000 400000000 200000000\n"
] | [
"2\n0\n6\n0\n4\n2\n"
] | [
"6\n7\n3 6 4 9 2 5 2\n5\n5 4 4 2 2\n8\n2 2 4 4 6 6 10 10\n1\n1000\n9\n6 8 9 10 12 9 7 5 4\n7\n300000000 600000000 400000000 900000000 200000000 400000000 200000000\n"
] | [
"2\n0\n6\n0\n4\n2\n"
] | Stalin Sort is a humorous sorting algorithm designed to eliminate elements which are out of place instead of bothering to sort them properly, lending itself to an $$$\mathcal{O}(n)$$$ time complexity.
It goes as follows: starting from the second element in the array, if it is strictly smaller than the previous element... | 1 |
Codeforces_test | null | 15 | stdin | [
"3\n3\n1 2 3\n5 4 6\n5\n1 2 3 6 8\n5 4 7 9 10\n5\n3 1 4 1 5\n7 2 6 5 10\n"
] | [
"3\n4\n4\n"
] | [
"3\n3\n1 2 3\n5 4 6\n5\n1 2 3 6 8\n5 4 7 9 10\n5\n3 1 4 1 5\n7 2 6 5 10\n"
] | [
"3\n4\n4\n"
] | This is the hard version of the problem. In this version, the constraints on $$$n$$$ and the time limit are higher. You can make hacks only if both versions of the problem are solved.
A set of (closed) segments is complex if it can be partitioned into some subsets such that
- all the subsets have the same size; and
-... | 1 |
Codeforces_test | null | 16 | stdin | [
"5\n5\n1 -1 10 1 1\n5\n-1 -1 -1 -1 -1\n2\n-1 2\n2\n7 1\n3\n1 4 -1\n"
] | [
"8\n-1 0 1 2 9 10 11 12 \n6\n-5 -4 -3 -2 -1 0 \n4\n-1 0 1 2 \n4\n0 1 7 8 \n6\n-1 0 1 3 4 5\n"
] | [
"5\n5\n1 -1 10 1 1\n5\n-1 -1 -1 -1 -1\n2\n-1 2\n2\n7 1\n3\n1 4 -1\n",
"1\n4\n-1 1 1 1\n",
"1\n19\n1 -1 1 1 -1 1 1 1 1 1 1 1 1 -1 1 -1 -1 -1 1\n",
"1\n3\n1 1 -1\n"
] | [
"8\n-1 0 1 2 9 10 11 12 \n6\n-5 -4 -3 -2 -1 0 \n4\n-1 0 1 2 \n4\n0 1 7 8 \n6\n-1 0 1 3 4 5 \n",
"5\n-1 0 1 2 3 \n",
"13\n-3 -2 -1 0 1 2 3 4 5 6 7 8 9 \n",
"4\n-1 0 1 2 \n"
] | You are given an array $$$a$$$ of $$$n$$$ integers, where all elements except for at most one are equal to $$$-1$$$ or $$$1$$$. The remaining element $$$x$$$ satisfies $$$-10^9 \le x \le 10^9$$$.
Find all possible sums of subarrays of $$$a$$$, including the empty subarray, whose sum is defined as $$$0$$$. In other wor... | 1 |
Codeforces_test | null | 17 | stdin | [
"4\n2\n2 1\n2 1\n3\n1 2 3\n3 2 1\n4\n2 1 4 3\n4 2 3 1\n5\n1 4 3 2 5\n5 2 3 4 1\n"
] | [
"0\n1\n1 3\n3\n1 4\n2 4\n1 3\n4\n1 2\n4 5\n2 5\n1 4\n"
] | [
"4\n2\n2 1\n2 1\n3\n1 2 3\n3 2 1\n4\n2 1 4 3\n4 2 3 1\n5\n1 4 3 2 5\n5 2 3 4 1\n"
] | [
"0\n1\n1 3\n3\n1 4\n2 4\n1 3\n4\n1 2\n4 5\n2 5\n1 4\n"
] | You are given two permutations $$$p_1,p_2,\ldots,p_n$$$ and $$$q_1,q_2,\ldots,q_n$$$ of length $$$n$$$. In one operation, you can select two integers $$$1\leq i,j\leq n,i\neq j$$$ and swap $$$p_i$$$ and $$$p_j$$$. The cost of the operation is $$$\min (|i-j|,|p_i-p_j|)$$$.
Find the minimum cost to make $$$p_i = q_i$$$ ... | 1 |
Codeforces_test | null | 18 | stdin | [
"9\n2\n1 1\n2\n2 1\n4\n1 1 4 4\n4\n3 4 3 3\n4\n2 3 4 4\n6\n3 3 4 5 3 3\n6\n2 2 2 4 4 4\n8\n1 1 1 1 1 1 1 4\n10\n9 9 9 10 10 10 10 10 10 10\n"
] | [
"Yes\nNo\nYes\nYes\nNo\nYes\nNo\nYes\nYes\n"
] | [
"9\n2\n1 1\n2\n2 1\n4\n1 1 4 4\n4\n3 4 3 3\n4\n2 3 4 4\n6\n3 3 4 5 3 3\n6\n2 2 2 4 4 4\n8\n1 1 1 1 1 1 1 4\n10\n9 9 9 10 10 10 10 10 10 10\n"
] | [
"Yes\nNo\nYes\nYes\nNo\nYes\nNo\nYes\nYes\n"
] | You have two large bags of numbers. Initially, the first bag contains $$$n$$$ numbers: $$$a_1, a_2, \ldots, a_n$$$, while the second bag is empty. You are allowed to perform the following operations:
- Choose any number from the first bag and move it to the second bag.
- Choose a number from the first bag that is also... | 1 |
Codeforces_test | null | 19 | stdin | [
"5\n5\n1 5\n2 4\n3 3\n4 2\n5 1\n3\n2 2\n1 1\n1 2\n1\n3 2\n3\n100 100\n100 100\n100 100\n4\n1 4\n2 3\n1 5\n3 2\n"
] | [
"20\n8\n10\n400\n16\n"
] | [
"5\n5\n1 5\n2 4\n3 3\n4 2\n5 1\n3\n2 2\n1 1\n1 2\n1\n3 2\n3\n100 100\n100 100\n100 100\n4\n1 4\n2 3\n1 5\n3 2\n"
] | [
"20\n8\n10\n400\n16\n"
] | You are coloring an infinite square grid, in which all cells are initially white. To do this, you are given $$$n$$$ stamps. Each stamp is a rectangle of width $$$w_i$$$ and height $$$h_i$$$.
You will use each stamp exactly once to color a rectangle of the same size as the stamp on the grid in black. You cannot rotate ... | 1 |
Codeforces_test | null | 20 | stdin | [
"6\n1\n2\n2\n2 19\n3\n1 3 20\n4\n1 2 3 4\n5\n1 2 3 4 5\n6\n1 2 1 1 1 25\n"
] | [
"-1\n-1\n0\n15\n16\n0\n"
] | [
"6\n1\n2\n2\n2 19\n3\n1 3 20\n4\n1 2 3 4\n5\n1 2 3 4 5\n6\n1 2 1 1 1 25\n"
] | [
"-1\n-1\n0\n15\n16\n0\n"
] | Look around, the rich are getting richer, and the poor are getting poorer. We need to take from the rich and give to the poor. We need Robin Hood!
There are $$$n$$$ people living in the town. Just now, the wealth of the $$$i$$$-th person was $$$a_i$$$ gold. But guess what? The richest person has found an extra pot of ... | 1 |
Codeforces_test | null | 21 | stdin | [
"4\n4 4 3\n1 2 3 4\n1 3 4\n5 4 3\n1 2 3 4\n1 3 4\n4 4 4\n1 2 3 4\n1 2 3 4\n2 2 1\n1 2\n2\n"
] | [
"0100\n0000\n1111\n10\n"
] | [
"4\n4 4 3\n1 2 3 4\n1 3 4\n5 4 3\n1 2 3 4\n1 3 4\n4 4 4\n1 2 3 4\n1 2 3 4\n2 2 1\n1 2\n2\n"
] | [
"0100\n0000\n1111\n10\n"
] | Monocarp is preparing for his first exam at the university. There are $$$n$$$ different questions which can be asked during the exam, numbered from $$$1$$$ to $$$n$$$. There are $$$m$$$ different lists of questions; each list consists of exactly $$$n-1$$$ different questions. Each list $$$i$$$ is characterized by one i... | 1 |
Codeforces_test | null | 22 | stdin | [
"6\n2\n2 2\n6\n1 3 6 10 15 21\n5\n6 30 18 36 9\n1\n1000000000\n6\n1 1 4 5 1 4\n12\n70 130 90 90 90 108 612 500 451 171 193 193\n"
] | [
"3\n18\n5\n1\n18\n53\n"
] | [
"6\n2\n2 2\n6\n1 3 6 10 15 21\n5\n6 30 18 36 9\n1\n1000000000\n6\n1 1 4 5 1 4\n12\n70 130 90 90 90 108 612 500 451 171 193 193\n"
] | [
"3\n18\n5\n1\n18\n53\n"
] | Let there be a set that contains distinct positive integers. To expand the set to contain as many integers as possible, Eri can choose two integers $$$x\neq y$$$ from the set such that their average $$$\frac{x+y}2$$$ is still a positive integer and isn't contained in the set, and add it to the set. The integers $$$x$$$... | 1 |
Codeforces_test | null | 23 | stdin | [
"5\nqwq\nppppp\npppwwwqqq\nwqpqwpqwwqp\npqpqpqpq\n"
] | [
"pwp\nqqqqq\npppwwwqqq\nqpwwpqwpqpw\npqpqpqpq\n"
] | [
"5\nqwq\nppppp\npppwwwqqq\nwqpqwpqwwqp\npqpqpqpq\n",
"1\npwwwqppppwppwwwpwwwppqpwwqppqpppwwwwpwwwwpwwwwqwqqwwww\n"
] | [
"pwp\nqqqqq\npppwwwqqq\nqpwwpqwpqpw\npqpqpqpq\n",
"wwwwppwpwwwwqwwwwqwwwwqqqpqqpwwqpqqwwwqwwwqqwqqqqpwwwq\n"
] | A string consisting of only characters 'p', 'q', and 'w' is painted on a glass window of a store. Ship walks past the store, standing directly in front of the glass window, and observes string $$$a$$$. Ship then heads inside the store, looks directly at the same glass window, and observes string $$$b$$$.
Ship gives yo... | 1 |
Codeforces_test | null | 24 | stdin | [
"3\n10\n1 2 3 4 5 6 7 8 9 10\n11\n1 6 9 4 7 4 4 10 3 2 3\n4\n527792568 502211460 850237282 374773208\n"
] | [
"1 3 8 13 46 59 126 149 1174 1311 \n1 7 22 26 70 74 150 1303 1306 1308 1568 \n527792568 83665723 399119771 773892979\n"
] | [
"3\n10\n1 2 3 4 5 6 7 8 9 10\n11\n1 6 9 4 7 4 4 10 3 2 3\n4\n527792568 502211460 850237282 374773208\n",
"1\n3\n999999998 2097152 1048576\n"
] | [
"1 3 8 13 46 59 126 149 1174 1311 \n1 7 22 26 70 74 150 1303 1306 1308 1568 \n527792568 83665723 399119771 773892979 \n",
"999999998 2097143 546480318 \n"
] | You are given an array $$$b$$$ of length $$$m$$$. You can perform the following operation any number of times (possibly zero):
- Choose two distinct indices $$$i$$$ and $$$j$$$ where $$$\bf{1\le i < j\le m}$$$ and $$$b_i$$$ is even, divide $$$b_i$$$ by $$$2$$$ and multiply $$$b_j$$$ by $$$2$$$.
Since this problem is ... | 1 |
Codeforces_test | null | 25 | stdin | [
"6\n2 3\n10\n2 3\n11\n5 1\n11101\n7 9\n1101011\n17 34\n11001010001010010\n1 1000000000\n1\n"
] | [
"3\n2\n0\n8\n32\n0\n"
] | [
"6\n2 3\n10\n2 3\n11\n5 1\n11101\n7 9\n1101011\n17 34\n11001010001010010\n1 1000000000\n1\n"
] | [
"3\n2\n0\n8\n32\n0\n"
] | This is the hard version of the problem. The difference between the versions is that in this version, the constraints on $$$t$$$, $$$k$$$, and $$$m$$$ are higher. You can hack only if you solved all versions of this problem.
A sequence $$$a$$$ of $$$n$$$ integers is called good if the following condition holds:
- Let... | 1 |
We use Stdio input/output format here. For example, for the task to calculate the sum of a list, the input and output are in the following format:
input = "5\n1 2 3 4 5\n"
output = "15"
CodeContests and CodeForces are using this format, however, MBPP and part of LiveCodeBench are using functional input/output format, such like
assert sum_function([1, 2, 3, 4, 5]) == 15
In this project, we have converted the the functional format to the Stdio format to achieve consistency.
@article{wang2025cure,
title={Co-Evolving LLM Coder and Unit Tester via Reinforcement Learning},
author={Wang, Yinjie and Yang, Ling and Tian, Ye and Shen, Ke and Wang, Mengdi},
journal={arXiv preprint arXiv:2506.03136},
year={2025}
}
@misc{penedo2025codeforces,
title={CodeForces},
author={Guilherme Penedo and Anton Lozhkov and Hynek Kydlíček and Loubna Ben Allal and Edward Beeching and Agustín Piqueres Lajarín and Quentin Gallouédec and Nathan Habib and Lewis Tunstall and Leandro von Werra},
year={2025},
publisher = {Hugging Face},
journal = {Hugging Face repository},
howpublished = {\url{https://huggingface.co/datasets/open-r1/codeforces}}
}