<commit_before>package datastructures;

/** Allows for efficient union/find operations. */
public class DisjointSetForest {
    private final int[] forest;

    /**
     * Creates a disjoint set forest made up of n disjoint sets.
     *
     * @throws IllegalArgumentException if n is negative
     */
    public DisjointSetForest(int n) {
        if (n < 0) {
            throw new IllegalArgumentException("n must be nonnegative");
        }
        forest = new int[n];
        for (int i = 0; i < n; ++i) {
            forest[i] = -1;
        }
    }

    /**
     * Returns the set representative of a given element.
     *
     * @throws IndexOutOfBoundsException if x is outside the range [0, n)
     */
    public int find(int x) {
        if (x < 0 || x >= forest.length) {
            throw new IndexOutOfBoundsException(String.valueOf(x));
        }
        int root = x;
        int current = forest[x];
        while (current >= 0) {
            root = current;
            current = forest[current];
        }
        /* Performs path compression. */
        current = x;
        while (current != root) {
            int old = current;<commit_msg>Edited<commit_after>package datastructures;

/** Allows for efficient union/find operations. */
public class DisjointSetForest {
    private final int[] forest;

    /**
     * Creates a disjoint set forest made up of n disjoint sets.
     *
     * @throws IllegalArgumentException if n is negative
     */
    public DisjointSetForest(int n) {
        if (n < 0) {
            throw new IllegalArgumentException("n must not be negative");
        }
        forest = new int[n];
        for (int i = 0; i < n; ++i) {
            forest[i] = -1;
        }
    }

    /**
     * Returns the set representative of a given element.
     *
     * @throws IndexOutOfBoundsException if x is outside the range [0, n)
     */
    public int find(int x) {
        if (x < 0 || x >= forest.length) {
            throw new IndexOutOfBoundsException(String.valueOf(x));
        }
        int root = x;
        int current = forest[x];
        while (current >= 0) {
            root = current;
            current = forest[current];
        }
        /* Performs path compression. */
        current = x;
        while (current != root) {
            int old = current;
{'fraction_non_alphanumeric': 0.10526315789473684, 'fraction_numerical': 0.005176876617773943, 'mean_word_length': 1.7673031026252983, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5888400', 'n_tokens_mistral': 654, 'n_tokens_neox': 633, 'n_words': 218}