Language: C

#include <stdio.h>


typedef struct{
char name[10];
int time;
}queue;

queue Q[100000];

int head=0;
int tail=0;


void dequeue(queue ,int);
queue enqueue(int);

int main(){
	int n,i,q;
	int count=0;
	scanf("%d%d",&n,&q);
	queue Que;

	for(i=0;i<n;i++){
		scanf("%s",Que.name);
		scanf("%d",&Que.time);
		enqueque(Que,n);
	}



	while(1){
		if(head==tail)break;
	
		if(Q[head]<=q){
			Que=dequeue(n);
			count+=Que.time;
			printf("%s %d\n",Que.name,count);
		}
		else{
			Que=dequeue(n);
			Que.time-=q;
			count+=q;
			enqueue(Que,n);
		}
	}	

	return 0;
}

void enqueue(queue x,int n){
	Q[tail]=x;
	if(tail+1==n)tail=0;
	else tail++;
}



queue dequeue(int n){
	queue x;
	x=Q[head];
	if(head+1==n)head=0;
	else head++;
	return x;
}

Compiler output:
main.c: In function 'main':
main.c:27:17: error: implicit declaration of function 'enqueque'; did you mean 'enqueue'? [-Wimplicit-function-declaration]
   27 |                 enqueque(Que,n);
      |                 ^~~~~~~~
      |                 enqueue
main.c:35:27: error: invalid operands to binary <= (have 'queue' and 'int')
   35 |                 if(Q[head]<=q){
      |                    ~~~~~~~^~
      |                     |
      |                     queue
main.c:36:37: error: incompatible type for argument 1 of 'dequeue'
   36 |                         Que=dequeue(n);
      |                                     ^
      |                                     |
      |                                     int
main.c:15:14: note: expected 'queue' but argument is of type 'int'
   15 | void dequeue(queue ,int);
      |              ^~~~~
main.c:36:29: error: too few arguments to function 'dequeue'
   36 |                         Que=dequeue(n);
      |                             ^~~~~~~
main.c:15:6: note: declared here
   15 | void dequeue(queue ,int);
      |      ^~~~~~~
main.c:41:37: error: incompatible type for argument 1 of 'dequeue'
   41 |                         Que=dequeue(n);
      |                                     ^
      |                                     |
      |                                     int
main.c:15:14: note: expected 'queue' but argument is of type 'int'
   15 | void dequeue(queue ,int);
      |              ^~~~~
main.c:41:29: error: too few arguments to function 'dequeue'
   41 |                         Que=dequeue(n);
      |                             ^~~~~~~
main.c:15:6: note: declared here
   15 | void dequeue(queue ,int);
      |      ^~~~~~~
main.c:44:33: error: incompatible type for argument 1 of 'enqueue'
   44 |                         enqueue(Que,n);
      |                                 ^~~
      |                                 |
      |                                 queue
main.c:16:15: note: expected 'int' but argument is of type 'queue'
   16 | queue enqueue(int);
      |               ^~~
main.c:44:25: error: too many arguments to function 'enqueue'
   44 |                         enqueue(Que,n);
      |                         ^~~~~~~
main.c:16:7: note: declared here
   16 | queue enqueue(int);
      |       ^~~~~~~
main.c: At top level:
main.c:51:6: error: conflicting types for 'enqueue'; have 'void(queue,  int)'
   51 | void enqueue(queue x,int n){
      |      ^~~~~~~
main.c:16:7: note: previous declaration of 'enqueue' with type 'queue(int)'
   16 | queue enqueue(int);
      |       ^~~~~~~
main.c:59:7: error: conflicting types for 'dequeue'; have 'queue(int)'
   59 | queue dequeue(int n){
      |       ^~~~~~~
main.c:15:6: note: previous declaration of 'dequeue' with type 'void(queue,  int)'
   15 | void dequeue(queue ,int);
      |      ^~~~~~~