problem
stringlengths
20
3.95k
answer
stringclasses
532 values
task
stringclasses
6 values
problem_number
int64
1
1.31k
set_number
int64
1
5
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
3
Takahashi sent a string T consisting of lowercase English letters to Aoki. As a result, Aoki received a string T' consisting of lowercase English letters. T' may have been altered from T. Specifically, exactly one of the following four conditions is known to hold. - T' is equal to T. - T' is a string obtained by inser...
LiveCodeBench
1,100
1
Takahashi sent a string T consisting of lowercase English letters to Aoki. As a result, Aoki received a string T' consisting of lowercase English letters. T' may have been altered from T. Specifically, exactly one of the following four conditions is known to hold. - T' is equal to T. - T' is a string obtained by inser...
LiveCodeBench
1,100
2
Takahashi sent a string T consisting of lowercase English letters to Aoki. As a result, Aoki received a string T' consisting of lowercase English letters. T' may have been altered from T. Specifically, exactly one of the following four conditions is known to hold. - T' is equal to T. - T' is a string obtained by inser...
LiveCodeBench
1,100
3
You are given a string S of length N consisting of digits. Find the number of square numbers that can be obtained by interpreting a permutation of S as a decimal integer. More formally, solve the following. Let s _ i be the number corresponding to the i-th digit (1\leq i\leq N) from the beginning of S. Find the number ...
LiveCodeBench
1,101
1
You are given a string S of length N consisting of digits. Find the number of square numbers that can be obtained by interpreting a permutation of S as a decimal integer. More formally, solve the following. Let s _ i be the number corresponding to the i-th digit (1\leq i\leq N) from the beginning of S. Find the number ...
LiveCodeBench
1,101
2
You are given a string S of length N consisting of digits. Find the number of square numbers that can be obtained by interpreting a permutation of S as a decimal integer. More formally, solve the following. Let s _ i be the number corresponding to the i-th digit (1\leq i\leq N) from the beginning of S. Find the number ...
LiveCodeBench
1,101
3
You are given N strings S_1, S_2, \ldots, S_N consisting of lowercase English letters, and a string T consisting of lowercase English letters. There are N^2 pairs (i, j) of integers between 1 and N, inclusive. Print the number of pairs among them that satisfy the following condition. - The concatenation of S_i and S_j...
LiveCodeBench
1,102
1
You are given N strings S_1, S_2, \ldots, S_N consisting of lowercase English letters, and a string T consisting of lowercase English letters. There are N^2 pairs (i, j) of integers between 1 and N, inclusive. Print the number of pairs among them that satisfy the following condition. - The concatenation of S_i and S_j...
LiveCodeBench
1,102
2
You are given N strings S_1, S_2, \ldots, S_N consisting of lowercase English letters, and a string T consisting of lowercase English letters. There are N^2 pairs (i, j) of integers between 1 and N, inclusive. Print the number of pairs among them that satisfy the following condition. - The concatenation of S_i and S_j...
LiveCodeBench
1,102
3
There is a directed graph with N vertices and M edges. Each edge has two positive integer values: beauty and cost. For i = 1, 2, \ldots, M, the i-th edge is directed from vertex u_i to vertex v_i, with beauty b_i and cost c_i. Here, the constraints guarantee that u_i \lt v_i. Find the maximum value of the following fo...
LiveCodeBench
1,103
1
There is a directed graph with N vertices and M edges. Each edge has two positive integer values: beauty and cost. For i = 1, 2, \ldots, M, the i-th edge is directed from vertex u_i to vertex v_i, with beauty b_i and cost c_i. Here, the constraints guarantee that u_i \lt v_i. Find the maximum value of the following fo...
LiveCodeBench
1,103
2
There is a directed graph with N vertices and M edges. Each edge has two positive integer values: beauty and cost. For i = 1, 2, \ldots, M, the i-th edge is directed from vertex u_i to vertex v_i, with beauty b_i and cost c_i. Here, the constraints guarantee that u_i \lt v_i. Find the maximum value of the following fo...
LiveCodeBench
1,103
3
Keyence has a culture of addressing everyone with the honorific "san," regardless of their role, age, or position. Even a new employee would call the president "Nakata-san." [Translator's note: this is a bit unusual in Japan.] You are given a person's surname and first name as strings S and T, respectively. Print the ...
LiveCodeBench
1,104
1
Keyence has a culture of addressing everyone with the honorific "san," regardless of their role, age, or position. Even a new employee would call the president "Nakata-san." [Translator's note: this is a bit unusual in Japan.] You are given a person's surname and first name as strings S and T, respectively. Print the ...
LiveCodeBench
1,104
2
Keyence has a culture of addressing everyone with the honorific "san," regardless of their role, age, or position. Even a new employee would call the president "Nakata-san." [Translator's note: this is a bit unusual in Japan.] You are given a person's surname and first name as strings S and T, respectively. Print the ...
LiveCodeBench
1,104
3
Keyence has N bases worldwide, numbered 1 to N. Base i has W_i employees, and at 0 o'clock in Coordinated Universal Time (UTC), it is X_i o'clock at base i. You want to hold a one-hour meeting across the entire company. Each employee can only participate in the meeting if the meeting time is completely within the 9:0...
LiveCodeBench
1,105
1
Keyence has N bases worldwide, numbered 1 to N. Base i has W_i employees, and at 0 o'clock in Coordinated Universal Time (UTC), it is X_i o'clock at base i. You want to hold a one-hour meeting across the entire company. Each employee can only participate in the meeting if the meeting time is completely within the 9:0...
LiveCodeBench
1,105
2
Keyence has N bases worldwide, numbered 1 to N. Base i has W_i employees, and at 0 o'clock in Coordinated Universal Time (UTC), it is X_i o'clock at base i. You want to hold a one-hour meeting across the entire company. Each employee can only participate in the meeting if the meeting time is completely within the 9:0...
LiveCodeBench
1,105
3
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 from the top and the j-th column from the left. Whether each square contains a sensor is given by the strings S_1, S_2, \ldots, S_H, each of length W. (i, j) contains a sensor if and only if the j-th ...
LiveCodeBench
1,106
1
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 from the top and the j-th column from the left. Whether each square contains a sensor is given by the strings S_1, S_2, \ldots, S_H, each of length W. (i, j) contains a sensor if and only if the j-th ...
LiveCodeBench
1,106
2
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 from the top and the j-th column from the left. Whether each square contains a sensor is given by the strings S_1, S_2, \ldots, S_H, each of length W. (i, j) contains a sensor if and only if the j-th ...
LiveCodeBench
1,106
3
There are N products labeled 1 to N flowing on a conveyor belt. A Keyence printer is attached to the conveyor belt, and product i enters the range of the printer T_i microseconds from now and leaves it D_i microseconds later. The Keyence printer can instantly print on one product within the range of the printer (in pa...
LiveCodeBench
1,107
1
There are N products labeled 1 to N flowing on a conveyor belt. A Keyence printer is attached to the conveyor belt, and product i enters the range of the printer T_i microseconds from now and leaves it D_i microseconds later. The Keyence printer can instantly print on one product within the range of the printer (in pa...
LiveCodeBench
1,107
2
There are N products labeled 1 to N flowing on a conveyor belt. A Keyence printer is attached to the conveyor belt, and product i enters the range of the printer T_i microseconds from now and leaves it D_i microseconds later. The Keyence printer can instantly print on one product within the range of the printer (in pa...
LiveCodeBench
1,107
3
There are N cities in a certain country. You will travel from your office in city 1 to a destination in city N, via zero or more cities. Two types of transportation are available: company car and train. The time required to travel from city i to city j is as follows: - D_{i,j} \times A minutes by company car, and - D_...
LiveCodeBench
1,108
1
There are N cities in a certain country. You will travel from your office in city 1 to a destination in city N, via zero or more cities. Two types of transportation are available: company car and train. The time required to travel from city i to city j is as follows: - D_{i,j} \times A minutes by company car, and - D_...
LiveCodeBench
1,108
2
There are N cities in a certain country. You will travel from your office in city 1 to a destination in city N, via zero or more cities. Two types of transportation are available: company car and train. The time required to travel from city i to city j is as follows: - D_{i,j} \times A minutes by company car, and - D_...
LiveCodeBench
1,108
3
As the factory manager of Keyence, you want to monitor several sections on a conveyor belt. There are a total of N sections you want to monitor, and the length of the i-th section is D_i meters. There are two types of sensors to choose from, and below is some information about each sensor. - Type-j sensor (1\leq j \le...
LiveCodeBench
1,109
1
As the factory manager of Keyence, you want to monitor several sections on a conveyor belt. There are a total of N sections you want to monitor, and the length of the i-th section is D_i meters. There are two types of sensors to choose from, and below is some information about each sensor. - Type-j sensor (1\leq j \le...
LiveCodeBench
1,109
2
As the factory manager of Keyence, you want to monitor several sections on a conveyor belt. There are a total of N sections you want to monitor, and the length of the i-th section is D_i meters. There are two types of sensors to choose from, and below is some information about each sensor. - Type-j sensor (1\leq j \le...
LiveCodeBench
1,109
3
Takahashi is in a building with 100 floors. He uses the stairs for moving up two floors or less or moving down three floors or less, and uses the elevator otherwise. Does he use the stairs to move from floor X to floor Y? Input The input is given from Standard Input in the following format: X Y Output If Takahashi ...
LiveCodeBench
1,110
1
Takahashi is in a building with 100 floors. He uses the stairs for moving up two floors or less or moving down three floors or less, and uses the elevator otherwise. Does he use the stairs to move from floor X to floor Y? Input The input is given from Standard Input in the following format: X Y Output If Takahashi ...
LiveCodeBench
1,110
2
Takahashi is in a building with 100 floors. He uses the stairs for moving up two floors or less or moving down three floors or less, and uses the elevator otherwise. Does he use the stairs to move from floor X to floor Y? Input The input is given from Standard Input in the following format: X Y Output If Takahashi ...
LiveCodeBench
1,110
3
A 326-like number is a three-digit positive integer where the product of the hundreds and tens digits equals the ones digit. For example, 326,400,144 are 326-like numbers, while 623,777,429 are not. Given an integer N, find the smallest 326-like number greater than or equal to N. It always exists under the constraints....
LiveCodeBench
1,111
1
A 326-like number is a three-digit positive integer where the product of the hundreds and tens digits equals the ones digit. For example, 326,400,144 are 326-like numbers, while 623,777,429 are not. Given an integer N, find the smallest 326-like number greater than or equal to N. It always exists under the constraints....
LiveCodeBench
1,111
2
A 326-like number is a three-digit positive integer where the product of the hundreds and tens digits equals the ones digit. For example, 326,400,144 are 326-like numbers, while 623,777,429 are not. Given an integer N, find the smallest 326-like number greater than or equal to N. It always exists under the constraints....
LiveCodeBench
1,111
3
Takahashi has placed N gifts on a number line. The i-th gift is placed at coordinate A_i. You will choose a half-open interval [x,x+M) of length M on the number line and acquire all the gifts included in it. More specifically, you acquire gifts according to the following procedure. - First, choose one real number x. ...
LiveCodeBench
1,112
1
Takahashi has placed N gifts on a number line. The i-th gift is placed at coordinate A_i. You will choose a half-open interval [x,x+M) of length M on the number line and acquire all the gifts included in it. More specifically, you acquire gifts according to the following procedure. - First, choose one real number x. ...
LiveCodeBench
1,112
2
Takahashi has placed N gifts on a number line. The i-th gift is placed at coordinate A_i. You will choose a half-open interval [x,x+M) of length M on the number line and acquire all the gifts included in it. More specifically, you acquire gifts according to the following procedure. - First, choose one real number x. ...
LiveCodeBench
1,112
3
You are given an integer N and strings R and C of length N consisting of A, B, and C. Solve the following problem. There is a N \times N grid. All cells are initially empty. You can write at most one character from A, B, and C in each cell. (You can also leave the cell empty.) Determine if it is possible to satisfy al...
LiveCodeBench
1,113
1
You are given an integer N and strings R and C of length N consisting of A, B, and C. Solve the following problem. There is a N \times N grid. All cells are initially empty. You can write at most one character from A, B, and C in each cell. (You can also leave the cell empty.) Determine if it is possible to satisfy al...
LiveCodeBench
1,113
2
You are given an integer N and strings R and C of length N consisting of A, B, and C. Solve the following problem. There is a N \times N grid. All cells are initially empty. You can write at most one character from A, B, and C in each cell. (You can also leave the cell empty.) Determine if it is possible to satisfy al...
LiveCodeBench
1,113
3
Aoki, an employee at AtCoder Inc., has his salary for this month determined by an integer N and a sequence A of length N as follows. First, he is given an N-sided die (dice) that shows the integers from 1 to N with equal probability, and a variable x=0. Then, the following steps are repeated until terminated. - Roll ...
LiveCodeBench
1,114
1
Aoki, an employee at AtCoder Inc., has his salary for this month determined by an integer N and a sequence A of length N as follows. First, he is given an N-sided die (dice) that shows the integers from 1 to N with equal probability, and a variable x=0. Then, the following steps are repeated until terminated. - Roll ...
LiveCodeBench
1,114
2
Aoki, an employee at AtCoder Inc., has his salary for this month determined by an integer N and a sequence A of length N as follows. First, he is given an N-sided die (dice) that shows the integers from 1 to N with equal probability, and a variable x=0. Then, the following steps are repeated until terminated. - Roll ...
LiveCodeBench
1,114
3
You are given a string S of length N consisting of lowercase English letters. If there are any adjacent occurrences of a and b in S, print Yes; otherwise, print No. (The order of a and b does not matter.) Input The input is given from Standard Input in the following format: N S Output If there are any adjacent oc...
LiveCodeBench
1,115
1
You are given a string S of length N consisting of lowercase English letters. If there are any adjacent occurrences of a and b in S, print Yes; otherwise, print No. (The order of a and b does not matter.) Input The input is given from Standard Input in the following format: N S Output If there are any adjacent oc...
LiveCodeBench
1,115
2
You are given a string S of length N consisting of lowercase English letters. If there are any adjacent occurrences of a and b in S, print Yes; otherwise, print No. (The order of a and b does not matter.) Input The input is given from Standard Input in the following format: N S Output If there are any adjacent oc...
LiveCodeBench
1,115
3
You are given an integer B. If there exists a positive integer A such that A^A = B, print its value; otherwise, output -1. Input The input is given from Standard Input in the following format: B Output If there exists a positive integer A such that A^A = B, print its value; otherwise, print -1. If there are multipl...
LiveCodeBench
1,116
1
You are given an integer B. If there exists a positive integer A such that A^A = B, print its value; otherwise, output -1. Input The input is given from Standard Input in the following format: B Output If there exists a positive integer A such that A^A = B, print its value; otherwise, print -1. If there are multipl...
LiveCodeBench
1,116
2
You are given an integer B. If there exists a positive integer A such that A^A = B, print its value; otherwise, output -1. Input The input is given from Standard Input in the following format: B Output If there exists a positive integer A such that A^A = B, print its value; otherwise, print -1. If there are multipl...
LiveCodeBench
1,116
3
There is a 9\times 9 grid A, where each cell contains an integer between 1 and 9, inclusive. Specifically, the cell at the i-th row from the top and j-th column from the left contains A_{i,j}. If A satisfies all of the following conditions, print Yes. Otherwise, print No. - For each row of A, the nine cells in that ro...
LiveCodeBench
1,117
1
There is a 9\times 9 grid A, where each cell contains an integer between 1 and 9, inclusive. Specifically, the cell at the i-th row from the top and j-th column from the left contains A_{i,j}. If A satisfies all of the following conditions, print Yes. Otherwise, print No. - For each row of A, the nine cells in that ro...
LiveCodeBench
1,117
2
There is a 9\times 9 grid A, where each cell contains an integer between 1 and 9, inclusive. Specifically, the cell at the i-th row from the top and j-th column from the left contains A_{i,j}. If A satisfies all of the following conditions, print Yes. Otherwise, print No. - For each row of A, the nine cells in that ro...
LiveCodeBench
1,117
3
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_2, \dots, T_M)), is said to be a good pair of sequences when (S, T) satisfies the following condition. - There exists a sequence X = (X_1, X_2, \dots, X_N) of length N consisting of 0 and 1 that satisfi...
LiveCodeBench
1,118
1
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_2, \dots, T_M)), is said to be a good pair of sequences when (S, T) satisfies the following condition. - There exists a sequence X = (X_1, X_2, \dots, X_N) of length N consisting of 0 and 1 that satisfi...
LiveCodeBench
1,118
2
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_2, \dots, T_M)), is said to be a good pair of sequences when (S, T) satisfies the following condition. - There exists a sequence X = (X_1, X_2, \dots, X_N) of length N consisting of 0 and 1 that satisfi...
LiveCodeBench
1,118
3
Takahashi participated in N contests and earned a performance P_i in the i-th contest. He wants to choose some (at least one) contests from these and maximize his rating calculated from the results of those contests. Find the maximum possible rating he can achieve by optimally choosing the contests. Here, Takahashi's r...
LiveCodeBench
1,119
1
Takahashi participated in N contests and earned a performance P_i in the i-th contest. He wants to choose some (at least one) contests from these and maximize his rating calculated from the results of those contests. Find the maximum possible rating he can achieve by optimally choosing the contests. Here, Takahashi's r...
LiveCodeBench
1,119
2
Takahashi participated in N contests and earned a performance P_i in the i-th contest. He wants to choose some (at least one) contests from these and maximize his rating calculated from the results of those contests. Find the maximum possible rating he can achieve by optimally choosing the contests. Here, Takahashi's r...
LiveCodeBench
1,119
3
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. Print the total score for all problems with a score of X or less. Input The input is given from Standard Input in the following format: N X S_1 S_2 \ldots S_N Output Print the answer. Constraints ...
LiveCodeBench
1,120
1
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. Print the total score for all problems with a score of X or less. Input The input is given from Standard Input in the following format: N X S_1 S_2 \ldots S_N Output Print the answer. Constraints ...
LiveCodeBench
1,120
2
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. Print the total score for all problems with a score of X or less. Input The input is given from Standard Input in the following format: N X S_1 S_2 \ldots S_N Output Print the answer. Constraints ...
LiveCodeBench
1,120
3
AtCoder Kingdom uses a calendar whose year has N months. Month i (1\leq i\leq N) has D _ i days, from day 1 of month i to day D _ i of month i. How many days in a year of AtCoder have "repdigits" dates? Here, day j of month i (1\leq i\leq N,1\leq j\leq D _ i) is said to have a repdigit date if and only if all digits in...
LiveCodeBench
1,121
1
AtCoder Kingdom uses a calendar whose year has N months. Month i (1\leq i\leq N) has D _ i days, from day 1 of month i to day D _ i of month i. How many days in a year of AtCoder have "repdigits" dates? Here, day j of month i (1\leq i\leq N,1\leq j\leq D _ i) is said to have a repdigit date if and only if all digits in...
LiveCodeBench
1,121
2
AtCoder Kingdom uses a calendar whose year has N months. Month i (1\leq i\leq N) has D _ i days, from day 1 of month i to day D _ i of month i. How many days in a year of AtCoder have "repdigits" dates? Here, day j of month i (1\leq i\leq N,1\leq j\leq D _ i) is said to have a repdigit date if and only if all digits in...
LiveCodeBench
1,121
3
You are given a string S = S_1S_2\ldots S_N of length N consisting of lowercase English letters. Additionally, you are given Q queries about the string S. For i = 1, 2, \ldots, Q, the i-th query is represented by two integers l_i, r_i and asks the following. In the substring S_{l_i}S_{l_i+1}\ldots S_{r_i} of S, which...
LiveCodeBench
1,122
1
You are given a string S = S_1S_2\ldots S_N of length N consisting of lowercase English letters. Additionally, you are given Q queries about the string S. For i = 1, 2, \ldots, Q, the i-th query is represented by two integers l_i, r_i and asks the following. In the substring S_{l_i}S_{l_i+1}\ldots S_{r_i} of S, which...
LiveCodeBench
1,122
2
You are given a string S = S_1S_2\ldots S_N of length N consisting of lowercase English letters. Additionally, you are given Q queries about the string S. For i = 1, 2, \ldots, Q, the i-th query is represented by two integers l_i, r_i and asks the following. In the substring S_{l_i}S_{l_i+1}\ldots S_{r_i} of S, which...
LiveCodeBench
1,122
3
You are given a string S consisting of three different characters: A, B, and C. As long as S contains the string ABC as a consecutive substring, repeat the following operation: Remove the leftmost occurrence of the substring ABC from S. Print the final string S after performing the above procedure. Input The input ...
LiveCodeBench
1,123
1
You are given a string S consisting of three different characters: A, B, and C. As long as S contains the string ABC as a consecutive substring, repeat the following operation: Remove the leftmost occurrence of the substring ABC from S. Print the final string S after performing the above procedure. Input The input ...
LiveCodeBench
1,123
2
You are given a string S consisting of three different characters: A, B, and C. As long as S contains the string ABC as a consecutive substring, repeat the following operation: Remove the leftmost occurrence of the substring ABC from S. Print the final string S after performing the above procedure. Input The input ...
LiveCodeBench
1,123
3
You are given a weighted simple connected undirected graph with N vertices and M edges, where vertices are numbered 1 to N, and edges are numbered 1 to M. Additionally, a positive integer K is given. Edge i\ (1\leq i\leq M) connects vertices u_i and v_i and has a weight of w_i. For a spanning tree T of this graph, the ...
LiveCodeBench
1,124
1
You are given a weighted simple connected undirected graph with N vertices and M edges, where vertices are numbered 1 to N, and edges are numbered 1 to M. Additionally, a positive integer K is given. Edge i\ (1\leq i\leq M) connects vertices u_i and v_i and has a weight of w_i. For a spanning tree T of this graph, the ...
LiveCodeBench
1,124
2
You are given a weighted simple connected undirected graph with N vertices and M edges, where vertices are numbered 1 to N, and edges are numbered 1 to M. Additionally, a positive integer K is given. Edge i\ (1\leq i\leq M) connects vertices u_i and v_i and has a weight of w_i. For a spanning tree T of this graph, the ...
LiveCodeBench
1,124
3
You are given a string S consisting of uppercase English letters. Separate each character of S with a space and print them one by one in order. Input The input is given from Standard Input in the following format: S Output Separate each character of S with a space and print them one by one. Constraints - S is a ...
LiveCodeBench
1,125
1
You are given a string S consisting of uppercase English letters. Separate each character of S with a space and print them one by one in order. Input The input is given from Standard Input in the following format: S Output Separate each character of S with a space and print them one by one. Constraints - S is a ...
LiveCodeBench
1,125
2
You are given a string S consisting of uppercase English letters. Separate each character of S with a space and print them one by one in order. Input The input is given from Standard Input in the following format: S Output Separate each character of S with a space and print them one by one. Constraints - S is a ...
LiveCodeBench
1,125
3
You are given N integers A_1, A_2, \ldots, A_N. Find the largest among those integers that are not the largest. The constraints of this problem guarantee that the answer exists. Input The input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N Output Print the answer. Constraints - 2 \l...
LiveCodeBench
1,126
1
You are given N integers A_1, A_2, \ldots, A_N. Find the largest among those integers that are not the largest. The constraints of this problem guarantee that the answer exists. Input The input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N Output Print the answer. Constraints - 2 \l...
LiveCodeBench
1,126
2
You are given N integers A_1, A_2, \ldots, A_N. Find the largest among those integers that are not the largest. The constraints of this problem guarantee that the answer exists. Input The input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N Output Print the answer. Constraints - 2 \l...
LiveCodeBench
1,126
3
You are given a string S of length N consisting of lowercase English letters. Find the number of non-empty substrings of S that are repetitions of one character. Here, two substrings that are equal as strings are not distinguished even if they are obtained differently. A non-empty substring of S is a string of length a...
LiveCodeBench
1,127
1
You are given a string S of length N consisting of lowercase English letters. Find the number of non-empty substrings of S that are repetitions of one character. Here, two substrings that are equal as strings are not distinguished even if they are obtained differently. A non-empty substring of S is a string of length a...
LiveCodeBench
1,127
2
You are given a string S of length N consisting of lowercase English letters. Find the number of non-empty substrings of S that are repetitions of one character. Here, two substrings that are equal as strings are not distinguished even if they are obtained differently. A non-empty substring of S is a string of length a...
LiveCodeBench
1,127
3
There is an election to choose one winner from N candidates with candidate numbers 1, 2, \ldots, N, and there have been M votes cast. Each vote is for exactly one candidate, with the i-th vote being for candidate A_i. The votes will be counted in order from first to last, and after each vote is counted, the current win...
LiveCodeBench
1,128
1
There is an election to choose one winner from N candidates with candidate numbers 1, 2, \ldots, N, and there have been M votes cast. Each vote is for exactly one candidate, with the i-th vote being for candidate A_i. The votes will be counted in order from first to last, and after each vote is counted, the current win...
LiveCodeBench
1,128
2
There is an election to choose one winner from N candidates with candidate numbers 1, 2, \ldots, N, and there have been M votes cast. Each vote is for exactly one candidate, with the i-th vote being for candidate A_i. The votes will be counted in order from first to last, and after each vote is counted, the current win...
LiveCodeBench
1,128
3
You are given two strings: S, which consists of uppercase English letters and has length N, and T, which also consists of uppercase English letters and has length M\ (\leq N). There is a string X of length N consisting only of the character #. Determine whether it is possible to make X match S by performing the followi...
LiveCodeBench
1,129
1
You are given two strings: S, which consists of uppercase English letters and has length N, and T, which also consists of uppercase English letters and has length M\ (\leq N). There is a string X of length N consisting only of the character #. Determine whether it is possible to make X match S by performing the followi...
LiveCodeBench
1,129
2
You are given two strings: S, which consists of uppercase English letters and has length N, and T, which also consists of uppercase English letters and has length M\ (\leq N). There is a string X of length N consisting only of the character #. Determine whether it is possible to make X match S by performing the followi...
LiveCodeBench
1,129
3
There are N boxes numbered 1, 2, \ldots, N. Initially, box i contains one ball of color C_i. You are given Q queries, which you should process in order. Each query is given by a pair of integers (a,b) and asks you to do the following: - Move all the balls from box a to box b, and then print the number of different col...
LiveCodeBench
1,130
1
There are N boxes numbered 1, 2, \ldots, N. Initially, box i contains one ball of color C_i. You are given Q queries, which you should process in order. Each query is given by a pair of integers (a,b) and asks you to do the following: - Move all the balls from box a to box b, and then print the number of different col...
LiveCodeBench
1,130
2
There are N boxes numbered 1, 2, \ldots, N. Initially, box i contains one ball of color C_i. You are given Q queries, which you should process in order. Each query is given by a pair of integers (a,b) and asks you to do the following: - Move all the balls from box a to box b, and then print the number of different col...
LiveCodeBench
1,130
3
N people labeled 1,2,\dots,N took an exam, and person i scored A_i points. Only those who scored at least L points pass this exam. Determine how many people out of the N have passed the exam. Input The input is given from Standard Input in the following format: N L A_1 A_2 \dots A_N Output Print the answer as an...
LiveCodeBench
1,131
1
N people labeled 1,2,\dots,N took an exam, and person i scored A_i points. Only those who scored at least L points pass this exam. Determine how many people out of the N have passed the exam. Input The input is given from Standard Input in the following format: N L A_1 A_2 \dots A_N Output Print the answer as an...
LiveCodeBench
1,131
2
N people labeled 1,2,\dots,N took an exam, and person i scored A_i points. Only those who scored at least L points pass this exam. Determine how many people out of the N have passed the exam. Input The input is given from Standard Input in the following format: N L A_1 A_2 \dots A_N Output Print the answer as an...
LiveCodeBench
1,131
3
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. For each i=1,2,\ldots,N, find the integer X_i that satisfies both of the following conditions. Note that the integer to be found is always uniquely determined. - L\leq X_i \leq R. - For every integer Y such tha...
LiveCodeBench
1,132
1
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. For each i=1,2,\ldots,N, find the integer X_i that satisfies both of the following conditions. Note that the integer to be found is always uniquely determined. - L\leq X_i \leq R. - For every integer Y such tha...
LiveCodeBench
1,132
2
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. For each i=1,2,\ldots,N, find the integer X_i that satisfies both of the following conditions. Note that the integer to be found is always uniquely determined. - L\leq X_i \leq R. - For every integer Y such tha...
LiveCodeBench
1,132
3