criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <stdio.h>
#include <iostream>
#include <cstdlib>
using namespace std;

typedef struct {
	char name[11] = "\0";
	int time;
} P;

class Queue {
private:
	int size;
	P *queue;
	int head = 0;
	int tail = 0;
public:
	Queue(int n);
	void enqueue(P p);
	void dequeue();
	bool isEmpty();
	P *get();
	void clear();
}

Queue::Queue(int n)
{
	size = n;
	queue = new P[n];
}

void Queue::enqueue(P p)
{
	queue[tail] = p;
	tail = (tail + 1) % size;
}

void Queue::dequeue()
{
	head = (head + 1) % size;
}

bool Queue::isEmpty()
{
	return head == tail;
}

P *Queue::get()
{
	return &queue[head];
}

void Queue::clear()
{
	delete[] queue;
}

int main(void)
{	
	int n, q;
	cin >> n >> q;
	
	Queue queue(n);
	for (int i = 0; i < n; i++) {
		P p;
		cin >> p.name;
		cin >> p.time;
		queue.enqueue(p);
	}
	
	int time = 0;
	while (!queue.isEmpty()) {
		P *p = queue.get();
		if (p->time <= q) {
			time += p->time;
			queue.dequeue();
			cout << p->name << " ";
			cout << time << endl;
		} else {
			time += q;
			p->time -= q;
			queue.dequeue();
			queue.enqueue(p);
		}
	}
	
	queue.clear();
	return 0;
}

Compiler output:
a.cc:11:1: error: new types may not be defined in a return type
   11 | class Queue {
      | ^~~~~
a.cc:11:1: note: (perhaps a semicolon is missing after the definition of 'Queue')
a.cc:11:1: error: return type specification for constructor invalid
a.cc: In function 'int main()':
a.cc:83:39: error: cannot convert 'P*' to 'P'
   83 |                         queue.enqueue(p);
      |                                       ^
      |                                       |
      |                                       P*
a.cc:32:23: note:   initializing argument 1 of 'void Queue::enqueue(P)'
   32 | void Queue::enqueue(P p)
      |                     ~~^
Language: C++

#include <stdio.h>
#include <iostream>
#include <cstdlib>
using namespace std;

typedef struct {
	char name[11] = "\0";
	int time;
} P;

class Queue {
private:
	int size;
	P *queue;
	int head = 0;
	int tail = 0;
public:
	Queue(int n);
	void enqueue(P p);
	void dequeue();
	bool isEmpty();
	P *get();
	void clear();
};

Queue::Queue(int n)
{
	size = n;
	queue = new P[n];
}

void Queue::enqueue(P p)
{
	queue[tail] = p;
	tail = (tail + 1) % size;
}

void Queue::dequeue()
{
	head = (head + 1) % size;
}

bool Queue::isEmpty()
{
	return head == tail;
}

P *Queue::get()
{
	return &queue[head];
}

void Queue::clear()
{
	delete[] queue;
}

int main(void)
{	
	int n, q;
	cin >> n >> q;
	
	Queue queue(n);
	for (int i = 0; i < n; i++) {
		P p;
		cin >> p.name;
		cin >> p.time;
		queue.enqueue(p);
	}
	
	int time = 0;
	while (!queue.isEmpty()) {
		P *p = queue.get();
		if (p->time <= q) {
			time += p->time;
			queue.dequeue();
			cout << p->name << " ";
			cout << time << endl;
		} else {
			time += q;
			p->time -= q;
			queue.dequeue();
			queue.enqueue(p);
		}
	}
	
	queue.clear();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:39: error: cannot convert 'P*' to 'P'
   83 |                         queue.enqueue(p);
      |                                       ^
      |                                       |
      |                                       P*
a.cc:32:23: note:   initializing argument 1 of 'void Queue::enqueue(P)'
   32 | void Queue::enqueue(P p)
      |                     ~~^
Language: C++

#include<iostream>
#include<queue>
 
using namespace std;
 
int n=0;
int q=0;
int total=0;
 
struct process {
    string name;
    int time;
};

int main(){
    queue<process> que;
    queue<process> ans;
    cin>>n>>q;
    
    for (int i=0;i<n;i++){
        process p;
        cin>>p.name>>p.time;
        que.push(p);
    }
    while(!que.empty()){
        if(que.front().time <= q){
            total = total+que.front().time;
            process p;
            p.name = que.front().name;
            p.time = total;
            ans.push(p);
            que.pop();
        }
        else{
            total.time+=q;
            process p;
            p.name=q.front().name;
            p.time=q.front().time-q;
            que.pop();
            que.push(p);
        }

    }
    
     while (!ans.empty()) {
        cout<<ans.front().name<<" "<<ans.front().time<<endl;
        ans.pop();
    }
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:19: error: request for member 'time' in 'total', which is of non-class type 'int'
   35 |             total.time+=q;
      |                   ^~~~
a.cc:37:22: error: request for member 'front' in 'q', which is of non-class type 'int'
   37 |             p.name=q.front().name;
      |                      ^~~~~
a.cc:38:22: error: request for member 'front' in 'q', which is of non-class type 'int'
   38 |             p.time=q.front().time-q;
      |                      ^~~~~
Language: C++

#include<iostream>
#include<queue>
 
using namespace std;
 
int n=0;
int q=0;
int total=0;
 
struct process {
    string name;
    int time;
};

int main(){
    queue<process> que;
    queue<process> ans;
    cin>>n>>q;
    
    for (int i=0;i<n;i++){
        process p;
        cin>>p.name>>p.time;
        que.push(p);
    }
    while(!que.empty()){
        if(que.front().time <= q){
            total = total+que.front().time;
            process p;
            p.name = que.front().name;
            p.time = total;
            ans.push(p);
            que.pop();
        }
        else{
            total+=q;
            process p;
            p.name=q.front().name;
            p.time=q.front().time-q;
            que.pop();
            que.push(p);
        }

    }
    
     while (!ans.empty()) {
        cout<<ans.front().name<<" "<<ans.front().time<<endl;
        ans.pop();
    }
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:22: error: request for member 'front' in 'q', which is of non-class type 'int'
   37 |             p.name=q.front().name;
      |                      ^~~~~
a.cc:38:22: error: request for member 'front' in 'q', which is of non-class type 'int'
   38 |             p.time=q.front().time-q;
      |                      ^~~~~
Language: C++

#include <stdio.h>
#include <string.h>
#define LEN 10005

struct Proc {
	char name[100];
	int t;
};

Proc Q[LEN];
int head, tail, n;

void enqueue(Proc x) {
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

Proc dequeue() {
	Proc x = Q[head];
	head = (head + 1) % LEN;
	return x;
}

int min(int a, int b) { return a < b ? a : b; }

int main() {
	int elaps = 0, c;
	Proc u;
	int n,q;

	scanf("%d %d", &n, &q);

	for (int i = 1; i <= n; i++) {
		scanf("%s", Q[i].name);
		scanf("%d", &Q[i].t);
	}

	head = 1; tail = n + 1;

	while (head != tail) {
		u = dequeue();
		c = min(q, u.t);
		u.t -= c;
		elaps += c;
		if (u.t > 0) {
			enqueue(u);
		}
		else {
			printf("%s  %d\n", u.name, elaps);
		}

	}

	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:54:18: error: expected '}' at end of input
   54 |         return 0;
      |                  ^
a.cc:26:12: note: to match this '{'
   26 | int main() {
      |            ^
Language: C++

#include<iostream.h>
#include<queue>
using namespace std;

main()
{
	queue<int> Q2;
	queue<string> Q1;
	int i,n,q,t,total=0;
	char st[10];
	
	cin >> n;
	cin >> q;
	
	for(i=0;i<=n-1;i++)
	{
		cin >> st;
		Q1.push(st);
		cin >> t;
		Q2.push(t);
	}
	while(Q2.empty()!=1)
	{
		if(Q2.front()-100<=0)
		{
			total+=Q2.front();
			cout << Q1.front() << " ";
			Q1.pop();
			Q2.pop();
			cout << total << endl;
		}
		else
		{
			total+=100;
			Q1.push(Q1.front());
			Q1.pop();
			Q2.push(Q2.front()-100);
			Q2.pop();
		}
	}
	return 0;
}

Compiler output:
a.cc:1:9: fatal error: iostream.h: No such file or directory
    1 | #include<iostream.h>
      |         ^~~~~~~~~~~~
compilation terminated.
Language: C++

#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
int main(){
  int n,q;
  int i,t;
  queue<pair<string,int>>Q;
  scanf("%d %d",%n,&q);
  for(i=0;i<n;i++){
    scanf("%s %d",name,t);
    Q.push(make_pair(name,t));
  }
  pair<string,int>u;
  int elaps=0,a;
  whilie(!Q.empty()){
    u=Q.front();Q.pop();
    a=min(u.t,q);
    u.t-=a;elaps+=a;
    if(u.t>0){
      Q.push(u);
    } else {
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: expected primary-expression before '%' token
   10 |   scanf("%d %d",%n,&q);
      |                 ^
a.cc:12:19: error: 'name' was not declared in this scope; did you mean 'tzname'?
   12 |     scanf("%s %d",name,t);
      |                   ^~~~
      |                   tzname
a.cc:17:3: error: 'whilie' was not declared in this scope
   17 |   whilie(!Q.empty()){
      |   ^~~~~~
Language: C++

#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
int main(){
  int n,q;
  int i,t;
  string name;
  queue<pair<string,int> >Q;
  scanf("%d %d",&n,&q);
  for(i=0;i<n;i++){
    scanf("%s %d",name,t);
    Q.push(make_pair(name,t));
  }
  pair<string,int>u;
  int elaps=0,a;
  while(!Q.empty()){
    u=Q.front();Q.pop();
    a=min(u.t,q);
    u.t-=a;elaps+=a;
    if(u.t>0){
      Q.push(u);
    } else {
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'struct std::pair<std::__cxx11::basic_string<char>, int>' has no member named 't'
   20 |     a=min(u.t,q);
      |             ^
a.cc:21:7: error: 'struct std::pair<std::__cxx11::basic_string<char>, int>' has no member named 't'
   21 |     u.t-=a;elaps+=a;
      |       ^
a.cc:22:10: error: 'struct std::pair<std::__cxx11::basic_string<char>, int>' has no member named 't'
   22 |     if(u.t>0){
      |          ^
a.cc:25:26: error: 'struct std::pair<std::__cxx11::basic_string<char>, int>' has no member named 'name'
   25 |       printf("%s %d\n",u.name,elaps);
      |                          ^~~~
Language: C++

#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
  P;
}

P Q[LEN];
int head,tail,n;

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1)%LEN;
}

P dequeue(){
  P x=Q[head];
  head=(head+1)%LEN;
  return x;
}

int min(int a,int b){return a<b?a:b;}

int main(){
  int elaps=0,c;
  int i,1;
  P u;
  scanf("%d%d",&n,&q);
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head=1;tail=n+1;

  while(head!=tail){
    u=dequeue();
    c=min(q,u.t);
    u.t=-=c;
    if(u.t>0)enqueue(u);
    else{
      printf("%s%d\n",u.name,elaps);
    }
  }
  return 0;
}

Compiler output:
a.cc:8:3: error: 'P' does not name a type
    8 |   P;
      |   ^
a.cc:11:3: error: expected initializer before 'Q'
   11 | P Q[LEN];
      |   ^
a.cc:14:6: error: variable or field 'enqueue' declared void
   14 | void enqueue(P x){
      |      ^~~~~~~
a.cc:14:14: error: 'P' was not declared in this scope
   14 | void enqueue(P x){
      |              ^
a.cc:19:1: error: 'P' does not name a type
   19 | P dequeue(){
      | ^
a.cc: In function 'int main()':
a.cc:29:9: error: expected unqualified-id before numeric constant
   29 |   int i,1;
      |         ^
a.cc:30:3: error: 'P' was not declared in this scope
   30 |   P u;
      |   ^
a.cc:31:20: error: 'q' was not declared in this scope
   31 |   scanf("%d%d",&n,&q);
      |                    ^
a.cc:33:16: error: 'Q' was not declared in this scope
   33 |     scanf("%s",Q[i].name);
      |                ^
a.cc:39:5: error: 'u' was not declared in this scope
   39 |     u=dequeue();
      |     ^
a.cc:39:7: error: 'dequeue' was not declared in this scope
   39 |     u=dequeue();
      |       ^~~~~~~
a.cc:41:9: error: expected primary-expression before '-=' token
   41 |     u.t=-=c;
      |         ^~
a.cc:42:14: error: 'enqueue' was not declared in this scope
   42 |     if(u.t>0)enqueue(u);
      |              ^~~~~~~
Language: C++

#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}

P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1)%LEN;
}

P dequeue(){
  P x=Q[head];
  head=(head+1)%LEN;
  return x;
}

int min(int a,int b){return a<b?a:b;}

int main(){
  int elaps=0,c;
  int i,1;
  P u;
  scanf("%d%d",&n,&q);
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head=1;tail=n+1;

  while(head!=tail){
    u=dequeue();
    c=min(q,u.t);
    u.t=-=c;
    if(u.t>0)enqueue(u);
    else{
      printf("%s%d\n",u.name,elaps);
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: expected unqualified-id before numeric constant
   30 |   int i,1;
      |         ^
a.cc:32:20: error: 'q' was not declared in this scope
   32 |   scanf("%d%d",&n,&q);
      |                    ^
a.cc:42:9: error: expected primary-expression before '-=' token
   42 |     u.t=-=c;
      |         ^~
Language: C++

#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}

P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1)%LEN;
}

P dequeue(){
  P x=Q[head];
  head=(head+1)%LEN;
  return x;
}

int min(int a,int b){return a<b?a:b;}

int main(){
  int elaps=0,c;
  int i,q;
  P u;
  scanf("%d%d",&n,&q);
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head=1;tail=n+1;

  while(head!=tail){
    u=dequeue();
    c=min(q,u.t);
    u.t=-=c;
    if(u.t>0)enqueue(u);
    else{
      printf("%s%d\n",u.name,elaps);
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: expected primary-expression before '-=' token
   42 |     u.t=-=c;
      |         ^~
Language: C++

#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;

int main() {
	int n, q, t;
	string name;
	queue<pair<string, int>> Q;

	cin >> n >> q;

	for (int i = 0; i < n; i++) {
		cin >> name >> t;
		Q.push(make_pair(name.t));
	}

	pair<string, int> u;
	int elaps = 0, a;

	while (!Q.empty()) {
		u = Q.front(); Q.pop();
		a = min(u.second, q);
		u.second -= a;
		elaps += a;
		if (u.second > 0) {
			Q.push(u);
		}
		else {
			cout << u.first << " " << elaps << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:39: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 't'; did you mean 'at'?
   16 |                 Q.push(make_pair(name.t));
      |                                       ^
      |                                       at
Language: C++

#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
} P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  if ( tail + 1 == LEN ) {
    tail = 0;
  } else {
    tail++;
  }
}

P dequeue(){
  P x = Q[head];
  if ( head + 1 == LEN ) {
    head = 0;
  } else {
    head++;
  }
  return x
}

int min(int a, int b) { return a < b ? a : b; }

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;

  while (head != tail ) {
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if ( u.t > 0 ) enqueue(u);
    else {
      printf("%s %d\n", u.name, elaps);
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'P dequeue()':
a.cc:29:11: error: expected ';' before '}' token
   29 |   return x
      |           ^
      |           ;
   30 | }
      | ~
Language: C++

#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;

int main() {
  int n, q, t;
  string name;
  
  queue<pair<string, int> > Q;

  cin >> n >> q;

  for ( int i = 0; i < n; i++ ) {
    cin >> name >> t;
    Q.push(make_pair(name, t));
  }

  pair<string, int> u;
  int elaps = 0, a;

  while ( !Q.empyt() ) {
    u = Q.front(); Q.pop();
    a = min(u.second, q);
    u.second -= a;
    elaps += a;
    if ( u.second > 0) {
      Q.push(u);
    } else {
      cout << u.first << " " << elaps <<endl;
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: 'class std::queue<std::pair<std::__cxx11::basic_string<char>, int> >' has no member named 'empyt'; did you mean 'empty'?
   23 |   while ( !Q.empyt() ) {
      |              ^~~~~
      |              empty
Language: C++

#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
using namespace stdext;

class Queue{
public:
	int* Q;
	int head;
	int tail;
	int size;

	Queue(int n);
	~Queue();
	Queue(const Queue &other);

	void enqueue(int x);
	int dequeue();
	bool isEmpty();
	bool isFull();
};

Queue::Queue(int n){
	Q = new int[n + 1];
	size = n + 1;
	head = 0;
	tail = 0;
	return;
}

Queue::Queue(const Queue &other){
	Q = new int[other.size];
	size = other.size;
	head = other.head;
	tail = other.tail;
	copy(other.Q, other.Q + size, checked_array_iterator<int*>(Q, size));
}

Queue::~Queue(){
	delete[] Q;
}

void Queue::enqueue(int x){
	Q[tail] = x;
	tail = (tail + 1) % size;
	return;
}

int Queue::dequeue(){
	int x = Q[head];
	head = (head + 1) % size;
	return x;
}

bool Queue::isEmpty(){
	return (tail == head);
}

bool Queue::isFull(){
	return (tail - head == size - 1 || tail - head == -1);
}

int main(){
	int n, q, wt;
	cin >> n >> q;
	Queue Que(n);
	vector<string> name(n);
	vector<int> time(n);

	for (int i = 0; i != n; i++){
		cin >> name[i] >> time[i];
		Que.enqueue(i);
	}

	wt = 0;
	while (!Que.isEmpty()){
		int iter = Que.dequeue();
		time[iter] -= q;
		if (0 >= time[iter]){
			cout << name[iter] << " " << wt + time[iter] + q << endl;
			wt += time[iter] + q;
		}
		else{
			Que.enqueue(iter);
			wt += q;
		}
	}

	return 0;
}


Compiler output:
a.cc:8:17: error: 'stdext' is not a namespace-name
    8 | using namespace stdext;
      |                 ^~~~~~
a.cc: In copy constructor 'Queue::Queue(const Queue&)':
a.cc:40:39: error: 'checked_array_iterator' was not declared in this scope
   40 |         copy(other.Q, other.Q + size, checked_array_iterator<int*>(Q, size));
      |                                       ^~~~~~~~~~~~~~~~~~~~~~
a.cc:40:62: error: expected primary-expression before 'int'
   40 |         copy(other.Q, other.Q + size, checked_array_iterator<int*>(Q, size));
      |                                                              ^~~
Language: C++

#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
using namespace stdext;

class Queue{
public:
	int* Q;
	int head;
	int tail;
	int size;

	Queue(int n);
	~Queue();
	Queue(const Queue &other);

	void enqueue(int x);
	int dequeue();
	bool isEmpty();
	bool isFull();
};

Queue::Queue(int n){
	Q = new int[n + 1];
	size = n + 1;
	head = 0;
	tail = 0;
	return;
}

Queue::Queue(const Queue &other){
	Q = new int[other.size];
	size = other.size;
	head = other.head;
	tail = other.tail;
	copy(other.Q, other.Q + size, Q);
}

Queue::~Queue(){
	delete[] Q;
}

void Queue::enqueue(int x){
	Q[tail] = x;
	tail = (tail + 1) % size;
	return;
}

int Queue::dequeue(){
	int x = Q[head];
	head = (head + 1) % size;
	return x;
}

bool Queue::isEmpty(){
	return (tail == head);
}

bool Queue::isFull(){
	return (tail - head == size - 1 || tail - head == -1);
}

int main(){
	int n, q, wt;
	cin >> n >> q;
	Queue Que(n);
	vector<string> name(n);
	vector<int> time(n);

	for (int i = 0; i != n; i++){
		cin >> name[i] >> time[i];
		Que.enqueue(i);
	}

	wt = 0;
	while (!Que.isEmpty()){
		int iter = Que.dequeue();
		time[iter] -= q;
		if (0 >= time[iter]){
			cout << name[iter] << " " << wt + time[iter] + q << endl;
			wt += time[iter] + q;
		}
		else{
			Que.enqueue(iter);
			wt += q;
		}
	}

	return 0;
}


Compiler output:
a.cc:8:17: error: 'stdext' is not a namespace-name
    8 | using namespace stdext;
      |                 ^~~~~~
Language: C++

import sys
from collections import deque
s=sys.stdin.readlines()
n,q=map(int,s[0].split())
d=deque(e.split()for e in s[1:])
t=0
while d:
 k,v=d.popleft()
 v=int(v)
 if v>q:
  v-=q
  t+=q
  d.append([k,v])
 else:
  t+=v
  print(k,t)


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;
#define MAX 100000

int mycount = 0;

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

queuecell queue[MAX];

void enqueue(char *name, int time) {
    strcpy(queue[mycount].name, name);
    queue[mycount].time = time;
    mycount++;
}

queuecell dequeue() {
    queuecell cell;

    strcpy(cell.name, queue[0].name);
    cell.time = queue[0].time;
    for(int i=0; i<mycount-1; i++) {
        strcpy(queue[i].name, queue[i+1].name);
        queue[i].time = queue[i+1].time;
    }
    mycount--;

    return cell;
}

int main() {
    int n, maxtime;
    int sumtime = 0;
    cin >> n;
    cin >> maxtime;
    queuecell cell;

    for(int i=0; i<n; i++) {
        scanf("%s", queue[i].name);
        scanf("%d", &queue[i].t)
    }

    while(mycount>0) {
        if(queue[0].time>maxtime) {
            sumtime += maxtime;
            cell = dequeue();
            enqueue(cell.name, cell.time-maxtime);
        }
        else {
            cell = dequeue();
            sumtime += cell.time;
            printf("%s %d\n", cell.name, sumtime);
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:31: error: 'queuecell' {aka 'struct _queue'} has no member named 't'
   45 |         scanf("%d", &queue[i].t)
      |                               ^
Language: C++

#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;
#define MAX 100000

int mycount = 0;

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

queuecell queue[MAX];

void enqueue(char *name, int time) {
    strcpy(queue[mycount].name, name);
    queue[mycount].time = time;
    mycount++;
}

queuecell dequeue() {
    queuecell cell;

    strcpy(cell.name, queue[0].name);
    cell.time = queue[0].time;
    for(int i=0; i<mycount-1; i++) {
        strcpy(queue[i].name, queue[i+1].name);
        queue[i].time = queue[i+1].time;
    }
    mycount--;

    return cell;
}

int main() {
    int n, maxtime;
    int sumtime = 0;
    cin >> n;
    cin >> maxtime;
    queuecell cell;

    for(int i=0; i<n; i++) {
        scanf("%s", queue[i].name);
        scanf("%d", &queue[i].time)
    }

    while(mycount>0) {
        if(queue[0].time>maxtime) {
            sumtime += maxtime;
            cell = dequeue();
            enqueue(cell.name, cell.time-maxtime);
        }
        else {
            cell = dequeue();
            sumtime += cell.time;
            printf("%s %d\n", cell.name, sumtime);
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:36: error: expected ';' before '}' token
   45 |         scanf("%d", &queue[i].time)
      |                                    ^
      |                                    ;
   46 |     }
      |     ~
Language: C++

#include <iostream>
#include <string>
#include<string.h>
#include <cstdio>

using namespace std;
#define size 100005

typedef struct pu {
	int time;
	string name;
}P;

P Q[size];
int head, tail, n;//先頭尻尾、要素数
void enqueue(P x) {
	Q[tail] = x;
	tail = (tail + 1) % size;
}
P dequeue() {
	P x = Q[head];
	head = (head + 1) % size;
	return x;
}

int min(int a, int b) { return a < b ? a : b; }

int main()
{
	int elps = 0, re_time;//経過時間と残り時間
	int q;
	cin >> n>>q;
	head = 1;
	tail = n + 1;
	for (int i = 1; i <= n; i++) {
		cin >> Q[i].name >> Q[i].time;
	}

	while (head!=tail) {
		P u = dequeue();
		re_time=min(q, u.time);
		u.time -= re_time;
		elps += re_time;
		if (u.time > 0) {
			enqueue(u);
		}
		else {
			cout << u.name << " " << elaps << endl;
		}

	}

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:48:50: error: 'elaps' was not declared in this scope; did you mean 'elps'?
   48 |                         cout << u.name << " " << elaps << endl;
      |                                                  ^~~~~
      |                                                  elps
Language: C++

#include <iostream>
#include <cstring>
#include <queue>
using namespace std;

int main() {
  int n, q;
  cin>>n>>q;
  queue<pair<string,int> > Q;
  int name, t;
  for (int i=0; i<n; i++) {
    cin>>name>>t;
    Q.push(make_pair(name,t));
  }
  pair<string,int> u;
  int elaps=0;
  while (!Q.empty()) {
    u=Q.front();
    Q.pop();
    int a=min(u.second,q);
    u.second-=a;
    elaps+=a;
    if (u.second>0) {
      Q.push(u);
    } else {
      cout<<u.first<<" "<<elaps<<endl;
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: no matching function for call to 'std::queue<std::pair<std::__cxx11::basic_string<char>, int> >::push(std::pair<int, int>)'
   13 |     Q.push(make_pair(name,t));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<std::__cxx11::basic_string<char>, int>; _Sequence = std::deque<std::pair<std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<std::__cxx11::basic_string<char>, int> > >; value_type = std::pair<std::__cxx11::basic_string<char>, int>]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:30: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::queue<std::pair<std::__cxx11::basic_string<char>, int> >::value_type&' {aka 'const std::pair<std::__cxx11::basic_string<char>, int>&'}
  283 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<std::__cxx11::basic_string<char>, int>; _Sequence = std::deque<std::pair<std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<std::__cxx11::basic_string<char>, int> > >; value_type = std::pair<std::__cxx11::basic_string<char>, int>]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:25: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::queue<std::pair<std::__cxx11::basic_string<char>, int> >::value_type&&' {aka 'std::pair<std::__cxx11::basic_string<char>, int>&&'}
  288 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
Language: C++

// キュー
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

#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 enqueue(queue_element)':
a.cc:114:16: error: 'INT_MIN' was not declared in this scope
  114 |         return INT_MIN;
      |                ^~~~~~~
a.cc:12:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include<vector>
  +++ |+#include <climits>
   12 | 
a.cc: In function 'queue_element dequeue()':
a.cc:131:18: error: 'INT_MIN' was not declared in this scope
  131 |         ret.id = INT_MIN;
      |                  ^~~~~~~
a.cc:131:18: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#define len 150000;

using namespace std;


struct A
{
	char name[100];
	int time;
};

int head, tail,N, interval;
A a[len];

A dequeue()
{
	A x = a[head++];
	head = head%len;
	return x;
}

void enqueue(A m)
{
	a[tail] = m;
	tail = (tail + 1) % len;
}

int main()
{
	cin >> N >> interval;
	for (int i = 0; i < N; i++)
	{
		scanf("%s", a[i].name);
		scanf("%d", &a[i].time);
	}
	head = 0;
	tail = N;
	int sum = 0;
	while (head != tail)
	{
		A x = dequeue();
		if (x.time <= interval)
		{
			sum = sum + x.time;
			cout << x.name << ' ' << sum << endl;
		}
		else
		{
			x.time = x.time - interval;
			sum = sum + interval;
			enqueue(x);
		}
	}

	return 0;
}


Compiler output:
a.cc:4:19: error: expected ']' before ';' token
    4 | #define len 150000;
      |                   ^
a.cc:16:5: note: in expansion of macro 'len'
   16 | A a[len];
      |     ^~~
a.cc:16:8: error: expected unqualified-id before ']' token
   16 | A a[len];
      |        ^
a.cc: In function 'A dequeue()':
a.cc:20:15: error: 'a' was not declared in this scope
   20 |         A x = a[head++];
      |               ^
a.cc: In function 'void enqueue(A)':
a.cc:27:9: error: 'a' was not declared in this scope
   27 |         a[tail] = m;
      |         ^
a.cc: In function 'int main()':
a.cc:36:29: error: 'a' was not declared in this scope
   36 |                 scanf("%s", a[i].name);
      |                             ^
Language: C++

//
//  4.cpp
//  Algorithms and Data Structures
//
//  Created by kawauso on 2018/04/06.
//

#include "4.hpp"

#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <sstream>
#include <tuple>

#define MAIN() c_4_3()
#ifdef MAIN
int main(int argc, const char * argv[]) {
	std::ios::sync_with_stdio(false);
	MAIN();
	return 0;
}
#endif

void c_4_3() {
	int n;
	int q;
	int index;
	int elapsed;

	std::cin >> n;
	std::cin >> q;
	std::vector<std::tuple<std::string, int>> queue(n);
	for (int i = 0; i < n; i++) {
		std::string name;
		int time;

		std::cin >> name;
		std::cin >> time;
		queue[i] = std::make_tuple(name, time);
	}
	index = 0;
	elapsed = 0;
	while (queue.size() > 0) {
		index %= queue.size();
		if (std::get<1>(queue[index]) <= q) {
			std::cout << std::get<0>(queue[index]) << " " << elapsed + std::get<1>(queue[index]) << std::endl;
			elapsed += std::get<1>(queue[index]);
			queue.erase(queue.begin() + index);
		} else {
			std::get<1>(queue[index]) = std::get<1>(queue[index]) - q;
			index++;
			elapsed += q;
		}
	}
}

void c_4_2() {
	std::string line;
	std::string s;

	// input
	std::getline(std::cin, line);
	std::istringstream iss(line);
	std::vector<std::string> a;
	while (iss >> s) {
		if (s == "+") {
			const auto result = std::stoi(a[1]) + std::stoi(a[0]);
			a.erase(a.begin(), a.begin() + 2);
			a.insert(a.begin(), std::to_string(result));
		} else if (s == "-") {
			const auto result = std::stoi(a[1]) - std::stoi(a[0]);
			a.erase(a.begin(), a.begin() + 2);
			a.insert(a.begin(), std::to_string(result));
		} else if (s == "*") {
			const auto result = std::stoi(a[1]) * std::stoi(a[0]);
			a.erase(a.begin(), a.begin() + 2);
			a.insert(a.begin(), std::to_string(result));
		} else {
			a.insert(a.begin(), s);
		}
	}
	std::cout << a[0] << std::endl;
}
// 正解との相違: 演算子は格納しなくてよいので配列の要素の型は整数でよい
// C++で実装するならstd::stackを使ってよいだろう



Compiler output:
a.cc:8:10: fatal error: 4.hpp: No such file or directory
    8 | #include "4.hpp"
      |          ^~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#define INT_MAX 2147483647
int MAX_SIZE = 0;

struct Process{
  std::string name;
  int time;
};

class Queue {
private:
  Process Table[MAX_SIZE];
  int head;
  int top;
public:
  Queue(){ head=0; top=0; };
  void Enqueue(Process P){ Table[top] = P; top = (top+1)%MAX_SIZE };
  Process Dequeue(){ return Table[head]; head = (head+1)%MAX_SIZE };
  bool isEmpty(){return head==top; };
  void show(){
    std::cout << "head : " << head << '\n';
    std::cout << "top : " << top  << '\n';
  };
};

int main(int argc, char const *argv[]) {
  int n;
  int q;
  int cumtime=0;
  Process P;
  Queue queue = Queue();
  std::cin >> n >> q;

  for (size_t i = 0; i < n; i++) {
    std::cin >> P.name;
    std::cin >> P.time;
    queue.Enqueue(P);
  }

  while (!queue.isEmpty()) {
    P = queue.Dequeue();
    P.time -= q;
    if (P.time>0) {
      queue.Enqueue(P);
      cumtime += q;
    } else {
      cumtime += (q + P.time);
      std::cout << P.name << ' ' << cumtime << '\n';
    }
  }

  return 0;
}



Compiler output:
a.cc:12:17: error: size of array 'Table' is not an integral constant-expression
   12 |   Process Table[MAX_SIZE];
      |                 ^~~~~~~~
a.cc: In member function 'void Queue::Enqueue(Process)':
a.cc:17:67: error: expected ';' before '}' token
   17 |   void Enqueue(Process P){ Table[top] = P; top = (top+1)%MAX_SIZE };
      |                                                                   ^
a.cc: In member function 'Process Queue::Dequeue()':
a.cc:18:67: error: expected ';' before '}' token
   18 |   Process Dequeue(){ return Table[head]; head = (head+1)%MAX_SIZE };
      |                                                                   ^
Language: C++

#include <iostream>
#define INT_MAX 2147483647

struct Process{
  std::string name;
  int time;
};

class Queue {
private:
  Process Table[100005];
  int head;
  int top;
public:
  Queue(){ head=0; top=0; };
  void Enqueue(Process P){ Table[top] = P; top = (top+1)%100005 };
  Process Dequeue(){ return Table[head]; head = (head+1)%100005 };
  bool isEmpty(){return head==top; };
  void show(){
    std::cout << "head : " << head << '\n';
    std::cout << "top : " << top  << '\n';
  };
};

int main(int argc, char const *argv[]) {
  int n;
  int q;
  int cumtime=0;
  Process P;
  Queue queue = Queue();
  std::cin >> n >> q;

  for (size_t i = 0; i < n; i++) {
    std::cin >> P.name;
    std::cin >> P.time;
    queue.Enqueue(P);
  }

  while (!queue.isEmpty()) {
    P = queue.Dequeue();
    P.time -= q;
    if (P.time>0) {
      queue.Enqueue(P);
      cumtime += q;
    } else {
      cumtime += (q + P.time);
      std::cout << P.name << ' ' << cumtime << '\n';
    }
  }

  return 0;
}



Compiler output:
a.cc: In member function 'void Queue::Enqueue(Process)':
a.cc:16:65: error: expected ';' before '}' token
   16 |   void Enqueue(Process P){ Table[top] = P; top = (top+1)%100005 };
      |                                                                 ^
a.cc: In member function 'Process Queue::Dequeue()':
a.cc:17:65: error: expected ';' before '}' token
   17 |   Process Dequeue(){ return Table[head]; head = (head+1)%100005 };
      |                                                                 ^
Language: C++

//队列的简单使用
/**
队列的常用函数size(),
front(),返回队首元素
pop() 从队列中取出并删除元素
push() 向队尾添加元素
empty()
**/
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>

using namespace std;

int main() {
  int n, q, t;
  string name;
  queue<pair<string, int> que>;

  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> name >> t;
    que.push(make_pair(name, t));
  }
  pair<string, int> u;

  int res = 0;
  ;
  while (!que.empty()) {
    u = que.front();
    que.pop();
    int a = min(u.second, q);
    u.second -= a;
    res += a;
    if (u.second > 0) {
      que.push(u);
    } else {
      cout << u.first << " " << res;
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:19:30: error: template argument 1 is invalid
   19 |   queue<pair<string, int> que>;
      |                              ^
a.cc:19:30: error: template argument 2 is invalid
a.cc:24:5: error: 'que' was not declared in this scope
   24 |     que.push(make_pair(name, t));
      |     ^~~
a.cc:30:11: error: 'que' was not declared in this scope
   30 |   while (!que.empty()) {
      |           ^~~
Language: C++

#include<iostream>
#define SIZE 200000


struct Queue{
  int table[SIZE];
  int tail,head;
  
  void init(){
    head=tail=0;
  }
  
  bool empty(){
    return head==tail;
  }
    
  void inqueue(int x){
    table[tail]=x;
    tail++;
    tail%=SIZE;
  }
  
  int dequeue(){
    if(empty())return 0;
    int res=table[head];
    head++;
    head%=SIZE;
    return res;
  }
};
  
int main(){
  Queue queue,queue2;
  int n,q,num;
  string table[SIZE];
  cin>>n>>q;
  queue.init();
  queue2.init();
  for(int i=0;i<n;i++){
    cin>>table[i]>>num;
    queue.inqueue(num);
    queue2.inqueue(i);
  }
    
  int now=0,A,B;
  while(!queue.empty()){
    A=queue.dequeue();
    B=queue2.dequeue();
    if(A<=q){
      now+=A;
      cout<<table[B]<<' '<<now<<endl;
    }else{
      now+=q;
      A-=q;
      queue.inqueue(A);
      queue2.inqueue(B);
    }
  }
    
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:3: error: 'string' was not declared in this scope
   35 |   string table[SIZE];
      |   ^~~~~~
a.cc:35:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:36:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   36 |   cin>>n>>q;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:40:10: error: 'table' was not declared in this scope; did you mean 'mutable'?
   40 |     cin>>table[i]>>num;
      |          ^~~~~
      |          mutable
a.cc:51:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   51 |       cout<<table[B]<<' '<<now<<endl;
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:51:13: error: 'table' was not declared in this scope; did you mean 'mutable'?
   51 |       cout<<table[B]<<' '<<now<<endl;
      |             ^~~~~
      |             mutable
a.cc:51:33: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   51 |       cout<<table[B]<<' '<<now<<endl;
      |                                 ^~~~
      |                                 std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++


#include<iostream>
#define SIZE 200000


struct Queue{
  int table[SIZE];
  int tail,head;
  
  void init(){
    head=tail=0;
  }
  
  bool empty(){
    return head==tail;
  }
    
  void inqueue(int x){
    table[tail]=x;
    tail++;
    tail%=SIZE;
  }
  
  int dequeue(){
    if(empty())return 0;
    int res=table[head];
    head++;
    head%=SIZE;
    return res;
  }
};
  
int main(){
  Queue queue,queue2;
  int n,q,num;
  string table[SIZE];
  cin>>n>>q;
  queue.init();
  queue2.init();
  for(int i=0;i<n;i++){
    cin>>table[i]>>num;
    queue.inqueue(num);
    queue2.inqueue(i);
  }
    
  int now=0,A,B;
  while(!queue.empty()){
    A=queue.dequeue();
    B=queue2.dequeue();
    if(A<=q){
      now+=A;
      cout<<table[B]<<' '<<now<<endl;
    }else{
      now+=q;
      A-=q;
      queue.inqueue(A);
      queue2.inqueue(B);
    }
  }
    
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:3: error: 'string' was not declared in this scope
   36 |   string table[SIZE];
      |   ^~~~~~
a.cc:36:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:37:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   37 |   cin>>n>>q;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:41:10: error: 'table' was not declared in this scope; did you mean 'mutable'?
   41 |     cin>>table[i]>>num;
      |          ^~~~~
      |          mutable
a.cc:52:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   52 |       cout<<table[B]<<' '<<now<<endl;
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:52:13: error: 'table' was not declared in this scope; did you mean 'mutable'?
   52 |       cout<<table[B]<<' '<<now<<endl;
      |             ^~~~~
      |             mutable
a.cc:52:33: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   52 |       cout<<table[B]<<' '<<now<<endl;
      |                                 ^~~~
      |                                 std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

class Queue():
    def __init__(self, size=10):
        self.queue = [None] * size
        self.head = self.tail = 0
        self.MAX = size
        self.num_items = 0

    def is_empty(self):
        return self.num_items == 0

    def is_full(self):
        return self.num_items == self.MAX

    def enqueue(self, x):
        if self.is_full():
            raise IndexError

        self.queue[self.tail] = x
        self.num_items += 1
        if self.tail+1 == self.MAX:
            self.tail = 0
        else:
            self.tail += 1

    def dequeue(self):
        if self.is_empty():
            raise IndexError

        x = self.queue[self.head]
        self.num_items -= 1
        if self.head+1 == self.MAX:
            self.head = 0
        else:
            self.head += 1

        return x


class Process:
    def __init__(self, name, time):
        self.name = name
        self.time = time

    def print_time(self):
        return self.time

    def print_name(self):
        return self.name


def main():
    n, q = map(int, input().split())
    qq = Queue(n)

    t = 0
    for i in range(n):
        name, time = input().split()
        p = Process(name, int(time))
        qq.enqueue(p)

    while not qq.is_empty():
        p = qq.dequeue()

        if p.time - q <= 0:
            t += p.time
            print("{} {}".format(p.name, t))
        else:
            p.time -= q
            t += q
            qq.enqueue(p)


if __name__ == '__main__':
    main()



Compiler output:
a.cc:73:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   73 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:13: error: expected unqualified-id before ')' token
    1 | class Queue():
      |             ^
Language: C++

#include<iostream>
#include<queue>
#include<string>
int main(){
  std::queue<string> x1;
  std::queue<int> x2;
 
  std::string x01;
  int x02;
  int max_datasets=500000;
  int all_time=0;
  
  int n,q;
  std::string name[max_datasets];
  int time[max_datasets];
  std::cin>>n>>q;
  for(int i=0;i<n;i++){
    std::cin>>name[i]>>time[i];
    x1.push(name[i]);
    x2.push(time[i]);
  }
  
  while(x1.size()!=0){
    if(x2.front()<=q){
      all_time += x2.front();
      std::cout<<x1.front()<<" "<<all_time<<"\n";
      x1.pop();
      x2.pop();
    }
    else{
      x2.front() -= q;
      all_time += q;
      x01=x1.front();
      x02=x2.front();
      x1.pop();
      x2.pop();
      x1.push(x01);
      x2.push(x02);
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: 'string' was not declared in this scope
    5 |   std::queue<string> x1;
      |              ^~~~~~
a.cc:5:14: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:5:20: error: template argument 1 is invalid
    5 |   std::queue<string> x1;
      |                    ^
a.cc:5:20: error: template argument 2 is invalid
a.cc:19:8: error: request for member 'push' in 'x1', which is of non-class type 'int'
   19 |     x1.push(name[i]);
      |        ^~~~
a.cc:23:12: error: request for member 'size' in 'x1', which is of non-class type 'int'
   23 |   while(x1.size()!=0){
      |            ^~~~
a.cc:26:21: error: request for member 'front' in 'x1', which is of non-class type 'int'
   26 |       std::cout<<x1.front()<<" "<<all_time<<"\n";
      |                     ^~~~~
a.cc:27:10: error: request for member 'pop' in 'x1', which is of non-class type 'int'
   27 |       x1.pop();
      |          ^~~
a.cc:33:14: error: request for member 'front' in 'x1', which is of non-class type 'int'
   33 |       x01=x1.front();
      |              ^~~~~
a.cc:35:10: error: request for member 'pop' in 'x1', which is of non-class type 'int'
   35 |       x1.pop();
      |          ^~~
a.cc:37:10: error: request for member 'push' in 'x1', which is of non-class type 'int'
   37 |       x1.push(x01);
      |          ^~~~