Language: C++

#include<iostream>
#include<vector>
using namespace std;

struct data {
  int h,w,num;
  bool operator < (const data &p)const{
    return num<p.num;
  }
};
int n,w,d,p,s,cnt;
vector < data > t;

int main(){
  while(cin>>n>>w>>d){
    if(n==0&&w==0&&d==0)break;

    t.clear();
    t.push_back( (data){d,w,1} );
    cnt=1;

    for(int i=1;i<=n;i++){
      cin>>p>>s;
      p--;
      data d = t[p];
      data e = t[p];

      s=s%(d.h*2+d.w*2);
      if(s>d.h+d.w)s-=(d.h+d.w);

      if(s>d.w){
	d.h=s-d.w;
	e.h=e.h-d.h;
      }else{
	d.w=s;
	e.w=e.w-d.w;
      }

      if(e.h*e.w<d.h*d.w){
	e.num=cnt+1;
	d.num=cnt+2;
	t[p]=e;
	t.push_back(d);
      }else{
	d.num=cnt+1;
	e.num=cnt+2;
	t.push_back(e);
	t[p]=d;
      }
      cnt+=2;
      sort(t.begin(),t.end());
    }//i

    for(int i=0;i<(int)t.size();i++){
      t[i].num=t[i].h*t[i].w;
    }
    sort(t.begin(),t.end());
    for(int i=0;i<(int)t.size();i++){
      if(i)cout<<' ';
      cout<<t[i].num;
    }
    cout<<endl;
  }
  return 0;
}

Compiler output:
a.cc:12:15: error: template argument 1 is invalid
   12 | vector < data > t;
      |               ^
a.cc:12:15: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:18:7: error: request for member 'clear' in 't', which is of non-class type 'int'
   18 |     t.clear();
      |       ^~~~~
a.cc:19:7: error: request for member 'push_back' in 't', which is of non-class type 'int'
   19 |     t.push_back( (data){d,w,1} );
      |       ^~~~~~~~~
a.cc:19:19: error: reference to 'data' is ambiguous
   19 |     t.push_back( (data){d,w,1} );
      |                   ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:5:8: note:                 'struct data'
    5 | struct data {
      |        ^~~~
a.cc:25:7: error: reference to 'data' is ambiguous
   25 |       data d = t[p];
      |       ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:5:8: note:                 'struct data'
    5 | struct data {
      |        ^~~~
a.cc:26:7: error: reference to 'data' is ambiguous
   26 |       data e = t[p];
      |       ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:5:8: note:                 'struct data'
    5 | struct data {
      |        ^~~~
a.cc:28:14: error: request for member 'h' in 'd', which is of non-class type 'int'
   28 |       s=s%(d.h*2+d.w*2);
      |              ^
a.cc:28:20: error: request for member 'w' in 'd', which is of non-class type 'int'
   28 |       s=s%(d.h*2+d.w*2);
      |                    ^
a.cc:29:14: error: request for member 'h' in 'd', which is of non-class type 'int'
   29 |       if(s>d.h+d.w)s-=(d.h+d.w);
      |              ^
a.cc:29:18: error: request for member 'w' in 'd', which is of non-class type 'int'
   29 |       if(s>d.h+d.w)s-=(d.h+d.w);
      |                  ^
a.cc:29:26: error: request for member 'h' in 'd', which is of non-class type 'int'
   29 |       if(s>d.h+d.w)s-=(d.h+d.w);
      |                          ^
a.cc:29:30: error: request for member 'w' in 'd', which is of non-class type 'int'
   29 |       if(s>d.h+d.w)s-=(d.h+d.w);
      |                              ^
a.cc:31:14: error: request for member 'w' in 'd', which is of non-class type 'int'
   31 |       if(s>d.w){
      |              ^
a.cc:32:11: error: request for member 'h' in 'd', which is of non-class type 'int'
   32 |         d.h=s-d.w;
      |           ^
a.cc:32:17: error: request for member 'w' in 'd', which is of non-class type 'int'
   32 |         d.h=s-d.w;
      |                 ^
a.cc:33:9: error: 'e' was not declared in this scope
   33 |         e.h=e.h-d.h;
      |         ^
a.cc:33:19: error: request for member 'h' in 'd', which is of non-class type 'int'
   33 |         e.h=e.h-d.h;
      |                   ^
a.cc:35:11: error: request for member 'w' in 'd', which is of non-class type 'int'
   35 |         d.w=s;
      |           ^
a.cc:36:9: error: 'e' was not declared in this scope
   36 |         e.w=e.w-d.w;
      |         ^
a.cc:36:19: error: request for member 'w' in 'd', which is of non-class type 'int'
   36 |         e.w=e.w-d.w;
      |                   ^
a.cc:39:10: error: 'e' was not declared in this scope
   39 |       if(e.h*e.w<d.h*d.w){
      |          ^
a.cc:39:20: error: request for member 'h' in 'd', which is of non-class type 'int'
   39 |       if(e.h*e.w<d.h*d.w){
      |                    ^
a.cc:39:24: error: request for member 'w' in 'd', which is of non-class type 'int'
   39 |       if(e.h*e.w<d.h*d.w){
      |                        ^
a.cc:41:11: error: request for member 'num' in 'd', which is of non-class type 'int'
   41 |         d.num=cnt+2;
      |           ^~~
a.cc:42:10: error: invalid types 'int[int]' for array subscript
   42 |         t[p]=e;
      |          ^
a.cc:43:11: error: request for member 'push_back' in 't', which is of non-class type 'int'
   43 |         t.push_back(d);
      |           ^~~~~~~~~
a.cc:45:11: error: request for member 'num' in 'd', which is of non-class type 'int'
   45 |         d.num=cnt+1;
      |           ^~~
a.cc:47:11: error: request for member 'push_back' in 't', which is of non-class type 'int'
   47 |         t.push_back(e);
      |           ^~~~~~~~~
a.cc:48:10: error: invalid types 'int[int]' for array subscript
   48 |         t[p]=d;
      |          ^
a.cc:51:14: error: request for member 'begin' in 't', which is of non-class type 'int'
   51 |       sort(t.begin(),t.end());
      |              ^~~~~
a.cc:51:24: error: request for member 'end' in 't', which is of non-class type 'int'
   51 |       sort(t.begin(),t.end());
      |                        ^~~
a.cc:51:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   51 |       sort(t.begin(),t.end());
      |       ^~~~
      |       short
a.cc:54:26: error: request for member 'size' in 't', which is of non-class type 'int'
   54 |     for(int i=0;i<(int)t.size();i++){
      |                          ^~~~
a.cc:55:8: error: invalid types 'int[int]' for array subscript
   55 |       t[i].num=t[i].h*t[i].w;
      |        ^
a.cc:55:17: error: invalid types 'int[int]' for array subscript
   55 |       t[i].num=t[i].h*t[i].w;
      |                 ^
a.cc:55:24: error: invalid types 'int[int]' for array subscript
   55 |       t[i].num=t[i].h*t[i].w;
      |                        ^
a.cc:57:12: error: request for member 'begin' in 't', which is of non-class type 'int'
   57 |     sort(t.begin(),t.end());
      |            ^~~~~
a.cc:57:22: error: request for member 'end' in 't', which is of non-class type 'int'
   57 |     sort(t.begin(),t.end());
      |                      ^~~
a.cc:57:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   57 |     sort(t.begin(),t.end());
      |     ^~~~
      |     short
a.cc:58:26: error: request for member 'size' in 't', which is of non-class type 'int'
   58 |     for(int i=0;i<(int)t.size();i++){
      |                          ^~~~
a.cc:60:14: error: invalid types 'int[int]' for array subscript
   60 |       cout<<t[i].num;
      |              ^