func_code_string: #include <bits/stdc++.h>   using namespace std;   int present(int *lib, int k, int x) {     int i;     for (i = 0; i < k; i++) {       if (lib[i] == x) return 1;     }     return 0;   }   int findMax(int *lib, int k, queue<int> *q, int n) {     int i, max = -1, maxi = 0;     for (i = 0; i < k; i++) {       if (q[lib[i]].empty()) return i;       if (max < q[lib[i]].front()) {         max = q[lib[i]].front();         maxi = i;       }     }     return maxi;   }   int main() {     int n, k, i, ans = 0, size = 0, z;     scanf( %d%d , &n, &k);     int *lib = (int *)calloc(k, sizeof(int));     int *arr = (int *)calloc(n, sizeof(int));     queue<int> q[n + 1];     for (i = 0; i < n; i++) {       scanf( %d , &arr[i]);       q[arr[i]].push(i);     }     for (i = 0; i < n; i++) {       if (present(lib, k, arr[i]) == 0) {         if (size < k) {           q[arr[i]].pop();           lib[size++] = arr[i];           ans++;         } else {           q[arr[i]].pop();           z = findMax(lib, k, q, n);           lib[z] = arr[i];           ans++;         }       } else {         q[arr[i]].pop();       }     }     printf( %d n , ans);     return 0;   }   