Language: C++

#include<string>
#include<queue>

int main()
{
	int i,all_time=0,sa;
#include<iostream>
	int n,q;
	std::string name[100];
	int time[100];
	
	std::cin>>n>>q;
	for(i=0; i<n; i++){
		std::cin>>name[i]>>time[i];
	}
	for (i = 0; i < n; i++) {
		if (time[i] < q) {
			all_time += time[i];
			std::cout << name[i] << " " <<all_time<<'\n';
		}
		else {
			all_time += q;
			time[sa+1] = time[i] - q;
			sa += 1;
			std::cout << name[i] << " " << all_time << '\n';
		}
	}

	return 0;
}


Compiler output:
In file included from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:7:
/usr/include/c++/14/exception: In function 'int main()':
/usr/include/c++/14/exception:41:8: error: expected unqualified-id before string constant
   41 | extern "C++" {
      |        ^~~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:36,
                 from /usr/include/c++/14/exception:166:
/usr/include/c++/14/bits/cxxabi_init_exception.h:50:1: error: 'namespace' definition is not allowed here
   50 | namespace std
      | ^~~~~~~~~
/usr/include/c++/14/bits/cxxabi_init_exception.h:55:1: error: 'namespace' definition is not allowed here
   55 | namespace __cxxabiv1
      | ^~~~~~~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:37:
/usr/include/c++/14/typeinfo:44:8: error: expected unqualified-id before string constant
   44 | extern "C++" {
      |        ^~~~~
/usr/include/c++/14/bits/exception_ptr.h:50:8: error: expected unqualified-id before string constant
   50 | extern "C++" {
      |        ^~~~~
In file included from /usr/include/c++/14/exception:167:
/usr/include/c++/14/bits/nested_exception.h:40:8: error: expected unqualified-id before string constant
   40 | extern "C++" {
      |        ^~~~~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/string:38,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/sched.h:128:1: error: expected unqualified-id before string constant
  128 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/cpu-set.h:115:1: error: expected unqualified-id before string constant
  115 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
/usr/include/sched.h:51:1: error: expected unqualified-id before string constant
   51 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/time.h:75:1: error: expected unqualified-id before string constant
   75 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
/usr/include/time.h:68:1: error: expected unqualified-id before string constant
   68 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/pthread_stack_min-dynamic.h:23:1: error: expected unqualified-id before string constant
   23 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
/usr/include/pthread.h:197:1: error: expected unqualified-id before string constant
  197 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44:
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:314:1: error: a function-definition is not allowed here before '{' token
  314 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:675:1: error: a function-definition is not allowed here before '{' token
  675 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:681:1: error: a function-definition is not allowed here before '{' token
  681 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:687:1: error: a function-definition is not allowed here before '{' token
  687 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:693:1: error: a function-definition is not allowed here before '{' token
  693 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:699:1: error: a function-definition is not allowed here before '{' token
  699 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:705:1: error: a function-definition is not allowed here before '{' token
  705 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:711:1: error: a function-definition is not allowed here before '{' token
  711 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:720:1: error: a function-definition is not allowed here before '{' token
  720 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:726:1: error: a function-definition is not allowed here before '{' token
  726 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:732:1: error: a function-definition is not allowed here before '{' token
  732 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:738:1: error: a function-definition is not allowed here before '{' token
  738 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:744:1: error: a function-definition is not allowed here before '{' token
  744 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:751:1: error: a function-definition is not allowed here before '{' token
  751 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:760:1: error: a function-definition is not allowed here before '{' token
  760 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:769:1: error: a function-definition is not allowed here before '{' token
  769 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:780:1: error: a function-definition is not allowed here before '{' token
  780 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:790:1: error: a function-definition is not allowed here before '{' token
  790 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:823:1: error: a function-definition is not allowed here before '{' token
  823 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:829:1: error: a function-definition is not allowed here before '{' token
  829 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:837:1: error: a function-definition is not allowed here before '{' token
  837 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:844:1: error: a function-definition is not allowed here before '{' token
  844 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:850:1: error: a function-definition is not allowed here before '{' token
  850 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:865:1: error: a function-definition is not allowed here before '{' token
  865 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:871:1: error: a function-definition is not allowed here before '{' token
  871 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:877:1: error: a function-definition is not allowed here before '{' token
  877 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:884:1: error: a function-definition is not allowed here before '{' token
  884 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:891:1: error: a function-definition is not allowed here before '{' token
  891 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:897:1: error: a function-definition is not allowed here before '{' token
  897 | {
      | ^
/usr/include/x86_64-linux-gnu/sys/single_threaded.h:24:1: error: expected unqualified-id before string constant
   24 | __BEGIN_DECLS
      | ^~~~~~~~~~~~~
/usr/include/c++/14/ext/atomicity.h:41:21: error: expected '=' before '__attribute__'
   41 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/atomicity.h:41:21: error: expected identifier before '__attribute__'
/usr/include/c++/14/ext/atomicity.h:41:20: error: expected ';' before '__attribute__'
   41 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
      |                    ^
      |                    ;
/usr/include/c++/14/ext/atomicity.h:42:1: error: expected primary-expression before '{' token
   42 | {
      | ^
/usr/include/c++/14/bits/locale_classes.h:47:15: error: expected '=' before '__attribute__'
   47 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/locale_classes.h:47:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/locale_classes.h:47:14: error: expected ';' before '__attribute__'
   47 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/14/bits/locale_classes.h:48:1: error: expected primary-expression before '{' token
   48 | {
      | ^
/usr/include/c++/14/bits/locale_classes.tcc:39:15: error: expected '=' before '__attribute__'
   39 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/locale_classes.tcc:39:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/bits/locale_classes.h:888:
/usr/include/c++/14/bits/locale_classes.tcc:39:14: error: expected ';' before '__attribute__'
   39 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/14/bits/locale_classes.tcc:40:1: error: expected primary-expression before '{' token
   40 | {
      | ^
/usr/include/x86_64-linux-gnu/c++/14/bits/error_constants.h:36:15: error: expected '=' before '__attribute__'
   36 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/c++/14/bits/error_constants.h:36:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/system_error:41,
                 from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/x86_64-linux-gnu/c++/14/bits/error_constants.h:36:14: error: expected ';' before '__attribute__'
   36 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/x86_64-linux-gnu/c++/14/bits/error_constants.h:37:1: error: expected primary-expression before '{' token
   37 | {
      | ^
/usr/include/c++/14/stdexcept:41:15: error: expected '=' before '__attr