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>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>

#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to, weight;

	bool operator < (const Edge& obj) const {
		return weight < obj.weight;
	}
	bool operator > (const Edge& obj) const {
		return weight > obj.weight;
	}
};

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //????????\??£??????????????¨ y?????\??£?????????????????????
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //x??¨y????????????????????\??£??????????????????????????????
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int arr[100001];
void Eratosthenes(int N) {//N?????§????´???°??¨
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = i * 2; j <= N; j += i) {
				arr[j] = 0;
			}
		}
	}
}

int main()
{
	while (1) {

	int a, b;
	cin >> a >> b;

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

	int cou = 0;
	rep(i, a, b + 1) {
		if ((i % 4) == 0 && i % 100) cou++;
		else if ((i % 400) == 0) cou++;
	}
	cout << cou << endl;
	}
	return 0;
}

C++: #include <iostream>

int main() {
    int a, b, n = 0;
    std::cin >> a >> b;
    while (a != 0 && b != 0) {
        for (int i = a; i <= b; ++i) {
            if (i % 400 == 0) {
                std::cout << i << std::endl;
                n += 1;
            } else if (i % 100 != 0 && i % 4 == 0) {
                std::cout << i << std::endl;
                n += 1;
            } else  {
                continue;
            }
        }
        if (n == 0) {
            std::cout << "NA" << std::endl;
        }
        std::cin >> a >> b;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){

  int a,b;
  while( cin >> a >> b ){

    bool flag = false;
    for( int i = a ; i <= b ; i++ ){
      if( i % 4 == 0 ){
	if( i % 400 == 0 ) cout << i << endl;
	else if( i % 100 == 0 ) continue;
	else cout << i << endl;
	flag = true;
      }
    }
    if(flag) cout << endl;
    else cout << "NA" << endl << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std; 

int main()
{
	int a, b;
	
	while (cin >> a >> b, a, b){
		bool flag = false;
		
		for (a; a <= b; a++){
			if (a % 4 == 0 && a % 100 != 0 || a % 400 == 0){
				cout << a << endl;
				if (!flag){
					flag = true;
				}
			}
		}
		if (!flag){
			cout << "NA" << endl;
		}
		cout << endl;
	}
	
	return (0);
}

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

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

int main(void){
	int a,b;
	while(cin >> a >> b){
		if(a==0&&b==0)break;
		bool na = false;
		for(int i=a;i<=b;i++){
			if(isleapyear(i)){
				cout << i << "\n";
				na = true;
			}
		}
		if(!na)cout << "NA";
		cout << "\n";
	}
	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;

	while (1) {
		scanf("%d%d", &a, &b);
		if (a == 0 && b == 0) {
			break;
		} else {
			uru(a,b);
		}
	}
	cout << endl;
	return 0;
}

C++: #include <cstdio>

using namespace std;

#define YEAR_MAX 3000

bool reap[YEAR_MAX + 1];

int main()
{
	for (int i = 4; i < YEAR_MAX; i++){
		if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
			reap[i] = true;
		}
	}
	
	int a[10000], b[10000];
	bool flag;
	int num = 0;
	
	while (scanf("%d %d", &a[num], &b[num]), !(a[num] == 0 && b[num] == 0)){
		num++;
	}
	
	for (int j = 0; j < num; j++){
		flag = true;
		for (int i = a[j]; i <= b[j]; i++){
			if(reap[i]){
				printf("%d\n", i);
				flag = false;
			}
		}
		if (flag) printf("NA\n");
		puts("");
	}
}

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

using namespace std;

int main(void){

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

    int f;
    for (int i = 0; i < (b-a+1) ; i++) {
        f = 0;
        if ((a+i)%4 == 0) {
            if ((a+i)%100 == 0) {
                if ((a+i)%400 == 0) {
                    cout << a+i << endl;
                    f = 1;
                }   
                //no
            }   
            else {
                cout << a+i << endl;
                f = 1;
            }   
        }                                                                        
        else {
            //no
        }   

        if (f == 0) {
            cout << "NA" << 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)){
		w=0;
		flg=0;
		for(i=a;i<=b;i++){
			w=a%4;
			if(a%100!=0){
				if(w==0 || 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");
			printf("\n");
		}
	}
	return 0;
}

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

int main()
{
	vector<int> a;
	for(int i=1;i<4000;i++)
	{
		if(i%400!=0&&i%100==0)continue;
		if(i%4==0)a.push_back(i);
	}
	int A,B;
	bool f=false;
	while(cin>>A>>B&&A&&B)
	{
		if(f)cout<<endl;
		f=true;
		bool flag=true;
		for(int i=0;i<a.size();i++)
		{
			if(A<a[i]&&a[i]<B)
			{
				flag=false;
				cout<<a[i]<<endl;
			}
			
		}
		if(flag)cout<<"NA"<<endl;
	}
	
}