Python (Use collections.deque instead of queue.Queue) NO TLE( BFS/PriorityQueue)
Runtime: 5734 ms, faster than 79.53% of Python3 online submissions for Cut Off Trees for Golf Event.\nMemory Usage: 14.4 MB, less than 96.34% of Python3 online 
Runtime: 5734 ms, faster than 79.53% of Python3 online submissions for Cut Off Trees for Golf Event.\nMemory Usage: 14.4 MB, less than 96.34% of Python3 online submissions for Cut Off Trees for Golf Event.\n\nI was using queue.Queue() and got TLE, replaced that with collections.deque and reduced time from TLE to 2000 ms\n```\nfrom queue import Queue\nclass Solution:\n    # returns sorted trees by height\n    def get_priority(self, forest):\n        m, n = len(forest), len(forest[0])\n        priority = []\n        for r in range(m):\n            for c in range(n):\n                v = forest[r][c]\n                if v > 1:\n                    priority.append((v)) \n        priority.sort()\n        return priority\n        \n    def cutOffTree(self, forest: List[List[int]]) -> int:\n        n = len(forest)\n        m = len(forest[0])\n        priority = self.get_priority(forest)\n        steps = 0\n        \n        i,j = 0, 0\n\t\t# next tree in line\n        for node in priority:\n            to_find =node \n            visited = [[0]*m for _ in range(n)]\n            q = collections.deque([(i, j, steps)])\n            q.append((i,j, steps))\n            found = False # if found is False that means blocked by 0s\n            while q:\n                i, j, steps = q.popleft()\n                if forest[i][j] == to_find: # Tree found so move to next tree\n                    found = True\n                    break\n                \n                if forest[i][j] == 0: # Skip 0s\n                    continue\n                if i + 1 < n and forest[i+1][j] !=0 and not visited[i+1][j]:\n                    q.append((i+1, j, steps+1))\n                    visited[i+1][j]= 1\n                if i - 1 >= 0 and forest[i-1][j] !=0 and  not visited[i-1][j]:\n                    q.append((i-1, j, steps+1))\n                    visited[i-1][j]= 1\n                if j + 1 < m and forest[i][j+1] !=0 and not  visited[i][j+1]:\n                    q.append((i, j + 1, steps+1))\n                    visited[i][j+1]= 1\n                if j - 1 >= 0 and forest[i][j-1] !=0 and not visited[i][j-1]:\n                    q.append((i, j-1, steps+1))\n                    visited[i][j-1]= 1\n            \n            if not found: return -1\n        return steps \n        \n```
[]