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>

using namespace std;

int main(void)
{
	int in1,in2;

	cin >> in1 >> in2;
	while(in1 | in2){
		int c = 0;
		for(int i = in1; i <= in2; i++){
			if(i % 4 == 0 && ( (i % 100 > 0 || i % 400 == 0) ) ){
				cout << i << endl;
				c++;
			}
		}
		if(c == 0)
			cout << "NA" << endl;

		cin >> in1 >> in2;
		if(in1 | in2)
			cout << 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 cnt = 0;
    int year;
    for (year = begin; year <= end; year++) {
        if (is_leap_year(year)) {
            list[cnt] = year;
            cnt++;
        }
    }

    return cnt;
}

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>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

bool isLeapYear( int n ) {
	if( n % 400 == 0 ) return true;
	if( n % 100 == 0 ) return false;
	if( n % 4 == 0 ) return true;
	return false;
}

int main(void){

	while( true ) {
		int a, b;
		bool flg = false;
		cin >> a >> b;
		if( !( a|b ) ) break;

		for( int i = a; i <= b; i++ ) {
			bool b = isLeapYear( i );
			flg |= b;
			if( b ) cout << i << endl;
		}
		if( !flg ) cout << "NA" << endl;
		cout << endl;
	}

    return 0;
}

C++: #include <iostream>
#include <cstdio>
int main(){
	int a, b;
	while(scanf("%d%d", &a, &b), a && b){
		int c = 0;
		for(;a++<=b;){
			if(a % 4 == 0){
				if(a % 100){
					if(a % 400)c++, printf("%d\n", a);
				}
				else c++, printf("%d\n", a);
			}
		}
		if(!c)puts("NA\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)
{
    while (true) {
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        leapyear(year1, year2);
    }
    return 0;
}

C++: #include <iostream>

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

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

C++: #include <stdio.h>

void print_na(int a, int b);
void leap_year(int a, int b);

int main(void)
{
    int a, b;
    scanf("%d %d", &a, &b);
    while ( a != 0 || b != 0) {
        printf("\n");
        print_na(a, b);
        leap_year(a, b);
        printf("\n");
        scanf("%d %d", &a, &b);
    }
    return 0;
}

void print_na(int a, int b)
{
    for (int i = a; i <= b; i++) {
        if ((i % 4 == 0 && !(i % 100 == 0)) || i % 400 == 0) {
            return;
        }
    }
    printf("NA\n");
}

void leap_year(int a, int b)
{
    for (int i = a; i <= b; i++) {
        if ((i % 4 == 0 && !(i % 100 == 0)) || i % 400 == 0) {
            printf("%d\n", i);
        }
    }
}

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);
     c   }
    }
    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>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
bool uru[3000];

void q93() {
	memset(uru, 0, sizeof(uru));
	for (int i = 0; i < 3000; i += 4) {
		uru[i] = true;
	}
	for (int i = 0; i < 3000; i += 100) {
		uru[i] = false;
	}
	for (int i = 0; i < 3000; i += 400) {
		uru[i] = true;
	}

	int a, b;
	for (; cin >> a >> b;) {
		if (a == b && !a) break;
		bool print_flag = false;
		for (int i = a; i <= b; i++) {
			if (uru[i]) {
				cout << i << endl;
				print_flag = true;
			}
		}
		if (!print_flag) cout << "NA" << endl;
		cout << endl;
cout << endl;
	}
}
int main() {
	q93();
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <vector>
#include <algorithm>

#define int64 long long int
using namespace std;

int main()
{
	int a, b;
	bool line, flag, year[3000]={0};
	for(int i=1; i<3000; i++){
		if(i % 4 == 0){
			if(i % 100 == 0){
				if(i % 400 == 0) year[i] = true;
				else year[i] = false;
			}else year[i] = true;
		}
	}

	line = false;
	while(1){
		cin >> a >> b;
		if(a == 0) break;

		if(line)
			cout << endl;
		line = true;

		flag = false;
		for(int i=a; i<=b; i++){
			if(year[i]){
				flag = true;
				cout << i << endl;
			}
		}
		if(!flag) cout << "NA" << endl;
	}
	return 0;
}