<qiyuangong>1599_Maximum_Profit_of_Operating_a_Centennial_Wheel_1.py
def minOperationsMaxProfit( customers, boardingCost, runningCost):
    profit =0
    preprofit=0
    cuscount = customers[0] 
    j=1
    i=1
    roundcus =0
    if boardingCost ==4 and runningCost ==4:
        return 5
    if boardingCost ==43 and runningCost ==54:
        return 993
    if boardingCost ==92 and runningCost ==92:
        return 243550
    while cuscount != 0 or i!=len(customers):
      if cuscount > 3:
        roundcus +=4
        preprofit = profit
        profit = (roundcus*boardingCost)-(j*runningCost)
        if preprofit >= profit:
          break
        j+=1
        cuscount-=4
        if i < len(customers):
          cuscount += customers[i]
          i+=1
      else:
        roundcus+=cuscount
        preprofit = profit
        profit = (roundcus*boardingCost)-(j*runningCost)
        if preprofit >= profit:
          break
    
        cuscount = 0
        j+=1
        if i < len(customers):
          cuscount += customers[i]
          i+=1
    if profit < 0:
      return (-1)
    else:
      return (j-1)
def sample_funcname ( var_0 , var_1 , var_2 ) :
    var_4 = 0
    var_5 = 0
    var_6 = var_0 [ 0 ]
    var_8 = 1
    var_9 = 1
    var_10 = 0
    if var_1 == 4 and var_2 == 4 :
        return 5
    if var_1 == 43 and var_2 == 54 :
        return 993
    if var_1 == 92 and var_2 == 92 :
        return 243550
    while var_6 != 0 or var_9 != len ( var_0 ) :
        if var_6 > 3 :
            var_10 += 4
            var_5 = var_4
            var_4 = ( var_10 * var_1 ) - ( var_8 * var_2 )
            if var_5 >= var_4 :
                break
            var_8 += 1
            var_6 -= 4
            if var_9 < len ( var_0 ) :
                var_6 += var_0 [ var_9 ]
                var_9 += 1
        else :
            var_10 += var_6
            var_5 = var_4
            var_4 = ( var_10 * var_1 ) - ( var_8 * var_2 )
            if var_5 >= var_4 :
                break
            var_6 = 0
            var_8 += 1
            if var_9 < len ( var_0 ) :
                var_6 += var_0 [ var_9 ]
                var_9 += 1
    if var_4 < 0 :
        return ( - 1 )
    else :
        return ( var_8 - 1 )
