problem
stringlengths
20
3.95k
answer
stringclasses
532 values
task
stringclasses
6 values
problem_number
int64
1
1.31k
set_number
int64
1
5
There are H \times W cookies in H rows and W columns. The color of the cookie at the i-row from the top and j-th column from the left is represented by a lowercase English letter c_{i,j}. We will perform the following procedure. 1. For each row, perform the following operation: if there are two or more cookies remain...
LiveCodeBench
1,066
2
There are H \times W cookies in H rows and W columns. The color of the cookie at the i-row from the top and j-th column from the left is represented by a lowercase English letter c_{i,j}. We will perform the following procedure. 1. For each row, perform the following operation: if there are two or more cookies remain...
LiveCodeBench
1,066
3
We have N books numbered 1 to N. Book i assumes that you have read C_i books, the j-th of which is book P_{i,j}: you must read all these C_i books before reading book i. Here, you can read all the books in some order. You are trying to read the minimum number of books required to read book 1. Print the numbers of th...
LiveCodeBench
1,067
1
We have N books numbered 1 to N. Book i assumes that you have read C_i books, the j-th of which is book P_{i,j}: you must read all these C_i books before reading book i. Here, you can read all the books in some order. You are trying to read the minimum number of books required to read book 1. Print the numbers of th...
LiveCodeBench
1,067
2
We have N books numbered 1 to N. Book i assumes that you have read C_i books, the j-th of which is book P_{i,j}: you must read all these C_i books before reading book i. Here, you can read all the books in some order. You are trying to read the minimum number of books required to read book 1. Print the numbers of th...
LiveCodeBench
1,067
3
There is a race through checkpoints 1,2,\dots,N in this order on a coordinate plane. The coordinates of checkpoint i are (X_i,Y_i), and all checkpoints have different coordinates. Checkpoints other than checkpoints 1 and N can be skipped. However, let C be the number of checkpoints skipped, and the following penalty wi...
LiveCodeBench
1,068
1
There is a race through checkpoints 1,2,\dots,N in this order on a coordinate plane. The coordinates of checkpoint i are (X_i,Y_i), and all checkpoints have different coordinates. Checkpoints other than checkpoints 1 and N can be skipped. However, let C be the number of checkpoints skipped, and the following penalty wi...
LiveCodeBench
1,068
2
There is a race through checkpoints 1,2,\dots,N in this order on a coordinate plane. The coordinates of checkpoint i are (X_i,Y_i), and all checkpoints have different coordinates. Checkpoints other than checkpoints 1 and N can be skipped. However, let C be the number of checkpoints skipped, and the following penalty wi...
LiveCodeBench
1,068
3
Takahashi likes full moons. Let today be day 1. The first day on or after today on which he can see a full moon is day M. After that, he can see a full moon every P days, that is, on day M+P, day M+2P, and so on. Find the number of days between day 1 and day N, inclusive, on which he can see a full moon. Input The in...
LiveCodeBench
1,069
1
Takahashi likes full moons. Let today be day 1. The first day on or after today on which he can see a full moon is day M. After that, he can see a full moon every P days, that is, on day M+P, day M+2P, and so on. Find the number of days between day 1 and day N, inclusive, on which he can see a full moon. Input The in...
LiveCodeBench
1,069
2
Takahashi likes full moons. Let today be day 1. The first day on or after today on which he can see a full moon is day M. After that, he can see a full moon every P days, that is, on day M+P, day M+2P, and so on. Find the number of days between day 1 and day N, inclusive, on which he can see a full moon. Input The in...
LiveCodeBench
1,069
3
There are N rectangular sheets spread out on a coordinate plane. Each side of the rectangular region covered by each sheet is parallel to the x- or y-axis. Specifically, the i-th sheet covers exactly the region satisfying A_i \leq x\leq B_i and C_i \leq y\leq D_i. Let S be the area of the region covered by one or more...
LiveCodeBench
1,070
1
There are N rectangular sheets spread out on a coordinate plane. Each side of the rectangular region covered by each sheet is parallel to the x- or y-axis. Specifically, the i-th sheet covers exactly the region satisfying A_i \leq x\leq B_i and C_i \leq y\leq D_i. Let S be the area of the region covered by one or more...
LiveCodeBench
1,070
2
There are N rectangular sheets spread out on a coordinate plane. Each side of the rectangular region covered by each sheet is parallel to the x- or y-axis. Specifically, the i-th sheet covers exactly the region satisfying A_i \leq x\leq B_i and C_i \leq y\leq D_i. Let S be the area of the region covered by one or more...
LiveCodeBench
1,070
3
Takahashi is planning an N-day train trip. For each day, he can pay the regular fare or use a one-day pass. Here, for 1\leq i\leq N, the regular fare for the i-th day of the trip is F_i yen. On the other hand, a batch of D one-day passes is sold for P yen. You can buy as many passes as you want, but only in units of D....
LiveCodeBench
1,071
1
Takahashi is planning an N-day train trip. For each day, he can pay the regular fare or use a one-day pass. Here, for 1\leq i\leq N, the regular fare for the i-th day of the trip is F_i yen. On the other hand, a batch of D one-day passes is sold for P yen. You can buy as many passes as you want, but only in units of D....
LiveCodeBench
1,071
2
Takahashi is planning an N-day train trip. For each day, he can pay the regular fare or use a one-day pass. Here, for 1\leq i\leq N, the regular fare for the i-th day of the trip is F_i yen. On the other hand, a batch of D one-day passes is sold for P yen. You can buy as many passes as you want, but only in units of D....
LiveCodeBench
1,071
3
You are given a weighted undirected complete graph with N vertices numbered from 1 to N. The edge connecting vertices i and j (i< j) has a weight of D_{i,j}. When choosing some number of edges under the following condition, find the maximum possible total weight of the chosen edges. - The endpoints of the chosen edges...
LiveCodeBench
1,072
1
You are given a weighted undirected complete graph with N vertices numbered from 1 to N. The edge connecting vertices i and j (i< j) has a weight of D_{i,j}. When choosing some number of edges under the following condition, find the maximum possible total weight of the chosen edges. - The endpoints of the chosen edges...
LiveCodeBench
1,072
2
You are given a weighted undirected complete graph with N vertices numbered from 1 to N. The edge connecting vertices i and j (i< j) has a weight of D_{i,j}. When choosing some number of edges under the following condition, find the maximum possible total weight of the chosen edges. - The endpoints of the chosen edges...
LiveCodeBench
1,072
3
You are given a sequence of positive integers of length N: A=(A_1,A_2,\ldots,A_N). Find the number of triples of positive integers (i,j,k) that satisfy all of the following conditions: - 1\leq i < j < k\leq N, - A_i = A_k, - A_i \neq A_j. Input The input is given from Standard Input in the following format: N A_1...
LiveCodeBench
1,073
1
You are given a sequence of positive integers of length N: A=(A_1,A_2,\ldots,A_N). Find the number of triples of positive integers (i,j,k) that satisfy all of the following conditions: - 1\leq i < j < k\leq N, - A_i = A_k, - A_i \neq A_j. Input The input is given from Standard Input in the following format: N A_1...
LiveCodeBench
1,073
2
You are given a sequence of positive integers of length N: A=(A_1,A_2,\ldots,A_N). Find the number of triples of positive integers (i,j,k) that satisfy all of the following conditions: - 1\leq i < j < k\leq N, - A_i = A_k, - A_i \neq A_j. Input The input is given from Standard Input in the following format: N A_1...
LiveCodeBench
1,073
3
You are given a positive integer N. Print a string of length (N+1), s_0s_1\ldots s_N, defined as follows. For each i = 0, 1, 2, \ldots, N, - if there is a divisor j of N that is between 1 and 9, inclusive, and i is a multiple of N/j, then s_i is the digit corresponding to the smallest such j (s_i will thus be one of ...
LiveCodeBench
1,074
1
You are given a positive integer N. Print a string of length (N+1), s_0s_1\ldots s_N, defined as follows. For each i = 0, 1, 2, \ldots, N, - if there is a divisor j of N that is between 1 and 9, inclusive, and i is a multiple of N/j, then s_i is the digit corresponding to the smallest such j (s_i will thus be one of ...
LiveCodeBench
1,074
2
You are given a positive integer N. Print a string of length (N+1), s_0s_1\ldots s_N, defined as follows. For each i = 0, 1, 2, \ldots, N, - if there is a divisor j of N that is between 1 and 9, inclusive, and i is a multiple of N/j, then s_i is the digit corresponding to the smallest such j (s_i will thus be one of ...
LiveCodeBench
1,074
3
There is a 3\times3 grid with numbers between 1 and 9, inclusive, written in each square. The square at the i-th row from the top and j-th column from the left (1\leq i\leq3,1\leq j\leq3) contains the number c _ {i,j}. The same number may be written in different squares, but not in three consecutive cells vertically, h...
LiveCodeBench
1,075
1
There is a 3\times3 grid with numbers between 1 and 9, inclusive, written in each square. The square at the i-th row from the top and j-th column from the left (1\leq i\leq3,1\leq j\leq3) contains the number c _ {i,j}. The same number may be written in different squares, but not in three consecutive cells vertically, h...
LiveCodeBench
1,075
2
There is a 3\times3 grid with numbers between 1 and 9, inclusive, written in each square. The square at the i-th row from the top and j-th column from the left (1\leq i\leq3,1\leq j\leq3) contains the number c _ {i,j}. The same number may be written in different squares, but not in three consecutive cells vertically, h...
LiveCodeBench
1,075
3
Takahashi is displaying a sentence with N words in a window. All words have the same height, and the width of the i-th word (1\leq i\leq N) is L _ i. The words are displayed in the window separated by a space of width 1. More precisely, when the sentence is displayed in a window of width W, the following conditions a...
LiveCodeBench
1,076
1
Takahashi is displaying a sentence with N words in a window. All words have the same height, and the width of the i-th word (1\leq i\leq N) is L _ i. The words are displayed in the window separated by a space of width 1. More precisely, when the sentence is displayed in a window of width W, the following conditions a...
LiveCodeBench
1,076
2
Takahashi is displaying a sentence with N words in a window. All words have the same height, and the width of the i-th word (1\leq i\leq N) is L _ i. The words are displayed in the window separated by a space of width 1. More precisely, when the sentence is displayed in a window of width W, the following conditions a...
LiveCodeBench
1,076
3
Takahashi is initially at his house and is about to visit Aoki's house. There are N bus stops numbered 1 to N between the two houses, and Takahashi can move between them in the following ways: - He can walk from his house to bus stop 1 in X units of time. - For each i = 1, 2, \ldots, N-1, a bus departs from bus stop i...
LiveCodeBench
1,077
1
Takahashi is initially at his house and is about to visit Aoki's house. There are N bus stops numbered 1 to N between the two houses, and Takahashi can move between them in the following ways: - He can walk from his house to bus stop 1 in X units of time. - For each i = 1, 2, \ldots, N-1, a bus departs from bus stop i...
LiveCodeBench
1,077
2
Takahashi is initially at his house and is about to visit Aoki's house. There are N bus stops numbered 1 to N between the two houses, and Takahashi can move between them in the following ways: - He can walk from his house to bus stop 1 in X units of time. - For each i = 1, 2, \ldots, N-1, a bus departs from bus stop i...
LiveCodeBench
1,077
3
You are given positive integers A and B. Print the value A^B+B^A. Input The input is given from Standard Input in the following format: A B Output Print the answer as an integer. Constraints - 2 \leq A \leq B \leq 9 - All input values are integers. Sample Input 1 2 8 Sample Output 1 320 For A = 2, B = 8, ...
LiveCodeBench
1,078
1
You are given positive integers A and B. Print the value A^B+B^A. Input The input is given from Standard Input in the following format: A B Output Print the answer as an integer. Constraints - 2 \leq A \leq B \leq 9 - All input values are integers. Sample Input 1 2 8 Sample Output 1 320 For A = 2, B = 8, ...
LiveCodeBench
1,078
2
You are given positive integers A and B. Print the value A^B+B^A. Input The input is given from Standard Input in the following format: A B Output Print the answer as an integer. Constraints - 2 \leq A \leq B \leq 9 - All input values are integers. Sample Input 1 2 8 Sample Output 1 320 For A = 2, B = 8, ...
LiveCodeBench
1,078
3
You are given a string S. Find the maximum length of a contiguous substring of S that is a palindrome. Note that there is always a contiguous substring of S that is a palindrome. Input The input is given from Standard Input in the following format: S Output Print the answer. Constraints - S is a string of leng...
LiveCodeBench
1,079
1
You are given a string S. Find the maximum length of a contiguous substring of S that is a palindrome. Note that there is always a contiguous substring of S that is a palindrome. Input The input is given from Standard Input in the following format: S Output Print the answer. Constraints - S is a string of leng...
LiveCodeBench
1,079
2
You are given a string S. Find the maximum length of a contiguous substring of S that is a palindrome. Note that there is always a contiguous substring of S that is a palindrome. Input The input is given from Standard Input in the following format: S Output Print the answer. Constraints - S is a string of leng...
LiveCodeBench
1,079
3
This problem is an easier version of Problem G. There is a slot machine with three reels. The arrangement of symbols on the i-th reel is represented by the string S_i. Here, S_i is a string of length M consisting of digits. Each reel has a corresponding button. For each non-negative integer t, Takahashi can either ch...
LiveCodeBench
1,080
1
This problem is an easier version of Problem G. There is a slot machine with three reels. The arrangement of symbols on the i-th reel is represented by the string S_i. Here, S_i is a string of length M consisting of digits. Each reel has a corresponding button. For each non-negative integer t, Takahashi can either ch...
LiveCodeBench
1,080
2
This problem is an easier version of Problem G. There is a slot machine with three reels. The arrangement of symbols on the i-th reel is represented by the string S_i. Here, S_i is a string of length M consisting of digits. Each reel has a corresponding button. For each non-negative integer t, Takahashi can either ch...
LiveCodeBench
1,080
3
There are N people numbered 1 to N on a coordinate plane. Person 1 is at the origin. You are given M pieces of information in the following form: - From person A_i's perspective, person B_i is X_i units away in the positive x-direction and Y_i units away in the positive y-direction. Determine the coordinates of each...
LiveCodeBench
1,081
1
There are N people numbered 1 to N on a coordinate plane. Person 1 is at the origin. You are given M pieces of information in the following form: - From person A_i's perspective, person B_i is X_i units away in the positive x-direction and Y_i units away in the positive y-direction. Determine the coordinates of each...
LiveCodeBench
1,081
2
There are N people numbered 1 to N on a coordinate plane. Person 1 is at the origin. You are given M pieces of information in the following form: - From person A_i's perspective, person B_i is X_i units away in the positive x-direction and Y_i units away in the positive y-direction. Determine the coordinates of each...
LiveCodeBench
1,081
3
There are N people gathered for an event called Flowing Noodles. The people are lined up in a row, numbered 1 to N in order from front to back. During the event, the following occurrence happens M times: - At time T_i, a quantity W_i of noodles is flown down. The person at the front of the row gets all of it (if no on...
LiveCodeBench
1,082
1
There are N people gathered for an event called Flowing Noodles. The people are lined up in a row, numbered 1 to N in order from front to back. During the event, the following occurrence happens M times: - At time T_i, a quantity W_i of noodles is flown down. The person at the front of the row gets all of it (if no on...
LiveCodeBench
1,082
2
There are N people gathered for an event called Flowing Noodles. The people are lined up in a row, numbered 1 to N in order from front to back. During the event, the following occurrence happens M times: - At time T_i, a quantity W_i of noodles is flown down. The person at the front of the row gets all of it (if no on...
LiveCodeBench
1,082
3
A positive integer x is called a 321-like Number when it satisfies the following condition. - The digits of x are strictly decreasing from top to bottom. - In other words, if x has d digits, it satisfies the following for every integer i such that 1 \le i < d: - (the i-th digit from the top of x) > (the (i+1)-th digit...
LiveCodeBench
1,083
1
A positive integer x is called a 321-like Number when it satisfies the following condition. - The digits of x are strictly decreasing from top to bottom. - In other words, if x has d digits, it satisfies the following for every integer i such that 1 \le i < d: - (the i-th digit from the top of x) > (the (i+1)-th digit...
LiveCodeBench
1,083
2
A positive integer x is called a 321-like Number when it satisfies the following condition. - The digits of x are strictly decreasing from top to bottom. - In other words, if x has d digits, it satisfies the following for every integer i such that 1 \le i < d: - (the i-th digit from the top of x) > (the (i+1)-th digit...
LiveCodeBench
1,083
3
There is an exam structured as follows. - The exam consists of N rounds called round 1 to N. - In each round, you are given an integer score between 0 and 100, inclusive. - Your final grade is the sum of the N-2 of the scores earned in the rounds excluding the highest and lowest. - Formally, let S=(S_1,S_2,\dots,S_N) ...
LiveCodeBench
1,084
1
There is an exam structured as follows. - The exam consists of N rounds called round 1 to N. - In each round, you are given an integer score between 0 and 100, inclusive. - Your final grade is the sum of the N-2 of the scores earned in the rounds excluding the highest and lowest. - Formally, let S=(S_1,S_2,\dots,S_N) ...
LiveCodeBench
1,084
2
There is an exam structured as follows. - The exam consists of N rounds called round 1 to N. - In each round, you are given an integer score between 0 and 100, inclusive. - Your final grade is the sum of the N-2 of the scores earned in the rounds excluding the highest and lowest. - Formally, let S=(S_1,S_2,\dots,S_N) ...
LiveCodeBench
1,084
3
A positive integer x is called a 321-like Number when it satisfies the following condition. This definition is the same as the one in Problem A. - The digits of x are strictly decreasing from top to bottom. - In other words, if x has d digits, it satisfies the following for every integer i such that 1 \le i < d: - (th...
LiveCodeBench
1,085
1
A positive integer x is called a 321-like Number when it satisfies the following condition. This definition is the same as the one in Problem A. - The digits of x are strictly decreasing from top to bottom. - In other words, if x has d digits, it satisfies the following for every integer i such that 1 \le i < d: - (th...
LiveCodeBench
1,085
2
A positive integer x is called a 321-like Number when it satisfies the following condition. This definition is the same as the one in Problem A. - The digits of x are strictly decreasing from top to bottom. - In other words, if x has d digits, it satisfies the following for every integer i such that 1 \le i < d: - (th...
LiveCodeBench
1,085
3
AtCoder cafeteria offers N main dishes and M side dishes. The price of the i-th main dish is A_i, and that of the j-th side dish is B_j. The cafeteria is considering introducing a new set meal menu. A set meal consists of one main dish and one side dish. Let s be the sum of the prices of the main dish and the side di...
LiveCodeBench
1,086
1
AtCoder cafeteria offers N main dishes and M side dishes. The price of the i-th main dish is A_i, and that of the j-th side dish is B_j. The cafeteria is considering introducing a new set meal menu. A set meal consists of one main dish and one side dish. Let s be the sum of the prices of the main dish and the side di...
LiveCodeBench
1,086
2
AtCoder cafeteria offers N main dishes and M side dishes. The price of the i-th main dish is A_i, and that of the j-th side dish is B_j. The cafeteria is considering introducing a new set meal menu. A set meal consists of one main dish and one side dish. Let s be the sum of the prices of the main dish and the side di...
LiveCodeBench
1,086
3
There is a tree with N vertices numbered 1 to N. For each i\ (2 \leq i \leq N), there is an edge connecting vertex i and vertex \lfloor \frac{i}{2} \rfloor. There are no other edges. In this tree, find the number of vertices whose distance from vertex X is K. Here, the distance between two vertices u and v is define...
LiveCodeBench
1,087
1
There is a tree with N vertices numbered 1 to N. For each i\ (2 \leq i \leq N), there is an edge connecting vertex i and vertex \lfloor \frac{i}{2} \rfloor. There are no other edges. In this tree, find the number of vertices whose distance from vertex X is K. Here, the distance between two vertices u and v is define...
LiveCodeBench
1,087
2
There is a tree with N vertices numbered 1 to N. For each i\ (2 \leq i \leq N), there is an edge connecting vertex i and vertex \lfloor \frac{i}{2} \rfloor. There are no other edges. In this tree, find the number of vertices whose distance from vertex X is K. Here, the distance between two vertices u and v is define...
LiveCodeBench
1,087
3
You are given a string S of length N consisting of A, B, and C. Find the position where ABC first appears as a (contiguous) substring in S. In other words, find the smallest integer n that satisfies all of the following conditions. - 1 \leq n \leq N - 2. - The string obtained by extracting the n-th through (n+2)-th ch...
LiveCodeBench
1,088
1
You are given a string S of length N consisting of A, B, and C. Find the position where ABC first appears as a (contiguous) substring in S. In other words, find the smallest integer n that satisfies all of the following conditions. - 1 \leq n \leq N - 2. - The string obtained by extracting the n-th through (n+2)-th ch...
LiveCodeBench
1,088
2
You are given a string S of length N consisting of A, B, and C. Find the position where ABC first appears as a (contiguous) substring in S. In other words, find the smallest integer n that satisfies all of the following conditions. - 1 \leq n \leq N - 2. - The string obtained by extracting the n-th through (n+2)-th ch...
LiveCodeBench
1,088
3
You are given two strings S and T consisting of lowercase English letters. The lengths of S and T are N and M, respectively. (The constraints guarantee that N \leq M.) S is said to be a prefix of T when the first N characters of T coincide S. S is said to be a suffix of T when the last N characters of T coincide S. If ...
LiveCodeBench
1,089
1
You are given two strings S and T consisting of lowercase English letters. The lengths of S and T are N and M, respectively. (The constraints guarantee that N \leq M.) S is said to be a prefix of T when the first N characters of T coincide S. S is said to be a suffix of T when the last N characters of T coincide S. If ...
LiveCodeBench
1,089
2
You are given two strings S and T consisting of lowercase English letters. The lengths of S and T are N and M, respectively. (The constraints guarantee that N \leq M.) S is said to be a prefix of T when the first N characters of T coincide S. S is said to be a suffix of T when the last N characters of T coincide S. If ...
LiveCodeBench
1,089
3
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, fireworks will be launched. It is guaranteed that fireworks will be launched on the last day of the festival. (In other words, A_M=N is guaranteed.) For each i=1,2,\dots,N, solve the following problem....
LiveCodeBench
1,090
1
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, fireworks will be launched. It is guaranteed that fireworks will be launched on the last day of the festival. (In other words, A_M=N is guaranteed.) For each i=1,2,\dots,N, solve the following problem....
LiveCodeBench
1,090
2
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, fireworks will be launched. It is guaranteed that fireworks will be launched on the last day of the festival. (In other words, A_M=N is guaranteed.) For each i=1,2,\dots,N, solve the following problem....
LiveCodeBench
1,090
3
A polyomino is a puzzle piece in the shape of a connected polygon made by connecting several squares by their edges. There is a grid with four rows and four columns, and three polyominoes that fit within the grid. The shape of the i-th polyomino is represented by 16 characters P_{i,j,k} (1 \leq j, k \leq 4). They desc...
LiveCodeBench
1,091
1
A polyomino is a puzzle piece in the shape of a connected polygon made by connecting several squares by their edges. There is a grid with four rows and four columns, and three polyominoes that fit within the grid. The shape of the i-th polyomino is represented by 16 characters P_{i,j,k} (1 \leq j, k \leq 4). They desc...
LiveCodeBench
1,091
2
A polyomino is a puzzle piece in the shape of a connected polygon made by connecting several squares by their edges. There is a grid with four rows and four columns, and three polyominoes that fit within the grid. The shape of the i-th polyomino is represented by 16 characters P_{i,j,k} (1 \leq j, k \leq 4). They desc...
LiveCodeBench
1,091
3
AtCoder Inc. is planning to develop a product. The product has K parameters, whose values are currently all zero. The company aims to raise all parameter values to at least P. There are N development plans. Executing the i-th development plan (1 \le i \le N) increases the value of the j-th parameter by A_{i,j} for ever...
LiveCodeBench
1,092
1
AtCoder Inc. is planning to develop a product. The product has K parameters, whose values are currently all zero. The company aims to raise all parameter values to at least P. There are N development plans. Executing the i-th development plan (1 \le i \le N) increases the value of the j-th parameter by A_{i,j} for ever...
LiveCodeBench
1,092
2
AtCoder Inc. is planning to develop a product. The product has K parameters, whose values are currently all zero. The company aims to raise all parameter values to at least P. There are N development plans. Executing the i-th development plan (1 \le i \le N) increases the value of the j-th parameter by A_{i,j} for ever...
LiveCodeBench
1,092
3
You are given a string S of length 16 consisting of 0 and 1. If the i-th character of S is 0 for every even number i from 2 through 16, print Yes; otherwise, print No. Input The input is given from Standard Input in the following format: S Output If the i-th character of S is 0 for every even number i from 2 throug...
LiveCodeBench
1,093
1
You are given a string S of length 16 consisting of 0 and 1. If the i-th character of S is 0 for every even number i from 2 through 16, print Yes; otherwise, print No. Input The input is given from Standard Input in the following format: S Output If the i-th character of S is 0 for every even number i from 2 throug...
LiveCodeBench
1,093
2
You are given a string S of length 16 consisting of 0 and 1. If the i-th character of S is 0 for every even number i from 2 through 16, print Yes; otherwise, print No. Input The input is given from Standard Input in the following format: S Output If the i-th character of S is 0 for every even number i from 2 throug...
LiveCodeBench
1,093
3
There are N players numbered 1 to N, who have played a round-robin tournament. For every match in this tournament, one player won and the other lost. The results of the matches are given as N strings S_1,S_2,\ldots,S_N of length N each, in the following format: - If i\neq j, the j-th character of S_i is o or x. o mea...
LiveCodeBench
1,094
1
There are N players numbered 1 to N, who have played a round-robin tournament. For every match in this tournament, one player won and the other lost. The results of the matches are given as N strings S_1,S_2,\ldots,S_N of length N each, in the following format: - If i\neq j, the j-th character of S_i is o or x. o mea...
LiveCodeBench
1,094
2
There are N players numbered 1 to N, who have played a round-robin tournament. For every match in this tournament, one player won and the other lost. The results of the matches are given as N strings S_1,S_2,\ldots,S_N of length N each, in the following format: - If i\neq j, the j-th character of S_i is o or x. o mea...
LiveCodeBench
1,094
3
The programming contest World Tour Finals is underway, where N players are participating, and half of the competition time has passed. There are M problems in this contest, and the score A_i of problem i is a multiple of 100 between 500 and 2500, inclusive. For each i = 1, \ldots, N, you are given a string S_i that ind...
LiveCodeBench
1,095
1
The programming contest World Tour Finals is underway, where N players are participating, and half of the competition time has passed. There are M problems in this contest, and the score A_i of problem i is a multiple of 100 between 500 and 2500, inclusive. For each i = 1, \ldots, N, you are given a string S_i that ind...
LiveCodeBench
1,095
2
The programming contest World Tour Finals is underway, where N players are participating, and half of the competition time has passed. There are M problems in this contest, and the score A_i of problem i is a multiple of 100 between 500 and 2500, inclusive. For each i = 1, \ldots, N, you are given a string S_i that ind...
LiveCodeBench
1,095
3
Initially, there are N sizes of slimes. Specifically, for each 1\leq i\leq N, there are C_i slimes of size S_i. Takahashi can repeat slime synthesis any number of times (possibly zero) in any order. Slime synthesis is performed as follows. - Choose two slimes of the same size. Let this size be X, and a new slime of si...
LiveCodeBench
1,096
1
Initially, there are N sizes of slimes. Specifically, for each 1\leq i\leq N, there are C_i slimes of size S_i. Takahashi can repeat slime synthesis any number of times (possibly zero) in any order. Slime synthesis is performed as follows. - Choose two slimes of the same size. Let this size be X, and a new slime of si...
LiveCodeBench
1,096
2
Initially, there are N sizes of slimes. Specifically, for each 1\leq i\leq N, there are C_i slimes of size S_i. Takahashi can repeat slime synthesis any number of times (possibly zero) in any order. Slime synthesis is performed as follows. - Choose two slimes of the same size. Let this size be X, and a new slime of si...
LiveCodeBench
1,096
3
Takahashi has a playlist with N songs. Song i (1 \leq i \leq N) lasts T_i seconds. Takahashi has started random play of the playlist at time 0. Random play repeats the following: choose one song from the N songs with equal probability and play that song to the end. Here, songs are played continuously: once a song ends,...
LiveCodeBench
1,097
1
Takahashi has a playlist with N songs. Song i (1 \leq i \leq N) lasts T_i seconds. Takahashi has started random play of the playlist at time 0. Random play repeats the following: choose one song from the N songs with equal probability and play that song to the end. Here, songs are played continuously: once a song ends,...
LiveCodeBench
1,097
2
Takahashi has a playlist with N songs. Song i (1 \leq i \leq N) lasts T_i seconds. Takahashi has started random play of the playlist at time 0. Random play repeats the following: choose one song from the N songs with equal probability and play that song to the end. Here, songs are played continuously: once a song ends,...
LiveCodeBench
1,097
3
You are given N integers A _ 1,A _ 2,\ldots,A _ N. If their values are all equal, print Yes; otherwise, print No. Input The input is given from Standard Input in the following format: N A _ 1 A _ 2 \ldots A _ N Output Print a single line containing Yes if the values of the given A _ 1,A _ 2,\ldots,A _ N are all eq...
LiveCodeBench
1,098
1
You are given N integers A _ 1,A _ 2,\ldots,A _ N. If their values are all equal, print Yes; otherwise, print No. Input The input is given from Standard Input in the following format: N A _ 1 A _ 2 \ldots A _ N Output Print a single line containing Yes if the values of the given A _ 1,A _ 2,\ldots,A _ N are all eq...
LiveCodeBench
1,098
2
You are given N integers A _ 1,A _ 2,\ldots,A _ N. If their values are all equal, print Yes; otherwise, print No. Input The input is given from Standard Input in the following format: N A _ 1 A _ 2 \ldots A _ N Output Print a single line containing Yes if the values of the given A _ 1,A _ 2,\ldots,A _ N are all eq...
LiveCodeBench
1,098
3
You are given a positive integer N. If there are integers x and y such that N=2^x3^y, print Yes; otherwise, print No. Input The input is given from Standard Input in the following format: N Output Print a single line containing Yes if there are integers x and y that satisfy the condition, and No otherwise. Constr...
LiveCodeBench
1,099
1
You are given a positive integer N. If there are integers x and y such that N=2^x3^y, print Yes; otherwise, print No. Input The input is given from Standard Input in the following format: N Output Print a single line containing Yes if there are integers x and y that satisfy the condition, and No otherwise. Constr...
LiveCodeBench
1,099
2