context listlengths 1 1 | gen_kwargs dict | repeat_idx int64 0 4 | request_idx int64 0 510 | task_name stringclasses 6
values | metadata dict | model_outputs stringlengths 539 136k |
|---|---|---|---|---|---|---|
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S of length N consisting of A, B, and C.\nFind the position where ABC first appears as a (conti... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 289 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this problem where given a string S consisting of A, B, and C, I have to find the starting position of the first occurrence of the substring "ABC". If it doesn't exist, return -1. Let's think about how to approach this.
First, the input is given as N, the length o... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two strings S and T consisting of lowercase English letters. The lengths of S and T are N and M, respect... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 290 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's tackle this problem step by step. So, we need to determine if string S is a prefix, suffix, both, or neither of string T. The output depends on those conditions. Let me think about how to approach this.
First, the input format is given as N, M, then the strings S and T. N is the length of S, and M is the l... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The AtCoder Kingdom holds a festival for N days. On M of these days, namely on the A_1-th, A_2-th, \\dots, A_M-th days... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 291 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this problem where we have a festival lasting N days, and on certain days (given as A_1, A_2, ..., A_M), there are fireworks. The task is to determine, for each day i from 1 to N, how many days later the next fireworks show happens on or after day i. If there are f... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A polyomino is a puzzle piece in the shape of a connected polygon made by connecting several squares by their edges.\n... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 292 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads three polyominoes from stdin, each represented as a 4x4 grid of '#' and '.' characters. The goal is to determine if these three polyominoes can tile a 4x4 grid without overlapping and without going outside the grid. They can be translated and rotated but not flipped... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.AtCoder Inc. is planning to develop a product. The product has K parameters, whose values are currently all zero. The ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 293 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where AtCoder Inc. wants to increase all K parameters from 0 to at least P using some development plans. Each plan has a cost C_i and adds certain values A_{i,j} to each parameter j. The goal is to find the minimum total cost to achieve this, or -1 if it's impossible.
Let me start... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S of length 16 consisting of 0 and 1.\nIf the i-th character of S is 0 for every even number i ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 294 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's see. I need to write a Python function that checks if all the even-indexed characters in a given 16-character string S are '0's. If they are, print 'Yes'; otherwise, print 'No'. The string is read from stdin, and the result is printed to stdout.
First, I should start by defining the function. Let's name it... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N players numbered 1 to N, who have played a round-robin tournament. For every match in this tournament, one... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 295 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads input from stdin, processes the tournament results, and prints the player numbers in descending order based on their number of wins. If two players have the same number of wins, the one with the smaller player number comes first. Let me break this down step by step.... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The programming contest World Tour Finals is underway, where N players are participating, and half of the competition ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 296 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this programming contest problem. Let me try to understand the problem first.
We have N players and M problems. Each problem has a score A_i, which is a multiple of 100 between 500 and 2500. Each player has a string S_i of length M where each character is 'o' if t... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Initially, there are N sizes of slimes.\nSpecifically, for each 1\\leq i\\leq N, there are C_i slimes of size S_i.\nTa... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 297 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to minimize the number of slimes after performing as many syntheses as possible. The problem states that each synthesis combines two slimes of the same size into one slime of double the size. The goal is to end up with the least number of slimes possible.
First, let me understand the... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi has a playlist with N songs.\nSong i (1 \\leq i \\leq N) lasts T_i seconds.\nTakahashi has started random pl... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 298 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this probability problem where Takahashi is playing a playlist on random repeat. The question is asking for the probability that the first song (song 1) is being played at X + 0.5 seconds after time 0. The answer needs to be modulo 998244353. Hmm, let's break this down.
First, the setup: There... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given N integers A _ 1,A _ 2,\\ldots,A _ N.\nIf their values are all equal, print Yes; otherwise, print No.\n\... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 299 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that checks if all the numbers in a list are equal. The input is going to be from standard input, first line is N, the number of integers, and the second line is the list of integers. The function should print "Yes" if all numbers are the same, otherwise "No".
Let me start by... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a positive integer N.\r\nIf there are integers x and y such that N=2^x3^y, print Yes; otherwise, print N... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 300 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that checks if a given number N can be expressed as 2^x multiplied by 3^y, where x and y are non-negative integers. The function should take input from stdin and print "Yes" or "No" accordingly. Let me think through this step by step.
First, the problem is about factorizing N... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi sent a string T consisting of lowercase English letters to Aoki. As a result, Aoki received a string T' cons... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 301 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this problem where we have to find which strings from a list could potentially be the original string T that was altered to become T'. The alterations could be inserting a character, deleting a character, changing a character, or being exactly the same.
First, le... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S of length N consisting of digits.\nFind the number of square numbers that can be obtained by ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 302 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this problem where given a string S of digits, I have to find how many different square numbers can be formed by permuting the digits of S and interpreting them as a decimal integer. The function should take input from stdin and print the result. Let me try to brea... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given N strings S_1, S_2, \\ldots, S_N consisting of lowercase English letters, and a string T consisting of l... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 303 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where I have to find the number of pairs (i, j) such that the concatenation of S_i and S_j contains T as a subsequence. The constraints are pretty large, so a straightforward approach with checking all pairs would be O(N^2) which is too slow given N can be up to 5e5. The total leng... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a directed graph with N vertices and M edges. Each edge has two positive integer values: beauty and cost.\nFo... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 304 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where I have a directed graph with N vertices and M edges. Each edge has a beauty and a cost. The goal is to find the maximum value of the ratio (total beauty)/(total cost) for any path from vertex 1 to vertex N. The graph is guaranteed to have at least one such path.
Let me star... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Keyence has a culture of addressing everyone with the honorific \"san,\" regardless of their role, age, or position.\n... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 305 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes input from stdin, which will be two strings: a surname and a first name. Then, the function should print the surname followed by a space and then "san". The input format is S T, where S is the surname and T is the first name.
First, I need to figure out how to rea... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Keyence has N bases worldwide, numbered 1 to N.\r\nBase i has W_i employees, and at 0 o'clock in Coordinated Universal... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 306 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to solve this problem where Keyence has N bases with different time zones, and I need to schedule a one-hour meeting that maximizes the number of participating employees. Each employee can only join if the meeting is entirely within their local 9:00 to 18:00 window. Let me break this d... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are zero or more sensors placed on a grid of H rows and W columns. Let (i, j) denote the square in the i-th row ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 307 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads a grid from stdin, where each cell can either be a sensor ('#') or empty ('.'). The task is to count the number of sensor groups, where a group is defined as all sensors that are adjacent to each other either horizontally, vertically, or diagonally. This means each ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N products labeled 1 to N flowing on a conveyor belt.\r\nA Keyence printer is attached to the conveyor belt,... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 308 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to solve this problem where we have to maximize the number of products the Keyence printer can print on. The printer can only print one product at a time and needs 1 microsecond to charge after each print. The products are in the printer's range from time T_i to T_i + D_i. The goal is ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N cities in a certain country.\nYou will travel from your office in city 1 to a destination in city N, via z... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 309 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out the minimum time to travel from city 1 to city N using either the company car or the train, with the constraint that once I switch from the car to the train, I can't switch back. The input gives me the time matrices for the cities and the parameters A, B, C where the time by car is D_ij * ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.As the factory manager of Keyence, you want to monitor several sections on a conveyor belt. There are a total of N sec... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 310 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where I have to monitor several sections on a conveyor belt using two types of sensors. Each section has a certain length, and each sensor type has a coverage length, cost, and a maximum number of units I can use. The goal is to find the minimum total cost to monitor all sections, ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi is in a building with 100 floors.\nHe uses the stairs for moving up two floors or less or moving down three ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 311 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's see. So the problem is about Takahashi moving between floors in a building with 100 floors. The rules are that he uses the stairs if he's moving up two floors or less, or moving down three floors or less. Otherwise, he uses the elevator. We need to determine if he uses the stairs or the elevator based on th... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A 326-like number is a three-digit positive integer where the product of the hundreds and tens digits equals the ones ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 312 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that finds the smallest 326-like number greater than or equal to a given integer N. The number N is a three-digit number between 100 and 919. Let me first make sure I understand what a 326-like number is.
From the problem statement, a 326-like number is a three-digit number ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi has placed N gifts on a number line. The i-th gift is placed at coordinate A_i.\nYou will choose a half-open... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 313 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this problem where Takahashi has placed N gifts on a number line, and I need to find the maximum number of gifts I can acquire by choosing a half-open interval [x, x+M). The input will be given as N and M on the first line, followed by the coordinates of the gifts.... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an integer N and strings R and C of length N consisting of A, B, and C. Solve the following problem.\nTh... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 314 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to create a Python function that reads input from stdin, which includes an integer N, two strings R and C each of length N. The task is to determine if it's possible to fill a N x N grid with characters A, B, C such that each row and column contains exactly one A, one B, and one C. Additionally, the lef... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Aoki, an employee at AtCoder Inc., has his salary for this month determined by an integer N and a sequence A of length... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 315 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where Aoki's salary is determined by a die-rolling process. The goal is to find the expected value of his salary modulo 998244353. Let me try to break down the problem step by step.
First, let's understand the process. Aoki starts with x=0. Each time he rolls an N-sided die, getti... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S of length N consisting of lowercase English letters.\r\nIf there are any adjacent occurrences... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 316 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that checks if a string S has any adjacent occurrences of 'a' and 'b'. The order doesn't matter, so 'ab' or 'ba' should both count. The input will be the length N and the string S itself. The function should read from stdin and print 'Yes' or 'No' accordingly.
First, let me t... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an integer B.\nIf there exists a positive integer A such that A^A = B, print its value; otherwise, outpu... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 317 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes an integer B from stdin and checks if there's a positive integer A such that A^A equals B. If such an A exists, the function should print it; otherwise, it should print -1. Let me think about how to approach this.
First, let's understand the problem. Given B, find ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a 9\\times 9 grid A, where each cell contains an integer between 1 and 9, inclusive.\nSpecifically, the cell ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 318 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that checks if a 9x9 grid satisfies the Sudoku rules. That means each row, each column, and each 3x3 subgrid must contain all numbers from 1 to 9 exactly once. The input will come from stdin, and the function should print "Yes" if all conditions are met, otherwise "No".
First... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A pair of sequences of length M consisting of positive integers at most N, (S, T) = ((S_1, S_2, \\dots, S_M), (T_1, T_... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 319 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out if a given pair of sequences (A, B) is a "good" pair. The definition of a good pair is that there exists a binary sequence X (of length N with 0s and 1s) such that for every i from 1 to M, X_{A_i} ≠ X_{B_i}.
First, let me parse the problem again. The input is two sequences A and B, each ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi participated in N contests and earned a performance P_i in the i-th contest.\nHe wants to choose some (at le... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 320 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this rating maximization problem for Takahashi. Let me try to understand the problem first.
Takahashi has participated in N contests, each with a performance score P_i. He wants to choose some subset of these contests (at least one) such that his rating R is maxim... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a programming contest with N problems. For each i = 1, 2, \\ldots, N, the score for the i-th problem is S_i.\... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 321 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's see. I need to write a Python function that reads input from stdin, processes it according to the problem description, and prints the result. The problem is about calculating the total score of programming contest problems that have a score less than or equal to a given value X.
First, let me parse the pro... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.AtCoder Kingdom uses a calendar whose year has N months.\nMonth i (1\\leq i\\leq N) has D _ i days, from day 1 of mont... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 322 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads input from stdin, processes it according to the problem description, and prints the result. Let me try to break down the problem step by step.
First, the problem is about counting the number of "repdigit" dates in a year. A repdigit date is when both the month and ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S = S_1S_2\\ldots S_N of length N consisting of lowercase English letters.\nAdditionally, you a... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 323 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads input from stdin, processes the queries, and prints the results. Let me start by understanding the problem again.
We have a string S of length N and Q queries. Each query gives a range [l_i, r_i], and we need to count how many times a character is repeated consecut... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S consisting of three different characters: A, B, and C.\nAs long as S contains the string ABC ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 324 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that processes a string S consisting of characters A, B, and C. The task is to repeatedly remove the leftmost occurrence of the substring "ABC" until there are no more "ABC" substrings left. Then, the function should print the resulting string.
Let me start by understanding t... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a weighted simple connected undirected graph with N vertices and M edges, where vertices are numbered 1 ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 325 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this problem where given a graph with N vertices, M edges, and a number K, I have to find the minimum cost of a spanning tree modulo K. The input is given through stdin, and the output should be printed. Let me think step by step.
First, the problem is about findi... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S consisting of uppercase English letters. Separate each character of S with a space and print ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 326 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes a string S from standard input, separates each character with a space, and prints them one by one in order. Let me think about how to approach this.
First, the function should read the input string S. Since the problem states that the input is given from Standard I... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given N integers A_1, A_2, \\ldots, A_N. Find the largest among those integers that are not the largest.\nThe ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 327 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads input from stdin, processes it according to the problem description, and prints the result. Let me break down the problem first.
The problem says: Given N integers, find the largest one that is not the overall largest. The constraints ensure there's always an answe... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S of length N consisting of lowercase English letters.\nFind the number of non-empty substrings... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 328 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads input from stdin, which includes an integer N and a string S of length N. The task is to find the number of non-empty substrings of S that are composed of the same character. Each such substring should be counted only once, even if it appears multiple times in S.
... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is an election to choose one winner from N candidates with candidate numbers 1, 2, \\ldots, N, and there have be... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 329 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that processes election votes incrementally and prints the winner after each vote. The function should take input from stdin and print the results to stdout. Let me think through the requirements step by step.
First, the input format is N (number of candidates) and M (number ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two strings: S, which consists of uppercase English letters and has length N, and T, which also consists... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 330 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to solve this problem where we have two strings, S and T, and we need to determine if we can turn the initial string X (which is all #'s) into S by replacing M-length segments with T any number of times. Let's break down the problem step by step.
First, let's understand the operations... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N boxes numbered 1, 2, \\ldots, N. Initially, box i contains one ball of color C_i.\nYou are given Q queries... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 331 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that processes queries on boxes with colored balls. Let me try to understand the problem first.
We have N boxes, each initially containing one ball of color C_i. Then there are Q queries, each asking to move all balls from box a to box b and print the number of distinct color... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.N people labeled 1,2,\\dots,N took an exam, and person i scored A_i points.\r\nOnly those who scored at least L points... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 332 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads input from stdin, processes it according to the problem description, and prints the output. Let me break down the problem step by step.
First, the problem says there are N people who took an exam, each labeled from 1 to N. Each person i has a score A_i. The passing... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an integer sequence A=(A_1,A_2,\\ldots,A_N) of length N and integers L and R such that L\\leq R.\nFor ea... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 333 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's see. So the problem is about finding, for each number in a sequence A, the integer X_i within a given range [L, R] that is closest to A_i. And if there are multiple such numbers, we need to pick the smallest one. Wait, no, actually the problem says "the integer to be found is always uniquely determined," so... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a positive integer D.\nFind the minimum value of |x^2+y^2-D| for non-negative integers x and y.\n\nInput... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 334 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes a positive integer D as input and finds the minimum value of |x² + y² - D| where x and y are non-negative integers. The function should read D from stdin, compute the result, and print it. Let me think about how to approach this.
First, the problem is about finding... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an N \\times N grid. Let (i,j) denote the cell in the i-th row from the top and the j-th column from the... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 335 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this grid problem. Let me try to understand the problem first. The task is to find the number of triples of cells that meet certain conditions. Let me restate the conditions to make sure I get them:
1. The three cells must be distinct.
2. All three cells must have... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a sequence A=(A_1,A_2,\\dots,A_N) of length N.\r\nRespond to the following Q queries in the order they a... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 336 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that can read input from stdin, process the given queries, and print the mex after each query. The mex is the smallest non-negative integer not present in the array. The challenges here are handling up to 200,000 queries efficiently and keeping track of the mex after each upda... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In the calendar of AtCoder Kingdom, a year consists of M months from month 1 to month M, and each month consists of D ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 337 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that, given a date in the format year y, month m, day d, along with the total number of months M and days D in a year, calculates the next day. The input will be provided via stdin, and the output should be printed to stdout in the format y' m' d' separated by spaces.
First,... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A supermarket sells egg packs.\nA pack of 6 eggs costs S yen, a pack of 8 eggs costs M yen, and a pack of 12 eggs cost... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 338 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this egg pack problem. Let me try to understand the problem first. The supermarket sells three different packs of eggs: 6, 8, and 12 eggs. Each has a different price: S yen for 6, M yen for 8, and L yen for 12. The goal is to find the minimum amount of money needed... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a sequence A=(A_1,\\ldots,A_N) of length N.\nFor each i=1,\\ldots,N, solve the following problem.\nProbl... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 339 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads an integer N and a sequence of N integers from stdin, then for each element in the sequence, calculates the sum of all elements greater than it, and prints the results separated by spaces. The function should then be called after its definition. Let me think through... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a grid with 10^9 by 10^9 squares. Let (i, j) denote the square at the (i + 1)-th row from the top and the (j ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 340 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that can handle queries on a very large grid (10^9 x 10^9) where each cell's color (black or white) is determined by a pattern of size N x N. The key here is that the grid is periodic, repeating every N rows and columns. The function should read from stdin, process the input, ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.AtCoder cafeteria sells meals consisting of a main dish and a side dish.\r\nThere are N types of main dishes, called m... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 341 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where I have to find the most expensive set meal that's offered at AtCoder cafeteria. The set meal is a combination of one main dish and one side dish, but some pairs are not allowed. The input gives me the number of main dishes (N), side dishes (M), and the number of forbidden pai... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.AtCoder Inc. sells merchandise through its online shop.\nTakahashi has decided to purchase N types of products from th... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 342 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's see. I need to write a Python function that calculates the total amount Takahashi will pay for his online shopping. The problem says that he buys N types of products, each with a price P_i and quantity Q_i. Then there's a shipping fee that's either K yen if the total product price is below S yen, or 0 if it... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.AtCoder Inc. sells glasses and mugs.\nTakahashi has a glass with a capacity of G milliliters and a mug with a capacity... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 343 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's try to figure out how to solve this problem. So, we have a glass with capacity G and a mug with capacity M, where G is less than M. Both start empty, and we need to perform K operations. Each operation has some steps: if the glass is full, discard all water from it. Otherwise, if the mug is empty, fill the ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.AtCoder Inc. sells T-shirts with its logo.\nYou are given Takahashi's schedule for N days as a string S of length N co... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 344 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's try to figure out how to solve this problem. So, Takahashi has a schedule for N days, each day being 0, 1, or 2. He has M plain T-shirts initially. We need to find the minimum number of logo T-shirts he needs to buy so that he can follow his schedule.
First, let's understand the constraints. On days marke... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two grids, A and B, each with H rows and W columns.\nFor each pair of integers (i, j) satisfying 1 \\leq... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 345 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to determine if grid A can be transformed into grid B using the minimum number of row and column swaps. The operations allowed are swapping adjacent rows or adjacent columns. If it's possible, print the minimum number of operations; otherwise, print -1.
First, let me understand the pr... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an integer N between 1 and 9, inclusive, as input.\nConcatenate N copies of the digit N and print the re... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 346 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes an integer N from stdin, which is between 1 and 9 inclusive. Then, the function should concatenate N copies of the digit N and print the resulting string. Let me think about how to approach this.
First, the function should read the input from stdin. Since the probl... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A regular pentagon P is shown in the figure below.\n\nDetermine whether the length of the line segment connecting poin... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 347 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that determines whether the length of the line segment connecting two points (S₁ and S₂) in a regular pentagon is equal to the length of another segment (T₁ and T₂). The input will be two pairs of points, each pair on a new line. The function should read from stdin, which mean... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A repunit is an integer whose digits are all 1 in decimal representation. The repunits in ascending order are 1, 11, 1... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 348 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that, given an integer N, finds the N-th smallest integer that can be expressed as the sum of exactly three repunits. Repunits are numbers like 1, 11, 111, etc., where all digits are 1s.
First, I need to understand how these sums work. Since a repunit is made up of all 1s, a... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a tree with N vertices: vertex 1, vertex 2, \\ldots, vertex N.\r\nThe i-th edge (1\\leq i\\lt N) connect... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 349 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to solve this problem where we have a tree, and we need to find the minimum number of operations required to delete vertex 1. The operation is deleting a leaf node each time. Let me think through this step by step.
First, let me understand the problem better. We have a tree with N nod... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi will embark on an adventure.\nDuring the adventure, N events will occur.\r\nThe i-th event (1\\leq i\\leq N)... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 350 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where Takahashi has to go through a series of events where he either finds potions or encounters monsters. The goal is to figure out the minimum maximum number of potions he has at any point (K_min) while still being able to defeat all the monsters. If it's impossible, we print -1.... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi, a young baseball enthusiast, has been a very good boy this year, so Santa has decided to give him a bat or ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 351 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's see. So the problem is about Takahashi getting either a bat or a glove from Santa, whichever is more expensive. The input will be two numbers, B for the bat's price and G for the glove's price. They are different, so we don't have to worry about them being equal. The task is to write a Python function that ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a road that stretches infinitely to the east and west, and the coordinate of a point located x meters to the ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 352 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's see. So the problem is about Snuke setting up Christmas trees along an infinite road at intervals of M meters, starting from a point A. We need to find how many of these trees are between Takahashi and Aoki, who are standing at points L and R respectively, where L ≤ R.
First, I need to understand how the p... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi has N pairs of socks, and the i-th pair consists of two socks of color i.\nOne day, after organizing his che... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 353 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's try to figure out how to solve this problem. So, Takahashi has N pairs of socks, each pair is a different color from 1 to N. Then he lost one sock each from K colors, given as A_1 to A_K. Now he wants to make as many new pairs as possible from the remaining socks, and he wants to minimize the total weirdnes... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N sleighs numbered 1,2,\\ldots, N.\nR_i reindeer are required to pull sleigh i.\nAdditionally, each reindeer... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 354 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this sleigh and reindeer problem. Let me try to understand the problem first.
We have N sleighs, each requiring R_i reindeer. We need to answer Q queries where each query gives us X reindeer, and we have to find the maximum number of sleighs we can pull with X rei... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.This problem has a similar setting to Problem G. Differences in the problem statement are indicated in red.\nThere is ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 355 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where I have a grid with red and green cells. The task is to compute the expected number of green connected components after randomly repainting one red cell to green. The expected value should be modulo 998244353. Hmm, let's break this down step by step.
First, I need to understa... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S consisting of lowercase English letters and digits.\nS is guaranteed to end with 2023.\r\nCha... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 356 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes a string S as input from stdin, changes the last character to '4', and then prints the modified string. The problem says that the string S is guaranteed to end with '2023'. Let me think about how to approach this.
First, since the string ends with '2023', the last ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an integer N.\nPrint all triples of non-negative integers (x,y,z) such that x+y+z\\leq N in ascending le... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 357 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes an integer N from stdin and prints all triples (x, y, z) of non-negative integers where x + y + z ≤ N, ordered lexicographically. The output should be each triple on a separate line, with the numbers separated by spaces.
First, I need to understand what lexicograp... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi has created a game where the player controls a dragon on a coordinate plane.\nThe dragon consists of N parts... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 358 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's try to tackle this problem. So, Takahashi has this dragon game where the dragon is made up of N parts, each at coordinates (i, 0) initially. The head is part 1, and the rest follow in order. We need to process Q queries: either moving the head or finding the coordinates of a specific part.
First, understan... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a grid with N rows and N columns, where N is an odd number at most 45.\nLet (i,j) denote the cell at the i-th... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 359 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to create a Python function that takes an odd integer N (between 3 and 45) as input and prints an N x N grid. The grid should have Takahashi (denoted by 'T') at the center, and the numbers 1 to N²-1 placed in the other cells such that each number from 2 to N²-1 is adjacent to the previous number. The ad... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.For a positive integer X, the Dragon String of level X is a string of length (X+3) formed by one L, X occurrences of o... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 360 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to create a Python function that generates something called a "Dragon String" based on the input level N. Let me try to understand the problem first.
The prompt says that for a positive integer X, the Dragon String of level X is a string of length (X+3) formed by one 'L', X occurrences of 'o', one 'n',... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.For a positive integer X, let \\text{ctz}(X) be the (maximal) number of consecutive zeros at the end of the binary not... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 361 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that calculates the number of trailing zeros in the binary representation of a given positive integer N. The function should take input from stdin and print the result. Let me think about how to approach this.
First, I remember that the number of trailing zeros in the binary ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A non-negative integer n is called a good integer when it satisfies the following condition:\n\n- All digits in the de... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 362 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to find the N-th smallest good integer where a good integer has all even digits. The digits allowed are 0, 2, 4, 6, 8. The problem is that N can be up to 10^12, which is really big, so I need an efficient way to compute this without generating all numbers up to that point.
First, let me think about how... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.For a positive integer k, the Pyramid Sequence of size k is a sequence of length (2k-1) where the terms of the sequenc... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 363 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to solve this problem where we have a sequence A, and we can perform operations to decrease elements by 1 or remove the first or last term. The goal is to find the maximum size of a Pyramid Sequence that can be obtained.
First, let me make sure I understand what a Pyramid Sequence is... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Team Takahashi and Team Aoki played N matches.\r\nIn the i-th match (1\\leq i\\leq N), Team Takahashi scored X _ i poi... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 364 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads input from stdin, processes the scores of two teams over N matches, and determines the winner or if it's a draw. Let me think about how to approach this.
First, the input format is given as N, followed by N lines each containing X_i and Y_i, the scores for each mat... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.We define Extended A strings, Extended B strings, Extended C strings, and Extended ABC strings as follows:\n\n- A stri... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 365 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that checks if a given string S is an Extended ABC string. Let me try to understand the problem first.
From the prompt, an Extended ABC string is formed by concatenating an Extended A string, an Extended B string, and an Extended C string in that order. Each Extended A, B, or... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N people standing in a line: person 1, person 2, \\ldots, person N.\nYou are given the arrangement of the pe... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 366 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's see. I need to write a Python function that takes input from stdin and prints the order of people in a line based on the given arrangement. The input format is N followed by a sequence A where each A_i indicates the person right in front of person i, unless A_i is -1, meaning that person is at the front.
... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a grid with H rows and W columns. Let (i, j) denote the cell at the i-th row from the top and the j-th column... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 367 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads a grid from stdin, where each cell is either 'o', 'x', or '.', and determines the minimum number of operations needed to create a horizontal or vertical line of 'o's of length K. If it's impossible, the function should print -1. The operations allowed are changing a... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.This is an interactive problem (a type of problem where your program interacts with the judge program through Standard... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 368 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this interactive problem where there's one bad juice bottle among N bottles, and I have to figure out which one it is by testing groups of bottles with friends. The key points are that I need to use the minimum number of friends (tests) required, which is probably ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a non-empty string S consisting of uppercase and lowercase English letters. Determine whether the follow... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 369 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that checks if a given string S has its first character uppercase and all other characters lowercase. The function should take input from stdin and print "Yes" or "No" accordingly. Let me think about how to approach this.
First, I should read the input string from stdin. Then... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S consisting of lowercase English letters. Find the character that appears most frequently in S... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 370 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes a string from stdin, finds the character that appears most frequently, and if there's a tie, picks the one that's earliest in the alphabet. Let me think through this step by step.
First, how do I read the input from stdin? In Python, I can use the `input()` functio... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Your refrigerator has N kinds of ingredients. Let us call them ingredient 1, \\dots, ingredient N. You have Q_i grams ... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 371 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to solve this problem where I have to maximize the total number of servings for two types of dishes, A and B, given the ingredients I have. Let me try to break it down.
First, the problem says I have N ingredients, each with a quantity Q_i. Each dish A requires A_i grams of ingredient... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The AtCoder Archipelago consists of N islands connected by N bridges.\nThe islands are numbered from 1 to N, and the i... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 372 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where we have an AtCoder Archipelago with N islands connected in a cycle by N bridges. The goal is to close one bridge optimally such that the length of the tour (which is the number of bridge crossings needed to visit a given sequence of islands in order) is minimized. The input g... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are 2N points placed at equal intervals on a circle, numbered 1 to 2N in a clockwise direction starting from a c... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 373 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that determines if any two chords intersect on a circle with 2N points. The input will be N chords, each connecting two points, and all points are distinct. The function should read from stdin, which will have the number N first, followed by N lines each containing two numbers... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a weighted simple directed graph with N vertices and M edges.\r\nThe vertices are numbered 1 to N, and the i-... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 374 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where given a directed graph with N vertices and M edges, some of which have negative weights, but no negative cycles. The task is to determine if there's a walk that visits each vertex at least once, and if such a walk exists, find the minimum total weight of the edges traversed. ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string S consisting of lowercase English letters and the character ..\r\nPrint the last substring when... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 375 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes a string S as input from stdin, splits it by the '.' character, and then prints the last substring in that split. The key points here are that the input string S can have lowercase English letters and '.', and it's guaranteed to have at least one '.'. Also, the spli... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a grid with H rows and W columns; initially, all cells are painted white. Let (i, j) denote the cell at the i... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 376 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's try to tackle this problem. So, we have a grid that's toroidal, meaning it wraps around both horizontally and vertically. Takahashi starts at (1,1) facing upwards. Each time he performs an operation: if the cell is white (.), he paints it black (#), turns right, and moves forward. If it's black, he paints i... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A bus is in operation. The number of passengers on the bus is always a non-negative integer.\nAt some point in time, t... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 377 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to solve this problem where we have a bus that stops N times, and at each stop, the number of passengers changes by A_i. The key thing is that the number of passengers must always be a non-negative integer. We need to find the minimum possible current number of passengers on the bus gi... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is an N \\times N grid, where each cell is either empty or contains an obstacle. Let (i, j) denote the cell at t... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 378 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to solve this problem where there are two players on an N x N grid with obstacles. The goal is to find the minimum number of moves required to get both players on the same cell. If it's impossible, print -1. The allowed moves are choosing a direction (up, down, left, right), and both players attempt to ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Print an arithmetic sequence with first term A, last term B, and common difference D.\nYou are only given inputs for w... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 379 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that reads three integers from stdin: A, B, and D. Then, it should print an arithmetic sequence starting with A, ending with B, with a common difference D. The problem statement says that such a sequence exists, so I don't have to worry about invalid inputs. Let me think about... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You have an empty sequence A. There are Q queries given, and you need to process them in the order they are given.\nTh... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 380 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's see. I need to write a Python function that processes a series of queries on a sequence A. The sequence starts empty, and the queries are either appending a value or retrieving the k-th value from the end. The function should take input from stdin and print the results for each type 2 query.
First, I need ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a single integer N written on a blackboard.\r\nTakahashi will repeat the following series of operations until... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 381 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's try to figure out this problem. So, we have an initial number N on the blackboard, and we need to perform operations until all numbers are less than 2. Each operation involves taking a number x (which is at least 2), paying x yen, and replacing x with floor(x/2) and ceil(x/2). The total amount paid is the s... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi is playing a game.\nThe game consists of N stages numbered 1,2,\\ldots,N. Initially, only stage 1 can be pla... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 382 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to figure out how to solve this problem where Takahashi is playing a game with N stages. The goal is to find the minimum time required to reach stage N. Each stage i (from 1 to N-1) has two options: spend A_i seconds to clear it and proceed to stage i+1, or spend B_i seconds to clear it and proceed to s... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N boxes numbered 0 to N-1. Initially, box i contains A_i balls.\nTakahashi will perform the following operat... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 383 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's try to figure out how to solve this problem. So, we have N boxes, each initially containing some number of balls A_0, A_1, ..., A_{N-1}. Then, we perform M operations. Each operation is defined by a B_i. For each operation i (from 1 to M), we do the following:
1. Set a variable C to 0.
2. Take all the ball... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a positive integer N, print a string of N zeros and N+1 ones where 0 and 1 alternate.\n\nInput\n\nThe input is g... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 384 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that takes an integer N from stdin, and then prints a string with N zeros and N+1 ones, alternating between 0 and 1. Let me think about how to approach this.
First, the input is a single integer N. The output should be a string that starts with 1, then alternates 0 and 1, suc... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N countries numbered 1 to N. For each i = 1, 2, \\ldots, N, Takahashi has A_i units of the currency of count... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 385 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's try to figure out how to solve this problem. So, we have N countries, each with some amount of currency that Takahashi has. The goal is to maximize the amount of currency in country N. The operation allowed is to convert some amount from country i to country i+1, with certain exchange rates given by S_i and... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a grid with H rows and W columns.\nEach cell of the grid is land or sea, which is represented by H strings S_... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 386 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, let's try to figure out how to solve this problem. So, we have a grid with H rows and W columns. The perimeter is all sea (represented by '#'), and the inner cells can be land ('.') or sea ('#'). Takahashi's spaceship crash-landed somewhere on land, and then he moved N times according to a string T consisting of ... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given three positive integers N, M, and K. Here, N and M are different.\nPrint the K-th smallest positive inte... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 387 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that solves this problem where given two different positive integers N and M, and another positive integer K, I have to find the K-th smallest positive integer that's divisible by exactly one of N or M. The input comes from stdin in the format "N M K", and the output should be... |
[
{
"content": "Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A string consisting of 0 and 1 is called a good string if two consecutive characters in the string are always differen... | {
"do_sample": false,
"max_new_tokens": 32768,
"seed": 1,
"temperature": 0.7
} | 1 | 388 | LiveCodeBench | {
"expected_answer": "",
"problem_id": "",
"reference_solution": ""
} | Okay, so I need to write a Python function that processes queries on a binary string. The queries can either flip a range of characters or check if a substring is a "good" string where no two consecutive characters are the same. The constraints are up to 5x10^5 for both the string length and the number of queries, so e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.