Count the minimum and maximum number of pairs that can be formed when people are split into teams as evenly as possible.
You are given people and need to split them into teams. The teams should be as balanced as possible: some teams may have one extra person, but the team sizes can differ by at most $1$.
After the teams are formed, consider how many pairs of people can be on the same team.
Your task is to determine:
A pair means two distinct people belonging to the same team.
If is not divisible by , then exactly teams have size and the remaining teams have size .
Compute the smallest and largest possible number of same-team pairs over all valid balanced splits.
The input contains two integers:
Print two integers:
Example 1
Input
7 3
Output
5 6
Explanation
A balanced split is sizes 3, 2, and 2. The minimum number of pairs is obtained by keeping teams as even as possible: C(3,2)+C(2,2)+C(2,2)=3+1+1=5. The maximum is 6.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.