It’s time to find out which player is consistent in cricket. You need to calculate the average of a player based on his score. Player average is defined as total runs scored by a player in N matches divided by the number of matches in which he gets out.
 
Example 1:
Input: run = {10, 101, 49}, 
status = {"out", "notout", "out"}
Output: 80
Explanation: Total run = 10 + 101 + 49 = 160.
2 times the player gets out.
So, Average = 160 / 2 = 80.
Example 2:
Input: run = {6, 67, 5}, status = {"notout", 
"notout", "notout"}.
Output: -1
Explanation: Not possible to determine average.
 
Your Task:
You don't need to read or print anything. Your task is to complete the function Average() which takes a list of runs and a list of status of the player in every match and retruns ceil value of the average. If not possible returns -1.
 
Expected Time Complexity: O(n) where n is the number of matches 
Expected Space Complexity: O(1)
 
Constraints:
1 <= No. of matches <= 500
1 <= run scored in every match <= 300

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(n) where n is the number of matches
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
	def Average(self, run, status):
		# Code here

Solutions:
import math

class Solution:

	def Average(self, run, status):
		total_runs = sum(run)
		if 'out' not in status:
			return -1
		else:
			count_out = status.count('out')
			return math.ceil(total_runs / count_out)


class Solution:

	def Average(self, run, status):
		import math
		s = sum(run)
		c = status.count('out')
		if c == 0:
			return -1
		else:
			k = s / c
			if k == int(k):
				return int(k)
			elif k > int(k):
				return int(k) + 1


class Solution:

	def Average(self, run, status):
		import math
		x = sum(run)
		y = status.count('out')
		if y == 0:
			return -1
		else:
			return math.ceil(x / y)


from math import ceil

class Solution:

	def Average(self, run, status):
		runs = sum(run)
		div = status.count('out')
		return ceil(runs / div) if div != 0 else -1


import math

class Solution:

	def Average(self, run, status):
		nt = 0
		ot = 0
		x = sum(run)
		for i in status:
			if i == 'out':
				ot += 1
			else:
				nt += 1
		if ot == 0:
			return -1
		return math.ceil(x / ot)


import math

class Solution:

	def Average(self, run, status):
		avg = 0.0
		count = 0
		for i in range(len(run)):
			if status[i] == 'out':
				count = count + 1
			avg = avg + run[i]
		if count == 0:
			return -1
		return math.ceil(avg / count)


import math

class Solution:

	def Average(self, run, status):
		c = 0
		for i in status:
			if i == 'out':
				c = c + 1
		if c == 0:
			return -1
		return math.ceil(sum(run) / c)


import math

class Solution:

	def Average(self, run, status):
		tot = sum(run)
		c = status.count('out')
		if c == 0:
			return -1
		return math.ceil(tot / c)
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		n = int(input())
		run = []
		status = []
		for _ in range(n):
			(r, s) = input().split()
			run.append(int(r))
			status.append(s)
		ob = Solution()
		ans = ob.Average(run, status)
		print(ans)


class Solution:

	def Average(self, run, status):
		import math as m
		ans = 0
		x = 0
		for i in range(len(run)):
			if status[i] == 'out':
				ans += run[i]
				x += 1
			else:
				ans += run[i]
		if x == 0:
			return -1
		return m.ceil(ans / x)