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 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 from the left. Each cell contains one of the characters o, x, and .. The characters written in each cell are represented by H strings S_1, S_2, \ldots, S_H of length W; the character written in cell (i...
LiveCodeBench
1,166
2
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 from the left. Each cell contains one of the characters o, x, and .. The characters written in each cell are represented by H strings S_1, S_2, \ldots, S_H of length W; the character written in cell (i...
LiveCodeBench
1,166
3
This is an interactive problem (a type of problem where your program interacts with the judge program through Standard Input and Output). There are N bottles of juice, numbered 1 to N. It has been discovered that exactly one of these bottles has gone bad. Even a small sip of the spoiled juice will cause stomach upset t...
LiveCodeBench
1,167
1
This is an interactive problem (a type of problem where your program interacts with the judge program through Standard Input and Output). There are N bottles of juice, numbered 1 to N. It has been discovered that exactly one of these bottles has gone bad. Even a small sip of the spoiled juice will cause stomach upset t...
LiveCodeBench
1,167
2
This is an interactive problem (a type of problem where your program interacts with the judge program through Standard Input and Output). There are N bottles of juice, numbered 1 to N. It has been discovered that exactly one of these bottles has gone bad. Even a small sip of the spoiled juice will cause stomach upset t...
LiveCodeBench
1,167
3
You are given a non-empty string S consisting of uppercase and lowercase English letters. Determine whether the following condition is satisfied: - The first character of S is uppercase, and all other characters are lowercase. Input The input is given from Standard Input in the following format: S Output If the co...
LiveCodeBench
1,168
1
You are given a non-empty string S consisting of uppercase and lowercase English letters. Determine whether the following condition is satisfied: - The first character of S is uppercase, and all other characters are lowercase. Input The input is given from Standard Input in the following format: S Output If the co...
LiveCodeBench
1,168
2
You are given a non-empty string S consisting of uppercase and lowercase English letters. Determine whether the following condition is satisfied: - The first character of S is uppercase, and all other characters are lowercase. Input The input is given from Standard Input in the following format: S Output If the co...
LiveCodeBench
1,168
3
You are given a string S consisting of lowercase English letters. Find the character that appears most frequently in S. If multiple such characters exist, report the one that comes earliest in alphabetical order. Input The input is given from Standard Input in the following format: S Output Among the characters tha...
LiveCodeBench
1,169
1
You are given a string S consisting of lowercase English letters. Find the character that appears most frequently in S. If multiple such characters exist, report the one that comes earliest in alphabetical order. Input The input is given from Standard Input in the following format: S Output Among the characters tha...
LiveCodeBench
1,169
2
You are given a string S consisting of lowercase English letters. Find the character that appears most frequently in S. If multiple such characters exist, report the one that comes earliest in alphabetical order. Input The input is given from Standard Input in the following format: S Output Among the characters tha...
LiveCodeBench
1,169
3
Your refrigerator has N kinds of ingredients. Let us call them ingredient 1, \dots, ingredient N. You have Q_i grams of ingredient i. You can make two types of dishes. To make one serving of dish A, you need A_i grams of each ingredient i (1 \leq i \leq N). To make one serving of dish B, you need B_i grams of each ingr...
LiveCodeBench
1,170
1
Your refrigerator has N kinds of ingredients. Let us call them ingredient 1, \dots, ingredient N. You have Q_i grams of ingredient i. You can make two types of dishes. To make one serving of dish A, you need A_i grams of each ingredient i (1 \leq i \leq N). To make one serving of dish B, you need B_i grams of each ingr...
LiveCodeBench
1,170
2
Your refrigerator has N kinds of ingredients. Let us call them ingredient 1, \dots, ingredient N. You have Q_i grams of ingredient i. You can make two types of dishes. To make one serving of dish A, you need A_i grams of each ingredient i (1 \leq i \leq N). To make one serving of dish B, you need B_i grams of each ingr...
LiveCodeBench
1,170
3
The AtCoder Archipelago consists of N islands connected by N bridges. The islands are numbered from 1 to N, and the i-th bridge (1\leq i\leq N-1) connects islands i and i+1 bidirectionally, while the N-th bridge connects islands N and 1 bidirectionally. There is no way to travel between islands other than crossing the ...
LiveCodeBench
1,171
1
The AtCoder Archipelago consists of N islands connected by N bridges. The islands are numbered from 1 to N, and the i-th bridge (1\leq i\leq N-1) connects islands i and i+1 bidirectionally, while the N-th bridge connects islands N and 1 bidirectionally. There is no way to travel between islands other than crossing the ...
LiveCodeBench
1,171
2
The AtCoder Archipelago consists of N islands connected by N bridges. The islands are numbered from 1 to N, and the i-th bridge (1\leq i\leq N-1) connects islands i and i+1 bidirectionally, while the N-th bridge connects islands N and 1 bidirectionally. There is no way to travel between islands other than crossing the ...
LiveCodeBench
1,171
3
There are 2N points placed at equal intervals on a circle, numbered 1 to 2N in a clockwise direction starting from a certain point. There are also N chords on the circle, with the i-th chord connecting points A_i and B_i. It is guaranteed that all the values A_1,\dots,A_N,B_1,\dots,B_N are distinct. Determine whether t...
LiveCodeBench
1,172
1
There are 2N points placed at equal intervals on a circle, numbered 1 to 2N in a clockwise direction starting from a certain point. There are also N chords on the circle, with the i-th chord connecting points A_i and B_i. It is guaranteed that all the values A_1,\dots,A_N,B_1,\dots,B_N are distinct. Determine whether t...
LiveCodeBench
1,172
2
There are 2N points placed at equal intervals on a circle, numbered 1 to 2N in a clockwise direction starting from a certain point. There are also N chords on the circle, with the i-th chord connecting points A_i and B_i. It is guaranteed that all the values A_1,\dots,A_N,B_1,\dots,B_N are distinct. Determine whether t...
LiveCodeBench
1,172
3
There is a weighted simple directed graph with N vertices and M edges. The vertices are numbered 1 to N, and the i-th edge has a weight of W_i and extends from vertex U_i to vertex V_i. The weights can be negative, but the graph does not contain negative cycles. Determine whether there is a walk that visits each vert...
LiveCodeBench
1,173
1
There is a weighted simple directed graph with N vertices and M edges. The vertices are numbered 1 to N, and the i-th edge has a weight of W_i and extends from vertex U_i to vertex V_i. The weights can be negative, but the graph does not contain negative cycles. Determine whether there is a walk that visits each vert...
LiveCodeBench
1,173
2
There is a weighted simple directed graph with N vertices and M edges. The vertices are numbered 1 to N, and the i-th edge has a weight of W_i and extends from vertex U_i to vertex V_i. The weights can be negative, but the graph does not contain negative cycles. Determine whether there is a walk that visits each vert...
LiveCodeBench
1,173
3
You are given a string S consisting of lowercase English letters and the character .. Print the last substring when S is split by .s. In other words, print the longest suffix of S that does not contain .. Input The input is given from Standard Input in the following format: S Output Print the answer. Constraints...
LiveCodeBench
1,174
1
You are given a string S consisting of lowercase English letters and the character .. Print the last substring when S is split by .s. In other words, print the longest suffix of S that does not contain .. Input The input is given from Standard Input in the following format: S Output Print the answer. Constraints...
LiveCodeBench
1,174
2
You are given a string S consisting of lowercase English letters and the character .. Print the last substring when S is split by .s. In other words, print the longest suffix of S that does not contain .. Input The input is given from Standard Input in the following format: S Output Print the answer. Constraints...
LiveCodeBench
1,174
3
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-th row from the top and the j-th column from the left. This grid is considered to be toroidal. That is, (i, 1) is to the right of (i, W) for each 1 \leq i \leq H, and (1, j) is below (H, j) for each 1 ...
LiveCodeBench
1,175
1
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-th row from the top and the j-th column from the left. This grid is considered to be toroidal. That is, (i, 1) is to the right of (i, W) for each 1 \leq i \leq H, and (1, j) is below (H, j) for each 1 ...
LiveCodeBench
1,175
2
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-th row from the top and the j-th column from the left. This grid is considered to be toroidal. That is, (i, 1) is to the right of (i, W) for each 1 \leq i \leq H, and (1, j) is below (H, j) for each 1 ...
LiveCodeBench
1,175
3
A bus is in operation. The number of passengers on the bus is always a non-negative integer. At some point in time, the bus had zero or more passengers, and it has stopped N times since then. At the i-th stop, the number of passengers increased by A_i. Here, A_i can be negative, meaning the number of passengers decreas...
LiveCodeBench
1,176
1
A bus is in operation. The number of passengers on the bus is always a non-negative integer. At some point in time, the bus had zero or more passengers, and it has stopped N times since then. At the i-th stop, the number of passengers increased by A_i. Here, A_i can be negative, meaning the number of passengers decreas...
LiveCodeBench
1,176
2
A bus is in operation. The number of passengers on the bus is always a non-negative integer. At some point in time, the bus had zero or more passengers, and it has stopped N times since then. At the i-th stop, the number of passengers increased by A_i. Here, A_i can be negative, meaning the number of passengers decreas...
LiveCodeBench
1,176
3
There is an N \times N grid, where each cell is either empty or contains an obstacle. Let (i, j) denote the cell at the i-th row from the top and the j-th column from the left. There are also two players on distinct empty cells of the grid. The information about each cell is given as N strings S_1, S_2, \ldots, S_N of ...
LiveCodeBench
1,177
1
There is an N \times N grid, where each cell is either empty or contains an obstacle. Let (i, j) denote the cell at the i-th row from the top and the j-th column from the left. There are also two players on distinct empty cells of the grid. The information about each cell is given as N strings S_1, S_2, \ldots, S_N of ...
LiveCodeBench
1,177
2
There is an N \times N grid, where each cell is either empty or contains an obstacle. Let (i, j) denote the cell at the i-th row from the top and the j-th column from the left. There are also two players on distinct empty cells of the grid. The information about each cell is given as N strings S_1, S_2, \ldots, S_N of ...
LiveCodeBench
1,177
3
Print an arithmetic sequence with first term A, last term B, and common difference D. You are only given inputs for which such an arithmetic sequence exists. Input The input is given from Standard Input in the following format: A B D Output Print the terms of the arithmetic sequence with first term A, last term B, ...
LiveCodeBench
1,178
1
Print an arithmetic sequence with first term A, last term B, and common difference D. You are only given inputs for which such an arithmetic sequence exists. Input The input is given from Standard Input in the following format: A B D Output Print the terms of the arithmetic sequence with first term A, last term B, ...
LiveCodeBench
1,178
2
Print an arithmetic sequence with first term A, last term B, and common difference D. You are only given inputs for which such an arithmetic sequence exists. Input The input is given from Standard Input in the following format: A B D Output Print the terms of the arithmetic sequence with first term A, last term B, ...
LiveCodeBench
1,178
3
You have an empty sequence A. There are Q queries given, and you need to process them in the order they are given. The queries are of the following two types: - 1 x: Append x to the end of A. - 2 k: Find the k-th value from the end of A. It is guaranteed that the length of A is at least k when this query is given. In...
LiveCodeBench
1,179
1
You have an empty sequence A. There are Q queries given, and you need to process them in the order they are given. The queries are of the following two types: - 1 x: Append x to the end of A. - 2 k: Find the k-th value from the end of A. It is guaranteed that the length of A is at least k when this query is given. In...
LiveCodeBench
1,179
2
You have an empty sequence A. There are Q queries given, and you need to process them in the order they are given. The queries are of the following two types: - 1 x: Append x to the end of A. - 2 k: Find the k-th value from the end of A. It is guaranteed that the length of A is at least k when this query is given. In...
LiveCodeBench
1,179
3
There is a single integer N written on a blackboard. Takahashi will repeat the following series of operations until all integers not less than 2 are removed from the blackboard: - Choose one integer x not less than 2 written on the blackboard. - Erase one occurrence of x from the blackboard. Then, write two new integ...
LiveCodeBench
1,180
1
There is a single integer N written on a blackboard. Takahashi will repeat the following series of operations until all integers not less than 2 are removed from the blackboard: - Choose one integer x not less than 2 written on the blackboard. - Erase one occurrence of x from the blackboard. Then, write two new integ...
LiveCodeBench
1,180
2
There is a single integer N written on a blackboard. Takahashi will repeat the following series of operations until all integers not less than 2 are removed from the blackboard: - Choose one integer x not less than 2 written on the blackboard. - Erase one occurrence of x from the blackboard. Then, write two new integ...
LiveCodeBench
1,180
3
Takahashi is playing a game. The game consists of N stages numbered 1,2,\ldots,N. Initially, only stage 1 can be played. For each stage i ( 1\leq i \leq N-1 ) that can be played, you can perform one of the following two actions at stage i: - Spend A_i seconds to clear stage i. This allows you to play stage i+1. - Spen...
LiveCodeBench
1,181
1
Takahashi is playing a game. The game consists of N stages numbered 1,2,\ldots,N. Initially, only stage 1 can be played. For each stage i ( 1\leq i \leq N-1 ) that can be played, you can perform one of the following two actions at stage i: - Spend A_i seconds to clear stage i. This allows you to play stage i+1. - Spen...
LiveCodeBench
1,181
2
Takahashi is playing a game. The game consists of N stages numbered 1,2,\ldots,N. Initially, only stage 1 can be played. For each stage i ( 1\leq i \leq N-1 ) that can be played, you can perform one of the following two actions at stage i: - Spend A_i seconds to clear stage i. This allows you to play stage i+1. - Spen...
LiveCodeBench
1,181
3
There are N boxes numbered 0 to N-1. Initially, box i contains A_i balls. Takahashi will perform the following operations for i=1,2,\ldots,M in order: - Set a variable C to 0. - Take out all the balls from box B_i and hold them in hand. - While holding at least one ball in hand, repeat the following process: - Increas...
LiveCodeBench
1,182
1
There are N boxes numbered 0 to N-1. Initially, box i contains A_i balls. Takahashi will perform the following operations for i=1,2,\ldots,M in order: - Set a variable C to 0. - Take out all the balls from box B_i and hold them in hand. - While holding at least one ball in hand, repeat the following process: - Increas...
LiveCodeBench
1,182
2
There are N boxes numbered 0 to N-1. Initially, box i contains A_i balls. Takahashi will perform the following operations for i=1,2,\ldots,M in order: - Set a variable C to 0. - Take out all the balls from box B_i and hold them in hand. - While holding at least one ball in hand, repeat the following process: - Increas...
LiveCodeBench
1,182
3
Given a positive integer N, print a string of N zeros and N+1 ones where 0 and 1 alternate. Input The input is given from Standard Input in the following format: N Output Print the answer. Constraints - N is an integer. - 1 \leq N \leq 100 Sample Input 1 4 Sample Output 1 101010101 A string of four zeros a...
LiveCodeBench
1,183
1
Given a positive integer N, print a string of N zeros and N+1 ones where 0 and 1 alternate. Input The input is given from Standard Input in the following format: N Output Print the answer. Constraints - N is an integer. - 1 \leq N \leq 100 Sample Input 1 4 Sample Output 1 101010101 A string of four zeros a...
LiveCodeBench
1,183
2
Given a positive integer N, print a string of N zeros and N+1 ones where 0 and 1 alternate. Input The input is given from Standard Input in the following format: N Output Print the answer. Constraints - N is an integer. - 1 \leq N \leq 100 Sample Input 1 4 Sample Output 1 101010101 A string of four zeros a...
LiveCodeBench
1,183
3
There are N countries numbered 1 to N. For each i = 1, 2, \ldots, N, Takahashi has A_i units of the currency of country i. Takahashi can repeat the following operation any number of times, possibly zero: - First, choose an integer i between 1 and N-1, inclusive. - Then, if Takahashi has at least S_i units of the curre...
LiveCodeBench
1,184
1
There are N countries numbered 1 to N. For each i = 1, 2, \ldots, N, Takahashi has A_i units of the currency of country i. Takahashi can repeat the following operation any number of times, possibly zero: - First, choose an integer i between 1 and N-1, inclusive. - Then, if Takahashi has at least S_i units of the curre...
LiveCodeBench
1,184
2
There are N countries numbered 1 to N. For each i = 1, 2, \ldots, N, Takahashi has A_i units of the currency of country i. Takahashi can repeat the following operation any number of times, possibly zero: - First, choose an integer i between 1 and N-1, inclusive. - Then, if Takahashi has at least S_i units of the curre...
LiveCodeBench
1,184
3
There is a grid with H rows and W columns. Each cell of the grid is land or sea, which is represented by H strings S_1, S_2, \ldots, S_H of length W. Let (i, j) denote the cell at the i-th row from the top and j-th column from the left, and (i, j) is land if the j-th character of S_i is ., and (i, j) is sea if the char...
LiveCodeBench
1,185
1
There is a grid with H rows and W columns. Each cell of the grid is land or sea, which is represented by H strings S_1, S_2, \ldots, S_H of length W. Let (i, j) denote the cell at the i-th row from the top and j-th column from the left, and (i, j) is land if the j-th character of S_i is ., and (i, j) is sea if the char...
LiveCodeBench
1,185
2
There is a grid with H rows and W columns. Each cell of the grid is land or sea, which is represented by H strings S_1, S_2, \ldots, S_H of length W. Let (i, j) denote the cell at the i-th row from the top and j-th column from the left, and (i, j) is land if the j-th character of S_i is ., and (i, j) is sea if the char...
LiveCodeBench
1,185
3
You are given three positive integers N, M, and K. Here, N and M are different. Print the K-th smallest positive integer divisible by exactly one of N and M. Input The input is given from Standard Input in the following format: N M K Output Print the K-th smallest positive integer divisible by exactly one of N and ...
LiveCodeBench
1,186
1
You are given three positive integers N, M, and K. Here, N and M are different. Print the K-th smallest positive integer divisible by exactly one of N and M. Input The input is given from Standard Input in the following format: N M K Output Print the K-th smallest positive integer divisible by exactly one of N and ...
LiveCodeBench
1,186
2
You are given three positive integers N, M, and K. Here, N and M are different. Print the K-th smallest positive integer divisible by exactly one of N and M. Input The input is given from Standard Input in the following format: N M K Output Print the K-th smallest positive integer divisible by exactly one of N and ...
LiveCodeBench
1,186
3
A string consisting of 0 and 1 is called a good string if two consecutive characters in the string are always different. You are given a string S of length N consisting of 0 and 1. Q queries will be given and must be processed in order. There are two types of queries: - 1 L R: Flip each of the L-th to R-th characters ...
LiveCodeBench
1,187
1
A string consisting of 0 and 1 is called a good string if two consecutive characters in the string are always different. You are given a string S of length N consisting of 0 and 1. Q queries will be given and must be processed in order. There are two types of queries: - 1 L R: Flip each of the L-th to R-th characters ...
LiveCodeBench
1,187
2
A string consisting of 0 and 1 is called a good string if two consecutive characters in the string are always different. You are given a string S of length N consisting of 0 and 1. Q queries will be given and must be processed in order. There are two types of queries: - 1 L R: Flip each of the L-th to R-th characters ...
LiveCodeBench
1,187
3
You are given a simple undirected graph consisting of N vertices and M edges. For i = 1, 2, \ldots, M, the i-th edge connects vertices u_i and v_i. Also, for i = 1, 2, \ldots, N, vertex i is assigned a positive integer W_i, and there are A_i pieces placed on it. As long as there are pieces on the graph, repeat the foll...
LiveCodeBench
1,188
1
You are given a simple undirected graph consisting of N vertices and M edges. For i = 1, 2, \ldots, M, the i-th edge connects vertices u_i and v_i. Also, for i = 1, 2, \ldots, N, vertex i is assigned a positive integer W_i, and there are A_i pieces placed on it. As long as there are pieces on the graph, repeat the foll...
LiveCodeBench
1,188
2
You are given a simple undirected graph consisting of N vertices and M edges. For i = 1, 2, \ldots, M, the i-th edge connects vertices u_i and v_i. Also, for i = 1, 2, \ldots, N, vertex i is assigned a positive integer W_i, and there are A_i pieces placed on it. As long as there are pieces on the graph, repeat the foll...
LiveCodeBench
1,188
3
You are given a string S consisting of lowercase English letters. The length of S is between 3 and 100, inclusive. All characters but one of S are the same. Find x such that the x-th character of S differs from all other characters. Input The input is given from Standard Input in the following format: S Output Prin...
LiveCodeBench
1,189
1
You are given a string S consisting of lowercase English letters. The length of S is between 3 and 100, inclusive. All characters but one of S are the same. Find x such that the x-th character of S differs from all other characters. Input The input is given from Standard Input in the following format: S Output Prin...
LiveCodeBench
1,189
2
You are given a string S consisting of lowercase English letters. The length of S is between 3 and 100, inclusive. All characters but one of S are the same. Find x such that the x-th character of S differs from all other characters. Input The input is given from Standard Input in the following format: S Output Prin...
LiveCodeBench
1,189
3
There are N people standing in a line. The person standing at the i-th position from the front is person P_i. Process Q queries. The i-th query is as follows: - You are given integers A_i and B_i. Between person A_i and person B_i, print the person number of the person standing further to the front. Input The input ...
LiveCodeBench
1,190
1
There are N people standing in a line. The person standing at the i-th position from the front is person P_i. Process Q queries. The i-th query is as follows: - You are given integers A_i and B_i. Between person A_i and person B_i, print the person number of the person standing further to the front. Input The input ...
LiveCodeBench
1,190
2
There are N people standing in a line. The person standing at the i-th position from the front is person P_i. Process Q queries. The i-th query is as follows: - You are given integers A_i and B_i. Between person A_i and person B_i, print the person number of the person standing further to the front. Input The input ...
LiveCodeBench
1,190
3
You are given a string S of length N consisting of lowercase English letters. You will perform an operation Q times on the string S. The i-th operation (1\leq i\leq Q) is represented by a pair of characters (c _ i,d _ i), which corresponds to the following operation: - Replace all occurrences of the character c _ i i...
LiveCodeBench
1,191
1
You are given a string S of length N consisting of lowercase English letters. You will perform an operation Q times on the string S. The i-th operation (1\leq i\leq Q) is represented by a pair of characters (c _ i,d _ i), which corresponds to the following operation: - Replace all occurrences of the character c _ i i...
LiveCodeBench
1,191
2
You are given a string S of length N consisting of lowercase English letters. You will perform an operation Q times on the string S. The i-th operation (1\leq i\leq Q) is represented by a pair of characters (c _ i,d _ i), which corresponds to the following operation: - Replace all occurrences of the character c _ i i...
LiveCodeBench
1,191
3
You are given a sequence of non-negative integers A=(A_1,\ldots,A_N) of length N. Find the number of pairs of integers (i,j) that satisfy both of the following conditions: - 1\leq i < j\leq N - A_i A_j is a square number. Here, a non-negative integer a is called a square number when it can be expressed as a=d^2 using...
LiveCodeBench
1,192
1
You are given a sequence of non-negative integers A=(A_1,\ldots,A_N) of length N. Find the number of pairs of integers (i,j) that satisfy both of the following conditions: - 1\leq i < j\leq N - A_i A_j is a square number. Here, a non-negative integer a is called a square number when it can be expressed as a=d^2 using...
LiveCodeBench
1,192
2
You are given a sequence of non-negative integers A=(A_1,\ldots,A_N) of length N. Find the number of pairs of integers (i,j) that satisfy both of the following conditions: - 1\leq i < j\leq N - A_i A_j is a square number. Here, a non-negative integer a is called a square number when it can be expressed as a=d^2 using...
LiveCodeBench
1,192
3
In the country of AtCoder, there are N stations: station 1, station 2, \ldots, station N. You are given M pieces of information about trains in the country. The i-th piece of information (1\leq i\leq M) is represented by a tuple of six positive integers (l _ i,d _ i,k _ i,c _ i,A _ i,B _ i), which corresponds to the fo...
LiveCodeBench
1,193
1
In the country of AtCoder, there are N stations: station 1, station 2, \ldots, station N. You are given M pieces of information about trains in the country. The i-th piece of information (1\leq i\leq M) is represented by a tuple of six positive integers (l _ i,d _ i,k _ i,c _ i,A _ i,B _ i), which corresponds to the fo...
LiveCodeBench
1,193
2
In the country of AtCoder, there are N stations: station 1, station 2, \ldots, station N. You are given M pieces of information about trains in the country. The i-th piece of information (1\leq i\leq M) is represented by a tuple of six positive integers (l _ i,d _ i,k _ i,c _ i,A _ i,B _ i), which corresponds to the fo...
LiveCodeBench
1,193
3
You are given two integers A and B, each between 0 and 9, inclusive. Print any integer between 0 and 9, inclusive, that is not equal to A + B. Input The input is given from Standard Input in the following format: A B Output Print any integer between 0 and 9, inclusive, that is not equal to A + B. Constraints - 0...
LiveCodeBench
1,194
1
You are given two integers A and B, each between 0 and 9, inclusive. Print any integer between 0 and 9, inclusive, that is not equal to A + B. Input The input is given from Standard Input in the following format: A B Output Print any integer between 0 and 9, inclusive, that is not equal to A + B. Constraints - 0...
LiveCodeBench
1,194
2
You are given two integers A and B, each between 0 and 9, inclusive. Print any integer between 0 and 9, inclusive, that is not equal to A + B. Input The input is given from Standard Input in the following format: A B Output Print any integer between 0 and 9, inclusive, that is not equal to A + B. Constraints - 0...
LiveCodeBench
1,194
3
There is a simple undirected graph G with N vertices labeled with numbers 1, 2, \ldots, N. You are given the adjacency matrix (A_{i,j}) of G. That is, G has an edge connecting vertices i and j if and only if A_{i,j} = 1. For each i = 1, 2, \ldots, N, print the numbers of the vertices directly connected to vertex i in a...
LiveCodeBench
1,195
1
There is a simple undirected graph G with N vertices labeled with numbers 1, 2, \ldots, N. You are given the adjacency matrix (A_{i,j}) of G. That is, G has an edge connecting vertices i and j if and only if A_{i,j} = 1. For each i = 1, 2, \ldots, N, print the numbers of the vertices directly connected to vertex i in a...
LiveCodeBench
1,195
2
There is a simple undirected graph G with N vertices labeled with numbers 1, 2, \ldots, N. You are given the adjacency matrix (A_{i,j}) of G. That is, G has an edge connecting vertices i and j if and only if A_{i,j} = 1. For each i = 1, 2, \ldots, N, print the numbers of the vertices directly connected to vertex i in a...
LiveCodeBench
1,195
3
You are given a positive integer N. Find the maximum value of a palindromic cube number not greater than N. Here, a positive integer K is defined to be a palindromic cube number if and only if it satisfies the following two conditions: - There is a positive integer x such that x^3 = K. - The decimal representation of ...
LiveCodeBench
1,196
1
You are given a positive integer N. Find the maximum value of a palindromic cube number not greater than N. Here, a positive integer K is defined to be a palindromic cube number if and only if it satisfies the following two conditions: - There is a positive integer x such that x^3 = K. - The decimal representation of ...
LiveCodeBench
1,196
2
You are given a positive integer N. Find the maximum value of a palindromic cube number not greater than N. Here, a positive integer K is defined to be a palindromic cube number if and only if it satisfies the following two conditions: - There is a positive integer x such that x^3 = K. - The decimal representation of ...
LiveCodeBench
1,196
3
Takahashi is hosting a contest with N players numbered 1 to N. The players will compete for points. Currently, all players have zero points. Takahashi's foreseeing ability lets him know how the players' scores will change. Specifically, for i=1,2,\dots,T, the score of player A_i will increase by B_i points at i second...
LiveCodeBench
1,197
1
Takahashi is hosting a contest with N players numbered 1 to N. The players will compete for points. Currently, all players have zero points. Takahashi's foreseeing ability lets him know how the players' scores will change. Specifically, for i=1,2,\dots,T, the score of player A_i will increase by B_i points at i second...
LiveCodeBench
1,197
2
Takahashi is hosting a contest with N players numbered 1 to N. The players will compete for points. Currently, all players have zero points. Takahashi's foreseeing ability lets him know how the players' scores will change. Specifically, for i=1,2,\dots,T, the score of player A_i will increase by B_i points at i second...
LiveCodeBench
1,197
3
In a coordinate space, we want to place three cubes with a side length of 7 so that the volumes of the regions contained in exactly one, two, three cube(s) are V_1, V_2, V_3, respectively. For three integers a, b, c, let C(a,b,c) denote the cubic region represented by (a\leq x\leq a+7) \land (b\leq y\leq b+7) \land (c...
LiveCodeBench
1,198
1
In a coordinate space, we want to place three cubes with a side length of 7 so that the volumes of the regions contained in exactly one, two, three cube(s) are V_1, V_2, V_3, respectively. For three integers a, b, c, let C(a,b,c) denote the cubic region represented by (a\leq x\leq a+7) \land (b\leq y\leq b+7) \land (c...
LiveCodeBench
1,198
2
In a coordinate space, we want to place three cubes with a side length of 7 so that the volumes of the regions contained in exactly one, two, three cube(s) are V_1, V_2, V_3, respectively. For three integers a, b, c, let C(a,b,c) denote the cubic region represented by (a\leq x\leq a+7) \land (b\leq y\leq b+7) \land (c...
LiveCodeBench
1,198
3
You initially have an empty string S. Additionally, there are bags 1, 2, \dots, N, each containing some strings. Bag i contains A_i strings S_{i,1}, S_{i,2}, \dots, S_{i,A_i}. You will repeat the following steps for i = 1, 2, \dots, N: - Choose and perform one of the following two actions: - Pay 1 yen, select exactl...
LiveCodeBench
1,199
1
You initially have an empty string S. Additionally, there are bags 1, 2, \dots, N, each containing some strings. Bag i contains A_i strings S_{i,1}, S_{i,2}, \dots, S_{i,A_i}. You will repeat the following steps for i = 1, 2, \dots, N: - Choose and perform one of the following two actions: - Pay 1 yen, select exactl...
LiveCodeBench
1,199
2