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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	int a, b, c = 0;
	while(cin >> a >> b && (a || b))
	{
		if(c++) cout << endl;

		int flag = 0;
		REP(i, a, b + 1)
			if((i % 4 == 0 && i % 100 != 0) || i % 400 == 0)
				cout << (++flag ? i : 0 ) << endl;

		if(!flag)
			cout << "NA" << endl;
	}
}

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int a,b;
    bool start=true;
    while(cin>>a>>b&&a){
        if(start){
            start=false;
        }else cout<<endl;
        bool f=true;
        rep(i,a,b+1){
            int n=i;
            if(n%400==0){
                cout<<i<<endl;
                f=false;
            }
            else if(n%100&&n%4==0){
                cout<<i<<endl;
                f=false;
            }
        }
        if(f)cout<<"NA"<<endl;
        
    }

    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b,count;
	while(true){
	    cin>>a>>b;
		count=0;
		if(a==0&&b==0)
			break;
		bool h=false;
		for(int i=a;i<=b;i++){
			bool t=false;
			if(i%4==0)
				t=true;
			if(i%100==0)
				t=false;
			if(i%400==0)
				t=true;
			if(t==true){
				cout<<i<<endl;
				h=true;
			}
		}
		if(h==false)
			cout<<"NA"<<endl;
		cout<<endl;
	}
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
    int i,j,k,l;
    int year_f,year_l;
    bool fast_f=false;
    bool flag;

    while(cin>>year_f>>year_l,year_f&&year_l){
        flag=true;
        if(fast_f){
            cout<<endl;
        }
        fast_f=true;
        for(i=year_f;i<=year_l;i++){
            if(i%4==0&&i%100!=0||i%400==0){
                cout<<i<<endl;
                flag=false;
            }
        }
        if(flag){
            cout<<"NA"<<endl;
        }
    }
    return(0);
    
}

C++: #include <iostream>
using namespace std;
void uruu(int, bool&);

int main() {
	int a, b;
	bool not_first = false;

	while (true) {
		cin >> a >> b;
		if (a == 0 && b == 0) break;
		bool flag = true;
		
		
		if (not_first)cout << endl;

		for (int i = a;i <= b;i++) {
			uruu(i, flag);
		}
		if (flag)cout << "NA" << endl;
		not_first = true;
	}

	return 0;
}

void uruu(int year, bool& flag) {
	if (year % 400 == 0) {
		cout << year << endl;
		flag = false;
		return;
	}
	else if (year % 100 == 0) {
		return;
	}
	else if (year % 4 == 0) {
		cout << year << endl;
		flag = false;
		return;
	}
	else {
		return;
	}
}

C++: #include <iostream>
using namespace std;
bool chk(int n){
  return (n % 4 == 0) - (n%100 == 0) + (n%400 ==0);
}

int main(void){
  int a,b,res = 0;
  bool first = false;
  while(cin>>a>>b,a+b){
    bool used = false;
    for(int i = a ; i <= b ; i ++)
      if(chk(i)){
	cout<<i<<endl;
	used = true;
      }
    if(!used)cout<<"NA"<<endl;
    if(first)cout<<endl;
    first = true;
  }
}

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("NA\n");
            printf("\n");
        }else {
            leap_year(a, b);
        }
    }
    return 0;
}

void leap_year(int year1, int year2)
{   
    int limit = 0; /*もしも、うるう年がなかった時に使う*/
    for(int i = year1; i <= year2; ++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>

using namespace std;


int main(){
  int a,b,i,j;
  cin >> a >> b;
  while(a!=0 || b!=0){
    j=0;
    for(i=1;i<=3000;i++){
      if(i>=a && i<=b && i%4==0){
	if( (i%100==0 && i%400==0)  || i%100!=0 ){
	  j++;
	  cout << i << endl;
	}
      }
    }
    if(j==0){
      cout << "NA" << endl;
    }
    cout << endl;
    cin >> a >> b;
  } 

}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int a,b,c = 0;

  while( cin >> a >> b , a+b){
    int f = 1;

    if(c)cout << endl;

    for(int i = a ; i <= b ; i++){
      if(i%4 == 0){
	if(i%100 != 0 || i%400 == 0){
	  cout << i << endl;
	  f = 0;
	}
      }
    }
    if(f) cout << "NA" << endl;
    c = 1;
  }
  return 0;
}

C++: #include <iostream>


int leap_year(int y) {
	if( y % 400 == 0) {
		return 1;/*???????????´*/
	} else if (y % 100 == 0 && y % 400 != 0) {
		return 0;/*???????????´??§??????*/
	} else if (y % 4 == 0 && y % 100 != 0) {
		return 1;
	} else {
		return 0;
	}
}
int main()
{
	int a;
	int b;
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			int sum = 0;
			for (int k = a; k <= b; k++) {
				sum = sum + leap_year(k);
			}
			if (sum == 0 /*????????????????????´?????????*/) {
				std::cout << "NA" << std::endl;
			} else {
			    for (int i =a; i <= b; i++) {
					if (leap_year(i) == 1) {
						std::cout << i << std::endl;
					}
				}
			}
			std::cout << std::endl;
			std::cout << std::endl;
		}
	}
	return 0;
}