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>
/*与えられた期間の間のうるう年をすべて出力*/
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 {
            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");
    }
}

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

bool is_leap_year(int y);

int get_leap_years(int* a, int b, int c);

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]);
            }
            printf("\n");
        }
        
    }
}

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* a, int b, int c)
{
    int s;
    for (int i = 0; b <= c; ++b) {        
        if (is_leap_year(b) == true) {
        a[i] = b;
        ++s;
        ++i;
        }
    }
    return s;
}

C++: #include<iostream>
int main(){for(int a,b,c,d=0;std::cin>>a>>b,a||b;){c=0;for(;a<=b;a++)if(!(a%400)||!(a%4)&&(a%100))c++?0:d?puts(""):0,std::cout<<a<<'\n';if(!c)std::cout<<"\nNA\n";d++;}}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int a, b;
bool isUruu(int year) {
    return((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}

void solve() {
    bool update = false;
    for(int r = a; r <= b; r++) {
        if(isUruu(r)){ cout << r << endl; update = true; }
    }
    if(!update) cout << "NA" << endl;
    cout << endl;
}

int main(void) {
    while(cin >> a >> b, a|b) {
        solve();
    }
    return(0);
}

C++: #include <stdio.h>

int hantei(int year);
//???????????´????????????????????????????????????

int main(void)
{
	int year[2];
	int NA;
	for(;;) {
		scanf("%d %d", &year[0], &year[1]);
		if(year[0] == 0 && year[1] == 0) {
			break;
		}
		NA = 0;
		for(int i = year[0]; i <= year[1]; i++) {
			if(hantei(i) == 1) {
			printf("%d\n", i);
			NA++;
			}
		}
		if(NA == 0) {
			printf("NA\n");
		}
	}
    printf("\n");
	return 0;
}

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

C++: #include <stdio.h>
void leaprinter(int start, int end);
int main(void){
    int year1, year2;
    while(1){
        scanf("%d%d", &year1, &year2);
        if (year1 == 0 && year2 == 0){
            break;
        }
        leaprinter(year1, year2);
        printf("\n");
    }

    
}
void leaprinter(int start, int end){
    int naflag = 1;
    for(int i = start; i <= end; i++){
        if(i % 4 == 0){
            if(i % 100 == 0){
                if(i % 400 == 0){
                    printf("%d\n", i);
                    naflag = 0;
                }
            }else {
                printf("%d\n", i);
                naflag = 0;
            }
        }
    }
    if(naflag){
        printf("NA\n");
    }
}

C++: #include <stdio.h>

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

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;
    int j;
    while (1) {
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0) {
            break;
        } else  {
            for (year = a; year < b; ++year) {
                uru(year);
            }
            if (j == 0) {
                printf("NA\n");
            }
        }
        printf("\n");
    }
    return 0;
}

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

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

void printLeapYear(int, int);
bool judgeLeapYear(int);

int main(void)
{
    int start_year, end_year;
    bool first_data = true;
    
    while (true) {
        scanf("%d%d", &start_year, &end_year);
        
        if (start_year == 0 && end_year == 0) {
            break;
        }
        
        if(first_data) {
            first_data = false;
        } else {
            printf("\n");
        }
        printLeapYear(start_year, end_year);

    }
    
    return 0;
}

void printLeapYear(int start_year, int end_year)
{
    bool exist_leap_year = false;
    
    for (int year = start_year; year <= end_year; year++) {
        if (judgeLeapYear(year)) {
            exist_leap_year = true;
            printf("%d\n", year);
        }
    }

    if(!exist_leap_year) {
        printf("NA\n");
    }
}

bool judgeLeapYear(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;
    }
}