Smart Phone

coz they will be paying 30 and not 30 or 54
you need to get price that all the customers will pay
revenue = price * customers that buy them
customers only buy them if price is lower or equal to their expectations

i have done this according to your explanation but still its showing partially correct.

code given below

num = int(input())
budget = []
while num>0:
b = int(input())
budget.append(b)
num-=1

revenue = [];
for price in budget:
r=0
for i in budget:
if i>=price:
r += price
revenue.append®

revenue.sort()

print(revenue[-1])

n = int(input())

inp = []

for i in range(n):

inp.append(int(input()))

inp.sort()

def smart(n , inp):

minm = []

for j in range(n):

    if minm == None:
        minm = inp[j]*(n-j)
    else:
        minm.append(inp[j]*(n-j))
return max(minm)

print(smart(n, inp))