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++: #include <stdio.h>
#include <stdbool.h>

bool is_leap_year(int y);

int get_leap_years(int leap_years_list[1000], int year_begin, int year_end)
{
    int count = 0;
    for(int year = year_begin; year <= year_end; ++year) {
        if (is_leap_year(year) != false) {
            leap_years_list[count] = year;
            ++count;
        }
    }
    return count;
}
        

int main()
{
    int leap_years_list[1000]; //A.D. 0 - A.D. 3000 の間に閏年は高々1000個しかない

    bool first_set = true; //一つ目のセットの前にだけは改行を入れてはいけないので

    while (true) {
        int year_begin, year_end;

        //読み込み
        scanf("%d %d", &year_begin, &year_end);

        //終了判定
        if (year_begin == 0 && year_end == 0) {
            break;
        }

        //閏年を計算する
        int leap_years_count = get_leap_years(leap_years_list, year_begin, year_end);

        //セットとセットの間には空行を入れる
        if (first_set) {
            first_set = false;
        } else {
            putchar('\n'); //putcharは一文字だけ出力する関数です
        }

        //閏年を出力
        if (leap_years_count == 0) {
            puts("NA"); //putsは与えられた文字列を出力した後改行する関数です
        } else {
            for (int i = 0; i < leap_years_count; i++) {
                printf("%d\n", leap_years_list[i]);
            }
        }
        
    }
}

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

C++: #include <iostream>

using namespace std;

int main()
{
    int a, b;
    bool flag = false;

    while (cin >> a >> b, a || b) {
        int ans = 0;

        if (flag)
            cout << endl;
        for ( ; a <= b; a++) {
            if (a % 4 == 0 && (a % 100 != 0 || a % 400 == 0)) {
                cout << a << endl;
                ans++;
            }
        }
        if (ans == 0)
            cout << "NA" << endl;
        flag = true;
    }
    
    return 0;
}

C++: #include<stdio.h>
/*与えられた期間の間のうるう年をすべて出力*/
void leap_year(int year1, int year2);

int main(void)
{
    while (1){
        int a, b; /*a は year1　, b は year2*/
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0){
            break;
        }else if (a == b){
            printf("\n");
            printf("NA\n");
            printf("\n");
        }else {
            leap_year(a, b);
        }
    }
    return 0;
}

void leap_year(int year1, int year2)
{   
    int limit = 0; /*もしも、うるう年がなかった時に使う*/
    printf("\n");
    for (int i = year1; i <= year2; ++i){ /*i は年を表す*/     
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
            printf("%d\n", i);
        }else{
            ++limit;
        }
    }
    if (limit == (year2 - year1 + 1)){/*うるう年がない場合*/
        printf("NA\n");
        printf("\n");
    }else{    /*うるう年がある場合*/
        printf("\n");
    }
}

C++: #include<iostream>
using namespace std;
int main() {
	int a, b;
	bool fi = true;
	while (cin >> a >> b, a || b) {
		if (!fi)cout << endl;
		fi = false;
		bool f = false;
		for (int i = a; i <= b; i++) {
			if (i % 400 == 0) {
				cout << i << endl;
				f = true;
			}
			else if (i % 100 == 0) {
			}
			else if (i % 4 == 0) {
				cout << i << endl;
				f = true;
			}
		}
		if (!f) cout << "NA" << endl;
	}
}

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

int main()
{
	int a, b;
	bool first = false;

	while (scanf("%d%d", &a, &b), a){
		bool check = true;
		for (int i = a; i <= b; i++){
			if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)){
				printf("%d\n", i);
				check = false;
			}
		}

		if (check && first){
			printf("NA\n");
		}
		first = true;
	}

	return (0);
}

C++: #include <iostream>
using namespace std;
int main(){
	int a,b;
	while(1){
		cin >> a >> b ;
		if(a==0 && b==0) break;
		int* ans=new int[(b-a+1)/4];int n=0;
		for(int i=a;i<=b;i++) if((i%4==0 && i%100!=0) || i%400==0) ans[n++]=i;
		if(n==0) cout << "NA\n" ;
		else for(int j=0;j<n;j++) cout << ans[j] << '\n';
		cout << '\n' ;
	};
}

C++: #include <stdio.h>
#include <stdbool.h>

void leapyear (int year1, int year2)
{
    int i;
    int j = 0; 
    for (i = year1; i <= year2; ++i) {
        if (i % 4 == 0) {
            if (i % 100 != 0) {
                printf("%d\n", i);
                ++j;
            } else if (i % 400 == 0) {
                printf("%d\n", i);
                ++j;
            } 
        }
    }
    if (j == 0) {
        printf("NA\n");
    }
    printf("\n");
}

int main(void)
{
    int k = 0;
    while (true) {
        if (k != 0) {
            printf("\n");
        }
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        leapyear(year1, year2);
        ++k;
    }
    return 0;
}

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

int main(){
	int A,B;
	while(cin>>A>>B,A||B){
		bool flag=false;
		for(int i=A;i<=B;i++){
			if(i%4==0 && (i%100!=0 || i%400==0)){
				printf("%d\n",i);
				flag=true;
			}
		}
		if(flag==false) puts("NA");
		puts("");
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define rep(i, n) for(int i=0;i<n;i++)
#define FOR(i, j, n) for(int i=j;i<n;i++)
#define IS_NEGATIVE(i) 0>i
#define BIG 2
#define MEDIUM 1
#define SMALL 0
#define DEBUG 0

using namespace std;

int main() {
    int start, end;
    while(1) {
        cin >> start >> end;
        if (!start && !end) return 0;

        bool flag = false;
        for(int i = start; i <= end; i++) {
            if (i % 4  == 0 && (i % 100 != 0 || i % 400 == 0)) {
                flag = true;
                cout << i << endl;
            }
        }
        if (!flag) {
            cout << "NA" << endl;
        }
        cout << endl;
    }
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	int a,b;
	int y=0;
	int x=0;
	while(true){
		cin>>a>>b;
		if(a+b==0) break;
		if(y!=0) cout<<endl;
		for(int i=a;i<=b;i++){
			if((i%4==0&&i%100!=0)||i%400==0){
				printf("%d\n",i);
				x++;
			}
			if(i==b&&x==0){
				printf("%s\n","NA");
			}
		}
		x=0;
		y++;
	}
}