Minimum number of additions to cover all In a special batch of N students, which focuses on competit

import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt(); // Number of students
    int M = scanner.nextInt(); // Number of teaching assistants
    int K = scanner.nextInt(); // Range of coverage

    int[] taPositions = new int[M];
    for (int i = 0; i < M; i++) {
        taPositions[i] = scanner.nextInt();
    }

    Arrays.sort(taPositions);

    boolean[] studentCoverage = new boolean[N + 1];
    int uncoveredStudents = N; // Initially, all students are uncovered

    for (int i = 0; i < M; i++) {
        int coveredRangeStart = Math.max(1, taPositions[i] - K);
        int coveredRangeEnd = Math.min(N, taPositions[i] + K);

        for (int j = coveredRangeStart; j <= coveredRangeEnd; j++) {
            if (!studentCoverage[j]) {
                studentCoverage[j] = true;
                uncoveredStudents--;
            }
        }
    }

    // Calculate the number of additional TAs needed
    int additionalTAs = (uncoveredStudents + 2 * K) / (2 * K + 1);

    System.out.println(additionalTAs);

    scanner.close();
}

}

some test cases are failing some are right