const students = [
{name: "Ivan", estimate: 4, course: 1, active: true},
{name: "Petr", estimate: 3, course: 1, active: false},
{name: "Alex", estimate: 2, course: 4, active: false},
{name: "Max", estimate: 5, course: 2, active: true},
{name: "Anton", estimate: 4, course: 3, active: true},
{name: "Roman", estimate: 3, course: 2, active: false},
{name: "Vladimir", estimate: 4, course: 4, active: true},
{name: "Oleg", estimate: 5, course: 3, active: true},
];
let res = students.reduce( (ac, {course, active}) => {
ac[course] = (ac[course]||0) + !active ;
return ac;
}, {});
console.log(res)