def METHOD_NAME(y, d, D, s):
    """Applies differencing and seasonal differencing to the data"""
    n_obs, batch_size = y.shape
    s1 = s if D else (1 if d else 0)
    s2 = 1 if d + D == 2 else 0
    y_diff = np.zeros((n_obs - d - s * D, batch_size), dtype=y.dtype)
    for i in range(batch_size):
        temp = y[s1:, i] - y[:-s1, i] if s1 else y[:, i]
        y_diff[:, i] = temp[s2:] - temp[:-s2] if s2 else temp[:]
    return y_diff