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 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 i;
    for (int year = begin; year <= end; year++) {
    if (is_leap_year(year)) {
    list[i] = year;
    i++;
    }
    }
    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 <stdio.h>
	
int uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		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 0;
}
	
int main(void)
{	
	int first, end, a;
	a = 0;
	while (a == 0) {
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			printf("\n");
			a = uruu(first, end);
		}
	}
	return 0;
}

C++: #include <stdio.h>
  int main(){
	   int a,b;
	  scanf("%d%d",&a,&b);
while(1){
int i,sum=0;
for(i=a;i<=b;i++){
if(i%400==0){
printf("%d\n",i); sum++;
}else if(i%100==0){
continue;
}else if(i%4==0){
printf("%d\n",i);sum++;
}}
if(sum==0) printf("NA\n");
sum=0;
scanf("%d%d",&a,&b);
if(a==0 && b==0) break;
printf("\n");
}
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) {
        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<cstdio>
main(){int a,b,d=0,c;while(scanf("%d%d",&a,&b),a){d++&&puts("");for(c=0;a<=b;a++)if(a%4<1&&a%25||a%16<1)printf("%d\n",c=a);if(!c)puts("NA");}}

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

int z;

int leap(int year){
	if(year % 400 == 0){
		cout << year << endl;
		z++;
	}
	else if (year % 4 == 0){
		if(year % 100 != 0){
			cout << year << endl;
			z++;
		}
	}
	return 0;
}

int main(){
	int a, b;
	while(cin >> a >> b){
		if (a == 0 && b == 0) { break; }
		z = 0;
		for ( int i = a;i<=b;i++){
			leap(i);
		}
		if (z == 0){
			cout << "NA" << endl;
		}
		cout << endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int i,a,b,w,x,flg;
	scanf("%d %d",&a,&b);
	while(!(a==0 && b==0)){
		flg=0;
		for(i=a;i<=b;i++){
			if(a%4==0){
				if(a%100!=0){
					printf("%d\n",a);
					flg=1;
				}
			}
			else if(a%400==0){
				printf("%d\n",a);
				flg=1;
			}
			
			a++;
		}
		if(flg==0){
			printf("NA\n");
		}
		scanf("%d %d",&a,&b);
		if(!(a==0 && b==0)){
			printf("\n");
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

int main(){
	int a, b;
	bool f;
	while(true){
		f = false;
		cin >> a >> b ;
		if(a == 0 && b == 0) return 0;
		for (int i = a; i < b + 1; i++){
			if(isLeap(i)) {
				cout << i << endl;
				f = true;
			}
		}
		if(!f) { cout << "NA" << endl; }
		cout << endl;
	}
	return 0;
}

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

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

int main(void)
{ 
    while (true) {
        int x, y;
        bool exist = false;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0) {
            break;
        }
        for (int i = x;i <= y; ++i) {
            bool flag = judge(i);
	    if (flag == true) {
                printf("%d\n", i);
                exist = true;
        } 
        if (exist == 0) {
            printf("NA\n");
        }
        printf("\n");
           
    }
    return 0;        
}

C++: #include <iostream>

using namespace std;

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

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

int main()
{
	int a,b,c;
	while(cin >> a >> b, a||b)
	{
		c=0;
		for(int i=a; i<=b; i++)
		{
			if( (i%4==0 && i%100!=0) || (i%400==0) )
			{
				c++;
				cout << i << endl;
			}
		}
		cout << (c?"\n":"NA\n\n");
	}
}

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

int main()
{
	int a, b, cou, f;
	f = 0;
	while (cin >> a >> b){
		cou = 0;
		if (a == 0 && b == 0) break;
		for (int i = a; i <= b; i++){
			if (i % 400 == 0){
			 cout << i << endl;
			 cou++;
			}
			else if (i % 4 == 0 && i % 100){
			 cout << i << endl;
			 cou++;
			}
		}
		if (cou == 0) cout << "NA" << endl;
		cout << endl;
	}
	return (0);
}