#include <bits/stdc++.h>

using namespace std;

// khai bao
    struct record {
        string ho_ten = {};
        int sb_nghi = 0;
        float g_ky = 0, c_can = 0, c_ky = 0,avg = 0;
        bool status = true;
    };
    record sv_record[51];
    int i,slsv = -1;
// ==================

void inp(){
    while ((slsv < 0) || (slsv > 50)){
        cout << "Nhap so luong sinh vien: ";
        cin >> slsv;
        if ((slsv < 0) || (slsv > 50)){
            cout << "So luong sinh vien phai >-1 va <51" << '\n';
        }
    }
    for (i = 0 ; i < slsv ; i++){
        system("cls");
        cout << "Ho va ten sv " << i + 1 << " ";
        std::fflush(stdin);
        getline(std::cin, sv_record[i].ho_ten);
        cout << "So buoi nghi hoc sv " << i + 1 << " ";
        cin >> sv_record[i].sb_nghi;
        if (sv_record[i].sb_nghi >= 5){
            sv_record[i].status = false;
            sv_record[i].avg = -1;
            continue;
        }
        cout << "Diem giua ki sv " << i + 1 << " ";
        cin >> sv_record[i].g_ky;
        cout << "Diem chuyen can sv " << i + 1 << " ";
        cin >> sv_record[i].c_can;
        cout << "Diem cuoi ky sv " << i + 1 << " ";
        cin >> sv_record[i].c_ky;
        sv_record[i].avg = sv_record[i].g_ky * 0.2 + sv_record[i].c_can * 0.2 + sv_record[i].c_ky * 0.6;
    }
}

void out(){
    system("cls");
    int kddk = 0,ma4 = 0, mi9 = 0;
    for(i = 0; i < slsv ; i++){
        if (!sv_record[i].status)
            kddk += 1;
        if (sv_record[i].avg < 4)
            ma4 += 1;
        if (sv_record[i].avg >= 9)
            mi9 += 1;
    }
    cout << "So sinh vien khong duoc thi: " << kddk << '\n';
    cout << "So sinh vien co diem trong binh <4: " << ma4 << '\n';
    cout << "So sinh vien co diem trong binh >=9: " << mi9 << '\n';
}

int main()
{
    inp();
    out();
    return 0;
}