class Solution:
    """
    @param obstacleGrid: An list of lists of integers
    @return: An integer
    """
    def uniquePathsWithObstacles(self, obstacleGrid):
        # write your code here

        m=len(obstacleGrid)
        n=len(obstacleGrid[0])

        res=[[0 for i in range(n)] for j in range(m)]

        for i in range(m):
            if obstacleGrid[i][0]==0:
                res[i][0]=1
            else:
                res[i][0]=0
                break
        for i in range(n):
            if obstacleGrid[0][i]==0:
                res[0][i]=1
            else:
                res[0][i]=0
                break

        for i in range(1,m):
            for j in range(1,n):
                if obstacleGrid[i][j]==1:
                    res[i][j]=0
                else:
                    res[i][j]=res[i-1][j]+res[i][j-1]

        return res[m-1][n-1]
8a566854db1b2e6613b9f7bc5fddefd85cb10c43
<mask token>

class Solution:
    <mask token>
    <mask token>

class Solution:
    <mask token>

    def uniquePathsWithObstacles(self, obstacleGrid):
        m = len(obstacleGrid)
        n = len(obstacleGrid[0])
        res = [[(0) for i in range(n)] for j in range(m)]
        for i in range(m):
            if obstacleGrid[i][0] == 0:
                res[i][0] = 1
            else:
                res[i][0] = 0
                break
        for i in range(n):
            if obstacleGrid[0][i] == 0:
                res[0][i] = 1
            else:
                res[0][i] = 0
                break
        for i in range(1, m):
            for j in range(1, n):
                if obstacleGrid[i][j] == 1:
                    res[i][j] = 0
                else:
                    res[i][j] = res[i - 1][j] + res[i][j - 1]
        return res[m - 1][n - 1]

class Solution:
    """
    @param obstacleGrid: An list of lists of integers
    @return: An integer
    """

    def uniquePathsWithObstacles(self, obstacleGrid):
        m = len(obstacleGrid)
        n = len(obstacleGrid[0])
        res = [[(0) for i in range(n)] for j in range(m)]
        for i in range(m):
            if obstacleGrid[i][0] == 0:
                res[i][0] = 1
            else:
                res[i][0] = 0
                break
        for i in range(n):
            if obstacleGrid[0][i] == 0:
                res[0][i] = 1
            else:
                res[0][i] = 0
                break
        for i in range(1, m):
            for j in range(1, n):
                if obstacleGrid[i][j] == 1:
                    res[i][j] = 0
                else:
                    res[i][j] = res[i - 1][j] + res[i][j - 1]
        return res[m - 1][n - 1]

class Solution:
    """
    @param obstacleGrid: An list of lists of integers
    @return: An integer
    """
    def uniquePathsWithObstacles(self, obstacleGrid):
        # write your code here

        m=len(obstacleGrid)
        n=len(obstacleGrid[0])

        res=[[0 for i in range(n)] for j in range(m)]

        for i in range(m):
            if obstacleGrid[i][0]==0:
                res[i][0]=1
            else:
                res[i][0]=0
                break
        for i in range(n):
            if obstacleGrid[0][i]==0:
                res[0][i]=1
            else:
                res[0][i]=0
                break

        for i in range(1,m):
            for j in range(1,n):
                if obstacleGrid[i][j]==1:
                    res[i][j]=0
                else:
                    res[i][j]=res[i-1][j]+res[i][j-1]

        return res[m-1][n-1]