Given an integer N, find the sum of odd numbers and even numbers from 1 to N.
 
Example 1:
Input: 5
Output: 9 6
Explanation: Odd numbers upto 5 are 1, 3, 5
and their sum = 1 + 3 + 5 = 9.Even numbers
upto 5 are 2 and 4 and their sum = 2 + 4 = 6.
Example 1:
Input: 6
Output: 9 12
Explanation: Odd numbers upto 6 are 1, 3, 5
and their sum = 1 + 3 + 5 = 9.Even numbers
upto 5 are 2 , 4 and 6 and their 
sum = 2 + 4 + 6  = 12.
 
Your Task:
You don't need to read or print anything, Your task is to complete the function find_sum() which takes N as input parameter and returns a list of two numbers where first numbers is sum of odd numbers and second number is sum of even numbers.
 
Expected Time Complexity: O(1)
Expected Space Complexity: O(1)
 
Constraints:
1 <= N <= 10^{4}

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
	def find_sum(self, n):
		# Code here


Solutions:
class Solution:

	def find_sum(self, n):
		nev = n // 2
		nod = n - n // 2
		return [nod ** 2, nev * (nev + 1)]


class Solution:

	def find_sum(self, n):
		odd = 0
		even = 0
		for i in range(2, n + 1, 2):
			even += i
		odd = int(n * (n + 1) / 2 - even)
		return [odd, even]


class Solution:

	def find_sum(self, n):
		odd = 0
		even = 0
		if n % 2:
			odd = (int(n / 2) + 1) * (1 + n) / 2
			even = int(n / 2) * (2 + n - 1) / 2
		else:
			odd = int(n / 2) * (1 + n - 1) / 2
			even = int(n / 2) * (2 + n) / 2
		return [int(odd), int(even)]


import math

class Solution:

	def find_sum(self, n):
		o_sum = 0
		o_terms = math.ceil(n / 2)
		o_sum = o_terms / 2 * (2 + (o_terms - 1) * 2)
		e_sum = 0
		if n > 1:
			e_terms = math.floor(n / 2)
			e_sum = e_terms / 2 * (4 + (e_terms - 1) * 2)
		res = []
		res.append(int(o_sum))
		res.append(int(e_sum))
		return res


class Solution:

	def find_sum(self, n):
		evenNumber = n // 2
		oddNumber = n - n // 2
		return [oddNumber ** 2, evenNumber * (evenNumber + 1)]


class Solution:

	def find_sum(self, n):
		if n % 2 == 0:
			s1 = n / 2 * (n / 2 + 1)
			s0 = n * (n + 1) / 2 - s1
		else:
			n1 = n - 1
			s1 = n1 / 2 * (n1 / 2 + 1)
			s0 = n * (n + 1) / 2 - s1
		return (int(s0), int(s1))


class Solution:

	def find_sum(self, n):
		sum = n * (n + 1) / 2
		n = n // 2
		even = 2 * n + n * (n - 1)
		return [int(sum - even), int(even)]


import math

class Solution:

	def find_sum(self, n):
		sumall = n * (n + 1) / 2
		sume = math.floor(n / 2) * (math.floor(n / 2) + 1)
		return (int(sumall - sume), sume)


class Solution:

	def ap_sum(self, n, a, d):
		return (2 * a + (n - 1) * d) * n // 2

	def find_sum(self, n):
		if n % 2 == 0:
			return [self.ap_sum(n // 2, 1, 2), self.ap_sum(n // 2, 2, 2)]
		else:
			return [self.ap_sum(n // 2 + 1, 1, 2), self.ap_sum(n // 2, 2, 2)]


class Solution:

	def find_sum(self, n):
		sumeven = n // 2
		sumodd = n - n // 2
		return (sumodd ** 2, sumeven * (sumeven + 1))


class Solution:

	def find_sum(self, n):
		odd = sum([x for x in range(1, n + 1, 2)])
		even = sum([x for x in range(2, n + 1, 2)])
		return (odd, even)


class Solution:

	def find_sum(self, n):
		sum = [0] * 2
		if n % 2 == 0:
			sum[0] = n // 2 * (1 + n - 1) // 2
			sum[1] = n // 2 * (2 + n) // 2
		else:
			sum[0] = (n // 2 + 1) * (1 + n) // 2
			sum[1] = n // 2 * (2 + n - 1) // 2
		return sum


class Solution:

	def find_sum(self, n):
		even_n = n // 2
		odd_n = n // 2 + n % 2
		even_last = 2 + (even_n - 1) * 2
		odd_last = 1 + (odd_n - 1) * 2
		even_sum = even_n * (2 + even_last) // 2
		odd_sum = odd_n * (1 + odd_last) // 2
		return (odd_sum, even_sum)


class Solution:

	def find_sum(self, n):
		e = n // 2
		o = n - n // 2
		return (o ** 2, e * (e + 1))


class Solution:

	def find_sum(self, n):
		odd = ((n + 1) // 2) ** 2
		even = n // 2 * (n // 2 + 1)
		return (odd, even)


class Solution:

	def find_sum(self, n):
		nth = 1 + (n - 1) // 2
		a = [0, 0]
		sum1 = nth * ((1 + n) // 2)
		x = 0
		y = 1
		a[x] = sum1
		a[y] = n * (n + 1) // 2 - sum1
		return a


class Solution:

	def find_sum(self, n):
		num = n // 2
		if n % 2 == 0:
			od = num / 2 * (2 * 1 + (num - 1) * 2)
		else:
			od = (num + 1) / 2 * (2 * 1 + num * 2)
		ev = num / 2 * (2 * 2 + (num - 1) * 2)
		return [int(od), int(ev)]


class Solution:

	def find_sum(self, N):
		odd_sum = ((N + 1) // 2) ** 2
		even_sum = N // 2 * (N // 2 + 1)
		return (odd_sum, even_sum)


class Solution:

	def find_sum(self, n):
		no = (n - 1) // 2 + 1
		ne = n // 2
		return (int(no ** 2), int(ne * (ne + 1)))


class Solution:

	def find_sum(self, n):
		if n % 2 == 0:
			ano = n - 1
			ane = n
			(o, e) = (int(n / 2), int(n / 2))
		else:
			ano = n
			ane = n - 1
			o = int(n - n // 2)
			e = int(n // 2)
		return [round((1 + ano) / 2 * o), round((2 + ane) / 2 * e)]


import math

class Solution:

	def find_sum(self, n):
		od = math.ceil(n / 2)
		to = n * (n + 1) // 2
		return (od * od, to - od * od)


class Solution:

	def find_sum(self, n):
		ec = n // 2
		oc = (n + 1) // 2
		even = int(ec * (4 + (ec - 1) * 2) / 2)
		odd = int(oc * (2 + (oc - 1) * 2) / 2)
		return (odd, even)


class Solution:

	def find_sum(self, n):
		l = []
		if n % 2 == 0:
			n = int(n / 2)
			sum_even = n * (n + 1)
			sum_odd = n ** 2
		else:
			num = n // 2
			sum_even = num * (num + 1)
			num = n // 2 + 1
			sum_odd = num ** 2
		l = [sum_odd, sum_even]
		return l


class Solution:

	def find_sum(self, n):
		m = n // 2
		list_fin = []
		if n % 2 == 0:
			even_sum = m / 2 * (2 + n)
			odd_sum = m / 2 * (1 + (n - 1))
		else:
			even_sum = m / 2 * (2 + (n - 1))
			odd_sum = (m + 1) / 2 * (1 + n)
		list_fin.append(int(odd_sum))
		list_fin.append(int(even_sum))
		return list_fin


class Solution:

	def find_sum(self, n):
		arr = list(range(1, n + 1))
		return (sum(arr[::2]), sum(arr[1::2]))


import math

class Solution:

	def find_sum(self, n):
		l = list()
		n1 = 0
		n2 = 0
		n2 = n // 2
		n1 = n - n2
		e = n2 * ((4 + (n2 - 1) * 2) // 2)
		o = n1 * ((2 + (n1 - 1) * 2) // 2)
		l.append(o)
		l.append(e)
		return l


class Solution:

	def find_sum(self, n):
		l = []
		if n % 2 == 0:
			n = n // 2
			s2 = n * (4 + (n - 1) * 2) // 2
			s1 = n * (2 + (n - 1) * 2) // 2
		else:
			n1 = n // 2 + 1
			n2 = n // 2
			s2 = n2 * (4 + (n2 - 1) * 2) // 2
			s1 = int(n1 * (2 + (n1 - 1) * 2) // 2)
		l.append(s1)
		l.append(s2)
		return l


class Solution:

	def find_sum(self, n):
		total = n * (n + 1) // 2
		odd = 0
		if n % 2 == 1:
			odd = (n // 2 + 1) * (1 + n) // 2
			return [odd, total - odd]
		else:
			odd = n // 2 * n // 2
			return [odd, total - odd]


class Solution:

	def find_sum(self, n):
		ans = []
		n1 = int(n / 2)
		n2 = n - n1
		e = n1 * (n1 + 1)
		o = int(1 / 2 * n2 * (2 + (n2 - 1) * 2))
		ans.append(o)
		ans.append(e)
		return ans


class Solution:

	def find_sum(self, n):
		return (sum(range(1, n + 1, 2)), sum(range(2, n + 1, 2)))


class Solution:

	def find_sum(self, n):
		ev = n // 2
		od = n - n // 2
		return [od ** 2, ev * (ev + 1)]


class Solution:

	def find_sum(self, n):
		a = n // 2
		b = n - n // 2
		return (b ** 2, a * (a + 1))


class Solution:

	def find_sum(self, n):
		tot = int(n * (n + 1) / 2)
		if n % 2 == 0:
			l = int(n / 4 * (2 + n))
			return [tot - l, l]
		else:
			l = int((n - 1) / 4 * (2 + n - 1))
			return [tot - l, l]


class Solution:

	def find_sum(self, n):
		odd = 0
		even = 0
		if n < 1000:
			for i in range(1, n + 1):
				if i % 2 == 0:
					even += i
				else:
					odd += i
			return [odd, even]
		odd = int(n * (n - 1) / 4)
		ev = int(n * n / 4)
		tot = int(n * (n + 1) / 2)
		if n % 2 == 0:
			l = int(n / 4 * (2 + n))
			return [tot - l, l]
		else:
			l = int((n - 1) / 4 * (2 + n - 1))
			return [tot - l, l]


class Solution:

	def find_sum(self, n):
		se = n // 2
		so = n - n // 2
		return [so ** 2, se * (se + 1)]


class Solution:

	def find_sum(self, n):
		e = n // 2
		o = n - n // 2
		os = o ** 2
		es = e * (e + 1)
		return (os, es)


class Solution:

	def find_sum(self, n):
		eum = n // 2
		oum = n - n // 2
		osum = oum * oum
		esum = eum * (eum + 1)
		return (osum, esum)


class Solution:

	def find_sum(self, n):
		k = n // 2
		j = n - n // 2
		odd = j * j
		even = k * (k + 1)
		return (odd, even)


class Solution:

	def find_sum(self, n):
		if n % 2 == 0:
			(e, o) = (n // 2, n // 2)
		else:
			(e, o) = (n // 2, n // 2 + 1)
		return [o * o, e * (e + 1)]


class Solution:

	def find_sum(self, n):
		sum_even = sum(range(0, n + 1, 2))
		sum_odd = sum(range(1, n + 1, 2))
		return (sum_odd, sum_even)


class Solution:

	def find_sum(self, n):
		return ((n - n // 2) ** 2, n // 2 * (n // 2 + 1))


class Solution:

	def find_sum(self, n):
		if n % 2 == 0:
			count_odd = n / 2
			count_even = n / 2
		else:
			count_odd = n // 2 + 1
			count_even = n // 2
		return (int(pow(count_odd, 2)), int(count_even * (count_even + 1)))


class Solution:

	def find_sum(self, n):
		a = [i for i in range(1, n + 1)]
		return (sum(a[0::2]), sum(a[1::2]))


class Solution:

	def find_sum(self, n):
		a = n * (n + 1) // 2
		n = n // 2
		ev = n * (n + 1)
		return (a - ev, ev)


class Solution:

	def find_sum(self, n):
		arr = list()
		sum = int(n * (n + 1) / 2)
		a = int(n / 2)
		e_sum = a / 2 * (4 + (a - 1) * 2)
		arr.append(sum - int(e_sum))
		arr.append(int(e_sum))
		return arr


class Solution:

	def find_sum(self, n):
		if n % 2 == 0:
			n = n // 2
			l = [n ** 2, n * (n + 1)]
			return l
		n = n // 2
		l = [(n + 1) ** 2, n * (n + 1)]
		return l


class Solution:

	def find_sum(self, n):
		odd = sum(range(1, n + 1, 2))
		even = sum(range(2, n + 1, 2))
		return (odd, even)


class Solution:

	def find_sum(self, n):
		if n % 2 == 0:
			sum1 = (1 + n - 1) * (n // 2) // 2
			sum2 = (2 + n) * (n // 2) // 2
		else:
			sum1 = (1 + n) * (n // 2 + 1) // 2
			sum2 = (2 + n - 1) * (n // 2) // 2
		return [sum1, sum2]


class Solution:

	def find_sum(self, n):
		a = [1, 0]
		if n % 2 == 0 and n > 1:
			a.clear()
			n = n // 2
			a.append(n ** 2)
			a.append(n * (n + 1))
		elif n > 1:
			a.clear()
			n = n // 2
			a.append((n + 1) ** 2)
			a.append(n * (n + 1))
		return a