This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include  <bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
//#define int long long int
//#define ll long long
#define pb push_back
#define p push
#define f first
#define s second
#define N 350
signed main(){
  lalala;
  int n;cin>>n;
  int a=0,b=0,c=0;
  while(n--){
    string x,y;cin>>x>>y;
    if(x=="section"){
      a++;
      b=c=0;
      cout<<a<<" "<<y<<endl;
    }
    else if(x=="subsection"){
      if(a==0)a=1;
      b++;
      c=0;
      cout<<a<<"."<<b<<" "<<y<<endl;
    }
    else{
      if(a==0)a=1;
      if(b==0)b=1;
      c++;
      cout<<a<<"."<<b<<"."<<c<<" "<<y<<endl;
    }
  }
 
}
| # | 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... |