def fill_missing_day(all_loc_rec, k):
    """
    For any location (L) in any day, see the next k days.
    If in these k days, there is >= 1 day when this person appears in L,
    then fill the gaps with L.
    """
    result_dict = {}
    for loc in all_loc_rec.keys():
        loc_date = all_loc_rec[loc]
        loc_date.sort()
        new_loc_date = list(loc_date)
        if len(loc_date) > 1:
            for i, date in enumerate(loc_date[:-1]):
                close_date = loc_date[i + 1]
                date_diff = close_date - date
                if 1 < date_diff <= k:
                    new_loc_date += range(date + 1, close_date)
        new_loc_date.sort()
        result_dict[loc] = new_loc_date
    return result_dict
