Given an integer n, the task is to find whether n can be written as sum of three consecutive integer.
Example 1:
Input: n = 6
Output: 1 2 3 
Explanation: 6 = 1+2+3
Hence 6 can be written as sum of 
three consecutive integer.
Example 2:
Input: n = 7
Output: -1
Explanation: 7 cannot be written as 
sum of three consecutive integer.
Your Task:  
You dont need to read input or print anything. Complete the function consecutiveSum() which takes n as input parameter and returns a vector contains of three consecutive integers if it is possible else -1.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
1<= n <=10000

Source: geeksforgeeks | Difficulty: EASY
Tags: Number theory

Starter code: #User function Template for python3

class Solution:

    def consecutiveSum (self, n):

        # code here 

Solutions:
class Solution:

	def consecutiveSum(self, n):
		if n % 3 != 0:
			return [-1]
		a = n // 3
		return [a - 1, a, a + 1]


class Solution:

	def consecutiveSum(self, n):
		x = n // 3
		return [x - 1, x, x + 1] if n % 3 == 0 else [-1]


class Solution:

	def consecutiveSum(self, n):
		i = 1
		while i <= n / 2:
			if i + (i + 1) + (i + 2) == n:
				return (i, i + 1, i + 2)
			i += 1
		i = [-1]
		return i


class Solution:

	def consecutiveSum(self, n):
		if n < 3:
			return [-1]
		if (n - 3) % 3 != 0:
			return [-1]
		return [(n - 3) // 3, (n - 3) // 3 + 1, (n - 3) // 3 + 2]


class Solution:

	def consecutiveSum(self, n):
		for i in range(0, n):
			if 3 * i + 3 == n:
				return [i, i + 1, i + 2]
		return [-1]


class Solution:

	def consecutiveSum(self, n):
		if n % 3 != 0:
			return [-1]
		else:
			t = int(n / 3)
		return [t - 1, t, t + 1]


class Solution:

	def consecutiveSum(self, num):
		if num % 3 == 0:
			num = num // 3
			return [num - 1, num, num + 1]
		return [-1]


class Solution:

	def consecutiveSum(self, n):
		if n % 3 != 0:
			return [-1]
		else:
			b = n // 3
			return [b - 1, b, b + 1]
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		list = ob.consecutiveSum(n)
		print(*list)


class Solution:

	def consecutiveSum(self, n):
		k = n // 2 + 1
		for i in range(1, k + 1):
			if i + i + 1 + i + 2 == n:
				return [i, i + 1, i + 2]
		return [-1]


class Solution:

	def consecutiveSum(self, n):
		l = []
		if n % 3 == 0:
			l.append(n // 3 - 1)
			l.append(n // 3)
			l.append(n // 3 + 1)
		else:
			l.append(-1)
		return l