Language: C++

#include <iostream>
#include <queue>

int main(int argc, char const *argv[]){
	int n,q,t;
	std::cin >> n >> q;
	std::queue<std::pair<std::string,int>> que;
	
	for (int i = 0; i < n; ++i){
		std::string tsk;
		int tm;
		std::cin >> nm >> tm;
		que.push(make_pair(nm,tm));
	} 

	while(!task.empty()){
		pair<string,int> front = que.front();

		if(front.second - q > 0){
			t += q;
			que.push(make_pair(front.first,front.second-q));
		}else{
			t += que.second;
			std::cout << front.first << " " << t << std::endl;
		}
		que.pop();
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:12:29: error: 'nm' was not declared in this scope; did you mean 'tm'?
   12 |                 std::cin >> nm >> tm;
      |                             ^~
      |                             tm
a.cc:13:26: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   13 |                 que.push(make_pair(nm,tm));
      |                          ^~~~~~~~~
      |                          std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 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,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/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:16:16: error: 'task' was not declared in this scope
   16 |         while(!task.empty()){
      |                ^~~~
a.cc:17:17: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   17 |                 pair<string,int> front = que.front();
      |                 ^~~~
      |                 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:17:22: error: 'string' was not declared in this scope
   17 |                 pair<string,int> front = que.front();
      |                      ^~~~~~
a.cc:17:22: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:17:29: error: expected primary-expression before 'int'
   17 |                 pair<string,int> front = que.front();
      |                             ^~~
a.cc:19:20: error: 'front' was not declared in this scope
   19 |                 if(front.second - q > 0){
      |                    ^~~~~
a.cc:21:34: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   21 |                         que.push(make_pair(front.first,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)
      |     ^~~~~~~~~
a.cc:23:34: error: 'class std::queue<std::pair<std::__cxx11::basic_string<char>, int> >' has no member named 'second'
   23 |                         t += que.second;
      |                                  ^~~~~~