Problem:
You are passionate about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use the income to grow the ranch. You wanted to grow your field quickly. Therefore, we decided to start by arranging the crops that can be grown in the game based on their income efficiency per hour. You have to buy seeds to grow crops. Here the species name of crop i is given by Li and the price by Pi. When a seed is planted in a field, it sprouts after time Ai. Young leaves emerge after time Bi from the emergence of buds. Leaves grow thick after time Ci from the emergence of young leaves. After the time Di has passed since the leaves grow thick, the flowers bloom. After the time Ei after the flower blooms, the fruit is formed. One seed produces Fi seeds, and each of these seeds can be sold at a price of Si. Some crops are multi-season crops and produce Mi crops in total. Mi = 1 for single cropping. Multi-season crops return to leaves after fruiting until Mi th fruiting. The income for a seed is the amount of money sold for all the fruit of that seed minus the price of the seed. In addition, the income efficiency of the seed is the value obtained by dividing the income by the time from planting the seed until all fruits are produced. Your task is to write a program that takes the input crop information and sorts it in descending order of income efficiency.

Incorrect submission (verdict: Wrong Answer):
resultss = []
while True:
    N = int(input())
    if N == 0:
        break
       
    B = [list(map(str, input().split())) for _ in range(N)]
    results = []
    for i in range(N):
        A = []
        name = B[i][0]
        B[i][0] = B[i][1]
        for j in range(10):
            A.append(int(B[i][j]))
            
        if A[-1] == 1:
            time = A[2] + A[3] + A[4] + A[5] + A[6]
            money = A[7] * A[8]
            res = money - A[1]
            res /= time
            
        else:
            time = A[2] + A[3] + A[4] + A[5] + A[6] + (A[5] + A[6]) * (A[-1] - 1)
            money = A[7] * A[8] * A[-1]
            res = money - A[1]
            res /= time
            
        results.append([res, name])
        
    tmp = results[0][0]
    flag =False
    for i in range(len(results)):
        if results[i][0] != tmp:
            flag = True
      
    if flag:
        results.sort()
    else:
        results = sorted(results, key=lambda x: x[1], reverse=True)
    resultss.append(results)
    
for i in range(len(resultss)):
    for j in range(len(resultss[i])):
        print(resultss[i][-j-1][1])
    print('#')


Fixed, accepted submission:
resultss = []
while True:
    N = int(input())
    if N == 0:
        break
       
    B = [list(map(str, input().split())) for _ in range(N)]
    results = []
    for i in range(N):
        A = []
        name = B[i][0]
        B[i][0] = B[i][1]
        for j in range(10):
            A.append(int(B[i][j]))
            
        if A[-1] == 1:
            time = A[2] + A[3] + A[4] + A[5] + A[6]
            money = A[7] * A[8]
            res = money - A[1]
            res /= time
            
        else:
            time = A[2] + A[3] + A[4] + A[5] + A[6] + (A[5] + A[6]) * (A[-1] - 1)
            money = A[7] * A[8] * A[-1]
            res = money - A[1]
            res /= time
            
        results.append([res, name])
        
      
    results = sorted(results, key=lambda x: x[1], reverse = True)
    
    results = sorted(results, key=lambda x: x[0])
        
    resultss.append(results)
    
for i in range(len(resultss)):
    for j in range(len(resultss[i])):
        print(resultss[i][-j-1][1])
    print('#')