Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func isLeapYear(y int) bool {
	return (y%4 == 0 && y%100 > 0) || (y%4 == 0 && y%400 == 0)
}

func cntLeap(y []int) {
	cnt := 0

	for i := y[0]; i <= y[1]; i++ {
		if isLeapYear(i) {
			cnt++
			fmt.Println(i)
		}
	}

	if cnt == 0 {
		fmt.Println("NA")
	}
}

func main() {
	num := 0

	for sc.Scan() {
		y := Sliceconvtoi()

		if y[0] == 0 && y[1] == 0 {
			break
		}

		if num > 0 {
			fmt.Println()
		}

		cntLeap(y)
		num++
	}

}

C++: #define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	bool f = true;
	for (ll a = in(), b = in(); a != 0; a = in(), b = in()) {
		if (!f)cout << endl;
		else f = false;
		ll cnt = 0;
		for (ll i = a; i <= b; ++i)if (i % 400 == 0 || i % 100 != 0 && i % 4 == 0) {
			cout << i << endl;
			++cnt;
		}
		if (cnt == 0) {
			cout << "NA" << endl;
		}
	}
}

C++: #include <stdio.h>
	
void uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
}
	
int main(void)
{	
	int first, end;
	while (1) {
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			printf("\n");
			uruu(first, end);
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    int a, b;

    while(scanf("%d%d", &a, &b) == 2 && a != 0 && b!= 0) {
        int in = 1;
        int count = 0;
        for(int i = a; i <= b; i+=in) {
            if(i%4 == 0){
                if(i%100 == 0){
                    
                    if (i%400 == 0) {
                        in = 4;
                        count++;
                        cout << i <<endl;
                    }
                    
                }
                else{
                    in = 4;
                    count++;
                    cout << i << endl;
                }
            }
        }
        if(count == 0)
            cout << "NA" << endl;
        cout << endl;
    }

    

        
        
    return 0;
}

C++: #include <stdio.h>

void leap_year(int x, int y)
{
    while (x <= y) {
        if (((x % 4 == 0) && (x % 100 != 0)) || (x % 400 == 0)) {
            printf("%d\n", x);
        }
        x += 1;
    }    
}

int main(void)
{
    int x, y;
    scanf("%d %d", &x, &y);
    while(!(x == 0 && y == 0)) {
        leap_year(x, y);
        printf("\n");
        scanf("%d %d", &x, &y);
    }
    return 0;
}

C++: #include <stdio.h>

void uru(int year);

int main(void)
{
    int a, b;
    int year;
    scanf("%d %d", &a, &b);
    for (year = a; year < b; ++year) {
        uru(year);
    }
    return 0;
}

void uru(int year)
{
    int R4, R100, R400;
    R4 = year % 4;
    R100 = year % 100;
    R400 = year % 400;
    if (R4 == 0 && R100 != 0) {
        printf("%d\n", year);
    } else if (R400 == 0) {
        printf("%d\n", year);
    }
}

C++: #include <iostream>
using namespace std;

//0093
int main(){
	int y1, y2;
	while(cin >> y1 >> y2, y1||y2){
		int count = 0;
		for(int i=y1; i<y2+1; ++i){
			if( (i%4)==0 && (i%100)!=0 || i%400==0 ){
				cout << i << endl;
				++count;
			}
		}

		if(!count){
			cout << "NA" << endl;
		}
		cout << endl;
	}
}

C++: #include <iostream>
#include <vector>
using namespace std;

void leap(int a, int b);
bool check(int a);

int main(void){
  int a,b;
  bool begin=true;
  while(1){
    cin>>a>>b;
    if(a==0 && b==0)break;
    if(begin==false)cout<<endl;
    leap(a,b);
    begin=false;
  }
}

void leap(int a, int b){
  vector<int> year;
  for(int i=a;i<=b;i++){
    if(check(i)){
      year.push_back(i);
    }
  }
  if(year.size()==0){
    cout<<"NA"<<endl;
  }
  else{
    for(int i=0;i<year.size();i++){
      cout<<year[i]<<endl;
    }
  }
}

bool check(int a){
  if(a%400==0){return true;}
  else if(a%100==0){return false;}
  else if(a%4==0){return true;}
  else{return false;}
}

C++: #include <stdio.h>


const int year[4] = {1868, 1912, 1926, 1989};
const int month[4] = {9, 7, 12, 1};
const int day[4] = {8, 30, 25, 8};
const char gengou[5] = {'p', 'm', 't', 's', 'h'};//??????pre-meiji, meiji, taisyou, syowa, heisei??¨??????

char gengouka (int inputyear, int inputmonth, int inputday)
{
    int i;
    char y;//y?????????????????????????????????
    for (i = 0; i < 3; ++i) {
        if (inputyear == year[i]) {//?¢?????????´?????¨????????????
            if (inputmonth == month[i]) {
                if (inputday < day[i]) {
                    y = gengou[i];
                    break;
                } else {
                    y = gengou[i + 1];
                    break;
                } 
            } else if (inputmonth < month[i]) {
                y = gengou[i];
                break;
            } else {
                y = gengou[i + 1];
                break;
            }
            break;
        } else if (inputyear < year[i]) {
            y = gengou[i]; 
            break;
        } 
        if (inputyear > year[3]) {//???????????????????????§??????
            y = gengou[4];
            break;
        }
    }
    return y;
}

int main(void) 
{
    int inputyear, inputmonth, inputday, outputyear;
??????while (scanf("%d %d %d", &inputyear, &inputmonth, &inputday) != EOF) {
        char y = gengouka(inputyear, inputmonth, inputday);
        if (y == 'p') {
            printf("pre-meiji\n");
        } else if (y == 'm') {
            outputyear = inputyear - year[0] + 1;
            printf("meiji %d %d %d\n", outputyear, inputmonth, inputday);
        } else if (y == 't') {
            outputyear = inputyear - year[1] + 1;
            printf("taisho %d %d %d\n", outputyear, inputmonth, inputday); 
        } else if (y == 's') {
            outputyear = inputyear - year[2] + 1;
            printf("syowa %d %d %d\n", outputyear, inputmonth, inputday);
        } else {
            outputyear = inputyear - year[3] + 1;
            printf("heisei %d %d %d\n", outputyear, inputmonth, inputday);
        }
    } 
    return 0;
}

C++: #include<stdio.h>
 
int main(){
	int a, b, i, count = 0;
	while(scanf("%d %d", &a, &b) != 0){
		if(a == 0 || b == 0) break;
		for(i = a; i <= b; i++){
			if(i % 400 == 0){
				printf("%d\n", i);
				count = 1;
			}else if(i % 100 == 0) continue;
			else if(i % 4 == 0){
				printf("%d\n", i);
				count = 1;
			}
		}
		if(count == 0) printf("NA\n\n");
	}
	return 0;
}

C++: 
#include <stdio.h>

int main(void) {

  int a,b;
  int i,flag;

  while(1) {

    scanf("%d %d",&a,&b);

    if(a==0 && b==0) {
      break;
    }

    flag=0;

    for(i=a;i<=b;i++) {
      
      if((i%4==0 && i%100!=0) || i%400==0) {
	printf("%d\n",i);
	flag=1;
      }

    }

    if(flag==0) printf("NA\n");

    printf("\n");
  }

  puts("");

  return 0;

}