"""
https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance/

"""
from typing import List


class Solution:
    def filterRestaurants(self, restaurants: List[List[int]], veganFriendly: int, maxPrice: int, maxDistance: int) -> List[int]:

        data = []
        for _id, rating, vegan, price, distance in restaurants:
            if price <= maxPrice and distance <= maxDistance:
                if veganFriendly:
                    if vegan:
                        data.append((rating, _id))
                else:
                    data.append((rating, _id))

        data.sort(reverse=True)
        return [_id for rating, _id in data]

ca8f21d148759538c0eba1f98e01e6c7c1ad73b7
<mask token>

<mask token>


class Solution:
    <mask token>

<mask token>


class Solution:

    def filterRestaurants(self, restaurants: List[List[int]], veganFriendly:
        int, maxPrice: int, maxDistance: int) ->List[int]:
        data = []
        for _id, rating, vegan, price, distance in restaurants:
            if price <= maxPrice and distance <= maxDistance:
                if veganFriendly:
                    if vegan:
                        data.append((rating, _id))
                else:
                    data.append((rating, _id))
        data.sort(reverse=True)
        return [_id for rating, _id in data]

<mask token>
from typing import List


class Solution:

    def filterRestaurants(self, restaurants: List[List[int]], veganFriendly:
        int, maxPrice: int, maxDistance: int) ->List[int]:
        data = []
        for _id, rating, vegan, price, distance in restaurants:
            if price <= maxPrice and distance <= maxDistance:
                if veganFriendly:
                    if vegan:
                        data.append((rating, _id))
                else:
                    data.append((rating, _id))
        data.sort(reverse=True)
        return [_id for rating, _id in data]

"""
https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance/

"""
from typing import List


class Solution:
    def filterRestaurants(self, restaurants: List[List[int]], veganFriendly: int, maxPrice: int, maxDistance: int) -> List[int]:

        data = []
        for _id, rating, vegan, price, distance in restaurants:
            if price <= maxPrice and distance <= maxDistance:
                if veganFriendly:
                    if vegan:
                        data.append((rating, _id))
                else:
                    data.append((rating, _id))

        data.sort(reverse=True)
        return [_id for rating, _id in data]
