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_year_array, int start_year, int final_year);
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;
    }
}

int get_leap_years(int* leap_year_array, int start_year, int final_year)
{
    for(int i = start_year; i <= final_year; i++){
        if(is_leap_year(i)){
            leap_year_array[count] = i;
            count++;
        }
    }
    return count + 1;
}

C++: #include<cstdio>
main(){int a,b,d=0,c;while(scanf("%d%d",&a,&b),a){if(d++)puts("");c=0;for(;a<=b;a++)if(a%4<1)if(a%25 || a%16)c++,printf("%d\n",a);if(!c)puts("NA");}}

C++: 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    int hoge = 0;
    while(1){
        int a, b; cin >> a >> b;
        if(!a) break;

        if(hoge != 0) cout << endl;
        int cnt = 0;
        for(int x = a; x <= b; x++){
            if(x % 4 != 0) continue;
            if(x % 100 == 0 && x % 400 != 0) continue;
            cout << x << endl;
            cnt++;
        }

        if(cnt == 0) cout << "NA" << endl;
        hoge++;
    }   
    return 0;
}

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

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

inline bool is_leapyear(unsigned int y){
    return (y & 3) == 0 && (y % 100 != 0 || (y / 100 & 3) == 0);
}

void solve(int a, int b){
    bool flag = false;
    for(int i = a; i <= b; i++){
        if(is_leapyear(i)){
            printf("%d\n", i);
            flag = true;
        }
    }
    if(!flag) puts("NA");
}

int main(){
    int a, b;
    bool flag = false;
    while(cin >> a >> b){
        if(flag) puts("");
        if(a == 0 && b == 0) break;
        solve(a, b);
        flag = true;
    }
    return 0;
}

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

using namespace std;

void uru(int c, int d) {
	int counter = 0;

	for (int i = c; i <= d; i++) {
		if (i % 4 == 0) {
			if (i % 100 == 0) {
				if (i % 400 == 0) {
					cout << i << endl;
					counter++;
				} 
			} else {
				cout << i << endl;
				counter++;
			}
		}
	}
	if (counter == 0) {
		cout << "NA" << endl;
	}
	//cout << endl;
	return;
}

int main() {
	int a,b;

	while (1) {
		scanf("%d%d", &a, &b);
		if (a == 0 && b == 0) {
			break;
		} else {
			uru(a,b);
		}
	}
	return 0;
}

C++: #include<stdio.h>

int main(){
	int a,b,i,c;
	while(0<=scanf("%d%d",&a,&b)){
		if(a==0 && b==0) break;
		c=0;
		for(i=a;i<=b;i++){
			if(i%400==0 || i%100!=0 && i%4==0){
				++c;
				printf("%d\n",i);
			}
		}
		if(c==0){
			printf("NA\n\n");
		}else{
			printf("\n");
		}
	}
	return 0;
}

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

int main()
{
	int syear,eyear;
	while(cin >> syear && cin >> eyear){
		if(syear==0&&eyear==0)
			break;
		bool flag = false;
		for(int i=syear;i<=eyear;i++){
			if(i%4==0){
				if(i%400==0){
					flag = true;
					cout << i << endl;
				}
				else if(i%100==0)
					break;
				else{
					flag = true;
					cout << i << endl;
				}
			}
		}
		if(flag==false)
			cout << "NA" << endl;
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int a,b;
int init=0;
int main(){
while(cin>>a>>b){
	if(a==0&&b==0)break;
	if(init!=0)cout<<endl;
	init=1;
	int ans=0;
	for (int i = a; i <= b; ++i) {
		if((i%4==0)&&(i%100)!=0||(i%400==0)){cout<<i<<endl;ans++;}
	}
	if(ans==0){cout<<"NA"<<endl;}
}
return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    while (true){
    int a,b,n=0;
    cin >> a >> b;
    if (a==0 && b==0) break;
    for (int i=a;i<b+1;i++){
        if (i%400==0) {n=1;cout << i << endl;}
        else if (i%100==0) continue;
        else if (i%4==0) {n=1;cout << i << endl;}
    }
    if (n==0) cout << "NA" << endl;
    cout << endl;
    }
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
	int a,b;
	bool first=1;
	while(cin>>a>>b,a||b){
	if(first==0)cout<<endl;
	first=0;
	bool f=0;
	for(int i=a;i<=b;i++){
	if( i%4==0&&i%100!=0 ||i%400==0  ){cout<<i<<endl;f=1;}
	}
	if(f==0)cout<<"NA"<<endl;
	}
	return 0;
}