<reponame>hippieZhou/The-Way-Of-LeetCode<gh_stars>0
class Solution:
    def lemonadeChange(self, bills: list) -> bool:
        five = ten = 0
        for i in bills:
            if i == 5:
                five += 1
            elif i == 10:
                five, ten = five - 1, ten + 1
            elif ten > 0:
                five, ten = five - 1, ten - 1
            else:
                five -= 3

            if five < 0:
                return False
        return True

class Solution:
    def lemonadeChange(self, bills: list) -> bool:
        five = ten = 0
        for i in bills:
            if i == 5:
                five += 1
            elif i == 10:
                five, ten = five - 1, ten + 1
            elif ten > 0:
                five, ten = five - 1, ten - 1
            else:
                five -= 3

            if five < 0:
                return False
        return True