import numpy as np
import torch

def add(x, y, K):
    """
    x: vector of size (n) with entries in (0,...,K-1)
    y: vector of size (n) with entries in (0,...,K-1)
    K: mod parameter

    Returns:
        x + y (mod K)
    """

    return (x + y) % K