Language: C++

#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
int main(){
	int n,q,t;
	string name;
	queue<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:7:9: error: 'string' was not declared in this scope
    7 |         string name;
      |         ^~~~~~
a.cc:7: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:8:9: error: 'queue' was not declared in this scope; did you mean 'std::queue'?
    8 |         queue<string,int> >Q;
      |         ^~~~~
      |         std::queue
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_queue.h:96:11: note: 'std::queue' declared here
   96 |     class queue
      |           ^~~~~
a.cc:8:22: error: expected primary-expression before 'int'
    8 |         queue<string,int> >Q;
      |                      ^~~
a.cc:9:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |         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:11:24: error: 'name' was not declared in this scope; did you mean 'tzname'?
   11 |                 cin >> name >> t;
      |                        ^~~~
      |                        tzname
a.cc:12:17: error: 'Q' was not declared in this scope
   12 |                 Q.push(make_pair(name,t));
      |                 ^
a.cc:12:24: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   12 |                 Q.push(make_pair(name,t));
      |                        ^~~~~~~~~
      |                        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:14:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   14 |         pair<string,int> u;
      |         ^~~~
      |         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:14:21: error: expected primary-expression before 'int'
   14 |         pair<string,int> u;
      |                     ^~~
a.cc:16:16: error: 'Q' was not declared in this scope
   16 |         while(!Q.empty()){
      |                ^
a.cc:17:17: error: 'u' was not declared in this scope
   17 |                 u = Q.front();Q.pop();
      |                 ^
a.cc:18:21: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |                 a = min(u.second,q);
      |                     ^~~
      |                     std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:25:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   25 |                         cout << u.first << " " << elaps << 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:25:60: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   25 |                         cout << u.first << " " << elaps << endl;
      |                                                            ^~~~
      |                                                            std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~