Language: C++

#include <iostream>
#include <queue>

int main(int argc, char const *argv[]){
	int n,q,t;
	std::cin >> n >> q;

	std::queue<std::string> task(n);
	std::queue<int> time(n);
	
	for (int i = 0; i < n; ++i){
		std::cin >> task[i] >> time[i]; 
	}

	while(!task.empty()){
		if(time.front() - q > 0){
			t += q;
			time.push(time.front()-q);
			task.push(task.front());
		}else{
			t += time.front();
			std::cout << task.front() << " " << t << std::endl;
		}
		time.pop();
		task.pop();
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:8:39: error: no matching function for call to 'std::queue<std::__cxx11::basic_string<char> >::queue(int&)'
    8 |         std::queue<std::string> task(n);
      |                                       ^
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_queue.h:195:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(std::queue<_Tp, _Sequence>&&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >]'
  195 |         queue(queue&& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:195:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:191:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(const std::queue<_Tp, _Sequence>&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >]'
  191 |         queue(const queue& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:191:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:187:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(_Sequence&&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >]'
  187 |         queue(_Sequence&& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:187:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:183:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(const _Sequence&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >]'
  183 |         queue(const _Sequence& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:183:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:179:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(const _Alloc&) [with _Requires = _Alloc; _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >]'
  179 |         queue(const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:179:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_queue.h: In substitution of 'template<class _Tp, class _Sequence> template<class _Alloc> using std::queue<_Tp, _Sequence>::_Uses = typename std::enable_if<std::uses_allocator<_Sequence, _Alloc>::value>::type [with _Alloc = int; _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >]':
/usr/include/c++/14/bits/stl_queue.h:177:33:   required from here
  177 |       template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
      |                                 ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:125:15: error: no type named 'type' in 'struct std::enable_if<false, void>'
  125 |         using _Uses = typename
      |               ^~~~~
/usr/include/c++/14/bits/stl_queue.h:166:9: note: candidate: 'template<class _Seq, class _Requires> std::queue<_Tp, _Sequence>::queue() [with _Requires = _Seq; _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >]'
  166 |         queue()
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:166:9: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:174:7: note: candidate: 'std::queue<_Tp, _Sequence>::queue(_Sequence&&) [with _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >]'
  174 |       queue(_Sequence&& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_queue.h:174:25: note:   no known conversion for argument 1 from 'int' to 'std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >&&'
  174 |       queue(_Sequence&& __c)
      |             ~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:170:7: note: candidate: 'std::queue<_Tp, _Sequence>::queue(const _Sequence&) [with _Tp = std::__cxx11::basic_string<char>; _Sequence = std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >]'
  170 |       queue(const _Sequence& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_queue.h:170:30: note:   no known conversion for argument 1 from 'int' to 'const std::deque<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> > >&'
  170 |       queue(const _Sequence& __c)
      |             ~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:96:11: note: candidate: 'std::queue<std::__cxx11::basic_string<char> >::queue(const std::queue<std::__cxx11::basic_string<char> >&)'
   96 |     class queue
      |           ^~~~~
/usr/include/c++/14/bits/stl_queue.h:96:11: note:   no known conversion for argument 1 from 'int' to 'const std::queue<std::__cxx11::basic_string<char> >&'
/usr/include/c++/14/bits/stl_queue.h:96:11: note: candidate: 'std::queue<std::__cxx11::basic_string<char> >::queue(std::queue<std::__cxx11::basic_string<char> >&&)'
/usr/include/c++/14/bits/stl_queue.h:96:11: note:   no known conversion for argument 1 from 'int' to 'std::queue<std::__cxx11::basic_string<char> >&&'
a.cc:9:31: error: no matching function for call to 'std::queue<int>::queue(int&)'
    9 |         std::queue<int> time(n);
      |                               ^
/usr/include/c++/14/bits/stl_queue.h:195:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(std::queue<_Tp, _Sequence>&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  195 |         queue(queue&& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:195:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:191:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(const std::queue<_Tp, _Sequence>&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  191 |         queue(const queue& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:191:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:187:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(_Sequence&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  187 |         queue(_Sequence&& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:187:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:183:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(const _Sequence&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  183 |         queue(const _Sequence& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:183:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:179:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  179 |         queue(const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:179:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_queue.h: In substitution of 'template<class _Tp, class _Sequence> template<class _Alloc> using std::queue<_Tp, _Sequence>::_Uses = typename std::enable_if<std::uses_allocator<_Sequence, _Alloc>::value>::type [with _Alloc = int; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]':
/usr/include/c++/14/bits/stl_queue.h:177:33:   required from here
  177 |       template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
      |                                 ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:125:15: error: no type named 'type' in 'struct std::enable_if<false, void>'
  125 |         using _Uses = typename
      |               ^~~~~
/usr/include/c++/14/bits/stl_queue.h:166:9: note: candidate: 'template<class _Seq, class _Requires> std::queue<_Tp, _Sequence>::queue() [with _Requires = _Seq; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  166 |         queue()
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:166:9: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:174:7: note: candidate: 'std::queue<_Tp, _Sequence>::queue(_Sequence&&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  174 |       queue(_Sequence&& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_queue.h:174:25: note:   no known conversion for argument 1 from 'int' to 'std::deque<int, std::allocator<int> >&&'
  174 |       queue(_Sequence&& __c)
      |             ~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:170:7: note: candidate: 'std::queue<_Tp, _Sequence>::queue(const _Sequence&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  170 |       queue(const _Sequence& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_queue.h:170:30: note:   no known conversion for argument