#K65257. Maximum Leftover Candies
Maximum Leftover Candies
Maximum Leftover Candies
Given the total number of candies available, determine the maximum number of candies each child can receive such that the leftover candies are maximized. In case different distributions yield the same number of leftover candies, choose the smallest possible distribution.
You are provided with several test cases. For each test case, you are given an integer representing the total number of candies. Compute total_candies - 1 for each test case.
Mathematical Explanation:
Let \(n\) be the total number of candies. The maximum candies per child while maximizing the leftover is \(n - 1\), since any other division will result in fewer leftover candies or a larger value for candies per child.
inputFormat
The first line contains an integer \(T\) (\(1 \le T \le 10^5\)), the number of test cases. Each of the following \(T\) lines contains a single integer \(total_candies\) (\(2 \le total\_candies \le 10^9\)).
outputFormat
For each test case, output the maximum number of candies per child on a new line.
## sample3
2
5
7
1
4
6
</p>