#include <stdio.h>

int queue[100];
int f = 0;
int r = 0;

void enque(int x){
    queue[r++] = x;
}

int deque(){
    return queue[f++];
}

int empty(){
    return r == f;
}

int size(){
    return r - f;
}

int main() {
    int request[] = {100, 300, 2900, 3200, 4000};
    int n = 5;

    for(int i = 0; i < n; i++){
        enque(request[i]);

        if(queue[f] < request[i] - 3000){
            deque();
        }

        printf("%d\n", size());
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: