A football league of N teams is taking place, where each team plays other teams once in [single round robin] fashion. A team gets 3 points for winning a game and 0 for losing (assume that no games end in a draw/tie). What is the maximum possible difference of points between the winning team and the second-placed team?

------ Input Format ------ 

- The first line of input will contain a single integer T, denoting the number of test cases. Then the test cases follow.
- Each test case consists of a single line of input, containing a single integer N.

------ Output Format ------ 

For each test case, output in a single line the maximum difference of points between first and second place.

------ Constraints ------ 

$1 ≤ T ≤ 10^{5}$
$2 ≤ N ≤ 10^{9}$

----- Sample Input 1 ------ 
4
2
3
4
9
----- Sample Output 1 ------ 
3
3
6
12
----- explanation 1 ------ 
Test case $1$: There will only be one match played between the two teams, therefore one team wins by $3$ points.

Test case $2$: Let the three teams be A, B, C. If team A wins both the games against team B and team C, then team A will win by $3$ points since one of team B and team C will win the game between them.

Test case $3$: Let the four teams be A, B, C, D. One possibility is for A to win all its games, and then B beats C, C beats D, D beats B. This way, the winner has $9$ points and second place has $3$ points, making a difference of $6$.

Test case $4$: It can be shown that it's not possible to achieve a difference higher than $12$ when $9$ teams play. One way of achieving this is for the winner to score $24$ points and second place to score $12$.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
T = int(input())
for i in range(T):
	n = int(input())
	if n == 2:
		print(3)
	else:
		s1 = 3 * (n - 1)
		s2 = (n - 1) // 2 * 3
		print(s1 - s2)


for i in range(int(input())):
	n = int(input())
	print(3 * (n // 2))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 * 3)
	else:
		print((n - 1) // 2 * 3)


import math
T = int(input())
for _ in range(T):
	N = int(input())
	result_mod = N % 2
	result_floordiv = N // 2
	if result_mod == 0:
		print(N + result_floordiv)
	elif result_mod != 0:
		print(N + (result_floordiv - 1))


t = int(input())
for i in range(t):
	x = int(input())
	print(x // 2 * 3)


T = int(input())
for i in range(T):
	N = int(input())
	if N % 2 == 0:
		print(int(N / 2 * 3))
	else:
		print(int((N - 1) / 2) * 3)


T = int(input())
for _ in range(T):
	N = int(input())
	print(N // 2 * 3)


for i in range(int(input())):
	a = int(input())
	print(a // 2 * 3)


for i in range(int(input())):
	a = int(input())
	if a % 2 == 0:
		print(a // 2 * 3)
	else:
		print((a - 1) // 2 * 3)


for _ in range(int(input())):
	n = int(input())
	if n % 2 == 0:
		print(n // 2 * 3)
	else:
		print((n // 2 + 1 - 1) * 3)


for j in range(int(input())):
	a = int(input())
	if a % 2 == 0:
		z = (a // 2 - 1) * 3
		print((a - 1) * 3 - z)
	else:
		print((a - 1) * 3 - a // 2 * 3)


for _ in range(int(input())):
	n = int(input())
	print(n // 2 * 3)


t = int(input())
for i in range(t):
	n = int(input())
	hp = (n - 1) * 3
	sh = n - 2 - (n - 2) // 2
	print(hp - sh * 3)


for i in range(int(input())):
	N = int(input())
	print(N // 2 * 3)


import math
for i in range(int(input())):
	n = int(input())
	a = (n - 1) * 3
	b = math.ceil((n * (n - 1) // 2 - (n - 1)) / (n - 1)) * 3
	print(a - b)


for i in range(int(input())):
	x = int(input())
	y = x // 2
	print(y * 3)


t = int(input())
for i in range(t):
	a = int(input())
	c = a // 2
	print(c * 3)


t = int(input())
for _ in range(t):
	n = int(input())
	c = n // 2
	print(c * 3)


try:
	t = int(input())
	for r in range(t):
		n = int(input())
		c = n - 1
		x = c // 2
		m = c - x
		print(m * 3)
except:
	pass


n = int(input())
for _ in range(n):
	x = int(input())
	s = x // 2
	print(s * 3)


for i in range(int(input())):
	teams = int(input())
	print(teams // 2 * 3)


T = int(input())
while T > 0:
	N = int(input())
	points = N // 2 * 3
	print(points)
	T -= 1


t = int(input())
for i in range(t):
	n = int(input())
	m = n // 2
	print(m * 3)


t = int(input())
for i in range(t):
	n = int(input())
	a = n // 2
	print(a * 3)


t = int(input())
while t > 0:
	n = int(input())
	print(n // 2 * 3)
	t = t - 1


T = int(input())
for i in range(T):
	N = int(input())
	temp = N // 2
	print(temp * 3)


t = int(input())
for i in range(t):
	n = int(input())
	a = (n - 1) * 3
	b = int((n - 1) / 2) * 3
	z = a - b
	print(z)


for i in range(int(input())):
	a = int(input())
	x = (a - 1) * 3
	y = int((a - 1) / 2) * 3
	print(x - y)


t = int(input())
for _ in range(t):
	n = int(input())
	print((n - 1) * 3 - (n - 1) // 2 * 3)


for i in range(int(input())):
	n = int(input())
	mip = (n - 1) * 3
	mpi = (n - 1) // 2 * 3
	print(mip - mpi)


t = int(input())
for i in range(t):
	n = int(input())
	max_points = (n - 1) * 3
	min_points = (n - 1) // 2 * 3
	print(max_points - min_points)


for _testcase in range(int(input())):
	a = int(input())
	print(a // 2 * 3)


for t in range(int(input())):
	num = int(input())
	print(num // 2 * 3)


for i in range(int(input())):
	inp = int(input())
	print(inp // 2 * 3)


for _ in range(int(input())):
	x = int(input())
	max_x = (x - 1) * 3
	min_x = int((x - 1) / 2) * 3
	print(max_x - min_x)


for t in range(int(input())):
	n = int(input())
	print(n // 2 * 3)


t = int(input())
for tc in range(t):
	n = int(input())
	v = n - 1
	x = v // 2
	b = v - x
	print(b * 3)