Language: C++

#include <iostream>
#include <list>
#include <string>
using namespace std;

class Task {
public:
  void input() {
    cin >> name >> time;
  }
  string name;
  int time;
}

int main() {
  int n, q;
  list<Task&> tasks;

  cin >> n >> q;
  for (int i=0; i<n; i++) {
    auto task = Task;
    task.input();
    tasks.push_back(task);
  }

  list<Task&>::iterator current;
  int time = 0;

  while ((current = tasks.begin()) != tasks.end()) {
    if (current->time > 100) {
      current->time -= 100;
      tasks.push_back(current);
      tasks.erase(current);
    } else {
      cout << current->name << current->time << endl;
    }
    tasks.erase(current);
  }
}

Compiler output:
a.cc:13:2: error: expected ';' after class definition
   13 | }
      |  ^
      |  ;
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33,
                 from /usr/include/c++/14/bits/allocator.h:46,
                 from /usr/include/c++/14/string:43,
                 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/new_allocator.h: In instantiation of 'class std::__new_allocator<Task&>':
/usr/include/c++/14/bits/allocator.h:128:11:   required from 'class std::allocator<Task&>'
  128 |     class allocator : public __allocator_base<_Tp>
      |           ^~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:430:24:   required from 'class std::__cxx11::_List_base<Task&, std::allocator<Task&> >'
  430 |         rebind<_Tp>::other                              _Tp_alloc_type;
      |                                                         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:633:11:   required from 'class std::__cxx11::list<Task&>'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:17:15:   required from here
   17 |   list<Task&> tasks;
      |               ^~~~~
/usr/include/c++/14/bits/new_allocator.h:70:26: error: forming pointer to reference type 'Task&'
   70 |       typedef _Tp*       pointer;
      |                          ^~~~~~~
/usr/include/c++/14/bits/new_allocator.h:71:26: error: forming pointer to reference type 'Task&'
   71 |       typedef const _Tp* const_pointer;
      |                          ^~~~~~~~~~~~~
/usr/include/c++/14/bits/new_allocator.h:126:7: error: forming pointer to reference type 'Task&'
  126 |       allocate(size_type __n, const void* = static_cast<const void*>(0))
      |       ^~~~~~~~
/usr/include/c++/14/bits/new_allocator.h:156:7: error: forming pointer to reference type 'Task&'
  156 |       deallocate(_Tp* __p, size_type __n __attribute__ ((__unused__)))
      |       ^~~~~~~~~~
/usr/include/c++/14/bits/allocator.h: In instantiation of 'class std::allocator<Task&>':
/usr/include/c++/14/bits/stl_list.h:430:24:   required from 'class std::__cxx11::_List_base<Task&, std::allocator<Task&> >'
  430 |         rebind<_Tp>::other                              _Tp_alloc_type;
      |                                                         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:633:11:   required from 'class std::__cxx11::list<Task&>'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:17:15:   required from here
   17 |   list<Task&> tasks;
      |               ^~~~~
/usr/include/c++/14/bits/allocator.h:137:26: error: forming pointer to reference type 'Task&'
  137 |       typedef _Tp*       pointer;
      |                          ^~~~~~~
/usr/include/c++/14/bits/allocator.h:138:26: error: forming pointer to reference type 'Task&'
  138 |       typedef const _Tp* const_pointer;
      |                          ^~~~~~~~~~~~~
In file included from /usr/include/c++/14/ext/alloc_traits.h:34,
                 from /usr/include/c++/14/bits/basic_string.h:39,
                 from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/alloc_traits.h: In instantiation of 'struct std::allocator_traits<std::allocator<Task&> >':
/usr/include/c++/14/ext/alloc_traits.h:45:10:   required from 'struct __gnu_cxx::__alloc_traits<std::allocator<Task&>, Task&>'
   45 |   struct __alloc_traits
      |          ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:430:24:   required from 'class std::__cxx11::_List_base<Task&, std::allocator<Task&> >'
  430 |         rebind<_Tp>::other                              _Tp_alloc_type;
      |                                                         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:633:11:   required from 'class std::__cxx11::list<Task&>'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:17:15:   required from here
   17 |   list<Task&> tasks;
      |               ^~~~~
/usr/include/c++/14/bits/alloc_traits.h:470:13: error: forming pointer to reference type 'Task&'
  470 |       using pointer = _Tp*;
      |             ^~~~~~~
/usr/include/c++/14/bits/alloc_traits.h:473:13: error: forming pointer to reference type 'Task&'
  473 |       using const_pointer = const _Tp*;
      |             ^~~~~~~~~~~~~
/usr/include/c++/14/ext/alloc_traits.h: In instantiation of 'struct __gnu_cxx::__alloc_traits<std::allocator<Task&>, Task&>':
/usr/include/c++/14/bits/stl_list.h:430:24:   required from 'class std::__cxx11::_List_base<Task&, std::allocator<Task&> >'
  430 |         rebind<_Tp>::other                              _Tp_alloc_type;
      |                                                         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:633:11:   required from 'class std::__cxx11::list<Task&>'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:17:15:   required from here
   17 |   list<Task&> tasks;
      |               ^~~~~
/usr/include/c++/14/ext/alloc_traits.h:61:23: error: 'allocate' has not been declared in '__gnu_cxx::__alloc_traits<std::allocator<Task&>, Task&>::_Base_type'
   61 |     using _Base_type::allocate;
      |                       ^~~~~~~~
/usr/include/c++/14/ext/alloc_traits.h:62:23: error: 'deallocate' has not been declared in '__gnu_cxx::__alloc_traits<std::allocator<Task&>, Task&>::_Base_type'
   62 |     using _Base_type::deallocate;
      |                       ^~~~~~~~~~
In file included from /usr/include/c++/14/list:65,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_list.h: In instantiation of 'class std::__cxx11::list<Task&>':
a.cc:17:15:   required from here
   17 |   list<Task&> tasks;
      |               ^~~~~
/usr/include/c++/14/bits/stl_list.h:1269:7: error: 'void std::__cxx11::list<_Tp, _Alloc>::push_front(value_type&&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; value_type = Task&]' cannot be overloaded with 'void std::__cxx11::list<_Tp, _Alloc>::push_front(const value_type&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; value_type = Task&]'
 1269 |       push_front(value_type&& __x)
      |       ^~~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:1264:7: note: previous declaration 'void std::__cxx11::list<_Tp, _Alloc>::push_front(const value_type&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; value_type = Task&]'
 1264 |       push_front(const value_type& __x)
      |       ^~~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:1319:7: error: 'void std::__cxx11::list<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; value_type = Task&]' cannot be overloaded with 'void std::__cxx11::list<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; value_type = Task&]'
 1319 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:1314:7: note: previous declaration 'void std::__cxx11::list<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; value_type = Task&]'
 1314 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:1411:7: error: 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; iterator = std::__cxx11::list<Task&>::iterator; const_iterator = std::__cxx11::list<Task&>::const_iterator; value_type = Task&]' cannot be overloaded with 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; iterator = std::__cxx11::list<Task&>::iterator; const_iterator = std::__cxx11::list<Task&>::const_iterator; value_type = Task&]'
 1411 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
In file included from /usr/include/c++/14/list:66:
/usr/include/c++/14/bits/list.tcc:101:5: note: previous declaration 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; iterator = std::__cxx11::list<Task&>::iterator; const_iterator = std::__cxx11::list<Task&>::const_iterator; value_type = Task&]'
  101 |     list<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:21:21: error: expected primary-expression before ';' token
   21 |     auto task = Task;
      |                     ^
/usr/include/c++/14/bits/stl_list.h: In instantiation of 'struct std::_List_iterator<Task&>':
a.cc:26:25:   required from here
   26 |   list<Task&>::iterator current;
      |                         ^~~~~~~
/usr/include/c++/14/bits/stl_list.h:262:49: error: forming pointer to reference type 'Task&'
  262 |       typedef _Tp*                              pointer;
      |                                                 ^~~~~~~
a.cc:30:16: error: base operand of '->' has non-pointer type 'std::__cxx11::list<Task&>::iterator'
   30 |     if (current->time > 100) {
      |                ^~
a.cc:31:14: error: base operand of '->' has non-pointer type 'std::__cxx11::list<Task&>::iterator'
   31 |       current->time -= 100;
      |              ^~
a.cc:32:23: error: cannot convert 'std::__cxx11::list<Task&>::iterator' to 'Task&'
   32 |       tasks.push_back(current);
      |                       ^~~~~~~
      |                       |
      |                       std::__cxx11::list<Task&>::iterator
/usr/include/c++/14/bits/stl_list.h:1314:35: note:   initializing argument 1 of 'void std::__cxx11::list<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = Task&; _Alloc = std::allocator<Task&>; value_type = Task&]'
 1314 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_list.h: In instantiation of 'struct std::_List_const_iterator<Task&>':
a.cc:33:18