171582025-05-26 21:15:41MolnárÚthasználati díj (75 pont)cpp17Compilation error
int main()
{
    int n, k, x;
    cin >> n >> k;
    int j = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> x;

        if (x == 1)
        {
            j++;
        }
    }

    int ossz = 0;

    for (int i = 0; i < j; i++)
    {
        // ossz += min(k - 1, j - i - 1);
        if (k - 1 < j - i - 1)
            ossz = ossz + k - 1;
        else
            ossz = ossz + j - i - 1;
    }

    cout << ossz;

    return 0;
}
Compilation error
open /var/local/lib/isolate/442/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> n >> k;
      |     ^~~
main.cpp:28:5: error: 'cout' was not declared in this scope
   28 |     cout << ossz;
      |     ^~~~