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 <iostream>

int leap_year(int year)
{
	if ( year % 4 == 0) {
		if ( year % 100 == 0) {
			if ( year % 400 == 0) {
				return 1;
			} else {
				return 0;
			}
		} else {
			return 1;
		}
	} else {
		return 0;
	}
}

int main()
{
	int a, b;
	
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			int i = 0;
			for (int j = 0; a + j <= b; j++) {
				if (leap_year(a + j) == 0) {
					i++;
				} else {
					std::cout << a + j << std::endl;
				}
			}
			if ( i == a - b + 1) {
				std::cout << "NA" << std::endl;
			}
			
			//std::cout << std::endl;
		}
	}
	
	return 0;
}

C++: #include <stdio.h>

void judge_leap_year(int a, int b);

int existance_leap_year(int a, int b);

int main(void)
{
    while(1) {
      int exist;
      int start_year, end_year;
      scanf("%d %d", &start_year, &end_year);
      if (start_year == 0 && end_year == 0) {
        break;
      } else {exist = existance_leap_year(start_year, end_year);
        if (exist == 1) {
          judge_leap_year(start_year, end_year);
        } else {
          printf("NA\n");
        }
      }
    }
    return 0;
}

void judge_leap_year(int a, int b)
{
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        printf("%d\n", year);
      } else if (year % 4 == 0 && year % 100 != 0) {
        printf("%d\n", year);
      }
    }
}
//閏年を記述する                                                                                                                                                                     

int existance_leap_year(int a, int b)
{
    int n = 0;
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        n = 1;
        break;
      } else if (year % 4 == 0 && year % 100 != 0) {
        n = 1;
        break;//一度閏年を検出した時点でループを抜ける。                                                                                                                             
      }
    }
    return n;
}
//閏年があった時、１を返す

C++: #include <stdio.h>
#include <stdbool.h>
//declaration
bool is_leap_year(int y);

int get_leap_years(int* strage, int begin, int enden);
//============end_of_declaration=============================//
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* strage, int begin, int enden)
{
    int times = 0;//count how many leap years it has.
    for(int i = begin; i <= enden; i++) {
        if(is_leap_year(i) == true) {
            *(strage + times) = i;
            times++;
        }
    }
    return times;
}

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>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

int dx[]={1, 0, -1, 0};
int dy[]={0, -1, 0, 1};

int main(){
    vector<int> a, b;
    while(1){
        int A, B; cin>>A>>B;
        if(A == 0 && B == 0) break;
        a.eb(A);
        b.eb(B);
    }

    for(int j=0; j<a.size(); j++){
        vector<int> ans;
        for(int i=a[j]; i<=b[j]; i++){
            if(i % 4 == 0){
                if(i % 100 == 0){
                    if(i % 400 == 0){
                        ans.eb(i);
                    }
                }
                else{
                    ans.eb(i);
                }
            }
        }

        if(ans.size() == 0){
            cout << "NA" << endl;
        }
        else{
            for(auto i:ans){
                cout << i << endl;
            }
        }

        if(j != a.size() - 1){
            cout << endl;
        }
    }
}

C++: #include <iostream>

using namespace std;

int main(){

    int a,b;

    while(1){

        int count = 0;

        cin >> a >> b;
        if(a == 0 && b == 0) break;

        for(int i = a; i <= b; i++){

            if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
                cout << i;
                count++;
            }

        }

        if(count == 0){
            cout << "NA";
        }

        cout << endl;
    }

    return 0;
}

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

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

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

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