Read problems statements in Mandarin Chinese and Russian as well. 

What is the maximum number of squares of size 2x2 that can be fit in a right angled isosceles triangle of base B.

One side of the square must be parallel to the base of the isosceles triangle.

Base is the shortest side of the triangle

------ Input  ------ 

First line contains T, the number of test cases.

Each of the following T lines contains 1 integer B.

------ Output ------ 

Output exactly T lines, each line containing the required answer.

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

1 ≤ T ≤ 10^{3}

1 ≤ B ≤ 10^{4}

----- Sample Input 1 ------ 
11
1
2
3
4
5
6
7
8
9
10
11
----- Sample Output 1 ------ 
0
0
0
1
1
3
3
6
6
10
10

Source: codechef | Difficulty: EASY
Tags: Constructive algorithms

Geometry

Complete search

Mathematics

Matrices


Solutions:
import math
for t in range(int(input())):
	b = int(input())
	s = math.floor(b / 2)
	print(int((s - 1) * s / 2))


import math
t = int(input())
for i in range(t):
	b = int(input())
	k = math.floor(b / 2)
	print(int(k * (k - 1) / 2))


import math
for i in range(int(input())):
	l = int(input())
	s = math.floor(l / 2)
	print(int((s - 1) * s / 2))


import math
for _ in range(int(input())):
	n = int(input())
	s = math.floor(n / 2)
	print(int((s - 1) * s / 2))


for i in range(int(input())):
	base = int(input())
	result = 0
	for j in range(base // 2 - 1):
		result += base // 2 - 1 - j
	print(result)


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


t = int(input())
for i in range(t):
	b = int(input())
	c = 0
	a = b
	for i in range(a // 2):
		b = b - 2
		c = c + b // 2
	print(c)


import math
t = int(input())
for i in range(t):
	squares = 0
	b = int(input())
	b = b - 2
	b = math.floor(b / 2)
	print(int(b * (b + 1) / 2))


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


import math
t = int(input())
for i in range(t):
	x = int(input())
	c = math.floor(x / 2)
	print(int((c - 1) * c / 2))


t = int(input())
while t > 0:
	b = int(input())
	x = b - 2
	if x > 0:
		count = x // 2
		triangles = int(count * (count + 1) / 2)
		print(triangles)
	else:
		print(0)
	t -= 1


import math
q = int(input())
for i in range(q):
	b = int(input())
	s = math.floor(b / 2)
	print(int((s - 1) * s / 2))


for _ in range(int(input())):
	b = int(input())
	b = (b - 2) // 2 * ((b - 2) // 2 + 1) / 2
	print(int(b))


T = int(input())
for _ in range(T):
	B = int(input())
	print(int((B // 2 - 1) * (B // 2) / 2))


for _ in range(int(input())):
	b = int(input())
	if b == 1:
		print(0)
	else:
		c = b // 2 - 1
		tot = c * (c + 1) / 2
		print(int(tot))


for i in range(int(input())):
	B = int(input())
	print(int((B // 2 - 1) * (B // 2) / 2))


x = int(input())
for i in range(0, x):
	b = int(input())
	if b < 4:
		print(0)
		continue
	n = b // 2 - 1
	print(n * (n + 1) // 2)


for i in range(int(input())):
	w = int(input())
	w = w - 2
	w = w // 2
	print(int(w * (w + 1) / 2))


import math
t = int(input())
while t != 0:
	a = int(input())
	b = math.floor(a / 2)
	c = int((b - 1) * b / 2)
	print(c)
	t = t - 1


T = int(input())
for i in range(T):
	B = int(input())
	Y = B // 2
	print(Y * (Y - 1) // 2)


Test = int(input())
for Cases in range(Test):
	Base = int(input())
	BaseNew = int((Base - 2) / 2)
	Result = BaseNew * (BaseNew + 1) / 2
	print(int(Result))


n = int(input())
for i in range(n):
	p = int(input())
	if p <= 3:
		print(0)
	else:
		p = p - 2
		p = p // 2
		c = p - 1
		while c > 0:
			p = p + c
			c = c - 1
		print(p)


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


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


for j in range(int(input())):
	x = int(input())
	if x == 1:
		print(0)
	else:
		c = x // 2
		if c == 1:
			a = 0
		else:
			a = 0
			b = 1
			for i in range(1, c):
				a = a + b
				b = b + 1
		print(a)


for _ in range(int(input())):
	base = int(input())
	base -= 2
	base //= 2
	print(base * (base + 1) // 2)


for _ in range(int(input())):
	base = int(input())
	cnt = 0
	while base > 2:
		cnt += (base - 2) // 2
		base -= 2
	print(cnt)


c = int(input())
for i in range(c):
	base = int(input())
	cnt = 0
	while base > 2:
		cnt += (base - 2) // 2
		base -= 2
	print(cnt)


for _ in range(int(input())):
	base = int(input())
	count = 0
	while base > 2:
		count += (base - 2) // 2
		base -= 2
	print(count)


import math
for i in range(int(input())):
	B = int(input())
	a = math.floor(B / 2)
	print((a - 1) * a // 2)


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


c = 0
for i in range(int(input())):
	B = int(input())
	while B >= 2:
		B = B - 2
		c += B // 2
	print(c)
	c = 0


for i in range(int(input())):
	b = int(input())
	if b < 4:
		print(0)
	else:
		n = (b - 2) // 2
		print(int(n * (n + 1) / 2))


for i in range(int(input())):
	ep = int(input())
	ep = ep - 2
	ep = ep // 2
	print(int(ep * (ep + 1) / 2))


t = int(input())
for i in range(t):
	a = [int(i) for i in input().split()]
	if a[0] < 4:
		print(0)
	else:
		k = a[0] // 2 - 1
		print(k * (k + 1) // 2)


for _ in range(int(input())):
	b = int(input())
	i = max(0, b // 2 - 1)
	print(i * (i + 1) // 2)


T = int(input())
for i in range(T):
	B = int(input())
	k = 0
	for j in range(2, B + 1, 2):
		if (B - j) // 2 != 0:
			k += (B - j) // 2
			continue
		else:
			break
	print(k)


t = int(input())
for i in range(t):
	b = int(input())
	b = b - 2
	b = b // 2
	tri = b * (b + 1) // 2
	print(tri)


import math

def numberOfSquares(base):
	base = (base - 2) // 2
	return base * (base + 1) / 2
for t in range(int(input())):
	base = int(input())
	print(math.floor(numberOfSquares(base)))


try:
	t = int(input())
	for r in range(t):
		b = map(int, input().split())
		s = 0
		for i in b:
			while i > 2:
				s += (i - 2) // 2
				i = i - 2
			print(s)
except:
	pass