Television sets question in mockvita
this code worked for the public test cases, but it is not working for the private ones
please help anyone
import sys
def revenue (no_rooms,high_cost,low_cost,tv,patients):
wtv=no_rooms-tv
rev=0
for i in range (0,len(patients)):
if (i <= wtv):
rev+=ipatients[i]low_cost
elif (i>wtv):
rev+=wtvlow_costpatients[i]+(i-wtv)high_costpatients[i]
return rev
no_rooms=(sys.stdin.readline().strip())
if (no_rooms.isdigit()):
no_rooms=int(no_rooms)
s =sys.stdin.readline().split()
high_cost = s[0]
low_cost = s[1]
if (high_cost.isdigit() and low_cost.isdigit()):
high_cost=int(high_cost)
low_cost=int(low_cost)
yearly_target = sys.stdin.readline().strip()
if (yearly_target.isdigit()):
yearly_target = int(yearly_target)
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
patients = [0] * min(no_rooms + 1, 52 + 1)
for m in range(0, len(days)):
for d in range(0, days[m]):
p = (m - 6) ** 2 + abs(d - 15)
if (p > no_rooms):
patients[no_rooms] += 1
else:
patients[p] += 1
boll = False
for tv in range(0, no_rooms):
if (high_cost == low_cost):
if (revenue(no_rooms, high_cost, low_cost, tv, patients) >=yearly_target):
lk = 0
boll = True
break
kr = revenue(no_rooms, high_cost, low_cost, tv, patients)
if (kr >= yearly_target):
lk = tv
boll = True
break
if (boll == True):
print(lk)
else:
print(no_rooms)