Language: C++

#include<iostream>
#include<string>
#include<queue>

int main(){

  int n,q;
  std::cin>>n>>q;
  std::pair<string,int> p;
  std::queue<pair<string,int>> Q;
  int total=0;
  int n,q;
  std::cin>>n>>q;

  for(int i=0;i<n;i++){
    string name;
    int time;
    std::cin>>name>>time;
    p=make_pair(name,time);
    Q.push(p);
  }
  while!q.empty()){
  if(Q.front().second<=q){
    total += Q.front().second;
    std::cout<<Q.front().first<<" "<<total<<endl;
    Q.pop();
  }else{
    total+=q;
    p=make_pair(Q.front().first,Q.front().second-q);
    Q.pop();
    Q.push(p);
  }
}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'string' was not declared in this scope
    9 |   std::pair<string,int> p;
      |             ^~~~~~
a.cc:9:13: 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:9:23: error: template argument 1 is invalid
    9 |   std::pair<string,int> p;
      |                       ^
a.cc:10:14: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   10 |   std::queue<pair<string,int>> Q;
      |              ^~~~
      |              std::pair
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:3013:12: note: 'std::pair' declared here
 3013 |     struct pair;
      |            ^~~~
a.cc:10:26: error: template argument 1 is invalid
   10 |   std::queue<pair<string,int>> Q;
      |                          ^~~
a.cc:10:29: error: expected unqualified-id before '>' token
   10 |   std::queue<pair<string,int>> Q;
      |                             ^~
a.cc:12:7: error: redeclaration of 'int n'
   12 |   int n,q;
      |       ^
a.cc:7:7: note: 'int n' previously declared here
    7 |   int n,q;
      |       ^
a.cc:12:9: error: redeclaration of 'int q'
   12 |   int n,q;
      |         ^
a.cc:7:9: note: 'int q' previously declared here
    7 |   int n,q;
      |         ^
a.cc:16:11: error: expected ';' before 'name'
   16 |     string name;
      |           ^~~~~
      |           ;
a.cc:18:15: error: 'name' was not declared in this scope
   18 |     std::cin>>name>>time;
      |               ^~~~
a.cc:19:7: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   19 |     p=make_pair(name,time);
      |       ^~~~~~~~~
      |       std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:20:5: error: 'Q' was not declared in this scope
   20 |     Q.push(p);
      |     ^
a.cc:22:8: error: expected '(' before '!' token
   22 |   while!q.empty()){
      |        ^
      |        (
a.cc:22:11: error: request for member 'empty' in 'q', which is of non-class type 'int'
   22 |   while!q.empty()){
      |           ^~~~~
a.cc:23:6: error: 'Q' was not declared in this scope
   23 |   if(Q.front().second<=q){
      |      ^
a.cc:25:45: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   25 |     std::cout<<Q.front().first<<" "<<total<<endl;
      |                                             ^~~~
      |                                             std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:29:7: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   29 |     p=make_pair(Q.front().first,Q.front().second-q);
      |       ^~~~~~~~~
      |       std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~