yl-9/probench huggingface dataset:
# Battle for Survive

## Problem Description

Eralim, being the mafia boss, manages a group of $ n $ fighters. Fighter $ i $ has a rating of $ a_i $ .

Eralim arranges a tournament of $ n - 1 $ battles, in each of which two not yet eliminated fighters $ i $ and $ j $ ( $ 1 \le i < j \le n $ ) are chosen, and as a result of the battle, fighter $ i $ is eliminated from the tournament, and the rating of fighter $ j $ is reduced by the rating of fighter $ i $ . That is, $ a_j $ is decreased by $ a_i $ . Note that fighter $ j $ 's rating can become negative. The fighters indexes do not change.

Eralim wants to know what maximum rating the last remaining fighter can preserve if he chooses the battles optimally.

## Input Format

Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 10^4 $ ). The description of the test cases follows.

The first line of each test case contains a single integer $ n $ ( $ 2 \le n \le 2 \cdot 10^5 $ ) — the number of fighters.

The second line of each test case contains $ n $ integers $ a_1, a_2, \ldots a_n $ ( $ 1 \le a_i \le 10^9 $ ) — the ratings of the fighters.

The sum of $ n $ over all testcases does not exceed $ 2 \cdot 10^5 $ .

## Output Format

For each testcase, output a single integer — the maximum rating that the last remaining fighter can preserve.

## Sample #1

### Sample Input #1

```
5
2
2 1
3
2 2 8
4
1 2 4 3
5
1 2 3 4 5
5
3 2 4 5 4
```

### Sample Output #1

```
-1
8
2
7
8
```

## Hint

In the first example, you can arrange a fight between fighters with indices $ 1 $ and $ 2 $ , where the fighter with index $ 2 $ will win. The rating of the last fighter, that is, the fighter with index $ 2 $ , will be $ 1 - 2 = -1 $ .

In the second example, you can first conduct a fight between fighters with indices $ 1 $ and $ 2 $ , where the fighter with index $ 2 $ will win, and then conduct a fight between fighters with indices $ 2 $ and $ 3 $ , where the fighter with index $ 3 $ will win.

The rating of the fighter with index $ 2 $ after the first fight will be $ 2 - 2 = 0 $ . The rating of the fighter with index $ 3 $ after the second fight will be $ 8 - 0 = 8 $ .

## Limit



Time Limit
1.00s

Memory Limit
250.00MB

Tags: constructive algorithms, greedy, math
Difficulty: 900
# Zhan's Blender

## Problem Description

Today, a club fair was held at "NSPhM". In order to advertise his pastry club, Zhan decided to demonstrate the power of his blender.

To demonstrate the power of his blender, Zhan has $ n $ fruits.

The blender can mix up to $ x $ fruits per second.

In each second, Zhan can put up to $ y $ fruits into the blender. After that, the blender will blend $ \min(x, c) $ fruits, where $ c $ is the number of fruits inside the blender. After blending, blended fruits are removed from the blender.

Help Zhan determine the minimum amount of time required for Zhan to blend all fruits.

## Input Format

Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 1000 $ ). The description of the test cases follows.

The first line of each test case contains one integer $ n $ ( $ 0 \le n \le 10^9 $ ) — the number of fruits Zhan has.

The second line of each test case contains two integers $ x $ and $ y $ ( $ 1 \le x, y \le 10^9 $ ) — the number of fruits the blender can blend per second and the number of fruits Zhan can put into the blender per second.

## Output Format

For each testcase, output a single integer — the minimum number of seconds to blend all fruits.

## Sample #1

### Sample Input #1

```
5
5
3 4
3
1 2
6
4 3
100
4 3
9
3 3
```

### Sample Output #1

```
2
3
2
34
3
```

## Hint

In the first example, you can first put $ 2 $ fruits in the blender. After that, the blender will mix these $ 2 $ fruits, and in the end, there will be $ 0 $ fruits left in the blender. Then you can put $ 3 $ fruits into the blender, after which the blender will mix these $ 3 $ fruits.

In the second example, you can put $ 1 $ fruit into the blender $ 3 $ times.

In the third example, you can first put $ 3 $ fruits into the blender, then add another $ 3 $ fruits.

## Limit



Time Limit
1.00s

Memory Limit
250.00MB

Tags: constructive algorithms, math
Difficulty: 800
# Message Transmission Error (hard version)

## Problem Description

This is a more difficult version of the problem. It differs from the easy one only by the constraints.

At the Berland State University, the local network between servers does not always operate without errors. When transmitting two identical messages consecutively, an error may occur, resulting in the two messages merging into one. In this merging, the end of the first message coincides with the beginning of the second. Of course, the merging can only occur at identical characters. The length of the merging must be a positive number less than the length of the message text.

For example, when transmitting two messages "abrakadabra" consecutively, it is possible that it will be transmitted with the described type of error, resulting in a message like "abrakadabrabrakadabra" or "abrakadabrakadabra' (in the first case, the merging occurred at one character, and in the second case, at four).

Given the received message $ t $ , determine if it is possible that this is the result of an error of the described type in the operation of the local network, and if so, determine a possible value of $ s $ .

A situation where two messages completely overlap each other should not be considered an error. For example, if the received message is "abcd", it should be considered that there is no error in it. Similarly, simply appending one message after another is not a sign of an error. For instance, if the received message is "abcabc", it should also be considered that there is no error in it.

## Input Format

The input consists of a single non-empty string $ t $ , consisting of lowercase letters of the Latin alphabet. The length of the string $ t $ does not exceed $ 4·10^{5} $ characters.

## Output Format

If the message $ t $ cannot contain an error, output "NO" (without quotes) in a single line of output.

Otherwise, in the first line, output "YES" (without quotes), and in the next line, output the string $ s $ — a possible message that could have led to the error. If there are multiple possible answers, any of them is acceptable.

## Sample #1

### Sample Input #1

```
abrakadabrabrakadabra
```

### Sample Output #1

```
YES
abrakadabra
```

## Sample #2

### Sample Input #2

```
acacacaca
```

### Sample Output #2

```
YES
acacaca
```

## Sample #3

### Sample Input #3

```
abcabc
```

### Sample Output #3

```
NO
```

## Sample #4

### Sample Input #4

```
abababab
```

### Sample Output #4

```
YES
ababab
```

## Sample #5

### Sample Input #5

```
tatbt
```

### Sample Output #5

```
NO
```

## Hint

In the second example, a suitable answer could also be the string "acacaca".

## Limit



Time Limit
2.00s

Memory Limit
250.00MB

Tags: hashing, string suffix structures, strings, two pointers
Difficulty: 1700
# Message Transmission Error (easy version)

## Problem Description

This is a simplified version of the problem. It differs from the difficult one only in its constraints.

At the Berland State University, the local network between servers does not always operate without errors. When transmitting two identical messages consecutively, an error may occur, resulting in the two messages merging into one. In this merging, the end of the first message coincides with the beginning of the second. Of course, the merging can only occur at identical characters. The length of the merging must be a positive number less than the length of the message text.

For example, when transmitting two messages "abrakadabra" consecutively, it is possible that it will be transmitted with the described type of error, resulting in a message like "abrakadabrabrakadabra" or "abrakadabrakadabra' (in the first case, the merging occurred at one character, and in the second case, at four).

Given the received message $ t $ , determine if it is possible that this is the result of an error of the described type in the operation of the local network, and if so, determine a possible value of $ s $ .

A situation where two messages completely overlap each other should not be considered an error. For example, if the received message is "abcd", it should be considered that there is no error in it. Similarly, simply appending one message after another is not a sign of an error. For instance, if the received message is "abcabc", it should also be considered that there is no error in it.

## Input Format

The input consists of a single non-empty string $ t $ , consisting of lowercase letters of the Latin alphabet. The length of the string $ t $ does not exceed $ 100 $ characters.

## Output Format

If the message $ t $ cannot contain an error, output "NO" (without quotes) in a single line of output.

Otherwise, in the first line, output "YES" (without quotes), and in the next line, output the string $ s $ — a possible message that could have led to the error. If there are multiple possible answers, any of them is acceptable.

## Sample #1

### Sample Input #1

```
abrakadabrabrakadabra
```

### Sample Output #1

```
YES
abrakadabra
```

## Sample #2

### Sample Input #2

```
acacacaca
```

### Sample Output #2

```
YES
acaca
```

## Sample #3

### Sample Input #3

```
abcabc
```

### Sample Output #3

```
NO
```

## Sample #4

### Sample Input #4

```
abababab
```

### Sample Output #4

```
YES
ababab
```

## Sample #5

### Sample Input #5

```
tatbt
```

### Sample Output #5

```
NO
```

## Hint

In the second example, a suitable answer could also be the string "acacaca".

## Limit



Time Limit
2.00s

Memory Limit
250.00MB

Tags: brute force, strings
Difficulty: 1400
# Three Brothers

## Problem Description

Three brothers agreed to meet. Let's number the brothers as follows: the oldest brother is number $ 1 $ , the middle brother is number $ 2 $ , and the youngest brother is number $ 3 $ .

When it was time for the meeting, one of the brothers was late. Given the numbers of the two brothers who arrived on time, you need to determine the number of the brother who was late.

## Input Format

The first line of input contains two different integers $ a $ and $ b $ ( $ 1<=a,b<=3 $ , $ a≠b $ ) — the numbers of the brothers who arrived on time. The numbers are given in arbitrary order.

## Output Format

Output a single integer — the number of the brother who was late to the meeting.

## Sample #1

### Sample Input #1

```
3 1
```

### Sample Output #1

```
2
```

## Limit



Time Limit
1.00s

Memory Limit
250.00MB

Tags: brute force, implementation, math
Difficulty: 800
# Alternating Sum of Numbers

## Problem Description

You are given a sequence of integers. Output the alternating sum of this sequence. In other words, output $ a_1 - a_2 + a_3 - a_4 + a_5 - \dots $ . That is, the signs of plus and minus alternate, starting with a plus.

## Input Format

The first line of the test contains one integer $ t $ ( $ 1 \le t \le 1000 $ ) — the number of test cases. Then follow $ t $ test cases.

The first line of each test case contains one integer $ n $ ( $ 1 \le n \le 50 $ ) — the length of the sequence. The second line of the test case contains $ n $ integers $ a_1, a_2, \dots, a_n $ ( $ 1 \le a_i \le 100 $ ).

## Output Format

Output $ t $ lines. For each test case, output the required alternating sum of the numbers.

## Sample #1

### Sample Input #1

```
4
4
1 2 3 17
1
100
2
100 100
5
3 1 4 1 5
```

### Sample Output #1

```
-15
100
0
10
```

## Limit



Time Limit
2.00s

Memory Limit
250.00MB

Tags: brute force, implementation, math
Difficulty: 800
# Yunli's Subarray Queries (extreme version)

## Problem Description

This is the extreme version of the problem. In this version, the output of each query is different from the easy and hard versions. It is also guaranteed that $ r \geq l+k-1 $ for all queries.

For an arbitrary array $ b $ , Yunli can perform the following operation any number of times:

- Select an index $ i $ . Set $ b_i = x $ where $ x $ is any integer she desires ( $ x $ is not limited to the interval $ [1,n] $ ).

Denote $ f(b) $ as the minimum number of operations she needs to perform until there exists a consecutive subarray $ ^{\text{∗}} $ of length at least $ k $ in $ b $ .

Yunli is given an array $ a $ of size $ n $ and asks you $ q $ queries. In each query, you must output $ \sum_{i=l}^{r-k+1} \sum_{j=i+k-1}^{r} f([a_i, a_{i+1}, \ldots, a_j]) $ .

 $ ^{\text{∗}} $ If there exists a consecutive subarray of length $ k $ that starts at index $ i $ ( $ 1 \leq i \leq |b|-k+1 $ ), then $ b_j = b_{j-1} + 1 $ for all $ i < j \leq i+k-1 $ .

## Input Format

The first line contains $ t $ ( $ 1 \leq t \leq 10^4 $ ) — the number of test cases.

The first line of each test case contains three integers $ n $ , $ k $ , and $ q $ ( $ 1 \leq k \leq n \leq 2 \cdot 10^5 $ , $ 1 \leq q \leq 2 \cdot 10^5 $ ) — the length of the array, the length of the consecutive subarray, and the number of queries.

The following line contains $ n $ integers $ a_1, a_2, ..., a_n $ ( $ 1 \leq a_i \leq n $ ).

The following $ q $ lines contain two integers $ l $ and $ r $ ( $ 1 \leq l \leq r \leq n $ , $ r \geq l+k-1 $ ) — the bounds of the query.

It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 2 \cdot 10^5 $ and the sum of $ q $ over all test cases does not exceed $ 2 \cdot 10^5 $ .

## Output Format

Output $ \sum_{i=l}^{r-k+1} \sum_{j=i+k-1}^{r} f([a_i, a_{i+1}, \ldots, a_j]) $ for each query on a new line.

## Sample #1

### Sample Input #1

```
5
7 2 4
1 2 3 2 1 2 3
4 6
1 7
2 7
3 7
8 4 2
4 3 1 1 2 4 3 2
3 6
1 5
5 4 2
4 5 1 2 3
1 4
1 5
10 4 8
2 3 6 5 8 9 8 10 10 1
2 7
6 10
1 9
1 6
3 9
4 10
2 10
1 8
10 7 4
3 4 5 3 4 5 9 10 8 9
1 9
2 10
1 10
2 9
```

### Sample Output #1

```
1
3
3
3
2
7
2
4
8
6
28
7
16
20
32
19
18
15
26
9
```

## Hint

In the first query of the first testcase, we can calculate the answer for the query through the following:

- $ i = 4 $ and $ j = 5 $ : $ f([2, 1])=1 $ because Yunli can set $ b_2=3 $ , making a consecutive subarray of size $ 2 $ in $ 1 $ move.
- $ i = 4 $ and $ j = 6 $ : $ f([2, 1, 2])=0 $ because there is already a consecutive array of size $ 2 $ .
- $ i = 5 $ and $ j = 6 $ : $ f([1, 2])=0 $ because there is already a consecutive array of size $ 2 $ .

The answer to this query is $ 1+0+0=1 $ .

## Limit



Time Limit
3.00s

Memory Limit
500.00MB

Tags: data structures, dp, implementation
Difficulty: 2700
# Yunli's Subarray Queries (hard version)

## Problem Description

This is the hard version of the problem. In this version, it is guaranteed that $ r \geq l+k-1 $ for all queries.

For an arbitrary array $ b $ , Yunli can perform the following operation any number of times:

- Select an index $ i $ . Set $ b_i = x $ where $ x $ is any integer she desires ( $ x $ is not limited to the interval $ [1,n] $ ).

Denote $ f(b) $ as the minimum number of operations she needs to perform until there exists a consecutive subarray $ ^{\text{∗}} $ of length at least $ k $ in $ b $ .

Yunli is given an array $ a $ of size $ n $ and asks you $ q $ queries. In each query, you must output $ \sum_{j=l+k-1}^{r} f([a_l, a_{l+1}, \ldots, a_j]) $ .

 $ ^{\text{∗}} $ If there exists a consecutive subarray of length $ k $ that starts at index $ i $ ( $ 1 \leq i \leq |b|-k+1 $ ), then $ b_j = b_{j-1} + 1 $ for all $ i < j \leq i+k-1 $ .

## Input Format

The first line contains $ t $ ( $ 1 \leq t \leq 10^4 $ ) — the number of test cases.

The first line of each test case contains three integers $ n $ , $ k $ , and $ q $ ( $ 1 \leq k \leq n \leq 2 \cdot 10^5 $ , $ 1 \leq q \leq 2 \cdot 10^5 $ ) — the length of the array, the length of the consecutive subarray, and the number of queries.

The following line contains $ n $ integers $ a_1, a_2, ..., a_n $ ( $ 1 \leq a_i \leq n $ ).

The following $ q $ lines contain two integers $ l $ and $ r $ ( $ 1 \leq l \leq r \leq n $ , $ r \geq l+k-1 $ ) — the bounds of the query.

It is guaranteed the sum of $ n $ over all test cases does not exceed $ 2 \cdot 10^5 $ and the sum of $ q $ over all test cases does not exceed $ 2 \cdot 10^5 $ .

## Output Format

Output $ \sum_{j=l+k-1}^{r} f([a_l, a_{l+1}, \ldots, a_j]) $ for each query on a new line.

## Sample #1

### Sample Input #1

```
3
7 5 3
1 2 3 2 1 2 3
1 7
2 7
3 7
8 4 2
4 3 1 1 2 4 3 2
3 6
1 5
5 4 2
4 5 1 2 3
1 4
1 5
```

### Sample Output #1

```
6
5
2
2
5
2
3
```

## Hint

In the second query of the first testcase, we calculate the following function values:

- $ f([2,3,2,1,2])=3 $ because Yunli can set $ b_3=4 $ , $ b_4=5 $ , and $ b_5=6 $ , making a consecutive subarray of size $ 5 $ in $ 3 $ moves.
- $ f([2,3,2,1,2,3])=2 $ because we can set $ b_3=0 $ and $ b_2=-1 $ , making a consecutive subarray of size $ 5 $ in $ 2 $ moves (starting at position $ 2 $ )

The answer to this query is $ 3+2=5 $ .

## Limit



Time Limit
3.00s

Memory Limit
500.00MB

Tags: binary search, data structures, dp
Difficulty: 2200
# Yunli's Subarray Queries (easy version)

## Problem Description

This is the easy version of the problem. In this version, it is guaranteed that $ r=l+k-1 $ for all queries.

For an arbitrary array $ b $ , Yunli can perform the following operation any number of times:

- Select an index $ i $ . Set $ b_i = x $ where $ x $ is any integer she desires ( $ x $ is not limited to the interval $ [1,n] $ ).

Denote $ f(b) $ as the minimum number of operations she needs to perform until there exists a consecutive subarray $ ^{\text{∗}} $ of length at least $ k $ in $ b $ .

Yunli is given an array $ a $ of size $ n $ and asks you $ q $ queries. In each query, you must output $ \sum_{j=l+k-1}^{r} f([a_l, a_{l+1}, \ldots, a_j]) $ . Note that in this version, you are only required to output $ f([a_l, a_{l+1}, \ldots, a_{l+k-1}]) $ .

 $ ^{\text{∗}} $ If there exists a consecutive subarray of length $ k $ that starts at index $ i $ ( $ 1 \leq i \leq |b|-k+1 $ ), then $ b_j = b_{j-1} + 1 $ for all $ i < j \leq i+k-1 $ .

## Input Format

The first line contains $ t $ ( $ 1 \leq t \leq 10^4 $ ) — the number of test cases.

The first line of each test case contains three integers $ n $ , $ k $ , and $ q $ ( $ 1 \leq k \leq n \leq 2 \cdot 10^5 $ , $ 1 \leq q \leq 2 \cdot 10^5 $ ) — the length of the array, the length of the consecutive subarray, and the number of queries.

The following line contains $ n $ integers $ a_1, a_2, \dots, a_n $ ( $ 1 \leq a_i \leq n $ ).

The following $ q $ lines contain two integers $ l $ and $ r $ ( $ 1 \leq l \leq r \leq n $ , $ r=l+k-1 $ ) — the bounds of the query.

It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 2 \cdot 10^5 $ and the sum of $ q $ over all test cases does not exceed $ 2 \cdot 10^5 $ .

## Output Format

Output $ \sum_{j=l+k-1}^{r} f([a_l, a_{l+1}, \ldots, a_j]) $ for each query on a new line.

## Sample #1

### Sample Input #1

```
3
7 5 3
1 2 3 2 1 2 3
1 5
2 6
3 7
8 4 2
4 3 1 1 2 4 3 2
3 6
2 5
5 4 2
4 5 1 2 3
1 4
2 5
```

### Sample Output #1

```
2
3
2
2
2
2
1
```

## Hint

In the first query of the first testcase, $ b=[1,2,3,2,1] $ . Yunli can make a consecutive subarray of length $ 5 $ in $ 2 $ moves:

- Set $ b_4=4 $
- Set $ b_5=5 $

 After operations $ b=[1, 2, 3, 4, 5] $ .In the second query of the first testcase, $ b=[2,3,2,1,2] $ . Yunli can make a consecutive subarray of length $ 5 $ in $ 3 $ moves:

- Set $ b_3=0 $
- Set $ b_2=-1 $
- Set $ b_1=-2 $

 After operations $ b=[-2, -1, 0, 1, 2] $ .

## Limit



Time Limit
3.00s

Memory Limit
500.00MB

Tags: binary search, data structures, two pointers
Difficulty: 1900
# Firefly's Queries

## Problem Description

Firefly is given an array $ a $ of length $ n $ . Let $ c_i $ denote the $ i $ 'th cyclic shift $ ^{\text{∗}} $ of $ a $ . She creates a new array $ b $ such that $ b = c_1 + c_2 + \dots + c_n $ where $ + $ represents concatenation $ ^{\text{†}} $ .

Then, she asks you $ q $ queries. For each query, output the sum of all elements in the subarray of $ b $ that starts from the $ l $ -th element and ends at the $ r $ -th element, inclusive of both ends.

 $ ^{\text{∗}} $ The $ x $ -th ( $ 1 \leq x \leq n $ ) cyclic shift of the array $ a $ is $ a_x, a_{x+1} \ldots a_n, a_1, a_2 \ldots a_{x - 1} $ . Note that the $ 1 $ -st shift is the initial $ a $ .

 $ ^{\text{†}} $ The concatenation of two arrays $ p $ and $ q $ of length $ n $ (in other words, $ p + q $ ) is $ p_1, p_2, ..., p_n, q_1, q_2, ..., q_n $ .

## Input Format

The first line contains $ t $ ( $ 1 \leq t \leq 10^4 $ ) — the number of test cases.

The first line of each test case contains two integers $ n $ and $ q $ ( $ 1 \leq n, q \leq 2 \cdot 10^5 $ ) — the length of the array and the number of queries.

The following line contains $ n $ integers $ a_1, a_2, ..., a_n $ ( $ 1 \leq a_i \leq 10^6 $ ).

The following $ q $ lines contain two integers $ l $ and $ r $ ( $ 1 \leq l \leq r \leq n^2 $ ) — the left and right bounds of the query.

Note that the large inputs may require the use of 64-bit integers.

It is guaranteed that the sum of $ n $ does not exceed $ 2 \cdot 10^5 $ and the sum of $ q $ does not exceed $ 2 \cdot 10^5 $ .

## Output Format

For each query, output the answer on a new line.

## Sample #1

### Sample Input #1

```
5
3 3
1 2 3
1 9
3 5
8 8
5 5
4 8 3 2 4
1 14
3 7
7 10
2 11
1 25
1 1
6
1 1
5 7
3 1 6 10 4
3 21
6 17
2 2
1 5
1 14
9 15
12 13
5 3
4 9 10 10 1
20 25
3 11
20 22
```

### Sample Output #1

```
18
8
1
55
20
13
41
105
6
96
62
1
24
71
31
14
44
65
15
```

## Hint

For the first test case, $ b = [1, 2, 3, 2, 3, 1, 3, 1, 2] $ .

## Limit



Time Limit
2.00s

Memory Limit
250.00MB

Tags: bitmasks, data structures, flows, math
Difficulty: 1700
# Klee's SUPER DUPER LARGE Array!!!

## Problem Description

Klee has an array $ a $ of length $ n $ containing integers $ [k, k+1, ..., k+n-1] $ in that order. Klee wants to choose an index $ i $ ( $ 1 \leq i \leq n $ ) such that $ x = |a_1 + a_2 + \dots + a_i - a_{i+1} - \dots - a_n| $ is minimized. Note that for an arbitrary integer $ z $ , $ |z| $ represents the absolute value of $ z $ .

Output the minimum possible value of $ x $ .

## Input Format

The first line contains $ t $ ( $ 1 \leq t \leq 10^4 $ ) — the number of test cases.

Each test case contains two integers $ n $ and $ k $ ( $ 2 \leq n, k \leq 10^9 $ ) — the length of the array and the starting element of the array.

## Output Format

For each test case, output the minimum value of $ x $ on a new line.

## Sample #1

### Sample Input #1

```
4
2 2
7 2
5 3
1000000000 1000000000
```

### Sample Output #1

```
1
5
1
347369930
```

## Hint

In the first sample, $ a = [2, 3] $ . When $ i = 1 $ is chosen, $ x = |2-3| = 1 $ . It can be shown this is the minimum possible value of $ x $ .

In the third sample, $ a = [3, 4, 5, 6, 7] $ . When $ i = 3 $ is chosen, $ x = |3 + 4 + 5 - 6 - 7| = 1 $ . It can be shown this is the minimum possible value of $ x $ .

## Limit



Time Limit
2.00s

Memory Limit
250.00MB

Tags: binary search, math, ternary search
Difficulty: 1400