import math


def out_size(dim_in, k, s, p, d):
    """Calculates the resulting size after a convolutional layer.
    
    Args:
        dim_in (int): Input dimension size.
        k (int): Kernel size.
        s (int): Stride of convolution.
        p (int): Padding (of input).
        d (int): Dilation
    """
    return math.floor((dim_in + 2 * p - d * (k - 1) - 1) / s + 1)