This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt,fma")
#include<bits/stdc++.h>
#ifdef DEBUG
  #include "debug.h"
#else
  #define debug(...) void(37)
#endif
using namespace std;
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N;
	cin >> N;
	string type, name;
	int sec(0), subsec(0), subsubsec(0);
	for(register int i = 0; i < N; ++i){
		cin >> type >> name;
		if(type == "section"){
			subsec = subsubsec = 0;
			++sec;
			cout << sec << ' ' << name << '\n';
		}else if(type == "subsection"){
			subsubsec = 0;
			++subsec;
			cout << sec << '.' << subsec << ' ' << name << '\n';
		}else{
			++subsubsec;
			cout << sec << '.' << subsec << '.' << subsubsec << ' ' << name << '\n';
		}
    }
    return 0;
}
Compilation message (stderr)
Main.cpp: In function 'int main()':
Main.cpp:19:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |  for(register int i = 0; i < N; ++i){
      |                   ^| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |