<garvit244>1277_1.py
def countSquares( matrix):
    p_arr = [[0 for i in range(len(matrix[0]))] for j in range(len(matrix))]  
    result = 0
    
    for index_i in range(1, len(matrix)):
        for index_j in range(1, len(matrix[0])):
            if matrix[index_i][index_j] == 1:
                matrix[index_i][index_j] = min(matrix[index_i-1][index_j-1], min(matrix[index_i-1][index_j], matrix[index_i][index_j-1]))+1
    return sum([ sum(x) for x in matrix])
def sample_funcname ( var_0 ) :
    var_6 = [ [ 0 for var_2 in range ( len ( var_0 [ 0 ] ) ) ] for var_5 in range ( len ( var_0 ) ) ]
    var_7 = 0
    for var_9 in range ( 1 , len ( var_0 ) ) :
        for var_10 in range ( 1 , len ( var_0 [ 0 ] ) ) :
            if var_0 [ var_9 ] [ var_10 ] == 1 :
                var_0 [ var_9 ] [ var_10 ] = min ( var_0 [ var_9 - 1 ] [ var_10 - 1 ] , min ( var_0 [ var_9 - 1 ] [ var_10 ] , var_0 [ var_9 ] [ var_10 - 1 ] ) ) + 1
    return sum ( [ sum ( var_13 ) for var_13 in var_0 ] )
