Ishika got stuck on an island. There is only one shop on this island and it is open on all days of the week except for Sunday. Consider following constraints:
	N – The maximum unit of food you can buy each day.
	S – Number of days you are required to survive.
	M – Unit of food required each day to survive.
Currently, it’s Monday, and she needs to survive for the next S days.
Find the minimum number of days on which you need to buy food from the shop so that she can survive the next S days, or determine that it isn’t possible to survive. 
Example 1:
Input: S = 10, N = 16, M = 2
Output: 2
Explaination: One possible solution is to 
buy a box on the first day (Monday), 
it’s sufficient to eat from this box up to 
8th day (Monday) inclusive. Now, on the 9th 
day (Tuesday), you buy another box and use 
the chocolates in it to survive the 9th and 
10th day.
Example 2:
Input: S = 10, N = 20, M = 30
Output: -1
Explaination: She can’t survive even if 
she buy food because the maximum number 
of units she can buy in 1 day is less the 
required food for 1 day.
Your Task:
You do not need to read input or print anything. Your task is to complete the function minimumDays() which takes S, N, and M as input parameters and returns the minimum number of days Ishika needs to buy food. Otherwise, returns -1 if she cannot survive.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N, S ≤ 50
1 ≤ M ≤ 30

Difficulty: EASY
Tags: Greedy algorithms

Ad-hoc
Skill types: Greedy algorithms
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
    def minimumDays(self, S, N, M):
        # code here

Solutions:
class Solution:

	def minimumDays(self, S, N, M):
		if M * 7 > N * 6 and S > 6 or M > N:
			return -1
		else:
			day = M * S // N
			if M * S % N != 0:
				day += 1
			return day


class Solution:

	def minimumDays(self, S, N, M):
		sunday = S // 7
		buyingDays = S - sunday
		ans = 0
		if N < M:
			return -1
		total = S * M
		if total % N == 0:
			ans = total // N
		else:
			ans = total // N + 1
		if ans <= buyingDays:
			return ans
		else:
			return -1


class Solution:

	def minimumDays(self, S, N, M):
		k = S // 7
		l = S - k
		tp = S * M
		ans = 0
		if tp % N == 0:
			ans = tp // N
		else:
			ans = tp // N + 1
		if ans <= l:
			return ans
		return -1


class Solution:

	def minimumDays(self, S, N, M):
		sunday = S // 7
		totalfood = S * M
		buyingdays = S - sunday
		ans = 0
		if totalfood % N == 0:
			ans = totalfood // N
		else:
			ans = totalfood // N + 1
		if ans <= buyingdays:
			return ans
		else:
			return -1


from math import ceil

class Solution:

	def minimumDays(self, S, N, M):
		total_food = S * M
		buying_days = S - S // 7
		days = ceil(total_food / N)
		if days <= buying_days:
			return days
		else:
			return -1


class Solution:

	def minimumDays(self, S, N, M):
		sun = S // 7
		buying_day = S - sun
		if N < M:
			return -1
		f = S * M
		if f % N == 0:
			d = f // N
		else:
			d = f // N + 1
		if d > buying_day:
			return -1
		return d


class Solution:

	def minimumDays(self, S, N, M):
		no_of_sunday = S // 7
		if (S - no_of_sunday) * N < S * M:
			return -1
		elif S * M % N == 0:
			return S * M // N
		else:
			return S * M // N + 1


class Solution:

	def minimumDays(self, S, N, M):
		sun = S // 7
		buy = S - sun
		ans = 0
		if M > N:
			return -1
		total = S * M
		if total % N == 0:
			ans = total // N
		else:
			ans = total // N + 1
		if ans <= buy:
			return ans
		else:
			return -1


import math

class Solution:

	def minimumDays(self, S, N, M):
		if M > N or (7 * M > 6 * N and S > 6):
			return -1
		else:
			return math.ceil(S * M / N)


class Solution:

	def minimumDays(self, S, N, M):
		if M > N:
			return -1
		elif S > 6:
			if 7 * M > 6 * N:
				return -1
			else:
				tot = S * M // N
				if S * M % N != 0:
					tot = tot + 1
				return tot
		else:
			tot = S * M // N
			if S * M % N != 0:
				tot = tot + 1
			return tot


class Solution:

	def minimumDays(self, S, N, M):
		if N < M:
			return -1
		total_food = S * M
		buying_days = S - S // 7
		if total_food % N == 0:
			days = total_food // N
		else:
			days = total_food // N + 1
		if days <= buying_days:
			return days
		else:
			return -1


class Solution:

	def minimumDays(self, S, N, M):
		if M > N:
			return -1
		total_sundays = S // 7
		buying_days = S - total_sundays
		total_food = S * M
		ans = 0
		if total_food % N == 0:
			ans = total_food // N
		else:
			ans = total_food // N + 1
		if ans <= buying_days:
			return ans
		return -1


class Solution:

	def minimumDays(self, S, N, M):
		if M > N:
			return -1
		if S > 6 and N * 6 < M * 7:
			return -1
		else:
			days = S * M // N
			if S * M % N != 0:
				days += 1
			return days


class Solution:

	def minimumDays(self, S, N, M):
		sunday = S // 7
		buy_days = S - sunday
		ans = 0
		stock = S * M
		if stock % N == 0:
			ans = stock // N
		else:
			ans = stock // N + 1
		if ans <= buy_days:
			return ans
		else:
			return -1


def min_survival_days(days_to_survive, food_given_each_day, food_need_each_day):
	if food_given_each_day < food_need_each_day:
		return -1
	left_each_day = food_given_each_day % food_need_each_day
	if left_each_day * 6 < food_need_each_day and int(food_given_each_day // food_need_each_day) == 1 and (days_to_survive > 6):
		return -1
	one_unit_days = food_given_each_day / food_need_each_day
	if days_to_survive % one_unit_days == 0:
		return int(days_to_survive // one_unit_days)
	else:
		return 1 + int(days_to_survive // one_unit_days)

class Solution:

	def minimumDays(self, S, N, M):
		return min_survival_days(S, N, M)


import math

class Solution:

	def minimumDays(self, S, N, M):
		p = S // 7
		if N * (S - p) < S * M:
			return -1
		return math.ceil(S * M / N)


class Solution:

	def minimumDays(self, S, N, M):
		sun = S // 7
		by = S - sun
		ans = 0
		if S * M % N == 0:
			an = S * M // N
		else:
			an = S * M // N + 1
		if an <= by:
			return an
		else:
			return -1


class Solution:

	def minimumDays(self, S, N, M):
		if N < M:
			return -1
		if S < 7:
			return M * S // N + bool(M * S % N)
		if 6 * N >= 7 * M:
			return M * S // N + bool(M * S % N)
		return -1


class Solution:

	def minimumDays(self, s, n, m):
		import numpy
		ans = 0
		food_req = S * M
		max_food = (S - S // 7) * N
		if food_req > max_food:
			return -1
		ans = int(numpy.ceil(food_req / N))
		return ans


from math import ceil

class Solution:

	def minimumDays(self, S, N, M):
		totalfoodreq = S * M
		if (S - S // 7) * N < totalfoodreq:
			return -1
		else:
			return ceil(totalfoodreq / N)


import math

class Solution:

	def minimumDays(self, S, N, M):
		if N < M:
			return -1
		req_food = S * M
		check = 0
		ans = 0
		i = 1
		while i <= S and check < req_food:
			check += N
			ans += 1
			if i % 6 == 0:
				i += 1
			i += 1
		if check >= req_food:
			return ans
		return -1


import math

class Solution:

	def minimumDays(self, S, N, M):
		ans = 0
		food_req = S * M
		max_food = (S - S // 7) * N
		if food_req > max_food:
			return -1
		ans = math.ceil(food_req / N)
		return ans


import math

class Solution:

	def minimumDays(self, S, N, M):
		food_tot = S * M
		buy_days = S - S // 7
		buy_food = buy_days * N
		if food_tot > buy_food:
			return -1
		else:
			return int(math.ceil(food_tot / N))


class Solution:

	def minimumDays(self, S, N, M):
		days = S - S // 7
		foodRequired = S * M
		dayToSurvived = foodRequired // N
		if foodRequired % N != 0:
			dayToSurvived += 1
		if dayToSurvived > days:
			return -1
		return dayToSurvived


class Solution:

	def minimumDays(self, S, N, M):
		sun = S // 7
		shop_open = S - sun
		food_req = M * S
		food_avail = shop_open * N
		if food_req > food_avail:
			return -1
		days = food_req // N
		if food_req % N != 0:
			days += 1
		return days


import math

class Solution:

	def minimumDays(self, S, N, M):
		num_sundays = math.floor(S / 7)
		if M > N or M * S > (S - num_sundays) * N:
			return -1
		return math.ceil(S * M / N)


class Solution:

	def minimumDays(self, S, N, M):
		sundays = S // 7
		buying_days = S - sundays
		food_required = S * M
		ans = 0
		if food_required % N == 0:
			ans = food_required // N
		else:
			ans = food_required // N + 1
		if ans <= buying_days:
			return ans
		else:
			return -1


import math

class Solution:

	def minimumDays(self, S, N, M):
		mancare_necesara = S * M
		zile = S - S // 7
		mancare_cumparata = zile * N
		if mancare_necesara > mancare_cumparata:
			return -1
		return int(math.ceil(mancare_necesara / N))


import math

class Solution:

	def minimumDays(self, S, N, M):
		totalFoodRequired = S * M
		shopOpenDays = S - S // 7
		availableFood = shopOpenDays * N
		if totalFoodRequired > availableFood:
			return -1
		return math.ceil(totalFoodRequired / N)


import math

class Solution:

	def minimumDays(self, s, n, m):
		food_required = s * m
		days = s - s // 7
		food_bought = n * days
		if food_required > food_bought:
			return -1
		else:
			return math.ceil(s * m / n)


class Solution:

	def minimumDays(self, S, N, M):
		if M > N:
			return -1
		n = S // 7
		k = S - n
		if k * N < S * M:
			return -1
		if N == M and S >= 7:
			return -1
		s = S * M
		if s % N == 0:
			return s // N
		else:
			return s // N + 1


import math

class Solution:

	def minimumDays(self, s, n, m):
		total_food_required = S * M
		aval_days = S - S // 7
		food_bought = aval_days * N
		if total_food_required > food_bought:
			return -1
		return int(math.ceil(total_food_required / N))


import math

class Solution:

	def minimumDays(self, S, N, M):
		if M > N or (6 * N < 7 * M and S > 6):
			return -1
		req = S * M
		fpw = N * 6
		weeks = req // fpw
		food = req - weeks * fpw
		days = math.ceil(food / N) + weeks * 6
		return days


import math

class Solution:

	def minimumDays(self, S, N, M):
		total_days = S * M
		a = S - S // 7
		f = a * N
		if total_days > f:
			return -1
		return int(math.ceil(total_days / N))


import math

class Solution:

	def minimumDays(self, S, N, M):
		req = S * M
		days = S - S // 7
		food = days * N
		if req > food:
			return -1
		return math.ceil(req / N)


import math

class Solution:

	def minimumDays(self, S, N, M):
		days_open = S - S // 7
		food_can_be_bought = days_open * N
		food_required = S * M
		if food_can_be_bought < food_required:
			return -1
		else:
			return math.ceil(food_required / N)


import math

class Solution:

	def minimumDays(self, S, N, M):
		if N < M:
			return -1
		if S > 6 and 6 * N < 7 * M:
			return -1
		foodRequired = S * M
		if foodRequired % N == 0:
			return foodRequired // N
		return foodRequired // N + 1


import math

class Solution:

	def minimumDays(self, S, N, M):
		a = S * M
		d = S - S // 7
		av = d * N
		p = math.ceil(a / N)
		if a > av:
			return -1
		else:
			return p


import math

class Solution:

	def minimumDays(self, S, N, M):
		if M > N:
			return -1
		if S > 6 and (N - M) * 6 < M:
			return -1
		return math.ceil(S * M / N)


class Solution:

	def minimumDays(self, S, N, M):
		if N < M:
			return -1
		if N == M and S > 6:
			return -1
		if 6 * N < 7 * M and S > 6:
			return -1
		c = 0
		i = 0
		j = 0
		while i < S:
			j += 1
			if j % 7 == 0:
				continue
			i += N / M
			c += 1
		return c


import math

class Solution:

	def minimumDays(self, S, N, M):
		tf = S * M
		ad = S - S // 7
		fb = ad * N
		if tf > fb:
			return -1
		return int(math.ceil(tf / N))


class Solution:

	def minimumDays(self, S, N, M):
		if M > N:
			return -1
		sun = S // 7
		b = S - sun
		if M > N:
			return -1
		x = S * M
		if x % N == 0:
			ans = x // N
		else:
			ans = x // N + 1
		if ans <= b:
			return ans
		return -1


class Solution:

	def minimumDays(self, S, N, M):
		if M > N:
			return -1
		ans = 0
		y = S - S // 7
		if S * M % N == 0:
			ans = S * M // N
		else:
			ans = S * M // N + 1
		if ans <= y:
			return ans
		else:
			return -1


import math

class Solution:

	def minimumDays(self, S, N, M):
		total_food_need = S * M
		available_days = S - S // 7
		food_buy = available_days * N
		if total_food_need > food_buy:
			return -1
		return int(math.ceil(total_food_need / N))


import math

class Solution:

	def minimumDays(self, S, N, M):
		c = S * M
		if (S - S // 7) * N < c:
			return -1
		else:
			return math.ceil(c / N)


from math import ceil

class Solution:

	def minimumDays(self, S, N, M):
		r = S * M
		if M > N:
			return -1
		if S > 6 and (N - M) * 6 < M:
			return -1
		else:
			return ceil(r / N)