Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    TypeError
Message:      Couldn't cast array of type string to null
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1871, in _prepare_split_single
                  writer.write_table(table)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/arrow_writer.py", line 623, in write_table
                  pa_table = table_cast(pa_table, self._schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2293, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2246, in cast_table_to_schema
                  arrays = [
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2247, in <listcomp>
                  cast_array_to_feature(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1796, in wrapper
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1796, in <listcomp>
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2103, in cast_array_to_feature
                  return array_cast(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1798, in wrapper
                  return func(array, *args, **kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1949, in array_cast
                  raise TypeError(f"Couldn't cast array of type {_short_str(array.type)} to {_short_str(pa_type)}")
              TypeError: Couldn't cast array of type string to null
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1438, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1050, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 925, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1001, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1742, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1898, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

id
string
aliases
sequence
contest_id
string
contest_name
string
contest_type
string
contest_start
int64
contest_start_year
int64
index
string
time_limit
float64
memory_limit
int64
title
string
description
string
input_format
string
output_format
string
interaction_format
null
note
string
examples
list
editorial
string
rating
int64
tags
sequence
testset_size
int64
official_tests
list
official_tests_complete
bool
input_mode
string
generated_checker
null
executable
bool
465/A
null
465
Codeforces Round 265 (Div. 2)
CF
1,410,103,800
2,014
A
1
256
inc ARG
Sergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting of n bits. These bits are numbered from 1 to n. An integer is stored in the cell in the following way: the least significant bit is stored in the first bit of the cell, the next significant bit is stored in ...
The first line contains a single integer n (1 ≤ n ≤ 100) — the number of bits in the cell. The second line contains a string consisting of n characters — the initial state of the cell. The first character denotes the state of the first bit of the cell. The second character denotes the second least significant bit and ...
Print a single integer — the number of bits in the cell which change their state after we add 1 to the cell.
null
In the first sample the cell ends up with value 0010, in the second sample — with 0000.
[ { "input": "4\n1100", "output": "3" }, { "input": "4\n1111", "output": "4" } ]
null
900
[ "implementation" ]
33
[ { "input": "4\r\n1100\r\n", "output": "3\r\n" }, { "input": "4\r\n1111\r\n", "output": "4\r\n" }, { "input": "1\r\n0\r\n", "output": "1\r\n" }, { "input": "1\r\n1\r\n", "output": "1\r\n" }, { "input": "2\r\n00\r\n", "output": "1\r\n" }, { "input": "2\r...
true
stdio
null
true
465/B
null
465
Codeforces Round 265 (Div. 2)
CF
1,410,103,800
2,014
B
1
256
Inbox (100500)
Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program shows the content of an unread letter, it becomes read letter (if the program shows...
The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of letters in the mailbox. The second line contains n space-separated integers (zeros and ones) — the state of the letter list. The i-th number equals either 1, if the i-th number is unread, or 0, if the i-th letter is read.
Print a single number — the minimum number of operations needed to make all the letters read.
null
In the first sample Alexey needs three operations to cope with the task: open the second letter, move to the third one, move to the fourth one. In the second sample the action plan: open the first letter, move to the second letter, return to the list, open the fifth letter. In the third sample all letters are already...
[ { "input": "5\n0 1 0 1 0", "output": "3" }, { "input": "5\n1 1 0 0 1", "output": "4" }, { "input": "2\n0 0", "output": "0" } ]
null
1,000
[ "implementation" ]
44
[ { "input": "5\r\n0 1 0 1 0\r\n", "output": "3\r\n" }, { "input": "5\r\n1 1 0 0 1\r\n", "output": "4\r\n" }, { "input": "2\r\n0 0\r\n", "output": "0\r\n" }, { "input": "9\r\n1 0 1 0 1 0 1 0 1\r\n", "output": "9\r\n" }, { "input": "5\r\n1 1 1 1 1\r\n", "output":...
false
stdio
null
true
1347/B
[ "1351/B" ]
1347
Kotlin Heroes: Practice 4
ICPC
1,590,154,500
2,020
B
1
256
Square?
Vasya claims that he had a paper square. He cut it into two rectangular parts using one vertical or horizontal cut. Then Vasya informed you the dimensions of these two rectangular parts. You need to check whether Vasya originally had a square. In other words, check if it is possible to make a square using two given rec...
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is given in two lines. The first line contains two integers $$$a_1$$$ and $$$b_1$$$ ($$$1 \le a_1, b_1 \le 100$$$) — the dimensions of the first one obtained afte...
Print $$$t$$$ answers, each of which is a string "YES" (in the case of a positive answer) or "NO" (in the case of a negative answer). The letters in words can be printed in any case (upper or lower).
null
null
[ { "input": "3\n2 3\n3 1\n3 2\n1 3\n3 3\n1 3", "output": "Yes\nYes\nNo" } ]
null
900
[ "*special", "implementation", "math" ]
6
[ { "input": "3\r\n2 3\r\n3 1\r\n3 2\r\n1 3\r\n3 3\r\n1 3\r\n", "output": "Yes\r\nYes\r\nNo\r\n" }, { "input": "1\r\n64 9\r\n41 36\r\n", "output": "No\r\n" } ]
false
stdio
null
true
1223/B
[ "1241/B" ]
1223
Technocup 2020 - Elimination Round 1
CF
1,570,374,300
2,019
B
1
256
Strings Equalization
You are given two strings of equal length $$$s$$$ and $$$t$$$ consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings. During each operation you choose two adjacent characters in any string and assign the value of the first character to the value of the second or ...
The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query is represented by two consecutive lines. The first line of each query contains the string $$$s$$$ ($$$1 \le |s| \le 100$$$) consisting of lowercase Latin letters. The second line of each query contains the string $...
For each query, print "YES" if it is possible to make $$$s$$$ equal to $$$t$$$, and "NO" otherwise. You may print every letter in any case you want (so, for example, the strings "yEs", "yes", "Yes", and "YES" will all be recognized as positive answer).
null
In the first query, you can perform two operations $$$s_1 = s_2$$$ (after it $$$s$$$ turns into "aabb") and $$$t_4 = t_3$$$ (after it $$$t$$$ turns into "aabb"). In the second query, the strings are equal initially, so the answer is "YES". In the third query, you can not make strings $$$s$$$ and $$$t$$$ equal. Theref...
[ { "input": "3\nxabb\naabx\ntechnocup\ntechnocup\na\nz", "output": "YES\nYES\nNO" } ]
If there is a character which is contained in string $$$s$$$ and $$$t$$$ (let's denote it as $$$c$$$), then we answer is "YES" because we can turn these string into string consisting only of this character $$$c$$$. Otherwise the answer is "NO", because if initially strings have not a common character, then after perfor...
1,000
[ "strings" ]
33
[ { "input": "3\r\nxabb\r\naabx\r\ntechnocup\r\ntechnocup\r\na\r\nz\r\n", "output": "YES\r\nYES\r\nNO\r\n" } ]
false
stdio
null
true
501/A
null
501
Codeforces Round 285 (Div. 2)
CF
1,421,053,200
2,015
A
1
256
Contest
Misha and Vasya participated in a Codeforces contest. Unfortunately, each of them solved only one problem, though successfully submitted it at the first attempt. Misha solved the problem that costs a points and Vasya solved the problem that costs b points. Besides, Misha submitted the problem c minutes after the contes...
The first line contains four integers a, b, c, d (250 ≤ a, b ≤ 3500, 0 ≤ c, d ≤ 180). It is guaranteed that numbers a and b are divisible by 250 (just like on any real Codeforces round).
Output on a single line: "Misha" (without the quotes), if Misha got more points than Vasya. "Vasya" (without the quotes), if Vasya got more points than Misha. "Tie" (without the quotes), if both of them got the same number of points.
null
null
[ { "input": "500 1000 20 30", "output": "Vasya" }, { "input": "1000 1000 1 1", "output": "Tie" }, { "input": "1500 1000 176 177", "output": "Misha" } ]
null
900
[ "implementation" ]
40
[ { "input": "500 1000 20 30\r\n", "output": "Vasya\r\n" }, { "input": "1000 1000 1 1\r\n", "output": "Tie\r\n" }, { "input": "1500 1000 176 177\r\n", "output": "Misha\r\n" }, { "input": "1500 1000 74 177\r\n", "output": "Misha\r\n" }, { "input": "750 2500 175 178\r...
true
stdio
null
true
139/A
null
139
Codeforces Beta Round 99 (Div. 2)
CF
1,324,728,000
2,011
A
2
256
Petr and Book
One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly n pages. Petr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day of the week he knows how many pages he will be able to read on that day. Som...
The first input line contains the single integer n (1 ≤ n ≤ 1000) — the number of pages in the book. The second line contains seven non-negative space-separated integers that do not exceed 1000 — those integers represent how many pages Petr can read on Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday ...
Print a single number — the number of the day of the week, when Petr will finish reading the book. The days of the week are numbered starting with one in the natural order: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
null
Note to the first sample: By the end of Monday and therefore, by the beginning of Tuesday Petr has 85 pages left. He has 65 pages left by Wednesday, 45 by Thursday, 30 by Friday, 20 by Saturday and on Saturday Petr finishes reading the book (and he also has time to read 10 pages of something else). Note to the second...
[ { "input": "100\n15 20 20 15 10 30 45", "output": "6" }, { "input": "2\n1 0 0 0 0 0 0", "output": "1" } ]
null
1,000
[ "implementation" ]
49
[ { "input": "100\r\n15 20 20 15 10 30 45\r\n", "output": "6\r\n" }, { "input": "2\r\n1 0 0 0 0 0 0\r\n", "output": "1\r\n" }, { "input": "100\r\n100 200 100 200 300 400 500\r\n", "output": "1\r\n" }, { "input": "3\r\n1 1 1 1 1 1 1\r\n", "output": "3\r\n" }, { "inpu...
true
stdio
null
true
1650/B
null
1650
Codeforces Round 776 (Div. 3)
ICPC
1,646,750,100
2,022
B
2
256
DIV + MOD
Not so long ago, Vlad came up with an interesting function: - $$$f_a(x)=\left\lfloor\frac{x}{a}\right\rfloor + x \bmod a$$$, where $$$\left\lfloor\frac{x}{a}\right\rfloor$$$ is $$$\frac{x}{a}$$$, rounded down, $$$x \bmod a$$$ — the remainder of the integer division of $$$x$$$ by $$$a$$$. For example, with $$$a=3$$$ a...
The first line of input data contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of input test cases. This is followed by $$$t$$$ lines, each of which contains three integers $$$l_i$$$, $$$r_i$$$ and $$$a_i$$$ ($$$1 \le l_i \le r_i \le 10^9, 1 \le a_i \le 10^9$$$) — the left and right boundaries of the s...
For each test case, output one number on a separate line — the maximum value of the function on a given segment for a given $$$a$$$.
null
In the first sample: - $$$f_3(1) = \left\lfloor\frac{1}{3}\right\rfloor + 1 \bmod 3 = 0 + 1 = 1$$$, - $$$f_3(2) = \left\lfloor\frac{2}{3}\right\rfloor + 2 \bmod 3 = 0 + 2 = 2$$$, - $$$f_3(3) = \left\lfloor\frac{3}{3}\right\rfloor + 3 \bmod 3 = 1 + 0 = 1$$$, - $$$f_3(4) = \left\lfloor\frac{4}{3}\right\rfloor + 4 \bmod ...
[ { "input": "5\n1 4 3\n5 8 4\n6 10 6\n1 1000000000 1000000000\n10 12 8", "output": "2\n4\n5\n999999999\n5" } ]
Consider $$$f_a(r)$$$. Note that $$$\left\lfloor\frac{r}{a}\right\rfloor$$$ is maximal over the entire segment from $$$l$$$ to $$$r$$$, so if there is $$$x$$$ in which $$$f_a$$$ gives a greater result, then $$$x \bmod a > r\bmod a$$$. Note that numbers from $$$r - r \bmod a$$$ to $$$r$$$ that have an incomplete quotien...
900
[ "math" ]
9
[ { "input": "5\r\n1 4 3\r\n5 8 4\r\n6 10 6\r\n1 1000000000 1000000000\r\n10 12 8\r\n", "output": "2\r\n4\r\n5\r\n999999999\r\n5\r\n" }, { "input": "1\r\n87 95 696969\r\n", "output": "95\r\n" }, { "input": "1\r\n6 999998 9\r\n", "output": "111118\r\n" }, { "input": "1\r\n1 100 ...
false
stdio
null
true
1471/A
null
1471
Codeforces Round 694 (Div. 2)
CF
1,609,857,300
2,021
A
1
256
Strange Partition
You are given an array $$$a$$$ of length $$$n$$$, and an integer $$$x$$$. You can perform the following operation as many times as you would like (possibly zero): replace two adjacent elements of the array by their sum. For example, if the initial array was $$$[3, 6, 9]$$$, in a single operation one can replace the las...
The first input line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The first line of each test case contains two integers $$$n$$$ and $$$x$$$ ($$$1 \leq n \leq 10^5$$$, $$$1 \leq x \leq 10^9$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_...
For each test case output two integers — the minimal and the maximal possible beauty.
null
In the first test case the beauty of the array does not change if we perform any operations. In the second example we can leave the array unchanged to attain the maximum beauty, and to get the minimum beauty one can replace two elements $$$4$$$ and $$$11$$$ with their sum, yielding an array $$$[6, 15]$$$, which has it...
[ { "input": "2\n3 3\n3 6 9\n3 3\n6 4 11", "output": "6 6\n7 8" } ]
Note that, $$$\left\lceil \frac{a + b}{x} \right\rceil \leq \left\lceil \frac{a}{x} \right\rceil + \left\lceil \frac{b}{x} \right\rceil$$$. It means that the maximal sum is attained if we do not apply any operations, and the minimal one is attained if we replace all the element with a single one, equal to the sum of al...
900
[ "greedy", "math", "number theory" ]
24
[ { "input": "2\r\n3 3\r\n3 6 9\r\n3 3\r\n6 4 11\r\n", "output": "6 6\r\n7 8\r\n" }, { "input": "1\r\n10 1\r\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\r\n", "output": "10000000000 10000000000\r\n" }, { "input": "1\r\n20 2...
false
stdio
null
true
1969/B
null
1969
Educational Codeforces Round 165 (Rated for Div. 2)
ICPC
1,714,401,300
2,024
B
2
256
Shifts and Sorting
Let's define a cyclic shift of some string $$$s$$$ as a transformation from $$$s_1 s_2 \dots s_{n-1} s_{n}$$$ into $$$s_{n} s_1 s_2 \dots s_{n-1}$$$. In other words, you take one last character $$$s_n$$$ and place it before the first character while moving all other characters to the right. You are given a binary stri...
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first and only line of each test case contains a binary string $$$s$$$ ($$$2 \le |s| \le 2 \cdot 10^5$$$; $$$s_i \in$$$ {0, 1}) — the string you need to sort. Additional constraint on the input: the sum of length...
For each test case, print the single integer — the minimum total cost to make string sorted using operation above any number of times.
null
In the first test case, you can choose the whole string and perform a cyclic shift: 10 $$$\rightarrow$$$ 01. The length of the substring is $$$2$$$, so the cost is $$$2$$$. In the second test case, the string is already sorted, so you don't need to perform any operations. In the third test case, one of the optimal st...
[ { "input": "5\n10\n0000\n11000\n101011\n01101001", "output": "2\n0\n9\n5\n11" } ]
Let's look at the operation as the following: you choose $$$(l, r)$$$, erase the element at position $$$r$$$ and then insert it before the element at position $$$l$$$. We can also interpret the cost of such operation as the following: you pay $$$1$$$ for the element at position $$$r$$$ you "teleport" to the left and $$...
1,000
[ "constructive algorithms", "greedy" ]
15
[ { "input": "5\r\n10\r\n0000\r\n11000\r\n101011\r\n01101001\r\n", "output": "2\r\n0\r\n9\r\n5\r\n11\r\n" }, { "input": "2\r\n11111111111111111010101010101111\r\n1111111110\r\n", "output": "123\r\n10\r\n" } ]
false
stdio
null
true
1515/B
null
1515
Codeforces Global Round 14
CF
1,619,966,100
2,021
B
2
256
Phoenix and Puzzle
Phoenix is playing with a new puzzle, which consists of $$$n$$$ identical puzzle pieces. Each puzzle piece is a right isosceles triangle as shown below. A puzzle piece The goal of the puzzle is to create a square using the $$$n$$$ pieces. He is allowed to rotate and move the pieces around, but none of them can overla...
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the number of puzzle pieces.
For each test case, if Phoenix can create a square with the $$$n$$$ puzzle pieces, print YES. Otherwise, print NO.
null
For $$$n=2$$$, Phoenix can create a square like this: For $$$n=4$$$, Phoenix can create a square like this: For $$$n=6$$$, it is impossible for Phoenix to create a square.
[ { "input": "3\n2\n4\n6", "output": "YES\nYES\nNO" } ]
If $$$n$$$ can be written as $$$2x$$$ or $$$4x$$$, where $$$x$$$ is a square number, then the answer is YES. Otherwise it is NO. To visualize this construction, we start by first building a smaller square using exactly $$$2$$$ or $$$4$$$ pieces (the drawings are in the sample test explanation). We can just use $$$x$$$ ...
1,000
[ "brute force", "geometry", "math", "number theory" ]
27
[ { "input": "3\r\n2\r\n4\r\n6\r\n", "output": "YES\r\nYES\r\nNO\r\n" }, { "input": "1\r\n999939200\r\n", "output": "YES\r\n" }, { "input": "1\r\n92888450\r\n", "output": "YES\r\n" }, { "input": "1\r\n1458\r\n", "output": "YES\r\n" }, { "input": "1\r\n9060100\r\n", ...
false
stdio
null
true
237/A
null
237
Codeforces Round 147 (Div. 2)
CF
1,351,179,000
2,012
A
2
256
Free Cash
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ...
The first line contains a single integer n (1 ≤ n ≤ 105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0 ≤ hi ≤ 23; 0 ≤ mi ≤ 59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. Al...
Print a single integer — the minimum number of cashes, needed to serve all clients next day.
null
In the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away. In the second sample all visitors will come in different times, so ...
[ { "input": "4\n8 0\n8 10\n8 10\n8 45", "output": "2" }, { "input": "3\n0 12\n10 11\n22 22", "output": "1" } ]
null
1,000
[ "implementation" ]
67
[ { "input": "4\r\n8 0\r\n8 10\r\n8 10\r\n8 45\r\n", "output": "2\r\n" }, { "input": "3\r\n0 12\r\n10 11\r\n22 22\r\n", "output": "1\r\n" }, { "input": "5\r\n12 8\r\n15 27\r\n15 27\r\n16 2\r\n19 52\r\n", "output": "2\r\n" }, { "input": "7\r\n5 6\r\n7 34\r\n7 34\r\n7 34\r\n12 29...
false
stdio
null
true
1796/B
null
1796
Educational Codeforces Round 144 (Rated for Div. 2)
ICPC
1,677,594,900
2,023
B
2
256
Asterisk-Minor Template
You are given two strings $$$a$$$ and $$$b$$$, consisting of lowercase Latin letters. A template $$$t$$$ is string, consisting of lowercase Latin letters and asterisks (character '*'). A template is called asterisk-minor if the number of asterisks in it is less than or equal to the number of letters in it. A string $...
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains a string $$$a$$$ ($$$1 \le |a| \le 50$$$, where $$$|a|$$$ is the length of $$$a$$$), consisting of lowercase Latin letters. The second line contains a string $$$b$$$ ($$$1 \le ...
For each testcase, output "NO", if there doesn't exist an asterisk-minor template that both $$$a$$$ and $$$b$$$ match. Otherwise, print "YES" in the first line and the template in the second line. If there are multiple answers, print any of them. A template should consist only of lowercase Latin letters and asterisks ...
null
In the first testcase, for a template "*b", you can replace the only asterisk with "aaa" to get "aaab" (which is equal to $$$a$$$) or with "zzz" to get "zzzb" (which is equal to $$$b$$$). In the third testcase, a template "*o*" is not asterisk-minor, as it contains more asterisks than letters. There are no asterisk-mi...
[ { "input": "6\naaab\nzzzb\ncodeforces\natcoder\ncodeforces\ntokitlx\naaaa\naaaaaa\nabcd\nabcd\nc\nf", "output": "YES\n*b\nYES\n*co*\nNO\nYES\na*a*a*a\nYES\nabcd\nNO" } ]
What's the reason behind authors specifically asking for templates that have less or equal asterisks than letters? Well, without that the problem would be kind of trivial. A template "*" is matched by every string, so it would always work. Hmm, let's try to make something similar to that template then. We basically hav...
1,000
[ "implementation", "strings" ]
12
[ { "input": "6\r\naaab\r\nzzzb\r\ncodeforces\r\natcoder\r\ncodeforces\r\ntokitlx\r\naaaa\r\naaaaaa\r\nabcd\r\nabcd\r\nc\r\nf\r\n", "output": "YES\r\n*b\r\nYES\r\n*co*\r\nNO\r\nYES\r\na*\r\nYES\r\na*\r\nNO\r\n" } ]
false
stdio
null
false
318/A
null
318
Codeforces Round 188 (Div. 2)
CF
1,371,223,800
2,013
A
1
256
Even Odds
Being a nonconformist, Volodya is displeased with the current state of things, particularly with the order of natural numbers (natural number is positive integer number). He is determined to rearrange them. But there are too many natural numbers, so Volodya decided to start with the first n. He writes down the followin...
The only line of input contains integers n and k (1 ≤ k ≤ n ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
Print the number that will stand at the position number k after Volodya's manipulations.
null
In the first sample Volodya's sequence will look like this: {1, 3, 5, 7, 9, 2, 4, 6, 8, 10}. The third place in the sequence is therefore occupied by the number 5.
[ { "input": "10 3", "output": "5" }, { "input": "7 7", "output": "6" } ]
null
900
[ "math" ]
25
[ { "input": "10 3\r\n", "output": "5" }, { "input": "7 7\r\n", "output": "6" }, { "input": "7 1\r\n", "output": "1" }, { "input": "7 2\r\n", "output": "3" }, { "input": "8 5\r\n", "output": "2" }, { "input": "8 3\r\n", "output": "5" }, { "in...
true
stdio
null
true
1166/A
null
1166
Codeforces Round 561 (Div. 2)
CF
1,558,105,500
2,019
A
1
256
Silent Classroom
There are $$$n$$$ students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same letter will be chatty if they are put in the same classroom (because they m...
The first line contains a single integer $$$n$$$ ($$$1\leq n \leq 100$$$) — the number of students. After this $$$n$$$ lines follow. The $$$i$$$-th line contains the name of the $$$i$$$-th student. It is guaranteed each name is a string of lowercase English letters of length at most $$$20$$$. Note that multiple stud...
The output must consist of a single integer $$$x$$$ — the minimum possible number of chatty pairs.
null
In the first sample the minimum number of pairs is $$$1$$$. This can be achieved, for example, by putting everyone except jose in one classroom, and jose in the other, so jorge and jerry form the only chatty pair. In the second sample the minimum number of pairs is $$$2$$$. This can be achieved, for example, by puttin...
[ { "input": "4\njorge\njose\noscar\njerry", "output": "1" }, { "input": "7\nkambei\ngorobei\nshichiroji\nkyuzo\nheihachi\nkatsushiro\nkikuchiyo", "output": "2" }, { "input": "5\nmike\nmike\nmike\nmike\nmike", "output": "4" } ]
First, note that we can solve the problem for each starting letter independently, because two students whose name starts with a different letter never form a chatty pair. How do we solve the problem when all the students' names start with the same letter? We claim that it's best to split as evenly as possible. If one c...
900
[ "combinatorics", "greedy" ]
23
[ { "input": "4\r\njorge\r\njose\r\noscar\r\njerry\r\n", "output": "1\r\n" }, { "input": "7\r\nkambei\r\ngorobei\r\nshichiroji\r\nkyuzo\r\nheihachi\r\nkatsushiro\r\nkikuchiyo\r\n", "output": "2\r\n" }, { "input": "5\r\nmike\r\nmike\r\nmike\r\nmike\r\nmike\r\n", "output": "4\r\n" }, ...
false
stdio
null
true
End of preview.
README.md exists but content is empty.
Downloads last month
3