Language: C++

// キュー
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>

//const int MAX_N = 100000;
const int STR_LEN = 10;

// キュー関連の定義
const int Max_Queue = 1000;
int queue_pointer = 0;

typedef struct q_e
{
    // 配列の要素No.
    int id;
    // プロセス名
    char process_name[STR_LEN];
    // プロセスの時間
    int process_time;
}queue_element;

queue_element ary_queue[Max_Queue];

void create_queue(void);
int enqueue(queue_element element);
queue_element dequeue(void);

int main(void)
{

    int N, cpu_time, total_time = 0;
    char str[STR_LEN];
    queue_element que_ele;

    // キューの初期化
    create_queue();

    scanf("%d %d", &N, &cpu_time);

    for(int i = 0; i < N; i++)
    {
    	que_ele.id = i;

        scanf("%s", &str[0]);
        strcpy(&(que_ele.process_name[0]), &str[0]);

        scanf("%s", &str[0]);
        que_ele.process_time = atoi(str);

        // キューに挿入する
        enqueue(que_ele);
    }

    // cpuの時間を割り当てる
    while( queue_pointer > 0 )
    {
        // キューからポップする
        que_ele = dequeue();

        if( 0 < que_ele.process_time
            && que_ele.process_time <= cpu_time )
        {
            total_time += que_ele.process_time;
            que_ele.process_time = 0;

            printf("%s %d\n", que_ele.process_name, total_time);
        }
        else
        {
            total_time += cpu_time;
            que_ele.process_time -= cpu_time;

            enqueue(que_ele);
        }
    }

    return 0;

}

// キューを作成する関数
void create_queue(void)
{
    int i;

    for(i = 0; i < Max_Queue; i++)
    {
        // キューの初期化
    	ary_queue[i].id = 0;
        ary_queue[i].process_name[0] = '\0';
        ary_queue[i].process_time = 0;
    }

    queue_pointer = 0;

    return;
}

// キューへプッシュする関数
int enqueue(queue_element element)
{

    if( queue_pointer > Max_Queue )
    {
        // サイズオーバー
        return INT_MIN;
    }

    // キューに追加する
    ary_queue[queue_pointer++] = element;

    return 0;
}

// キューからポップする関数
queue_element dequeue(void)
{
    queue_element ret;

    if( queue_pointer < 0 )
    {
        // キューが空の時
        ret.id = INT_MIN;
    }
    else
    {
        ret = ary_queue[0];
    }

    for(int i = 0; i < queue_pointer; i++)
    {
        // 値をコピーしておく
        ary_queue[i] = ary_queue[i + 1];
    }

    queue_pointer--;

    return ret;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: 'strcpy' was not declared in this scope
   48 |         strcpy(&(que_ele.process_name[0]), &str[0]);
      |         ^~~~~~
a.cc:7:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include<vector>
  +++ |+#include <cstring>
    7 | 
a.cc: In function 'int enqueue(queue_element)':
a.cc:109:16: error: 'INT_MIN' was not declared in this scope
  109 |         return INT_MIN;
      |                ^~~~~~~
a.cc:7:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<vector>
  +++ |+#include <climits>
    7 | 
a.cc: In function 'queue_element dequeue()':
a.cc:126:18: error: 'INT_MIN' was not declared in this scope
  126 |         ret.id = INT_MIN;
      |                  ^~~~~~~
a.cc:126:18: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'