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>

int main(){

	int a,b;
	int i;
	int answer[1000];
	int count;

	while(1){

		count = 0;

		scanf("%d %d",&a,&b);

		if(a == 0 && b == 0){
			break;
		}

		for(i = a; i < b; i++){
			if(i % 4 == 0){
				if(i % 100 != 0 || i % 400 == 0){
					answer[count] = i;
					count ++;
				}
			}
		}

		for(i = 0; i < count; i++){
			printf("%d\n",answer[i]);
		}

		if(count == 0){
			printf("NA\n");
		}
		printf("\n");
	}

	return 0;
}

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

int main(void)
{
	int a, b;
	bool x = true;
	
	while (1){
		scanf("%d %d", &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){
				printf("%d\n", i);
				x = false;
			}
		}
		if (x == true){
			printf("NA\n");
		}
		printf("\n");
		x = true;
	}
	
	return (0);
}

C++: #include <stdio.h>
#include <iostream>
 
using namespace std;
 
void uru(int c, int d) {
    int counter = 0;
 
    for (int i = c; i <= d; i++) {
        if (i % 4 == 0) {
            if (i % 100 == 0) {
                if (i % 400 == 0) {
                    cout << i << endl;
                    counter++;
                } 
            } else {
                cout << i << endl;
                counter++;
            }
        }
    }
    if (counter == 0) {
        cout << "NA" << endl;
    }
    //cout << endl;
    return;
}
 
int main() {
    int a,b;
 	bool flag=false;
    while (cin >> a >> b) {
    	if (a == 0 && b == 0) {
            break;
        }
    	if(flag) cout<<endl;
            uru(a,b);
    	flag=true;
    }
	//cout<<000000<<endl;
    return 0;
}

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

int main(void)
{
	int a, b;
	bool i = true;
	
	do{
		scanf("%d %d", &a, &b);
		while (a++ < b){
			if (a % 4 == 0 && a % 100 != 0 || a % 400 == 0){
				printf("%d\n", a);
				i = false;
			}
		}
		if (a != 0 && b != 0 && i == true){
			printf("NA\n");
		}
		i = true;
	}while (a != 0 && b != 0);
	
	return (0);
}

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

C++: #include <stdio.h>
int main(void)
{
    int start, finish;
    int exist;
    while(1){
        exist = 0;
        scanf("%d %d", &start, &finish);
        if (start == 0 && finish == 0) {
            break;
        }
        for(; start <= finish; start++) {
            if((start % 4 == 0 && start % 100 != 0) || start % 400 == 0) {
            printf("%d\n", start);
            exist = 1;
            printf("\n");
            }
        }
        if (exist == 0) {
            printf("NA\n");
        }
    }
    return 0;
}

C++: #include <stdio.h>


void uru(int year);

int j;

int main(void)
{
    while (1) {
        int a, b;
        int year;
        j = 0;
        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 R4, R100, R400;
    R4 = year % 4;
    R100 = year % 100;
    R400 = year % 400;
    if (R400 == 0 || (R4 == 0 && R100 != 0)) {
        printf("%d\n", year);
        ++j;
    }
}

C++: #include <stdio.h>

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

int main(void)
{
    int a,b;
    while(1){
        scanf("%d %d",&a,&b);
        if(a == 0 && b == 0){
            break;
        }else{
        leap(a,b);
        }
    }
    return 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;
    }

}
void printUruyear(int year_begin, int year_end)
{

    int count_year = 0;

    // 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 <iostream>
using namespace std;

int main(){
	int a,b;
	bool f;
	
	while(1){
		cin>>a>>b;
		f=false;
		if(a==0&&b==0)break;
		for(int i=a;i<=b;i++){
			if(i%4==0){
				if(i%100==0){
					if(i%400==0){
						cout<<i<<endl;
						f=true;
					}
				}
				else
				{
					cout << i << endl;
					f=true;
				}
			}
		}
		f?cout << endl:cout <<"NA" << endl <<endl;
	}
	return 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 && i % 100 == 0 && i - first <= 3 && end - i <= 3) {
			printf("NA\n");
			count = count + 1;		
		}
		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 first, end;
}
	
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 <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 <iostream>

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

int main()
{
	int a,b;
	bool first_data = true;
	while (true) {
		std::cin >> a >> b;
		
		if (a==0 && b==0) break;
		
		if (first_data) first_data = false;
		else std::cout << std::endl;
		
		bool exists = false;
		for (int year=a; year<=b; year++) {
			if (isLeap(year)) {
				exists = true;
				std::cout << year << std::endl;
			}
		}
		if (!exists) std::cout << "NA" << std::endl;
		
	}
	return 0;
}