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(){
	int a,b;
	while(cin>>a>>b){
		int c=0;
		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;
						c++;
					}else continue;
				}else{
					cout<<i<<endl;
					c++;
				}	
			}
		}
		if(c==0) cout<<"NA"<<endl;
		cout<<endl;
	}
	return 0;
}

C++: #include <array>
#include <iostream>

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

int main()
{
    do {
        int start;
        int end;

        std::cin >> start;
        std::cin >> end;

        if (start == 0 && end == 0) {
            break;
        }

        if (start >= end) {
            std::cout << "NA" << std::endl;
        }

        for (int i = start; i <= end; i++) {
            if (isLeapYear(i) == true) {
                std::cout << i << std::endl;
            }
        }

        std::cout << std::endl;

    } while (true);
}

C++: #include <iostream>
 
bool ifEndValInput(int input_n1, int input_n2);
bool inputValRangeCheck(int input_n1, int input_n2);
void printLeapYear(int start_y, int end_y);
bool isLeapYear(int year);
  
  
int main()
{
    int start_year, end_year;
    while (true) {
        std::cin >> start_year >> end_year;
        if (ifEndValInput(start_year, end_year)) {
            break;
        }
        if (inputValRangeCheck(start_year, end_year)) {
            printLeapYear(start_year, end_year);
        }
    }
    return 0;
}
 
bool ifEndValInput(int input_n1, int input_n2)
{
    if (input_n1 == 0 && input_n2 == 0) {
        return true;
    }
    return false;
}
 
bool inputValRangeCheck(int input_n1, int input_n2)
{
    if (input_n1 <= 0 || input_n1 > input_n2 || input_n2 >= 1000) {
        return false;
    }
    return true;
}
  
  
bool isLeapYear(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 printLeapYear(int start_y, int end_y)
{
    bool is_leap_year = false;
    for (int i = start_y; i <= end_y; i++) {
        if (isLeapYear(i) == true) {
            std::cout << i << std::endl;
        }
    }
}

C++: #include<stdio.h>
     
int print_leap_year(int x);
         
int main(void)
{
    int start_year, end_year, counter, dataset_number;
    dataset_number =0;
    while(1){
        scanf("%d %d", &start_year, &end_year);
        if(start_year == 0 && end_year == 0){
            break;
        }else{
            if(dataset_number){
            printf(" \n");
            }
            counter = 0;
            for(int i = start_year; i <= end_year; i++){
                counter += print_leap_year(i); 
            }
            if( counter == 0){
                printf("NA\n");
            } 
        }
    ++dataset_number; 
    }
    return 0;
}
     
     
int print_leap_year(int x)
{
    if((x % 4 == 0 && !(x % 100 == 0)) || x % 400 == 0){
        printf("%d\n", x);
        return 1;
    }
    return 0;
}

C++: #include <iostream>

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

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

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

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

C++: #include <stdio.h>
  int main(){
	  scanf("%d%d",&a,&b);
while(1){
 int a,b;
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;
}
return 0;
}

C++: #include <iostream>

bool isLeapYear(int year);
template <class Callback>
bool findLeapYears(int from, int to, Callback callback);

int main()
{
    bool is_first_data = true;
    while (true) {
        int from, to;
        std::cin >> from >> to;
        if (from == 0 && to == 0) {
            break;
        }
        if (!is_first_data) {
            std::cout << '\n';
        }
        bool leap_year_found = findLeapYears(from, to, [](int year) {
            std::cout << year << std::endl;
        });
        if (!leap_year_found) {
            std::cout << "NA" << std::endl;
        }
        is_first_data = false;
    }
    return 0;
}

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

template <class Callback>
bool findLeapYears(int from, int to, Callback callback)
{
    bool leap_year_found = false;
    for (int y = from; y <= to; ++y) {
        if (isLeapYear(y)) {
            leap_year_found = true;
            callback(y);
        }
    }
    return leap_year_found;
}

C++: #include <cstdio>

int main()
{
  int a, b;
  bool first = true;
  while (~scanf("%d %d", &a, &b)) {
    if ((a|b) == 0)
      break;

    if (!first)
      puts("");

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

    if (!found)
      puts("NA");
    first = false;
  }
  return 0;
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

bool is_uruu(int y){
  return (!(y % 4) && ((y % 100) || !(y % 400)));
}

int main() {
  int A, B;
  bool fir = true;
  while(cin >>A >>B && (A || B)){
    if(!fir) cout <<endl;
    fir = false;
    bool f = false;
    FOR(i, A, B + 1){
      if(is_uruu(i)){ f = true; cout <<i <<endl; }
    }
    if(!f) cout <<"NA" <<endl;
  }
  return 0;
}