from typing import Any


def hr_at_k(actual: Any, predicted: Any, k: int = 10) -> float:
    """Compute hit rate, hr@k.

    Parameters
    ----------
    actual : Any
        Label.
    predicted : Any
        Predictions.
    k : int, optional
        k, by default ``12``.

    Returns
    -------
    float
        hr@k.
    """
    count = 0
    for i, actual_i in enumerate(actual):
        for p in predicted[i][:k]:
            if p in actual_i:
                count += 1
                break
    return count / len(actual)