Language: C++

#include <stdio.h>
 
int32_t year, month, day, sum;

int print(void);

int main(void)
{
    while(scanf("%d %d %d", &year, &month, &day) != EOF) {
    sum = 10000 * year+ 100 * month + day;
    print();
    }
    return 0;
}

int print(void)
{
    if (sum < 18680907) {
        printf("pre-meiji\n");
    } else if (sum < 19120730) {
        printf("meiji %d %d %d\n", year - 1867, month, day);
    } else if (sum < 19261225) {
        printf("taisho %d %d %d\n", year - 1911, month, day);
    } else if (sum < 19890108) {
        printf("showa %d %d %d\n", year - 1925, month, day);
    } else {
        printf("heisei %d %d %d\n", year - 1988, month, day);
    }
}

Compiler output:
a.cc:3:1: error: 'int32_t' does not name a type
    3 | int32_t year, month, day, sum;
      | ^~~~~~~
a.cc:2:1: note: 'int32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    1 | #include <stdio.h>
  +++ |+#include <cstdint>
    2 | 
a.cc: In function 'int main()':
a.cc:9:30: error: 'year' was not declared in this scope
    9 |     while(scanf("%d %d %d", &year, &month, &day) != EOF) {
      |                              ^~~~
a.cc:9:37: error: 'month' was not declared in this scope
    9 |     while(scanf("%d %d %d", &year, &month, &day) != EOF) {
      |                                     ^~~~~
a.cc:9:45: error: 'day' was not declared in this scope
    9 |     while(scanf("%d %d %d", &year, &month, &day) != EOF) {
      |                                             ^~~
a.cc:10:5: error: 'sum' was not declared in this scope
   10 |     sum = 10000 * year+ 100 * month + day;
      |     ^~~
a.cc: In function 'int print()':
a.cc:18:9: error: 'sum' was not declared in this scope
   18 |     if (sum < 18680907) {
      |         ^~~
a.cc:21:36: error: 'year' was not declared in this scope
   21 |         printf("meiji %d %d %d\n", year - 1867, month, day);
      |                                    ^~~~
a.cc:21:49: error: 'month' was not declared in this scope
   21 |         printf("meiji %d %d %d\n", year - 1867, month, day);
      |                                                 ^~~~~
a.cc:21:56: error: 'day' was not declared in this scope
   21 |         printf("meiji %d %d %d\n", year - 1867, month, day);
      |                                                        ^~~
a.cc:23:37: error: 'year' was not declared in this scope
   23 |         printf("taisho %d %d %d\n", year - 1911, month, day);
      |                                     ^~~~
a.cc:23:50: error: 'month' was not declared in this scope
   23 |         printf("taisho %d %d %d\n", year - 1911, month, day);
      |                                                  ^~~~~
a.cc:23:57: error: 'day' was not declared in this scope
   23 |         printf("taisho %d %d %d\n", year - 1911, month, day);
      |                                                         ^~~
a.cc:25:36: error: 'year' was not declared in this scope
   25 |         printf("showa %d %d %d\n", year - 1925, month, day);
      |                                    ^~~~
a.cc:25:49: error: 'month' was not declared in this scope
   25 |         printf("showa %d %d %d\n", year - 1925, month, day);
      |                                                 ^~~~~
a.cc:25:56: error: 'day' was not declared in this scope
   25 |         printf("showa %d %d %d\n", year - 1925, month, day);
      |                                                        ^~~
a.cc:27:37: error: 'year' was not declared in this scope
   27 |         printf("heisei %d %d %d\n", year - 1988, month, day);
      |                                     ^~~~
a.cc:27:50: error: 'month' was not declared in this scope
   27 |         printf("heisei %d %d %d\n", year - 1988, month, day);
      |                                                  ^~~~~
a.cc:27:57: error: 'day' was not declared in this scope
   27 |         printf("heisei %d %d %d\n", year - 1988, month, day);
      |                                                         ^~~
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^