id stringlengths 6 7 | prompt stringlengths 783 4.98k | instructions stringclasses 1
value | inputs stringlengths 56 547 | environment stringclasses 12
values | resources stringclasses 1
value | grader stringlengths 180 181 | difficulty float64 800 3.5k | metadata stringlengths 255 379 |
|---|---|---|---|---|---|---|---|---|
1575_A | Andi and Budi were given an assignment to tidy up their bookshelf of n books. Each book is represented by the book title — a string s_i numbered from 1 to n, each with length m. Andi really wants to sort the book lexicographically ascending, while Budi wants to sort it lexicographically descending.
Settling their figh... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5 2\nAA\nAB\nBB\nBA\nAZ\n", "output": "5 2 1 3 4 \n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_A.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,100 | {"cf_contest_id": 1575, "cf_index": "A", "cf_rating": 1100, "cf_tags": ["data structures", "sortings", "strings"], "difficulty": "A", "memory_limit_bytes": 512000000, "name": "1575_A. Another Sorting Problem", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 1}, "time_limit": 2.0} |
1575_B | Mr. Chanek lives in a city represented as a plane. He wants to build an amusement park in the shape of a circle of radius r. The circle must touch the origin (point (0, 0)).
There are n bird habitats that can be a photo spot for the tourists in the park. The i-th bird habitat is at point p_i = (x_i, y_i).
Find the m... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "8 4\n-3 1\n-4 4\n1 5\n2 2\n2 -2\n-2 -4\n-1 -1\n-6 0\n", "output": "3.162277660\n"}, {"input": "1 1\n0 0\n", "output": "0.000000000\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 15.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_B.json.gz", "timeout": 15.0}, "kind": "codecontest_tests"} | 2,300 | {"cf_contest_id": 1575, "cf_index": "B", "cf_rating": 2300, "cf_tags": ["binary search", "geometry"], "difficulty": "B", "memory_limit_bytes": 512000000, "name": "1575_B. Building an Amusement Park", "source": "codeforces", "tests": {"generated": 200, "private": 7, "public": 2}, "time_limit": 5.0} |
1575_C | Denote a cyclic sequence of size n as an array s such that s_n is adjacent to s_1. The segment s[r, l] where l < r is the concatenation of s[r, n] and s[1, l].
You are given an array a consisting of n integers. Define b as the cyclic sequence obtained from concatenating m copies of a. Note that b has size n ⋅ m.
You ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5 1 5\n1 2 3 4 3\n", "output": "4\n"}, {"input": "5 1 5\n1 2 3 4 5\n", "output": "5\n"}, {"input": "5 4 5\n1 2 3 4 5\n", "output": "125\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 9.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_C.json.gz", "timeout": 9.0}, "kind": "codecontest_tests"} | 3,000 | {"cf_contest_id": 1575, "cf_index": "C", "cf_rating": 3000, "cf_tags": ["data structures", "fft", "number theory"], "difficulty": "C", "memory_limit_bytes": 512000000, "name": "1575_C. Cyclic Sum", "source": "codeforces", "tests": {"generated": 200, "private": 3, "public": 3}, "time_limit": 3.0} |
1575_D | Mr. Chanek has an integer represented by a string s. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer s, where s is divisible by 25. Of course, ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "0\n", "output": "1\n"}, {"input": "_XX\n", "output": "9\n"}, {"input": "_00\n", "output": "9\n"}, {"input": "0_25\n", "output": "0\n"}, {"input": "25\n", "output": "1\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_D.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,800 | {"cf_contest_id": 1575, "cf_index": "D", "cf_rating": 1800, "cf_tags": ["brute force", "dfs and similar", "dp"], "difficulty": "D", "memory_limit_bytes": 512000000, "name": "1575_D. Divisible by Twenty-Five", "source": "codeforces", "tests": {"generated": 200, "private": 69, "public": 5}, "time_limit": 2.0} |
1575_E | There is a city park represented as a tree with n attractions as its vertices and n - 1 rails as its edges. The i-th attraction has happiness value a_i.
Each rail has a color. It is either black if t_i = 0, or white if t_i = 1. Black trains only operate on a black rail track, and white trains only operate on a white r... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5 0\n1 3 2 6 4\n1 2 1\n1 4 0\n3 2 1\n2 5 0\n", "output": "45"}, {"input": "3 1\n1 1 1\n1 2 1\n3 2 0\n", "output": "10"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 12.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_E.json.gz", "timeout": 12.0}, "kind": "codecontest_tests"} | 2,600 | {"cf_contest_id": 1575, "cf_index": "E", "cf_rating": 2600, "cf_tags": ["data structures", "trees"], "difficulty": "E", "memory_limit_bytes": 512000000, "name": "1575_E. Eye-Pleasing City Park Tour", "source": "codeforces", "tests": {"generated": 200, "private": 2, "public": 2}, "time_limit": 4.0} |
1575_F | Mr. Chanek opened a letter from his fellow, who is currently studying at Singanesia. Here is what it says.
Define an array b (0 ≤ b_i < k) with n integers. While there exists a pair (i, j) such that b_i ≠ b_j, do the following operation:
* Randomly pick a number i satisfying 0 ≤ i < n. Note that each number i has a... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "10 9\n-1 0 -1 1 1 2 2 3 3 3\n", "output": "652419213\n"}, {"input": "3 3\n-1 -1 -1\n", "output": "11\n"}, {"input": "2 2\n0 -1\n", "output": "1\n"}, {"input": "3 3\n0 1 1\n", "output": "12\n"}, {"input": "2 2\n0 1\n", "output": "2\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 9.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_F.json.gz", "timeout": 9.0}, "kind": "codecontest_tests"} | 2,900 | {"cf_contest_id": 1575, "cf_index": "F", "cf_rating": 2900, "cf_tags": ["math"], "difficulty": "F", "memory_limit_bytes": 512000000, "name": "1575_F. Finding Expected Value", "source": "codeforces", "tests": {"generated": 200, "private": 24, "public": 5}, "time_limit": 3.0} |
1575_G | Mr. Chanek has an array a of n integers. The prettiness value of a is denoted as:
$$$∑_{i=1}^{n} {∑_{j=1}^{n} {\gcd(a_i, a_j) ⋅ \gcd(i, j)}}$$$
where \gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y.
In other words, the prettiness value of an array a is the total sum of \gcd(a_i, a_j) ⋅ \gcd(... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5\n3 6 2 1 4\n", "output": "77\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 9.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_G.json.gz", "timeout": 9.0}, "kind": "codecontest_tests"} | 2,200 | {"cf_contest_id": 1575, "cf_index": "G", "cf_rating": 2200, "cf_tags": ["math", "number theory"], "difficulty": "G", "memory_limit_bytes": 512000000, "name": "1575_G. GCD Festival", "source": "codeforces", "tests": {"generated": 200, "private": 2, "public": 1}, "time_limit": 3.0} |
1575_H | The Winter holiday will be here soon. Mr. Chanek wants to decorate his house's wall with ornaments. The wall can be represented as a binary string a of length n. His favorite nephew has another binary string b of length m (m ≤ n).
Mr. Chanek's nephew loves the non-negative integer k. His nephew wants exactly k occurre... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "9 3\n100101011\n101\n", "output": "1 1 0 1 6 -1 -1 -1 \n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 9.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_H.json.gz", "timeout": 9.0}, "kind": "codecontest_tests"} | 2,200 | {"cf_contest_id": 1575, "cf_index": "H", "cf_rating": 2200, "cf_tags": ["dp", "strings"], "difficulty": "H", "memory_limit_bytes": 512000000, "name": "1575_H. Holiday Wall Ornaments", "source": "codeforces", "tests": {"generated": 200, "private": 27, "public": 1}, "time_limit": 3.0} |
1575_I | Chanek Jones is back, helping his long-lost relative Indiana Jones, to find a secret treasure in a maze buried below a desert full of illusions.
The map of the labyrinth forms a tree with n rooms numbered from 1 to n and n - 1 tunnels connecting them such that it is possible to travel between each pair of rooms throug... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "6 4\n10 -9 2 -1 4 -6\n1 5\n5 4\n5 6\n6 2\n6 3\n2 1 2\n1 1 -3\n2 1 2\n2 3 3\n", "output": "39\n32\n0\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 9.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_I.json.gz", "timeout": 9.0}, "kind": "codecontest_tests"} | 2,300 | {"cf_contest_id": 1575, "cf_index": "I", "cf_rating": 2300, "cf_tags": ["data structures", "trees"], "difficulty": "I", "memory_limit_bytes": 512000000, "name": "1575_I. Illusions of the Desert", "source": "codeforces", "tests": {"generated": 200, "private": 2, "public": 1}, "time_limit": 3.0} |
1575_J | Mr. Chanek has a new game called Dropping Balls. Initially, Mr. Chanek has a grid a of size n × m
Each cell (x,y) contains an integer a_{x,y} denoting the direction of how the ball will move.
* a_{x,y}=1 — the ball will move to the right (the next cell is (x, y + 1));
* a_{x,y}=2 — the ball will move to the bott... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5 5 3\n1 2 3 3 3\n2 2 2 2 2\n2 2 2 2 2\n2 2 2 2 2\n2 2 2 2 2\n1 2 1\n", "output": "2 2 1 \n"}, {"input": "1 2 2\n1 3\n1 2\n", "output": "1 2 \n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_J.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,500 | {"cf_contest_id": 1575, "cf_index": "J", "cf_rating": 1500, "cf_tags": ["binary search", "brute force", "dsu", "implementation"], "difficulty": "J", "memory_limit_bytes": 512000000, "name": "1575_J. Jeopardy of Dropped Balls", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 2}, "time_limit":... |
1575_K | Mr. Chanek wants to knit a batik, a traditional cloth from Indonesia. The cloth forms a grid a with size n × m. There are k colors, and each cell in the grid can be one of the k colors.
Define a sub-rectangle as an ordered pair of two cells ((x_1, y_1), (x_2, y_2)), denoting the top-left cell and bottom-right cell (in... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4 5 170845 2 2\n1 4 3 1\n", "output": "756680455\n"}, {"input": "3 3 2 2 2\n1 1 2 2\n", "output": "32\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_K.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 2,200 | {"cf_contest_id": 1575, "cf_index": "K", "cf_rating": 2200, "cf_tags": ["implementation", "math"], "difficulty": "K", "memory_limit_bytes": 512000000, "name": "1575_K. Knitting Batik", "source": "codeforces", "tests": {"generated": 200, "private": 28, "public": 2}, "time_limit": 2.0} |
1575_L | Mr. Chanek gives you a sequence a indexed from 1 to n. Define f(a) as the number of indices where a_i = i.
You can pick an element from the current sequence and remove it, then concatenate the remaining elements together. For example, if you remove the 3-rd element from the sequence [4, 2, 3, 1], the resulting sequen... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4\n4 2 3 1\n", "output": "2\n"}, {"input": "7\n2 1 4 2 5 3 7\n", "output": "3\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_L.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 2,100 | {"cf_contest_id": 1575, "cf_index": "L", "cf_rating": 2100, "cf_tags": ["data structures", "divide and conquer", "dp", "sortings"], "difficulty": "M", "memory_limit_bytes": 512000000, "name": "1575_L. Longest Array Deconstruction", "source": "codeforces", "tests": {"generated": 200, "private": 2, "public": 2}, "time_li... |
1575_M | Mr. Chanek's city can be represented as a plane. He wants to build a housing complex in the city.
There are some telephone poles on the plane, which is represented by a grid a of size (n + 1) × (m + 1). There is a telephone pole at (x, y) if a_{x, y} = 1.
For each point (x, y), define S(x, y) as the square of the Euc... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "2 2\n101\n000\n000\n", "output": "18\n"}, {"input": "5 4\n10010\n00000\n01000\n00001\n00100\n00010\n", "output": "36\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1575_M.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 2,400 | {"cf_contest_id": 1575, "cf_index": "M", "cf_rating": 2400, "cf_tags": ["data structures", "geometry"], "difficulty": "N", "memory_limit_bytes": 512000000, "name": "1575_M. Managing Telephone Poles", "source": "codeforces", "tests": {"generated": 200, "private": 2, "public": 2}, "time_limit": 2.0} |
1579_A | Casimir has a string s which consists of capital Latin letters 'A', 'B', and 'C' only. Each turn he can choose to do one of the two following actions:
* he can either erase exactly one letter 'A' and exactly one letter 'B' from arbitrary places of the string (these letters don't have to be adjacent);
* or he can ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "6\nABACAB\nABBA\nAC\nABC\nCABCBB\nBCBCBCBCBCBCBCBC\n", "output": "NO\nYES\nNO\nNO\nYES\nYES\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1579_A.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 800 | {"cf_contest_id": 1579, "cf_index": "A", "cf_rating": 800, "cf_tags": ["math", "strings"], "difficulty": "A", "memory_limit_bytes": 256000000, "name": "1579_A. Casimir's String Solitaire", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 1}, "time_limit": 2.0} |
1579_B | The new generation external memory contains an array of integers a[1 … n] = [a_1, a_2, …, a_n].
This type of memory does not support changing the value of an arbitrary element. Instead, it allows you to cut out any segment of the given array, cyclically shift (rotate) it by any offset and insert it back into the same ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4\n2\n2 1\n3\n1 2 1\n4\n2 4 1 3\n5\n2 5 1 4 3\n", "output": "1\n1 2 1\n1\n2 3 1\n2\n1 3 2\n3 4 1\n3\n1 3 2\n3 5 2\n4 5 1\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1579_B.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,100 | {"cf_contest_id": 1579, "cf_index": "B", "cf_rating": 1100, "cf_tags": ["implementation", "sortings"], "difficulty": "B", "memory_limit_bytes": 256000000, "name": "1579_B. Shifting Sort", "source": "codeforces", "tests": {"generated": 200, "private": 1, "public": 1}, "time_limit": 2.0} |
1579_C | Casimir has a rectangular piece of paper with a checkered field of size n × m. Initially, all cells of the field are white.
Let us denote the cell with coordinates i vertically and j horizontally by (i, j). The upper left cell will be referred to as (1, 1) and the lower right cell as (n, m).
Casimir draws ticks of di... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "8\n2 3 1\n*.*\n...\n4 9 2\n*.*.*...*\n.*.*...*.\n..*.*.*..\n.....*...\n4 4 1\n*.*.\n****\n.**.\n....\n5 5 1\n.....\n*...*\n.*.*.\n..*.*\n...*.\n5 5 2\n.....\n*...*\n.*.*.\n..*.*\n...*.\n4 7 1\n*.....*\n.....*.\n..*.*..\n...*...\n3 3 1\n***\n***\n***\n3 5 1\n*...*\n.***.\n.**..\n", "output": "NO... | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1579_C.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,500 | {"cf_contest_id": 1579, "cf_index": "C", "cf_rating": 1500, "cf_tags": ["greedy", "implementation"], "difficulty": "C", "memory_limit_bytes": 256000000, "name": "1579_C. Ticks", "source": "codeforces", "tests": {"generated": 200, "private": 9, "public": 1}, "time_limit": 2.0} |
1579_D | An important meeting is to be held and there are exactly n people invited. At any moment, any two people can step back and talk in private. The same two people can talk several (as many as they want) times per meeting.
Each person has limited sociability. The sociability of the i-th person is a non-negative integer a_... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "8\n2\n2 3\n3\n1 2 3\n4\n1 2 3 4\n3\n0 0 2\n2\n6 2\n3\n0 0 2\n5\n8 2 0 1 1\n5\n0 1 0 0 6\n", "output": "2\n2 1\n2 1\n3\n3 2\n3 1\n2 3\n5\n4 3\n4 2\n3 4\n1 2\n3 4\n0\n2\n1 2\n1 2\n0\n4\n1 2\n1 2\n1 4\n1 5\n1\n5 2\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1579_D.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,400 | {"cf_contest_id": 1579, "cf_index": "D", "cf_rating": 1400, "cf_tags": ["constructive algorithms", "graphs", "greedy"], "difficulty": "D", "memory_limit_bytes": 256000000, "name": "1579_D. Productive Meeting", "source": "codeforces", "tests": {"generated": 200, "private": 1, "public": 1}, "time_limit": 2.0} |
1579_E2 | In fact, the problems E1 and E2 do not have much in common. You should probably think of them as two separate problems.
You are given an integer array a[1 … n] = [a_1, a_2, …, a_n].
Let us consider an empty [deque](https://tinyurl.com/pfeucbux) (double-ended queue). A deque is a data structure that supports adding el... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "6\n4\n3 7 5 5\n3\n3 2 1\n3\n3 1 2\n4\n-1 2 2 -1\n4\n4 5 1 3\n5\n1 3 1 3 2\n", "output": "2\n0\n1\n0\n1\n2\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1579_E2.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,700 | {"cf_contest_id": 1579, "cf_index": "E2", "cf_rating": 1700, "cf_tags": ["data structures", "greedy"], "difficulty": "E", "memory_limit_bytes": 256000000, "name": "1579_E2. Array Optimization by Deque", "source": "codeforces", "tests": {"generated": 200, "private": 2, "public": 1}, "time_limit": 2.0} |
1579_F | You are given an array a[0 … n - 1] = [a_0, a_1, …, a_{n - 1}] of zeroes and ones only. Note that in this problem, unlike the others, the array indexes are numbered from zero, not from one.
In one step, the array a is replaced by another array of length n according to the following rules:
1. First, a new array a^{... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5\n2 1\n0 1\n3 2\n0 1 0\n5 2\n1 1 0 1 0\n4 2\n0 1 0 1\n1 1\n0\n", "output": "1\n1\n3\n-1\n0\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1579_F.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,700 | {"cf_contest_id": 1579, "cf_index": "F", "cf_rating": 1700, "cf_tags": ["brute force", "graphs", "math", "number theory", "shortest paths"], "difficulty": "F", "memory_limit_bytes": 256000000, "name": "1579_F. Array Stabilization (AND version)", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public"... |
1579_G | You are given n lengths of segments that need to be placed on an infinite axis with coordinates.
The first segment is placed on the axis so that one of its endpoints lies at the point with coordinate 0. Let's call this endpoint the "start" of the first segment and let's call its "end" as that endpoint that is not the ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "6\n2\n1 3\n3\n1 2 3\n4\n6 2 3 9\n4\n6 8 4 5\n7\n1 2 4 6 7 7 3\n8\n8 6 5 1 2 2 3 6\n", "output": "3\n3\n9\n9\n7\n8\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1579_G.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 2,200 | {"cf_contest_id": 1579, "cf_index": "G", "cf_rating": 2200, "cf_tags": ["dp"], "difficulty": "G", "memory_limit_bytes": 256000000, "name": "1579_G. Minimal Coverage", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 1}, "time_limit": 1.0} |
1580_A | CQXYM found a rectangle A of size n × m. There are n rows and m columns of blocks. Each block of the rectangle is an obsidian block or empty. CQXYM can change an obsidian block to an empty block or an empty block to an obsidian block in one operation.
A rectangle M size of a × b is called a portal if and only if it sa... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "1\n9 9\n001010001\n101110100\n000010011\n100000001\n101010101\n110001111\n000001111\n111100000\n000110000\n", "output": "5\n"}, {"input": "1\n5 4\n1000\n0000\n0110\n0000\n0001\n", "output": "12\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1580_A.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 1,700 | {"cf_contest_id": 1580, "cf_index": "A", "cf_rating": 1700, "cf_tags": ["brute force", "data structures", "dp", "greedy", "implementation"], "difficulty": "A", "memory_limit_bytes": 256000000, "name": "1580_A. Portal", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 2}, "time_limit": 1.0} |
1580_B | Let c_1, c_2, …, c_n be a permutation of integers 1, 2, …, n. Consider all subsegments of this permutation containing an integer x. Given an integer m, we call the integer x good if there are exactly m different values of maximum on these subsegments.
Cirno is studying mathematics, and the teacher asks her to count th... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "6 4 1 769626776\n", "output": "472\n"}, {"input": "99 30 18 650457567\n", "output": "77365367\n"}, {"input": "66 11 9 786747482\n", "output": "206331312\n"}, {"input": "4 3 2 10007\n", "output": "4\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1580_B.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 2,600 | {"cf_contest_id": 1580, "cf_index": "B", "cf_rating": 2600, "cf_tags": ["brute force", "combinatorics", "dp", "trees"], "difficulty": "B", "memory_limit_bytes": 256000000, "name": "1580_B. Mathematics Curriculum", "source": "codeforces", "tests": {"generated": 200, "private": 42, "public": 4}, "time_limit": 2.0} |
1580_C | Kawasiro Nitori is excellent in engineering. Thus she has been appointed to help maintain trains.
There are n models of trains, and Nitori's department will only have at most one train of each model at any moment. In the beginning, there are no trains, at each of the following m days, one train will be added, or one t... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "3 4\n10 15\n12 10\n1 1\n1 3\n1 1\n2 1\n2 3\n", "output": "0\n1\n0\n0\n"}, {"input": "5 4\n1 1\n10000000 100000000\n998244353 1\n2 1\n1 2\n1 5\n2 5\n1 5\n1 1\n", "output": "0\n0\n0\n1\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1580_C.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 2,200 | {"cf_contest_id": 1580, "cf_index": "C", "cf_rating": 2200, "cf_tags": ["brute force", "data structures", "implementation"], "difficulty": "C", "memory_limit_bytes": 512000000, "name": "1580_C. Train Maintenance", "source": "codeforces", "tests": {"generated": 200, "private": 2, "public": 2}, "time_limit": 1.0} |
1580_D | Alice has an integer sequence a of length n and all elements are different. She will choose a subsequence of a of length m, and defines the value of a subsequence a_{b_1},a_{b_2},…,a_{b_m} as $$$∑_{i = 1}^m (m ⋅ a_{b_i}) - ∑_{i = 1}^m ∑_{j = 1}^m f(min(b_i, b_j), max(b_i, b_j)), where f(i, j) denotes \min(a_i, a_{i + 1... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "6 4\n15 2 18 12 13 4\n", "output": "100\n"}, {"input": "1 1\n114514\n", "output": "0\n"}, {"input": "2 1\n666 888\n", "output": "0\n"}, {"input": "11 5\n9 3 7 1 8 12 10 20 15 18 5\n", "output": "176\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1580_D.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 2,900 | {"cf_contest_id": 1580, "cf_index": "D", "cf_rating": 2900, "cf_tags": ["brute force", "divide and conquer", "dp", "greedy", "trees"], "difficulty": "D", "memory_limit_bytes": 256000000, "name": "1580_D. Subsequence", "source": "codeforces", "tests": {"generated": 200, "private": 5, "public": 4}, "time_limit": 1.0} |
1580_E | Because the railway system in Gensokyo is often congested, as an enthusiastic engineer, Kawasiro Nitori plans to construct more railway to ease the congestion.
There are n stations numbered from 1 to n and m two-way railways in Gensokyo. Every two-way railway connects two different stations and has a positive integer ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "10 16 8\n29 1 75 73 51 69 24 17 1 97\n1 2 18\n2 3 254\n2 4 546\n2 5 789\n5 6 998\n6 7 233\n7 8 433\n1 9 248\n5 10 488\n2 6 1787\n10 8 1176\n3 8 2199\n4 8 1907\n2 10 1277\n4 10 731\n9 10 1047\n1 11\n1 9\n8 8\n1 3\n2 19\n9 5\n9 4\n7 6\n", "output": "34\n45\n54\n54\n57\n76\n96\n112\n112\n"}, {"inp... | {"args": {"memory_bytes": 1073741824, "timeout": 7.5}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1580_E.json.gz", "timeout": 7.5}, "kind": "codecontest_tests"} | 3,400 | {"cf_contest_id": 1580, "cf_index": "E", "cf_rating": 3400, "cf_tags": ["brute force", "constructive algorithms", "data structures", "graphs", "shortest paths"], "difficulty": "E", "memory_limit_bytes": 512000000, "name": "1580_E. Railway Construction", "source": "codeforces", "tests": {"generated": 200, "private": 0, ... |
1580_F | XYMXYM and CQXYM will prepare n problems for Codeforces. The difficulty of the problem i will be an integer a_i, where a_i ≥ 0. The difficulty of the problems must satisfy a_i+a_{i+1}<m (1 ≤ i < n), and a_1+a_n<m, where m is a fixed integer. XYMXYM wants to know how many plans of the difficulty of the problems there ar... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5 9\n", "output": "8105\n"}, {"input": "3 2\n", "output": "4\n"}, {"input": "21038 3942834\n", "output": "338529212\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 24.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1580_F.json.gz", "timeout": 24.0}, "kind": "codecontest_tests"} | 3,300 | {"cf_contest_id": 1580, "cf_index": "F", "cf_rating": 3300, "cf_tags": ["combinatorics", "fft", "math"], "difficulty": "F", "memory_limit_bytes": 256000000, "name": "1580_F. Problems for Codeforces", "source": "codeforces", "tests": {"generated": 200, "private": 42, "public": 3}, "time_limit": 8.0} |
1581_A | CQXYM is counting permutations length of 2n.
A permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (n=3 but there is 4 in the array).
A... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4\n1\n2\n9\n91234\n", "output": "1\n12\n830455698\n890287984\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1581_A.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 800 | {"cf_contest_id": 1581, "cf_index": "A", "cf_rating": 800, "cf_tags": ["combinatorics", "math", "number theory"], "difficulty": "A", "memory_limit_bytes": 256000000, "name": "1581_A. CQXYM Count Permutations", "source": "codeforces", "tests": {"generated": 200, "private": 8, "public": 1}, "time_limit": 1.0} |
1581_B | CQXYM wants to create a connected undirected graph with n nodes and m edges, and the diameter of the graph must be strictly less than k-1. Also, CQXYM doesn't want a graph that contains self-loops or multiple edges (i.e. each edge connects two different vertices and between each pair of vertices there is at most one ed... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5\n1 0 3\n4 5 3\n4 6 3\n5 4 1\n2 1 1\n", "output": "YES\nNO\nYES\nNO\nNO\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1581_B.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 1,200 | {"cf_contest_id": 1581, "cf_index": "B", "cf_rating": 1200, "cf_tags": ["constructive algorithms", "graphs", "greedy", "math"], "difficulty": "B", "memory_limit_bytes": 256000000, "name": "1581_B. Diameter of Graph", "source": "codeforces", "tests": {"generated": 200, "private": 8, "public": 1}, "time_limit": 1.0} |
1582_A | Luntik has decided to try singing. He has a one-minute songs, b two-minute songs and c three-minute songs. He wants to distribute all songs into two concerts such that every song should be included to exactly one concert.
He wants to make the absolute difference of durations of the concerts as small as possible. The d... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4\n1 1 1\n2 1 3\n5 5 5\n1 1 2\n", "output": "0\n1\n0\n1\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1582_A.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 800 | {"cf_contest_id": 1582, "cf_index": "A", "cf_rating": 800, "cf_tags": ["math"], "difficulty": "A", "memory_limit_bytes": 256000000, "name": "1582_A. Luntik and Concerts", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 1}, "time_limit": 1.0} |
1582_B | Luntik came out for a morning stroll and found an array a of length n. He calculated the sum s of the elements of the array (s= ∑_{i=1}^{n} a_i). Luntik calls a subsequence of the array a nearly full if the sum of the numbers in that subsequence is equal to s-1.
Luntik really wants to know the number of nearly full su... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5\n5\n1 2 3 4 5\n2\n1000 1000\n2\n1 0\n5\n3 0 2 1 1\n5\n2 1 0 3 0\n", "output": "1\n0\n2\n4\n4\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1582_B.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 900 | {"cf_contest_id": 1582, "cf_index": "B", "cf_rating": 900, "cf_tags": ["combinatorics", "math"], "difficulty": "B", "memory_limit_bytes": 256000000, "name": "1582_B. Luntik and Subsequences", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 1}, "time_limit": 1.0} |
1582_C | Grandma Capa has decided to knit a scarf and asked Grandpa Sher to make a pattern for it, a pattern is a string consisting of lowercase English letters. Grandpa Sher wrote a string s of length n.
Grandma Capa wants to knit a beautiful scarf, and in her opinion, a beautiful scarf can only be knit from a string that is ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5\n8\nabcaacab\n6\nxyzxyz\n4\nabba\n8\nrprarlap\n10\nkhyyhhyhky\n", "output": "2\n-1\n0\n3\n2\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1582_C.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 1,200 | {"cf_contest_id": 1582, "cf_index": "C", "cf_rating": 1200, "cf_tags": ["brute force", "data structures", "greedy", "strings", "two pointers"], "difficulty": "C", "memory_limit_bytes": 256000000, "name": "1582_C. Grandma Capa Knits a Scarf", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 1}... |
1582_D | Vupsen and Pupsen were gifted an integer array. Since Vupsen doesn't like the number 0, he threw away all numbers equal to 0 from the array. As a result, he got an array a of length n.
Pupsen, on the contrary, likes the number 0 and he got upset when he saw the array without zeroes. To cheer Pupsen up, Vupsen decided ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "3\n2\n5 5\n5\n5 -2 10 -9 4\n7\n1 2 3 4 5 6 7\n", "output": "-5 5 \n2 5 -4 -4 1\n-2 1 -4 3 -7 -7 11\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1582_D.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 1,600 | {"cf_contest_id": 1582, "cf_index": "D", "cf_rating": 1600, "cf_tags": ["constructive algorithms", "math"], "difficulty": "D", "memory_limit_bytes": 256000000, "name": "1582_D. Vupsen, Pupsen and 0", "source": "codeforces", "tests": {"generated": 200, "private": 3, "public": 1}, "time_limit": 1.0} |
1582_E | Pchelyonok decided to give Mila a gift. Pchelenok has already bought an array a of length n, but gifting an array is too common. Instead of that, he decided to gift Mila the segments of that array!
Pchelyonok wants his gift to be beautiful, so he decided to choose k non-overlapping segments of the array [l_1,r_1], [l_... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5\n1\n1\n3\n1 2 3\n5\n1 1 2 2 3\n7\n1 2 1 1 3 2 6\n5\n9 6 7 9 7\n", "output": "1\n1\n2\n3\n1\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1582_E.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 2,000 | {"cf_contest_id": 1582, "cf_index": "E", "cf_rating": 2000, "cf_tags": ["binary search", "data structures", "dp", "greedy", "math"], "difficulty": "E", "memory_limit_bytes": 512000000, "name": "1582_E. Pchelyonok and Segments", "source": "codeforces", "tests": {"generated": 200, "private": 2, "public": 1}, "time_limit"... |
1582_F1 | This is an easier version of the problem with smaller constraints.
Korney Korneevich dag up an array a of length n. Korney Korneevich has recently read about the operation [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR), so he wished to experiment with it. For this purpose, he decided to find all in... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4\n4 2 2 4\n", "output": "4\n0 2 4 6 \n"}, {"input": "8\n1 0 1 7 12 5 3 2\n", "output": "12\n0 1 2 3 4 5 6 7 10 11 12 13 \n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 4.5}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1582_F1.json.gz", "timeout": 4.5}, "kind": "codecontest_tests"} | 1,800 | {"cf_contest_id": 1582, "cf_index": "F1", "cf_rating": 1800, "cf_tags": ["bitmasks", "dp", "greedy"], "difficulty": "F", "memory_limit_bytes": 512000000, "name": "1582_F1. Korney Korneevich and XOR (easy version)", "source": "codeforces", "tests": {"generated": 200, "private": 10, "public": 2}, "time_limit": 1.5} |
1582_F2 | This is a harder version of the problem with bigger constraints.
Korney Korneevich dag up an array a of length n. Korney Korneevich has recently read about the operation [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR), so he wished to experiment with it. For this purpose, he decided to find all inte... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4\n4 2 2 4\n", "output": "4\n0 2 4 6 \n"}, {"input": "8\n1 0 1 7 12 5 3 2\n", "output": "12\n0 1 2 3 4 5 6 7 10 11 12 13 \n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 4.5}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1582_F2.json.gz", "timeout": 4.5}, "kind": "codecontest_tests"} | 2,400 | {"cf_contest_id": 1582, "cf_index": "F2", "cf_rating": 2400, "cf_tags": ["binary search", "brute force", "dp", "greedy", "two pointers"], "difficulty": "F", "memory_limit_bytes": 512000000, "name": "1582_F2. Korney Korneevich and XOR (hard version)", "source": "codeforces", "tests": {"generated": 200, "private": 16, "p... |
1582_G | Kuzya started going to school. He was given math homework in which he was given an array a of length n and an array of symbols b of length n, consisting of symbols '*' and '/'.
Let's denote a path of calculations for a segment [l; r] (1 ≤ l ≤ r ≤ n) in the following way:
* Let x=1 initially. For every i from l to ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "7\n6 4 10 1 2 15 1\n*/*/*//\n", "output": "8\n"}, {"input": "3\n1 2 3\n*/*\n", "output": "2\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1582_G.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 2,600 | {"cf_contest_id": 1582, "cf_index": "G", "cf_rating": 2600, "cf_tags": ["data structures", "number theory"], "difficulty": "G", "memory_limit_bytes": 512000000, "name": "1582_G. Kuzya and Homework", "source": "codeforces", "tests": {"generated": 200, "private": 6, "public": 2}, "time_limit": 2.0} |
1586_A | A bow adorned with nameless flowers that bears the earnest hopes of an equally nameless person.
You have obtained the elegant bow known as the Windblume Ode. Inscribed in the weapon is an array of n (n ≥ 3) positive distinct integers (i.e. different, no duplicates are allowed).
Find the largest subset (i.e. having th... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4\n3\n8 1 2\n4\n6 9 4 2\n9\n1 2 3 4 5 6 7 8 9\n3\n200 199 198\n", "output": "2\n1 3\n4\n1 2 3 4\n9\n1 2 3 4 5 6 7 8 9\n3\n1 2 3\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1586_A.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 800 | {"cf_contest_id": 1586, "cf_index": "A", "cf_rating": 800, "cf_tags": ["brute force", "constructive algorithms", "greedy", "math", "number theory"], "difficulty": "A", "memory_limit_bytes": 256000000, "name": "1586_A. Windblume Ode", "source": "codeforces", "tests": {"generated": 200, "private": 2, "public": 1}, "time_... |
1586_B | Lord Omkar would like to have a tree with n nodes (3 ≤ n ≤ 10^5) and has asked his disciples to construct the tree. However, Lord Omkar has created m (1 ≤ m < n) restrictions to ensure that the tree will be as heavenly as possible.
A tree with n nodes is an connected undirected graph with n nodes and n-1 edges. Note ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "2\n7 4\n1 2 3\n3 4 5\n5 6 7\n6 5 4\n5 3\n1 2 3\n2 3 4\n3 4 5\n", "output": "1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 2\n1 3\n1 4\n1 5\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1586_B.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,200 | {"cf_contest_id": 1586, "cf_index": "B", "cf_rating": 1200, "cf_tags": ["brute force", "constructive algorithms", "trees"], "difficulty": "B", "memory_limit_bytes": 256000000, "name": "1586_B. Omkar and Heavenly Tree", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 1}, "time_limit": 2.0} |
1586_C | The problem statement looms below, filling you with determination.
Consider a grid in which some cells are empty and some cells are filled. Call a cell in this grid exitable if, starting at that cell, you can exit the grid by moving up and left through only empty cells. This includes the cell itself, so all filled in ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4 5\n..XXX\n...X.\n...X.\n...X.\n5\n1 3\n3 3\n4 5\n5 5\n1 5\n", "output": "YES\nYES\nNO\nYES\nNO\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1586_C.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,700 | {"cf_contest_id": 1586, "cf_index": "C", "cf_rating": 1700, "cf_tags": ["constructive algorithms", "dp", "greedy", "implementation", "two pointers"], "difficulty": "C", "memory_limit_bytes": 256000000, "name": "1586_C. Omkar and Determination", "source": "codeforces", "tests": {"generated": 200, "private": 22, "public"... |
1586_D | It turns out that the meaning of life is a permutation p_1, p_2, …, p_n of the integers 1, 2, …, n (2 ≤ n ≤ 100). Omkar, having created all life, knows this permutation, and will allow you to figure it out using some queries.
A query consists of an array a_1, a_2, …, a_n of integers between 1 and n. a is not required ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5\n\n2\n\n0\n\n1\n", "output": "\n\n? 4 4 2 3 2\n\n? 3 5 1 5 5\n\n? 5 2 4 3 1\n\n! 3 2 1 5 4\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1586_D.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,800 | {"cf_contest_id": 1586, "cf_index": "D", "cf_rating": 1800, "cf_tags": ["constructive algorithms", "greedy", "interactive", "math"], "difficulty": "D", "memory_limit_bytes": 256000000, "name": "1586_D. Omkar and the Meaning of Life", "source": "codeforces", "tests": {"generated": 200, "private": 26, "public": 1}, "time... |
1586_E | She does her utmost to flawlessly carry out a person's last rites and preserve the world's balance of yin and yang.
Hu Tao, being the little prankster she is, has tried to scare you with this graph problem! You are given a connected undirected graph of n nodes with m edges. You also have q queries. Each query consists... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "6 7\n2 1\n2 3\n3 5\n1 4\n6 1\n5 6\n4 5\n3\n1 4\n5 1\n4 5\n", "output": "YES\n2\n1 4\n4\n5 3 2 1\n5\n4 1 2 3 5\n"}, {"input": "5 7\n4 3\n4 5\n2 1\n1 4\n1 3\n3 5\n3 2\n4\n4 2\n3 5\n5 1\n4 5\n", "output": "NO\n2\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 9.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1586_E.json.gz", "timeout": 9.0}, "kind": "codecontest_tests"} | 2,200 | {"cf_contest_id": 1586, "cf_index": "E", "cf_rating": 2200, "cf_tags": ["constructive algorithms", "dfs and similar", "dsu", "graph matchings", "graphs", "greedy", "trees"], "difficulty": "E", "memory_limit_bytes": 512000000, "name": "1586_E. Moment of Bloom", "source": "codeforces", "tests": {"generated": 200, "privat... |
1586_F | Even if you just leave them be, they will fall to pieces all by themselves. So, someone has to protect them, right?
You find yourself playing with Teucer again in the city of Liyue. As you take the eccentric little kid around, you notice something interesting about the structure of the city.
Liyue can be represented ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "3 2\n", "output": "2\n1 2 2 "}, {"input": "8 7\n", "output": "2\n1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 2 2 "}, {"input": "5 3\n", "output": "2\n1 1 2 2 1 2 2 2 2 1 "}, {"input": "5 2\n", "output": "3\n1 2 2 3 2 2 3 1 3 3 "}]} | {"args": {"memory_bytes": 1073741824, "timeout": 9.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1586_F.json.gz", "timeout": 9.0}, "kind": "codecontest_tests"} | 2,500 | {"cf_contest_id": 1586, "cf_index": "F", "cf_rating": 2500, "cf_tags": ["bitmasks", "constructive algorithms", "divide and conquer", "graphs", "greedy", "math"], "difficulty": "F", "memory_limit_bytes": 512000000, "name": "1586_F. Defender of Childhood Dreams", "source": "codeforces", "tests": {"generated": 200, "priva... |
1586_G | El Psy Kongroo.
Omkar is watching Steins;Gate.
In Steins;Gate, Okabe Rintarou needs to complete n tasks (1 ≤ n ≤ 2 ⋅ 10^5). Unfortunately, he doesn't know when he needs to complete the tasks.
Initially, the time is 0. Time travel will now happen according to the following rules:
* For each k = 1, 2, …, n, Okabe w... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "6\n10 12\n3 7\n4 6\n2 9\n5 8\n1 11\n3\n2 4 6\n", "output": "17\n"}, {"input": "1\n1 2\n1\n1\n", "output": "1\n"}, {"input": "16\n31 32\n3 26\n17 19\n4 24\n1 28\n15 21\n12 16\n18 29\n20 23\n7 8\n11 14\n9 22\n6 30\n5 10\n25 27\n2 13\n6\n3 8 2 5 12 11\n", "output": "138\n"}, {"input": "2\n1 4\n2 3... | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1586_G.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 3,000 | {"cf_contest_id": 1586, "cf_index": "G", "cf_rating": 3000, "cf_tags": ["data structures", "dp", "math"], "difficulty": "G", "memory_limit_bytes": 256000000, "name": "1586_G. Omkar and Time Travel", "source": "codeforces", "tests": {"generated": 81, "private": 8, "public": 5}, "time_limit": 2.0} |
1586_H | Omkar is hosting tours of his country, Omkarland! There are n cities in Omkarland, and, rather curiously, there are exactly n-1 bidirectional roads connecting the cities to each other. It is guaranteed that you can reach any city from any other city through the road network.
Every city has an enjoyment value e. Each r... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "5 5\n1 2 3 4 5\n1 2 4 1\n1 3 3 1\n1 4 2 1\n2 5 1 1\n5 1\n4 1\n3 1\n2 1\n1 1\n", "output": "1 0\n2 1\n3 1\n4 1\n5 1\n"}, {"input": "5 3\n2 2 3 3 3\n1 2 4 7\n1 3 2 8\n2 4 8 2\n2 5 1 1\n1 3\n9 5\n6 2\n", "output": "3 8\n3 0\n3 2\n"}, {"input": "5 5\n1 2 2 2 2\n1 2 5 8\n1 3 6 3\n1 4 4 5\n1 5 7 1\n4... | {"args": {"memory_bytes": 1073741824, "timeout": 9.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1586_H.json.gz", "timeout": 9.0}, "kind": "codecontest_tests"} | 3,300 | {"cf_contest_id": 1586, "cf_index": "H", "cf_rating": 3300, "cf_tags": ["data structures", "dsu", "sortings", "trees"], "difficulty": "H", "memory_limit_bytes": 512000000, "name": "1586_H. Omkar and Tours", "source": "codeforces", "tests": {"generated": 200, "private": 3, "public": 3}, "time_limit": 3.0} |
1586_I | Omkar is creating a mosaic using colored square tiles, which he places in an n × n grid. When the mosaic is complete, each cell in the grid will have either a glaucous or sinoper tile. However, currently he has only placed tiles in some cells.
A completed mosaic will be a mastapeece if and only if each tile is adjace... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "10\n.S....S...\n..........\n...SSS....\n..........\n..........\n...GS.....\n....G...G.\n..........\n......G...\n..........\n", "output": "UNIQUE\nSSSSSSSSSS\nSGGGGGGGGS\nSGSSSSSSGS\nSGSGGGGSGS\nSGSGSSGSGS\nSGSGSSGSGS\nSGSGGGGSGS\nSGSSSSSSGS\nSGGGGGGGGS\nSSSSSSSSSS\n"}, {"input": "4\nS...\n..G.\... | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1586_I.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 3,500 | {"cf_contest_id": 1586, "cf_index": "I", "cf_rating": 3500, "cf_tags": ["combinatorics", "constructive algorithms", "math"], "difficulty": "I", "memory_limit_bytes": 256000000, "name": "1586_I. Omkar and Mosaic", "source": "codeforces", "tests": {"generated": 200, "private": 26, "public": 4}, "time_limit": 2.0} |
1591_A | Petya has got an interesting flower. Petya is a busy person, so he sometimes forgets to water it. You are given n days from Petya's live and you have to determine what happened with his flower in the end.
The flower grows as follows:
* If the flower isn't watered for two days in a row, it dies.
* If the flower ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4\n3\n1 0 1\n3\n0 1 1\n4\n1 0 0 1\n1\n0\n", "output": "3\n7\n-1\n1\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1591_A.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 800 | {"cf_contest_id": 1591, "cf_index": "A", "cf_rating": 800, "cf_tags": ["implementation"], "difficulty": "A", "memory_limit_bytes": 256000000, "name": "1591_A. Life of a Flower", "source": "codeforces", "tests": {"generated": 200, "private": 1, "public": 1}, "time_limit": 1.0} |
1591_B | You are given an array a of length n.
Let's define the eversion operation. Let x = a_n. Then array a is partitioned into two parts: left and right. The left part contains the elements of a that are not greater than x (≤ x). The right part contains the elements of a that are strictly greater than x (> x). The order of ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "3\n5\n2 4 1 5 3\n5\n5 3 2 4 1\n4\n1 1 1 1\n", "output": "1\n2\n0\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1591_B.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 900 | {"cf_contest_id": 1591, "cf_index": "B", "cf_rating": 900, "cf_tags": ["greedy"], "difficulty": "B", "memory_limit_bytes": 256000000, "name": "1591_B. Array Eversion", "source": "codeforces", "tests": {"generated": 200, "private": 1, "public": 1}, "time_limit": 1.0} |
1591_C | A total of n depots are located on a number line. Depot i lies at the point x_i for 1 ≤ i ≤ n.
You are a salesman with n bags of goods, attempting to deliver one bag to each of the n depots. You and the n bags are initially at the origin 0. You can carry up to k bags at a time. You must collect the required number of ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "4\n5 1\n1 2 3 4 5\n9 3\n-5 -10 -15 6 5 8 3 7 4\n5 3\n2 2 3 3 3\n4 2\n1000000000 1000000000 1000000000 1000000000\n", "output": "25\n41\n7\n3000000000\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 3.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1591_C.json.gz", "timeout": 3.0}, "kind": "codecontest_tests"} | 1,300 | {"cf_contest_id": 1591, "cf_index": "C", "cf_rating": 1300, "cf_tags": ["greedy", "math"], "difficulty": "C", "memory_limit_bytes": 256000000, "name": "1591_C. Minimize Distance", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 1}, "time_limit": 1.0} |
1591_D | Petya has an array of integers a_1, a_2, …, a_n. He only likes sorted arrays. Unfortunately, the given array could be arbitrary, so Petya wants to sort it.
Petya likes to challenge himself, so he wants to sort array using only 3-cycles. More formally, in one operation he can pick 3 pairwise distinct indices i, j, and ... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "7\n1\n1\n2\n2 2\n2\n2 1\n3\n1 2 3\n3\n2 1 3\n3\n3 1 2\n4\n2 1 4 3\n", "output": "YES\nYES\nNO\nYES\nNO\nYES\nYES\n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 6.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1591_D.json.gz", "timeout": 6.0}, "kind": "codecontest_tests"} | 1,900 | {"cf_contest_id": 1591, "cf_index": "D", "cf_rating": 1900, "cf_tags": ["constructive algorithms", "data structures", "math", "sortings"], "difficulty": "D", "memory_limit_bytes": 256000000, "name": "1591_D. Yet Another Sorting Problem", "source": "codeforces", "tests": {"generated": 200, "private": 0, "public": 1}, "t... |
1591_E | Petya has a rooted tree with an integer written on each vertex. The vertex 1 is the root. You are to answer some questions about the tree.
A tree is a connected graph without cycles. A rooted tree has a special vertex called the root. The parent of a node v is the next vertex on the shortest path from v to the root.
... | {"main": "The answer is solution.py of the workspace: a Python 3 program that reads the input from stdin and writes the output to stdout. run_program runs a workspace file on an input you give; run_examples runs it on the examples of the statement. A sub-task can ask for a file, such as a part of the program, a brute-f... | {"examples": [{"input": "2\n3 3\n1 1 1\n1 2\n3 1 1\n3 1 2\n3 2 1\n5 5\n1 2 1 1 2\n1 1 2 2\n3 1 1\n2 1 2\n4 1 1\n4 2 1\n4 2 2\n", "output": "1 -1 1 \n1 1 2 1 -1 \n"}]} | {"args": {"memory_bytes": 1073741824, "timeout": 12.0}, "kind": "codecontest"} | [] | {"args": {"memory_bytes": 1073741824, "sets": ["public", "private", "generated"], "tests": "files/codecontest/test/00/1591_E.json.gz", "timeout": 12.0}, "kind": "codecontest_tests"} | 2,400 | {"cf_contest_id": 1591, "cf_index": "E", "cf_rating": 2400, "cf_tags": ["binary search", "data structures", "dfs and similar", "trees", "two pointers"], "difficulty": "E", "memory_limit_bytes": 512000000, "name": "1591_E. Frequency Queries", "source": "codeforces", "tests": {"generated": 200, "private": 1, "public": 1}... |
mllm-benchs datasets
Every dataset is a set of splits named <dataset>.<split>, all with the columns of the task
record schema: id, prompt, instructions, inputs, environment, resources, grader,
difficulty, metadata. The JSON columns hold JSON text. Files rows refer to are under
files/, by path relative to this repository.
The mllm_benchs section of this card describes each split: purpose, source, whether grading
is deterministic, requirements, time limits, and the schemas of its inputs and metadata
columns.
Read with the mllm_benchs package: get_dataset("<dataset>") once MLLM_BENCHS_REPO names
this repository. It downloads only the files of the splits and tasks it opens.
With the datasets library, load_dataset("<repository>", split="<dataset>.<split>") returns
that split but prepares every split of the repository first. To read one split only:
from datasets import load_dataset
load_dataset("<repository>", data_files={"test": "data/math500.test.jsonl"}, split="test")
load_dataset("<repository>", split="math500.test", streaming=True)
- Downloads last month
- 66