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>
#include <cstdlib>

using namespace std;

class Date{
private:
	int m_year, m_month, m_day;
	bool m_hasDate;
public:
	Date(int year, int month, int day){
//		cout<<"Date(int year, int month, int day) called"<<endl;
		this->setDate(year, month, day);
	}
	Date(){
//		cout<<"Date() called"<<endl;
		this->setDate(0,0,0);
	}
	virtual ~Date(){
//		cout<<"~Date() called"<<endl;
	}
	void setDate(int year, int month, int day){
		m_year = year; m_month = month; m_day = day;
		m_hasDate = true;
//		cout<<"setDate(int year, int month, int day) called"<<endl;
	}
	void getDate(int &year, int &month, int &day){
		year = m_year; month = m_month; day = m_day;
	}
	int isLeapYear(){
		try{
			if(!m_hasDate){ throw "Date_is_not_setted"; }
		}catch(char* str){
			return -1;
		}
		if (m_year % 400 == 0){ return true;}
		if (m_year % 100 == 0){ return false;}
		if (m_year % 4 == 0){ return true;}
		return false;
	}
};

int main(){

	int a, b;
	class Date date;
	int isLeapYear;
	int nYear;

	while(cin>>a>>b){
		if (a==0 && b==0){break;}
		nYear = 0;
		for(int i=a;i<b;++i){
			date.setDate(i,0,0);
			isLeapYear = date.isLeapYear();
			if(isLeapYear == (-1)){
				cout<<"Data is not set"<<endl;
			}
			if(isLeapYear == 1){cout<<i<<endl; ++nYear;}
		}
		if (nYear == 0){cout<<"NA"<<endl;}
		cout<<""<<endl;
	}
	return 0;
}

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

C++: #include <stdio.h>
#include <stdbool.h>
 
bool is_leap_year(int y);
int  get_leap_years(int list[], int begin, int end);
 
int main(void)
{
    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]);
            }
        }
 
    }
}

int  get_leap_years(int list[], int begin, int end)
{
    int j;
    for (int year = begin; year <= end; year++) {
    if (is_leap_year(year)) {
    list[j] = year;
    j++;
    }
    }
    return 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>

bool judgeUruyear(int year)
{

    if (year % 400 == 0) {
        return true;
    } else if (year % 100 == 0) {
        return false;
    } else if (year % 4 == 0) {
        return true;
    } else {
        return false;
    }

}
int a=0;
void printUruyear(int year_begin, int year_end)
{

    int count_year = 0;

if (a==0){std::cout << std::endl; a+=1;}

    // kono for loop no jyouken-siki ha "=" hituyou
    for (int i = year_begin; i <= year_end; i++) {
        
        if (judgeUruyear(i)) {

            count_year += 1;
            std::cout << i << std::endl;
        }    
    }

    if (count_year == 0) { 
        std::cout << "NA" << std::endl;
    }
    std::cout << std::endl;

}

int main()
{
    int year_begin, year_end;

    for (; true;) {

        std::cin >> year_begin >> year_end;

        if (year_begin == 0 && year_end == 0) {
            break;
        }

        printUruyear(year_begin, year_end);
    }
    
    return 0;
}

C++: #include<stdio.h>

void leap_year(int a, int b);

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

void leap_year(int a, int b)
{
    int count = 0;
    for (int i = a; i <= b; i++){
        int j = i;
        if (i - j / 400 * 400 == 0) { //iが４００の倍数の時
            printf("%d\n", i);
            count = + 1;
            j = i;
        } else if (!(i - j / 100 * 100 == 0)) { //iが100の倍数のでないとき
            int j = i;  
            if ( i - j / 4 * 4 == 0) {//iが四の倍数のとき
                printf("%d\n", i);
                count = + 1;                
            }
        }
    }
    if (count == 0) { //閏年が0のとき        
        printf("\nNA\n");
    }    
}

C++: #include <iostream>

using namespace std;

void solve()
{
	int a, b;
	while(cin >> a >> b, a || b)
	{
		int count = 0;
		for(int i = a; i <= b; ++i)
		{
			if(i % 4 == 0)
			{
				if(i % 100 == 0 && i % 400 == 0)
				{
					cout << i << endl;
					++count;
				}
				else if(i % 100 != 0)
				{
					cout << i << endl;
					++count;
				}
			}
		}
		if(count == 0)
		{
			cout << "NA" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(void)
{ 
    while(true){
        int x, y, a;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0){
            break;
        }
        a = 0;
        for (int i = x;i <= y; ++i){
	    if(i % 400 == 0){
                printf("%d\n", i);
                a = 1;
            }else if(i % 100 == 0){
            }else if(i % 4 == 0){
                printf("%d\n", i);
                a = 1;
            } 
        }
        if(a == 0){
            printf("NA\n");
        }
        
    }   
    return 0;        
}