Language: C++

#include<iostream>
#include<queue>
#include<string>
 
int main(){
  queue<string> x1;
  queue<int> x2;
 
  string x01;
  int x02;
  int max_datasets=500000;
  int all_time=0;
  
  int n,q;
  string name[max_datasets];
  int time[max_datasets];
  cin>>n>>q;
  for(int i=0;i<n;i++){
    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();
      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:6:3: error: 'queue' was not declared in this scope; did you mean 'std::queue'?
    6 |   queue<string> x1;
      |   ^~~~~
      |   std::queue
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_queue.h:96:11: note: 'std::queue' declared here
   96 |     class queue
      |           ^~~~~
a.cc:6:9: error: 'string' was not declared in this scope
    6 |   queue<string> x1;
      |         ^~~~~~
a.cc:6:9: 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:6:17: error: 'x1' was not declared in this scope
    6 |   queue<string> x1;
      |                 ^~
a.cc:7:9: error: expected primary-expression before 'int'
    7 |   queue<int> x2;
      |         ^~~
a.cc:9:9: error: expected ';' before 'x01'
    9 |   string x01;
      |         ^~~~
      |         ;
a.cc:15:9: error: expected ';' before 'name'
   15 |   string name[max_datasets];
      |         ^~~~~
      |         ;
a.cc:17:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   17 |   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:19:10: error: 'name' was not declared in this scope
   19 |     cin>>name[i]>>time[i];
      |          ^~~~
a.cc:21:5: error: 'x2' was not declared in this scope; did you mean 'x02'?
   21 |     x2.push(time[i]);
      |     ^~
      |     x02
a.cc:25:8: error: 'x2' was not declared in this scope; did you mean 'x02'?
   25 |     if(x2.front()<=q){
      |        ^~
      |        x02
a.cc:27:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |       cout<<x1.front()<<" "<<all_time<<"\n";
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:34:7: error: 'x01' was not declared in this scope; did you mean 'x02'?
   34 |       x01=x1.front();
      |       ^~~
      |       x02